Fixed handling tuple from the image function
This commit is contained in:
parent
036f48d3c5
commit
f98d45ab42
1 changed files with 6 additions and 3 deletions
|
|
@ -151,9 +151,12 @@ class RGB888Format:
|
|||
def set_pixel(framebuf, x, y, color):
|
||||
"""Set a given pixel to a color."""
|
||||
index = (y * framebuf.stride + x) * 3
|
||||
framebuf.buf[index : index + 3] = bytes(
|
||||
((color >> 16) & 255, (color >> 8) & 255, color & 255)
|
||||
)
|
||||
if isinstance(color, tuple):
|
||||
framebuf.buf[index : index + 3] = bytes(color)
|
||||
else:
|
||||
framebuf.buf[index : index + 3] = bytes(
|
||||
((color >> 16) & 255, (color >> 8) & 255, color & 255)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_pixel(framebuf, x, y):
|
||||
|
|
|
|||
Loading…
Reference in a new issue