From: Caisking <3449750381@qq.com> Date: Wed, 20 Dec 2023 08:10:41 +0000 (+0800) Subject: 增加GIF函数,增加帧速参数 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=7ddf5a355fb7037189fc4de0b74729f22cbf1540;p=mirrors%2FFD230.git 增加GIF函数,增加帧速参数 --- diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingWinView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingWinView.h index 9f8d8a5b6..0fc9d8fda 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingWinView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingWinView.h @@ -38,7 +38,7 @@ namespace OHOS void InitView(); void DeInit(); - void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId); + void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId,int time); void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize); void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId); void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingWinView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingWinView.cpp index 56cedb7f8..6b16ccd90 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingWinView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingWinView.cpp @@ -163,9 +163,10 @@ namespace OHOS * @param width 视图的宽度。 * @param height 视图的高度。 * @param viewId 视图的ID。 + * @param time 视图的帧速 * @return 如果初始化成功则返回true,否则返回false。 */ - void TraingWinView::InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId) + void TraingWinView::InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId, int time) { if (imageAnimator == nullptr) { @@ -188,8 +189,8 @@ namespace OHOS imageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; } - imageAnimator->SetImageAnimatorSrc(imageAnimatorInfo, numFrames, 10); // 200 is the default delay time - imageAnimator->SetTimeOfPause(10); + imageAnimator->SetImageAnimatorSrc(imageAnimatorInfo, numFrames, time); // 200 is the default delay time + imageAnimator->SetTimeOfPause(time); imageAnimator->SetRepeatTimes(1); imageAnimator->SetReverse(true); imageAnimator->SetVisible(true); @@ -226,9 +227,9 @@ namespace OHOS const char *basePath = "/user/res/Training/win/"; const char *fileExtension = "bin"; const char **imagePaths = CreateImagePathsArray(basePath, fileExtension, 94); - InitImageAnimatorSource(imageAnimator, imagePaths, 94, 173, 100, 120, 120, "imageAnimator1"); + InitImageAnimatorSource(imageAnimator, imagePaths, 94, 173, 100, 120, 120, "imageAnimator1", 10); container_->Add(imageAnimator); - //FreeImagePathsArray(imagePaths, 94); //删除数组,释放内存 + // FreeImagePathsArray(imagePaths, 94); //删除数组,释放内存 // 初始化Button InitButton(button1_, 0, 366, 466, 100, BUTTONOK);