diff --git a/tests/circuitpython-manual/_bmp16.py b/tests/circuitpython-manual/bitmaptools/_bmp16.py similarity index 100% rename from tests/circuitpython-manual/_bmp16.py rename to tests/circuitpython-manual/bitmaptools/_bmp16.py diff --git a/tests/circuitpython-manual/blend.py b/tests/circuitpython-manual/bitmaptools/blend.py similarity index 100% rename from tests/circuitpython-manual/blend.py rename to tests/circuitpython-manual/bitmaptools/blend.py diff --git a/tests/circuitpython-manual/blinka16.bmp b/tests/circuitpython-manual/bitmaptools/blinka16.bmp similarity index 100% rename from tests/circuitpython-manual/blinka16.bmp rename to tests/circuitpython-manual/bitmaptools/blinka16.bmp diff --git a/tests/circuitpython-manual/bitmaptools/dither-atkinson.bmp b/tests/circuitpython-manual/bitmaptools/dither-atkinson.bmp new file mode 100644 index 0000000000..1829b8e7ae Binary files /dev/null and b/tests/circuitpython-manual/bitmaptools/dither-atkinson.bmp differ diff --git a/tests/circuitpython-manual/bitmaptools/dither-floydstenberg.bmp b/tests/circuitpython-manual/bitmaptools/dither-floydstenberg.bmp new file mode 100644 index 0000000000..e7481b0406 Binary files /dev/null and b/tests/circuitpython-manual/bitmaptools/dither-floydstenberg.bmp differ diff --git a/tests/circuitpython-manual/bitmaptools/dither.py b/tests/circuitpython-manual/bitmaptools/dither.py new file mode 100644 index 0000000000..13d0a5be6d --- /dev/null +++ b/tests/circuitpython-manual/bitmaptools/dither.py @@ -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) diff --git a/tests/circuitpython-manual/bitmaptools/ellipse.bmp b/tests/circuitpython-manual/bitmaptools/ellipse.bmp new file mode 100644 index 0000000000..c048cb17c7 Binary files /dev/null and b/tests/circuitpython-manual/bitmaptools/ellipse.bmp differ diff --git a/tests/circuitpython-manual/minerva16.bmp b/tests/circuitpython-manual/bitmaptools/minerva16.bmp similarity index 100% rename from tests/circuitpython-manual/minerva16.bmp rename to tests/circuitpython-manual/bitmaptools/minerva16.bmp diff --git a/tests/circuitpython-manual/dither.py b/tests/circuitpython-manual/dither.py deleted file mode 100644 index 49a63c458c..0000000000 --- a/tests/circuitpython-manual/dither.py +++ /dev/null @@ -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)