add some code

This commit is contained in:
2025-09-05 13:25:11 +08:00
parent 9ff0a99e7a
commit 3cf1229a85
8911 changed files with 2535396 additions and 0 deletions

View File

@@ -0,0 +1,199 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdbool.h>
#include "esp_err.h"
#include "gfx_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* DEFINES
*********************/
/**
* @brief LVGL port configuration structure
*/
#define GFX_EMOTE_INIT_CONFIG() \
{ \
.task_priority = 4, \
.task_stack = 7168, \
.task_affinity = -1, \
.task_stack_caps = MALLOC_CAP_DEFAULT, \
}
typedef void *gfx_handle_t;
typedef enum {
GFX_PLAYER_EVENT_IDLE = 0,
GFX_PLAYER_EVENT_ONE_FRAME_DONE,
GFX_PLAYER_EVENT_ALL_FRAME_DONE,
} gfx_player_event_t;
typedef void (*gfx_player_flush_cb_t)(gfx_handle_t handle, int x1, int y1, int x2, int y2, const void *data);
typedef void (*gfx_player_update_cb_t)(gfx_handle_t handle, gfx_player_event_t event);
typedef struct {
gfx_player_flush_cb_t flush_cb; ///< Callback function for flushing decoded data
gfx_player_update_cb_t update_cb; ///< Callback function for updating player
void *user_data; ///< User data
struct {
unsigned char swap:1;
unsigned char double_buffer:1;
unsigned char buff_dma:1;
unsigned char buff_spiram:1;
} flags;
uint32_t h_res; ///< Screen width in pixels
uint32_t v_res; ///< Screen height in pixels
uint32_t fps; ///< Target frame rate (frames per second)
/* Buffer configuration */
struct {
void *buf1; ///< Frame buffer 1 (NULL for internal allocation)
void *buf2; ///< Frame buffer 2 (NULL for internal allocation)
size_t buf_pixels; ///< Size of each buffer in pixels (0 for auto-calculation)
} buffers;
struct {
int task_priority; ///< Task priority (1-20)
int task_stack; ///< Task stack size in bytes
int task_affinity; ///< CPU core ID (-1: no affinity, 0: core 0, 1: core 1)
unsigned task_stack_caps; /*!< LVGL task stack memory capabilities (see esp_heap_caps.h) */
} task;
} gfx_core_config_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*=====================
* Core initialization
*====================*/
/**
* @brief Initialize graphics context
*
* @param cfg Graphics configuration (includes buffer configuration)
* @return gfx_handle_t Graphics handle, NULL on error
*
* @note Buffer configuration:
* - If cfg.buffers.buf1 and cfg.buffers.buf2 are NULL, internal buffers will be allocated
* - If buffers are provided, external buffers will be used (user must manage memory)
* - cfg.buffers.buf_pixels can be 0 for auto-calculation based on resolution
*
* @example Using internal buffers:
* @code
* gfx_core_config_t cfg = {
* .h_res = 320,
* .v_res = 240,
* .fps = 30,
* .buffers = {
* .buf1 = NULL,
* .buf2 = NULL,
* .buf_pixels = 0, // Auto-calculate
* },
* .task = GFX_EMOTE_INIT_CONFIG(),
* };
* gfx_handle_t handle = gfx_emote_init(&cfg);
* @endcode
*
* @example Using external buffers:
* @code
* uint16_t my_buf1[320 * 40]; // 320x40 pixels
* uint16_t my_buf2[320 * 40];
*
* gfx_core_config_t cfg = {
* .h_res = 320,
* .v_res = 240,
* .fps = 30,
* .buffers = {
* .buf1 = my_buf1,
* .buf2 = my_buf2,
* .buf_pixels = 320 * 40,
* },
* .task = GFX_EMOTE_INIT_CONFIG(),
* };
* gfx_handle_t handle = gfx_emote_init(&cfg);
* @endcode
*/
gfx_handle_t gfx_emote_init(const gfx_core_config_t *cfg);
/**
* @brief Deinitialize graphics context
*
* @param handle Graphics handle
*/
void gfx_emote_deinit(gfx_handle_t handle);
/**
* @brief Check if flush is ready
*
* @param handle Graphics handle
* @param swap_act_buf Whether to swap the active buffer
* @return bool True if the flush is ready, false otherwise
*/
bool gfx_emote_flush_ready(gfx_handle_t handle, bool swap_act_buf);
/**
* @brief Get the user data of the graphics context
*
* @param handle Graphics handle
* @return void* User data
*/
void *gfx_emote_get_user_data(gfx_handle_t handle);
/**
* @brief Get screen dimensions from graphics handle
*
* @param handle Graphics handle
* @param width Pointer to store screen width
* @param height Pointer to store screen height
* @return esp_err_t ESP_OK on success, otherwise an error code
*/
esp_err_t gfx_emote_get_screen_size(gfx_handle_t handle, uint32_t *width, uint32_t *height);
/**
* @brief Lock the recursive render mutex to prevent rendering during external operations
*
* @param handle Graphics handle
* @return esp_err_t ESP_OK on success, otherwise an error code
*/
esp_err_t gfx_emote_lock(gfx_handle_t handle);
/**
* @brief Unlock the recursive render mutex after external operations
*
* @param handle Graphics handle
* @return esp_err_t ESP_OK on success, otherwise an error code
*/
esp_err_t gfx_emote_unlock(gfx_handle_t handle);
/**
* @brief Set the default background color for frame buffers
*
* @param handle Graphics handle
* @param color Default background color in RGB565 format
* @return esp_err_t ESP_OK on success, otherwise an error code
*/
esp_err_t gfx_emote_set_bg_color(gfx_handle_t handle, gfx_color_t color);
/**
* @brief Check if the system is currently flushing the last block
*
* @param handle Graphics handle
* @return bool True if flushing the last block, false otherwise
*/
bool gfx_emote_is_flushing_last(gfx_handle_t handle);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,149 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "gfx_types.h"
#include "gfx_core.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* DEFINES
*********************/
/* Object types */
#define GFX_OBJ_TYPE_IMAGE 0x01
#define GFX_OBJ_TYPE_LABEL 0x02
#define GFX_OBJ_TYPE_ANIMATION 0x03
/* Alignment constants (similar to LVGL) */
#define GFX_ALIGN_DEFAULT 0x00
#define GFX_ALIGN_TOP_LEFT 0x00
#define GFX_ALIGN_TOP_MID 0x01
#define GFX_ALIGN_TOP_RIGHT 0x02
#define GFX_ALIGN_LEFT_MID 0x03
#define GFX_ALIGN_CENTER 0x04
#define GFX_ALIGN_RIGHT_MID 0x05
#define GFX_ALIGN_BOTTOM_LEFT 0x06
#define GFX_ALIGN_BOTTOM_MID 0x07
#define GFX_ALIGN_BOTTOM_RIGHT 0x08
#define GFX_ALIGN_OUT_TOP_LEFT 0x09
#define GFX_ALIGN_OUT_TOP_MID 0x0A
#define GFX_ALIGN_OUT_TOP_RIGHT 0x0B
#define GFX_ALIGN_OUT_LEFT_TOP 0x0C
#define GFX_ALIGN_OUT_LEFT_MID 0x0D
#define GFX_ALIGN_OUT_LEFT_BOTTOM 0x0E
#define GFX_ALIGN_OUT_RIGHT_TOP 0x0F
#define GFX_ALIGN_OUT_RIGHT_MID 0x10
#define GFX_ALIGN_OUT_RIGHT_BOTTOM 0x11
#define GFX_ALIGN_OUT_BOTTOM_LEFT 0x12
#define GFX_ALIGN_OUT_BOTTOM_MID 0x13
#define GFX_ALIGN_OUT_BOTTOM_RIGHT 0x14
/**********************
* TYPEDEFS
**********************/
/* Graphics object structure */
typedef struct gfx_obj {
void *src; /**< Source data (image, label, etc.) */
int type; /**< Object type */
gfx_coord_t x; /**< X position */
gfx_coord_t y; /**< Y position */
uint16_t width; /**< Object width */
uint16_t height; /**< Object height */
bool is_visible; /**< Object visibility */
bool is_dirty; /**< Object dirty flag */
uint8_t align_type; /**< Alignment type (see GFX_ALIGN_* constants) */
gfx_coord_t align_x_ofs; /**< X offset for alignment */
gfx_coord_t align_y_ofs; /**< Y offset for alignment */
bool use_align; /**< Whether to use alignment instead of absolute position */
gfx_handle_t parent_handle; /**< Parent graphics handle */
} gfx_obj_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*=====================
* Object setter functions
*====================*/
/**
* @brief Set the position of an object
* @param obj Pointer to the object
* @param x X coordinate
* @param y Y coordinate
*/
void gfx_obj_set_pos(gfx_obj_t *obj, gfx_coord_t x, gfx_coord_t y);
/**
* @brief Set the size of an object
* @param obj Pointer to the object
* @param w Width
* @param h Height
*/
void gfx_obj_set_size(gfx_obj_t *obj, uint16_t w, uint16_t h);
/**
* @brief Align an object relative to the screen or another object
* @param obj Pointer to the object to align
* @param align Alignment type (see GFX_ALIGN_* constants)
* @param x_ofs X offset from the alignment position
* @param y_ofs Y offset from the alignment position
*/
void gfx_obj_align(gfx_obj_t *obj, uint8_t align, gfx_coord_t x_ofs, gfx_coord_t y_ofs);
/**
* @brief Set object visibility
* @param obj Object to set visibility for
* @param visible True to make object visible, false to hide
*/
void gfx_obj_set_visible(gfx_obj_t *obj, bool visible);
/**
* @brief Get object visibility
* @param obj Object to check visibility for
* @return True if object is visible, false if hidden
*/
bool gfx_obj_get_visible(gfx_obj_t *obj);
/*=====================
* Object getter functions
*====================*/
/**
* @brief Get the position of an object
* @param obj Pointer to the object
* @param x Pointer to store X coordinate
* @param y Pointer to store Y coordinate
*/
void gfx_obj_get_pos(gfx_obj_t *obj, gfx_coord_t *x, gfx_coord_t *y);
/**
* @brief Get the size of an object
* @param obj Pointer to the object
* @param w Pointer to store width
* @param h Pointer to store height
*/
void gfx_obj_get_size(gfx_obj_t *obj, uint16_t *w, uint16_t *h);
/*=====================
* Object management functions
*====================*/
/**
* @brief Delete an object
* @param obj Pointer to the object to delete
*/
void gfx_obj_delete(gfx_obj_t *obj);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,108 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "gfx_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/* Timer callback function type */
typedef void (*gfx_timer_cb_t)(void *);
/* Timer handle type for external use */
typedef void* gfx_timer_handle_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*=====================
* Timer functions
*====================*/
/**
* @brief Create a new timer
* @param handle Player handle
* @param timer_cb Timer callback function
* @param period Timer period in milliseconds
* @param user_data User data passed to callback
* @return Timer handle, NULL on error
*/
gfx_timer_handle_t gfx_timer_create(void *handle, gfx_timer_cb_t timer_cb, uint32_t period, void *user_data);
/**
* @brief Delete a timer
* @param handle Player handle
* @param timer Timer handle to delete
*/
void gfx_timer_delete(void *handle, gfx_timer_handle_t timer);
/**
* @brief Pause a timer
* @param timer Timer handle to pause
*/
void gfx_timer_pause(gfx_timer_handle_t timer);
/**
* @brief Resume a timer
* @param timer Timer handle to resume
*/
void gfx_timer_resume(gfx_timer_handle_t timer);
/**
* @brief Set timer repeat count
* @param timer Timer handle to modify
* @param repeat_count Number of times to repeat (-1 for infinite)
*/
void gfx_timer_set_repeat_count(gfx_timer_handle_t timer, int32_t repeat_count);
/**
* @brief Set timer period
* @param timer Timer handle to modify
* @param period New period in milliseconds
*/
void gfx_timer_set_period(gfx_timer_handle_t timer, uint32_t period);
/**
* @brief Reset a timer
* @param timer Timer handle to reset
*/
void gfx_timer_reset(gfx_timer_handle_t timer);
/**
* @brief Get current system tick
* @return Current tick value in milliseconds
*/
uint32_t gfx_timer_tick_get(void);
/**
* @brief Calculate elapsed time since previous tick
* @param prev_tick Previous tick value
* @return Elapsed time in milliseconds
*/
uint32_t gfx_timer_tick_elaps(uint32_t prev_tick);
/**
* @brief Get actual FPS from timer manager
* @param handle Player handle
* @return Actual FPS value, 0 if handle is invalid
*/
uint32_t gfx_timer_get_actual_fps(void *handle);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,61 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "esp_err.h"
#include "stdbool.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/* Basic types */
typedef uint8_t gfx_opa_t; /**< Opacity (0-255) */
typedef int16_t gfx_coord_t; /**< Coordinate type */
/* Color type with full member for compatibility */
typedef union {
uint16_t full; /**< Full 16-bit color value */
} gfx_color_t;
/* Area structure */
typedef struct {
gfx_coord_t x1;
gfx_coord_t y1;
gfx_coord_t x2;
gfx_coord_t y2;
} gfx_area_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* @brief Convert a 32-bit hexadecimal color to gfx_color_t
* @param c The 32-bit hexadecimal color to convert
* @return Converted color in gfx_color_t type
*/
gfx_color_t gfx_color_hex(uint32_t c);
/**********************
* MACROS
**********************/
#define GFX_COLOR_HEX(color) ((gfx_color_t)gfx_color_hex(color))
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,51 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
/**
* @file gfx.h
* @brief Graphics Framework (GFX) - Main header file
*
* This header file includes all the public APIs for the GFX framework.
* The framework provides:
* - Object system for images and labels
* - Drawing functions for rendering to buffers
* - Color utilities and type definitions
* - Software blending capabilities
*/
#include "core/gfx_types.h"
#include "core/gfx_core.h"
#include "core/gfx_timer.h"
#include "core/gfx_obj.h"
#include "widget/gfx_img.h"
#include "widget/gfx_label.h"
#include "widget/gfx_anim.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/*=====================
* Main API
*====================*/
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,85 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "core/gfx_types.h"
#include "core/gfx_core.h"
#include "core/gfx_obj.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* DEFINES
*********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/*=====================
* Animation object creation
*====================*/
/**
* @brief Create an animation object
* @param handle Animation player handle
* @return Pointer to the created animation object
*/
gfx_obj_t * gfx_anim_create(gfx_handle_t handle);
/*=====================
* Animation setter functions
*====================*/
/**
* @brief Set the source data for an animation object
* @param obj Pointer to the animation object
* @param src_data Source data
* @param src_len Source data length
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_anim_set_src(gfx_obj_t *obj, const void *src_data, size_t src_len);
/**
* @brief Set the segment for an animation object
* @param obj Pointer to the animation object
* @param start Start frame index
* @param end End frame index
* @param fps Frames per second
* @param repeat Whether to repeat the animation
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_anim_set_segment(gfx_obj_t *obj, uint32_t start, uint32_t end, uint32_t fps, bool repeat);
/**
* @brief Start the animation
* @param obj Pointer to the animation object
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_anim_start(gfx_obj_t *obj);
/**
* @brief Stop the animation
* @param obj Pointer to the animation object
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_anim_stop(gfx_obj_t *obj);
/**
* @brief Set mirror display for an animation object
* @param obj Pointer to the animation object
* @param enabled Whether to enable mirror display
* @param offset Mirror offset in pixels
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_anim_set_mirror(gfx_obj_t *obj, bool enabled, int16_t offset);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,80 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "core/gfx_types.h"
#include "core/gfx_obj.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* DEFINES
*********************/
/* Magic numbers for image headers */
#define C_ARRAY_HEADER_MAGIC 0x19
/**********************
* TYPEDEFS
**********************/
/* Color format enumeration - simplified for public use */
typedef enum {
GFX_COLOR_FORMAT_RGB565A8 = 0x0A,
} gfx_color_format_t;
typedef struct {
uint32_t magic: 8; /**< Magic number. Must be GFX_IMAGE_HEADER_MAGIC */
uint32_t cf : 8; /**< Color format: See `gfx_color_format_t` */
uint32_t flags: 16; /**< Image flags */
uint32_t w: 16; /**< Width of the image */
uint32_t h: 16; /**< Height of the image */
uint32_t stride: 16; /**< Number of bytes in a row */
uint32_t reserved: 16; /**< Reserved for future use */
} gfx_image_header_t;
/* Image descriptor structure - compatible with LVGL */
typedef struct {
gfx_image_header_t header; /**< A header describing the basics of the image */
uint32_t data_size; /**< Size of the image in bytes */
const uint8_t * data; /**< Pointer to the data of the image */
const void * reserved; /**< Reserved field for future use */
const void * reserved_2; /**< Reserved field for future use */
} gfx_image_dsc_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*=====================
* Image object creation
*====================*/
/**
* @brief Create an image object
* @param handle Animation player handle
* @return Pointer to the created image object
*/
gfx_obj_t * gfx_img_create(gfx_handle_t handle);
/*=====================
* Image setter functions
*====================*/
/**
* @brief Set the source data for an image object
* @param obj Pointer to the image object
* @param src Pointer to the image source data
* @return Pointer to the object
*/
gfx_obj_t * gfx_img_set_src(gfx_obj_t *obj, void *src);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,190 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "core/gfx_types.h"
#include "core/gfx_core.h"
#include "core/gfx_obj.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* DEFINES
*********************/
/* Font handle type - hides internal FreeType implementation */
typedef void *gfx_font_t;
/* Label configuration structure */
typedef struct {
const char * name; /**< The name of the font file */
const void * mem; /**< The pointer to the font file */
size_t mem_size; /**< The size of the memory */
} gfx_label_cfg_t;
/**********************
* TYPEDEFS
**********************/
/**
* Text alignment enumeration (similar to LVGL)
*/
typedef enum {
GFX_TEXT_ALIGN_AUTO, /**< Align text auto */
GFX_TEXT_ALIGN_LEFT, /**< Align text to left */
GFX_TEXT_ALIGN_CENTER, /**< Align text to center */
GFX_TEXT_ALIGN_RIGHT, /**< Align text to right */
} gfx_text_align_t;
/**
* Long text mode enumeration (similar to LVGL)
*/
typedef enum {
GFX_LABEL_LONG_WRAP, /**< Break the long lines (word wrap) */
GFX_LABEL_LONG_SCROLL, /**< Make the text scrolling horizontally */
GFX_LABEL_LONG_CLIP, /**< Simply clip the parts which don't fit */
} gfx_label_long_mode_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*=====================
* Label object creation
*====================*/
/**
* @brief Create a label object
* @param handle Animation player handle
* @param cfg Font configuration
* @return Pointer to the created label object
*/
gfx_obj_t * gfx_label_create(gfx_handle_t handle);
/**
* @brief Create a new font
* @param handle Animation player handle
* @param cfg Font configuration
* @param ret_font Pointer to store the font handle
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_new_font(gfx_handle_t handle, const gfx_label_cfg_t *cfg, gfx_font_t *ret_font);
/*=====================
* Label setter functions
*====================*/
/**
* @brief Set the text for a label object
* @param obj Pointer to the label object
* @param text Text string to display
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_text(gfx_obj_t *obj, const char *text);
/**
* @brief Set the text for a label object with format
* @param obj Pointer to the label object
* @param fmt Format string
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_text_fmt(gfx_obj_t * obj, const char * fmt, ...);
/**
* @brief Set the color for a label object
* @param obj Pointer to the label object
* @param color Color value
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_color(gfx_obj_t *obj, gfx_color_t color);
/**
* @brief Set the background color for a label object
* @param obj Pointer to the label object
* @param bg_color Background color value
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_bg_color(gfx_obj_t *obj, gfx_color_t bg_color);
/**
* @brief Enable or disable background for a label object
* @param obj Pointer to the label object
* @param enable True to enable background, false to disable
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_bg_enable(gfx_obj_t *obj, bool enable);
/**
* @brief Set the opacity for a label object
* @param obj Pointer to the label object
* @param opa Opacity value (0-255)
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_opa(gfx_obj_t *obj, gfx_opa_t opa);
/**
* @brief Set the font size for a label object
* @param obj Pointer to the label object
* @param font_size Font size in points
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_font_size(gfx_obj_t *obj, uint8_t font_size);
/**
* @brief Set the font for a label object
* @param obj Pointer to the label object
* @param font Font handle
*/
esp_err_t gfx_label_set_font(gfx_obj_t *obj, gfx_font_t font);
/**
* @brief Set the text alignment for a label object
* @param obj Pointer to the label object
* @param align Text alignment value
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_text_align(gfx_obj_t *obj, gfx_text_align_t align);
/**
* @brief Set the long text mode for a label object
* @param obj Pointer to the label object
* @param long_mode Long text handling mode (wrap, scroll, or clip)
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_long_mode(gfx_obj_t *obj, gfx_label_long_mode_t long_mode);
/**
* @brief Set the line spacing for a label object
* @param obj Pointer to the label object
* @param spacing Line spacing in pixels
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_line_spacing(gfx_obj_t *obj, uint16_t spacing);
/**
* @brief Set the horizontal scrolling speed for a label object
* @param obj Pointer to the label object
* @param speed_ms Scrolling speed in milliseconds per pixel
* @note Only effective when long_mode is GFX_LABEL_LONG_SCROLL
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_scroll_speed(gfx_obj_t *obj, uint32_t speed_ms);
/**
* @brief Set whether scrolling should loop continuously
* @param obj Pointer to the label object
* @param loop True to enable continuous looping, false for one-time scroll
* @note Only effective when long_mode is GFX_LABEL_LONG_SCROLL
* @return ESP_OK on success, error code otherwise
*/
esp_err_t gfx_label_set_scroll_loop(gfx_obj_t *obj, bool loop);
#ifdef __cplusplus
}
#endif