# lv_draw_image.h (/api/draw/lv_draw_image_h)



<RelatedHeaders name="lv_draw_image_private.h" isPrivate="false" />

<ApiSummary functions="5" structs="1" typedefs="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Getters (2)&#x22;,&#x22;Other (3)&#x22;]">
  <ApiTab value="Getters (2)">
    <ApiMember kind="function" name="lv_draw_task_get_image_dsc" file="draw/lv_draw_image.h" line="130" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/lv_draw_image.h#L130">
      lv_draw_task_get_image_dsc [#lv_draw_task_get_image_dsc]

      Try to get an image draw descriptor from a draw task.

      ```c title=" " lineNumbers=1
      lv_draw_image_dsc_t * lv_draw_task_get_image_dsc(lv_draw_task_t *task)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                                         | Description |
      | ------ | ------------------------------------------------------------ | ----------- |
      | `task` | <ApiLink name="lv_draw_task_t" display="lv_draw_task_t *" /> | draw task   |

      **Returns:** <ApiLink name="lv_draw_image_dsc_t" display="lv_draw_image_dsc_t *" /> — the task's draw descriptor or NULL if the task is not of type LV\_DRAW\_TASK\_TYPE\_IMAGE
    </ApiMember>

    <ApiMember kind="function" name="lv_image_src_get_type" file="draw/lv_draw_image.h" line="161" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/lv_draw_image.h#L161">
      lv_image_src_get_type [#lv_image_src_get_type]

      Get the type of an image source

      ```c title=" " lineNumbers=1
      lv_image_src_t lv_image_src_get_type(const void *src)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type           | Description                                                                                                                                                                                                                    |
      | ----- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
      | `src` | `const void *` | pointer to an image source:<br />- pointer to an 'lv\_image\_t' variable (image stored internally and compiled into the code)<br />- a path to a file (e.g. "S:/folder/image.bin")<br />- or a symbol (e.g. LV\_SYMBOL\_CLOSE) |

      **Returns:** <ApiLink name="lv_image_src_t" /> — type of the image source LV\_IMAGE\_SRC\_VARIABLE/FILE/SYMBOL/UNKNOWN
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (3)">
    <ApiMember kind="function" name="lv_draw_image_dsc_init" file="draw/lv_draw_image.h" line="123" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/lv_draw_image.h#L123">
      lv_draw_image_dsc_init [#lv_draw_image_dsc_init]

      Initialize an image draw descriptor.

      ```c title=" " lineNumbers=1
      void lv_draw_image_dsc_init(lv_draw_image_dsc_t *dsc)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                                   | Description                  |
      | ----- | ---------------------------------------------------------------------- | ---------------------------- |
      | `dsc` | <ApiLink name="lv_draw_image_dsc_t" display="lv_draw_image_dsc_t *" /> | pointer to a draw descriptor |
    </ApiMember>

    <ApiMember kind="function" name="lv_draw_image" file="draw/lv_draw_image.h" line="141" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/lv_draw_image.h#L141">
      lv_draw_image [#lv_draw_image]

      Create an image draw task

      ```c title=" " lineNumbers=1
      void lv_draw_image(lv_layer_t *layer, const lv_draw_image_dsc_t *dsc, const lv_area_t *coords)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type                                                                         | Description                               |
      | -------- | ---------------------------------------------------------------------------- | ----------------------------------------- |
      | `layer`  | <ApiLink name="lv_layer_t" display="lv_layer_t *" />                         | pointer to a layer                        |
      | `dsc`    | <ApiLink name="lv_draw_image_dsc_t" display="const lv_draw_image_dsc_t *" /> | pointer to an initialized draw descriptor |
      | `coords` | <ApiLink name="lv_area_t" display="const lv_area_t *" />                     | the coordinates of the image              |

      <Callout type="info">
        `coords` can be small than the real image area (if only a part of the image is rendered) or can be larger (in case of tiled images). .
      </Callout>
    </ApiMember>

    <ApiMember kind="function" name="lv_draw_layer" file="draw/lv_draw_image.h" line="151" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/lv_draw_image.h#L151">
      lv_draw_layer [#lv_draw_layer]

      Create a draw task to blend a layer to another layer

      ```c title=" " lineNumbers=1
      void lv_draw_layer(lv_layer_t *layer, const lv_draw_image_dsc_t *dsc, const lv_area_t *coords)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type                                                                         | Description                                                                        |
      | -------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
      | `layer`  | <ApiLink name="lv_layer_t" display="lv_layer_t *" />                         | pointer to a layer                                                                 |
      | `dsc`    | <ApiLink name="lv_draw_image_dsc_t" display="const lv_draw_image_dsc_t *" /> | pointer to an initialized draw descriptor. `src` must be set to the layer to blend |
      | `coords` | <ApiLink name="lv_area_t" display="const lv_area_t *" />                     | the coordinates of the layer.                                                      |

      <Callout type="info">
        `coords` can be small than the total widget area from which the layer is created (if only a part of the widget was rendered to a layer)
      </Callout>
    </ApiMember>
  </ApiTab>
</ApiTabs>

Structs [#structs]

<ApiMember kind="struct" name="_lv_draw_image_dsc_t">
  \_lv_draw_image_dsc_t [#_lv_draw_image_dsc_t]

  | Member            | Type                                                                         | Description                                                                                                                                                                                                                                                                                                                                                             |
  | ----------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `base`            | <ApiLink name="lv_draw_dsc_base_t" />                                        |                                                                                                                                                                                                                                                                                                                                                                         |
  | `src`             | `const void *`                                                               | The image source: pointer to <ApiLink name="lv_image_dsc_t" /> or a path to a file                                                                                                                                                                                                                                                                                      |
  | `header`          | <ApiLink name="lv_image_header_t" />                                         | The header of the image. Initialized internally in `lv_draw_image`                                                                                                                                                                                                                                                                                                      |
  | `clip_radius`     | <ApiLink name="int32_t" />                                                   | Clip the corner of the image with this radius. Use `LV_RADIUS_CIRCLE` for max. radius                                                                                                                                                                                                                                                                                   |
  | `rotation`        | <ApiLink name="int32_t" />                                                   | The rotation of the image in 0.1 degree unit. E.g. 234 means 23.4°                                                                                                                                                                                                                                                                                                      |
  | `scale_x`         | <ApiLink name="int32_t" />                                                   | Horizontal scale (zoom) of the image. 256 (LV\_SCALE\_NONE): means no zoom, 512 double size, 128 half size.                                                                                                                                                                                                                                                             |
  | `scale_y`         | <ApiLink name="int32_t" />                                                   | Same as `scale_y` but vertically                                                                                                                                                                                                                                                                                                                                        |
  | `skew_x`          | <ApiLink name="int32_t" />                                                   | Parallelogram like transformation of the image horizontally in 0.1 degree unit. E.g. 456 means 45.6°.                                                                                                                                                                                                                                                                   |
  | `skew_y`          | <ApiLink name="int32_t" />                                                   | Same as `skew_x` but vertically                                                                                                                                                                                                                                                                                                                                         |
  | `pivot`           | <ApiLink name="lv_point_t" />                                                | The pivot point of transformation (scale and rotation). 0;0 is the top left corner of the image. Can be outside of the image too.                                                                                                                                                                                                                                       |
  | `recolor`         | <ApiLink name="lv_color_t" />                                                | Mix this color to the images. In case of `LV_COLOR_FORMAT_A8` it will be the color of the visible pixels                                                                                                                                                                                                                                                                |
  | `recolor_opa`     | <ApiLink name="lv_opa_t" />                                                  | The intensity of recoloring. 0 means, no recolor, 255 means full cover (transparent pixels remain transparent)                                                                                                                                                                                                                                                          |
  | `opa`             | <ApiLink name="lv_opa_t" />                                                  | Opacity in 0...255 range. LV\_OPA\_TRANSP, LV\_OPA\_10, LV\_OPA\_20, .. LV\_OPA\_COVER can be used as well                                                                                                                                                                                                                                                              |
  | `blend_mode`      | <ApiLink name="lv_blend_mode_t" />                                           | Describes how to blend the pixels of the image to the background. See `lv_blend_mode_t` for more details.                                                                                                                                                                                                                                                               |
  | `antialias`       | <ApiLink name="uint16_t" />                                                  | 1: perform the transformation with anti-aliasing                                                                                                                                                                                                                                                                                                                        |
  | `tile`            | <ApiLink name="uint16_t" />                                                  | If the image is smaller than the `image_area` field of `lv_draw_image_dsc_t` tile the image (repeat is both horizontally and vertically) to fill the `image_area` area                                                                                                                                                                                                  |
  | `colorkey`        | <ApiLink name="lv_image_colorkey_t" display="const lv_image_colorkey_t *" /> |                                                                                                                                                                                                                                                                                                                                                                         |
  | `sup`             | <ApiLink name="lv_draw_image_sup_t" display="lv_draw_image_sup_t *" />       | Used internally to store some information about the palette or the color of A8 images                                                                                                                                                                                                                                                                                   |
  | `image_area`      | <ApiLink name="lv_area_t" />                                                 | Used to indicate the entire original, non-clipped area where the image is to be drawn. This is important for:<br />1. Layer rendering, where it might happen that only a smaller area of the layer is rendered and e.g. `clip_radius` needs to know what the original image was.<br />2. Tiled images, where the target draw area is larger than the image to be tiled. |
  | `bitmap_mask_src` | <ApiLink name="lv_image_dsc_t" display="const lv_image_dsc_t *" />           | Pointer to an A8 or L8 image descriptor to mask the image with. The mask is always center aligned.                                                                                                                                                                                                                                                                      |
</ApiMember>

Typedefs [#typedefs]

<ApiMember kind="typedef" name="lv_draw_image_core_cb" file="draw/lv_draw_image.h" line="111" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/lv_draw_image.h#L111">
  lv_draw_image_core_cb [#lv_draw_image_core_cb]

  ```c title=" " lineNumbers=1
  typedef void(* lv_draw_image_core_cb) (lv_draw_task_t *t, const lv_draw_image_dsc_t *draw_dsc, const lv_image_decoder_dsc_t *decoder_dsc, lv_draw_image_sup_t *sup, const lv_area_t *img_coords, const lv_area_t *clipped_img_area)
  ```

  PErform the actual rendering of a decoded image
</ApiMember>

<TypeUsedBy name="lv_draw_image_core_cb" count="2">
  * `lv_draw_image_normal_helper` — param `draw_core_cb`
  * `lv_draw_image_tiled_helper` — param `draw_core_cb`
</TypeUsedBy>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_draw.h&#x22;, &#x22;lv_image_decoder.h&#x22;, &#x22;lv_draw_buf.h&#x22;, &#x22;lv_style.h&#x22;]" includedBy="[&#x22;lv_obj_draw.h&#x22;, &#x22;lv_draw_image_private.h&#x22;, &#x22;lv_draw_vector.h&#x22;, &#x22;lv_draw_nanovg_private.h&#x22;, &#x22;lv_draw_dave2d.h&#x22;, &#x22;lv_draw_sdl.h&#x22;, &#x22;lv_draw_sw.h&#x22;, &#x22;lv_draw_vg_lite.h&#x22;, &#x22;lv_canvas.h&#x22;]" transitiveIncludes="[&#x22;lv_anim.h&#x22;, &#x22;lv_area.h&#x22;, &#x22;lv_array.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_bidi.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_conf_internal.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_ext_data.h&#x22;, &#x22;lv_flex.h&#x22;, &#x22;lv_font.h&#x22;, &#x22;lv_fs.h&#x22;, &#x22;lv_grad.h&#x22;, &#x22;lv_grid.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_layout.h&#x22;, &#x22;lv_ll.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_matrix.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_profiler.h&#x22;, &#x22;lv_profiler_builtin.h&#x22;, &#x22;lv_sprintf.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_style_gen.h&#x22;, &#x22;lv_symbol_def.h&#x22;, &#x22;lv_text.h&#x22;, &#x22;lv_tick.h&#x22;, &#x22;lv_timer.h&#x22;, &#x22;lv_types.h&#x22;]" />
