This commit is contained in:
Willy-JL
2024-01-13 02:36:39 +00:00
25 changed files with 577 additions and 217 deletions
+7
View File
@@ -25,6 +25,9 @@ ICONS_TEMPLATE_C_FRAME = "const uint8_t {name}[] = {data};\n"
ICONS_TEMPLATE_C_DATA = "const uint8_t* const {name}[] = {data};\n"
ICONS_TEMPLATE_C_ICONS = "Icon {name} = {{.width={width},.height={height},.frame_count={frame_count},.frame_rate={frame_rate},.frames=_{name}}};\n"
MAX_IMAGE_WIDTH = 128
MAX_IMAGE_HEIGHT = 64
class Main(App):
def init(self):
@@ -112,6 +115,10 @@ class Main(App):
def _icon2header(self, file):
image = file2image(file)
if image.width > MAX_IMAGE_WIDTH or image.height > MAX_IMAGE_HEIGHT:
raise Exception(
f"Image {file} is too big ({image.width}x{image.height} vs. {MAX_IMAGE_WIDTH}x{MAX_IMAGE_HEIGHT})"
)
return image.width, image.height, image.data_as_carray()
def _iconIsSupported(self, filename):