add image type (#730)

This commit is contained in:
Guillermo Ruffino 2020-08-11 10:28:43 -03:00 committed by GitHub
parent db88fe7e32
commit 8fc0ec0c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -331,6 +331,12 @@ Configuration variables:
in your display code.
- **resize** (*Optional*, int): If set, this will resize the image to fit inside the given dimensions ``WIDTHxHEIGHT``
and preserve the aspect ratio.
- **type** (*Optional*): Specifies how to encode image internally. Defaults to ``BINARY``.
- ``BINARY``: Two colors, suitable for 1 color displays or 2 color image in color displays. Uses 1 bit
per pixel, 8 pixels per byte.
- ``GREYSCALE``: Full scale grey. Uses 8 bits per pixel, 1 pixel per byte.
- ``RGB24``: Full RGB color stored. Uses 3 bytes per pixel.
.. note::
@ -349,6 +355,22 @@ And then later in code:
// Draw the image my_image at position [x=0,y=0]
it.image(0, 0, id(my_image));
For binary images the ``image`` method accepts two additional color parameters which can
be supplied to modify the color used to represent the on and off bits respectively. e.g.
.. code-block:: yaml
display:
- platform: ...
# ...
lambda: |-
// Draw the image my_image at position [x=0,y=0]
// with front color red and back color blue
it.image(0, 0, id(my_image), id(red), id(blue));
You can also use this to invert images in two colors display, use ``COLOR_OFF`` then ``COLOR_ON``
as the additional parameters.
.. _display-pages:
Display Pages