Lines Matching full:the

7 An image can be a file or a variable which stores the bitmap itself and
24 :cpp:struct:`lv_image_dsc_t` structure with the following fields:
33 - **data**: pointer to an array where the image itself is stored
37 into the resulting executable like any other constant data.
49 is just an abstraction to read and/or write data to memory. See the
52 Images stored as files are not linked into the resulting executable, and
55 easier to replace without needing to rebuild the main program.
64 - :cpp:enumerator:`LV_COLOR_FORMAT_NATIVE`: Simply stores the RGB colors (in whatever color depth L…
69 …**Only stores the Alpha value with 1, 2, 4 or 8 bits.** The pixels take the color of ``style.img_r…
70 the set opacity. The source image has to be an alpha channel. This is
71 ideal for bitmaps similar to fonts where the whole image is one color
74 The bytes of :cpp:enumerator:`LV_COLOR_FORMAT_NATIVE` images are stored in the following order.
90 with one of the built-in color formats and an external :ref:`Image decoder <overview_image_decoder>`
91 needs to be used to decode the image.
101 - using the online converter
107 The online Image converter is available here:
110 Adding an image to LVGL via the online converter is easy.
113 2. Give the image a name that will be used within LVGL.
114 3. Select the :ref:`Color format <overview_image_color_formats>`.
115 4. Select the type of image you want. Choosing a binary will generate a
116 …``.bin`` file that must be stored separately and read using the :ref:`file support <overview_image…
118 5. Hit the *Convert* button. Once the conversion is finished, your
119 browser will automatically download the resulting file.
121 In the generated C arrays (variables), bitmaps for all the color depths
122 (1, 8, 16 or 32) are included in the C file, but only the color depth
124 into the resulting executable.
126 In the case of binary files, you need to specify the color format you
149 .header.cf = LV_COLOR_FORMAT_NATIVE, /* Set the color format */
154 run-time is to use the :ref:`Canvas <lv_canvas>` Widget.
159 The simplest way to use an image in LVGL is to display it with an
172 If the image was converted with the online converter, you should use
173 :cpp:expr:`LV_IMAGE_DECLARE(my_icon_dsc)` to declare the image in the file where
181 As you can see in the :ref:`overview_image_color_formats` section, LVGL
187 and attach them to LVGL via the *Image decoder* interface.
191 :info: get some basic info about the image (width, height and color format).
194 - set it to ``NULL`` to indicate the image can be read line-by-line.
196 :close: close an opened image, free the allocated resources.
199 drawn, the library will try all the registered image decoders until it
200 finds one which can open the image, i.e. one which knows that format.
202 The following formats are understood by the built-in decoder:
218 The easiest way to create a custom image is to use the online image
220 It will just take every byte of the
223 the real, renderable bitmap.
226 accordingly. You should choose the correct format according to your needs:
229 After decoding, the *raw* formats are considered *True color* by the
230 library. In other words, the image decoder must decode the *Raw* images
231 to *True color* according to the format described in the :ref:`overview_image_color_formats` sectio…
240 open/close the PNG files. It should look like this:
254 * @param decoder pointer to the decoder where this function belongs
257 * @return LV_RESULT_OK: no error; LV_RESULT_INVALID: can't get the info
261 /* Check whether the type `src` is known by the decoder */
264 /* Read the PNG header and find `width` and `height` */
274 * @param decoder pointer to the decoder where this function belongs
276 * @return LV_RESULT_OK: no error; LV_RESULT_INVALID: can't open the image
282 /* Check whether the type `src` is known by the decoder */
285 …/* Decode and store the image. If `dsc->decoded` is `NULL`, the `decoder_get_area` function will b…
288 …/* Change the color format if decoded image format is different than original format. For PNG it's…
291 …decoder function if required. It's not required if `my_png_decoder` opened the image in true color…
299 * @param decoder pointer to the decoder where this function belongs
301 * @param full_area input parameter. the full area to decode after enough subsequent calls
302 …* @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call …
303 * the decoded area is stored here after each call.
312 * incrementally decode the image by calling it repeatedly until it returns `LV_RESULT_INVALID`.
313 …* In the example below the image is decoded line-by-line but the decoded area can have any shape a…
314 * depending on the requirements and capabilities of the image decoder.
324 decoded_area->y2 = decoded_area->y1; /* decode line-by-line, starting with the first line */
326 /* create a draw buf the size of one line */
342 /* otherwise decoding is already in progress. decode the next line */
357 * @param decoder pointer to the decoder where this function belongs
359 * @return LV_RESULT_OK: no error; LV_RESULT_INVALID: can't open the image
369 /* Call the built-in close function if the built-in open/get_area was used */
376 - In ``decoder_info``, you should collect some basic information about the image and store it in ``…
377 - In ``decoder_open``, you should try to open the image source pointed by
379 If this format/type is not supported by the decoder, return :cpp:enumerator:`LV_RESULT_INVALID`.
380 However, if you can open the image, a pointer to the decoded image should be
381 set in ``dsc->decoded``. If the format is known, but you don't want to
382 decode the entire image (e.g. no memory for it), set ``dsc->decoded = NULL`` and
383 use ``decoder_get_area`` to get the image area pixels.
385 - ``decoder_get_area`` is optional. In this case you should decode the whole image In
387 Decoding the whole image requires extra memory and some computational overhead.
394 draw a raw image (i.e. using the ``lv_image`` Widget) but you can use them
396 the decoding session and call :cpp:func:`lv_image_decoder_open`.
398 The ``color`` parameter is used only with ``LV_COLOR_FORMAT_A1/2/4/8``
399 images to tell color of the image.
410 …/* Do something with `dsc->decoded`. You can copy out the decoded image by `lv_draw_buf_dup(dsc.de…
423 …tom post-processing function after ``lv_image_decoder_open`` to adjust the data in the image cache,
424 and then mark the processing status in ``cache_entry->process_state`` (to avoid repeated post-proce…
426 See the detailed code below:
507 inefficient and detrimental to the user experience.
514 store the decoded image. LVGL tries to optimize the process as much as
523 The size of cache (in bytes) can be defined with
524 :c:macro:`LV_CACHE_DEF_SIZE` in *lv_conf.h*. The default value is 0, so
527 The size of cache can be changed at run-time with
534 When you use more images than available cache size, LVGL can't cache all the
535 images. Instead, the library will close one of the cached images to free
539 made of how long it took to open the image. Cache entries that hold
540 slower-to-open images are considered more valuable and are kept in the
544 the *weight* value in the cache entry in
549 through the cache, the *life* value of all entries is increased by their
554 If there is no more space in the cache, the entry with *usage_count == 0*
564 Therefore, it's the user's responsibility to be sure there is enough RAM
565 to cache even the largest images at the same time.
567 Clean the cache
571 variable and use it in an ``lv_image`` Widget. If the image is already
572 cached and you then change the underlying PNG file, you need to notify
573 LVGL to cache the image again. Otherwise, there is no easy way of
574 detecting that the underlying file changed and LVGL will still draw the
582 If you want to implement your own cache algorithm, you can refer to the
583 following code to replace the LVGL built-in cache manager:
634 /* Replace existing cache manager with the new one. */