增加GIF函数,增加帧速参数
authorCaisking <3449750381@qq.com>
Wed, 20 Dec 2023 08:10:41 +0000 (16:10 +0800)
committerCaisking <3449750381@qq.com>
Wed, 20 Dec 2023 08:10:41 +0000 (16:10 +0800)
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingWinView.h
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingWinView.cpp

index 9f8d8a5..0fc9d8f 100644 (file)
@@ -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);
index 56cedb7..6b16ccd 100644 (file)
@@ -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);