2024-01-04 07:25:13 +01:00
|
|
|
.. _gif:
|
|
|
|
|
2023-04-27 06:42:02 -06:00
|
|
|
===========
|
|
|
|
GIF decoder
|
|
|
|
===========
|
|
|
|
|
2024-01-04 07:25:13 +01:00
|
|
|
Allow using GIF images in LVGL.
|
|
|
|
|
2024-01-06 08:34:02 +01:00
|
|
|
Detailed introduction: https://github.com/lecram/gifdec
|
2023-04-27 06:42:02 -06:00
|
|
|
|
|
|
|
When enabled in ``lv_conf.h`` with :c:macro:`LV_USE_GIF`
|
2024-01-04 07:25:13 +01:00
|
|
|
:cpp:expr:`lv_gif_create(parent)` can be used to create a gif widget.
|
2023-04-27 06:42:02 -06:00
|
|
|
|
2024-01-04 07:25:13 +01:00
|
|
|
:cpp:expr:`lv_gif_set_src(obj, src)` works very similarly to :cpp:func:`lv_image_set_src`.
|
2023-09-27 12:23:40 +02:00
|
|
|
As source, it also accepts images as variables (:c:struct:`lv_image_dsc_t`) or
|
2023-04-27 06:42:02 -06:00
|
|
|
files.
|
|
|
|
|
|
|
|
Convert GIF files to C array
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
To convert a GIF file to byte values array use `LVGL's online
|
|
|
|
converter <https://lvgl.io/tools/imageconverter>`__. Select "Raw" color
|
|
|
|
format and "C array" Output format.
|
|
|
|
|
|
|
|
Use GIF images from file
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
.. code:: c
|
|
|
|
|
|
|
|
lv_gif_set_src(obj, "S:path/to/example.gif");
|
|
|
|
|
|
|
|
Note that, a file system driver needs to be registered to open images
|
2024-01-04 07:25:13 +01:00
|
|
|
from files. Read more about it :ref:`overview_file_system` or just
|
2023-04-27 06:42:02 -06:00
|
|
|
enable one in ``lv_conf.h`` with ``LV_USE_FS_...``
|
|
|
|
|
|
|
|
Memory requirements
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
To decode and display a GIF animation the following amount of RAM is
|
|
|
|
required:
|
|
|
|
|
|
|
|
- :c:macro:`LV_COLOR_DEPTH` ``8``: 3 x image width x image height
|
|
|
|
- :c:macro:`LV_COLOR_DEPTH` ``16``: 4 x image width x image height
|
|
|
|
- :c:macro:`LV_COLOR_DEPTH` ``32``: 5 x image width x image height
|
|
|
|
|
2024-01-04 07:25:13 +01:00
|
|
|
.. _gif_example:
|
|
|
|
|
2023-04-27 06:42:02 -06:00
|
|
|
Example
|
|
|
|
-------
|
|
|
|
|
|
|
|
.. include:: ../examples/libs/gif/index.rst
|
|
|
|
|
2024-01-04 07:25:13 +01:00
|
|
|
.. _gif_api:
|
|
|
|
|
2023-04-27 06:42:02 -06:00
|
|
|
API
|
|
|
|
---
|
|
|
|
|
|
|
|
:ref:`gifdec`
|
2023-05-08 08:45:28 -06:00
|
|
|
|