--- /dev/null
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-01-17 10:51:35
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-01-17 10:51:38
+ * @FilePath: /1.FD230/FD230/code/sdk/application/wearable/nativeapp/nativeui/dial/include/dial_resource_image.h
+ * @Description:
+ * @
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved.
+ */
+#ifndef DIAL_RESOURCE_IMAGE_H
+#define DIAL_RESOURCE_IMAGE_H
+#include <cstdint>
+namespace OHOS
+{
+ static const int DIR_MASK = 0xfff00000;
+ static const int PNG_MASK = 0x000fffff;
+ /* -------------------------------------------------------------------------- */
+ static const int FLOWERBUD_0 = 0x100001;
+ static const int FLOWERBUD_1 = 0x100002;
+ static const int FLOWERBUD_2 = 0x100003;
+ static const int FLOWERBUD_3 = 0x100004;
+ static const int FLOWERBUD_4 = 0x100005;
+ static const int FLOWERBUD_5 = 0x100006;
+ static const int FLOWERBUD_6 = 0x100007;
+ static const int FLOWERBUD_7 = 0x100008;
+ static const int FLOWERBUD_8 = 0x100009;
+ static const int FLOWERBUD_9 = 0x10000a;
+ static const int FLOWERBUD_BACKGROUND = 0x10000b;
+ static const int FLOWERBUD_EIGHT = 0x10000c;
+ static const int FLOWERBUD_FIVE = 0x10000d;
+ static const int FLOWERBUD_FOUR = 0x10000e;
+ static const int FLOWERBUD_NINE = 0x10000f;
+ static const int FLOWERBUD_ONE = 0x100010;
+ static const int FLOWERBUD_POINT = 0x100011;
+ static const int FLOWERBUD_SEVEN = 0x100012;
+ static const int FLOWERBUD_SIX = 0x100013;
+ static const int FLOWERBUD_THREE = 0x100014;
+ static const int FLOWERBUD_TWO = 0x100015;
+ static const int FLOWERBUD_ZERO = 0x100016;
+ /* -------------------------------------------------------------------------- */
+ static const int KUMI_0 = 0x200001;
+ static const int KUMI_1 = 0x200002;
+ static const int KUMI_2 = 0x200003;
+ static const int KUMI_3 = 0x200004;
+ static const int KUMI_4 = 0x200005;
+ static const int KUMI_5 = 0x200006;
+ static const int KUMI_6 = 0x200007;
+ static const int KUMI_7 = 0x200008;
+ static const int KUMI_8 = 0x200009;
+ static const int KUMI_9 = 0x20000a;
+ static const int KUMI_BACKGROUND = 0x20000b;
+ static const int KUMI_POINT = 0x20000c;
+ /* -------------------------------------------------------------------------- */
+ static const int MALIAO_0 = 0x300001;
+ static const int MALIAO_1 = 0x300002;
+ static const int MALIAO_2 = 0x300003;
+ static const int MALIAO_3 = 0x300004;
+ static const int MALIAO_4 = 0x300005;
+ static const int MALIAO_5 = 0x300006;
+ static const int MALIAO_6 = 0x300007;
+ static const int MALIAO_7 = 0x300008;
+ static const int MALIAO_8 = 0x300009;
+ static const int MALIAO_9 = 0x30000a;
+ static const int MALIAO_BACKGROUND = 0x30000b;
+ static const int MALIAO_POINT = 0x30000c;
+ static const int MAOMAO_0 = 0x400001;
+ static const int MAOMAO_1 = 0x400002;
+ static const int MAOMAO_2 = 0x400003;
+ static const int MAOMAO_3 = 0x400004;
+ static const int MAOMAO_4 = 0x400005;
+ static const int MAOMAO_5 = 0x400006;
+ static const int MAOMAO_6 = 0x400007;
+ static const int MAOMAO_7 = 0x400008;
+ static const int MAOMAO_8 = 0x400009;
+ static const int MAOMAO_9 = 0x40000a;
+ static const int MAOMAO_POINT = 0x40000b;
+ /* -------------------------------------------------------------------------- */
+ static const int BACKGROUND_1 = 0x500001;
+ static const int BACKGROUND_10 = 0x500002;
+ static const int BACKGROUND_100 = 0x500003;
+ static const int BACKGROUND_101 = 0x500004;
+ static const int BACKGROUND_102 = 0x500005;
+ static const int BACKGROUND_103 = 0x500006;
+ static const int BACKGROUND_104 = 0x500007;
+ static const int BACKGROUND_105 = 0x500008;
+ static const int BACKGROUND_106 = 0x500009;
+ static const int BACKGROUND_107 = 0x50000a;
+ static const int BACKGROUND_108 = 0x50000b;
+ static const int BACKGROUND_109 = 0x50000c;
+ static const int BACKGROUND_11 = 0x50000d;
+ static const int BACKGROUND_110 = 0x50000e;
+ static const int BACKGROUND_111 = 0x50000f;
+ static const int BACKGROUND_112 = 0x500010;
+ static const int BACKGROUND_113 = 0x500011;
+ static const int BACKGROUND_114 = 0x500012;
+ static const int BACKGROUND_115 = 0x500013;
+ static const int BACKGROUND_116 = 0x500014;
+ static const int BACKGROUND_117 = 0x500015;
+ static const int BACKGROUND_118 = 0x500016;
+ static const int BACKGROUND_119 = 0x500017;
+ static const int BACKGROUND_12 = 0x500018;
+ static const int BACKGROUND_120 = 0x500019;
+ static const int BACKGROUND_121 = 0x50001a;
+ static const int BACKGROUND_122 = 0x50001b;
+ static const int BACKGROUND_123 = 0x50001c;
+ static const int BACKGROUND_124 = 0x50001d;
+ static const int BACKGROUND_125 = 0x50001e;
+ static const int BACKGROUND_126 = 0x50001f;
+ static const int BACKGROUND_127 = 0x500020;
+ static const int BACKGROUND_128 = 0x500021;
+ static const int BACKGROUND_129 = 0x500022;
+ static const int BACKGROUND_13 = 0x500023;
+ static const int BACKGROUND_130 = 0x500024;
+ static const int BACKGROUND_131 = 0x500025;
+ static const int BACKGROUND_132 = 0x500026;
+ static const int BACKGROUND_133 = 0x500027;
+ static const int BACKGROUND_134 = 0x500028;
+ static const int BACKGROUND_135 = 0x500029;
+ static const int BACKGROUND_136 = 0x50002a;
+ static const int BACKGROUND_137 = 0x50002b;
+ static const int BACKGROUND_138 = 0x50002c;
+ static const int BACKGROUND_139 = 0x50002d;
+ static const int BACKGROUND_14 = 0x50002e;
+ static const int BACKGROUND_140 = 0x50002f;
+ static const int BACKGROUND_141 = 0x500030;
+ static const int BACKGROUND_142 = 0x500031;
+ static const int BACKGROUND_143 = 0x500032;
+ static const int BACKGROUND_144 = 0x500033;
+ static const int BACKGROUND_145 = 0x500034;
+ static const int BACKGROUND_146 = 0x500035;
+ static const int BACKGROUND_147 = 0x500036;
+ static const int BACKGROUND_148 = 0x500037;
+ static const int BACKGROUND_149 = 0x500038;
+ static const int BACKGROUND_15 = 0x500039;
+ static const int BACKGROUND_150 = 0x50003a;
+ static const int BACKGROUND_151 = 0x50003b;
+ static const int BACKGROUND_152 = 0x50003c;
+ static const int BACKGROUND_153 = 0x50003d;
+ static const int BACKGROUND_154 = 0x50003e;
+ static const int BACKGROUND_155 = 0x50003f;
+ static const int BACKGROUND_156 = 0x500040;
+ static const int BACKGROUND_157 = 0x500041;
+ static const int BACKGROUND_158 = 0x500042;
+ static const int BACKGROUND_159 = 0x500043;
+ static const int BACKGROUND_16 = 0x500044;
+ static const int BACKGROUND_160 = 0x500045;
+ static const int BACKGROUND_161 = 0x500046;
+ static const int BACKGROUND_162 = 0x500047;
+ static const int BACKGROUND_163 = 0x500048;
+ static const int BACKGROUND_164 = 0x500049;
+ static const int BACKGROUND_165 = 0x50004a;
+ static const int BACKGROUND_166 = 0x50004b;
+ static const int BACKGROUND_167 = 0x50004c;
+ static const int BACKGROUND_168 = 0x50004d;
+ static const int BACKGROUND_169 = 0x50004e;
+ static const int BACKGROUND_17 = 0x50004f;
+ static const int BACKGROUND_170 = 0x500050;
+ static const int BACKGROUND_171 = 0x500051;
+ static const int BACKGROUND_172 = 0x500052;
+ static const int BACKGROUND_173 = 0x500053;
+ static const int BACKGROUND_174 = 0x500054;
+ static const int BACKGROUND_175 = 0x500055;
+ static const int BACKGROUND_176 = 0x500056;
+ static const int BACKGROUND_177 = 0x500057;
+ static const int BACKGROUND_178 = 0x500058;
+ static const int BACKGROUND_179 = 0x500059;
+ static const int BACKGROUND_18 = 0x50005a;
+ static const int BACKGROUND_180 = 0x50005b;
+ static const int BACKGROUND_181 = 0x50005c;
+ static const int BACKGROUND_182 = 0x50005d;
+ static const int BACKGROUND_183 = 0x50005e;
+ static const int BACKGROUND_184 = 0x50005f;
+ static const int BACKGROUND_185 = 0x500060;
+ static const int BACKGROUND_186 = 0x500061;
+ static const int BACKGROUND_187 = 0x500062;
+ static const int BACKGROUND_188 = 0x500063;
+ static const int BACKGROUND_189 = 0x500064;
+ static const int BACKGROUND_19 = 0x500065;
+ static const int BACKGROUND_190 = 0x500066;
+ static const int BACKGROUND_191 = 0x500067;
+ static const int BACKGROUND_192 = 0x500068;
+ static const int BACKGROUND_193 = 0x500069;
+ static const int BACKGROUND_194 = 0x50006a;
+ static const int BACKGROUND_195 = 0x50006b;
+ static const int BACKGROUND_196 = 0x50006c;
+ static const int BACKGROUND_197 = 0x50006d;
+ static const int BACKGROUND_198 = 0x50006e;
+ static const int BACKGROUND_199 = 0x50006f;
+ static const int BACKGROUND_2 = 0x500070;
+ static const int BACKGROUND_20 = 0x500071;
+ static const int BACKGROUND_200 = 0x500072;
+ static const int BACKGROUND_201 = 0x500073;
+ static const int BACKGROUND_202 = 0x500074;
+ static const int BACKGROUND_203 = 0x500075;
+ static const int BACKGROUND_204 = 0x500076;
+ static const int BACKGROUND_205 = 0x500077;
+ static const int BACKGROUND_21 = 0x500078;
+ static const int BACKGROUND_22 = 0x500079;
+ static const int BACKGROUND_23 = 0x50007a;
+ static const int BACKGROUND_24 = 0x50007b;
+ static const int BACKGROUND_25 = 0x50007c;
+ static const int BACKGROUND_26 = 0x50007d;
+ static const int BACKGROUND_27 = 0x50007e;
+ static const int BACKGROUND_28 = 0x50007f;
+ static const int BACKGROUND_29 = 0x500080;
+ static const int BACKGROUND_3 = 0x500081;
+ static const int BACKGROUND_30 = 0x500082;
+ static const int BACKGROUND_31 = 0x500083;
+ static const int BACKGROUND_32 = 0x500084;
+ static const int BACKGROUND_33 = 0x500085;
+ static const int BACKGROUND_34 = 0x500086;
+ static const int BACKGROUND_35 = 0x500087;
+ static const int BACKGROUND_36 = 0x500088;
+ static const int BACKGROUND_37 = 0x500089;
+ static const int BACKGROUND_38 = 0x50008a;
+ static const int BACKGROUND_39 = 0x50008b;
+ static const int BACKGROUND_4 = 0x50008c;
+ static const int BACKGROUND_40 = 0x50008d;
+ static const int BACKGROUND_41 = 0x50008e;
+ static const int BACKGROUND_42 = 0x50008f;
+ static const int BACKGROUND_43 = 0x500090;
+ static const int BACKGROUND_44 = 0x500091;
+ static const int BACKGROUND_45 = 0x500092;
+ static const int BACKGROUND_46 = 0x500093;
+ static const int BACKGROUND_47 = 0x500094;
+ static const int BACKGROUND_48 = 0x500095;
+ static const int BACKGROUND_49 = 0x500096;
+ static const int BACKGROUND_5 = 0x500097;
+ static const int BACKGROUND_50 = 0x500098;
+ static const int BACKGROUND_51 = 0x500099;
+ static const int BACKGROUND_52 = 0x50009a;
+ static const int BACKGROUND_53 = 0x50009b;
+ static const int BACKGROUND_54 = 0x50009c;
+ static const int BACKGROUND_55 = 0x50009d;
+ static const int BACKGROUND_56 = 0x50009e;
+ static const int BACKGROUND_57 = 0x50009f;
+ static const int BACKGROUND_58 = 0x5000a0;
+ static const int BACKGROUND_59 = 0x5000a1;
+ static const int BACKGROUND_6 = 0x5000a2;
+ static const int BACKGROUND_60 = 0x5000a3;
+ static const int BACKGROUND_61 = 0x5000a4;
+ static const int BACKGROUND_62 = 0x5000a5;
+ static const int BACKGROUND_63 = 0x5000a6;
+ static const int BACKGROUND_64 = 0x5000a7;
+ static const int BACKGROUND_65 = 0x5000a8;
+ static const int BACKGROUND_66 = 0x5000a9;
+ static const int BACKGROUND_67 = 0x5000aa;
+ static const int BACKGROUND_68 = 0x5000ab;
+ static const int BACKGROUND_69 = 0x5000ac;
+ static const int BACKGROUND_7 = 0x5000ad;
+ static const int BACKGROUND_70 = 0x5000ae;
+ static const int BACKGROUND_71 = 0x5000af;
+ static const int BACKGROUND_72 = 0x5000b0;
+ static const int BACKGROUND_73 = 0x5000b1;
+ static const int BACKGROUND_74 = 0x5000b2;
+ static const int BACKGROUND_75 = 0x5000b3;
+ static const int BACKGROUND_76 = 0x5000b4;
+ static const int BACKGROUND_77 = 0x5000b5;
+ static const int BACKGROUND_78 = 0x5000b6;
+ static const int BACKGROUND_79 = 0x5000b7;
+ static const int BACKGROUND_8 = 0x5000b8;
+ static const int BACKGROUND_80 = 0x5000b9;
+ static const int BACKGROUND_81 = 0x5000ba;
+ static const int BACKGROUND_82 = 0x5000bb;
+ static const int BACKGROUND_83 = 0x5000bc;
+ static const int BACKGROUND_84 = 0x5000bd;
+ static const int BACKGROUND_85 = 0x5000be;
+ static const int BACKGROUND_86 = 0x5000bf;
+ static const int BACKGROUND_87 = 0x5000c0;
+ static const int BACKGROUND_88 = 0x5000c1;
+ static const int BACKGROUND_89 = 0x5000c2;
+ static const int BACKGROUND_9 = 0x5000c3;
+ static const int BACKGROUND_90 = 0x5000c4;
+ static const int BACKGROUND_91 = 0x5000c5;
+ static const int BACKGROUND_92 = 0x5000c6;
+ static const int BACKGROUND_93 = 0x5000c7;
+ static const int BACKGROUND_94 = 0x5000c8;
+ static const int BACKGROUND_95 = 0x5000c9;
+ static const int BACKGROUND_96 = 0x5000ca;
+ static const int BACKGROUND_97 = 0x5000cb;
+ static const int BACKGROUND_98 = 0x5000cc;
+ static const int BACKGROUND_99 = 0x5000cd;
+ /* -------------------------------------------------------------------------- */
+ static const int MOMO_BACKGROUND = 0x600001;
+ static const int MOMO_HOUR = 0x600002;
+ static const int MOMO_MINUTE = 0x600003;
+ static const int MOMO_SECOND = 0x600004;
+ /* -------------------------------------------------------------------------- */
+ static const int REDUCED_GRAPH_FLOWERBUD = 0x700001;
+ static const int REDUCED_GRAPH_KUMI = 0x700002;
+ static const int REDUCED_GRAPH_MALIAO = 0x700003;
+ static const int REDUCED_GRAPH_MAOMAO = 0x700004;
+ /* -------------------------------------------------------------------------- */
+
+} // OHOS
+#endif // UI_RESOURCE_IMAGE_H
#include "uapi/linux/rtc.h"
#include <iostream>
#include <sstream>
+#include "common/image_cache_manager.h"
#include "MainViewSample.h"
}
return false; // 其他情况
}
+ /**
+ * @brief 初始化UIImageAnimatorView,并设置为GIF动画。
+ *
+ * 该函数用于使用提供的GIF图像和属性初始化UIImageAnimatorView。
+ *
+ * @param imageAnimator 要初始化的UIImageAnimatorView对象的引用。
+ * @param paths GIF图像文件路径的数组。
+ * @param numFrames GIF中的帧数。
+ * @param left 视图的左侧位置。
+ * @param top 视图的顶部位置。
+ * @param width 视图的宽度。
+ * @param height 视图的高度。
+ * @param viewId 视图的ID。
+ * @param time 视图的帧速
+ * @return 如果初始化成功则返回true,否则返回false。
+ */
+ void Digital_clockView::InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId, int time)
+ {
+ if (imageAnimator == nullptr)
+ {
+ imageAnimator = new UIImageAnimatorView();
+ }
+ imageAnimator->SetPosition(left, top);
+ imageAnimator->Resize(width, height);
+ imageAnimator->SetViewId(viewId);
+ imageAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ imageAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+
+ ImageAnimatorInfo *imageAnimatorInfo = new ImageAnimatorInfo[numFrames];
+ for (int i = 0; i < numFrames; i++)
+ {
+ imageAnimatorInfo[i].imagePath = imagePaths[i];
+ imageAnimatorInfo[i].pos.x = left;
+ imageAnimatorInfo[i].pos.y = top;
+ imageAnimatorInfo[i].width = width;
+ imageAnimatorInfo[i].height = height;
+ imageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH;
+ }
+
+ imageAnimator->SetImageAnimatorSrc(imageAnimatorInfo, numFrames, time); // 200 is the default delay time
+ imageAnimator->SetTimeOfPause(time);
+ imageAnimator->SetRepeatTimes(1);
+ imageAnimator->SetReverse(true);
+ imageAnimator->SetVisible(true);
+ }
/**
* @description: 初始化背景
* @return 初始化背景是否成功
{
// Handle GIF animation
// Add code to set the background as a GIF animation
- if (p_TraingWinView == nullptr)
- {
- p_TraingWinView = new TraingWinView();
- }
-
cJSON *size = cJSON_GetObjectItem(background_cjson, "size");
cJSON *coordinates = cJSON_GetObjectItem(background_cjson, "coordinates");
int background_count = cJSON_GetObjectItem(background_cjson, "background_count")->valueint;
int background_width = cJSON_GetObjectItem(size, "width")->valueint;
int background_height = cJSON_GetObjectItem(size, "height")->valueint;
imagePaths = CreateImagePathsArray(backgroundimagesPath.c_str(), "bin", background_count);
- p_TraingWinView->InitImageAnimatorSource(backgroundAnimator, imagePaths, background_count, background_left, background_top,
- background_width, background_height, "imageAnimator1", background_FPS);
+
+ InitImageAnimatorSource(backgroundAnimator, imagePaths, background_count, background_left, background_top,
+ background_width, background_height, "imageAnimator1", background_FPS);
}
else
{
if (fileExtension == "bin")
{
// Handle static image
- background->SetSrc(backgroundimagesPath.c_str());
+ ImageInfo *img = ImageCacheManager::GetInstance().LoadSingleRes(backgroundimagesPath.c_str());
+ background->SetSrc(img);
}
else if (fileExtension == "mp4")
{
ostMin << local_time.tm_min;
std::string weekStr = ostrHour.str() + ":" + ostMin.str();
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "time = %s!", weekStr.c_str());
- printf("weekStr:%s\n",weekStr.c_str());
+ printf("weekStr:%s\n", weekStr.c_str());
/* -------------------------------------------------------------------------- */
- stringtime = "11:35";
+ stringtime = "20:10";
// updateClockTime(stringtime);
cJSON *digits = cJSON_GetObjectItem(cjson_json, "digits");
}
}
+ /***
+ * @description: 加载
+ * @return {*}
+ */
void Digital_clockView::PreLoad(void)
{
- if (InitView())
+ if (!viewiInitStatus)
{
- viewiInitStatus = true;
+ InitView();
}
}
void Digital_clockView::UnLoad(void)
{
+ // ImageCacheManager::GetInstance().UnloadSingleRes(RES_PATH"breath.bin");
}
}