Skip to content

Commit 1a0ab6f

Browse files
authored
Merge pull request #11 from lesamouraipourpre/ondiskbitmap-changes
Update the pixel_shader usage of OnDiskBitmap
2 parents b2988eb + 2e77d56 commit 1a0ab6f

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

README.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ Usage Example
8585
f = open("/display-ruler.bmp", "rb")
8686
8787
pic = displayio.OnDiskBitmap(f)
88-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
88+
# CircuitPython 6 & 7 compatible
89+
t = displayio.TileGrid(
90+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
91+
)
92+
# CircuitPython 7 compatible only
93+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
8994
g.append(t)
9095
9196
display.show(g)

adafruit_il91874.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@
2020
2121
**Software and Dependencies:**
2222
23-
* Adafruit CircuitPython firmware (version 5+) for the supported boards:
23+
* Adafruit CircuitPython firmware for the supported boards:
2424
https://github.com/adafruit/circuitpython/releases
2525
26-
# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
27-
# * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
2826
"""
2927

3028
import displayio

examples/il91874_simpletest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@
4242
with open("/display-ruler.bmp", "rb") as f:
4343
pic = displayio.OnDiskBitmap(f)
4444
# Create a Tilegrid with the bitmap and put in the displayio group
45-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
45+
# CircuitPython 6 & 7 compatible
46+
t = displayio.TileGrid(
47+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
48+
)
49+
# CircuitPython 7 compatible only
50+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
4651
g.append(t)
4752

4853
# Place the display group on the screen (does not refresh)

0 commit comments

Comments
 (0)