Commit 0504b778 authored by Malte Schmitz's avatar Malte Schmitz

Fix C code

parent da4f2df9
uint32_t[62] = {0x2aa0,0x2aa0,0x2aa0,0x7fe0,0xfff0,0x1fff8,0xfffff,0x1fff8,0xfffff,0x1fff8,0xff83f,0x1f018,0xff7df,0x1f7d8,0xff39f,0x1fbb8,0xfff0,0x7fe0,0x5540,0x5540,0x5540,0x0,0xfe0,0x80,0x80,0xf80,0x0,0xe80,0xa80,0xa80,0xf80,0x0,0xf80,0x880,0x880,0xf80,0x0,0xfc0,0x880,0x0,0xfa0,0x0,0xfe0,0x200,0x500,0x880,0x0,0xf80,0x800,0x800,0xf80,0x0,0xf80,0x80,0x80,0xf80,0x80,0x80,0xf80,0x0,0x0,0x0};
██ ██ ██ ██ ██
██ ██ ██ ██ ██
██ ██ ██ ██ ██
████████████████████
████████████████████████
██████████ ██████ ████
██████████████████ ██ ████████████
██████████████ ████████
██████████████████████ ████████████████
████████████████████████████
██████████ ██████ ████████████
████ ████ ████
██████████ ████ ██████████ ██████████
████ ████ ██████████ ████
██████████ ████ ██████ ██████████
████ ██████ ██████ ██████
████████████████████████
████████████████████
██ ██ ██ ██ ██
██ ██ ██ ██ ██
██ ██ ██ ██ ██
██████████████
██
██
██████████
██████ ██
██ ██ ██
██ ██ ██
██████████
██████████
██ ██
██ ██
██████████
████████████
██ ██
██████████ ██
██████████████
██
██ ██
██ ██
██████████
██
██
██████████
██████████
██
██
██████████
██
██
██████████
uint32_t[62] = {0x2aa0,0x2aa0,0x2aa0,0x7fe0,0xfff0,0x1f398,0xff93f,0x1fc78,0xffeff,0x1fff8,0xfb83f,0x1b018,0xfb7df,0x1b7d8,0xfb39f,0x1bbb8,0xfff0,0x7fe0,0x5540,0x5540,0x5540,0x0,0xfe0,0x80,0x80,0xf80,0x0,0xe80,0xa80,0xa80,0xf80,0x0,0xf80,0x880,0x880,0xf80,0x0,0xfc0,0x880,0x0,0xfa0,0x0,0xfe0,0x200,0x500,0x880,0x0,0xf80,0x800,0x800,0xf80,0x0,0xf80,0x80,0x80,0xf80,0x80,0x80,0xf80,0x0,0x0,0x0};
for (int x = 0; x < 62; x++) {
uint32_t line = pixels[x];
for (int y = 0; y < 20: y++) {
for (int y = 0; y < 20; y++) {
uint32_t color = 0;
if (line && (1 << y)) {
if (line & (1 << y)) {
color = 0xFFFFFF;
}
strip.setPixelColor(y, color);
......
......@@ -7,21 +7,24 @@ def p(a):
black = r == 0 and g == 0 and b == 0
if not black:
result |= 1 << i
return hex(result)
return result
img = Image.open("20px-color.bmp").convert('RGB')
img = Image.open("20px-mono.bmp").convert('RGB')
width, height = img.size
pixels = [p([img.getpixel((x,y)) for y in range(height)]) for x in range(width)]
array = "{" + ",".join(pixels) + "}"
print("\n".join([format(p, '020b').replace('0', ' ').replace('1', '██') for p in pixels]))
print("\n\n\n\n\n")
array = "{" + ",".join([hex(p) for p in pixels]) + "}"
code = """uint32_t[{width}] = {array};
for (int x = 0; x < {width}; x++) {{
uint32_t line = pixels[x];
for (int y = 0; y < {height}: y++) {{
for (int y = 0; y < {height}; y++) {{
uint32_t color = 0;
if (line && (1 << y)) {{
if (line & (1 << y)) {{
color = 0xFFFFFF;
}}
strip.setPixelColor(y, color);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment