Lines Matching refs:image

7 An image can be a file or a variable which stores the bitmap itself and
33 - **data**: pointer to an array where the image itself is stored
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
91 needs to be used to decode the image.
93 - :cpp:enumerator:`LV_COLOR_FORMAT_RAW`: Indicates a basic raw image (e.g. a PNG or JPG image).
94 - :cpp:enumerator:`LV_COLOR_FORMAT_RAW_ALPHA`: Indicates that an image has alpha and an alpha byte …
110 Adding an image to LVGL via the online converter is easy.
112 1. You need to select a *BMP*, *PNG* or *JPG* image first.
113 2. Give the image a name that will be used within LVGL.
115 4. Select the type of image you want. Choosing a binary will generate a
134 Manually create an image
137 If you are generating an image at run-time, you can craft an image
153 Another (possibly simpler) option to create and display an image at
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
182 supports several built-in image formats. In many cases, these will be
183 all you need. LVGL doesn't directly support, however, generic image
186 To handle non-built-in image formats, you need to use external libraries
189 An image decoder consists of 4 callbacks:
191 :info: get some basic info about the image (width, height and color format).
192 :open: open an image:
193 - store a decoded image
194 - set it to ``NULL`` to indicate the image can be read line-by-line.
195 :get_area: if *open* didn't fully open an image this function should give back part of image as dec…
196 :close: close an opened image, free the allocated resources.
198 You can add any number of image decoders. When an image needs to be
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.
215 Custom image formats
218 The easiest way to create a custom image is to use the online image
221 binary file you uploaded and write it as an image "bitmap". You then
222 need to attach an image decoder that will parse that bitmap and generate
227 a fully opaque image, using an alpha channel.
230 library. In other words, the image decoder must decode the *Raw* images
234 Registering an image decoder
239 First, you need to create a new image decoder and set some functions to
253 * Get info about a PNG image
256 * @param header image information is set in header parameter
273 * Open a PNG image and decode it into dsc.decoded
275 * @param dsc image descriptor
276 * @return LV_RESULT_OK: no error; LV_RESULT_INVALID: can't open the image
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 …/* Call a binary image decoder function if required. It's not required if `my_png_decoder` opened …
298 * Decode an area of image
300 * @param dsc image decoder descriptor
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.
356 * Close PNG image and free data
358 * @param dsc image decoder descriptor
359 * @return LV_RESULT_OK: no error; LV_RESULT_INVALID: can't open the image
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
380 However, if you can open the image, a pointer to the decoded image should be
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
386 ``decoder_open`` function and store image data in ``dsc->decoded``.
387 Decoding the whole image requires extra memory and some computational overhead.
390 Manually use an image decoder
393 LVGL will use registered image decoders automatically if you try and
394 draw a raw image (i.e. using the ``lv_image`` Widget) but you can use them
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…
418 Considering that some hardware has special requirements for image formats,
419 such as alpha premultiplication and stride alignment, most image decoders (such as PNG decoders)
420 may not directly output image data that meets hardware requirements.
422 For this reason, LVGL provides a solution for image post-processing.
423 …tom post-processing function after ``lv_image_decoder_open`` to adjust the data in the image cache,
488 LV_LOG_ERROR("Failed to open image");
494 LV_LOG_ERROR("Failed to post-process image");
505 Sometimes it takes a lot of time to open an image. Continuously decoding
506 a PNG/JPEG image or loading images from a slow external memory would be
509 Therefore, LVGL caches image data. Caching means some
514 store the decoded image. LVGL tries to optimize the process as much as
525 no image is cached.
538 To decide which image to close, LVGL uses a measurement it previously
539 made of how long it took to open the image. Cache entries that hold
548 Every cache entry has a *"life"* value. Every time an image is opened
551 When a cached image is used, its *usage_count* value is increased
560 Note that a cached image might continuously consume memory. For example,
570 Let's say you have loaded a PNG image into a :cpp:struct:`lv_image_dsc_t` ``my_png``
571 variable and use it in an ``lv_image`` Widget. If the image is already
573 LVGL to cache the image again. Otherwise, there is no easy way of
575 old image from cache.