tests: move bitmaptools files to their own directory
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
BIN
tests/circuitpython-manual/bitmaptools/dither-atkinson.bmp
Normal file
After Width: | Height: | Size: 150 KiB |
BIN
tests/circuitpython-manual/bitmaptools/dither-floydstenberg.bmp
Normal file
After Width: | Height: | Size: 150 KiB |
18
tests/circuitpython-manual/bitmaptools/dither.py
Normal file
@ -0,0 +1,18 @@
|
||||
import bitmaptools
|
||||
import displayio
|
||||
import _bmp16
|
||||
|
||||
if "/" in __file__:
|
||||
here = __file__.rsplit("/", 1)[0]
|
||||
else:
|
||||
here = "."
|
||||
|
||||
c = displayio.Colorspace.BGR565
|
||||
|
||||
b1 = _bmp16.loadbmp16(here + "/minerva16.bmp")
|
||||
b3 = displayio.Bitmap(320, 240, 65536)
|
||||
|
||||
bitmaptools.dither(b3, b1, c)
|
||||
_bmp16.writebmp16(f"dither-atkinson.bmp", b3)
|
||||
bitmaptools.dither(b3, b1, c, bitmaptools.DitherAlgorithm.FloydStenberg)
|
||||
_bmp16.writebmp16(f"dither-floydstenberg.bmp", b3)
|
BIN
tests/circuitpython-manual/bitmaptools/ellipse.bmp
Normal file
After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
@ -1,31 +0,0 @@
|
||||
import bitmaptools
|
||||
import displayio
|
||||
import _bmp16
|
||||
|
||||
if "/" in __file__:
|
||||
here = __file__.rsplit("/", 1)[0]
|
||||
else:
|
||||
here = "."
|
||||
|
||||
c = displayio.Colorspace.BGR565
|
||||
|
||||
b1 = _bmp16.loadbmp16(here + "/minerva16.bmp")
|
||||
b3 = displayio.Bitmap(320, 240, 65536)
|
||||
|
||||
for i in (
|
||||
0,
|
||||
1 / 64,
|
||||
3 / 64,
|
||||
3 / 32,
|
||||
3 / 16,
|
||||
0.5,
|
||||
1 - 3 / 16,
|
||||
1 - 3 / 32,
|
||||
1 - 3 / 64,
|
||||
1 - 1 / 64,
|
||||
1,
|
||||
):
|
||||
bitmaptools.dither(b3, b1, c)
|
||||
_bmp16.writebmp16(f"dither-atkinson.bmp", b3)
|
||||
bitmaptools.dither(b3, b1, c, bitmaptools.DitherAlgorithm.FloydStenberg)
|
||||
_bmp16.writebmp16(f"dither-floydstenberg.bmp", b3)
|