mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add bitmaps for logos
This commit is contained in:
parent
fabb3174c7
commit
35fe7ed73f
3 changed files with 119 additions and 0 deletions
35
libs/ux-api/src/bitmaps/baochip128x128.rs
Normal file
35
libs/ux-api/src/bitmaps/baochip128x128.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
pub const BITMAP: [u32; 512] = [
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000,
|
||||
0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000,
|
||||
0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000,
|
||||
0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000,
|
||||
0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000,
|
||||
0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000003f, 0x00000000, 0x00000000, 0xe0000000, 0x0000783f, 0xfe0f0000, 0x00000003, 0xe0000000, 0x0007ffbf, 0xfefff000, 0x00000003,
|
||||
0xe0000000, 0x001fffff, 0xfffffc00, 0x00000003, 0xe0000000, 0x003fffff, 0xffffff00, 0x00000003, 0xe0000000, 0x00ffffff, 0xffffff80, 0x00000003, 0xe0000000, 0x01ffffff, 0xffffffc0, 0x00000003,
|
||||
0xe0000000, 0x01ffffff, 0xffffffe0, 0x00000003, 0xe0000000, 0x07ffffff, 0xfffffff0, 0x00000003, 0xe0000000, 0x07ffffff, 0xfffffff0, 0x00000003, 0xe0000000, 0x0fffcfff, 0xfff07ff8, 0x00000003,
|
||||
0xe0000000, 0x0fff03ff, 0xffc03ff8, 0x00000003, 0xe0000000, 0x0ffc01ff, 0xff801ff8, 0x00000003, 0xe0000000, 0x1ff8007f, 0xff800ffc, 0x00000003, 0xe0000000, 0x1ff8007f, 0xff0007fc, 0x00000003,
|
||||
0xe0000000, 0x1ff0007f, 0xff0007fc, 0x00000003, 0xe0000000, 0x1ff0007f, 0xff0007fc, 0x00000003, 0xe0000000, 0x1ff0007f, 0xff0007fc, 0x00000003, 0xe0000000, 0x1ff0007f, 0xff0007fc, 0x00000003,
|
||||
0xe0000000, 0x1ff8007f, 0xff000ffc, 0x00000003, 0xe0000000, 0x1ff8007f, 0xff800ffc, 0x00000003, 0xe0000000, 0x0ffc00ff, 0xffc03ff8, 0x00000003, 0xe0000000, 0x0ffe01ff, 0xffe07ff8, 0x00000003,
|
||||
0xe0000000, 0x0fff87ff, 0xfffffff8, 0x00000003, 0xe0000000, 0x07ffffff, 0xfffffff0, 0x00000003, 0xe0000000, 0x07ffffff, 0xfffffff0, 0x00000003, 0xe0000000, 0x03ffffff, 0xffffffe0, 0x00000003,
|
||||
0xe0000000, 0x01ffffff, 0xffffffc0, 0x00000003, 0xe0000000, 0x00ffffff, 0xffffff80, 0x00000003, 0xe0000000, 0x007fffff, 0xffffff00, 0x00000003, 0xe0000000, 0x003fffff, 0xfffffe00, 0x00000003,
|
||||
0xe0000000, 0x000fffff, 0xfffff800, 0x00000003, 0xe0000000, 0x0000fc3f, 0xfe1f8000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x001c78e0, 0x001fc000, 0x00000000, 0x00000000, 0x001c78e0, 0x007ff000, 0x00000000, 0x00000000, 0x00fffffc, 0x03fffc00, 0x00000000,
|
||||
0x00000000, 0x01fffffe, 0x07ffff00, 0x00000000, 0x00000000, 0x03ffffff, 0x1fffff80, 0x00000000, 0x00000000, 0x03ffffff, 0x1fffffc0, 0x00000000, 0x00000000, 0x03ffffff, 0x3fffffe0, 0x00000000,
|
||||
0xc0000000, 0x0fffffff, 0x7fffffe0, 0x00000000, 0xc0000000, 0x0fffffff, 0x7ffffff0, 0x00000000, 0xc0000000, 0x0fffffff, 0xfff0fff0, 0x00000000, 0x00000000, 0x03ffffff, 0xffc03ff8, 0x00000000,
|
||||
0x00000000, 0x03ffffff, 0xff800ff8, 0x00000001, 0x00000000, 0x03ffffff, 0xff800ff8, 0x00000001, 0xc0000000, 0x0fffffff, 0xff000ff8, 0x00000001, 0xc0000000, 0x0fffffff, 0xff0007fc, 0x00000001,
|
||||
0xc0000000, 0x0fffffff, 0xff0007fc, 0x00000001, 0xc0000000, 0x0fffffff, 0xff0007fc, 0x00000001, 0x00000000, 0x03ffffff, 0xff0007fc, 0x00000001, 0x00000000, 0x03ffffff, 0xff000ff8, 0x00000001,
|
||||
0x00000000, 0x03ffffff, 0xff800ff8, 0x00000001, 0xc0000000, 0x0fffffff, 0xffc01ff8, 0x00000001, 0xc0000000, 0x0fffffff, 0xffe07ff8, 0x00000000, 0xc0000000, 0x0fffffff, 0x7ffffff0, 0x00000000,
|
||||
0x00000000, 0x03ffffff, 0x7ffffff0, 0x00000000, 0x00000000, 0x03ffffff, 0x3fffffe0, 0x00000000, 0x00000000, 0x03ffffff, 0x3fffffc0, 0x00000000, 0x00000000, 0x01fffffe, 0x1fffff80, 0x00000000,
|
||||
0x00000000, 0x00fffffc, 0x0fffff00, 0x00000000, 0x00000000, 0x001c78e0, 0x07fffe00, 0x00000000, 0x00000000, 0x001c78e0, 0x01fff800, 0x00000000, 0x00000000, 0x00000000, 0x003fc000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x0000000e, 0x000e0000, 0x00000000, 0x00070000, 0x0000000e, 0x000e0000, 0x00000000, 0x00070000, 0x0000000e, 0x000e0000, 0x00000000, 0x00070000, 0x00000000,
|
||||
0x000e0000, 0x00000000, 0x00070000, 0x00000000, 0x000e0000, 0x00000000, 0x00070000, 0x00000000, 0x0fee0000, 0x0fe073f0, 0x03f707f0, 0x0003f70e, 0x1ffe0000, 0x1ff07ff8, 0x07ff0ff8, 0x0007ff0e,
|
||||
0x3e7e0000, 0x3c787e3c, 0x0fff1e3c, 0x000f1f0e, 0x781e0000, 0x783c7c1e, 0x1e0f1c1e, 0x001e0f0e, 0x701e0000, 0x701c780e, 0x1c07000e, 0x001c070e, 0x700e0000, 0x701c700e, 0x1c07000e, 0x001c070e,
|
||||
0x700e0000, 0x701c700e, 0x1c07000e, 0x001c070e, 0x701e0000, 0x701c700e, 0x1c07000e, 0x001c070e, 0x781e0000, 0x701c780e, 0x1c07001e, 0x001c070e, 0x3c3e0000, 0x783c7c1c, 0x1c071c3c, 0x001e0f0e,
|
||||
0x3ffe0000, 0x3ff87ffc, 0x1c071ff8, 0x000fff0e, 0x1fee0000, 0x1ff077f8, 0x1c070ff0, 0x0007ff0e, 0x03800000, 0x038001c0, 0x000003c0, 0x0001e700, 0x00000000, 0x00000000, 0x00000000, 0x00000700,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000700, 0x00000000, 0x00000000, 0x00000000, 0x00000700, 0x00000000, 0x00000000, 0x00000000, 0x00000700, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
];
|
||||
1
libs/ux-api/src/bitmaps/mod.rs
Normal file
1
libs/ux-api/src/bitmaps/mod.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
pub mod baochip128x128;
|
||||
83
libs/ux-api/src/bitmaps/pngtorust.py
Normal file
83
libs/ux-api/src/bitmaps/pngtorust.py
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import argparse
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
|
||||
def bitflip(data_block, bitwidth=32):
|
||||
if bitwidth == 0:
|
||||
return data_block
|
||||
|
||||
bytewidth = bitwidth // 8
|
||||
bitswapped = bytearray()
|
||||
|
||||
i = 0
|
||||
while i < len(data_block):
|
||||
data = int.from_bytes(data_block[i:i+bytewidth], byteorder='big', signed=False)
|
||||
b = '{:0{width}b}'.format(data, width=bitwidth)
|
||||
bitswapped.extend(int(b[::-1], 2).to_bytes(bytewidth, byteorder='big'))
|
||||
i = i + bytewidth
|
||||
|
||||
return bytes(bitswapped)
|
||||
|
||||
|
||||
def convert(ifile, ofile):
|
||||
# Open the image and convert it to 1-bit mode (black & white)
|
||||
im = Image.open(ifile)
|
||||
im = im.convert("1") # pixels will be either 0 (black) or 255 (white)
|
||||
|
||||
# Get pixel data in row-major order
|
||||
pixels = list(im.getdata())
|
||||
|
||||
packed = []
|
||||
current = 0
|
||||
count = 0
|
||||
|
||||
# Process each pixel: assign bit value 1 for white (255) and 0 for black (0)
|
||||
for p in pixels:
|
||||
bit = 1 if p else 0
|
||||
# Place the bit in the current 32-bit integer at the position given by count
|
||||
current |= (bit << count)
|
||||
count += 1
|
||||
if count == 32:
|
||||
packed.append(current)
|
||||
current = 0
|
||||
count = 0
|
||||
|
||||
# If there are remaining pixels that do not fill up a complete 32-bit word,
|
||||
# append the last partially-filled integer.
|
||||
if count > 0:
|
||||
packed.append(current)
|
||||
|
||||
with open(ofile, "w") as output:
|
||||
output.write("#![cfg_attr(rustfmt, rustfmt_skip)]\n")
|
||||
output.write("pub const BITMAP: [u32; 512] = [")
|
||||
for index in range(512):
|
||||
if index % 16 == 0:
|
||||
output.write("\n")
|
||||
b = packed[index]
|
||||
if index % 16 < 15:
|
||||
output.write("0x{:08x}, ".format(b))
|
||||
else:
|
||||
output.write("0x{:08x},".format(b))
|
||||
output.write("\n];\n")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Convert BMP to rust header file")
|
||||
parser.add_argument(
|
||||
"-f", "--file", required=True, help="filename to process", type=str
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o", "--output-file", required=False, help="name of output Rust file", type=str, default="logo.rs"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
ifile = args.file
|
||||
|
||||
convert(ifile, args.output_file)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Loading…
Reference in a new issue