Add example code and round ruler

This commit is contained in:
Scott Shawcroft 2023-09-27 11:34:00 -07:00
parent b99dbfeb57
commit c05c96fbf7
No known key found for this signature in database
GPG key ID: 0DFD512649C052DA
3 changed files with 65 additions and 1 deletions

View file

@ -1,2 +1,66 @@
# display-ruler
Display test image
Display test image useful for checking size, alignment and color order.
## Small rectangular displays
```python
import displayio
# Initialize the display in the display variable
ruler = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(ruler, pixel_shader=ruler.pixel_shader)
g = displayio.Group()
g.append(t)
display.show(g)
display.refresh()
while True:
pass
```
## Large rectangular displays
```python
import displayio
# Initialize the display in the display variable
ruler = displayio.OnDiskBitmap("/display-ruler-720p.bmp")
t = displayio.TileGrid(ruler, pixel_shader=ruler.pixel_shader)
g = displayio.Group()
g.append(t)
display.show(g)
display.refresh()
while True:
pass
```
## Round displays
```python
import displayio
# Initialize the display in the display variable
ruler = displayio.OnDiskBitmap("/round-display-ruler-720p.bmp")
t = displayio.TileGrid(ruler, pixel_shader=ruler.pixel_shader)
# Center the image
t.x -= (ruler.width - display.width) // 2
t.y -= (ruler.height - display.height) // 2
g = displayio.Group()
g.append(t)
display.show(g)
display.refresh()
while True:
pass
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 KiB

BIN
round-display-ruler.xcf Normal file

Binary file not shown.