# lv_draw_sw_utils.h (/api/draw/sw/lv_draw_sw_utils_h)



<ApiSummary functions="5" />

Functions [#functions]

<ApiMember kind="function" name="lv_draw_sw_i1_to_argb8888" file="draw/sw/lv_draw_sw_utils.h" line="44" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/sw/lv_draw_sw_utils.h#L44">
  lv_draw_sw_i1_to_argb8888 [#lv_draw_sw_i1_to_argb8888]

  Converts an I1 buffer to ARGB8888 format.

  ```c title=" " lineNumbers=1
  void lv_draw_sw_i1_to_argb8888(const void *buf_i1, void *buf_argb8888, uint32_t width, uint32_t height, uint32_t buf_i1_stride, uint32_t buf_argb8888_stride, uint32_t index0_color, uint32_t index1_color)
  ```

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

  | Name                  | Type                        | Description                                           |
  | --------------------- | --------------------------- | ----------------------------------------------------- |
  | `buf_i1`              | `const void *`              | pointer to buffer with I1 formatted render            |
  | `buf_argb8888`        | `void *`                    | pointer to buffer for ARGB8888 render                 |
  | `width`               | <ApiLink name="uint32_t" /> | width in pixels of the area. must be a multiple of 8. |
  | `height`              | <ApiLink name="uint32_t" /> | height in pixels of the area                          |
  | `buf_i1_stride`       | <ApiLink name="uint32_t" /> | stride of i1 buffer in bytes                          |
  | `buf_argb8888_stride` | <ApiLink name="uint32_t" /> | stride of argb8888 buffer in bytes                    |
  | `index0_color`        | <ApiLink name="uint32_t" /> | color of the 0 bits of i1 buf                         |
  | `index1_color`        | <ApiLink name="uint32_t" /> | color of the 1 bits of i1 buf                         |
</ApiMember>

<ApiMember kind="function" name="lv_draw_sw_rgb565_swap" file="draw/sw/lv_draw_sw_utils.h" line="54" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/sw/lv_draw_sw_utils.h#L54">
  lv_draw_sw_rgb565_swap [#lv_draw_sw_rgb565_swap]

  Swap the upper and lower byte of an RGB565 buffer. Might be required if a 8bit parallel port or an SPI port send the bytes in the wrong order. The bytes will be swapped in place.

  ```c title=" " lineNumbers=1
  void lv_draw_sw_rgb565_swap(void *buf, uint32_t buf_size_px)
  ```

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

  | Name          | Type                        | Description                    |
  | ------------- | --------------------------- | ------------------------------ |
  | `buf`         | `void *`                    | pointer to buffer              |
  | `buf_size_px` | <ApiLink name="uint32_t" /> | number of pixels in the buffer |
</ApiMember>

<ApiMember kind="function" name="lv_draw_sw_i1_invert" file="draw/sw/lv_draw_sw_utils.h" line="64" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/sw/lv_draw_sw_utils.h#L64">
  lv_draw_sw_i1_invert [#lv_draw_sw_i1_invert]

  Invert a draw buffer in the I1 color format. Conventionally, a bit is set to 1 during blending if the luminance is greater than 127. Depending on the display controller used, you might want to have different behavior. The inversion will be performed in place.

  ```c title=" " lineNumbers=1
  void lv_draw_sw_i1_invert(void *buf, uint32_t buf_size)
  ```

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

  | Name       | Type                        | Description                          |
  | ---------- | --------------------------- | ------------------------------------ |
  | `buf`      | `void *`                    | pointer to the buffer to be inverted |
  | `buf_size` | <ApiLink name="uint32_t" /> | size of the buffer in bytes          |
</ApiMember>

<ApiMember kind="function" name="lv_draw_sw_i1_convert_to_vtiled" file="draw/sw/lv_draw_sw_utils.h" line="79" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/sw/lv_draw_sw_utils.h#L79">
  lv_draw_sw_i1_convert_to_vtiled [#lv_draw_sw_i1_convert_to_vtiled]

  Convert a draw buffer in I1 color format from htiled (row-wise) to vtiled (column-wise) buffer layout. The conversion assumes that the buffer width and height is rounded to a multiple of 8.

  ```c title=" " lineNumbers=1
  void lv_draw_sw_i1_convert_to_vtiled(const void *buf, uint32_t buf_size, uint32_t width, uint32_t height, void *out_buf, uint32_t out_buf_size, bool bit_order_lsb)
  ```

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

  | Name            | Type                        | Description                              |
  | --------------- | --------------------------- | ---------------------------------------- |
  | `buf`           | `const void *`              | pointer to the buffer to be converted    |
  | `buf_size`      | <ApiLink name="uint32_t" /> | size of the buffer in bytes              |
  | `width`         | <ApiLink name="uint32_t" /> | width of the buffer                      |
  | `height`        | <ApiLink name="uint32_t" /> | height of the buffer                     |
  | `out_buf`       | `void *`                    | pointer to the output buffer             |
  | `out_buf_size`  | <ApiLink name="uint32_t" /> | size of the output buffer in bytes       |
  | `bit_order_lsb` | <ApiLink name="bool" />     | bit order of the resulting vtiled buffer |
</ApiMember>

<ApiMember kind="function" name="lv_draw_sw_rotate" file="draw/sw/lv_draw_sw_utils.h" line="94" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/sw/lv_draw_sw_utils.h#L94">
  lv_draw_sw_rotate [#lv_draw_sw_rotate]

  Rotate a buffer into another buffer

  ```c title=" " lineNumbers=1
  void lv_draw_sw_rotate(const void *src, void *dest, int32_t src_width, int32_t src_height, int32_t src_stride, int32_t dest_stride, lv_display_rotation_t rotation, lv_color_format_t color_format)
  ```

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

  | Name           | Type                                     | Description                                            |
  | -------------- | ---------------------------------------- | ------------------------------------------------------ |
  | `src`          | `const void *`                           | the source buffer                                      |
  | `dest`         | `void *`                                 | the destination buffer                                 |
  | `src_width`    | <ApiLink name="int32_t" />               | source width in pixels                                 |
  | `src_height`   | <ApiLink name="int32_t" />               | source height in pixels                                |
  | `src_stride`   | <ApiLink name="int32_t" />               | source stride in bytes (number of bytes in a row)      |
  | `dest_stride`  | <ApiLink name="int32_t" />               | destination stride in bytes (number of bytes in a row) |
  | `rotation`     | <ApiLink name="lv_display_rotation_t" /> | LV\_DISPLAY\_ROTATION\_0/90/180/270                    |
  | `color_format` | <ApiLink name="lv_color_format_t" />     | LV\_COLOR\_FORMAT\_RGB565/RGB888/XRGB8888/ARGB8888     |
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_area.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_display.h&#x22;]" includedBy="[&#x22;lv_draw_sw.h&#x22;]" transitiveIncludes="[&#x22;lv_array.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_ll.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_tick.h&#x22;, &#x22;lv_timer.h&#x22;, &#x22;lv_types.h&#x22;]" />
