reverted some changes which were intended for local use only

pull/12/head
sandr0 4 weeks ago
parent 692f5deb8c
commit 6bdfb02bd8
  1. BIN
      gfx/pacman.png
  2. 39
      lednamebadge.py

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

@ -416,50 +416,13 @@ class SimpleTextAndIcons:
monochrome_color = pixel_color
else:
sys.exit("%s: Unknown pixel format detected (%s)!" % (file, pixel_color))
if monochrome_color == 255:
if monochrome_color > 127:
bit_val = 1 << (7 - bit)
byte_val += bit_val
buf.append(byte_val)
im.close()
return buf, cols
@staticmethod
def bitmap_bits(rows: list[int], bits: int):
"""
Use with somethin like
[
0b11001100110011001100110011001100110011001100,
0b11001100110011001100110011001100110011001100,
0b00110011001100110011001100110011001100110011,
0b00110011001100110011001100110011001100110011,
0b11001100110011001100110011001100110011001100,
0b11001100110011001100110011001100110011001100,
0b00110011001100110011001100110011001100110011,
0b00110011001100110011001100110011001100110011,
0b11001100110011001100110011001100110011001100,
0b11001100110011001100110011001100110011001100,
0b00110011001100110011001100110011001100110011,
]
as an alternative to a PNG.
"""
buf = array('B')
assert len(rows) == 11
cols = (bits + 7) // 8
for col in range(cols):
for row in range(11): # [0..10]
byte_val = 0
for bit in range(8): # [0..7]
bit_val = 0
x = 8 * col + bit
if x < bits:
pixel_color = ((rows[row] >> (bits - 1 - x)) & 1) << (7 - bit)
byte_val += pixel_color
buf.append(byte_val)
return buf, cols
def bitmap(self, arg):
"""If arg is a valid and existing path name, we load it as an image.
Otherwise, we take it as a string (with ":"-notation, see bitmap_text()).

Loading…
Cancel
Save