# lv_obj_draw.h (/api/core/lv_obj_draw_h)



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

<ApiSummary functions="8" enums="1" />

Functions [#functions]

<ApiMember kind="function" name="lv_obj_init_draw_rect_dsc" file="core/lv_obj_draw.h" line="68" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_draw.h#L68">
  lv_obj_init_draw_rect_dsc [#lv_obj_init_draw_rect_dsc]

  Initialize a rectangle draw descriptor from an object's styles in its current state

  ```c title=" " lineNumbers=1
  void lv_obj_init_draw_rect_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_rect_dsc_t *draw_dsc)
  ```

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

  | Name       | Type                                                                 | Description                                                                                                                                                                              |
  | ---------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" />                     | pointer to an object                                                                                                                                                                     |
  | `part`     | <ApiLink name="lv_part_t" />                                         | part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc                                                                                                        |
  | `draw_dsc` | <ApiLink name="lv_draw_rect_dsc_t" display="lv_draw_rect_dsc_t *" /> | the descriptor to initialize. If an `..._opa` field is set to `LV_OPA_TRANSP` the related properties won't be initialized. Should be initialized with `lv_draw_rect_dsc_init(draw_dsc)`. |

  <Callout type="info">
    Only the relevant fields will be set. E.g. if `border width == 0` the other border properties won't be evaluated.
  </Callout>
</ApiMember>

<ApiMember kind="function" name="lv_obj_init_draw_label_dsc" file="core/lv_obj_draw.h" line="78" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_draw.h#L78">
  lv_obj_init_draw_label_dsc [#lv_obj_init_draw_label_dsc]

  Initialize a label draw descriptor from an object's styles in its current state

  ```c title=" " lineNumbers=1
  void lv_obj_init_draw_label_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_label_dsc_t *draw_dsc)
  ```

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

  | Name       | Type                                                                   | Description                                                                                                                                                                                          |
  | ---------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" />                       | pointer to an object                                                                                                                                                                                 |
  | `part`     | <ApiLink name="lv_part_t" />                                           | part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc                                                                                                                    |
  | `draw_dsc` | <ApiLink name="lv_draw_label_dsc_t" display="lv_draw_label_dsc_t *" /> | the descriptor to initialize. If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized. Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`. |
</ApiMember>

<ApiMember kind="function" name="lv_obj_init_draw_image_dsc" file="core/lv_obj_draw.h" line="87" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_draw.h#L87">
  lv_obj_init_draw_image_dsc [#lv_obj_init_draw_image_dsc]

  Initialize an image draw descriptor from an object's styles in its current state

  ```c title=" " lineNumbers=1
  void lv_obj_init_draw_image_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_image_dsc_t *draw_dsc)
  ```

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

  | Name       | Type                                                                   | Description                                                                                  |
  | ---------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
  | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" />                       | pointer to an object                                                                         |
  | `part`     | <ApiLink name="lv_part_t" />                                           | part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc            |
  | `draw_dsc` | <ApiLink name="lv_draw_image_dsc_t" display="lv_draw_image_dsc_t *" /> | the descriptor to initialize. Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`. |
</ApiMember>

<ApiMember kind="function" name="lv_obj_init_draw_line_dsc" file="core/lv_obj_draw.h" line="96" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_draw.h#L96">
  lv_obj_init_draw_line_dsc [#lv_obj_init_draw_line_dsc]

  Initialize a line draw descriptor from an object's styles in its current state

  ```c title=" " lineNumbers=1
  void lv_obj_init_draw_line_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_line_dsc_t *draw_dsc)
  ```

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

  | Name       | Type                                                                 | Description                                                                                 |
  | ---------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
  | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" />                     | pointer to an object                                                                        |
  | `part`     | <ApiLink name="lv_part_t" />                                         | part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc           |
  | `draw_dsc` | <ApiLink name="lv_draw_line_dsc_t" display="lv_draw_line_dsc_t *" /> | the descriptor to initialize. Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`. |
</ApiMember>

<ApiMember kind="function" name="lv_obj_init_draw_arc_dsc" file="core/lv_obj_draw.h" line="105" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_draw.h#L105">
  lv_obj_init_draw_arc_dsc [#lv_obj_init_draw_arc_dsc]

  Initialize an arc draw descriptor from an object's styles in its current state

  ```c title=" " lineNumbers=1
  void lv_obj_init_draw_arc_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_arc_dsc_t *draw_dsc)
  ```

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

  | Name       | Type                                                               | Description                                                                                |
  | ---------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
  | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" />                   | pointer to an object                                                                       |
  | `part`     | <ApiLink name="lv_part_t" />                                       | part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc          |
  | `draw_dsc` | <ApiLink name="lv_draw_arc_dsc_t" display="lv_draw_arc_dsc_t *" /> | the descriptor to initialize. Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`. |
</ApiMember>

<ApiMember kind="function" name="lv_obj_init_draw_blur_dsc" file="core/lv_obj_draw.h" line="117" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_draw.h#L117">
  lv_obj_init_draw_blur_dsc [#lv_obj_init_draw_blur_dsc]

  Initialize a blur draw descriptor from an object's styles in its current state. draw\_dsc->radius will only be calculated if it's 0 initially. Radius can be set before calling this function to avoid getting it twice.

  ```c title=" " lineNumbers=1
  void lv_obj_init_draw_blur_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_blur_dsc_t *draw_dsc)
  ```

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

  | Name       | Type                                                                 | Description                                                                                 |
  | ---------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
  | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" />                     | pointer to an object                                                                        |
  | `part`     | <ApiLink name="lv_part_t" />                                         | part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc           |
  | `draw_dsc` | <ApiLink name="lv_draw_blur_dsc_t" display="lv_draw_blur_dsc_t *" /> | the descriptor to initialize. Should be initialized with `lv_draw_blur_dsc_init(draw_dsc)`. |
</ApiMember>

<ApiMember kind="function" name="lv_obj_calculate_ext_draw_size" file="core/lv_obj_draw.h" line="125" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_draw.h#L125">
  lv_obj_calculate_ext_draw_size [#lv_obj_calculate_ext_draw_size]

  Get the required extra size (around the object's part) to draw shadow, outline, value etc.

  ```c title=" " lineNumbers=1
  int32_t lv_obj_calculate_ext_draw_size(lv_obj_t *obj, lv_part_t part)
  ```

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

  | Name   | Type                                             | Description          |
  | ------ | ------------------------------------------------ | -------------------- |
  | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object |
  | `part` | <ApiLink name="lv_part_t" />                     | part of the object   |

  **Returns:** <ApiLink name="int32_t" /> — the extra size required around the object
</ApiMember>

<ApiMember kind="function" name="lv_obj_refresh_ext_draw_size" file="core/lv_obj_draw.h" line="132" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_draw.h#L132">
  lv_obj_refresh_ext_draw_size [#lv_obj_refresh_ext_draw_size]

  Send a 'LV\_EVENT\_REFR\_EXT\_DRAW\_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size. The result will be saved in `obj`.

  ```c title=" " lineNumbers=1
  void lv_obj_refresh_ext_draw_size(lv_obj_t *obj)
  ```

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

  | Name  | Type                                             | Description          |
  | ----- | ------------------------------------------------ | -------------------- |
  | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object |
</ApiMember>

Enums [#enums]

<ApiMember kind="enum" name="lv_layer_type_t" file="core/lv_obj_draw.h" line="35" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_draw.h#L35">
  lv_layer_type_t [#lv_layer_type_t]

  Store the type of layer required to render a widget.

  | Name                      | Description                                                                                                                                                                                                                                                                                                                                       |
  | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `LV_LAYER_TYPE_NONE`      | No layer is needed.                                                                                                                                                                                                                                                                                                                               |
  | `LV_LAYER_TYPE_SIMPLE`    | Simple layer means that the layer can be rendered in chunks. For example with opa\_layered = 140 it's possible to render only 10 lines from the layer. When it's ready go to the next 10 lines. It avoids large memory allocations for the layer buffer. The buffer size for a chunk can be set by `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` in lv\_conf.h. |
  | `LV_LAYER_TYPE_TRANSFORM` | The widget is transformed and cannot be rendered in chunks. It's because - due to the transformations - pixel outside of a given area will also contribute to the final image. In this case there is no limitation on the buffer size. LVGL will allocate as large buffer as needed to render the transformed area.                               |
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_types.h&#x22;, &#x22;lv_draw_rect.h&#x22;, &#x22;lv_draw_label.h&#x22;, &#x22;lv_draw_image.h&#x22;, &#x22;lv_draw_line.h&#x22;, &#x22;lv_draw_arc.h&#x22;, &#x22;lv_draw_triangle.h&#x22;, &#x22;lv_draw_blur.h&#x22;, &#x22;lv_obj_style.h&#x22;]" includedBy="[&#x22;lv_obj.h&#x22;, &#x22;lv_obj_draw_private.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_draw.h&#x22;, &#x22;lv_draw_buf.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_decoder.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_obj_style_gen.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.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;]" />
