INNER CODE UNIT · Python

upto

Hykudoru/Pescado-Engine-Embedded-ESP32S3 · lib/TFT_eSPI-2.5.34/Tools/bmp2array4bit/bmp2array4bit.py:162

    upto =  startOfDefinitions + (i * 4)
    blue = contents[upto]
    green = contents[upto + 1]
    red = contents[upto + 2]
    # ignore the alpha channel.

    # data = struct.pack("BBBB", contents[upto], contents[upto+1], contents[upto+2], contents[upto+3])
    # t = struct.unpack("I", bytearray(data))
    # colorIndex[i] = t[0]

    colorIndex[i] = (((red & 0xf8)<<8) + ((green & 0xfc)<<3)+(blue>>3))
    debugOut("color at index {0} is {1:04x}, (r,g,b,a) = ({2:02x}, {3:02x}, {4:02x}, {5:02x})".format(i,  colorIndex[i], red, green, blue, contents[upto+3]))

#debugOut(the color definitions
# for i in range(colorsUsed[0]):    
#     print hex(colorIndex[i])

# perfect, except upside down.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…