Skip to content

Commit

Permalink
Merge pull request #113 from adafruit/matrix_fill_color_swap
Browse files Browse the repository at this point in the history
Fixing matrix.fill color flipping
  • Loading branch information
makermelissa authored Feb 21, 2023
2 parents 9b321db + 3428c47 commit 2591785
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions adafruit_ht16k33/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ def image(self, img: Image) -> None:
imwidth, imheight = img.size
if imwidth != self.columns or imheight != self.rows:
raise ValueError(
"Image must be same dimensions as display ({0}x{1}).".format(
self.columns, self.rows
)
f"Image must be same dimensions as display ({self.columns}x{self.rows})."
)
# Grab all the pixels from the image, faster than getpixel.
pixels = img.convert("1").load()
Expand Down Expand Up @@ -259,8 +257,8 @@ def fill(self, color: int) -> None:
fill1 = 0xFF if color & 0x01 else 0x00
fill2 = 0xFF if color & 0x02 else 0x00
for i in range(8):
self._set_buffer(i * 2, fill1)
self._set_buffer(i * 2 + 1, fill2)
self._set_buffer(i * 2 + 1, fill1)
self._set_buffer(i * 2, fill2)
if self._auto_write:
self.show()

Expand All @@ -274,9 +272,7 @@ def image(self, img: Image) -> None:
imwidth, imheight = img.size
if imwidth != self.columns or imheight != self.rows:
raise ValueError(
"Image must be same dimensions as display ({0}x{1}).".format(
self.columns, self.rows
)
f"Image must be same dimensions as display ({self.columns}x{self.rows})."
)
# Grab all the pixels from the image, faster than getpixel.
pixels = img.convert("RGB").load()
Expand Down

0 comments on commit 2591785

Please sign in to comment.