# lv_barcode.h (/api/libs/barcode/lv_barcode_h)



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

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

Functions [#functions]

<ApiTabs items="[&#x22;Setters (6)&#x22;,&#x22;Getters (4)&#x22;,&#x22;Other (2)&#x22;]">
  <ApiTab value="Setters (6)">
    <ApiMember kind="function" name="lv_barcode_set_dark_color" file="libs/barcode/lv_barcode.h" line="60" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L60">
      lv_barcode_set_dark_color [#lv_barcode_set_dark_color]

      Set the dark color of a barcode object

      ```c title=" " lineNumbers=1
      void lv_barcode_set_dark_color(lv_obj_t *obj, lv_color_t color)
      ```

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

      | Name    | Type                                             | Description               |
      | ------- | ------------------------------------------------ | ------------------------- |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to barcode object |
      | `color` | <ApiLink name="lv_color_t" />                    | dark color of the barcode |
    </ApiMember>

    <ApiMember kind="function" name="lv_barcode_set_light_color" file="libs/barcode/lv_barcode.h" line="67" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L67">
      lv_barcode_set_light_color [#lv_barcode_set_light_color]

      Set the light color of a barcode object

      ```c title=" " lineNumbers=1
      void lv_barcode_set_light_color(lv_obj_t *obj, lv_color_t color)
      ```

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

      | Name    | Type                                             | Description                |
      | ------- | ------------------------------------------------ | -------------------------- |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to barcode object  |
      | `color` | <ApiLink name="lv_color_t" />                    | light color of the barcode |
    </ApiMember>

    <ApiMember kind="function" name="lv_barcode_set_scale" file="libs/barcode/lv_barcode.h" line="74" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L74">
      lv_barcode_set_scale [#lv_barcode_set_scale]

      Set the scale of a barcode object

      ```c title=" " lineNumbers=1
      void lv_barcode_set_scale(lv_obj_t *obj, uint16_t scale)
      ```

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

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

    <ApiMember kind="function" name="lv_barcode_set_direction" file="libs/barcode/lv_barcode.h" line="81" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L81">
      lv_barcode_set_direction [#lv_barcode_set_direction]

      Set the direction of a barcode object

      ```c title=" " lineNumbers=1
      void lv_barcode_set_direction(lv_obj_t *obj, lv_dir_t direction)
      ```

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

      | Name        | Type                                             | Description                                   |
      | ----------- | ------------------------------------------------ | --------------------------------------------- |
      | `obj`       | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to barcode object                     |
      | `direction` | <ApiLink name="lv_dir_t" />                      | draw direction (`LV_DIR_HOR` or `LB_DIR_VER`) |
    </ApiMember>

    <ApiMember kind="function" name="lv_barcode_set_tiled" file="libs/barcode/lv_barcode.h" line="88" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L88">
      lv_barcode_set_tiled [#lv_barcode_set_tiled]

      Set the tiled mode of a barcode object

      ```c title=" " lineNumbers=1
      void lv_barcode_set_tiled(lv_obj_t *obj, bool tiled)
      ```

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

      | Name    | Type                                             | Description                                    |
      | ------- | ------------------------------------------------ | ---------------------------------------------- |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to barcode object                      |
      | `tiled` | <ApiLink name="bool" />                          | true: tiled mode, false: normal mode (default) |
    </ApiMember>

    <ApiMember kind="function" name="lv_barcode_set_encoding" file="libs/barcode/lv_barcode.h" line="95" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L95">
      lv_barcode_set_encoding [#lv_barcode_set_encoding]

      Set the encoding of a barcode object

      ```c title=" " lineNumbers=1
      void lv_barcode_set_encoding(lv_obj_t *obj, lv_barcode_encoding_t encoding)
      ```

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

      | Name       | Type                                             | Description                                    |
      | ---------- | ------------------------------------------------ | ---------------------------------------------- |
      | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to barcode object                      |
      | `encoding` | <ApiLink name="lv_barcode_encoding_t" />         | encoding (default is `LV_BARCODE_CODE128_GS1`) |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (4)">
    <ApiMember kind="function" name="lv_barcode_get_dark_color" file="libs/barcode/lv_barcode.h" line="110" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L110">
      lv_barcode_get_dark_color [#lv_barcode_get_dark_color]

      Get the dark color of a barcode object

      ```c title=" " lineNumbers=1
      lv_color_t lv_barcode_get_dark_color(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 barcode object |

      **Returns:** <ApiLink name="lv_color_t" /> — dark color of the barcode
    </ApiMember>

    <ApiMember kind="function" name="lv_barcode_get_light_color" file="libs/barcode/lv_barcode.h" line="117" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L117">
      lv_barcode_get_light_color [#lv_barcode_get_light_color]

      Get the light color of a barcode object

      ```c title=" " lineNumbers=1
      lv_color_t lv_barcode_get_light_color(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 barcode object |

      **Returns:** <ApiLink name="lv_color_t" /> — light color of the barcode
    </ApiMember>

    <ApiMember kind="function" name="lv_barcode_get_scale" file="libs/barcode/lv_barcode.h" line="124" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L124">
      lv_barcode_get_scale [#lv_barcode_get_scale]

      Get the scale of a barcode object

      ```c title=" " lineNumbers=1
      uint16_t lv_barcode_get_scale(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 barcode object |

      **Returns:** <ApiLink name="uint16_t" /> — scale factor
    </ApiMember>

    <ApiMember kind="function" name="lv_barcode_get_encoding" file="libs/barcode/lv_barcode.h" line="131" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L131">
      lv_barcode_get_encoding [#lv_barcode_get_encoding]

      Get the encoding of a barcode object

      ```c title=" " lineNumbers=1
      lv_barcode_encoding_t lv_barcode_get_encoding(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 barcode object |

      **Returns:** <ApiLink name="lv_barcode_encoding_t" /> — encoding
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (2)">
    <ApiMember kind="function" name="lv_barcode_create" file="libs/barcode/lv_barcode.h" line="53" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L53">
      lv_barcode_create [#lv_barcode_create]

      Create an empty barcode (an `lv_canvas`) object.

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

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

      | Name     | Type                                             | Description                                    |
      | -------- | ------------------------------------------------ | ---------------------------------------------- |
      | `parent` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | point to an object where to create the barcode |

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

    <ApiMember kind="function" name="lv_barcode_update" file="libs/barcode/lv_barcode.h" line="103" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L103">
      lv_barcode_update [#lv_barcode_update]

      Set the data of a barcode object

      ```c title=" " lineNumbers=1
      lv_result_t lv_barcode_update(lv_obj_t *obj, const char *data)
      ```

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

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

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: if no error; LV\_RESULT\_INVALID: on error
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="lv_barcode_encoding_t" file="libs/barcode/lv_barcode.h" line="31" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L31">
  lv_barcode_encoding_t [#lv_barcode_encoding_t]

  | Name                              | Description                                             |
  | --------------------------------- | ------------------------------------------------------- |
  | `LV_BARCODE_ENCODING_CODE128_GS1` | Code 128 with GS1 encoding. Strips `[FCN1]` and spaces. |
  | `LV_BARCODE_ENCODING_CODE128_RAW` | Code 128 with raw encoding.                             |
</ApiMember>

<TypeUsedBy name="lv_barcode_encoding_t" count="1">
  * `lv_barcode_set_encoding` — param `encoding`
</TypeUsedBy>

Variables [#variables]

<ApiMember kind="variable" name="lv_barcode_class" file="libs/barcode/lv_barcode.h" line="42" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/barcode/lv_barcode.h#L42">
  lv_barcode_class [#lv_barcode_class]

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

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_types.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_canvas.h&#x22;]" includedBy="[&#x22;lv_barcode_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_op.h&#x22;, &#x22;lv_conf_kconfig.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.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_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.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_property_names.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_observer.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_style_properties.h&#x22;, &#x22;lv_symbol_def.h&#x22;, &#x22;lv_text.h&#x22;, &#x22;lv_tick.h&#x22;, &#x22;lv_timer.h&#x22;]" />
