# lv_line.h (/api/public/widgets/lv_line_h)



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

<ApiSummary functions="9" enums="1" variables="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (3)&#x22;,&#x22;Getters (4)&#x22;,&#x22;Other (2)&#x22;]">
  <ApiTab value="Setters (3)">
    <ApiMember kind="function" name="lv_line_set_points" file="public/widgets/lv_line.h" line="59" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L59">
      lv_line_set_points [#lv_line_set_points]

      Set an array of points. The line object will connect these points.

      ```c title=" " lineNumbers=1
      void lv_line_set_points(lv_obj_t *obj, const lv_point_precise_t points[], uint32_t point_num)
      ```

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

      | Name        | Type                                                                     | Description                                                                                                                                                                           |
      | ----------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `obj`       | <ApiLink name="lv_obj_t" display="lv_obj_t *" />                         | pointer to a line object                                                                                                                                                              |
      | `points`    | <ApiLink name="lv_point_precise_t" display="const lv_point_precise_t" /> | an array of points. Only the address is saved, so the array needs to be alive while the line exists. **May** be `NULL`. Use NULL to remove the previously assigned points of the line |
      | `point_num` | `uint32_t`                                                               | number of points in 'point\_a'                                                                                                                                                        |
    </ApiMember>

    <ApiMember kind="function" name="lv_line_set_points_mutable" file="public/widgets/lv_line.h" line="68" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L68">
      lv_line_set_points_mutable [#lv_line_set_points_mutable]

      Set a non-const array of points. Identical to `lv_line_set_points` except the array may be retrieved by `lv_line_get_points_mutable`.

      ```c title=" " lineNumbers=1
      void lv_line_set_points_mutable(lv_obj_t *obj, lv_point_precise_t points[], uint32_t point_num)
      ```

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

      | Name        | Type                                             | Description                                                                                                                                                                                    |
      | ----------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `obj`       | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a line object                                                                                                                                                                       |
      | `points`    | <ApiLink name="lv_point_precise_t" />            | a non-const array of points. Only the address is saved, so the array needs to be alive while the line exists. **May** be `NULL`. Use NULL to remove the previously assigned points of the line |
      | `point_num` | `uint32_t`                                       | number of points in 'point\_a'                                                                                                                                                                 |
    </ApiMember>

    <ApiMember kind="function" name="lv_line_set_y_invert" file="public/widgets/lv_line.h" line="77" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L77">
      lv_line_set_y_invert [#lv_line_set_y_invert]

      Enable (or disable) the y coordinate inversion. If enabled then y will be subtracted from the height of the object, therefore the y = 0 coordinate will be on the bottom.

      ```c title=" " lineNumbers=1
      void lv_line_set_y_invert(lv_obj_t *obj, bool en)
      ```

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

      | Name  | Type                                             | Description                                                 |
      | ----- | ------------------------------------------------ | ----------------------------------------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a line object                                    |
      | `en`  | `bool`                                           | true: enable the y inversion, false:disable the y inversion |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (4)">
    <ApiMember kind="function" name="lv_line_get_points" file="public/widgets/lv_line.h" line="88" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L88">
      lv_line_get_points [#lv_line_get_points]

      Get the pointer to the array of points.

      ```c title=" " lineNumbers=1
      const lv_point_precise_t * lv_line_get_points(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 a line object |

      **Returns:** <ApiLink name="lv_point_precise_t" display="const lv_point_precise_t *" /> — const pointer to the array of points
    </ApiMember>

    <ApiMember kind="function" name="lv_line_get_point_count" file="public/widgets/lv_line.h" line="95" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L95">
      lv_line_get_point_count [#lv_line_get_point_count]

      Get the number of points in the array of points.

      ```c title=" " lineNumbers=1
      uint32_t lv_line_get_point_count(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 a line object |

      **Returns:** `uint32_t` — number of points in array of points
    </ApiMember>

    <ApiMember kind="function" name="lv_line_get_points_mutable" file="public/widgets/lv_line.h" line="109" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L109">
      lv_line_get_points_mutable [#lv_line_get_points_mutable]

      Get a pointer to the mutable array of points or NULL if it is not mutable

      ```c title=" " lineNumbers=1
      lv_point_precise_t * lv_line_get_points_mutable(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 a line object |

      **Returns:** <ApiLink name="lv_point_precise_t" display="lv_point_precise_t *" /> — pointer to the array of points. NULL if not mutable.
    </ApiMember>

    <ApiMember kind="function" name="lv_line_get_y_invert" file="public/widgets/lv_line.h" line="116" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L116">
      lv_line_get_y_invert [#lv_line_get_y_invert]

      Get the y inversion attribute

      ```c title=" " lineNumbers=1
      bool lv_line_get_y_invert(const lv_obj_t *obj)
      ```

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

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

      **Returns:** `bool` — true: y inversion is enabled, false: disabled
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (2)">
    <ApiMember kind="function" name="lv_line_create" file="public/widgets/lv_line.h" line="46" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L46">
      lv_line_create [#lv_line_create]

      Create a line object

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_line_create(lv_obj_t *parent)
      ```

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

      | Name     | Type                                             | Description                                                                                                         |
      | -------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
      | `parent` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a parent widget **May** be `NULL`.. When NULL, the widget is created as a screen on the default display. |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the created line
    </ApiMember>

    <ApiMember kind="function" name="lv_line_is_point_array_mutable" file="public/widgets/lv_line.h" line="102" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L102">
      lv_line_is_point_array_mutable [#lv_line_is_point_array_mutable]

      Check the mutability of the stored point array pointer.

      ```c title=" " lineNumbers=1
      bool lv_line_is_point_array_mutable(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 a line object |

      **Returns:** `bool` — true: the point array pointer is mutable, false: constant
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="_lv_property_line_id_t" file="public/widgets/lv_line.h" line="30" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L30">
  \_lv_property_line_id_t [#_lv_property_line_id_t]

  | Name                        | Value                                                          |
  | --------------------------- | -------------------------------------------------------------- |
  | `LV_PROPERTY_LINE_Y_INVERT` | `(LV_PROPERTY_LINE_START + ((int) 0 )) \| ((  11   ) <<  28 )` |
  | `LV_PROPERTY_LINE_END`      |                                                                |
</ApiMember>

Variables [#variables]

<ApiMember kind="variable" name="lv_line_class" file="public/widgets/lv_line.h" line="27" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_line.h#L27">
  lv_line_class [#lv_line_class]

  ```c title=" " lineNumbers=1
  const lv_obj_class_t lv_line_class
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_obj.h&#x22;]" includedBy="[&#x22;lvgl.h&#x22;, &#x22;lv_scale.h&#x22;]" transitiveIncludes="[&#x22;lv_anim.h&#x22;, &#x22;lv_area.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_display.h&#x22;, &#x22;lv_draw.h&#x22;, &#x22;lv_draw_arc.h&#x22;, &#x22;lv_draw_blur.h&#x22;, &#x22;lv_draw_buf.h&#x22;, &#x22;lv_draw_image.h&#x22;, &#x22;lv_draw_label.h&#x22;, &#x22;lv_draw_line.h&#x22;, &#x22;lv_draw_rect.h&#x22;, &#x22;lv_draw_triangle.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_group.h&#x22;, &#x22;lv_image_decoder.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_indev.h&#x22;, &#x22;lv_layout.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_class.h&#x22;, &#x22;lv_obj_draw.h&#x22;, &#x22;lv_obj_event.h&#x22;, &#x22;lv_obj_pos.h&#x22;, &#x22;lv_obj_property.h&#x22;, &#x22;lv_obj_scroll.h&#x22;, &#x22;lv_obj_style.h&#x22;, &#x22;lv_obj_style_gen.h&#x22;, &#x22;lv_obj_tree.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_timer.h&#x22;, &#x22;lv_types.h&#x22;]" />
