Skip to content

Commit 8c1dbf7

Browse files
authored
Merge pull request #20 from lesamouraipourpre/ondiskbitmap-changes
Update the pixel_shader usage of OnDiskBitmap
2 parents a0bf826 + ebd4118 commit 8c1dbf7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

examples/gizmo_eink_simpletest.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@
1616
with open("/display-ruler.bmp", "rb") as file:
1717
picture = displayio.OnDiskBitmap(file)
1818
# Create a Tilegrid with the bitmap and put in the displayio group
19-
sprite = displayio.TileGrid(picture, pixel_shader=displayio.ColorConverter())
19+
# CircuitPython 6 & 7 compatible
20+
sprite = displayio.TileGrid(
21+
picture,
22+
pixel_shader=getattr(picture, "pixel_shader", displayio.ColorConverter()),
23+
)
24+
# CircuitPython 7 compatible only
25+
# sprite = displayio.TileGrid(picture, pixel_shader=bitmap.pixel_shader)
2026
display_group.append(sprite)
2127

2228
# Place the display group on the screen

examples/gizmo_tft_thermometer.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ def c_to_f(c_val):
4444
bitmap = displayio.OnDiskBitmap(bitmap_file)
4545

4646
# Create a TileGrid to hold the bitmap
47-
tile_grid = displayio.TileGrid(bitmap, pixel_shader=displayio.ColorConverter())
47+
# CircuitPython 6 & 7 compatible
48+
tile_grid = displayio.TileGrid(
49+
bitmap,
50+
pixel_shader=getattr(bitmap, "pixel_shader", displayio.ColorConverter()),
51+
)
52+
# CircuitPython 7 compatible only
53+
# tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
4854

4955
# Create a Group to hold the TileGrid
5056
group = displayio.Group()

0 commit comments

Comments
 (0)