Add example code and round ruler
This commit is contained in:
parent
b99dbfeb57
commit
c05c96fbf7
3 changed files with 65 additions and 1 deletions
66
README.md
66
README.md
|
|
@ -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
|
||||
```
|
||||
BIN
round-display-ruler-720p.bmp
Normal file
BIN
round-display-ruler-720p.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 507 KiB |
BIN
round-display-ruler.xcf
Normal file
BIN
round-display-ruler.xcf
Normal file
Binary file not shown.
Loading…
Reference in a new issue