.. _xml_images: ====== Images ====== Overview ******** An ```` section can be added to ``globals.xml`` files. Later, it might also be supported in components and widgets to define local images and keep the global space cleaner. This ```` section describes how to map images with names. Only ```` is currently supported, and ```` is not yet implemented. Usage ***** .. code-block:: xml - ```` means that the image source is used as a file path: - ```` means that the image is converted to a C array on export. In both cases in the exported C code global ``const void * `` variables are created and in the initialization function of the component library (e.g. ``my_lib_init_gen()``) either the path or the pointer to the converted :cpp:expr:`lv_image_dsc_t` pointers are assigned to that variable. In :cpp:expr:`lv_image_set_src(image, )` is used instead of the path or :cpp:expr:`lv_image_dsc_t` pointer directly. For simplicity, in the UI Editor preview, images are always loaded as files. If the UI is created from XML at runtime and a ``globals.xml`` is parsed, the ```` tags are skipped because it is assumed that the user manually creates the mapping. This is because the XML parser cannot automatically map an image like: .. code-block:: c lv_image_dsc_t my_logo; to .. code-block:: xml Constants --------- Constants can be used with images as well. .. code-block:: xml