Skip to content

Commit

Permalink
ICONSIZE and debuggung
Browse files Browse the repository at this point in the history
  • Loading branch information
lubeda committed Dec 2, 2024
1 parent 2edf0fc commit 79ef9e8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions components/ehmtxv2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
MAXICONS = 120
ICONWIDTH = 8
ICONHEIGHT = 8
ICONBUFFERSIZE = ICONWIDTH * ICONHEIGHT * 2
ICONSIZE = ICONWIDTH * ICONHEIGHT * 2 #
SVG_ICONSTART = '<svg width="80px" height="80px" viewBox="0 0 80 80">'
SVG_FULL_SCREEN_START = '<svg width="320px" height="80px" viewBox="0 0 320 80">'
SVG_END = "</svg>"
Expand Down Expand Up @@ -427,6 +427,7 @@ def thumbnails(frames):

if hasattr(image, 'n_frames'):
frames = min(image.n_frames, MAXFRAMES)
logging.info(f"animation {conf[CONF_ID]} with { frames } frames")
else:
frames = 1

Expand All @@ -446,20 +447,23 @@ def thumbnails(frames):
pos = 0
frameIndex = 0
html_string += f"<DIV ID={conf[CONF_ID]}>"
data = [0 for _ in range(ICONBUFFERSIZE * frames)]
if width == 8:
data = [0 for _ in range(ICONSIZE * frames)]
else:
data = [0 for _ in range(4* ICONSIZE * frames)]
if image.has_transparency_data:
logging.warning(f" icon {conf[CONF_ID]} has transparency!")
logging.debug(f"icon {conf[CONF_ID]} has transparency!")

for frameIndex in range(frames):

image.seek(frameIndex)

frame = image.convert("RGB")

if CONF_RESIZE in conf:
frame = frame.resize([width, height])

pixels = list(frame.getdata())


# width, height = image.size
if width == 8:
Expand All @@ -482,10 +486,13 @@ def thumbnails(frames):
pos += 1
data[pos] = rgb & 255
pos += 1

html_string += SVG_END
html_string += f"</DIV>"

rhs = [HexInt(x) for x in data]

logging.debug(f"icon {conf[CONF_ID]} {rhs}")

prog_arr = cg.progmem_array(conf[CONF_RAW_DATA_ID], rhs)

Expand Down

0 comments on commit 79ef9e8

Please sign in to comment.