修改表盘工具为2.0版本
authorCaisking <Casiking@zhihuishixun.com>
Fri, 27 Jun 2025 06:56:33 +0000 (14:56 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Fri, 27 Jun 2025 06:56:33 +0000 (14:56 +0800)
21 files changed:
tools/dial_converter_tool/README.txt
tools/dial_converter_tool/converter.py
tools/dial_converter_tool/dial_arc_label.py
tools/dial_converter_tool/dial_arc_progress.py
tools/dial_converter_tool/dial_box_progress.py
tools/dial_converter_tool/dial_click.py
tools/dial_converter_tool/dial_digital_img.py
tools/dial_converter_tool/dial_kaleidoscope.py
tools/dial_converter_tool/dial_label.py
tools/dial_converter_tool/dial_option_img.py
tools/dial_converter_tool/dial_rotate_img.py
tools/dial_converter_tool/dial_sequence_img.py
tools/dial_converter_tool/dial_static_img.py
tools/dial_converter_tool/dial_video.py
tools/dial_converter_tool/dll/linux_cs/libcodec.so
tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.dll
tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.lib
tools/dial_converter_tool/img_convert.py
tools/dial_converter_tool/instance/114/obsidianrhythm.xml
tools/dial_converter_tool/out/obsidianrhythm.bin [new file with mode: 0644]
tools/dial_converter_tool/视频表盘制作变更.txt [deleted file]

index 58d2c0f..fb9b83a 100644 (file)
@@ -1,10 +1,10 @@
 usage: main.py [-h] [-file FILE] [-dir DIR] [-output OUTPUT]\r
 \r
 options:\r
-  -h, --help           show this help message and exit\r
-  -file FILE, -f FILE  The svg file need to be converted.\r
-  -dir DIR, -d DIR     The directory needs to be converted.\r
-  -output OUTPUT       output dir\r
+  -h, --help           显示帮助信息。\r
+  -file FILE, -f FILE  指定待转化的离线表盘xml文件路径。\r
+  -dir DIR, -d DIR     指定待转化的文件夹路径。根据指定路径,转化文件夹下所有xml文件。\r
+  -output OUTPUT       指定转化后离线表盘打包资源所在路径\r
 \r
 example:\r
 windows: python .\main.py -dir .\instance\analogue_dial\r
index 502ed35..67b5ff0 100644 (file)
@@ -4,6 +4,7 @@ import os
 import re\r
 import struct\r
 import ctypes\r
+import sys\r
 from ctypes import *\r
 import xml.sax\r
 from enum import Enum\r
@@ -33,12 +34,18 @@ class DialHeader(Structure):
         ('imgoffset', c_uint),\r
         ('period', c_ubyte),\r
         ('dialViewCount', c_ubyte),\r
+        ('displayCapabiliy', c_ubyte),\r
+        ('ambientPeriod', c_ubyte),\r
     ]\r
+    _DIAL_DEFAULT_MAX_WIDTH = 960\r
+    _DIAL_DEFAULT_MAX_HEIGHT = 960\r
 \r
     def __init__(self):\r
         self.imgoffset = 0\r
         self.dialViewCount = 0\r
         self.period = 0\r
+        self.displayCapabiliy = 0\r
+        self.ambientPeriod = 0\r
         self.viewType = []\r
         self.viewPt = []\r
 \r
@@ -49,21 +56,25 @@ class DialHeader(Structure):
         description = attributes["description"]\r
         self.description = bytes(description, encoding = "utf8")\r
 \r
-        size = attributes["size"]\r
-        width,height = size.split(' ')\r
-        self.width = int(width)\r
-        self.height = int(height)\r
-\r
         version = attributes["version"]\r
         self.version = bytes(version, encoding = "utf8")\r
 \r
+        self._parse_size_attr(attributes["size"])\r
+\r
         previewStr = attributes["preview_img"]\r
         self.previewImgId = img_convert.instance.convert_img(previewStr)\r
 \r
         for attr in attributes.getNames():\r
             if attr == "tile_width":\r
                 tile_width = int(attributes["tile_width"])\r
-                img_conver.instance.set_tile_width(tile_width)\r
+                img_convert.instance.set_tile_width(tile_width)\r
+            elif attr == "ambient_period":\r
+                period_suppor_value = {1, 10, 30, 60}\r
+                self.ambientPeriod = int(attributes["ambient_period"])\r
+                if self.ambientPeriod not in period_suppor_value:\r
+                    self.ambientPeriod = 0\r
+                    print("[WARNING]:label image period value not support, using defalut value 0")\r
+\r
 \r
     def add_view(self, viewObj, viewType):\r
         self.viewPt.append(viewObj)\r
@@ -79,6 +90,20 @@ class DialHeader(Structure):
     def get_size(self):\r
         return sizeof(self) + sizeof(c_ubyte) * self.dialViewCount\r
 \r
+    def _parse_size_attr(self, input_size):\r
+        input_width,input_height = input_size.split(' ')\r
+        width = int(input_width)\r
+        if width <= 0 or width > DialHeader._DIAL_DEFAULT_MAX_WIDTH :\r
+            print(f"[ERR]:dial size width out of range, (0, {DialHeader._DIAL_DEFAULT_MAX_WIDTH}], value:{width}")\r
+            sys.exit(1)\r
+        self.width = width\r
+\r
+        height = int(input_height)\r
+        if height <= 0 or height > DialHeader._DIAL_DEFAULT_MAX_HEIGHT :\r
+            print(f"[ERR]:dial size height out of range, (0, {DialHeader._DIAL_DEFAULT_MAX_HEIGHT}], value:{height}")\r
+            sys.exit(1)\r
+        self.height = height\r
+\r
 class DialConvertTool(xml.sax.ContentHandler):\r
     parser = xml.sax.make_parser()\r
     DIAL_STATIC_IMG_TYPE = 0\r
@@ -170,10 +195,24 @@ class DialConvertTool(xml.sax.ContentHandler):
 \r
     def _write_data_to_bin(self, fb):\r
         self.header.imgoffset += self.header.get_size()\r
+        aod_only, normal_only = 0, 0\r
         for view in self.header.viewPt:\r
             if self.header.period < view.period:\r
                 self.header.period = view.period\r
+            if view.displayMode == 1:\r
+                aod_only = aod_only + 1\r
+            elif view.displayMode == 2:\r
+                aod_only = aod_only + 1\r
+                normal_only = normal_only + 1\r
+            else:\r
+                normal_only = normal_only + 1\r
             self.header.imgoffset += view.get_size()\r
+        if normal_only > 0 and aod_only > 0:\r
+            self.header.displayCapabiliy = 2\r
+        elif normal_only > 0 and aod_only == 0:\r
+            self.header.displayCapabiliy = 0\r
+        else:\r
+            self.header.displayCapabiliy = 1\r
 \r
         fb.write(self.header.get_bytes())\r
         for view in self.header.viewPt:\r
index 5f493fa..1d3ac7e 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Point\r
@@ -18,11 +19,15 @@ class DialArcLabel(Structure):
         ('fontName', c_char * 64),\r
         ('text', c_char * 64),\r
         ('bindData', c_short),\r
-        ('isPeriod', c_bool)\r
+        ('isPeriodic', c_bool),\r
+        ('displayMode', c_ubyte),\r
+        ('isAmbientPeriodic', c_bool)\r
     ]\r
     def __init__(self):\r
         self.period = 0\r
-        self.isPeriod = False\r
+        self.isPeriodic = False\r
+        self.displayMode = 0\r
+        self.isAmbientPeriodic = False\r
 \r
     def parse_attributes(self, attributes):\r
         alignStr = attributes["align"]\r
@@ -34,30 +39,70 @@ class DialArcLabel(Structure):
             self.align = 2\r
         elif alignStr == "right":\r
             self.align = 1\r
+        elif alignStr == "left":\r
+            self.align = 0\r
         else:\r
             self.align = 0\r
+            print("[WARNING] arc label align value input error, using defalut value")\r
 \r
         self.fontSize = int(attributes["font_size"])\r
+        if self.fontSize < np.iinfo(np.int16).min or self.fontSize > np.iinfo(np.int16).max:\r
+            print("[ERR]:label font size out of range")\r
+            sys.exit(1)\r
 \r
         x,y = attributes["center"].split(" ")\r
         self.center.x = int(x)\r
+        if self.center.x < np.iinfo(np.int16).min or self.center.x > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc label center x out of range")\r
+            sys.exit(1)\r
         self.center.y = int(y)\r
+        if self.center.y < np.iinfo(np.int16).min or self.center.y > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc label center y out of range")\r
+            sys.exit(1)\r
 \r
         self.radius = int(attributes["radius"])\r
+        if self.radius < 0 or self.radius > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc label radius out of range")\r
+            sys.exit(1)\r
+\r
         self.rotateStart = int(attributes["start_angle"])\r
         self.rotaeteEnd = int(attributes["end_angle"])\r
+\r
         self.color = int(attributes["color"], 16)\r
         self.fontName = bytes(attributes["font"], encoding = "utf8")\r
         self.text = bytes(attributes["text"], encoding = "utf8")\r
         for attr in attributes.getNames():\r
             if attr == "bind_data":\r
                 self.bindData = int(attributes["bind_data"])\r
+                if self.bindData < 0 or self.bindData > np.iinfo(np.int16).max:\r
+                    print("[ERR]:arc label bind data out of range")\r
+                    sys.exit(1)\r
             elif attr == "period":\r
+                period_suppor_value = {1, 10, 30, 60}\r
                 self.period = int(attributes["period"])\r
-                if self.period != 0:\r
-                    self.isPeriod = True\r
-        if self.isPeriod != 0 and self.bindData == 0:\r
-            print("[ERROR]:[bind_data] is not set, [period] cannot be set")\r
+                if self.period == 0:\r
+                    self.isPeriodic = False\r
+                elif self.period not in period_suppor_value:\r
+                    self.period = 0\r
+                    print("[WARNING]:arc label period value not support, using defalut value 0")\r
+                else:\r
+                    self.isPeriodic = True\r
+\r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+        if self.displayMode != 0 :\r
+            if "ambient_periodic" in attributes.getNames():\r
+                if attributes["ambient_periodic"] == "true":\r
+                    self.isAmbientPeriodic = True\r
+\r
+        if self.isPeriodic != 0 and self.bindData == 0:\r
+            print("[ERR]:[bind_data] is not set, [period] cannot be set")\r
             sys.exit(1)\r
 \r
     def get_bytes(self):\r
index 1ee9f56..338c5c8 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Rect\r
@@ -18,7 +19,7 @@ class ProgressUnion(Union):
 class DialArcProgress(Structure):\r
     _fields_ = [\r
         ('cap', c_ubyte),\r
-        ('isPeriod', c_bool),\r
+        ('isPeriodic', c_bool),\r
         ('radius', c_ushort),\r
         ('startAngle', c_ushort),\r
         ('endAngle', c_ushort),\r
@@ -27,20 +28,36 @@ class DialArcProgress(Structure):
         ('bgColor', c_uint),\r
         ('type', c_ubyte),\r
         ('rect', Rect),\r
-        ('unionValue', ProgressUnion)\r
+        ('unionValue', ProgressUnion),\r
+        ('displayMode', c_ubyte),\r
+        ('isAmbientPeriodic', c_bool)\r
     ]\r
 \r
     def __init__(self):\r
         self.stop = []\r
         self.period = 0\r
-        self.isPeriod = False\r
+        self.isPeriodic = False\r
+        self.displayMode = 0\r
+        self.isAmbientPeriodic = False\r
 \r
     def parse_attributes(self, attributes):\r
         x,y,w,h = attributes["rect"].split(" ")\r
         self.rect.x = int(x)\r
+        if self.rect.x < np.iinfo(np.int16).min or self.rect.x > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc progress rect x out of range")\r
+            sys.exit(1)\r
         self.rect.y = int(y)\r
+        if self.rect.y < np.iinfo(np.int16).min or self.rect.y > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc progress rect y out of range")\r
+            sys.exit(1)\r
         self.rect.w = int(w)\r
+        if self.rect.w < np.iinfo(np.int16).min or self.rect.w > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc progress rect w out of range")\r
+            sys.exit(1)\r
         self.rect.h = int(h)\r
+        if self.rect.h < np.iinfo(np.int16).min or self.rect.h > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc progress rect h out of range")\r
+            sys.exit(1)\r
 \r
         cap = attributes["cap_type"]\r
         if cap == "round":\r
@@ -49,10 +66,22 @@ class DialArcProgress(Structure):
             self.cap = 0\r
 \r
         self.radius = int(attributes["radius"])\r
+        if self.radius < 0 or self.radius > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc progress radius out of range")\r
+            sys.exit(1)\r
+\r
         self.startAngle = int(attributes["start_angle"])\r
         self.endAngle = int(attributes["end_angle"])\r
+\r
         self.lineWidth = int(attributes["line_width"])\r
+        if self.lineWidth < 0 or self.lineWidth > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc progress lineWidth out of range")\r
+            sys.exit(1)\r
+\r
         self.bindData = int(attributes["bind_data"])\r
+        if self.bindData < 0 or self.bindData > np.iinfo(np.int16).max:\r
+            print("[ERR]:arc progress bind data out of range")\r
+            sys.exit(1)\r
 \r
         attrList = attributes.getNames()\r
         for attr in attrList:\r
@@ -78,10 +107,29 @@ class DialArcProgress(Structure):
                     self.stop.append(colorStop)\r
                 break\r
 \r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+        if self.displayMode != 0 :\r
+            if "ambient_periodic" in attributes.getNames():\r
+                if attributes["ambient_periodic"] == "true":\r
+                    self.isAmbientPeriodic = True\r
+\r
         if "period" in attrList:\r
+            period_suppor_value = {1, 10, 30, 60}\r
             self.period = int(attributes["period"])\r
-            if (self.period != 0):\r
-                self.isPeriod = True\r
+            if self.period == 0:\r
+                self.isPeriodic = False\r
+            elif self.period not in period_suppor_value:\r
+                self.period = 0\r
+                print("[WARNING]:label image period value not support, using defalut value 0")\r
+            else:\r
+                self.isPeriodic = True\r
 \r
         if "background_color" in attrList:\r
             self.bgColor = int(attributes["background_color"], 16)\r
index b427fe6..40d842b 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Rect\r
@@ -19,25 +20,41 @@ class DialBoxProgress(Structure):
     _fields_ = [\r
         ('cap', c_ubyte),\r
         ('direction', c_ubyte),\r
-        ('isPeriod', c_bool),\r
+        ('isPeriodic', c_bool),\r
         ('bindData', c_short),\r
         ('bgColor', c_uint),\r
         ('type', c_ubyte),\r
         ('rect', Rect),\r
-        ('unionValue', ProgressUnion)\r
+        ('unionValue', ProgressUnion),\r
+        ('displayMode', c_ubyte),\r
+        ('isAmbientPeriodic', c_bool)\r
     ]\r
 \r
     def __init__(self):\r
         self.stop = []\r
-        self.isPeriod = False\r
+        self.isPeriodic = False\r
         self.period = 0\r
+        self.displayMode = 0\r
+        self.isAmbientPeriodic = False\r
 \r
     def parse_attributes(self, attributes):\r
         x,y,w,h = attributes["rect"].split(" ")\r
         self.rect.x = int(x)\r
+        if self.rect.x < np.iinfo(np.int16).min or self.rect.x > np.iinfo(np.int16).max:\r
+            print("[ERR]:box progress rect x out of range")\r
+            sys.exit(1)\r
         self.rect.y = int(y)\r
+        if self.rect.y < np.iinfo(np.int16).min or self.rect.y > np.iinfo(np.int16).max:\r
+            print("[ERR]:box progress rect y out of range")\r
+            sys.exit(1)\r
         self.rect.w = int(w)\r
+        if self.rect.w < np.iinfo(np.int16).min or self.rect.w > np.iinfo(np.int16).max:\r
+            print("[ERR]:box progress rect w out of range")\r
+            sys.exit(1)\r
         self.rect.h = int(h)\r
+        if self.rect.h < np.iinfo(np.int16).min or self.rect.h > np.iinfo(np.int16).max:\r
+            print("[ERR]:box progress rect h out of range")\r
+            sys.exit(1)\r
 \r
         cap = attributes["cap_type"]\r
         if cap == "round":\r
@@ -54,8 +71,14 @@ class DialBoxProgress(Structure):
             self.direction = 2\r
         elif direction == "bottom_to_top":\r
             self.direction = 3\r
+        else:\r
+            self.direction = 0\r
+            print("[WARNING]:box progress direction set error, using defalut value")\r
 \r
         self.bindData = int(attributes["bind_data"])\r
+        if self.bindData < 0 or self.bindData > np.iinfo(np.int16).max:\r
+            print("[ERR]:box progress bind data out of range")\r
+            sys.exit(1)\r
 \r
         attrList = attributes.getNames()\r
         for attr in attrList:\r
@@ -81,10 +104,30 @@ class DialBoxProgress(Structure):
                 self.type = 2\r
                 break\r
 \r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+        if self.displayMode != 0 :\r
+            if "ambient_periodic" in attributes.getNames():\r
+                if attributes["ambient_periodic"] == "true":\r
+                    self.isAmbientPeriodic = True\r
+\r
         if "period" in attrList:\r
+            period_suppor_value = {1, 10, 30, 60}\r
             self.period = int(attributes["period"])\r
-            if (self.period != 0) :\r
-                self.isPeriod = True\r
+            if self.period == 0:\r
+                self.isPeriodic = False\r
+            elif self.period not in period_suppor_value:\r
+                self.period = 0\r
+                print("[WARNING]:label image period value not support, using defalut value 0")\r
+            else:\r
+                self.isPeriodic = True\r
+\r
         if "background_color" in attrList:\r
             self.bgColor = int(attributes["background_color"], 16)\r
 \r
index 957dd7d..4c23840 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Rect\r
@@ -17,17 +18,31 @@ class DialClick(Structure):
         ('type', c_ubyte),\r
         ('rect', Rect),\r
         ('unionType', ClickTypeUnion),\r
+        ('displayMode', c_ubyte)\r
     ]\r
 \r
     def __init__(self):\r
         self.period = 0\r
+        self.displayMode = 0\r
 \r
     def parse_attributes(self, attributes):\r
         x,y,w,h = attributes["rect"].split(" ")\r
         self.rect.x = int(x)\r
+        if self.rect.x < np.iinfo(np.int16).min or self.rect.x > np.iinfo(np.int16).max:\r
+            print("[ERR]:click rect x out of range")\r
+            sys.exit(1)\r
         self.rect.y = int(y)\r
+        if self.rect.y < np.iinfo(np.int16).min or self.rect.y > np.iinfo(np.int16).max:\r
+            print("[ERR]:click rect y out of range")\r
+            sys.exit(1)\r
         self.rect.w = int(w)\r
+        if self.rect.w < np.iinfo(np.int16).min or self.rect.w > np.iinfo(np.int16).max:\r
+            print("[ERR]:click rect w out of range")\r
+            sys.exit(1)\r
         self.rect.h = int(h)\r
+        if self.rect.h < np.iinfo(np.int16).min or self.rect.h > np.iinfo(np.int16).max:\r
+            print("[ERR]:click rect h out of range")\r
+            sys.exit(1)\r
 \r
         for attr in attributes.getNames():\r
             if attr == "action_slice":\r
@@ -39,6 +54,15 @@ class DialClick(Structure):
                 self.type = 1\r
                 break\r
 \r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+\r
     def get_bytes(self):\r
         return bytes(self)\r
 \r
index a19c1b3..8f634ef 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Point\r
@@ -18,12 +19,16 @@ class DialDigitalImg(Structure):
         ('space', c_ushort),\r
         ('alignPosition', Point),\r
         ('bindData', c_short),\r
-        ('isPeriod', c_bool)\r
+        ('isPeriodic', c_bool),\r
+        ('displayMode', c_ubyte),\r
+        ('isAmbientPeriodic', c_bool)\r
     ]\r
 \r
     def __init__(self):\r
         self.period = 0\r
-        self.isPeriod = False\r
+        self.isPeriodic = False\r
+        self.displayMode = 0\r
+        self.isAmbientPeriodic = False\r
 \r
     def parse_attributes(self, attributes):\r
         imgNames = attributes["img_names"].split(",")\r
@@ -36,17 +41,37 @@ class DialDigitalImg(Structure):
                 self.imgIds[index] = img_convert.instance.convert_img(imgNames[index])\r
 \r
         self.space = int(attributes["space"])\r
+        if self.space < 0 or self.space > np.iinfo(np.int16).max:\r
+            print("[ERR]:digital image space out of range")\r
+            sys.exit(1)\r
+\r
         alignStr = attributes["align"]\r
         if alignStr == "right":\r
             self.alignType = 2\r
         elif alignStr == "center":\r
             self.alignType = 1\r
-        else:\r
+        elif alignStr == "left":\r
             self.alignType = 0\r
-        x,y = attributes["align_pos"].split(" ")\r
-        self.alignPosition.x = int(x)\r
-        self.alignPosition.y = int(y)\r
+        else:\r
+            print("[ERR]:digital image align not support")\r
+\r
+        align_pos_x,align_pos_y = attributes["align_pos"].split(" ")\r
+        align_x = int(align_pos_x)\r
+        if align_x < np.iinfo(np.int16).min or align_x > np.iinfo(np.int16).max:\r
+            print("[ERR]:digital image align x out of range")\r
+            sys.exit(1)\r
+        self.alignPosition.x = align_x\r
+\r
+        align_y = int(align_pos_y)\r
+        if align_y < np.iinfo(np.int16).min or align_y > np.iinfo(np.int16).max:\r
+            print("[ERR]:digital image align y out of range")\r
+            sys.exit(1)\r
+        self.alignPosition.y = align_y\r
+\r
         self.bindData = int(attributes["bind_data"])\r
+        if self.bindData < 0 or self.bindData > np.iinfo(np.int16).max:\r
+            print("[ERR]:digital image bind data out of range")\r
+            sys.exit(1)\r
 \r
         for attr in attributes.getNames():\r
             if attr == "sign_img_name":\r
@@ -54,15 +79,40 @@ class DialDigitalImg(Structure):
                 self.signImgId = img_convert.instance.convert_img(signImgName)\r
             elif attr == "integer_length":\r
                 self.integerLength = int(attributes["integer_length"])\r
+                if self.integerLength < 0 or self.integerLength > np.iinfo(np.uint8).max:\r
+                    print("[ERR]:digital image integer length out of range")\r
+                    sys.exit(1)\r
             elif attr == "img_decimal_point":\r
                 decimalPointImgName = attributes["img_decimal_point"]\r
                 self.decimalPointImgId = img_convert.instance.convert_img(decimalPointImgName)\r
             elif attr == "decimal_precision":\r
                 self.decimalPrecision = int(attributes["decimal_precision"])\r
+                if self.decimalPrecision < 0 or self.decimalPrecision > np.iinfo(np.uint8).max:\r
+                    print("[ERR]:digital image decimal precision out of range")\r
+                    sys.exit(1)\r
             elif attr == "period":\r
+                period_suppor_value = {1, 10, 30, 60}\r
                 self.period = int(attributes["period"])\r
-                if self.period != 0:\r
-                    self.isPeriod = True\r
+                if self.period == 0:\r
+                    self.isPeriodic = False\r
+                elif self.period not in period_suppor_value:\r
+                    self.period = 0\r
+                    print("[WARNING]:digital image period value not support, using defalut value 0")\r
+                else:\r
+                    self.isPeriodic = True\r
+\r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+        if self.displayMode != 0 :\r
+            if "ambient_periodic" in attributes.getNames():\r
+                if attributes["ambient_periodic"] == "true":\r
+                    self.isAmbientPeriodic = True\r
 \r
     def get_bytes(self):\r
         return bytes(self)\r
index 450a6db..8f89526 100644 (file)
@@ -10,7 +10,8 @@ class DialKaleidoscope(Structure):
     _fields_ = [\r
         ('imgId', c_ushort),\r
         ('rotateEventFactor', c_float),\r
-        ('rotateAnimatorValue', c_float)\r
+        ('rotateAnimatorValue', c_float),\r
+        ('displayMode', c_ubyte)\r
     ]\r
 \r
     def __init__(self):\r
@@ -18,6 +19,7 @@ class DialKaleidoscope(Structure):
         self.rotateEventFactor = 1.0\r
         self.rotateAnimatorValue = 0.0\r
         self.period = 0\r
+        self.displayMode = 0\r
 \r
     def parse_attributes(self, attributes):\r
         self.imgId = img_convert.instance.convert_img(attributes["img_name"])\r
@@ -27,6 +29,15 @@ class DialKaleidoscope(Structure):
             elif attr == "animator_rotate_step":\r
                 self.rotateAnimatorValue = float(attributes["animator_rotate_step"])\r
 \r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+\r
     def get_bytes(self):\r
         return bytes(self)\r
 \r
index a2549bf..1bd19db 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Rect\r
@@ -11,24 +12,40 @@ class DialLabel(Structure):
         ('breakMode', c_ubyte),\r
         ('align', c_ubyte),\r
         ('fontSize', c_ubyte),\r
-        ('isPeriod', c_bool),\r
+        ('isPeriodic', c_bool),\r
         ('rect', Rect),\r
         ('color', c_uint),\r
         ('fontName', c_char * 64),\r
         ('text', c_char * 64),\r
-        ('bindData', c_short)\r
+        ('bindData', c_short),\r
+        ('displayMode', c_ubyte),\r
+        ('isAmbientPeriodic', c_bool)\r
     ]\r
 \r
     def __init__(self):\r
         self.period = 0\r
-        self.isPeriod = False\r
+        self.isPeriodic = False\r
+        self.displayMode = 0\r
+        self.isAmbientPeriodic = False\r
 \r
     def parse_attributes(self, attributes):\r
         x,y,w,h = attributes["rect"].split(" ")\r
         self.rect.x = int(x)\r
+        if self.rect.x < np.iinfo(np.int16).min or self.rect.x > np.iinfo(np.int16).max:\r
+            print("[ERR]:label rect x out of range")\r
+            sys.exit(1)\r
         self.rect.y = int(y)\r
+        if self.rect.y < np.iinfo(np.int16).min or self.rect.y > np.iinfo(np.int16).max:\r
+            print("[ERR]:label rect y out of range")\r
+            sys.exit(1)\r
         self.rect.w = int(w)\r
+        if self.rect.w < np.iinfo(np.int16).min or self.rect.w > np.iinfo(np.int16).max:\r
+            print("[ERR]:label rect w out of range")\r
+            sys.exit(1)\r
         self.rect.h = int(h)\r
+        if self.rect.h < np.iinfo(np.int16).min or self.rect.h > np.iinfo(np.int16).max:\r
+            print("[ERR]:label rect h out of range")\r
+            sys.exit(1)\r
 \r
         mode = attributes["break_mode"]\r
         if mode == "adapt":\r
@@ -45,7 +62,7 @@ class DialLabel(Structure):
             self.breakMode = 5\r
         else:\r
             self.breakMode = 3\r
-            print("[WARING][label:break_mode]Incorrect input:", mode)\r
+            print("[WARNING][label:break_mode]Incorrect input:", mode)\r
 \r
         alignStr = attributes["align"]\r
         if alignStr == "bottom":\r
@@ -60,9 +77,13 @@ class DialLabel(Structure):
             self.align = 0\r
         else:\r
             self.align = 0\r
-            print("[WARING][label:align]Incorrect input:", alignStr)\r
+            print("[WARNING][label:align]Incorrect input:", alignStr)\r
 \r
         self.fontSize = int(attributes["font_size"])\r
+        if self.fontSize < 0 or self.fontSize > np.iinfo(np.uint8).max:\r
+            print("[ERR]:label font size out of range")\r
+            sys.exit(1)\r
+\r
         self.color = int(attributes["color"], 16)\r
         self.fontName = bytes(attributes["font"], encoding = "utf8")\r
         self.text = bytes(attributes["text"], encoding = "utf8")\r
@@ -70,12 +91,35 @@ class DialLabel(Structure):
         for attr in attributes.getNames():\r
             if attr == "bind_data":\r
                 self.bindData = int(attributes["bind_data"])\r
+                if self.bindData < 0 or self.bindData > np.iinfo(np.int16).max:\r
+                    print("[ERR]:label bind data out of range")\r
+                    sys.exit(1)\r
             elif attr == "period":\r
+                period_suppor_value = {1, 10, 30, 60}\r
                 self.period = int(attributes["period"])\r
-                if self.period != 0:\r
-                    self.isPeriod = True\r
-        if self.isPeriod != 0 and self.bindData == 0:\r
-            print("[ERROR]:[bind_data] is not set, [period] cannot be set")\r
+                if self.period == 0:\r
+                    self.isPeriodic = False\r
+                elif self.period not in period_suppor_value:\r
+                    self.period = 0\r
+                    print("[WARNING]:label image period value not support, using defalut value 0")\r
+                else:\r
+                    self.isPeriodic = True\r
+\r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+        if self.displayMode != 0 :\r
+            if "ambient_periodic" in attributes.getNames():\r
+                if attributes["ambient_periodic"] == "true":\r
+                    self.isAmbientPeriodic = True\r
+\r
+        if self.isPeriodic != 0 and self.bindData == 0:\r
+            print("[ERR]:[bind_data] is not set, [period] cannot be set")\r
             sys.exit(1)\r
 \r
     def get_bytes(self):\r
index e5e318a..c2a448c 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Point\r
@@ -11,32 +12,66 @@ class DialOptionImg(Structure):
     _fields_ = [\r
         ('pos', Point),\r
         ('bindData', c_short),\r
-        ('isPeriod', c_bool),\r
+        ('isPeriodic', c_bool),\r
         ('count', c_ubyte),\r
+        ('displayMode', c_ubyte),\r
+        ('isAmbientPeriodic', c_bool)\r
     ]\r
 \r
     def __init__(self):\r
         self.imgId = []\r
         self.period = 0\r
-        self.isPeriod = False\r
+        self.isPeriodic = False\r
+        self.displayMode = 0\r
+        self.isAmbientPeriodic = False\r
 \r
     def parse_attributes(self, attributes):\r
-        x,y = attributes["position"].split(" ")\r
-        self.pos.x = int(x)\r
-        self.pos.y = int(y)\r
+        input_pos_x,input_pos_y = attributes["position"].split(" ")\r
+        self.pos.x = int(input_pos_x)\r
+        if self.pos.x < np.iinfo(np.int16).min or self.pos.x > np.iinfo(np.int16).max:\r
+            print("[ERR]:option image pos x out of range")\r
+            sys.exit(1)\r
+\r
+        self.pos.y = int(input_pos_y)\r
+        if self.pos.y < np.iinfo(np.int16).min or self.pos.y > np.iinfo(np.int16).max:\r
+            print("[ERR]:option image pos y out of range")\r
+            sys.exit(1)\r
 \r
         self.bindData = int(attributes["bind_data"])\r
+        if self.bindData < 0 or self.bindData > np.iinfo(np.int16).max:\r
+            print("[ERR]:option image bind data out of range")\r
+            sys.exit(1)\r
 \r
         imgNames = attributes["img_names"].split(",")\r
+\r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+        if self.displayMode != 0:\r
+            if "ambient_periodic" in attributes.getNames():\r
+                if attributes["ambient_periodic"] == "true":\r
+                    self.isAmbientPeriodic = True\r
+\r
         self.count = len(imgNames)\r
         for img in imgNames:\r
             imgId = img_convert.instance.convert_img(img)\r
             self.imgId.append(imgId)\r
 \r
         if "period" in attributes.getNames():\r
+            period_suppor_value = {1, 10, 30, 60}\r
             self.period = int(attributes["period"])\r
-            if self.period != 0:\r
-                self.isPeriod = True\r
+            if self.period == 0:\r
+                self.isPeriodic = False\r
+            elif self.period not in period_suppor_value:\r
+                self.period = 0\r
+                print("[WARNING]:option image period value not support, using defalut value 0")\r
+            else:\r
+                self.isPeriodic = True\r
 \r
     def get_bytes(self):\r
         ret = bytes(self)\r
index a7d6e2e..9a12409 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Point\r
@@ -15,32 +16,72 @@ class DialRotateImg(Structure):
         ('rotaeteEnd', c_short),\r
         ('imgId', c_ushort),\r
         ('bindData', c_short),\r
-        ('isPeriod', c_bool)\r
+        ('isPeriodic', c_bool),\r
+        ('displayMode', c_ubyte),\r
+        ('isAmbientPeriodic', c_bool)\r
     ]\r
 \r
     def __init__(self):\r
         self.period = 0\r
-        self.isPeriod = False\r
+        self.isPeriodic = False\r
+        self.displayMode = 0\r
+        self.isAmbientPeriodic = False\r
 \r
     def parse_attributes(self, attributes):\r
-        x,y = attributes["position"].split(" ")\r
-        self.pos.x = int(x)\r
-        self.pos.y = int(y)\r
+        input_pos_x,input_pos_y = attributes["position"].split(" ")\r
+        self.pos.x = int(input_pos_x)\r
+        if self.pos.x < np.iinfo(np.int16).min or self.pos.x > np.iinfo(np.int16).max:\r
+            print("[ERR]:rotate image pos x out of range")\r
+            sys.exit(1)\r
+\r
+        self.pos.y = int(input_pos_y)\r
+        if self.pos.y < np.iinfo(np.int16).min or self.pos.y > np.iinfo(np.int16).max:\r
+            print("[ERR]:rotate image pos y out of range")\r
+            sys.exit(1)\r
 \r
         x,y = attributes["rotate_center"].split(" ")\r
         self.center.x = round(float(x))\r
         self.center.y = round(float(y))\r
 \r
         self.rotateStart = int(attributes["rotate_start"])\r
+        if self.rotateStart < 0.0 or self.rotateStart > 360.0 :\r
+            print("[ERR]:rotate image start angle out of range, [0, 360]")\r
+            sys.exit(1)\r
+\r
         self.rotaeteEnd = int(attributes["rotate_end"])\r
+        if self.rotaeteEnd < 0.0 or self.rotaeteEnd > 360.0 :\r
+            print("[ERR]:rotate image end angle out of range, [0, 360]")\r
+            sys.exit(1)\r
 \r
         self.bindData = int(attributes["bind_data"])\r
+        if self.bindData < 0 or self.bindData > np.iinfo(np.int16).max:\r
+            print("[ERR]:rotate image bind data out of range")\r
+            sys.exit(1)\r
 \r
         self.imgId = img_convert.instance.convert_img(attributes["img_name"])\r
         if "period" in attributes.getNames():\r
+            period_suppor_value = {1, 10, 30, 60}\r
             self.period = int(attributes["period"])\r
-            if self.period != 0:\r
-                self.isPeriod = True\r
+            if self.period == 0:\r
+                self.isPeriodic = False\r
+            elif self.period not in period_suppor_value:\r
+                self.period = 0\r
+                print("[WARNING]:rotate image period value not support, using defalut value 0")\r
+            else:\r
+                self.isPeriodic = True\r
+\r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode = 1\r
+            elif display_mode == "always":\r
+                self.displayMode = 2\r
+        if self.displayMode != 0:\r
+            if "ambient_periodic" in attributes.getNames():\r
+                if attributes["ambient_periodic"] == "true":\r
+                    self.isAmbientPeriodic = True\r
 \r
     def get_bytes(self):\r
         return bytes(self)\r
index 09781e8..5f6a06e 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Point\r
@@ -13,25 +14,37 @@ class DialSequenceImg(Structure):
         ('interval', c_ushort),\r
         ('repeat', c_bool),\r
         ('imgNum', c_ubyte),\r
+        ('displayMode', c_ubyte)\r
     ]\r
 \r
     def __init__(self):\r
         self.imgId = []\r
         self.period = 0\r
+        self.displayMode = 0\r
 \r
     def parse_attributes(self, attributes):\r
         x,y = attributes["position"].split(" ")\r
         self.pos.x = int(x)\r
+        if self.pos.x < np.iinfo(np.int16).min or self.pos.x > np.iinfo(np.int16).max :\r
+            print("[ERR]:sequence image pos x out of range")\r
+            sys.exit(1)\r
+\r
         self.pos.y = int(y)\r
+        if self.pos.y < np.iinfo(np.int16).min or self.pos.y > np.iinfo(np.int16).max :\r
+            print("[ERR]:sequence image pos y out of range")\r
+            sys.exit(1)\r
 \r
-        if attributes["repeat"].lower() == "true":\r
+        if attributes["repeat"].lower() == "true" :\r
             self.repeat = True\r
-        elif attributes["repeat"].lower() == "false":\r
+        elif attributes["repeat"].lower() == "false" :\r
             self.repeat = False\r
+        else:\r
+            print("[ERR]:sequence image repeat only 'True' or 'False'")\r
+            sys.exit(1)\r
 \r
         interval = int(attributes["interval"])\r
-        if interval < 0:\r
-            print("[ERROR]: [interval] attr less than 0")\r
+        if interval < 0 or interval > np.iinfo(np.int16).max :\r
+            print("[ERR]: sequence image interval out of range")\r
             sys.exit(1)\r
         else:\r
             self.interval = interval\r
@@ -42,6 +55,15 @@ class DialSequenceImg(Structure):
             imgId = img_convert.instance.convert_img(img)\r
             self.imgId.append(imgId)\r
 \r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+\r
     def get_bytes(self):\r
         ret = bytes(self)\r
         for index in range(self.imgNum):\r
index 4e8302e..e057171 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Point\r
@@ -12,32 +13,59 @@ class DialStaticImg(Structure):
         ('pos', Point),\r
         ('center', Point),\r
         ('rotate', c_float),\r
-        ('imgId', c_ushort)\r
+        ('imgId', c_ushort),\r
+        ('displayMode', c_ubyte),\r
     ]\r
 \r
     def __init__(self):\r
         self.imgId = 0\r
-        self.pos.x = 0\r
-        self.pos.y = 0\r
         self.center.x = 0\r
         self.center.y = 0\r
-        self.rotate  = 0.0\r
+        self.rotate = 0.0\r
         self.period = 0\r
+        self.displayMode = 0\r
 \r
     def parse_attributes(self, attributes):\r
-        x,y = attributes["position"].split(" ")\r
-        self.pos.x = int(x)\r
-        self.pos.y = int(y)\r
+        input_pos_x, input_pos_y = attributes["position"].split(" ")\r
+        self.pos.x = int(input_pos_x)\r
+        if self.pos.x < np.iinfo(np.int16).min or self.pos.x > np.iinfo(np.int16).max:\r
+            print("[ERR]:static image pos x out of range")\r
+            sys.exit(1)\r
+\r
+        self.pos.y = int(input_pos_y)\r
+        if self.pos.y < np.iinfo(np.int16).min or self.pos.y > np.iinfo(np.int16).max:\r
+            print("[ERR]:static image pos y out of range")\r
+            sys.exit(1)\r
 \r
         self.imgId = img_convert.instance.convert_img(attributes["img_name"])\r
 \r
         for attr in attributes.getNames():\r
             if attr == "center":\r
-                x,y = attributes["center"].split(" ")\r
-                self.center.x = int(x)\r
-                self.center.y = int(y)\r
+                input_center_x,input_center_y = attributes["center"].split(" ")\r
+                self.center.x = int(input_center_x)\r
+                if self.center.x < np.iinfo(np.int16).min or self.center.x > np.iinfo(np.int16).max:\r
+                    print("[ERR]:static image center x out of range")\r
+                    sys.exit(1)\r
+\r
+                self.center.y = int(input_center_y)\r
+                if self.center.y < np.iinfo(np.int16).min or self.center.y > np.iinfo(np.int16).max:\r
+                    print("[ERR]:static image center y out of range")\r
+                    sys.exit(1)\r
             elif attr == "rotate":\r
-                self.rotate = float(attributes["rotate"])\r
+                rotate = float(attributes["rotate"])\r
+                if rotate < 0.0 or rotate > 360.0 :\r
+                    print("[ERR]:static image rotate out of range, [0, 360]")\r
+                    sys.exit(1)\r
+                self.rotate = rotate\r
+\r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode = 1\r
+            elif display_mode == "always":\r
+                self.displayMode = 2\r
 \r
     def get_bytes(self):\r
         return bytes(self)\r
index f83c85c..ecc263f 100644 (file)
@@ -2,6 +2,7 @@
 # coding: utf-8\r
 import sys\r
 import struct\r
+import numpy as np\r
 from xml.dom.minidom import parse\r
 from ctypes import *\r
 from common_types import Rect\r
@@ -14,24 +15,45 @@ class DialVideo(Structure):
         ('offset', c_uint),\r
         ('colorKey', c_uint),\r
         ('imgId', c_uint),\r
+        ('displayMode', c_ubyte)\r
     ]\r
 \r
     def __init__(self):\r
         self.period = 0\r
+        self.displayMode = 0\r
 \r
     def parse_attributes(self, attributes):\r
         x,y,w,h = attributes["rect"].split(" ")\r
         self.rect.x = int(x)\r
+        if self.rect.x < np.iinfo(np.int16).min or self.rect.x > np.iinfo(np.int16).max:\r
+            print("[ERR]:video rect x out of range")\r
+            sys.exit(1)\r
         self.rect.y = int(y)\r
+        if self.rect.y < np.iinfo(np.int16).min or self.rect.y > np.iinfo(np.int16).max:\r
+            print("[ERR]:video rect y out of range")\r
+            sys.exit(1)\r
         self.rect.w = int(w)\r
+        if self.rect.w < np.iinfo(np.int16).min or self.rect.w > np.iinfo(np.int16).max:\r
+            print("[ERR]:video rect w out of range")\r
+            sys.exit(1)\r
         self.rect.h = int(h)\r
+        if self.rect.h < np.iinfo(np.int16).min or self.rect.h > np.iinfo(np.int16).max:\r
+            print("[ERR]:video rect h out of range")\r
+            sys.exit(1)\r
 \r
         self.colorKey = int(attributes["color_key"], 16)\r
-\r
         self.offset = video_convert.instance.convert_video(attributes["source"])\r
-\r
         self.imgId = img_convert.instance.convert_img(attributes["preview_frame"])\r
 \r
+        if "display_mode" in attributes.getNames():\r
+            display_mode = attributes["display_mode"]\r
+            if display_mode == "normal":\r
+                self.displayMode = 0\r
+            elif display_mode == "ambient":\r
+                self.displayMode= 1\r
+            elif display_mode == "always":\r
+                self.displayMode= 2\r
+\r
     def get_bytes(self):\r
         return bytes(self)\r
 \r
index 1b99f0b..b9cf3fb 100644 (file)
Binary files a/tools/dial_converter_tool/dll/linux_cs/libcodec.so and b/tools/dial_converter_tool/dll/linux_cs/libcodec.so differ
index 21b76ed..7f5174e 100644 (file)
Binary files a/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.dll and b/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.dll differ
index fcdc59f..b339838 100644 (file)
Binary files a/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.lib and b/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.lib differ
index 50abf97..3c8dfad 100644 (file)
@@ -106,6 +106,7 @@ class ImageConverTool():
     imageData = []\r
     imageNum = 0\r
     isConvertedFile = []\r
+    tile_width_support = {4, 6, 8, 16}\r
 \r
     def __init__(self):\r
         self.markCurOffset = 0\r
@@ -125,7 +126,7 @@ class ImageConverTool():
 \r
     def set_tile_width(self, tile_width):\r
         if tile_width not in self.tile_width_support:\r
-            print("[ERROR]:The tile_width value is not supported.")\r
+            print("[ERR]:The tile_width:{tile_width} value is not supported.")\r
             sys.exit(1)\r
 \r
         self.tile_width = tile_width\r
@@ -181,8 +182,8 @@ class ImageConverTool():
             print("[ERROR]:", path, "is not exist")\r
             return False\r
         else:\r
-            if (not path[-3:].lower() == "png") and (not path[-3:].lower() == "jpg"):\r
-                print("[ERROR]:", path, "is not jpg or png format image")\r
+            if (not path[-3:].lower() == "png") and (not path[-3:].lower() == "jpg") and (not path[-3:].lower() == "bmp"):\r
+                print("[ERROR]:", path, "is not jpg or png or bmp format image")\r
                 return False\r
         return True\r
 \r
index 8c0a646..384785b 100644 (file)
@@ -1,84 +1,47 @@
-<dial title="obsidianrhythm" description="黑曜律动" size="466 466" version="1.0" preview_img="./instance/114/obsidianrhythm.png">\r
-    <!-- 视频背景 -->\r
-       <video id="video" rect="0 0 466 466" source="./instance/114/obsidianrhythm.mp4" color_key="0xff212324" preview_frame="./instance/114/preview_obsidianrhythm.png"></video>\r
-    \r
-    <!-- 动态背景 \r
+<dial title="obsidianrhythm" description="黑曜律动" size="466 466" version="2.0" preview_img="./instance/114/obsidianrhythm.png" ambient_period="60">\r
+<!--  视频背景  -->\r
+<video id="video" rect="0 0 466 466" source="./instance/114/obsidianrhythm.mp4" color_key="0xff212324" preview_frame="./instance/114/preview_obsidianrhythm.png"/>\r
+<!--  动态背景 \r
     <sequence_img img_names="./instance/114/background/1.png,./instance/114/background/2.png,./instance/114/background/3.png,./instance/114/background/4.png,./instance/114/background/5.png,./instance/114/background/6.png,./instance/114/background/7.png,./instance/114/background/8.png,./instance/114/background/9.png,./instance/114/background/10.png,./instance/114/background/11.png,./instance/114/background/12.png,./instance/114/background/13.png,./instance/114/background/14.png,./instance/114/background/15.png,./instance/114/background/16.png,./instance/114/background/17.png,./instance/114/background/18.png,./instance/114/background/19.png,./instance/114/background/20.png,./instance/114/background/21.png" position="0 0" repeat="true" interval="100"></sequence_img>\r
-    -->\r
-\r
-    <!-- 背景   -->\r
-    <static_img id="back_ground" position="0 0" img_name="./instance/114/MAIN_FACE_IMAGE.png"></static_img>\r
-\r
-    <!-- 天气显示 -->\r
-    <option_img position="201 69" img_names="./instance/114/weather/SUNNY.png,./instance/114/weather/CLEAR_SUNNY.png,./instance/114/weather/SUNNY_CLOUDY.png,./instance/114/weather/CLEAR_CLOUDY.png,./instance/114/weather/OVERCAST.png,./instance/114/weather/RAIN.png,./instance/114/weather/THUNDERSHOWER.png,./instance/114/weather/SNOW.png,./instance/114/weather/FOGGY.png,./instance/114/weather/HAZE.png,./instance/114/weather/DUSTSTORM.png,./instance/114/weather/UNKNOWN.png" bind_data="24" ></option_img>\r
-\r
-    \r
-    <!-- 星期显示 -->\r
-    <option_img position="75 173" img_names="./instance/114/week/WEEK_SUN.png,./instance/114/week/WEEK_MON.png,./instance/114/week/WEEK_TUE.png,./instance/114/week/WEEK_WED.png,./instance/114/week/WEEK_THU.png,./instance/114/week/WEEK_FRI.png,./instance/114/week/WEEK_SAT.png" bind_data="17" period="10"></option_img>\r
-\r
-    <!-- 天气信息显示 -->\r
-    <label id="weather_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="83 130 300 30" text="%s" font_size="20" align="center" bind_data="20482" ></label>\r
- \r
-    <!-- 日期显示 -->\r
-    <label id="day_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="90 222 100 40" text="%0.f" font_size="24" align="center" bind_data="16" period="10"></label>\r
-    \r
-    <!-- 心率显示 -->\r
-    <label id="heart_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="132 348 49 25" text="%0.f" font_size="20" align="center" bind_data="2"></label>\r
-    \r
-    <!-- 步数显示 -->\r
-    <label id="step_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="83 374 300 25" text="%0.f" font_size="20" align="center" bind_data="1" period="10"></label>\r
-    \r
-    <!-- 卡路里显示 -->\r
-    <label id="calories_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="287 348 45 25" text="%0.f" font_size="20" align="center" bind_data="3" period="10"></label>\r
-    \r
-    <!-- 心率icon显示 -->\r
-    <static_img  position="144 315"  img_name="./instance/114/module/heartrate.png"></static_img>\r
-    <!-- 步数icon显示 -->\r
-    <static_img  position="220 341"  img_name="./instance/114/module/step.png"></static_img>\r
-    <!-- 卡路里icon显示 -->\r
-    <static_img  position="296 315"  img_name="./instance/114/module/calories.png"></static_img>\r
-    <!-- 时间背景框icon显示 -->\r
-    <static_img  position="300 213"  img_name="./instance/114/module/ellipse.png"></static_img>\r
-\r
-\r
-    <!-- 小时显示 -->\r
-    <!-- <label id="hour_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="293 222 77 104" text="%02.f" font_size="20" align="center" bind_data="15" period="10"></label> -->\r
-    <!-- 分号显示 -->\r
-    <!-- <label id="point_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="333 222 28 139" text=":" font_size="20" align="center"></label> -->\r
-    <!-- 分钟显示 -->\r
-    <!-- <label id="minute_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="331 222 77 104" text="%02.f" font_size="20" align="center" bind_data="14" period="10"></label> -->\r
-\r
- \r
-    <label id="hour_ten_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="300 222 100 33" text="%s" font_size="20" align="center" bind_data="20483" period="10"></label>\r
-\r
-    <!-- 小时十位显示-->\r
-    <!-- <label id="hour_ten_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="adapt" rect="313 222 64 33" text="%1.0f" font_size="20" align="center" bind_data="26" period="10"></label> -->\r
-    <!-- 小时个位显示 -->\r
-    <!-- <label id="hour_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="adapt" rect="323 222 64 33" text="%1.0f" font_size="20" align="center" bind_data="27" period="10"></label> -->\r
-    <!-- 分号显示    -->\r
-    <!-- <label id="point_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="adapt" rect="340 220 28 139" text=":" font_size="22" align="center"></label> -->\r
-    <!-- 分钟十位显示 -->\r
-    <!-- <label id="minute_ten_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="adapt" rect="355 222 64 33" text="%1.0f" font_size="20" align="center" bind_data="28" period="10"></label> -->\r
-    <!-- 分钟个位显示 -->\r
-    <!-- <label id="hour_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="adapt" rect="370 222 64 33" text="%1.0f" font_size="20" align="center" bind_data="29" period="10"></label> -->\r
-\r
-\r
-    <!-- 小时 -->\r
-    <rotate_img id="hour" position="212 75" rotate_center="21.0 158.0" rotate_start="0" rotate_end="360" img_name="./instance/114/HOURHAND.png" bind_data="9" period="10"></rotate_img>\r
-    <!-- 分钟 -->\r
-    <rotate_img id="minute" position="218 23" rotate_center="15.0 210.0" rotate_start="0" rotate_end="360" img_name="./instance/114/MINUTEHAND.png" bind_data="10" period="10"></rotate_img>\r
-    <!-- 秒钟 -->\r
-    <rotate_img id="second" position="220 17" rotate_center="13.0 216.0" rotate_start="0" rotate_end="360" img_name="./instance/114/SECONDHAND.png" bind_data="12" period="60"></rotate_img>\r
-\r
-\r
-    <!--通话\r
+     -->\r
+<!--  背景    -->\r
+<static_img id="back_ground" position="0 0" img_name="./instance/114/MAIN_FACE_IMAGE.png"/>\r
+<!--  天气显示  -->\r
+<option_img position="201 69" img_names="./instance/114/weather/SUNNY.png,./instance/114/weather/CLEAR_SUNNY.png,./instance/114/weather/SUNNY_CLOUDY.png,./instance/114/weather/CLEAR_CLOUDY.png,./instance/114/weather/OVERCAST.png,./instance/114/weather/RAIN.png,./instance/114/weather/THUNDERSHOWER.png,./instance/114/weather/SNOW.png,./instance/114/weather/FOGGY.png,./instance/114/weather/HAZE.png,./instance/114/weather/DUSTSTORM.png,./instance/114/weather/UNKNOWN.png" bind_data="24"/>\r
+<!--  星期显示  -->\r
+<option_img position="75 173" img_names="./instance/114/week/WEEK_SUN.png,./instance/114/week/WEEK_MON.png,./instance/114/week/WEEK_TUE.png,./instance/114/week/WEEK_WED.png,./instance/114/week/WEEK_THU.png,./instance/114/week/WEEK_FRI.png,./instance/114/week/WEEK_SAT.png" bind_data="17" period="10"/>\r
+<!--  天气信息显示  -->\r
+<label id="weather_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="83 130 300 30" text="%s" font_size="20" align="center" bind_data="20482"/>\r
+<!--  日期显示  -->\r
+<label id="day_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="90 222 100 40" text="%0.f" font_size="24" align="center" bind_data="16" period="10"/>\r
+<!--  心率显示  -->\r
+<label id="heart_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="132 348 49 25" text="%0.f" font_size="20" align="center" bind_data="2"/>\r
+<!--  步数显示  -->\r
+<label id="step_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="83 374 300 25" text="%0.f" font_size="20" align="center" bind_data="1" period="10"/>\r
+<!--  卡路里显示  -->\r
+<label id="calories_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="287 348 45 25" text="%0.f" font_size="20" align="center" bind_data="3" period="10"/>\r
+<!--  心率icon显示  -->\r
+<static_img position="144 315" img_name="./instance/114/module/heartrate.png"/>\r
+<!--  步数icon显示  -->\r
+<static_img position="220 341" img_name="./instance/114/module/step.png"/>\r
+<!--  卡路里icon显示  -->\r
+<static_img position="296 315" img_name="./instance/114/module/calories.png"/>\r
+<!--  时间背景框icon显示  -->\r
+<static_img position="300 213" img_name="./instance/114/module/ellipse.png"/>\r
+<label id="hour_ten_label" color="0xFFFFFFFF" font="Audiowide_Regular.ttf" break_mode="ellipsis" rect="300 222 100 33" text="%s" font_size="20" align="center" bind_data="20483" period="10" display_mode="always" ambient_periodic="true"/><!--  小时  -->\r
+<rotate_img id="hour" position="212 75" rotate_center="21.0 158.0" rotate_start="0" rotate_end="360" img_name="./instance/114/HOURHAND.png" bind_data="9" period="10" display_mode="always" ambient_periodic="true"/>\r
+<!--  分钟  -->\r
+<rotate_img id="minute" position="218 23" rotate_center="15.0 210.0" rotate_start="0" rotate_end="360" img_name="./instance/114/MINUTEHAND.png" bind_data="10" period="10" display_mode="always" ambient_periodic="true"/>\r
+<!--  秒钟  -->\r
+<rotate_img id="second" position="220 17" rotate_center="13.0 216.0" rotate_start="0" rotate_end="360" img_name="./instance/114/SECONDHAND.png" bind_data="12" period="60" display_mode="always" ambient_periodic="true"/>\r
+<!-- 通话\r
     <click rect="0 193 80 80" action_slice="84"></click>\r
-    -->\r
-    <!--天气-->\r
-    <click rect="193 0 80 80" action_slice="202"></click>\r
-    <!--支付宝\r
+     -->\r
+<!-- 天气 -->\r
+<click rect="193 0 80 80" action_slice="202"/>\r
+<!-- 支付宝\r
     <click rect="386 193 80 80" action_slice="98"></click>\r
-    -->\r
-    <!--每日活动-->\r
-    <click rect="193 396 80 80" action_slice="201"></click>\r
-</dial>\r
+     -->\r
+<!-- 每日活动 -->\r
+<click rect="193 396 80 80" action_slice="201"/>\r
+</dial>
\ No newline at end of file
diff --git a/tools/dial_converter_tool/out/obsidianrhythm.bin b/tools/dial_converter_tool/out/obsidianrhythm.bin
new file mode 100644 (file)
index 0000000..a85f160
Binary files /dev/null and b/tools/dial_converter_tool/out/obsidianrhythm.bin differ
diff --git a/tools/dial_converter_tool/视频表盘制作变更.txt b/tools/dial_converter_tool/视频表盘制作变更.txt
deleted file mode 100644 (file)
index 8a9184b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-新增video的预览帧功能。video标签新增属性 preview_frame。\r
-1、历史表盘有视频表盘需要重新用新工具生成。\r
-2、使用video标签实例如下\r
-<video id="video" rect="0 0 454 454" source="./instance/video_dial/demo.mp4" color_key="0xff212324" preview_frame="./instance/video_dial/video_frame.png"></video>
\ No newline at end of file