Commit Graph

4 Commits

Author SHA1 Message Date
Dan Halbert 0d2c3c3f08 wip: continuing compilation fixes; mp_obj_alloc everywhere 2023-08-07 20:45:57 -04:00
gamblor21 0c95e6a08e Moving to gifio module 2023-02-12 11:17:34 -06:00
Jeff Epler b2cc8d2aad
run black_bindings across all bindings 2022-09-27 15:21:42 -05:00
Jeff Epler c34b6f757f Implement gifio.GifWriter
This involves:
 * Adding a new "L8" colorspace for colorconverters
 * factoring out displayio_colorconverter_convert_pixel
 * Making a minimal "colorspace only" version of displayio for the
   unix port (testing purposes)
 * fixing an error message

I only tested writing B&W animated images, with the following script:
```python
import displayio
import gifio

with gifio.GifWriter("foo.gif", 64, 64, displayio.Colorspace.L8) as g:
    for i in range(0, 256, 14):
        data = bytes([i, 255-i] * 32 + [255-i, i] * 32) * 32
        print("add_frame")
        g.add_frame(data)

# expected to raise an error, buffer is not big enough
with gifio.GifWriter("/dev/null", 64, 64, displayio.Colorspace.L8) as g:
    g.add_frame(bytes([3,3,3]))
```
2021-10-26 08:54:18 -05:00