Skip to content

Commit 8355d8f

Browse files
author
Melissa LeBlanc-Williams
committed
Got 16-bit color working perfect
1 parent 38e2d8e commit 8355d8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/ra8875_bmptest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
display.fill(WHITE)
2929

3030
def color555(rgb):
31-
return (rgb & 0x001F) << 11 | (rgb & 0x0700) | (rgb & 0x0060) << 1 | 0x20 | (rgb & 0xF800) >> 11
31+
return (rgb & 0x7C00) << 1 | (rgb & 0x03E0) << 1 | 0x20 | rgb & 0x001F
3232

3333
class BMP(object):
3434
def __init__(self, filename):
@@ -75,7 +75,7 @@ def draw(self, disp, x=0, y=0):
7575
if (line_size-i) < self.bpp//8:
7676
break
7777
if self.bpp == 16:
78-
color = color555(line_data[i] << 8 | line_data[i+1])
78+
color = color555(line_data[i] | line_data[i+1] << 8)
7979
if self.bpp == 24:
8080
color = color565(line_data[i+2], line_data[i+1], line_data[i])
8181
current_line_data = current_line_data + struct.pack(">H", color)

0 commit comments

Comments
 (0)