kopia lustrzana https://github.com/russhughes/st7789py_mpy
Update rgb_to_color565
rodzic
30384dbd0b
commit
ea6918ed8f
|
@ -56,8 +56,10 @@ def rgb_to_color565(r, g, b):
|
||||||
Returns:
|
Returns:
|
||||||
int: Converted color value in the 16-bit color format (565).
|
int: Converted color value in the 16-bit color format (565).
|
||||||
"""
|
"""
|
||||||
|
r = ((r * 31) // (255))
|
||||||
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b & 0xF8)
|
g = ((g * 63) // (255))
|
||||||
|
b = ((b * 31) // (255))
|
||||||
|
return (r << 11) | (g << 5) | b
|
||||||
|
|
||||||
|
|
||||||
def convert_to_bitmap(image_file, bits_requested):
|
def convert_to_bitmap(image_file, bits_requested):
|
||||||
|
|
Ładowanie…
Reference in New Issue