# lv_nanovg_utils.h (/api/draw/nanovg/lv_nanovg_utils_h)



<ApiSummary functions="14" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (1)&#x22;,&#x22;Other (13)&#x22;]">
  <ApiTab value="Setters (1)">
    <ApiMember kind="function" name="lv_nanovg_set_clip_area" file="draw/nanovg/lv_nanovg_utils.h" line="92" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L92">
      lv_nanovg_set_clip_area [#lv_nanovg_set_clip_area]

      Set the clipping area

      ```c title=" " lineNumbers=1
      void lv_nanovg_set_clip_area(NVGcontext *ctx, const lv_area_t *area)
      ```

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

      | Name   | Type                                                     | Description        |
      | ------ | -------------------------------------------------------- | ------------------ |
      | `ctx`  | `NVGcontext *`                                           | the NanoVG context |
      | `area` | <ApiLink name="lv_area_t" display="const lv_area_t *" /> | the clipping area  |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (13)">
    <ApiMember kind="function" name="lv_nanovg_utils_init" file="draw/nanovg/lv_nanovg_utils.h" line="44" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L44">
      lv_nanovg_utils_init [#lv_nanovg_utils_init]

      Initialize NanoVG utilities

      ```c title=" " lineNumbers=1
      void lv_nanovg_utils_init(struct _lv_draw_nanovg_unit_t *u)
      ```

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

      | Name | Type                                                                                | Description                |
      | ---- | ----------------------------------------------------------------------------------- | -------------------------- |
      | `u`  | <ApiLink name="_lv_draw_nanovg_unit_t" display="struct _lv_draw_nanovg_unit_t *" /> | pointer to the nanovg unit |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_utils_deinit" file="draw/nanovg/lv_nanovg_utils.h" line="50" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L50">
      lv_nanovg_utils_deinit [#lv_nanovg_utils_deinit]

      Deinitialize NanoVG utilities

      ```c title=" " lineNumbers=1
      void lv_nanovg_utils_deinit(struct _lv_draw_nanovg_unit_t *u)
      ```

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

      | Name | Type                                                                                | Description                |
      | ---- | ----------------------------------------------------------------------------------- | -------------------------- |
      | `u`  | <ApiLink name="_lv_draw_nanovg_unit_t" display="struct _lv_draw_nanovg_unit_t *" /> | pointer to the nanovg unit |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_matrix_convert" file="draw/nanovg/lv_nanovg_utils.h" line="57" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L57">
      lv_nanovg_matrix_convert [#lv_nanovg_matrix_convert]

      Convert an LVGL matrix to a NanoVG transform (3x2 matrix)

      \< Log only critical issues, when system may fail.

      \< Halt by default

      \< Log only critical issues, when system may fail.

      \< Halt by default

      ```c title=" " lineNumbers=1
      static void lv_nanovg_matrix_convert(float *xform, const lv_matrix_t *matrix)
      ```

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

      | Name     | Type                                                         | Description                           |
      | -------- | ------------------------------------------------------------ | ------------------------------------- |
      | `xform`  | `float *`                                                    | the NanoVG transform array (6 floats) |
      | `matrix` | <ApiLink name="lv_matrix_t" display="const lv_matrix_t *" /> | the LVGL matrix                       |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_color_convert" file="draw/nanovg/lv_nanovg_utils.h" line="75" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L75">
      lv_nanovg_color_convert [#lv_nanovg_color_convert]

      Convert an LVGL color to a NanoVG color

      ```c title=" " lineNumbers=1
      static NVGcolor lv_nanovg_color_convert(lv_color_t color, lv_opa_t opa)
      ```

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

      | Name    | Type                          | Description    |
      | ------- | ----------------------------- | -------------- |
      | `color` | <ApiLink name="lv_color_t" /> | the LVGL color |
      | `opa`   | <ApiLink name="lv_opa_t" />   | the opacity    |

      **Returns:** `NVGcolor` — the NanoVG color
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_transform" file="draw/nanovg/lv_nanovg_utils.h" line="85" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L85">
      lv_nanovg_transform [#lv_nanovg_transform]

      Apply a transform matrix to the NanoVG context

      ```c title=" " lineNumbers=1
      void lv_nanovg_transform(NVGcontext *ctx, const lv_matrix_t *matrix)
      ```

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

      | Name     | Type                                                         | Description          |
      | -------- | ------------------------------------------------------------ | -------------------- |
      | `ctx`    | `NVGcontext *`                                               | the NanoVG context   |
      | `matrix` | <ApiLink name="lv_matrix_t" display="const lv_matrix_t *" /> | the transform matrix |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_path_append_rect" file="draw/nanovg/lv_nanovg_utils.h" line="103" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L103">
      lv_nanovg_path_append_rect [#lv_nanovg_path_append_rect]

      Append a rectangle to the path

      ```c title=" " lineNumbers=1
      void lv_nanovg_path_append_rect(NVGcontext *ctx, float x, float y, float w, float h, float r)
      ```

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

      | Name  | Type           | Description                                     |
      | ----- | -------------- | ----------------------------------------------- |
      | `ctx` | `NVGcontext *` | the NanoVG context                              |
      | `x`   | `float`        | the x coordinate of the rectangle               |
      | `y`   | `float`        | the y coordinate of the rectangle               |
      | `w`   | `float`        | the width of the rectangle                      |
      | `h`   | `float`        | the height of the rectangle                     |
      | `r`   | `float`        | the radius of the rectangle (0 for no rounding) |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_path_append_area" file="draw/nanovg/lv_nanovg_utils.h" line="110" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L110">
      lv_nanovg_path_append_area [#lv_nanovg_path_append_area]

      Append an area to the path

      ```c title=" " lineNumbers=1
      void lv_nanovg_path_append_area(NVGcontext *ctx, const lv_area_t *area)
      ```

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

      | Name   | Type                                                     | Description        |
      | ------ | -------------------------------------------------------- | ------------------ |
      | `ctx`  | `NVGcontext *`                                           | the NanoVG context |
      | `area` | <ApiLink name="lv_area_t" display="const lv_area_t *" /> | the area           |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_path_append_arc_right_angle" file="draw/nanovg/lv_nanovg_utils.h" line="122" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L122">
      lv_nanovg_path_append_arc_right_angle [#lv_nanovg_path_append_arc_right_angle]

      Append a right angle arc to the path

      ```c title=" " lineNumbers=1
      void lv_nanovg_path_append_arc_right_angle(NVGcontext *ctx, float start_x, float start_y, float center_x, float center_y, float end_x, float end_y)
      ```

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

      | Name       | Type           | Description               |
      | ---------- | -------------- | ------------------------- |
      | `ctx`      | `NVGcontext *` | the NanoVG context        |
      | `start_x`  | `float`        | the starting x coordinate |
      | `start_y`  | `float`        | the starting y coordinate |
      | `center_x` | `float`        | the center x coordinate   |
      | `center_y` | `float`        | the center y coordinate   |
      | `end_x`    | `float`        | the ending x coordinate   |
      | `end_y`    | `float`        | the ending y coordinate   |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_path_append_arc" file="draw/nanovg/lv_nanovg_utils.h" line="137" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L137">
      lv_nanovg_path_append_arc [#lv_nanovg_path_append_arc]

      Append an arc to the path

      ```c title=" " lineNumbers=1
      void lv_nanovg_path_append_arc(NVGcontext *ctx, float cx, float cy, float radius, float start_angle, float sweep, bool pie)
      ```

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

      | Name          | Type                    | Description                                       |
      | ------------- | ----------------------- | ------------------------------------------------- |
      | `ctx`         | `NVGcontext *`          | the NanoVG context                                |
      | `cx`          | `float`                 | the center x coordinate                           |
      | `cy`          | `float`                 | the center y coordinate                           |
      | `radius`      | `float`                 | the radius                                        |
      | `start_angle` | `float`                 | the starting angle in radians                     |
      | `sweep`       | `float`                 | the sweep angle in radians                        |
      | `pie`         | <ApiLink name="bool" /> | whether to draw a pie slice (connected to center) |
    </ApiMember>

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

      Fill the current path

      ```c title=" " lineNumbers=1
      void lv_nanovg_fill(NVGcontext *ctx, enum NVGwinding winding, enum NVGcompositeOperation composite_operation, NVGcolor color)
      ```

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

      | Name                  | Type                         | Description        |
      | --------------------- | ---------------------------- | ------------------ |
      | `ctx`                 | `NVGcontext *`               | the NanoVG context |
      | `winding`             | `enum NVGwinding`            | the winding rule   |
      | `composite_operation` | `enum NVGcompositeOperation` | the blend mode     |
      | `color`               | `NVGcolor`                   | the fill color     |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_end_frame" file="draw/nanovg/lv_nanovg_utils.h" line="158" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L158">
      lv_nanovg_end_frame [#lv_nanovg_end_frame]

      End the current frame

      ```c title=" " lineNumbers=1
      void lv_nanovg_end_frame(struct _lv_draw_nanovg_unit_t *u)
      ```

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

      | Name | Type                                                                                | Description                |
      | ---- | ----------------------------------------------------------------------------------- | -------------------------- |
      | `u`  | <ApiLink name="_lv_draw_nanovg_unit_t" display="struct _lv_draw_nanovg_unit_t *" /> | pointer to the nanovg unit |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_clean_up" file="draw/nanovg/lv_nanovg_utils.h" line="164" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L164">
      lv_nanovg_clean_up [#lv_nanovg_clean_up]

      Clean up the NanoVG unit (e.g. at the end of task)

      ```c title=" " lineNumbers=1
      void lv_nanovg_clean_up(struct _lv_draw_nanovg_unit_t *u)
      ```

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

      | Name | Type                                                                                | Description                |
      | ---- | ----------------------------------------------------------------------------------- | -------------------------- |
      | `u`  | <ApiLink name="_lv_draw_nanovg_unit_t" display="struct _lv_draw_nanovg_unit_t *" /> | pointer to the nanovg unit |
    </ApiMember>

    <ApiMember kind="function" name="lv_nanovg_reshape_global_image" file="draw/nanovg/lv_nanovg_utils.h" line="174" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_utils.h#L174">
      lv_nanovg_reshape_global_image [#lv_nanovg_reshape_global_image]

      Reshape the global image buffer

      ```c title=" " lineNumbers=1
      lv_draw_buf_t * lv_nanovg_reshape_global_image(struct _lv_draw_nanovg_unit_t *u, lv_color_format_t cf, uint32_t w, uint32_t h)
      ```

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

      | Name | Type                                                                                | Description                |
      | ---- | ----------------------------------------------------------------------------------- | -------------------------- |
      | `u`  | <ApiLink name="_lv_draw_nanovg_unit_t" display="struct _lv_draw_nanovg_unit_t *" /> | pointer to the nanovg unit |
      | `cf` | <ApiLink name="lv_color_format_t" />                                                | the color format           |
      | `w`  | <ApiLink name="uint32_t" />                                                         | the new width              |
      | `h`  | <ApiLink name="uint32_t" />                                                         | the new height             |

      **Returns:** <ApiLink name="lv_draw_buf_t" display="lv_draw_buf_t *" /> — pointer to the resized draw buffer
    </ApiMember>
  </ApiTab>
</ApiTabs>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_matrix.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;nanovg.h&#x22;]" transitiveIncludes="[&#x22;lv_area.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_types.h&#x22;]" />
