diff --git a/demos/lv_demos.h b/demos/lv_demos.h index cd4cf838fc..be98e4df24 100644 --- a/demos/lv_demos.h +++ b/demos/lv_demos.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lvgl.h" +#include "../include/lvgl/lvgl.h" typedef struct _lv_demo_args lv_demo_args_t; diff --git a/demos/widgets/lv_demo_widgets.h b/demos/widgets/lv_demo_widgets.h index 287d31e3fd..d736134d2e 100644 --- a/demos/widgets/lv_demo_widgets.h +++ b/demos/widgets/lv_demo_widgets.h @@ -14,8 +14,8 @@ extern "C" { * INCLUDES *********************/ #include "../lv_demos.h" -#include "../../src/draw/lv_draw.h" -#include "../../src/draw/lv_draw_triangle.h" +#include "../../include/lvgl/draw/lv_draw.h" +#include "../../include/lvgl/draw/lv_draw_triangle.h" #if LV_USE_DEMO_WIDGETS diff --git a/env_support/cmake/esp.cmake b/env_support/cmake/esp.cmake index 8ee7c44d1c..591a9b07e0 100644 --- a/env_support/cmake/esp.cmake +++ b/env_support/cmake/esp.cmake @@ -10,9 +10,7 @@ if(LV_MICROPYTHON) SRCS ${SOURCES} INCLUDE_DIRS - ${LVGL_ROOT_DIR} - ${LVGL_ROOT_DIR}/src - ${LVGL_ROOT_DIR}/../ + ${LVGL_ROOT_DIR}/include REQUIRES main) else() diff --git a/env_support/cmake/main.cmake b/env_support/cmake/main.cmake index af33fedd7a..b9adaddf89 100644 --- a/env_support/cmake/main.cmake +++ b/env_support/cmake/main.cmake @@ -61,6 +61,7 @@ endif() # Determine if LVGL is built from a top-level directory get_directory_property(HAS_PARENT_SCOPE PARENT_DIRECTORY) +set(LVGL_INCLUDE_DIR ${LVGL_ROOT_DIR}/include) # Set sources used for LVGL components file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c @@ -175,7 +176,7 @@ if (LV_BUILD_SET_CONFIG_OPTS) execute_process( COMMAND ${Python_EXECUTABLE} ${LVGL_ROOT_DIR}/scripts/preprocess_lv_conf_internal.py - --input ${LVGL_ROOT_DIR}/src/lv_conf_internal.h + --input ${LVGL_INCLUDE_DIR}/lvgl/config/lv_conf_internal.h --tmp_file ${CMAKE_CURRENT_BINARY_DIR}/tmp.h --output ${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h --workfolder ${CMAKE_CURRENT_BINARY_DIR} @@ -218,9 +219,9 @@ include(${CMAKE_CURRENT_LIST_DIR}/dependencies.cmake) # Set the configuration inc dir for all targets created in this CMakeLists.txt # CMAKE_CURRENT_SOURCE_DIR is necessary because the assets include lvgl/lvgl.h ... -include_directories(${CONF_INC_DIR} ${LVGL_ROOT_DIR}) +include_directories(${CONF_INC_DIR} ${LVGL_INCLUDE_DIR} ${LVGL_INCLUDE_DIR}/lvgl) -target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${CONF_INC_DIR} ${CMAKE_CURRENT_BINARY_DIR}) +target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${LVGL_INCLUDE_DIR} ${CONF_INC_DIR} ${CMAKE_CURRENT_BINARY_DIR}) # Propagate the compiler definitions set on LVGL to the rest of the targets # mentioned in this file @@ -296,16 +297,7 @@ endif() ############################## INSTALLATION ###################################### -# Library and headers can be installed to system using make install -file(GLOB LVGL_PUBLIC_HEADERS - "${LVGL_ROOT_DIR}/lvgl.h" - "${CONF_INC_DIR}/*.h" - "${LVGL_ROOT_DIR}/lv_version.h") - -if (CONFIG_LV_USE_PRIVATE_API) - list(APPEND LVGL_PUBLIC_HEADERS "${LVGL_ROOT_DIR}/lvgl_private.h") -endif() - +# Install directory defaults if("${LIB_INSTALL_DIR}" STREQUAL "") set(LIB_INSTALL_DIR "lib") endif() @@ -313,19 +305,16 @@ if("${RUNTIME_INSTALL_DIR}" STREQUAL "") set(RUNTIME_INSTALL_DIR "bin") endif() if("${INC_INSTALL_DIR}" STREQUAL "") - set(INC_INSTALL_DIR "include/lvgl") + set(INC_INSTALL_DIR "include") endif() -#Install public headers +# Install public headers install( - DIRECTORY "${LVGL_ROOT_DIR}/src" - DESTINATION "${INC_INSTALL_DIR}" - FILES_MATCHING - PATTERN "*.h" - PATTERN "*_private.h" EXCLUDE) + DIRECTORY "${LVGL_ROOT_DIR}/include/lvgl" + DESTINATION "${INC_INSTALL_DIR}") -if (CONFIG_LV_USE_PRIVATE_API) - # Install private headers - only if required +# Install private headers only if required +if(CONFIG_LV_USE_PRIVATE_API) install( DIRECTORY "${LVGL_ROOT_DIR}/src" DESTINATION "${INC_INSTALL_DIR}" @@ -333,43 +322,36 @@ if (CONFIG_LV_USE_PRIVATE_API) PATTERN "*_private.h") endif() - -if (LV_BUILD_USE_KCONFIG) - # When KConfig is used, copy the expanded conf header - # and rename it to lv_conf.h - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h - DESTINATION ${INC_INSTALL_DIR} - RENAME lv_conf.h) +# When KConfig is used, copy the expanded conf header and rename it to lv_conf.h +if(LV_BUILD_USE_KCONFIG) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h" + DESTINATION "${INC_INSTALL_DIR}" + RENAME lv_conf.h) endif() +# Configure and install generated files +configure_file("${LVGL_ROOT_DIR}/lvgl.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc" @ONLY) +configure_file("${LVGL_ROOT_DIR}/lv_version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/lv_version.h" @ONLY) + install( - FILES ${LVGL_PUBLIC_HEADERS} - DESTINATION "${INC_INSTALL_DIR}/") + FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc" + DESTINATION "share/pkgconfig/") # Install library -set_target_properties( - lvgl - PROPERTIES OUTPUT_NAME lvgl - VERSION ${LVGL_VERSION} - SOVERSION ${LVGL_SOVERSION} - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib" - PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}") +set_target_properties(lvgl + PROPERTIES + OUTPUT_NAME lvgl + VERSION ${LVGL_VERSION} + SOVERSION ${LVGL_SOVERSION} + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") install( TARGETS lvgl ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" LIBRARY DESTINATION "${LIB_INSTALL_DIR}" - RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}" - PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}") - -# TODO: if LVGL is linked with something else eg Freetype, Pkgconfig file must contain -lfreetype2 -configure_file("${LVGL_ROOT_DIR}/lvgl.pc.in" ${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc @ONLY) -configure_file("${LVGL_ROOT_DIR}/lv_version.h.in" ${CMAKE_CURRENT_BINARY_DIR}/lv_version.h @ONLY) - -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc" - DESTINATION "share/pkgconfig/") + RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}") # Install library thorvg if(CONFIG_LV_USE_THORVG_INTERNAL) @@ -396,7 +378,7 @@ if(CONFIG_LV_BUILD_DEMOS) install( DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/demos" - DESTINATION "${INC_INSTALL_DIR}" + DESTINATION "${INC_INSTALL_DIR}/lvgl" FILES_MATCHING PATTERN "*.h") @@ -422,7 +404,7 @@ if(CONFIG_LV_BUILD_EXAMPLES) install( DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples" - DESTINATION "${INC_INSTALL_DIR}" + DESTINATION "${INC_INSTALL_DIR}/lvgl" FILES_MATCHING PATTERN "*.h") diff --git a/include/lvgl/3d/lv_3dmath.h b/include/lvgl/3d/lv_3dmath.h new file mode 100644 index 0000000000..cb41d7f765 --- /dev/null +++ b/include/lvgl/3d/lv_3dmath.h @@ -0,0 +1,72 @@ +/** + * @file lv_3dmath.h + * + */ + +#ifndef LV_3DMATH_H +#define LV_3DMATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" + +/********************* + * DEFINES + *********************/ + +#if LV_USE_GLTF + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + float x; + float y; + float z; +} lv_3dpoint_t; + +typedef struct { + float x; + float y; + float z; + float w; +} lv_quaternion_t; + +typedef struct { + lv_3dpoint_t origin; + lv_3dpoint_t direction; +} lv_3dplane_t; + +typedef lv_3dplane_t lv_3dray_t; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Get a plane that faces upward, centered at a given height + * @param elevation elevation of the ground plane, in world units. this is usually zero + * @return ground plane + */ +lv_3dplane_t lv_get_ground_plane(float elevation); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_GLTF*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + + +#endif /*LV_3DMATH_H*/ diff --git a/include/lvgl/3d/lv_gltf_environment.h b/include/lvgl/3d/lv_gltf_environment.h new file mode 100644 index 0000000000..79a2427103 --- /dev/null +++ b/include/lvgl/3d/lv_gltf_environment.h @@ -0,0 +1,92 @@ +/** + * @file lv_gltf_environment.h + * + */ + +#ifndef LV_GLTF_ENVIRONMENT_H +#define LV_GLTF_ENVIRONMENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_GLTF + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +#define LV_GLTF_DEFAULT_CUBE_MAP_RESOLUTION 128 + +/********************** + * TYPEDEFS + **********************/ + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an IBL sampler for processing environment images + * @return pointer to the created sampler, or NULL on failure + * @note Can be safely deleted after environments are created + */ +lv_gltf_ibl_sampler_t * lv_gltf_ibl_sampler_create(void); + +/** + * Set the resolution for each cubemap face + * @param pointer to a sampler + * @param resolution of each cube map face in pixels (recommended: 64-512 for embedded) + */ +void lv_gltf_ibl_sampler_set_cube_map_pixel_resolution(lv_gltf_ibl_sampler_t * sampler, uint32_t resolution); + +/** + * Delete an IBL sampler + * @param sampler pointer to the sampler to delete + */ +void lv_gltf_ibl_sampler_delete(lv_gltf_ibl_sampler_t * sampler); + +/** + * Create an environment from an HDR or JPEG panoramic image for IBL rendering + * @param sampler IBL sampler defining output resolution (can be deleted after this call) + * @param file_path path to equirectangular environment image, or NULL to use default embedded image + * @return pointer to the created environment, or NULL on failure + * + * @note The source image will be downsampled to the sampler's texture_size + * @note The environment can be shared across multiple glTF objects + */ +lv_gltf_environment_t * lv_gltf_environment_create(lv_gltf_ibl_sampler_t * sampler, const char * file_path); + +/** + * Set the rotation angle of the environment map + * @param env pointer to the environment + * @param angle rotation angle in degrees + */ +void lv_gltf_environment_set_angle(lv_gltf_environment_t * env, float angle); + +/** + * Delete an environment + * @param environment pointer to the environment to delete + */ +void lv_gltf_environment_delete(lv_gltf_environment_t * environment); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_GLTF*/ +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_GLTF_ENVIRONMENT_H*/ + + diff --git a/include/lvgl/3d/lv_gltf_model.h b/include/lvgl/3d/lv_gltf_model.h new file mode 100644 index 0000000000..3501befe70 --- /dev/null +++ b/include/lvgl/3d/lv_gltf_model.h @@ -0,0 +1,179 @@ +#ifndef LV_GLTF_MODEL_H +#define LV_GLTF_MODEL_H + +#include "../config/lv_conf_internal.h" + +#if LV_USE_GLTF + +#include "../core/lv_event.h" +#include "../lv_types.h" +#include "lv_gltf_model_node.h" +#include "lv_gltf_model_loader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Load a glTF model from a file + * @param file_path path to the glTF file to load + * @param loader pointer to the glTF model loader instance, or NULL to create a new one + * @return pointer to the loaded glTF model, or NULL on failure + * @note If loader is NULL, an internal loader will be created and managed automatically + */ +lv_gltf_model_t * lv_gltf_data_load_from_file(const char * file_path, + lv_gltf_model_loader_t * loader); + +/** + * Load a glTF model from a byte array + * @param data pointer to the glTF data buffer + * @param data_size size of the data buffer in bytes + * @param loader pointer to the glTF model loader instance, or NULL to create a new one + * @return pointer to the loaded glTF model, or NULL on failure + * @note If loader is NULL, an internal loader will be created and managed automatically + */ +lv_gltf_model_t * lv_gltf_data_load_from_bytes(const uint8_t * data, size_t data_size, + lv_gltf_model_loader_t * loader); + + +/** + * Delete a glTF model + * @param model the gltf model to delete + */ +void lv_gltf_model_delete(lv_gltf_model_t * model); + +/** + * @brief Get the number of images in the glTF model + * + * Images in glTF are used as sources for textures and can be stored either as external files + * or embedded as base64-encoded model within the glTF file. + * + * @param model Pointer to the glTF model data structure + * @return Number of images in the model + */ +size_t lv_gltf_model_get_image_count(const lv_gltf_model_t * model); + +/** + * @brief Get the number of textures in the glTF model + * + * Textures define how images are sampled and applied to materials. Each texture references + * an image and may specify sampling parameters like filtering and wrapping modes. + * + * @param model Pointer to the glTF model data structure + * @return Number of textures in the model + */ +size_t lv_gltf_model_get_texture_count(const lv_gltf_model_t * model); + +/** + * @brief Get the number of materials in the glTF model + * + * Materials define the visual appearance of mesh primitives, including properties like + * base color, metallic/roughness values, normal maps, and other surface characteristics. + * + * @param model Pointer to the glTF model data structure + * @return Number of materials in the model + */ +size_t lv_gltf_model_get_material_count(const lv_gltf_model_t * model); + +/** + * @brief Get the number of cameras in the glTF model + * + * Cameras define viewpoints within the 3D scene and can be either perspective or + * orthographic. They are typically attached to nodes in the scene graph. + * + * @param model Pointer to the glTF model data structure + * @return Number of cameras in the model + */ +size_t lv_gltf_model_get_camera_count(const lv_gltf_model_t * model); + + +/** + * @brief Get the number of meshes in the glTF model + * + * Meshes contain the geometric model for 3D objects, including vertex positions, normals, + * texture coordinates, and indices. Each mesh can have multiple primitives with different materials. + * + * @param model Pointer to the glTF model data structure + * @return Number of meshes in the model + */ +size_t lv_gltf_model_get_mesh_count(const lv_gltf_model_t * model); + +/** + * @brief Get the number of scenes in the glTF model + * + * Scenes define the root nodes of the scene graph. A glTF file can contain multiple scenes, + * though typically only one is designated as the default scene to be displayed. + * + * @param model Pointer to the glTF model data structure + * @return Number of scenes in the model + */ +size_t lv_gltf_model_get_scene_count(const lv_gltf_model_t * model); + +/** + * @brief Get the number of animations in the glTF model + * + * Animations define keyframe-based motion for nodes in the scene, including transformations + * like translation, rotation, and scaling over time. + * + * @param model Pointer to the glTF model data structure + * @return Number of animations in the model + */ +size_t lv_gltf_model_get_animation_count(const lv_gltf_model_t * model); + +/** + * @brief Select and start playing an animation + * + * @param model Pointer to the glTF model structure + * @param index Animation number to start playing + * @return LV_RESULT_OK if the animation was started else LV_RESULT_INVALID + */ +lv_result_t lv_gltf_model_play_animation(lv_gltf_model_t * model, size_t index); + +/** + * @brief Pause the current animation + * + * @param model Pointer to the glTF model structure + */ +void lv_gltf_model_pause_animation(lv_gltf_model_t * model); + +/** + * @brief Check if an animation is currently being played + * + * @param model Pointer to the glTF model structure + */ +bool lv_gltf_model_is_animation_paused(lv_gltf_model_t * model); + +/** + * @brief Get the current selected animation. To see if it's playing see `lv_gltf_model_is_animation_paused` + * + * @param model Pointer to the glTF model structure + */ +size_t lv_gltf_model_get_animation(lv_gltf_model_t * model); + +/** + * Set the animation speed ratio + * + * The actual ratio is the value parameter / LV_GLTF_ANIM_SPEED_NORMAL + * Values greater than LV_GLTF_ANIM_SPEED_NORMAL will speed-up the animation + * Values less than LV_GLTF_ANIM_SPEED_NORMAL will slow down the animation + * + * @param model pointer to a glTF model + * @param value speed-up ratio of the animation + */ +void lv_gltf_model_set_animation_speed(lv_gltf_model_t * model, uint32_t value); + +/** + * Get the animation speed ratio + * + * The actual ratio is the return value / LV_GLTF_ANIM_SPEED_NORMAL + * + * @param model pointer to a glTF model + */ +uint32_t lv_gltf_model_get_animation_speed(const lv_gltf_model_t * model); + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_USE_GLTF*/ +#endif /*LV_GLTF_MODEL_H*/ diff --git a/include/lvgl/3d/lv_gltf_model_loader.h b/include/lvgl/3d/lv_gltf_model_loader.h new file mode 100644 index 0000000000..d86eb9bfba --- /dev/null +++ b/include/lvgl/3d/lv_gltf_model_loader.h @@ -0,0 +1,75 @@ +/** + * @file lv_gltf_model_loader.h + * + */ + +#ifndef LV_GLTF_MODEL_LOADER_H +#define LV_GLTF_MODEL_LOADER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" + +#if LV_USE_GLTF + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct _lv_gltf_model_loader_t lv_gltf_model_loader_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a new glTF model loader instance + * @return pointer to the newly created glTF model loader instance + */ +lv_gltf_model_loader_t * lv_gltf_model_loader_create(void); + +/** + * Store a texture ID associated with a texture hash in the loader + * @param loader pointer to the glTF model loader instance + * @param texture_hash hash value identifying the texture + * @param texture_id the texture ID to associate with the hash + */ +void lv_gltf_model_loader_store_texture(lv_gltf_model_loader_t * loader, uint32_t texture_hash, uint32_t texture_id); + +/** + * Retrieve a texture ID by its hash from the loader + * @param loader pointer to the glTF model loader instance + * @param texture_hash hash value of the texture to retrieve + * @return the texture ID associated with the hash, or 0 if not found + */ +uint32_t lv_gltf_model_loader_get_texture(lv_gltf_model_loader_t * loader, uint32_t texture_hash); + +/** + * Delete a glTF model loader instance and free its resources + * @param loader pointer to the glTF model loader instance to delete + */ +void lv_gltf_model_loader_delete(lv_gltf_model_loader_t * loader); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_GLTF*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_GLTF_MODEL_LOADER_H*/ diff --git a/include/lvgl/3d/lv_gltf_model_node.h b/include/lvgl/3d/lv_gltf_model_node.h new file mode 100644 index 0000000000..40da2bde9e --- /dev/null +++ b/include/lvgl/3d/lv_gltf_model_node.h @@ -0,0 +1,273 @@ +/** + * @file lv_gltf_model_node.h + * + */ + +#ifndef LV_GLTF_MODEL_NODE_H +#define LV_GLTF_MODEL_NODE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" + +#if LV_USE_GLTF + +#include "../lv_types.h" +#include "lv_3dmath.h" +#include "../core/lv_event.h" + +/********************* + * DEFINES + *********************/ + +#define LV_GLTF_ANIM_SPEED_TENTH 100 +#define LV_GLTF_ANIM_SPEED_QUARTER 250 +#define LV_GLTF_ANIM_SPEED_HALF 500 +#define LV_GLTF_ANIM_SPEED_NORMAL 1000 +#define LV_GLTF_ANIM_SPEED_2X 2000 +#define LV_GLTF_ANIM_SPEED_3X 3000 +#define LV_GLTF_ANIM_SPEED_4X 4000 +#define LV_GLTF_DEFAULT_CAMERA 0 + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Get a glTF model node by its index + * + * @param data Pointer to the glTF model structure + * @param index The index of the node to retrieve + * @return Pointer to the glTF model node, or NULL if not found + */ +lv_gltf_model_node_t * lv_gltf_model_node_get_by_index(lv_gltf_model_t * data, size_t index); + +/** + * @brief Get a glTF model node by its numeric path + * + * @param data Pointer to the glTF model structure + * @param num_path The numeric path string of the node to retrieve (eg. ".0") + * @return Pointer to the glTF model node, or NULL if not found + */ +lv_gltf_model_node_t * lv_gltf_model_node_get_by_numeric_path(lv_gltf_model_t * data, const char * num_path); + +/** + * @brief Get a glTF model node by its path + * + * @param data Pointer to the glTF model structure + * @param path The path string of the node to retrieve + * @return Pointer to the glTF model node, or NULL if not found + */ +lv_gltf_model_node_t * lv_gltf_model_node_get_by_path(lv_gltf_model_t * data, const char * path); + +/** + * @brief Get the path of a glTF model node + * + * @param node Pointer to the glTF model node structure + * @return The path string of the node, or NULL if node is invalid + */ +const char * lv_gltf_model_node_get_path(lv_gltf_model_node_t * node); + +/** + * @brief Get the IP (internal pointer/identifier) of a glTF model node + * + * @param node Pointer to the glTF model node structure + * @return The IP string of the node, or NULL if node is invalid + */ +const char * lv_gltf_model_node_get_ip(lv_gltf_model_node_t * node); + +/** + * @brief Add an event callback to a glTF model node + * + * @param node Pointer to the glTF model node structure + * @param cb The event callback function to add. Use lv_event_get_param() to retrieve lv_gltf_node_data_t with the node's data. + * @param filter_list Event code filter for the callback + * @param user_data User data to pass to the callback + * @return Pointer to the event descriptor, or NULL if allocation failed + */ +lv_event_dsc_t * lv_gltf_model_node_add_event_cb(lv_gltf_model_node_t * node, lv_event_cb_t cb, + lv_event_code_t filter_list, + void * user_data); + +/** + * @brief Add an event callback to a glTF model node with world position computation enabled. Use this only when world position is needed, as computing it is an expensive operation. + * + * @param node Pointer to the glTF model node structure + * @param cb The event callback function to add. Use lv_event_get_param() to retrieve lv_gltf_node_data_t with the node's data. + * @param filter_list Event code filter for the callback + * @param user_data User data to pass to the callback + * @return Pointer to the event descriptor, or NULL if allocation failed + */ +lv_event_dsc_t * lv_gltf_model_node_add_event_cb_with_world_position(lv_gltf_model_node_t * node, lv_event_cb_t cb, + lv_event_code_t filter_list, + void * user_data); +/** + * @brief Get the number of nodes in the glTF model + * + * Nodes form the scene graph hierarchy and can contain transformations, meshes, cameras, + * or other nodes as children. They define the spatial relationships between objects in the scene. + * + * @param model Pointer to the glTF model data structure + * @return Number of nodes in the model + */ +size_t lv_gltf_model_get_node_count(const lv_gltf_model_t * model); + +/** + * @brief Set the X position of a glTF model node. The operation is queued and applied on the next rendering phase. + * + * @param node Pointer to the glTF model node structure + * @param x The X position value + * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation + */ +lv_result_t lv_gltf_model_node_set_position_x(lv_gltf_model_node_t * node, float x); + +/** + * @brief Set the Y position of a glTF model node. The operation is queued and applied on the next rendering phase. + * + * @param node Pointer to the glTF model node structure + * @param y The Y position value + * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation + */ +lv_result_t lv_gltf_model_node_set_position_y(lv_gltf_model_node_t * node, float y); + +/** + * @brief Set the Z position of a glTF model node. The operation is queued and applied on the next rendering phase. + * + * @param node Pointer to the glTF model node structure + * @param z The Z position value + * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation + */ +lv_result_t lv_gltf_model_node_set_position_z(lv_gltf_model_node_t * node, float z); + +/** + * @brief Set the X component of a glTF model node's rotation quaternion. The operation is queued and applied on the next rendering phase. + * + * @param node Pointer to the glTF model node structure + * @param x The X rotation component value + * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation + */ +lv_result_t lv_gltf_model_node_set_rotation_x(lv_gltf_model_node_t * node, float x); + +/** + * @brief Set the Y component of a glTF model node's rotation quaternion. The operation is queued and applied on the next rendering phase. + * + * @param node Pointer to the glTF model node structure + * @param y The Y rotation component value + * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation + */ +lv_result_t lv_gltf_model_node_set_rotation_y(lv_gltf_model_node_t * node, float y); + +/** + * @brief Set the Z component of a glTF model node's rotation quaternion. The operation is queued and applied on the next rendering phase. + * + * @param node Pointer to the glTF model node structure + * @param z The Z rotation component value + * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation + */ +lv_result_t lv_gltf_model_node_set_rotation_z(lv_gltf_model_node_t * node, float z); + +/** + * @brief Set the X scale of a glTF model node. The operation is queued and applied on the next rendering phase. + * + * @param node Pointer to the glTF model node structure + * @param x The X scale value + * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation + */ +lv_result_t lv_gltf_model_node_set_scale_x(lv_gltf_model_node_t * node, float x); + +/** + * @brief Set the Y scale of a glTF model node. The operation is queued and applied on the next rendering phase. + * + * @param node Pointer to the glTF model node structure + * @param y The Y scale value + * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation + */ +lv_result_t lv_gltf_model_node_set_scale_y(lv_gltf_model_node_t * node, float y); + +/** + * @brief Set the Z scale of a glTF model node. The operation is queued and applied on the next rendering phase. + * + * @param node Pointer to the glTF model node structure + * @param z The Z scale value + * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation + */ +lv_result_t lv_gltf_model_node_set_scale_z(lv_gltf_model_node_t * node, float z); + +/** + * @brief Get the local position of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback. + * + * Local position is relative to the node's parent. + * + * This function is only valid when called from an event callback registered. + * See `lv_gltf_model_node_add_event_cb()` and `lv_gltf_model_node_add_event_cb_with_world_position()` + * + * @param e Pointer to the event structure from the callback + * @param result Pointer to lv_3dpoint_t structure to store the position (x, y, z) + * @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback or if parameters are null + */ +lv_result_t lv_gltf_model_node_get_local_position(lv_event_t * e, lv_3dpoint_t * result); + +/** + * @brief Get the world position of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback + * registered with world position enabled. + * + * World position is the absolute position in global scene coordinates. + * + * This function requires the event callback to be registered with lv_gltf_model_node_add_event_cb_with_world_position() + * as it involves complex matrix calculations that are computed on-demand. + * + * @param e Pointer to the event structure from the callback + * @param result Pointer to lv_3dpoint_t structure to store the position (x, y, z) + * @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback, world position not enabled, or if parameters are null + */ +lv_result_t lv_gltf_model_node_get_world_position(lv_event_t * e, lv_3dpoint_t * result); + +/** + * @brief Get the scale of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback. + * + * Returns the scale factors for each axis. + * + * This function is only valid when called from an event callback registered. + * See `lv_gltf_model_node_add_event_cb()` and `lv_gltf_model_node_add_event_cb_with_world_position()` + * + * @param e Pointer to the event structure from the callback + * @param result Pointer to lv_3dpoint_t structure to store the scale (x, y, z) + * @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback or if parameters are null + */ +lv_result_t lv_gltf_model_node_get_scale(lv_event_t * e, lv_3dpoint_t * result); + +/** + * @brief Get the Euler rotation of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback. + * + * Returns rotation as Euler angles in radians (x, y, z). + * + * This function is only valid when called from an event callback registered. + * See `lv_gltf_model_node_add_event_cb()` and `lv_gltf_model_node_add_event_cb_with_world_position()` + * + * @param e Pointer to the event structure from the callback + * @param result Pointer to lv_3dpoint_t structure to store the rotation in radians (x, y, z) + * @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback or if parameters are null + */ +lv_result_t lv_gltf_model_node_get_euler_rotation(lv_event_t * e, lv_3dpoint_t * result); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_GLTF*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_GLTF_MODEL_NODE_H*/ diff --git a/include/lvgl/api_map/lv_api_map_v8.h b/include/lvgl/api_map/lv_api_map_v8.h new file mode 100644 index 0000000000..f11c20cf98 --- /dev/null +++ b/include/lvgl/api_map/lv_api_map_v8.h @@ -0,0 +1,332 @@ +/** + * @file lv_api_map_v8.h + * + */ + +#ifndef LV_API_MAP_V8_H +#define LV_API_MAP_V8_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../lv_types.h" +#include "../draw/lv_image_dsc.h" +#include "../display/lv_display.h" +#include "../core/lv_anim_timeline.h" +#include "../widgets/lv_buttonmatrix.h" + +/********************* + * DEFINES + *********************/ + +#define LV_DISP_ROTATION_0 LV_DISPLAY_ROTATION_0 +#define LV_DISP_ROTATION_90 LV_DISPLAY_ROTATION_90 +#define LV_DISP_ROTATION_180 LV_DISPLAY_ROTATION_180 +#define LV_DISP_ROTATION_270 LV_DISPLAY_ROTATION_270 + +#define LV_DISP_RENDER_MODE_PARTIAL LV_DISPLAY_RENDER_MODE_PARTIAL +#define LV_DISP_RENDER_MODE_DIRECT LV_DISPLAY_RENDER_MODE_DIRECT +#define LV_DISP_RENDER_MODE_FULL LV_DISPLAY_RENDER_MODE_FULL + +#if LV_USE_BUTTONMATRIX +#define LV_BTNMATRIX_BTN_NONE LV_BUTTONMATRIX_BUTTON_NONE + +#define LV_BTNMATRIX_CTRL_HIDDEN LV_BUTTONMATRIX_CTRL_HIDDEN +#define LV_BTNMATRIX_CTRL_NO_REPEAT LV_BUTTONMATRIX_CTRL_NO_REPEAT +#define LV_BTNMATRIX_CTRL_DISABLED LV_BUTTONMATRIX_CTRL_DISABLED +#define LV_BTNMATRIX_CTRL_CHECKABLE LV_BUTTONMATRIX_CTRL_CHECKABLE +#define LV_BTNMATRIX_CTRL_CHECKED LV_BUTTONMATRIX_CTRL_CHECKED +#define LV_BTNMATRIX_CTRL_CLICK_TRIG LV_BUTTONMATRIX_CTRL_CLICK_TRIG +#define LV_BTNMATRIX_CTRL_POPOVER LV_BUTTONMATRIX_CTRL_POPOVER +#define LV_BTNMATRIX_CTRL_CUSTOM_1 LV_BUTTONMATRIX_CTRL_CUSTOM_1 +#define LV_BTNMATRIX_CTRL_CUSTOM_2 LV_BUTTONMATRIX_CTRL_CUSTOM_2 +#endif /* LV_USE_BUTTONMATRIX */ + +/********************** + * TYPEDEFS + **********************/ +typedef int32_t lv_coord_t; +typedef lv_result_t lv_res_t; +typedef lv_image_dsc_t lv_img_dsc_t; +typedef lv_display_t lv_disp_t; +typedef lv_display_rotation_t lv_disp_rotation_t; +typedef lv_display_render_mode_t lv_disp_render_t; +typedef lv_anim_completed_cb_t lv_anim_ready_cb_t; +typedef lv_screen_load_anim_t lv_scr_load_anim_t; + +#if LV_USE_BUTTONMATRIX +typedef lv_buttonmatrix_ctrl_t lv_btnmatrix_ctrl_t; +#endif /* LV_USE_BUTTONMATRIX */ + +#if LV_USE_IMAGEBUTTON +#define LV_IMGBTN_STATE_RELEASED LV_IMAGEBUTTON_STATE_RELEASED +#define LV_IMGBTN_STATE_PRESSED LV_IMAGEBUTTON_STATE_PRESSED +#define LV_IMGBTN_STATE_DISABLED LV_IMAGEBUTTON_STATE_DISABLED +#define LV_IMGBTN_STATE_CHECKED_RELEASED LV_IMAGEBUTTON_STATE_CHECKED_RELEASED +#define LV_IMGBTN_STATE_CHECKED_PRESSED LV_IMAGEBUTTON_STATE_CHECKED_PRESSED +#define LV_IMGBTN_STATE_CHECKED_DISABLED LV_IMAGEBUTTON_STATE_CHECKED_DISABLED +#endif /* LV_USE_IMAGEBUTTON */ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +static inline LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_task_handler(void) +{ + return lv_timer_handler(); +} + +/** + * Move the object to the foreground. + * It will look like if it was created as the last child of its parent. + * It also means it can cover any of the siblings. + * @param obj pointer to an object + */ +static inline void lv_obj_move_foreground(lv_obj_t * obj) +{ + lv_obj_t * parent = lv_obj_get_parent(obj); + if(!parent) { + LV_LOG_WARN("parent is NULL"); + return; + } + + lv_obj_move_to_index(obj, lv_obj_get_child_count(parent) - 1); +} + +/** + * Move the object to the background. + * It will look like if it was created as the first child of its parent. + * It also means any of the siblings can cover the object. + * @param obj pointer to an object + */ +static inline void lv_obj_move_background(lv_obj_t * obj) +{ + lv_obj_move_to_index(obj, 0); +} + +/********************** + * MACROS + **********************/ +#define LV_RES_OK LV_RESULT_OK +#define LV_RES_INV LV_RESULT_INVALID + +#define LV_INDEV_STATE_PR LV_INDEV_STATE_PRESSED +#define LV_INDEV_STATE_REL LV_INDEV_STATE_RELEASED + +#define lv_obj_del lv_obj_delete +#define lv_obj_del_async lv_obj_delete_async +#define lv_obj_clear_flag lv_obj_remove_flag +#define lv_obj_clear_state lv_obj_remove_state + +#define lv_indev_set_disp lv_indev_set_display +#define lv_indev_get_act lv_indev_active +#define lv_scr_act lv_screen_active +#define lv_disp_remove lv_display_delete +#define lv_disp_set_default lv_display_set_default +#define lv_disp_get_default lv_display_get_default +#define lv_disp_get_next lv_display_get_next +#define lv_disp_set_rotation lv_display_set_rotation +#define lv_disp_get_hor_res lv_display_get_horizontal_resolution +#define lv_disp_get_ver_res lv_display_get_vertical_resolution +#define lv_disp_get_physical_hor_res lv_display_get_physical_horizontal_resolution +#define lv_disp_get_physical_ver_res lv_display_get_physical_vertical_resolution +#define lv_disp_get_offset_x lv_display_get_offset_x +#define lv_disp_get_offset_y lv_display_get_offset_y +#define lv_disp_get_rotation lv_display_get_rotation +#define lv_disp_get_dpi lv_display_get_dpi +#define lv_disp_get_antialiasing lv_display_get_antialiasing +#define lv_disp_flush_ready lv_display_flush_ready +#define lv_disp_flush_is_last lv_display_flush_is_last +#define lv_disp_get_scr_act lv_display_get_screen_active +#define lv_disp_get_scr_prev lv_display_get_screen_prev +#define lv_disp_load_scr lv_screen_load +#define lv_scr_load lv_screen_load +#define lv_scr_load_anim lv_screen_load_anim +#define lv_disp_get_layer_top lv_display_get_layer_top +#define lv_disp_get_layer_sys lv_display_get_layer_sys +#define lv_disp_send_event lv_display_send_event +#define lv_disp_set_theme lv_display_set_theme +#define lv_disp_get_theme lv_display_get_theme +#define lv_disp_get_inactive_time lv_display_get_inactive_time +#define lv_disp_trig_activity lv_display_trigger_activity +#define lv_disp_enable_invalidation lv_display_enable_invalidation +#define lv_disp_is_invalidation_enabled lv_display_is_invalidation_enabled +#define lv_disp_refr_timer lv_display_refr_timer +#define lv_disp_get_refr_timer lv_display_get_refr_timer + +#define lv_timer_del lv_timer_delete + +#define lv_anim_del lv_anim_delete +#define lv_anim_del_all lv_anim_delete_all +#define lv_anim_set_ready_cb lv_anim_set_completed_cb + +#define lv_group_del lv_group_delete + +#if LV_USE_TEXTAREA +#define lv_txt_get_size lv_text_get_size +#define lv_txt_get_width lv_text_get_width +#endif /* LV_USE_TEXTAREA */ + +#if LV_USE_IMAGE +#define lv_img_create lv_image_create +#define lv_img_set_src lv_image_set_src +#define lv_img_set_offset_x lv_image_set_offset_x +#define lv_img_set_offset_y lv_image_set_offset_y +#define lv_img_set_angle lv_image_set_rotation +#define lv_img_set_pivot lv_image_set_pivot +#define lv_img_set_zoom lv_image_set_scale +#define lv_img_set_antialias lv_image_set_antialias +#define lv_img_get_src lv_image_get_src +#define lv_img_get_offset_x lv_image_get_offset_x +#define lv_img_get_offset_y lv_image_get_offset_y +#define lv_img_get_angle lv_image_get_rotation +#define lv_img_get_pivot lv_image_get_pivot +#define lv_img_get_zoom lv_image_get_scale +#define lv_img_get_antialias lv_image_get_antialias +#endif /* LV_USE_IMAGE */ + +#if LV_USE_IMAGEBUTTON +#define lv_imgbtn_create lv_imagebutton_create +#define lv_imgbtn_set_src lv_imagebutton_set_src +#define lv_imgbtn_set_state lv_imagebutton_set_state +#define lv_imgbtn_get_src_left lv_imagebutton_get_src_left +#define lv_imgbtn_get_src_middle lv_imagebutton_get_src_middle +#define lv_imgbtn_get_src_right lv_imagebutton_get_src_right +#endif /* LV_USE_IMAGEBUTTON */ + +#if LV_USE_LIST +#define lv_list_set_btn_text lv_list_set_button_text +#define lv_list_get_btn_text lv_list_get_button_text +#define lv_list_add_btn lv_list_add_button +#endif /* LV_USE_LIST */ + +#if LV_USE_BUTTON +#define lv_btn_create lv_button_create +#endif /* LV_USE_BUTTON */ + +#if LV_USE_BUTTONMATRIX +#define lv_btnmatrix_create lv_buttonmatrix_create +#define lv_btnmatrix_set_map lv_buttonmatrix_set_map +#define lv_btnmatrix_set_ctrl_map lv_buttonmatrix_set_ctrl_map +#define lv_btnmatrix_set_selected_btn lv_buttonmatrix_set_selected_button +#define lv_btnmatrix_set_btn_ctrl lv_buttonmatrix_set_button_ctrl +#define lv_btnmatrix_clear_btn_ctrl lv_buttonmatrix_clear_button_ctrl +#define lv_btnmatrix_set_btn_ctrl_all lv_buttonmatrix_set_button_ctrl_all +#define lv_btnmatrix_clear_btn_ctrl_all lv_buttonmatrix_clear_button_ctrl_all +#define lv_btnmatrix_set_btn_width lv_buttonmatrix_set_button_width +#define lv_btnmatrix_set_one_checked lv_buttonmatrix_set_one_checked +#define lv_btnmatrix_get_map lv_buttonmatrix_get_map +#define lv_btnmatrix_get_selected_btn lv_buttonmatrix_get_selected_button +#define lv_btnmatrix_get_btn_text lv_buttonmatrix_get_button_text +#define lv_btnmatrix_has_button_ctrl lv_buttonmatrix_has_button_ctrl +#define lv_btnmatrix_get_one_checked lv_buttonmatrix_get_one_checked +#endif /* LV_USE_BUTTONMATRIX */ + +#if LV_USE_TABVIEW +#define lv_tabview_get_tab_btns lv_tabview_get_tab_bar +#define lv_tabview_get_tab_act lv_tabview_get_tab_active +#define lv_tabview_set_act lv_tabview_set_active +#endif /* LV_USE_TABVIEW */ + +#if LV_USE_TILEVIEW +#define lv_tileview_get_tile_act lv_tileview_get_tile_active +#define lv_obj_set_tile_id lv_tileview_set_tile_by_index +#define lv_obj_set_tile lv_tileview_set_tile +#endif /* LV_USE_TILEVIEW */ + +#if LV_USE_ROLLER +#define lv_roller_set_visible_row_cnt lv_roller_set_visible_row_count +#define lv_roller_get_option_cnt lv_roller_get_option_count +#endif /* LV_USE_ROLLER */ + +#if LV_USE_TABLE +#define lv_table_set_col_cnt lv_table_set_column_count +#define lv_table_set_row_cnt lv_table_set_row_count +#define lv_table_get_col_cnt lv_table_get_column_count +#define lv_table_get_row_cnt lv_table_get_row_count +#define lv_table_set_col_width lv_table_set_column_width +#define lv_table_get_col_width lv_table_get_column_width +#endif /* LV_USE_TABLE */ + +#if LV_USE_DROPDOWN +#define lv_dropdown_get_option_cnt lv_dropdown_get_option_count +#endif /* LV_USE_DROPDOWN */ + +#define lv_obj_get_child_cnt lv_obj_get_child_count +#define lv_obj_get_disp lv_obj_get_display +#define lv_obj_delete_anim_ready_cb lv_obj_delete_anim_completed_cb + +#define LV_STYLE_ANIM_TIME LV_STYLE_ANIM_DURATION +#define LV_STYLE_IMG_OPA LV_STYLE_IMAGE_OPA +#define LV_STYLE_IMG_RECOLOR LV_STYLE_IMAGE_RECOLOR +#define LV_STYLE_IMG_RECOLOR_OPA LV_STYLE_IMAGE_RECOLOR_OPA +#define LV_STYLE_SHADOW_OFS_X LV_STYLE_SHADOW_OFFSET_X +#define LV_STYLE_SHADOW_OFS_Y LV_STYLE_SHADOW_OFFSET_Y +#define LV_STYLE_TRANSFORM_ANGLE LV_STYLE_TRANSFORM_ROTATION + +#define lv_obj_get_style_anim_time lv_obj_get_style_anim_duration +#define lv_obj_get_style_img_opa lv_obj_get_style_image_opa +#define lv_obj_get_style_img_recolor lv_obj_get_style_image_recolor +#define lv_obj_get_style_img_recolor_filtered lv_obj_get_style_image_recolor_filtered +#define lv_obj_get_style_img_recolor_opa lv_obj_get_style_image_recolor_opa +#define lv_obj_get_style_shadow_ofs_x lv_obj_get_style_shadow_offset_x +#define lv_obj_get_style_shadow_ofs_y lv_obj_get_style_shadow_offset_y +#define lv_obj_get_style_transform_angle lv_obj_get_style_transform_rotation +#define lv_obj_get_style_bg_img_src lv_obj_get_style_bg_image_src +#define lv_obj_get_style_bg_img_recolor lv_obj_get_style_bg_image_recolor +#define lv_obj_get_style_bg_img_recolor_opa lv_obj_get_style_bg_image_recolor_opa + +#define lv_obj_set_style_anim_time lv_obj_set_style_anim_duration +#define lv_obj_set_style_img_opa lv_obj_set_style_image_opa +#define lv_obj_set_style_img_recolor lv_obj_set_style_image_recolor +#define lv_obj_set_style_img_recolor_opa lv_obj_set_style_image_recolor_opa +#define lv_obj_set_style_shadow_ofs_x lv_obj_set_style_shadow_offset_x +#define lv_obj_set_style_shadow_ofs_y lv_obj_set_style_shadow_offset_y +#define lv_obj_set_style_transform_zoom lv_obj_set_style_transform_scale +#define lv_obj_set_style_transform_angle lv_obj_set_style_transform_rotation +#define lv_obj_set_style_bg_img_src lv_obj_set_style_bg_image_src +#define lv_obj_set_style_bg_img_recolor lv_obj_set_style_bg_image_recolor +#define lv_obj_set_style_bg_img_recolor_opa lv_obj_set_style_bg_image_recolor_opa + +#define lv_style_set_anim_time lv_style_set_anim_duration +#define lv_style_set_img_opa lv_style_set_image_opa +#define lv_style_set_img_recolor lv_style_set_image_recolor +#define lv_style_set_img_recolor_opa lv_style_set_image_recolor_opa +#define lv_style_set_shadow_ofs_x lv_style_set_shadow_offset_x +#define lv_style_set_shadow_ofs_y lv_style_set_shadow_offset_y +#define lv_style_set_transform_angle lv_style_set_transform_rotation +#define lv_style_set_transform_zoom lv_style_set_transform_scale +#define lv_style_set_bg_img_src lv_style_set_bg_image_src +#define lv_style_set_bg_img_recolor lv_style_set_bg_image_recolor +#define lv_style_set_bg_img_recolor_opa lv_style_set_bg_image_recolor_opa + +#if LV_USE_KEYBOARD +#define lv_keyboard_get_selected_btn lv_keyboard_get_selected_button +#define lv_keyboard_get_btn_text lv_keyboard_get_button_text +#endif /* LV_USE_KEYBOARD */ + +#define LV_ZOOM_NONE LV_SCALE_NONE + +#define lv_image_decoder_built_in_open lv_bin_decoder_open +#define lv_image_decoder_built_in_close lv_bin_decoder_close + +/********************** + * MACROS + **********************/ +/** Use this macro to declare an image in a C file*/ +#define LV_IMG_DECLARE(var_name) extern const lv_image_dsc_t var_name; + +/********************** + * DEPRECATED FUNCTIONS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_API_MAP_V8_H*/ diff --git a/include/lvgl/api_map/lv_api_map_v9_0.h b/include/lvgl/api_map/lv_api_map_v9_0.h new file mode 100644 index 0000000000..e198ebb8a8 --- /dev/null +++ b/include/lvgl/api_map/lv_api_map_v9_0.h @@ -0,0 +1,67 @@ +/** + * @file lv_api_map_v9_0.h + * + */ + +#ifndef LV_API_MAP_V9_0_H +#define LV_API_MAP_V9_0_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ +#define lv_image_set_align lv_image_set_inner_align +#define lv_image_get_align lv_image_get_inner_align + +#ifndef LV_DRAW_LAYER_SIMPLE_BUF_SIZE +#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE +#endif + +#define lv_button_bind_checked lv_obj_bind_checked + +#define LV_DRAW_BUF_DEFINE LV_DRAW_BUF_DEFINE_STATIC + +#define _lv_utils_bsearch lv_utils_bsearch +#define lv_draw_buf_align_user lv_draw_buf_align_ex +#define lv_draw_buf_create_user lv_draw_buf_create_ex +#define lv_draw_buf_width_to_stride_user lv_draw_buf_width_to_stride_ex +#define lv_draw_buf_dup_user lv_draw_buf_dup_ex + +#define lv_draw_buf_invalidate_cache_user(handlers, drawbuf, area) lv_draw_buf_invalidate_cache(drawbuf, area) +#define lv_draw_buf_flush_cache_user(handlers, drawbuf, area) lv_draw_buf_flush_cache(drawbuf, area) +#define lv_draw_buf_destroy_user(handlers, drawbuf) lv_draw_buf_destroy(drawbuf) + +/********************** + * MACROS + **********************/ + +/********************** + * DEPRECATED FUNCTIONS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_API_MAP_V9_0_H*/ diff --git a/include/lvgl/api_map/lv_api_map_v9_1.h b/include/lvgl/api_map/lv_api_map_v9_1.h new file mode 100644 index 0000000000..5a85641886 --- /dev/null +++ b/include/lvgl/api_map/lv_api_map_v9_1.h @@ -0,0 +1,130 @@ +/** + * @file lv_api_map_v9_1.h + * + */ + +#ifndef LV_API_MAP_V9_1_H +#define LV_API_MAP_V9_1_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +/********************** + * MACROS + **********************/ + +#define _LV_EVENT_LAST LV_EVENT_LAST +#define _lv_event_code_t lv_event_code_t +#define _lv_event_mark_deleted lv_event_mark_deleted +#define lv_obj_add_event lv_obj_add_event_cb + +#define _LV_STYLE_LAST_BUILT_IN_PROP LV_STYLE_LAST_BUILT_IN_PROP +#define _LV_FLEX_REVERSE LV_FLEX_REVERSE +#define _LV_FLEX_WRAP LV_FLEX_WRAP +#define _LV_FLEX_COLUMN LV_FLEX_COLUMN + +#define _lv_area_is_equal lv_area_is_equal +#define _lv_area_is_in lv_area_is_in +#define _lv_area_intersect lv_area_intersect +#define _lv_area_is_point_on lv_area_is_point_on +#define _lv_area_join lv_area_join +#define _lv_image_buf_get_transformed_area lv_image_buf_get_transformed_area + +#define _lv_ll_init lv_ll_init +#define _lv_ll_ins_head lv_ll_ins_head +#define _lv_ll_ins_prev lv_ll_ins_prev +#define _lv_ll_ins_tail lv_ll_ins_tail +#define _lv_ll_get_head lv_ll_get_head +#define _lv_ll_get_tail lv_ll_get_tail +#define _lv_ll_get_next lv_ll_get_next +#define _lv_ll_get_prev lv_ll_get_prev +#define _lv_ll_get_len lv_ll_get_len +#define _lv_ll_move_before lv_ll_move_before +#define _lv_ll_is_empty lv_ll_is_empty +#define _lv_ll_clear lv_ll_clear +#define _lv_ll_remove lv_ll_remove +#define _lv_ll_chg_list lv_ll_chg_list +#define _LV_LL_READ LV_LL_READ +#define _LV_LL_READ_BACK LV_LL_READ_BACK + +#define _lv_obj_scroll_by_raw lv_obj_scroll_by_raw +#define _lv_obj_get_ext_draw_size lv_obj_get_ext_draw_size +#define _lv_indev_scroll_handler lv_indev_scroll_handler + +#define _lv_display_refr_timer lv_disp_refr_timer +#define _lv_disp_refr_timer lv_disp_refr_timer +#define _lv_disp_get_refr_timer lv_disp_get_refr_timer + +#define lv_obj_get_child_by_id lv_obj_find_by_id +#define lv_obj_update_flag lv_obj_set_flag + +#define _lv_inv_area lv_inv_area +#define lv_chart_set_all_value lv_chart_set_all_values +#define lv_calendar_set_showed_date lv_calendar_set_month_shown +#define lv_chart_set_range lv_chart_set_axis_range +#define lv_chart_set_value_by_id lv_chart_set_series_value_by_id +#define lv_chart_get_x_array lv_chart_get_series_x_array +#define lv_chart_get_y_array lv_chart_get_series_y_array +#define lv_chart_set_ext_x_array lv_chart_set_series_ext_x_array +#define lv_chart_set_ext_y_array lv_chart_set_series_ext_y_array + +#if defined(LV_FS_DEFAULT_DRIVE_LETTER) +#warning LV_FS_DEFAULT_DRIVE_LETTER is deprecated. Rename to LV_FS_DEFAULT_DRIVER_LETTER + +#if LV_FS_DEFAULT_DRIVER_LETTER == '\0' +#undef LV_FS_DEFAULT_DRIVER_LETTER +#define LV_FS_DEFAULT_DRIVER_LETTER LV_FS_DEFAULT_DRIVE_LETTER +#endif + +#endif /* defined(LV_FS_DEFAULT_DRIVE_LETTER) */ + +#define LV_LABEL_LONG_WRAP LV_LABEL_LONG_MODE_WRAP +#define LV_LABEL_LONG_DOT LV_LABEL_LONG_MODE_DOTS +#define LV_LABEL_LONG_SCROLL LV_LABEL_LONG_MODE_SCROLL +#define LV_LABEL_LONG_SCROLL_CIRCULAR LV_LABEL_LONG_MODE_SCROLL_CIRCULAR +#define LV_LABEL_LONG_CLIP LV_LABEL_LONG_MODE_CLIP + +#define lv_anim_set_time lv_anim_set_duration +#define lv_anim_set_playback_time lv_anim_set_reverse_duration +#define lv_anim_set_playback_delay lv_anim_set_reverse_delay +#define lv_anim_set_playback_duration lv_anim_set_reverse_duration + +#define lv_gradient_init_stops lv_grad_init_stops +#define lv_gradient_stop_t lv_grad_stop_t + +#define lv_spangroup_new_span lv_spangroup_add_span +#define lv_spangroup_refr_mode lv_spangroup_refresh + +#define lv_slider_set_left_value lv_slider_set_start_value + +#define lv_calendar_header_arrow_create lv_calendar_add_header_arrow +#define lv_calendar_header_dropdown_create lv_calendar_add_header_dropdown + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_API_MAP_V9_1_H */ diff --git a/include/lvgl/api_map/lv_api_map_v9_2.h b/include/lvgl/api_map/lv_api_map_v9_2.h new file mode 100644 index 0000000000..e709251311 --- /dev/null +++ b/include/lvgl/api_map/lv_api_map_v9_2.h @@ -0,0 +1,58 @@ +/** + * @file lv_api_map_v9_2.h + * + */ + +#ifndef LV_API_MAP_V9_2_H +#define LV_API_MAP_V9_2_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#define LV_SCR_LOAD_ANIM_NONE LV_SCREEN_LOAD_ANIM_NONE +#define LV_SCR_LOAD_ANIM_OVER_LEFT LV_SCREEN_LOAD_ANIM_OVER_LEFT +#define LV_SCR_LOAD_ANIM_OVER_RIGHT LV_SCREEN_LOAD_ANIM_OVER_RIGHT +#define LV_SCR_LOAD_ANIM_OVER_TOP LV_SCREEN_LOAD_ANIM_OVER_TOP +#define LV_SCR_LOAD_ANIM_OVER_BOTTOM LV_SCREEN_LOAD_ANIM_OVER_BOTTOM +#define LV_SCR_LOAD_ANIM_MOVE_LEFT LV_SCREEN_LOAD_ANIM_MOVE_LEFT +#define LV_SCR_LOAD_ANIM_MOVE_RIGHT LV_SCREEN_LOAD_ANIM_MOVE_RIGHT +#define LV_SCR_LOAD_ANIM_MOVE_TOP LV_SCREEN_LOAD_ANIM_MOVE_TOP +#define LV_SCR_LOAD_ANIM_MOVE_BOTTOM LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM +#define LV_SCR_LOAD_ANIM_FADE_IN LV_SCREEN_LOAD_ANIM_FADE_IN +#define LV_SCR_LOAD_ANIM_FADE_ON LV_SCREEN_LOAD_ANIM_FADE_ON +#define LV_SCR_LOAD_ANIM_FADE_OUT LV_SCREEN_LOAD_ANIM_FADE_OUT +#define LV_SCR_LOAD_ANIM_OUT_LEFT LV_SCREEN_LOAD_ANIM_OUT_LEFT +#define LV_SCR_LOAD_ANIM_OUT_RIGHT LV_SCREEN_LOAD_ANIM_OUT_RIGHT +#define LV_SCR_LOAD_ANIM_OUT_TOP LV_SCREEN_LOAD_ANIM_OUT_TOP +#define LV_SCR_LOAD_ANIM_OUT_BOTTOM LV_SCREEN_LOAD_ANIM_OUT_BOTTOM + +#define lv_ft81x_spi_operation lv_ft81x_spi_operation_t + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_API_MAP_V9_2_H */ diff --git a/include/lvgl/api_map/lv_api_map_v9_3.h b/include/lvgl/api_map/lv_api_map_v9_3.h new file mode 100644 index 0000000000..dc024896ae --- /dev/null +++ b/include/lvgl/api_map/lv_api_map_v9_3.h @@ -0,0 +1,98 @@ +/** + * @file lv_api_map_v9_3.h + * + */ + +#ifndef LV_API_MAP_V9_3_H +#define LV_API_MAP_V9_3_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#define lv_draw_buf_malloc_cb lv_draw_buf_malloc_cb_t +#define lv_draw_buf_free_cb lv_draw_buf_free_cb_t +#define lv_draw_buf_copy_cb lv_draw_buf_copy_cb_t +#define lv_draw_buf_align_cb lv_draw_buf_align_cb_t +#define lv_draw_buf_cache_operation_cb lv_draw_buf_cache_operation_cb_t +#define lv_draw_buf_width_to_stride_cb lv_draw_buf_width_to_stride_cb_t + +#define lv_glfw_window_t lv_opengles_window_t +#define lv_glfw_texture_t lv_opengles_window_texture_t +#define lv_glfw_window_create lv_opengles_glfw_window_create +#define lv_glfw_window_create_ex lv_opengles_glfw_window_create_ex +#define lv_glfw_window_set_title lv_opengles_glfw_window_set_title +#define lv_glfw_window_delete lv_opengles_window_delete +#define lv_glfw_window_set_flip lv_opengles_glfw_window_set_flip +#define lv_glfw_window_add_texture lv_opengles_window_add_texture +#define lv_glfw_texture_remove lv_opengles_window_texture_remove +#define lv_glfw_texture_set_x lv_opengles_window_texture_set_x +#define lv_glfw_texture_set_y lv_opengles_window_texture_set_y +#define lv_glfw_texture_set_opa lv_opengles_window_texture_set_opa +#define lv_glfw_texture_get_mouse_indev lv_opengles_window_texture_get_mouse_indev +#define lv_glfw_window_get_glfw_window lv_opengles_glfw_window_get_glfw_window + +#define lv_vector_dsc_create lv_draw_vector_dsc_create +#define lv_vector_dsc_delete lv_draw_vector_dsc_delete +#define lv_vector_dsc_set_transform lv_draw_vector_dsc_set_transform +#define lv_vector_dsc_set_blend_mode lv_draw_vector_dsc_set_blend_mode +#define lv_vector_dsc_set_fill_color32 lv_draw_vector_dsc_set_fill_color32 +#define lv_vector_dsc_set_fill_color lv_draw_vector_dsc_set_fill_color +#define lv_vector_dsc_set_fill_opa lv_draw_vector_dsc_set_fill_opa +#define lv_vector_dsc_set_fill_rule lv_draw_vector_dsc_set_fill_rule +#define lv_vector_dsc_set_fill_units lv_draw_vector_dsc_set_fill_units +#define lv_vector_dsc_set_fill_image lv_draw_vector_dsc_set_fill_image +#define lv_vector_dsc_set_fill_linear_gradient lv_draw_vector_dsc_set_fill_linear_gradient +#define lv_vector_dsc_set_fill_radial_gradient lv_draw_vector_dsc_set_fill_radial_gradient +#define lv_vector_dsc_set_fill_gradient_spread lv_draw_vector_dsc_set_fill_gradient_spread +#define lv_vector_dsc_set_fill_gradient_color_stops lv_draw_vector_dsc_set_fill_gradient_color_stops +#define lv_vector_dsc_set_fill_transform lv_draw_vector_dsc_set_fill_transform +#define lv_vector_dsc_set_stroke_color32 lv_draw_vector_dsc_set_stroke_color32 +#define lv_vector_dsc_set_stroke_color lv_draw_vector_dsc_set_stroke_color +#define lv_vector_dsc_set_stroke_opa lv_draw_vector_dsc_set_stroke_opa +#define lv_vector_dsc_set_stroke_width lv_draw_vector_dsc_set_stroke_width +#define lv_vector_dsc_set_stroke_dash lv_draw_vector_dsc_set_stroke_dash +#define lv_vector_dsc_set_stroke_cap lv_draw_vector_dsc_set_stroke_cap +#define lv_vector_dsc_set_stroke_join lv_draw_vector_dsc_set_stroke_join +#define lv_vector_dsc_set_stroke_miter_limit lv_draw_vector_dsc_set_stroke_miter_limit +#define lv_vector_dsc_set_stroke_linear_gradient lv_draw_vector_dsc_set_stroke_linear_gradient +#define lv_vector_dsc_set_stroke_radial_gradient lv_draw_vector_dsc_set_stroke_radial_gradient +#define lv_vector_dsc_set_stroke_gradient_spread lv_draw_vector_dsc_set_stroke_gradient_spread +#define lv_vector_dsc_set_stroke_gradient_color_stops lv_draw_vector_dsc_set_stroke_gradient_color_stops +#define lv_vector_dsc_set_stroke_transform lv_draw_vector_dsc_set_stroke_transform +#define lv_vector_dsc_identity lv_draw_vector_dsc_identity +#define lv_vector_dsc_scale lv_draw_vector_dsc_scale +#define lv_vector_dsc_rotate lv_draw_vector_dsc_rotate +#define lv_vector_dsc_translate lv_draw_vector_dsc_translate +#define lv_vector_dsc_skew lv_draw_vector_dsc_skew +#define lv_vector_dsc_add_path lv_draw_vector_dsc_add_path +#define lv_vector_dsc_clear_area lv_draw_vector_dsc_clear_area + + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_API_MAP_V9_3_H */ diff --git a/include/lvgl/api_map/lv_api_map_v9_4.h b/include/lvgl/api_map/lv_api_map_v9_4.h new file mode 100644 index 0000000000..031012dc0b --- /dev/null +++ b/include/lvgl/api_map/lv_api_map_v9_4.h @@ -0,0 +1,41 @@ +/** + * @file lv_api_map_v9_4.h + * + */ + +#ifndef LV_API_MAP_V9_4_H +#define LV_API_MAP_V9_4_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#define lv_tabview_rename_tab lv_tabview_set_tab_text +#define lv_wayland_timer_handler lv_timer_handler +#define lv_wayland_display_close_f_t lv_wayland_display_close_cb_t + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_API_MAP_V9_4_H */ diff --git a/src/draw/lv_draw_rect_private.h b/include/lvgl/api_map/lv_api_map_v9_5.h similarity index 72% rename from src/draw/lv_draw_rect_private.h rename to include/lvgl/api_map/lv_api_map_v9_5.h index ad75b53552..1c804578c8 100644 --- a/src/draw/lv_draw_rect_private.h +++ b/include/lvgl/api_map/lv_api_map_v9_5.h @@ -1,10 +1,10 @@ /** - * @file lv_draw_rect_private.h + * @file lv_api_map_v9_5.h * */ -#ifndef LV_DRAW_RECT_PRIVATE_H -#define LV_DRAW_RECT_PRIVATE_H +#ifndef LV_API_MAP_V9_5_H +#define LV_API_MAP_V9_5_H #ifdef __cplusplus extern "C" { @@ -14,8 +14,6 @@ extern "C" { * INCLUDES *********************/ -#include "lv_draw_rect.h" - /********************* * DEFINES *********************/ @@ -32,8 +30,10 @@ extern "C" { * MACROS **********************/ +#define lv_display_delete_event lv_display_remove_event + #ifdef __cplusplus } /*extern "C"*/ #endif -#endif /*LV_DRAW_RECT_PRIVATE_H*/ +#endif /* LV_API_MAP_V9_5_H */ diff --git a/include/lvgl/config/lv_conf_internal.h b/include/lvgl/config/lv_conf_internal.h new file mode 100644 index 0000000000..aa91a00472 --- /dev/null +++ b/include/lvgl/config/lv_conf_internal.h @@ -0,0 +1,5029 @@ +/** + * GENERATED FILE, DO NOT EDIT IT! + * @file lv_conf_internal.h + * This file ensures all defines of lv_conf.h have a default value. + */ + +#ifndef LV_CONF_INTERNAL_H +#define LV_CONF_INTERNAL_H +/* clang-format off */ + +/* Config options */ +#define LV_OS_NONE 0 +#define LV_OS_PTHREAD 1 +#define LV_OS_FREERTOS 2 +#define LV_OS_CMSIS_RTOS2 3 +#define LV_OS_RTTHREAD 4 +#define LV_OS_WINDOWS 5 +#define LV_OS_MQX 6 +#define LV_OS_SDL2 7 +#define LV_OS_CUSTOM 255 + +#define LV_STDLIB_BUILTIN 0 +#define LV_STDLIB_CLIB 1 +#define LV_STDLIB_MICROPYTHON 2 +#define LV_STDLIB_RTTHREAD 3 +#define LV_STDLIB_CUSTOM 255 + +#define LV_DRAW_SW_ASM_NONE 0 +#define LV_DRAW_SW_ASM_NEON 1 +#define LV_DRAW_SW_ASM_HELIUM 2 +#define LV_DRAW_SW_ASM_RISCV_V 3 +#define LV_DRAW_SW_ASM_CUSTOM 255 + +#define LV_NEMA_LIB_NONE 0 +#define LV_NEMA_LIB_M33_REVC 1 +#define LV_NEMA_LIB_M33_NEMAPVG 2 +#define LV_NEMA_LIB_M55 3 +#define LV_NEMA_LIB_M7 4 + +#define LV_NEMA_HAL_CUSTOM 0 +#define LV_NEMA_HAL_STM32 1 + +#define LV_NANOVG_BACKEND_GL2 1 +#define LV_NANOVG_BACKEND_GL3 2 +#define LV_NANOVG_BACKEND_GLES2 3 +#define LV_NANOVG_BACKEND_GLES3 4 + +/** Handle special Kconfig options. */ +#ifndef LV_KCONFIG_IGNORE + #include "lv_conf_kconfig.h" + #if defined(CONFIG_LV_CONF_SKIP) && !defined(LV_CONF_SKIP) + #define LV_CONF_SKIP + #endif +#endif + +/* If "lv_conf.h" is available from here try to use it later. */ +#ifdef __has_include + #if __has_include("lv_conf.h") + #ifndef LV_CONF_INCLUDE_SIMPLE + #define LV_CONF_INCLUDE_SIMPLE + #endif + #endif +#endif + +/* If lv_conf.h is not skipped, include it. */ +#if !defined(LV_CONF_SKIP) || defined(LV_CONF_PATH) + #ifdef LV_CONF_PATH /* If there is a path defined for lv_conf.h, use it */ + #include LV_CONF_PATH /* Note: Make sure to define custom CONF_PATH as a string */ + #elif defined(LV_CONF_INCLUDE_SIMPLE) /* Or simply include lv_conf.h is enabled. */ + #include "lv_conf.h" + #else + #include "../../lv_conf.h" /* Else assume lv_conf.h is next to the lvgl folder. */ + #endif + #if !defined(LV_CONF_H) && !defined(LV_CONF_SUPPRESS_DEFINE_CHECK) + /* #include will sometimes silently fail when __has_include is used */ + /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80753 */ + #pragma message("Possible failure to include lv_conf.h, please read the comment in this file if you get errors") + #endif +#endif + +#ifdef CONFIG_LV_COLOR_DEPTH + #define LV_KCONFIG_PRESENT +#endif + +/*---------------------------------- + * Start parsing lv_conf_template.h + -----------------------------------*/ + +/* If you need to include anything here, do it inside the `__ASSEMBLY__` guard */ +#if 0 && defined(__ASSEMBLY__) +#include "my_include.h" +#endif + +/*==================== + COLOR SETTINGS + *====================*/ + +/** Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888) */ +#ifndef LV_COLOR_DEPTH + #ifdef CONFIG_LV_COLOR_DEPTH + #define LV_COLOR_DEPTH CONFIG_LV_COLOR_DEPTH + #else + #define LV_COLOR_DEPTH 16 + #endif +#endif + +/*========================= + STDLIB WRAPPER SETTINGS + *=========================*/ + +/** Possible values + * - LV_STDLIB_BUILTIN: LVGL's built in implementation + * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc + * - LV_STDLIB_MICROPYTHON: MicroPython implementation + * - LV_STDLIB_RTTHREAD: RT-Thread implementation + * - LV_STDLIB_CUSTOM: Implement the functions externally + */ +#ifndef LV_USE_STDLIB_MALLOC + #ifdef CONFIG_LV_USE_STDLIB_MALLOC + #define LV_USE_STDLIB_MALLOC CONFIG_LV_USE_STDLIB_MALLOC + #else + #define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN + #endif +#endif + +/** Possible values + * - LV_STDLIB_BUILTIN: LVGL's built in implementation + * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc + * - LV_STDLIB_MICROPYTHON: MicroPython implementation + * - LV_STDLIB_RTTHREAD: RT-Thread implementation + * - LV_STDLIB_CUSTOM: Implement the functions externally + */ +#ifndef LV_USE_STDLIB_STRING + #ifdef CONFIG_LV_USE_STDLIB_STRING + #define LV_USE_STDLIB_STRING CONFIG_LV_USE_STDLIB_STRING + #else + #define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN + #endif +#endif + +/** Possible values + * - LV_STDLIB_BUILTIN: LVGL's built in implementation + * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc + * - LV_STDLIB_MICROPYTHON: MicroPython implementation + * - LV_STDLIB_RTTHREAD: RT-Thread implementation + * - LV_STDLIB_CUSTOM: Implement the functions externally + */ +#ifndef LV_USE_STDLIB_SPRINTF + #ifdef CONFIG_LV_USE_STDLIB_SPRINTF + #define LV_USE_STDLIB_SPRINTF CONFIG_LV_USE_STDLIB_SPRINTF + #else + #define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN + #endif +#endif + +#ifndef LV_STDINT_INCLUDE + #ifdef CONFIG_LV_STDINT_INCLUDE + #define LV_STDINT_INCLUDE CONFIG_LV_STDINT_INCLUDE + #else + #define LV_STDINT_INCLUDE + #endif +#endif +#ifndef LV_STDDEF_INCLUDE + #ifdef CONFIG_LV_STDDEF_INCLUDE + #define LV_STDDEF_INCLUDE CONFIG_LV_STDDEF_INCLUDE + #else + #define LV_STDDEF_INCLUDE + #endif +#endif +#ifndef LV_STDBOOL_INCLUDE + #ifdef CONFIG_LV_STDBOOL_INCLUDE + #define LV_STDBOOL_INCLUDE CONFIG_LV_STDBOOL_INCLUDE + #else + #define LV_STDBOOL_INCLUDE + #endif +#endif +#ifndef LV_INTTYPES_INCLUDE + #ifdef CONFIG_LV_INTTYPES_INCLUDE + #define LV_INTTYPES_INCLUDE CONFIG_LV_INTTYPES_INCLUDE + #else + #define LV_INTTYPES_INCLUDE + #endif +#endif +#ifndef LV_LIMITS_INCLUDE + #ifdef CONFIG_LV_LIMITS_INCLUDE + #define LV_LIMITS_INCLUDE CONFIG_LV_LIMITS_INCLUDE + #else + #define LV_LIMITS_INCLUDE + #endif +#endif +#ifndef LV_STDARG_INCLUDE + #ifdef CONFIG_LV_STDARG_INCLUDE + #define LV_STDARG_INCLUDE CONFIG_LV_STDARG_INCLUDE + #else + #define LV_STDARG_INCLUDE + #endif +#endif + +#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN + /** Size of memory available for `lv_malloc()` in bytes (>= 2kB) */ + #ifndef LV_MEM_SIZE + #ifdef CONFIG_LV_MEM_SIZE + #define LV_MEM_SIZE CONFIG_LV_MEM_SIZE + #else + #define LV_MEM_SIZE (64 * 1024U) /**< [bytes] */ + #endif + #endif + + /** Size of the memory expand for `lv_malloc()` in bytes */ + #ifndef LV_MEM_POOL_EXPAND_SIZE + #ifdef CONFIG_LV_MEM_POOL_EXPAND_SIZE + #define LV_MEM_POOL_EXPAND_SIZE CONFIG_LV_MEM_POOL_EXPAND_SIZE + #else + #define LV_MEM_POOL_EXPAND_SIZE 0 + #endif + #endif + + /** Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too. */ + #ifndef LV_MEM_ADR + #ifdef CONFIG_LV_MEM_ADR + #define LV_MEM_ADR CONFIG_LV_MEM_ADR + #else + #define LV_MEM_ADR 0 /**< 0: unused*/ + #endif + #endif + /* Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc */ + #if LV_MEM_ADR == 0 + #ifndef LV_MEM_POOL_INCLUDE + #ifdef CONFIG_LV_MEM_POOL_INCLUDE + #define LV_MEM_POOL_INCLUDE CONFIG_LV_MEM_POOL_INCLUDE + #else + #undef LV_MEM_POOL_INCLUDE + #endif + #endif + #ifndef LV_MEM_POOL_ALLOC + #ifdef CONFIG_LV_MEM_POOL_ALLOC + #define LV_MEM_POOL_ALLOC CONFIG_LV_MEM_POOL_ALLOC + #else + #undef LV_MEM_POOL_ALLOC + #endif + #endif + #endif +#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/ + +/*==================== + HAL SETTINGS + *====================*/ + +/** Default display refresh, input device read and animation step period. */ +#ifndef LV_DEF_REFR_PERIOD + #ifdef CONFIG_LV_DEF_REFR_PERIOD + #define LV_DEF_REFR_PERIOD CONFIG_LV_DEF_REFR_PERIOD + #else + #define LV_DEF_REFR_PERIOD 33 /**< [ms] */ + #endif +#endif + +/** Default Dots Per Inch. Used to initialize default sizes such as widgets sized, style paddings. + * (Not so important, you can adjust it to modify default sizes and spaces.) */ +#ifndef LV_DPI_DEF + #ifdef CONFIG_LV_DPI_DEF + #define LV_DPI_DEF CONFIG_LV_DPI_DEF + #else + #define LV_DPI_DEF 130 /**< [px/inch] */ + #endif +#endif + +/*================= + * OPERATING SYSTEM + *=================*/ +/** Select operating system to use. Possible options: + * - LV_OS_NONE + * - LV_OS_PTHREAD + * - LV_OS_FREERTOS + * - LV_OS_CMSIS_RTOS2 + * - LV_OS_RTTHREAD + * - LV_OS_WINDOWS + * - LV_OS_MQX + * - LV_OS_SDL2 + * - LV_OS_CUSTOM */ +#ifndef LV_USE_OS + #ifdef CONFIG_LV_USE_OS + #define LV_USE_OS CONFIG_LV_USE_OS + #else + #define LV_USE_OS LV_OS_NONE + #endif +#endif + +#if LV_USE_OS == LV_OS_CUSTOM + #ifndef LV_OS_CUSTOM_INCLUDE + #ifdef CONFIG_LV_OS_CUSTOM_INCLUDE + #define LV_OS_CUSTOM_INCLUDE CONFIG_LV_OS_CUSTOM_INCLUDE + #else + #define LV_OS_CUSTOM_INCLUDE + #endif + #endif +#endif +#if LV_USE_OS == LV_OS_FREERTOS + /* + * Unblocking an RTOS task with a direct notification is 45% faster and uses less RAM + * than unblocking a task using an intermediary object such as a binary semaphore. + * RTOS task notifications can only be used when there is only one task that can be the recipient of the event. + */ + #ifndef LV_USE_FREERTOS_TASK_NOTIFY + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_FREERTOS_TASK_NOTIFY + #define LV_USE_FREERTOS_TASK_NOTIFY CONFIG_LV_USE_FREERTOS_TASK_NOTIFY + #else + #define LV_USE_FREERTOS_TASK_NOTIFY 0 + #endif + #else + #define LV_USE_FREERTOS_TASK_NOTIFY 1 + #endif + #endif + + /* Enable this to provide a custom implementation of lv_os_get_idle_percent. */ + #ifndef LV_OS_IDLE_PERCENT_CUSTOM + #ifdef CONFIG_LV_OS_IDLE_PERCENT_CUSTOM + #define LV_OS_IDLE_PERCENT_CUSTOM CONFIG_LV_OS_IDLE_PERCENT_CUSTOM + #else + #define LV_OS_IDLE_PERCENT_CUSTOM 0 + #endif + #endif +#endif + +/*======================== + * RENDERING CONFIGURATION + *========================*/ + +/** Align stride of all layers and images to this bytes */ +#ifndef LV_DRAW_BUF_STRIDE_ALIGN + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_BUF_STRIDE_ALIGN + #define LV_DRAW_BUF_STRIDE_ALIGN CONFIG_LV_DRAW_BUF_STRIDE_ALIGN + #else + #define LV_DRAW_BUF_STRIDE_ALIGN 0 + #endif + #else + #define LV_DRAW_BUF_STRIDE_ALIGN 1 + #endif +#endif + +/** Align start address of draw_buf addresses to this bytes*/ +#ifndef LV_DRAW_BUF_ALIGN + #ifdef CONFIG_LV_DRAW_BUF_ALIGN + #define LV_DRAW_BUF_ALIGN CONFIG_LV_DRAW_BUF_ALIGN + #else + #define LV_DRAW_BUF_ALIGN 4 + #endif +#endif + +/** Using matrix for transformations. + * Requirements: + * - `LV_USE_MATRIX = 1`. + * - Rendering engine needs to support 3x3 matrix transformations. */ +#ifndef LV_DRAW_TRANSFORM_USE_MATRIX + #ifdef CONFIG_LV_DRAW_TRANSFORM_USE_MATRIX + #define LV_DRAW_TRANSFORM_USE_MATRIX CONFIG_LV_DRAW_TRANSFORM_USE_MATRIX + #else + #define LV_DRAW_TRANSFORM_USE_MATRIX 0 + #endif +#endif + +/* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode + * it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks. + * "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers + * and can't be drawn in chunks. */ + +/** The target buffer size for simple layer chunks. */ +#ifndef LV_DRAW_LAYER_SIMPLE_BUF_SIZE + #ifdef CONFIG_LV_DRAW_LAYER_SIMPLE_BUF_SIZE + #define LV_DRAW_LAYER_SIMPLE_BUF_SIZE CONFIG_LV_DRAW_LAYER_SIMPLE_BUF_SIZE + #else + #define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /**< [bytes]*/ + #endif +#endif + +/* Limit the max allocated memory for simple and transformed layers. + * It should be at least `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` sized but if transformed layers are also used + * it should be enough to store the largest widget too (width x height x 4 area). + * Set it to 0 to have no limit. */ +#ifndef LV_DRAW_LAYER_MAX_MEMORY + #ifdef CONFIG_LV_DRAW_LAYER_MAX_MEMORY + #define LV_DRAW_LAYER_MAX_MEMORY CONFIG_LV_DRAW_LAYER_MAX_MEMORY + #else + #define LV_DRAW_LAYER_MAX_MEMORY 0 /**< No limit by default [bytes]*/ + #endif +#endif + +/** Stack size of drawing thread. + * NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more. + */ +#ifndef LV_DRAW_THREAD_STACK_SIZE + #ifdef CONFIG_LV_DRAW_THREAD_STACK_SIZE + #define LV_DRAW_THREAD_STACK_SIZE CONFIG_LV_DRAW_THREAD_STACK_SIZE + #else + #define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /**< [bytes]*/ + #endif +#endif + +/** Thread priority of the drawing task. + * Higher values mean higher priority. + * Can use values from lv_thread_prio_t enum in lv_os.h: LV_THREAD_PRIO_LOWEST, + * LV_THREAD_PRIO_LOW, LV_THREAD_PRIO_MID, LV_THREAD_PRIO_HIGH, LV_THREAD_PRIO_HIGHEST + * Make sure the priority value aligns with the OS-specific priority levels. + * On systems with limited priority levels (e.g., FreeRTOS), a higher value can improve + * rendering performance but might cause other tasks to starve. */ +#ifndef LV_DRAW_THREAD_PRIO + #ifdef CONFIG_LV_DRAW_THREAD_PRIO + #define LV_DRAW_THREAD_PRIO CONFIG_LV_DRAW_THREAD_PRIO + #else + #define LV_DRAW_THREAD_PRIO LV_THREAD_PRIO_HIGH + #endif +#endif + +#ifndef LV_USE_DRAW_SW + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_DRAW_SW + #define LV_USE_DRAW_SW CONFIG_LV_USE_DRAW_SW + #else + #define LV_USE_DRAW_SW 0 + #endif + #else + #define LV_USE_DRAW_SW 1 + #endif +#endif +#if LV_USE_DRAW_SW == 1 + /* + * Selectively disable color format support in order to reduce code size. + * NOTE: some features use certain color formats internally, e.g. + * - gradients use RGB888 + * - bitmaps with transparency may use ARGB8888 + */ + #ifndef LV_DRAW_SW_SUPPORT_RGB565 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565 + #define LV_DRAW_SW_SUPPORT_RGB565 CONFIG_LV_DRAW_SW_SUPPORT_RGB565 + #else + #define LV_DRAW_SW_SUPPORT_RGB565 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_RGB565 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_RGB565_SWAPPED + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565_SWAPPED + #define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED CONFIG_LV_DRAW_SW_SUPPORT_RGB565_SWAPPED + #else + #define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_RGB565A8 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8 + #define LV_DRAW_SW_SUPPORT_RGB565A8 CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8 + #else + #define LV_DRAW_SW_SUPPORT_RGB565A8 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_RGB565A8 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_RGB888 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB888 + #define LV_DRAW_SW_SUPPORT_RGB888 CONFIG_LV_DRAW_SW_SUPPORT_RGB888 + #else + #define LV_DRAW_SW_SUPPORT_RGB888 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_RGB888 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_XRGB8888 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888 + #define LV_DRAW_SW_SUPPORT_XRGB8888 CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888 + #else + #define LV_DRAW_SW_SUPPORT_XRGB8888 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_XRGB8888 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_ARGB8888 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888 + #define LV_DRAW_SW_SUPPORT_ARGB8888 CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888 + #else + #define LV_DRAW_SW_SUPPORT_ARGB8888 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_ARGB8888 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED + #define LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED + #else + #define LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_L8 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_L8 + #define LV_DRAW_SW_SUPPORT_L8 CONFIG_LV_DRAW_SW_SUPPORT_L8 + #else + #define LV_DRAW_SW_SUPPORT_L8 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_L8 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_AL88 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_AL88 + #define LV_DRAW_SW_SUPPORT_AL88 CONFIG_LV_DRAW_SW_SUPPORT_AL88 + #else + #define LV_DRAW_SW_SUPPORT_AL88 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_AL88 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_A8 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_A8 + #define LV_DRAW_SW_SUPPORT_A8 CONFIG_LV_DRAW_SW_SUPPORT_A8 + #else + #define LV_DRAW_SW_SUPPORT_A8 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_A8 1 + #endif + #endif + #ifndef LV_DRAW_SW_SUPPORT_I1 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_SUPPORT_I1 + #define LV_DRAW_SW_SUPPORT_I1 CONFIG_LV_DRAW_SW_SUPPORT_I1 + #else + #define LV_DRAW_SW_SUPPORT_I1 0 + #endif + #else + #define LV_DRAW_SW_SUPPORT_I1 1 + #endif + #endif + + /* The threshold of the luminance to consider a pixel as + * active in indexed color format */ + #ifndef LV_DRAW_SW_I1_LUM_THRESHOLD + #ifdef CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD + #define LV_DRAW_SW_I1_LUM_THRESHOLD CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD + #else + #define LV_DRAW_SW_I1_LUM_THRESHOLD 127 + #endif + #endif + + /** Set number of draw units. + * - > 1 requires operating system to be enabled in `LV_USE_OS`. + * - > 1 means multiple threads will render the screen in parallel. */ + #ifndef LV_DRAW_SW_DRAW_UNIT_CNT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT + #define LV_DRAW_SW_DRAW_UNIT_CNT CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT + #else + #define LV_DRAW_SW_DRAW_UNIT_CNT 0 + #endif + #else + #define LV_DRAW_SW_DRAW_UNIT_CNT 1 + #endif + #endif + + /** Use Arm-2D to accelerate software (sw) rendering. */ + #ifndef LV_USE_DRAW_ARM2D_SYNC + #ifdef CONFIG_LV_USE_DRAW_ARM2D_SYNC + #define LV_USE_DRAW_ARM2D_SYNC CONFIG_LV_USE_DRAW_ARM2D_SYNC + #else + #define LV_USE_DRAW_ARM2D_SYNC 0 + #endif + #endif + + /** Enable native helium assembly to be compiled. */ + #ifndef LV_USE_NATIVE_HELIUM_ASM + #ifdef CONFIG_LV_USE_NATIVE_HELIUM_ASM + #define LV_USE_NATIVE_HELIUM_ASM CONFIG_LV_USE_NATIVE_HELIUM_ASM + #else + #define LV_USE_NATIVE_HELIUM_ASM 0 + #endif + #endif + + /** + * - 0: Use a simple renderer capable of drawing only simple rectangles with gradient, images, text, and straight lines only. + * - 1: Use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too. */ + #ifndef LV_DRAW_SW_COMPLEX + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_DRAW_SW_COMPLEX + #define LV_DRAW_SW_COMPLEX CONFIG_LV_DRAW_SW_COMPLEX + #else + #define LV_DRAW_SW_COMPLEX 0 + #endif + #else + #define LV_DRAW_SW_COMPLEX 1 + #endif + #endif + + #if LV_DRAW_SW_COMPLEX == 1 + /** Allow buffering some shadow calculation. + * LV_DRAW_SW_SHADOW_CACHE_SIZE is the maximum shadow size to buffer, where shadow size is + * `shadow_width + radius`. Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost. */ + #ifndef LV_DRAW_SW_SHADOW_CACHE_SIZE + #ifdef CONFIG_LV_DRAW_SW_SHADOW_CACHE_SIZE + #define LV_DRAW_SW_SHADOW_CACHE_SIZE CONFIG_LV_DRAW_SW_SHADOW_CACHE_SIZE + #else + #define LV_DRAW_SW_SHADOW_CACHE_SIZE 0 + #endif + #endif + + /** Set number of maximally-cached circle data. + * The circumference of 1/4 circle are saved for anti-aliasing. + * `radius * 4` bytes are used per circle (the most often used radiuses are saved). + * - 0: disables caching */ + #ifndef LV_DRAW_SW_CIRCLE_CACHE_SIZE + #ifdef CONFIG_LV_DRAW_SW_CIRCLE_CACHE_SIZE + #define LV_DRAW_SW_CIRCLE_CACHE_SIZE CONFIG_LV_DRAW_SW_CIRCLE_CACHE_SIZE + #else + #define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4 + #endif + #endif + #endif + + #ifndef LV_USE_DRAW_SW_ASM + #ifdef CONFIG_LV_USE_DRAW_SW_ASM + #define LV_USE_DRAW_SW_ASM CONFIG_LV_USE_DRAW_SW_ASM + #else + #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE + #endif + #endif + + #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM + #ifndef LV_DRAW_SW_ASM_CUSTOM_INCLUDE + #ifdef CONFIG_LV_DRAW_SW_ASM_CUSTOM_INCLUDE + #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE CONFIG_LV_DRAW_SW_ASM_CUSTOM_INCLUDE + #else + #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE "" + #endif + #endif + #endif + + /** Enable drawing complex gradients in software: linear at an angle, radial or conical */ + #ifndef LV_USE_DRAW_SW_COMPLEX_GRADIENTS + #ifdef CONFIG_LV_USE_DRAW_SW_COMPLEX_GRADIENTS + #define LV_USE_DRAW_SW_COMPLEX_GRADIENTS CONFIG_LV_USE_DRAW_SW_COMPLEX_GRADIENTS + #else + #define LV_USE_DRAW_SW_COMPLEX_GRADIENTS 0 + #endif + #endif + +#endif + +/*Use TSi's aka (Think Silicon) NemaGFX */ +#ifndef LV_USE_NEMA_GFX + #ifdef CONFIG_LV_USE_NEMA_GFX + #define LV_USE_NEMA_GFX CONFIG_LV_USE_NEMA_GFX + #else + #define LV_USE_NEMA_GFX 0 + #endif +#endif + +#if LV_USE_NEMA_GFX + /** Select which NemaGFX static library headers to use. Possible options: + * - LV_NEMA_LIB_NONE an alias of LV_NEMA_LIB_M33_REVC + * - LV_NEMA_LIB_M33_REVC + * - LV_NEMA_LIB_M33_NEMAPVG + * - LV_NEMA_LIB_M55 + * - LV_NEMA_LIB_M7 + * You must also take care to link the correct corresponding static library + * in libs/nema_gfx/lib/core/ + */ + #ifndef LV_USE_NEMA_LIB + #ifdef CONFIG_LV_USE_NEMA_LIB + #define LV_USE_NEMA_LIB CONFIG_LV_USE_NEMA_LIB + #else + #define LV_USE_NEMA_LIB LV_NEMA_LIB_NONE + #endif + #endif + + /** Select which NemaGFX HAL to use. Possible options: + * - LV_NEMA_HAL_CUSTOM + * - LV_NEMA_HAL_STM32 */ + #ifndef LV_USE_NEMA_HAL + #ifdef CONFIG_LV_USE_NEMA_HAL + #define LV_USE_NEMA_HAL CONFIG_LV_USE_NEMA_HAL + #else + #define LV_USE_NEMA_HAL LV_NEMA_HAL_CUSTOM + #endif + #endif + #if LV_USE_NEMA_HAL == LV_NEMA_HAL_STM32 + #ifndef LV_NEMA_STM32_HAL_INCLUDE + #ifdef CONFIG_LV_NEMA_STM32_HAL_INCLUDE + #define LV_NEMA_STM32_HAL_INCLUDE CONFIG_LV_NEMA_STM32_HAL_INCLUDE + #else + #define LV_NEMA_STM32_HAL_INCLUDE + #endif + #endif + + /** Set it to a value like __attribute__((section("Nemagfx_Memory_Pool_Buffer"))) + * and define the section in the linker script if you need the GPU memory to + * be, e.g. in a region where accesses will not be cached. + */ + #ifndef LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM + #ifdef CONFIG_LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM + #define LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM CONFIG_LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM + #else + #define LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM + #endif + #endif + #endif + + /*Enable Vector Graphics Operations. Available only if NemaVG library is present*/ + #ifndef LV_USE_NEMA_VG + #ifdef CONFIG_LV_USE_NEMA_VG + #define LV_USE_NEMA_VG CONFIG_LV_USE_NEMA_VG + #else + #define LV_USE_NEMA_VG 0 + #endif + #endif + #if LV_USE_NEMA_VG + /*Define application's resolution used for VG related buffer allocation */ + #ifndef LV_NEMA_GFX_MAX_RESX + #ifdef CONFIG_LV_NEMA_GFX_MAX_RESX + #define LV_NEMA_GFX_MAX_RESX CONFIG_LV_NEMA_GFX_MAX_RESX + #else + #define LV_NEMA_GFX_MAX_RESX 800 + #endif + #endif + #ifndef LV_NEMA_GFX_MAX_RESY + #ifdef CONFIG_LV_NEMA_GFX_MAX_RESY + #define LV_NEMA_GFX_MAX_RESY CONFIG_LV_NEMA_GFX_MAX_RESY + #else + #define LV_NEMA_GFX_MAX_RESY 600 + #endif + #endif + #endif +#endif + +/** Use NXP's PXP on iMX RTxxx platforms. */ +#ifndef LV_USE_PXP + #ifdef CONFIG_LV_USE_PXP + #define LV_USE_PXP CONFIG_LV_USE_PXP + #else + #define LV_USE_PXP 0 + #endif +#endif + +#if LV_USE_PXP + /** Use PXP for drawing.*/ + #ifndef LV_USE_DRAW_PXP + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_DRAW_PXP + #define LV_USE_DRAW_PXP CONFIG_LV_USE_DRAW_PXP + #else + #define LV_USE_DRAW_PXP 0 + #endif + #else + #define LV_USE_DRAW_PXP 1 + #endif + #endif + + /** Use PXP to rotate display.*/ + #ifndef LV_USE_ROTATE_PXP + #ifdef CONFIG_LV_USE_ROTATE_PXP + #define LV_USE_ROTATE_PXP CONFIG_LV_USE_ROTATE_PXP + #else + #define LV_USE_ROTATE_PXP 0 + #endif + #endif + + #if LV_USE_DRAW_PXP && LV_USE_OS + /** Use additional draw thread for PXP processing.*/ + #ifndef LV_USE_PXP_DRAW_THREAD + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_PXP_DRAW_THREAD + #define LV_USE_PXP_DRAW_THREAD CONFIG_LV_USE_PXP_DRAW_THREAD + #else + #define LV_USE_PXP_DRAW_THREAD 0 + #endif + #else + #define LV_USE_PXP_DRAW_THREAD 1 + #endif + #endif + #endif + + /** Enable PXP asserts. */ + #ifndef LV_USE_PXP_ASSERT + #ifdef CONFIG_LV_USE_PXP_ASSERT + #define LV_USE_PXP_ASSERT CONFIG_LV_USE_PXP_ASSERT + #else + #define LV_USE_PXP_ASSERT 0 + #endif + #endif +#endif + +/** Use NXP's G2D on MPU platforms. */ +#ifndef LV_USE_G2D + #ifdef CONFIG_LV_USE_G2D + #define LV_USE_G2D CONFIG_LV_USE_G2D + #else + #define LV_USE_G2D 0 + #endif +#endif + +#if LV_USE_G2D + /** Use G2D for drawing. **/ + #ifndef LV_USE_DRAW_G2D + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_DRAW_G2D + #define LV_USE_DRAW_G2D CONFIG_LV_USE_DRAW_G2D + #else + #define LV_USE_DRAW_G2D 0 + #endif + #else + #define LV_USE_DRAW_G2D 1 + #endif + #endif + + /** Maximum number of buffers that can be stored for G2D draw unit. + * Includes the frame buffers and assets. */ + #ifndef LV_G2D_HASH_TABLE_SIZE + #ifdef CONFIG_LV_G2D_HASH_TABLE_SIZE + #define LV_G2D_HASH_TABLE_SIZE CONFIG_LV_G2D_HASH_TABLE_SIZE + #else + #define LV_G2D_HASH_TABLE_SIZE 50 + #endif + #endif + + #if LV_USE_DRAW_G2D && LV_USE_OS + /** Use additional draw thread for G2D processing.*/ + #ifndef LV_USE_G2D_DRAW_THREAD + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_G2D_DRAW_THREAD + #define LV_USE_G2D_DRAW_THREAD CONFIG_LV_USE_G2D_DRAW_THREAD + #else + #define LV_USE_G2D_DRAW_THREAD 0 + #endif + #else + #define LV_USE_G2D_DRAW_THREAD 1 + #endif + #endif + #endif + + /** Enable G2D asserts. */ + #ifndef LV_USE_G2D_ASSERT + #ifdef CONFIG_LV_USE_G2D_ASSERT + #define LV_USE_G2D_ASSERT CONFIG_LV_USE_G2D_ASSERT + #else + #define LV_USE_G2D_ASSERT 0 + #endif + #endif +#endif + +/** Use Renesas Dave2D on RA platforms. */ +#ifndef LV_USE_DRAW_DAVE2D + #ifdef CONFIG_LV_USE_DRAW_DAVE2D + #define LV_USE_DRAW_DAVE2D CONFIG_LV_USE_DRAW_DAVE2D + #else + #define LV_USE_DRAW_DAVE2D 0 + #endif +#endif + +/** Draw using cached SDL textures*/ +#ifndef LV_USE_DRAW_SDL + #ifdef CONFIG_LV_USE_DRAW_SDL + #define LV_USE_DRAW_SDL CONFIG_LV_USE_DRAW_SDL + #else + #define LV_USE_DRAW_SDL 0 + #endif +#endif + +/** Use VG-Lite GPU. */ +#ifndef LV_USE_DRAW_VG_LITE + #ifdef CONFIG_LV_USE_DRAW_VG_LITE + #define LV_USE_DRAW_VG_LITE CONFIG_LV_USE_DRAW_VG_LITE + #else + #define LV_USE_DRAW_VG_LITE 0 + #endif +#endif +#if LV_USE_DRAW_VG_LITE + /** Enable VG-Lite custom external 'gpu_init()' function */ + #ifndef LV_VG_LITE_USE_GPU_INIT + #ifdef CONFIG_LV_VG_LITE_USE_GPU_INIT + #define LV_VG_LITE_USE_GPU_INIT CONFIG_LV_VG_LITE_USE_GPU_INIT + #else + #define LV_VG_LITE_USE_GPU_INIT 0 + #endif + #endif + + /** Enable VG-Lite assert. */ + #ifndef LV_VG_LITE_USE_ASSERT + #ifdef CONFIG_LV_VG_LITE_USE_ASSERT + #define LV_VG_LITE_USE_ASSERT CONFIG_LV_VG_LITE_USE_ASSERT + #else + #define LV_VG_LITE_USE_ASSERT 0 + #endif + #endif + + /** VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */ + #ifndef LV_VG_LITE_FLUSH_MAX_COUNT + #ifdef CONFIG_LV_VG_LITE_FLUSH_MAX_COUNT + #define LV_VG_LITE_FLUSH_MAX_COUNT CONFIG_LV_VG_LITE_FLUSH_MAX_COUNT + #else + #define LV_VG_LITE_FLUSH_MAX_COUNT 8 + #endif + #endif + + /** Enable border to simulate shadow. + * NOTE: which usually improves performance, + * but does not guarantee the same rendering quality as the software. */ + #ifndef LV_VG_LITE_USE_BOX_SHADOW + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_VG_LITE_USE_BOX_SHADOW + #define LV_VG_LITE_USE_BOX_SHADOW CONFIG_LV_VG_LITE_USE_BOX_SHADOW + #else + #define LV_VG_LITE_USE_BOX_SHADOW 0 + #endif + #else + #define LV_VG_LITE_USE_BOX_SHADOW 1 + #endif + #endif + + /** VG-Lite gradient maximum cache number. + * @note The memory usage of a single gradient image is 4K bytes. */ + #ifndef LV_VG_LITE_GRAD_CACHE_CNT + #ifdef CONFIG_LV_VG_LITE_GRAD_CACHE_CNT + #define LV_VG_LITE_GRAD_CACHE_CNT CONFIG_LV_VG_LITE_GRAD_CACHE_CNT + #else + #define LV_VG_LITE_GRAD_CACHE_CNT 32 + #endif + #endif + + /** VG-Lite stroke maximum cache number. */ + #ifndef LV_VG_LITE_STROKE_CACHE_CNT + #ifdef CONFIG_LV_VG_LITE_STROKE_CACHE_CNT + #define LV_VG_LITE_STROKE_CACHE_CNT CONFIG_LV_VG_LITE_STROKE_CACHE_CNT + #else + #define LV_VG_LITE_STROKE_CACHE_CNT 32 + #endif + #endif + + /** VG-Lite unaligned bitmap font maximum cache number. */ + #ifndef LV_VG_LITE_BITMAP_FONT_CACHE_CNT + #ifdef CONFIG_LV_VG_LITE_BITMAP_FONT_CACHE_CNT + #define LV_VG_LITE_BITMAP_FONT_CACHE_CNT CONFIG_LV_VG_LITE_BITMAP_FONT_CACHE_CNT + #else + #define LV_VG_LITE_BITMAP_FONT_CACHE_CNT 256 + #endif + #endif + + /** Remove VLC_OP_CLOSE path instruction (Workaround for NXP) **/ + #ifndef LV_VG_LITE_DISABLE_VLC_OP_CLOSE + #ifdef CONFIG_LV_VG_LITE_DISABLE_VLC_OP_CLOSE + #define LV_VG_LITE_DISABLE_VLC_OP_CLOSE CONFIG_LV_VG_LITE_DISABLE_VLC_OP_CLOSE + #else + #define LV_VG_LITE_DISABLE_VLC_OP_CLOSE 0 + #endif + #endif + + /** Disable blit rectangular offset to resolve certain hardware errors. */ + #ifndef LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET + #ifdef CONFIG_LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET + #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET CONFIG_LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET + #else + #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET 0 + #endif + #endif + + /** Disable linear gradient extension for some older versions of drivers. */ + #ifndef LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT + #ifdef CONFIG_LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT + #define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT CONFIG_LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT + #else + #define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT 0 + #endif + #endif + + /** Maximum path dump print length (in points) */ + #ifndef LV_VG_LITE_PATH_DUMP_MAX_LEN + #ifdef CONFIG_LV_VG_LITE_PATH_DUMP_MAX_LEN + #define LV_VG_LITE_PATH_DUMP_MAX_LEN CONFIG_LV_VG_LITE_PATH_DUMP_MAX_LEN + #else + #define LV_VG_LITE_PATH_DUMP_MAX_LEN 1000 + #endif + #endif + + /** Enable usage of the LVGL's built-in vg_lite driver */ + #ifndef LV_USE_VG_LITE_DRIVER + #ifdef CONFIG_LV_USE_VG_LITE_DRIVER + #define LV_USE_VG_LITE_DRIVER CONFIG_LV_USE_VG_LITE_DRIVER + #else + #define LV_USE_VG_LITE_DRIVER 0 + #endif + #endif + #if LV_USE_VG_LITE_DRIVER + /** Used to pick the correct GPU series folder valid options are gc255, gc355 and gc555*/ + #ifndef LV_VG_LITE_HAL_GPU_SERIES + #ifdef CONFIG_LV_VG_LITE_HAL_GPU_SERIES + #define LV_VG_LITE_HAL_GPU_SERIES CONFIG_LV_VG_LITE_HAL_GPU_SERIES + #else + #define LV_VG_LITE_HAL_GPU_SERIES gc255 + #endif + #endif + + /** Used to pick the correct GPU revision header it depends on the vendor */ + #ifndef LV_VG_LITE_HAL_GPU_REVISION + #ifdef CONFIG_LV_VG_LITE_HAL_GPU_REVISION + #define LV_VG_LITE_HAL_GPU_REVISION CONFIG_LV_VG_LITE_HAL_GPU_REVISION + #else + #define LV_VG_LITE_HAL_GPU_REVISION 0x40 + #endif + #endif + + /** Base memory address of the GPU IP it depends on SoC, + * default value is for NXP based devices */ + #ifndef LV_VG_LITE_HAL_GPU_BASE_ADDRESS + #ifdef CONFIG_LV_VG_LITE_HAL_GPU_BASE_ADDRESS + #define LV_VG_LITE_HAL_GPU_BASE_ADDRESS CONFIG_LV_VG_LITE_HAL_GPU_BASE_ADDRESS + #else + #define LV_VG_LITE_HAL_GPU_BASE_ADDRESS 0x40240000 + #endif + #endif + #endif /*LV_USE_VG_LITE_DRIVER*/ + + /** Use ThorVG (a software vector library) as VG-Lite driver to allow testing VGLite on PC + * Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */ + #ifndef LV_USE_VG_LITE_THORVG + #ifdef CONFIG_LV_USE_VG_LITE_THORVG + #define LV_USE_VG_LITE_THORVG CONFIG_LV_USE_VG_LITE_THORVG + #else + #define LV_USE_VG_LITE_THORVG 0 + #endif + #endif + #if LV_USE_VG_LITE_THORVG + /** Enable LVGL's blend mode support */ + #ifndef LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT + #ifdef CONFIG_LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT + #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT CONFIG_LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT + #else + #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0 + #endif + #endif + + /** Enable YUV color format support */ + #ifndef LV_VG_LITE_THORVG_YUV_SUPPORT + #ifdef CONFIG_LV_VG_LITE_THORVG_YUV_SUPPORT + #define LV_VG_LITE_THORVG_YUV_SUPPORT CONFIG_LV_VG_LITE_THORVG_YUV_SUPPORT + #else + #define LV_VG_LITE_THORVG_YUV_SUPPORT 0 + #endif + #endif + + /** Enable Linear gradient extension support */ + #ifndef LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT + #ifdef CONFIG_LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT + #define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT CONFIG_LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT + #else + #define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT 0 + #endif + #endif + + /** Enable alignment on 16 pixels */ + #ifndef LV_VG_LITE_THORVG_16PIXELS_ALIGN + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_VG_LITE_THORVG_16PIXELS_ALIGN + #define LV_VG_LITE_THORVG_16PIXELS_ALIGN CONFIG_LV_VG_LITE_THORVG_16PIXELS_ALIGN + #else + #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 0 + #endif + #else + #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1 + #endif + #endif + + /** Buffer address alignment */ + #ifndef LV_VG_LITE_THORVG_BUF_ADDR_ALIGN + #ifdef CONFIG_LV_VG_LITE_THORVG_BUF_ADDR_ALIGN + #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN CONFIG_LV_VG_LITE_THORVG_BUF_ADDR_ALIGN + #else + #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64 + #endif + #endif + + /** Enable multi-thread render */ + #ifndef LV_VG_LITE_THORVG_THREAD_RENDER + #ifdef CONFIG_LV_VG_LITE_THORVG_THREAD_RENDER + #define LV_VG_LITE_THORVG_THREAD_RENDER CONFIG_LV_VG_LITE_THORVG_THREAD_RENDER + #else + #define LV_VG_LITE_THORVG_THREAD_RENDER 0 + #endif + #endif + #endif /*LV_USE_VG_LITE_THORVG*/ +#endif + +/** Accelerate blends, fills, etc. with STM32 DMA2D */ +#ifndef LV_USE_DRAW_DMA2D + #ifdef CONFIG_LV_USE_DRAW_DMA2D + #define LV_USE_DRAW_DMA2D CONFIG_LV_USE_DRAW_DMA2D + #else + #define LV_USE_DRAW_DMA2D 0 + #endif +#endif +#if LV_USE_DRAW_DMA2D + #ifndef LV_DRAW_DMA2D_HAL_INCLUDE + #ifdef CONFIG_LV_DRAW_DMA2D_HAL_INCLUDE + #define LV_DRAW_DMA2D_HAL_INCLUDE CONFIG_LV_DRAW_DMA2D_HAL_INCLUDE + #else + #define LV_DRAW_DMA2D_HAL_INCLUDE "stm32h7xx_hal.h" + #endif + #endif + + /* if enabled, the user is required to call `lv_draw_dma2d_transfer_complete_interrupt_handler` + * upon receiving the DMA2D global interrupt + */ + #ifndef LV_USE_DRAW_DMA2D_INTERRUPT + #ifdef CONFIG_LV_USE_DRAW_DMA2D_INTERRUPT + #define LV_USE_DRAW_DMA2D_INTERRUPT CONFIG_LV_USE_DRAW_DMA2D_INTERRUPT + #else + #define LV_USE_DRAW_DMA2D_INTERRUPT 0 + #endif + #endif +#endif + +/** Draw using cached OpenGLES textures. Requires LV_USE_OPENGLES */ +#ifndef LV_USE_DRAW_OPENGLES + #ifdef CONFIG_LV_USE_DRAW_OPENGLES + #define LV_USE_DRAW_OPENGLES CONFIG_LV_USE_DRAW_OPENGLES + #else + #define LV_USE_DRAW_OPENGLES 0 + #endif +#endif +#if LV_USE_DRAW_OPENGLES + #ifndef LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT + #ifdef CONFIG_LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT + #define LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT CONFIG_LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT + #else + #define LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT 64 + #endif + #endif +#endif + +/** Draw using espressif PPA accelerator */ +#ifndef LV_USE_PPA + #ifdef CONFIG_LV_USE_PPA + #define LV_USE_PPA CONFIG_LV_USE_PPA + #else + #define LV_USE_PPA 0 + #endif +#endif +#if LV_USE_PPA + #ifndef LV_USE_PPA_IMG + #ifdef CONFIG_LV_USE_PPA_IMG + #define LV_USE_PPA_IMG CONFIG_LV_USE_PPA_IMG + #else + #define LV_USE_PPA_IMG 0 + #endif + #endif + #ifndef LV_PPA_BURST_LENGTH + #ifdef CONFIG_LV_PPA_BURST_LENGTH + #define LV_PPA_BURST_LENGTH CONFIG_LV_PPA_BURST_LENGTH + #else + #define LV_PPA_BURST_LENGTH 128 + #endif + #endif +#endif + +/* Use EVE FT81X GPU. */ +#ifndef LV_USE_DRAW_EVE + #ifdef CONFIG_LV_USE_DRAW_EVE + #define LV_USE_DRAW_EVE CONFIG_LV_USE_DRAW_EVE + #else + #define LV_USE_DRAW_EVE 0 + #endif +#endif +#if LV_USE_DRAW_EVE + /* EVE_GEN value: 2, 3, or 4 */ + #ifndef LV_DRAW_EVE_EVE_GENERATION + #ifdef CONFIG_LV_DRAW_EVE_EVE_GENERATION + #define LV_DRAW_EVE_EVE_GENERATION CONFIG_LV_DRAW_EVE_EVE_GENERATION + #else + #define LV_DRAW_EVE_EVE_GENERATION 4 + #endif + #endif + + /* The maximum number of bytes to buffer before a single SPI transmission. + * Set it to 0 to disable write buffering. + */ + #ifndef LV_DRAW_EVE_WRITE_BUFFER_SIZE + #ifdef CONFIG_LV_DRAW_EVE_WRITE_BUFFER_SIZE + #define LV_DRAW_EVE_WRITE_BUFFER_SIZE CONFIG_LV_DRAW_EVE_WRITE_BUFFER_SIZE + #else + #define LV_DRAW_EVE_WRITE_BUFFER_SIZE 2048 + #endif + #endif +#endif + +/** Use NanoVG Renderer + * - Requires LV_USE_NANOVG, LV_USE_MATRIX. + */ +#ifndef LV_USE_DRAW_NANOVG + #ifdef CONFIG_LV_USE_DRAW_NANOVG + #define LV_USE_DRAW_NANOVG CONFIG_LV_USE_DRAW_NANOVG + #else + #define LV_USE_DRAW_NANOVG 0 + #endif +#endif +#if LV_USE_DRAW_NANOVG + /** Select OpenGL backend for NanoVG: + * - LV_NANOVG_BACKEND_GL2: OpenGL 2.0 + * - LV_NANOVG_BACKEND_GL3: OpenGL 3.0+ + * - LV_NANOVG_BACKEND_GLES2: OpenGL ES 2.0 + * - LV_NANOVG_BACKEND_GLES3: OpenGL ES 3.0+ + */ + #ifndef LV_NANOVG_BACKEND + #ifdef CONFIG_LV_NANOVG_BACKEND + #define LV_NANOVG_BACKEND CONFIG_LV_NANOVG_BACKEND + #else + #define LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GLES2 + #endif + #endif + + /** Draw image texture cache count. */ + #ifndef LV_NANOVG_IMAGE_CACHE_CNT + #ifdef CONFIG_LV_NANOVG_IMAGE_CACHE_CNT + #define LV_NANOVG_IMAGE_CACHE_CNT CONFIG_LV_NANOVG_IMAGE_CACHE_CNT + #else + #define LV_NANOVG_IMAGE_CACHE_CNT 128 + #endif + #endif + + /** Draw letter texture cache count. */ + #ifndef LV_NANOVG_LETTER_CACHE_CNT + #ifdef CONFIG_LV_NANOVG_LETTER_CACHE_CNT + #define LV_NANOVG_LETTER_CACHE_CNT CONFIG_LV_NANOVG_LETTER_CACHE_CNT + #else + #define LV_NANOVG_LETTER_CACHE_CNT 512 + #endif + #endif +#endif + +/*======================= + * FEATURE CONFIGURATION + *=======================*/ + +/*------------- + * Logging + *-----------*/ + +/** Enable log module */ +#ifndef LV_USE_LOG + #ifdef CONFIG_LV_USE_LOG + #define LV_USE_LOG CONFIG_LV_USE_LOG + #else + #define LV_USE_LOG 0 + #endif +#endif +#if LV_USE_LOG + /** Set value to one of the following levels of logging detail: + * - LV_LOG_LEVEL_TRACE Log detailed information. + * - LV_LOG_LEVEL_INFO Log important events. + * - LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem. + * - LV_LOG_LEVEL_ERROR Log only critical issues, when system may fail. + * - LV_LOG_LEVEL_USER Log only custom log messages added by the user. + * - LV_LOG_LEVEL_NONE Do not log anything. */ + #ifndef LV_LOG_LEVEL + #ifdef CONFIG_LV_LOG_LEVEL + #define LV_LOG_LEVEL CONFIG_LV_LOG_LEVEL + #else + #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN + #endif + #endif + + /** - 1: Print log with 'printf'; + * - 0: User needs to register a callback with `lv_log_register_print_cb()`. */ + #ifndef LV_LOG_PRINTF + #ifdef CONFIG_LV_LOG_PRINTF + #define LV_LOG_PRINTF CONFIG_LV_LOG_PRINTF + #else + #define LV_LOG_PRINTF 0 + #endif + #endif + + /** Set callback to print logs. + * E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)`. + * Can be overwritten by `lv_log_register_print_cb`. */ + //#define LV_LOG_PRINT_CB + + /** - 1: Enable printing timestamp; + * - 0: Disable printing timestamp. */ + #ifndef LV_LOG_USE_TIMESTAMP + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_USE_TIMESTAMP + #define LV_LOG_USE_TIMESTAMP CONFIG_LV_LOG_USE_TIMESTAMP + #else + #define LV_LOG_USE_TIMESTAMP 0 + #endif + #else + #define LV_LOG_USE_TIMESTAMP 1 + #endif + #endif + + /** - 1: Print file and line number of the log; + * - 0: Do not print file and line number of the log. */ + #ifndef LV_LOG_USE_FILE_LINE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_USE_FILE_LINE + #define LV_LOG_USE_FILE_LINE CONFIG_LV_LOG_USE_FILE_LINE + #else + #define LV_LOG_USE_FILE_LINE 0 + #endif + #else + #define LV_LOG_USE_FILE_LINE 1 + #endif + #endif + + /* Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs. */ + #ifndef LV_LOG_TRACE_MEM + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_TRACE_MEM + #define LV_LOG_TRACE_MEM CONFIG_LV_LOG_TRACE_MEM + #else + #define LV_LOG_TRACE_MEM 0 + #endif + #else + #define LV_LOG_TRACE_MEM 1 /**< Enable/disable trace logs in memory operations. */ + #endif + #endif + #ifndef LV_LOG_TRACE_TIMER + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_TRACE_TIMER + #define LV_LOG_TRACE_TIMER CONFIG_LV_LOG_TRACE_TIMER + #else + #define LV_LOG_TRACE_TIMER 0 + #endif + #else + #define LV_LOG_TRACE_TIMER 1 /**< Enable/disable trace logs in timer operations. */ + #endif + #endif + #ifndef LV_LOG_TRACE_INDEV + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_TRACE_INDEV + #define LV_LOG_TRACE_INDEV CONFIG_LV_LOG_TRACE_INDEV + #else + #define LV_LOG_TRACE_INDEV 0 + #endif + #else + #define LV_LOG_TRACE_INDEV 1 /**< Enable/disable trace logs in input device operations. */ + #endif + #endif + #ifndef LV_LOG_TRACE_DISP_REFR + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_TRACE_DISP_REFR + #define LV_LOG_TRACE_DISP_REFR CONFIG_LV_LOG_TRACE_DISP_REFR + #else + #define LV_LOG_TRACE_DISP_REFR 0 + #endif + #else + #define LV_LOG_TRACE_DISP_REFR 1 /**< Enable/disable trace logs in display re-draw operations. */ + #endif + #endif + #ifndef LV_LOG_TRACE_EVENT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_TRACE_EVENT + #define LV_LOG_TRACE_EVENT CONFIG_LV_LOG_TRACE_EVENT + #else + #define LV_LOG_TRACE_EVENT 0 + #endif + #else + #define LV_LOG_TRACE_EVENT 1 /**< Enable/disable trace logs in event dispatch logic. */ + #endif + #endif + #ifndef LV_LOG_TRACE_OBJ_CREATE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_TRACE_OBJ_CREATE + #define LV_LOG_TRACE_OBJ_CREATE CONFIG_LV_LOG_TRACE_OBJ_CREATE + #else + #define LV_LOG_TRACE_OBJ_CREATE 0 + #endif + #else + #define LV_LOG_TRACE_OBJ_CREATE 1 /**< Enable/disable trace logs in object creation (core `obj` creation plus every widget). */ + #endif + #endif + #ifndef LV_LOG_TRACE_LAYOUT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_TRACE_LAYOUT + #define LV_LOG_TRACE_LAYOUT CONFIG_LV_LOG_TRACE_LAYOUT + #else + #define LV_LOG_TRACE_LAYOUT 0 + #endif + #else + #define LV_LOG_TRACE_LAYOUT 1 /**< Enable/disable trace logs in flex- and grid-layout operations. */ + #endif + #endif + #ifndef LV_LOG_TRACE_ANIM + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_TRACE_ANIM + #define LV_LOG_TRACE_ANIM CONFIG_LV_LOG_TRACE_ANIM + #else + #define LV_LOG_TRACE_ANIM 0 + #endif + #else + #define LV_LOG_TRACE_ANIM 1 /**< Enable/disable trace logs in animation logic. */ + #endif + #endif + #ifndef LV_LOG_TRACE_CACHE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LOG_TRACE_CACHE + #define LV_LOG_TRACE_CACHE CONFIG_LV_LOG_TRACE_CACHE + #else + #define LV_LOG_TRACE_CACHE 0 + #endif + #else + #define LV_LOG_TRACE_CACHE 1 /**< Enable/disable trace logs in cache operations. */ + #endif + #endif +#endif /*LV_USE_LOG*/ + +/*------------- + * Asserts + *-----------*/ + +/* Enable assertion failures if an operation fails or invalid data is found. + * If LV_USE_LOG is enabled, an error message will be printed on failure. */ +#ifndef LV_USE_ASSERT_NULL + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_ASSERT_NULL + #define LV_USE_ASSERT_NULL CONFIG_LV_USE_ASSERT_NULL + #else + #define LV_USE_ASSERT_NULL 0 + #endif + #else + #define LV_USE_ASSERT_NULL 1 /**< Check if the parameter is NULL. (Very fast, recommended) */ + #endif +#endif +#ifndef LV_USE_ASSERT_MALLOC + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_ASSERT_MALLOC + #define LV_USE_ASSERT_MALLOC CONFIG_LV_USE_ASSERT_MALLOC + #else + #define LV_USE_ASSERT_MALLOC 0 + #endif + #else + #define LV_USE_ASSERT_MALLOC 1 /**< Checks is the memory is successfully allocated or no. (Very fast, recommended) */ + #endif +#endif +#ifndef LV_USE_ASSERT_STYLE + #ifdef CONFIG_LV_USE_ASSERT_STYLE + #define LV_USE_ASSERT_STYLE CONFIG_LV_USE_ASSERT_STYLE + #else + #define LV_USE_ASSERT_STYLE 0 /**< Check if the styles are properly initialized. (Very fast, recommended) */ + #endif +#endif +#ifndef LV_USE_ASSERT_MEM_INTEGRITY + #ifdef CONFIG_LV_USE_ASSERT_MEM_INTEGRITY + #define LV_USE_ASSERT_MEM_INTEGRITY CONFIG_LV_USE_ASSERT_MEM_INTEGRITY + #else + #define LV_USE_ASSERT_MEM_INTEGRITY 0 /**< Check the integrity of `lv_mem` after critical operations. (Slow) */ + #endif +#endif +#ifndef LV_USE_ASSERT_OBJ + #ifdef CONFIG_LV_USE_ASSERT_OBJ + #define LV_USE_ASSERT_OBJ CONFIG_LV_USE_ASSERT_OBJ + #else + #define LV_USE_ASSERT_OBJ 0 /**< Check the object's type and existence (e.g. not deleted). (Slow) */ + #endif +#endif + +/** Add a custom handler when assert happens e.g. to restart MCU. */ +#ifndef LV_ASSERT_HANDLER_INCLUDE + #ifdef CONFIG_LV_ASSERT_HANDLER_INCLUDE + #define LV_ASSERT_HANDLER_INCLUDE CONFIG_LV_ASSERT_HANDLER_INCLUDE + #else + #define LV_ASSERT_HANDLER_INCLUDE + #endif +#endif +#ifndef LV_ASSERT_HANDLER + #ifdef CONFIG_LV_ASSERT_HANDLER + #define LV_ASSERT_HANDLER CONFIG_LV_ASSERT_HANDLER + #else + #define LV_ASSERT_HANDLER while(1); /**< Halt by default */ + #endif +#endif + +/*------------- + * Check arg + *-----------*/ + +/** Enable LV_CHECK_ARG macro to validate function arguments at runtime. + * When enabled, failed checks log a warning and execute the specified action. + * 0: Disable all LV_CHECK_ARG checks (checks compile to nothing) + * 1: Enable LV_CHECK_ARG checks */ +#ifndef LV_USE_CHECK_ARG + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_CHECK_ARG + #define LV_USE_CHECK_ARG CONFIG_LV_USE_CHECK_ARG + #else + #define LV_USE_CHECK_ARG 0 + #endif + #else + #define LV_USE_CHECK_ARG 1 + #endif +#endif + +/** If enabled, also call LV_ASSERT_HANDLER when an LV_CHECK_ARG check fails. + * Requires LV_USE_CHECK_ARG to be enabled. */ +#ifndef LV_CHECK_ARG_ASSERT_ON_FAIL + #ifdef CONFIG_LV_CHECK_ARG_ASSERT_ON_FAIL + #define LV_CHECK_ARG_ASSERT_ON_FAIL CONFIG_LV_CHECK_ARG_ASSERT_ON_FAIL + #else + #define LV_CHECK_ARG_ASSERT_ON_FAIL 0 + #endif +#endif + +/*------------- + * Debug + *-----------*/ + +/** 1: Draw random colored rectangles over the redrawn areas. */ +#ifndef LV_USE_REFR_DEBUG + #ifdef CONFIG_LV_USE_REFR_DEBUG + #define LV_USE_REFR_DEBUG CONFIG_LV_USE_REFR_DEBUG + #else + #define LV_USE_REFR_DEBUG 0 + #endif +#endif + +/** 1: Draw a red overlay for ARGB layers and a green overlay for RGB layers*/ +#ifndef LV_USE_LAYER_DEBUG + #ifdef CONFIG_LV_USE_LAYER_DEBUG + #define LV_USE_LAYER_DEBUG CONFIG_LV_USE_LAYER_DEBUG + #else + #define LV_USE_LAYER_DEBUG 0 + #endif +#endif + +/** 1: Adds the following behaviors for debugging: + * - Draw overlays with different colors for each draw_unit's tasks. + * - Draw index number of draw unit on white background. + * - For layers, draws index number of draw unit on black background. */ +#ifndef LV_USE_PARALLEL_DRAW_DEBUG + #ifdef CONFIG_LV_USE_PARALLEL_DRAW_DEBUG + #define LV_USE_PARALLEL_DRAW_DEBUG CONFIG_LV_USE_PARALLEL_DRAW_DEBUG + #else + #define LV_USE_PARALLEL_DRAW_DEBUG 0 + #endif +#endif + +/*------------- + * Others + *-----------*/ + +#ifndef LV_ENABLE_GLOBAL_CUSTOM + #ifdef CONFIG_LV_ENABLE_GLOBAL_CUSTOM + #define LV_ENABLE_GLOBAL_CUSTOM CONFIG_LV_ENABLE_GLOBAL_CUSTOM + #else + #define LV_ENABLE_GLOBAL_CUSTOM 0 + #endif +#endif +#if LV_ENABLE_GLOBAL_CUSTOM + /** Header to include for custom 'lv_global' function" */ + #ifndef LV_GLOBAL_CUSTOM_INCLUDE + #ifdef CONFIG_LV_GLOBAL_CUSTOM_INCLUDE + #define LV_GLOBAL_CUSTOM_INCLUDE CONFIG_LV_GLOBAL_CUSTOM_INCLUDE + #else + #define LV_GLOBAL_CUSTOM_INCLUDE + #endif + #endif +#endif + +/** Default cache size in bytes. + * Used by image decoders such as `lv_lodepng` to keep the decoded image in memory. + * If size is not set to 0, the decoder will fail to decode when the cache is full. + * If size is 0, the cache function is not enabled and the decoded memory will be + * released immediately after use. */ +#ifndef LV_CACHE_DEF_SIZE + #ifdef CONFIG_LV_CACHE_DEF_SIZE + #define LV_CACHE_DEF_SIZE CONFIG_LV_CACHE_DEF_SIZE + #else + #define LV_CACHE_DEF_SIZE 0 + #endif +#endif + +/** Default number of image header cache entries. The cache is used to store the headers of images + * The main logic is like `LV_CACHE_DEF_SIZE` but for image headers. */ +#ifndef LV_IMAGE_HEADER_CACHE_DEF_CNT + #ifdef CONFIG_LV_IMAGE_HEADER_CACHE_DEF_CNT + #define LV_IMAGE_HEADER_CACHE_DEF_CNT CONFIG_LV_IMAGE_HEADER_CACHE_DEF_CNT + #else + #define LV_IMAGE_HEADER_CACHE_DEF_CNT 0 + #endif +#endif + +/** Number of stops allowed per gradient. Increase this to allow more stops. + * This adds (sizeof(lv_color_t) + 1) bytes per additional stop. */ +#ifndef LV_GRADIENT_MAX_STOPS + #ifdef CONFIG_LV_GRADIENT_MAX_STOPS + #define LV_GRADIENT_MAX_STOPS CONFIG_LV_GRADIENT_MAX_STOPS + #else + #define LV_GRADIENT_MAX_STOPS 2 + #endif +#endif + +/** Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. + * - 0: round down, + * - 64: round up from x.75, + * - 128: round up from half, + * - 192: round up from x.25, + * - 254: round up */ +#ifndef LV_COLOR_MIX_ROUND_OFS + #ifdef CONFIG_LV_COLOR_MIX_ROUND_OFS + #define LV_COLOR_MIX_ROUND_OFS CONFIG_LV_COLOR_MIX_ROUND_OFS + #else + #define LV_COLOR_MIX_ROUND_OFS 0 + #endif +#endif + +/** Add 2 x 32-bit variables to each `lv_obj_t` to speed up getting style properties */ +#ifndef LV_OBJ_STYLE_CACHE + #ifdef CONFIG_LV_OBJ_STYLE_CACHE + #define LV_OBJ_STYLE_CACHE CONFIG_LV_OBJ_STYLE_CACHE + #else + #define LV_OBJ_STYLE_CACHE 0 + #endif +#endif + +/** Add `id` field to `lv_obj_t` */ +#ifndef LV_USE_OBJ_ID + #ifdef CONFIG_LV_USE_OBJ_ID + #define LV_USE_OBJ_ID CONFIG_LV_USE_OBJ_ID + #else + #define LV_USE_OBJ_ID 0 + #endif +#endif + +/** Enable support widget names*/ +#ifndef LV_USE_OBJ_NAME + #ifdef CONFIG_LV_USE_OBJ_NAME + #define LV_USE_OBJ_NAME CONFIG_LV_USE_OBJ_NAME + #else + #define LV_USE_OBJ_NAME 0 + #endif +#endif + +/** Automatically assign an ID when obj is created */ +#ifndef LV_OBJ_ID_AUTO_ASSIGN + #ifdef CONFIG_LV_OBJ_ID_AUTO_ASSIGN + #define LV_OBJ_ID_AUTO_ASSIGN CONFIG_LV_OBJ_ID_AUTO_ASSIGN + #else + #define LV_OBJ_ID_AUTO_ASSIGN LV_USE_OBJ_ID + #endif +#endif + +/** Use builtin obj ID handler functions: +* - lv_obj_assign_id: Called when a widget is created. Use a separate counter for each widget class as an ID. +* - lv_obj_id_compare: Compare the ID to decide if it matches with a requested value. +* - lv_obj_stringify_id: Return string-ified identifier, e.g. "button3". +* - lv_obj_free_id: Does nothing, as there is no memory allocation for the ID. +* When disabled these functions needs to be implemented by the user.*/ +#ifndef LV_USE_OBJ_ID_BUILTIN + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_OBJ_ID_BUILTIN + #define LV_USE_OBJ_ID_BUILTIN CONFIG_LV_USE_OBJ_ID_BUILTIN + #else + #define LV_USE_OBJ_ID_BUILTIN 0 + #endif + #else + #define LV_USE_OBJ_ID_BUILTIN 1 + #endif +#endif + +/** Use obj property set/get API. */ +#ifndef LV_USE_OBJ_PROPERTY + #ifdef CONFIG_LV_USE_OBJ_PROPERTY + #define LV_USE_OBJ_PROPERTY CONFIG_LV_USE_OBJ_PROPERTY + #else + #define LV_USE_OBJ_PROPERTY 0 + #endif +#endif + +/** Enable property name support. */ +#ifndef LV_USE_OBJ_PROPERTY_NAME + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_OBJ_PROPERTY_NAME + #define LV_USE_OBJ_PROPERTY_NAME CONFIG_LV_USE_OBJ_PROPERTY_NAME + #else + #define LV_USE_OBJ_PROPERTY_NAME 0 + #endif + #else + #define LV_USE_OBJ_PROPERTY_NAME 1 + #endif +#endif + +/* Enable the multi-touch gesture recognition feature */ +/* Gesture recognition requires the use of floats */ +#ifndef LV_USE_GESTURE_RECOGNITION + #ifdef CONFIG_LV_USE_GESTURE_RECOGNITION + #define LV_USE_GESTURE_RECOGNITION CONFIG_LV_USE_GESTURE_RECOGNITION + #else + #define LV_USE_GESTURE_RECOGNITION 0 + #endif +#endif + +/*===================== + * COMPILER SETTINGS + *====================*/ + +/** For big endian systems set to 1 */ +#ifndef LV_BIG_ENDIAN_SYSTEM + #ifdef CONFIG_LV_BIG_ENDIAN_SYSTEM + #define LV_BIG_ENDIAN_SYSTEM CONFIG_LV_BIG_ENDIAN_SYSTEM + #else + #define LV_BIG_ENDIAN_SYSTEM 0 + #endif +#endif + +/** Define a custom attribute for `lv_tick_inc` function */ +#ifndef LV_ATTRIBUTE_TICK_INC + #ifdef CONFIG_LV_ATTRIBUTE_TICK_INC + #define LV_ATTRIBUTE_TICK_INC CONFIG_LV_ATTRIBUTE_TICK_INC + #else + #define LV_ATTRIBUTE_TICK_INC + #endif +#endif + +/** Define a custom attribute for `lv_timer_handler` function */ +#ifndef LV_ATTRIBUTE_TIMER_HANDLER + #ifdef CONFIG_LV_ATTRIBUTE_TIMER_HANDLER + #define LV_ATTRIBUTE_TIMER_HANDLER CONFIG_LV_ATTRIBUTE_TIMER_HANDLER + #else + #define LV_ATTRIBUTE_TIMER_HANDLER + #endif +#endif + +/** Define a custom attribute for `lv_display_flush_ready` function */ +#ifndef LV_ATTRIBUTE_FLUSH_READY + #ifdef CONFIG_LV_ATTRIBUTE_FLUSH_READY + #define LV_ATTRIBUTE_FLUSH_READY CONFIG_LV_ATTRIBUTE_FLUSH_READY + #else + #define LV_ATTRIBUTE_FLUSH_READY + #endif +#endif + +/** Define a custom attribute for `lv_display_sync_ready` function */ +#ifndef LV_ATTRIBUTE_SYNC_READY + #ifdef CONFIG_LV_ATTRIBUTE_SYNC_READY + #define LV_ATTRIBUTE_SYNC_READY CONFIG_LV_ATTRIBUTE_SYNC_READY + #else + #define LV_ATTRIBUTE_SYNC_READY + #endif +#endif + +/** Align VG_LITE buffers on this number of bytes. + * @note vglite_src_buf_aligned() uses this value to validate alignment of passed buffer pointers. */ +#ifndef LV_ATTRIBUTE_MEM_ALIGN_SIZE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE + #define LV_ATTRIBUTE_MEM_ALIGN_SIZE CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE + #else + #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 0 + #endif + #else + #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 + #endif +#endif + +/** Will be added where memory needs to be aligned (with -Os data might not be aligned to boundary by default). + * E.g. __attribute__((aligned(4)))*/ +#ifndef LV_ATTRIBUTE_MEM_ALIGN + #ifdef CONFIG_LV_ATTRIBUTE_MEM_ALIGN + #define LV_ATTRIBUTE_MEM_ALIGN CONFIG_LV_ATTRIBUTE_MEM_ALIGN + #else + #define LV_ATTRIBUTE_MEM_ALIGN + #endif +#endif + +/** Attribute to mark large constant arrays, for example for font bitmaps */ +#ifndef LV_ATTRIBUTE_LARGE_CONST + #ifdef CONFIG_LV_ATTRIBUTE_LARGE_CONST + #define LV_ATTRIBUTE_LARGE_CONST CONFIG_LV_ATTRIBUTE_LARGE_CONST + #else + #define LV_ATTRIBUTE_LARGE_CONST + #endif +#endif + +/** Compiler prefix for a large array declaration in RAM */ +#ifndef LV_ATTRIBUTE_LARGE_RAM_ARRAY + #ifdef CONFIG_LV_ATTRIBUTE_LARGE_RAM_ARRAY + #define LV_ATTRIBUTE_LARGE_RAM_ARRAY CONFIG_LV_ATTRIBUTE_LARGE_RAM_ARRAY + #else + #define LV_ATTRIBUTE_LARGE_RAM_ARRAY + #endif +#endif + +/** Place performance critical functions into a faster memory (e.g RAM) */ +#ifndef LV_ATTRIBUTE_FAST_MEM + #ifdef CONFIG_LV_ATTRIBUTE_FAST_MEM + #define LV_ATTRIBUTE_FAST_MEM CONFIG_LV_ATTRIBUTE_FAST_MEM + #else + #define LV_ATTRIBUTE_FAST_MEM + #endif +#endif + +/** Export integer constant to binding. This macro is used with constants in the form of LV_ that + * should also appear on LVGL binding API such as MicroPython. */ +#ifndef LV_EXPORT_CONST_INT + #ifdef CONFIG_LV_EXPORT_CONST_INT + #define LV_EXPORT_CONST_INT CONFIG_LV_EXPORT_CONST_INT + #else + #define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /**< The default value just prevents GCC warning */ + #endif +#endif + +/** Prefix all global extern data with this */ +#ifndef LV_ATTRIBUTE_EXTERN_DATA + #ifdef CONFIG_LV_ATTRIBUTE_EXTERN_DATA + #define LV_ATTRIBUTE_EXTERN_DATA CONFIG_LV_ATTRIBUTE_EXTERN_DATA + #else + #define LV_ATTRIBUTE_EXTERN_DATA + #endif +#endif + +/** Use `float` as `lv_value_precise_t` */ +#ifndef LV_USE_FLOAT + #ifdef CONFIG_LV_USE_FLOAT + #define LV_USE_FLOAT CONFIG_LV_USE_FLOAT + #else + #define LV_USE_FLOAT 0 + #endif +#endif + +/** Enable matrix support + * - Requires `LV_USE_FLOAT = 1` */ +#ifndef LV_USE_MATRIX + #ifdef CONFIG_LV_USE_MATRIX + #define LV_USE_MATRIX CONFIG_LV_USE_MATRIX + #else + #define LV_USE_MATRIX 0 + #endif +#endif + +/** Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default */ +#ifndef LV_USE_PRIVATE_API + #ifndef LV_USE_PRIVATE_API + #ifdef CONFIG_LV_USE_PRIVATE_API + #define LV_USE_PRIVATE_API CONFIG_LV_USE_PRIVATE_API + #else + #define LV_USE_PRIVATE_API 0 + #endif + #endif +#endif + +/*================== + * FONT USAGE + *===================*/ + +/* Montserrat fonts with ASCII range and some symbols using bpp = 4 + * https://fonts.google.com/specimen/Montserrat */ +#ifndef LV_FONT_MONTSERRAT_8 + #ifdef CONFIG_LV_FONT_MONTSERRAT_8 + #define LV_FONT_MONTSERRAT_8 CONFIG_LV_FONT_MONTSERRAT_8 + #else + #define LV_FONT_MONTSERRAT_8 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_10 + #ifdef CONFIG_LV_FONT_MONTSERRAT_10 + #define LV_FONT_MONTSERRAT_10 CONFIG_LV_FONT_MONTSERRAT_10 + #else + #define LV_FONT_MONTSERRAT_10 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_12 + #ifdef CONFIG_LV_FONT_MONTSERRAT_12 + #define LV_FONT_MONTSERRAT_12 CONFIG_LV_FONT_MONTSERRAT_12 + #else + #define LV_FONT_MONTSERRAT_12 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_14 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_FONT_MONTSERRAT_14 + #define LV_FONT_MONTSERRAT_14 CONFIG_LV_FONT_MONTSERRAT_14 + #else + #define LV_FONT_MONTSERRAT_14 0 + #endif + #else + #define LV_FONT_MONTSERRAT_14 1 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_16 + #ifdef CONFIG_LV_FONT_MONTSERRAT_16 + #define LV_FONT_MONTSERRAT_16 CONFIG_LV_FONT_MONTSERRAT_16 + #else + #define LV_FONT_MONTSERRAT_16 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_18 + #ifdef CONFIG_LV_FONT_MONTSERRAT_18 + #define LV_FONT_MONTSERRAT_18 CONFIG_LV_FONT_MONTSERRAT_18 + #else + #define LV_FONT_MONTSERRAT_18 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_20 + #ifdef CONFIG_LV_FONT_MONTSERRAT_20 + #define LV_FONT_MONTSERRAT_20 CONFIG_LV_FONT_MONTSERRAT_20 + #else + #define LV_FONT_MONTSERRAT_20 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_22 + #ifdef CONFIG_LV_FONT_MONTSERRAT_22 + #define LV_FONT_MONTSERRAT_22 CONFIG_LV_FONT_MONTSERRAT_22 + #else + #define LV_FONT_MONTSERRAT_22 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_24 + #ifdef CONFIG_LV_FONT_MONTSERRAT_24 + #define LV_FONT_MONTSERRAT_24 CONFIG_LV_FONT_MONTSERRAT_24 + #else + #define LV_FONT_MONTSERRAT_24 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_26 + #ifdef CONFIG_LV_FONT_MONTSERRAT_26 + #define LV_FONT_MONTSERRAT_26 CONFIG_LV_FONT_MONTSERRAT_26 + #else + #define LV_FONT_MONTSERRAT_26 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_28 + #ifdef CONFIG_LV_FONT_MONTSERRAT_28 + #define LV_FONT_MONTSERRAT_28 CONFIG_LV_FONT_MONTSERRAT_28 + #else + #define LV_FONT_MONTSERRAT_28 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_30 + #ifdef CONFIG_LV_FONT_MONTSERRAT_30 + #define LV_FONT_MONTSERRAT_30 CONFIG_LV_FONT_MONTSERRAT_30 + #else + #define LV_FONT_MONTSERRAT_30 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_32 + #ifdef CONFIG_LV_FONT_MONTSERRAT_32 + #define LV_FONT_MONTSERRAT_32 CONFIG_LV_FONT_MONTSERRAT_32 + #else + #define LV_FONT_MONTSERRAT_32 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_34 + #ifdef CONFIG_LV_FONT_MONTSERRAT_34 + #define LV_FONT_MONTSERRAT_34 CONFIG_LV_FONT_MONTSERRAT_34 + #else + #define LV_FONT_MONTSERRAT_34 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_36 + #ifdef CONFIG_LV_FONT_MONTSERRAT_36 + #define LV_FONT_MONTSERRAT_36 CONFIG_LV_FONT_MONTSERRAT_36 + #else + #define LV_FONT_MONTSERRAT_36 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_38 + #ifdef CONFIG_LV_FONT_MONTSERRAT_38 + #define LV_FONT_MONTSERRAT_38 CONFIG_LV_FONT_MONTSERRAT_38 + #else + #define LV_FONT_MONTSERRAT_38 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_40 + #ifdef CONFIG_LV_FONT_MONTSERRAT_40 + #define LV_FONT_MONTSERRAT_40 CONFIG_LV_FONT_MONTSERRAT_40 + #else + #define LV_FONT_MONTSERRAT_40 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_42 + #ifdef CONFIG_LV_FONT_MONTSERRAT_42 + #define LV_FONT_MONTSERRAT_42 CONFIG_LV_FONT_MONTSERRAT_42 + #else + #define LV_FONT_MONTSERRAT_42 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_44 + #ifdef CONFIG_LV_FONT_MONTSERRAT_44 + #define LV_FONT_MONTSERRAT_44 CONFIG_LV_FONT_MONTSERRAT_44 + #else + #define LV_FONT_MONTSERRAT_44 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_46 + #ifdef CONFIG_LV_FONT_MONTSERRAT_46 + #define LV_FONT_MONTSERRAT_46 CONFIG_LV_FONT_MONTSERRAT_46 + #else + #define LV_FONT_MONTSERRAT_46 0 + #endif +#endif +#ifndef LV_FONT_MONTSERRAT_48 + #ifdef CONFIG_LV_FONT_MONTSERRAT_48 + #define LV_FONT_MONTSERRAT_48 CONFIG_LV_FONT_MONTSERRAT_48 + #else + #define LV_FONT_MONTSERRAT_48 0 + #endif +#endif + +/* Demonstrate special features */ +#ifndef LV_FONT_MONTSERRAT_28_COMPRESSED + #ifdef CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED + #define LV_FONT_MONTSERRAT_28_COMPRESSED CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED + #else + #define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */ + #endif +#endif +#ifndef LV_FONT_DEJAVU_16_PERSIAN_HEBREW + #ifdef CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW + #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW + #else + #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /**< Hebrew, Arabic, Persian letters and all their forms */ + #endif +#endif +#ifndef LV_FONT_SOURCE_HAN_SANS_SC_14_CJK + #ifdef CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK + #define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK + #else + #define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 0 /**< 1338 most common CJK radicals */ + #endif +#endif +#ifndef LV_FONT_SOURCE_HAN_SANS_SC_16_CJK + #ifdef CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK + #define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK + #else + #define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 0 /**< 1338 most common CJK radicals */ + #endif +#endif + +/** Pixel perfect monospaced fonts */ +#ifndef LV_FONT_UNSCII_8 + #ifdef CONFIG_LV_FONT_UNSCII_8 + #define LV_FONT_UNSCII_8 CONFIG_LV_FONT_UNSCII_8 + #else + #define LV_FONT_UNSCII_8 0 + #endif +#endif +#ifndef LV_FONT_UNSCII_16 + #ifdef CONFIG_LV_FONT_UNSCII_16 + #define LV_FONT_UNSCII_16 CONFIG_LV_FONT_UNSCII_16 + #else + #define LV_FONT_UNSCII_16 0 + #endif +#endif + +/** Optionally declare custom fonts here. + * + * You can use any of these fonts as the default font too and they will be available + * globally. Example: + * + * @code + * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2) + * @endcode + */ +#ifndef LV_FONT_CUSTOM_DECLARE + #ifdef CONFIG_LV_FONT_CUSTOM_DECLARE + #define LV_FONT_CUSTOM_DECLARE CONFIG_LV_FONT_CUSTOM_DECLARE + #else + #define LV_FONT_CUSTOM_DECLARE + #endif +#endif + +/** Always set a default font */ +#ifndef LV_FONT_DEFAULT + #ifdef CONFIG_LV_FONT_DEFAULT + #define LV_FONT_DEFAULT CONFIG_LV_FONT_DEFAULT + #else + #define LV_FONT_DEFAULT &lv_font_montserrat_14 + #endif +#endif + +/** Enable handling large font and/or fonts with a lot of characters. + * The limit depends on the font size, font face and bpp. + * A compiler error will be triggered if a font needs it. */ +#ifndef LV_FONT_FMT_TXT_LARGE + #ifdef CONFIG_LV_FONT_FMT_TXT_LARGE + #define LV_FONT_FMT_TXT_LARGE CONFIG_LV_FONT_FMT_TXT_LARGE + #else + #define LV_FONT_FMT_TXT_LARGE 0 + #endif +#endif + +/** Enables/disables support for compressed fonts. */ +#ifndef LV_USE_FONT_COMPRESSED + #ifdef CONFIG_LV_USE_FONT_COMPRESSED + #define LV_USE_FONT_COMPRESSED CONFIG_LV_USE_FONT_COMPRESSED + #else + #define LV_USE_FONT_COMPRESSED 0 + #endif +#endif + +/** Enable drawing placeholders when glyph dsc is not found. */ +#ifndef LV_USE_FONT_PLACEHOLDER + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_FONT_PLACEHOLDER + #define LV_USE_FONT_PLACEHOLDER CONFIG_LV_USE_FONT_PLACEHOLDER + #else + #define LV_USE_FONT_PLACEHOLDER 0 + #endif + #else + #define LV_USE_FONT_PLACEHOLDER 1 + #endif +#endif + +/*================= + * TEXT SETTINGS + *=================*/ + +/** + * Select a character encoding for strings. + * Your IDE or editor should have the same character encoding. + * - LV_TXT_ENC_UTF8 + * - LV_TXT_ENC_ASCII + */ +#ifndef LV_TXT_ENC + #ifdef CONFIG_LV_TXT_ENC + #define LV_TXT_ENC CONFIG_LV_TXT_ENC + #else + #define LV_TXT_ENC LV_TXT_ENC_UTF8 + #endif +#endif + +/** While rendering text strings, break (wrap) text on these chars. */ +#ifndef LV_TXT_BREAK_CHARS + #ifdef CONFIG_LV_TXT_BREAK_CHARS + #define LV_TXT_BREAK_CHARS CONFIG_LV_TXT_BREAK_CHARS + #else + #define LV_TXT_BREAK_CHARS " ,.;:-_)]}" + #endif +#endif + +/** If a word is at least this long, will break wherever "prettiest". + * To disable, set to a value <= 0. */ +#ifndef LV_TXT_LINE_BREAK_LONG_LEN + #ifdef CONFIG_LV_TXT_LINE_BREAK_LONG_LEN + #define LV_TXT_LINE_BREAK_LONG_LEN CONFIG_LV_TXT_LINE_BREAK_LONG_LEN + #else + #define LV_TXT_LINE_BREAK_LONG_LEN 0 + #endif +#endif + +/** Minimum number of characters in a long word to put on a line before a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ +#ifndef LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN + #ifdef CONFIG_LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN + #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN CONFIG_LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN + #else + #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 + #endif +#endif + +/** Minimum number of characters in a long word to put on a line after a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ +#ifndef LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN + #ifdef CONFIG_LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN + #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN CONFIG_LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN + #else + #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 + #endif +#endif + +/** Support bidirectional text. Allows mixing Left-to-Right and Right-to-Left text. + * The direction will be processed according to the Unicode Bidirectional Algorithm: + * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ +#ifndef LV_USE_BIDI + #ifdef CONFIG_LV_USE_BIDI + #define LV_USE_BIDI CONFIG_LV_USE_BIDI + #else + #define LV_USE_BIDI 0 + #endif +#endif +#if LV_USE_BIDI + /*Set the default direction. Supported values: + *`LV_BASE_DIR_LTR` Left-to-Right + *`LV_BASE_DIR_RTL` Right-to-Left + *`LV_BASE_DIR_AUTO` detect text base direction*/ + #ifndef LV_BIDI_BASE_DIR_DEF + #ifdef CONFIG_LV_BIDI_BASE_DIR_DEF + #define LV_BIDI_BASE_DIR_DEF CONFIG_LV_BIDI_BASE_DIR_DEF + #else + #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO + #endif + #endif +#endif + +/** Enable Arabic/Persian processing + * In these languages characters should be replaced with another form based on their position in the text */ +#ifndef LV_USE_ARABIC_PERSIAN_CHARS + #ifdef CONFIG_LV_USE_ARABIC_PERSIAN_CHARS + #define LV_USE_ARABIC_PERSIAN_CHARS CONFIG_LV_USE_ARABIC_PERSIAN_CHARS + #else + #define LV_USE_ARABIC_PERSIAN_CHARS 0 + #endif +#endif + +/*The control character to use for signaling text recoloring*/ +#ifndef LV_TXT_COLOR_CMD + #ifdef CONFIG_LV_TXT_COLOR_CMD + #define LV_TXT_COLOR_CMD CONFIG_LV_TXT_COLOR_CMD + #else + #define LV_TXT_COLOR_CMD "#" + #endif +#endif + +/*================== + * WIDGETS + *================*/ +/* Documentation for widgets can be found here: https://docs.lvgl.io/master/widgets/index.html . */ + +/** 1: Causes these widgets to be given default values at creation time. + * - lv_buttonmatrix_t: Get default maps: {"Btn1", "Btn2", "Btn3", "\n", "Btn4", "Btn5", ""}, else map not set. + * - lv_checkbox_t : String label set to "Check box", else set to empty string. + * - lv_dropdown_t : Options set to "Option 1", "Option 2", "Option 3", else no values are set. + * - lv_roller_t : Options set to "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", else no values are set. + * - lv_label_t : Text set to "Text", else empty string. + * - lv_arclabel_t : Text set to "Arced Text", else empty string. + * */ +#ifndef LV_WIDGETS_HAS_DEFAULT_VALUE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE + #define LV_WIDGETS_HAS_DEFAULT_VALUE CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE + #else + #define LV_WIDGETS_HAS_DEFAULT_VALUE 0 + #endif + #else + #define LV_WIDGETS_HAS_DEFAULT_VALUE 1 + #endif +#endif + +#ifndef LV_USE_ANIMIMG + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_ANIMIMG + #define LV_USE_ANIMIMG CONFIG_LV_USE_ANIMIMG + #else + #define LV_USE_ANIMIMG 0 + #endif + #else + #define LV_USE_ANIMIMG 1 + #endif +#endif + +#ifndef LV_USE_ARC + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_ARC + #define LV_USE_ARC CONFIG_LV_USE_ARC + #else + #define LV_USE_ARC 0 + #endif + #else + #define LV_USE_ARC 1 + #endif +#endif + +#ifndef LV_USE_ARCLABEL + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_ARCLABEL + #define LV_USE_ARCLABEL CONFIG_LV_USE_ARCLABEL + #else + #define LV_USE_ARCLABEL 0 + #endif + #else + #define LV_USE_ARCLABEL 1 + #endif +#endif + +#ifndef LV_USE_BAR + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_BAR + #define LV_USE_BAR CONFIG_LV_USE_BAR + #else + #define LV_USE_BAR 0 + #endif + #else + #define LV_USE_BAR 1 + #endif +#endif + +#ifndef LV_USE_BUTTON + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_BUTTON + #define LV_USE_BUTTON CONFIG_LV_USE_BUTTON + #else + #define LV_USE_BUTTON 0 + #endif + #else + #define LV_USE_BUTTON 1 + #endif +#endif + +#ifndef LV_USE_BUTTONMATRIX + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_BUTTONMATRIX + #define LV_USE_BUTTONMATRIX CONFIG_LV_USE_BUTTONMATRIX + #else + #define LV_USE_BUTTONMATRIX 0 + #endif + #else + #define LV_USE_BUTTONMATRIX 1 + #endif +#endif + +#ifndef LV_USE_CALENDAR + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_CALENDAR + #define LV_USE_CALENDAR CONFIG_LV_USE_CALENDAR + #else + #define LV_USE_CALENDAR 0 + #endif + #else + #define LV_USE_CALENDAR 1 + #endif +#endif +#if LV_USE_CALENDAR + #ifndef LV_CALENDAR_WEEK_STARTS_MONDAY + #ifdef CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY + #define LV_CALENDAR_WEEK_STARTS_MONDAY CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY + #else + #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 + #endif + #endif + #if LV_CALENDAR_WEEK_STARTS_MONDAY + #ifndef LV_CALENDAR_DEFAULT_DAY_NAMES + #ifdef CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES + #define LV_CALENDAR_DEFAULT_DAY_NAMES CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES + #else + #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} + #endif + #endif + #else + #ifndef LV_CALENDAR_DEFAULT_DAY_NAMES + #ifdef CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES + #define LV_CALENDAR_DEFAULT_DAY_NAMES CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES + #else + #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} + #endif + #endif + #endif + + #ifndef LV_CALENDAR_DEFAULT_MONTH_NAMES + #ifdef CONFIG_LV_CALENDAR_DEFAULT_MONTH_NAMES + #define LV_CALENDAR_DEFAULT_MONTH_NAMES CONFIG_LV_CALENDAR_DEFAULT_MONTH_NAMES + #else + #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} + #endif + #endif + #ifndef LV_USE_CALENDAR_HEADER_ARROW + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_CALENDAR_HEADER_ARROW + #define LV_USE_CALENDAR_HEADER_ARROW CONFIG_LV_USE_CALENDAR_HEADER_ARROW + #else + #define LV_USE_CALENDAR_HEADER_ARROW 0 + #endif + #else + #define LV_USE_CALENDAR_HEADER_ARROW 1 + #endif + #endif + #ifndef LV_USE_CALENDAR_HEADER_DROPDOWN + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN + #define LV_USE_CALENDAR_HEADER_DROPDOWN CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN + #else + #define LV_USE_CALENDAR_HEADER_DROPDOWN 0 + #endif + #else + #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 + #endif + #endif + #ifndef LV_USE_CALENDAR_CHINESE + #ifdef CONFIG_LV_USE_CALENDAR_CHINESE + #define LV_USE_CALENDAR_CHINESE CONFIG_LV_USE_CALENDAR_CHINESE + #else + #define LV_USE_CALENDAR_CHINESE 0 + #endif + #endif +#endif /*LV_USE_CALENDAR*/ + +#ifndef LV_USE_CANVAS + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_CANVAS + #define LV_USE_CANVAS CONFIG_LV_USE_CANVAS + #else + #define LV_USE_CANVAS 0 + #endif + #else + #define LV_USE_CANVAS 1 + #endif +#endif + +#ifndef LV_USE_CHART + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_CHART + #define LV_USE_CHART CONFIG_LV_USE_CHART + #else + #define LV_USE_CHART 0 + #endif + #else + #define LV_USE_CHART 1 + #endif +#endif + +#ifndef LV_USE_CHECKBOX + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_CHECKBOX + #define LV_USE_CHECKBOX CONFIG_LV_USE_CHECKBOX + #else + #define LV_USE_CHECKBOX 0 + #endif + #else + #define LV_USE_CHECKBOX 1 + #endif +#endif + +#ifndef LV_USE_DROPDOWN + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_DROPDOWN + #define LV_USE_DROPDOWN CONFIG_LV_USE_DROPDOWN + #else + #define LV_USE_DROPDOWN 0 + #endif + #else + #define LV_USE_DROPDOWN 1 /**< Requires: lv_label */ + #endif +#endif + +#ifndef LV_USE_IMAGE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_IMAGE + #define LV_USE_IMAGE CONFIG_LV_USE_IMAGE + #else + #define LV_USE_IMAGE 0 + #endif + #else + #define LV_USE_IMAGE 1 /**< Requires: lv_label */ + #endif +#endif + +#ifndef LV_USE_IMAGEBUTTON + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_IMAGEBUTTON + #define LV_USE_IMAGEBUTTON CONFIG_LV_USE_IMAGEBUTTON + #else + #define LV_USE_IMAGEBUTTON 0 + #endif + #else + #define LV_USE_IMAGEBUTTON 1 + #endif +#endif + +#ifndef LV_USE_KEYBOARD + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_KEYBOARD + #define LV_USE_KEYBOARD CONFIG_LV_USE_KEYBOARD + #else + #define LV_USE_KEYBOARD 0 + #endif + #else + #define LV_USE_KEYBOARD 1 + #endif +#endif + +#ifndef LV_USE_LABEL + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_LABEL + #define LV_USE_LABEL CONFIG_LV_USE_LABEL + #else + #define LV_USE_LABEL 0 + #endif + #else + #define LV_USE_LABEL 1 + #endif +#endif +#if LV_USE_LABEL + #ifndef LV_LABEL_TEXT_SELECTION + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LABEL_TEXT_SELECTION + #define LV_LABEL_TEXT_SELECTION CONFIG_LV_LABEL_TEXT_SELECTION + #else + #define LV_LABEL_TEXT_SELECTION 0 + #endif + #else + #define LV_LABEL_TEXT_SELECTION 1 /**< Enable selecting text of the label */ + #endif + #endif + #ifndef LV_LABEL_LONG_TXT_HINT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LABEL_LONG_TXT_HINT + #define LV_LABEL_LONG_TXT_HINT CONFIG_LV_LABEL_LONG_TXT_HINT + #else + #define LV_LABEL_LONG_TXT_HINT 0 + #endif + #else + #define LV_LABEL_LONG_TXT_HINT 1 /**< Store some extra info in labels to speed up drawing of very long text */ + #endif + #endif + #ifndef LV_LABEL_WAIT_CHAR_COUNT + #ifdef CONFIG_LV_LABEL_WAIT_CHAR_COUNT + #define LV_LABEL_WAIT_CHAR_COUNT CONFIG_LV_LABEL_WAIT_CHAR_COUNT + #else + #define LV_LABEL_WAIT_CHAR_COUNT 3 /**< The count of wait chart */ + #endif + #endif +#endif + +#ifndef LV_USE_LED + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_LED + #define LV_USE_LED CONFIG_LV_USE_LED + #else + #define LV_USE_LED 0 + #endif + #else + #define LV_USE_LED 1 + #endif +#endif + +#ifndef LV_USE_LINE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_LINE + #define LV_USE_LINE CONFIG_LV_USE_LINE + #else + #define LV_USE_LINE 0 + #endif + #else + #define LV_USE_LINE 1 + #endif +#endif + +#ifndef LV_USE_LIST + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_LIST + #define LV_USE_LIST CONFIG_LV_USE_LIST + #else + #define LV_USE_LIST 0 + #endif + #else + #define LV_USE_LIST 1 + #endif +#endif + +#ifndef LV_USE_LOTTIE + #ifdef CONFIG_LV_USE_LOTTIE + #define LV_USE_LOTTIE CONFIG_LV_USE_LOTTIE + #else + #define LV_USE_LOTTIE 0 /**< Requires: lv_canvas, thorvg */ + #endif +#endif + +#ifndef LV_USE_MENU + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_MENU + #define LV_USE_MENU CONFIG_LV_USE_MENU + #else + #define LV_USE_MENU 0 + #endif + #else + #define LV_USE_MENU 1 + #endif +#endif + +#ifndef LV_USE_MSGBOX + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_MSGBOX + #define LV_USE_MSGBOX CONFIG_LV_USE_MSGBOX + #else + #define LV_USE_MSGBOX 0 + #endif + #else + #define LV_USE_MSGBOX 1 + #endif +#endif + +#ifndef LV_USE_ROLLER + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_ROLLER + #define LV_USE_ROLLER CONFIG_LV_USE_ROLLER + #else + #define LV_USE_ROLLER 0 + #endif + #else + #define LV_USE_ROLLER 1 /**< Requires: lv_label */ + #endif +#endif + +#ifndef LV_USE_SCALE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_SCALE + #define LV_USE_SCALE CONFIG_LV_USE_SCALE + #else + #define LV_USE_SCALE 0 + #endif + #else + #define LV_USE_SCALE 1 + #endif +#endif + +#ifndef LV_USE_SLIDER + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_SLIDER + #define LV_USE_SLIDER CONFIG_LV_USE_SLIDER + #else + #define LV_USE_SLIDER 0 + #endif + #else + #define LV_USE_SLIDER 1 /**< Requires: lv_bar */ + #endif +#endif + +#ifndef LV_USE_SPAN + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_SPAN + #define LV_USE_SPAN CONFIG_LV_USE_SPAN + #else + #define LV_USE_SPAN 0 + #endif + #else + #define LV_USE_SPAN 1 + #endif +#endif +#if LV_USE_SPAN + /** A line of text can contain this maximum number of span descriptors. */ + #ifndef LV_SPAN_SNIPPET_STACK_SIZE + #ifdef CONFIG_LV_SPAN_SNIPPET_STACK_SIZE + #define LV_SPAN_SNIPPET_STACK_SIZE CONFIG_LV_SPAN_SNIPPET_STACK_SIZE + #else + #define LV_SPAN_SNIPPET_STACK_SIZE 64 + #endif + #endif +#endif + +#ifndef LV_USE_SPINBOX + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_SPINBOX + #define LV_USE_SPINBOX CONFIG_LV_USE_SPINBOX + #else + #define LV_USE_SPINBOX 0 + #endif + #else + #define LV_USE_SPINBOX 1 + #endif +#endif + +#ifndef LV_USE_SPINNER + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_SPINNER + #define LV_USE_SPINNER CONFIG_LV_USE_SPINNER + #else + #define LV_USE_SPINNER 0 + #endif + #else + #define LV_USE_SPINNER 1 + #endif +#endif + +#ifndef LV_USE_SWITCH + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_SWITCH + #define LV_USE_SWITCH CONFIG_LV_USE_SWITCH + #else + #define LV_USE_SWITCH 0 + #endif + #else + #define LV_USE_SWITCH 1 + #endif +#endif + +#ifndef LV_USE_TABLE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_TABLE + #define LV_USE_TABLE CONFIG_LV_USE_TABLE + #else + #define LV_USE_TABLE 0 + #endif + #else + #define LV_USE_TABLE 1 + #endif +#endif + +#ifndef LV_USE_TABVIEW + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_TABVIEW + #define LV_USE_TABVIEW CONFIG_LV_USE_TABVIEW + #else + #define LV_USE_TABVIEW 0 + #endif + #else + #define LV_USE_TABVIEW 1 + #endif +#endif + +#ifndef LV_USE_TEXTAREA + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_TEXTAREA + #define LV_USE_TEXTAREA CONFIG_LV_USE_TEXTAREA + #else + #define LV_USE_TEXTAREA 0 + #endif + #else + #define LV_USE_TEXTAREA 1 /**< Requires: lv_label */ + #endif +#endif +#if LV_USE_TEXTAREA != 0 + #ifndef LV_TEXTAREA_DEF_PWD_SHOW_TIME + #ifdef CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME + #define LV_TEXTAREA_DEF_PWD_SHOW_TIME CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME + #else + #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /**< [ms] */ + #endif + #endif +#endif + +#ifndef LV_USE_TILEVIEW + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_TILEVIEW + #define LV_USE_TILEVIEW CONFIG_LV_USE_TILEVIEW + #else + #define LV_USE_TILEVIEW 0 + #endif + #else + #define LV_USE_TILEVIEW 1 + #endif +#endif + +#ifndef LV_USE_WIN + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_WIN + #define LV_USE_WIN CONFIG_LV_USE_WIN + #else + #define LV_USE_WIN 0 + #endif + #else + #define LV_USE_WIN 1 + #endif +#endif + +#ifndef LV_USE_3DTEXTURE + #ifdef CONFIG_LV_USE_3DTEXTURE + #define LV_USE_3DTEXTURE CONFIG_LV_USE_3DTEXTURE + #else + #define LV_USE_3DTEXTURE 0 + #endif +#endif + +/*================== + * THEMES + *==================*/ +/* Documentation for themes can be found here: https://docs.lvgl.io/master/common-widget-features/styles/styles.html#themes . */ + +/** A simple, impressive and very complete theme */ +#ifndef LV_USE_THEME_DEFAULT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_THEME_DEFAULT + #define LV_USE_THEME_DEFAULT CONFIG_LV_USE_THEME_DEFAULT + #else + #define LV_USE_THEME_DEFAULT 0 + #endif + #else + #define LV_USE_THEME_DEFAULT 1 + #endif +#endif +#if LV_USE_THEME_DEFAULT + /** 0: Light mode; 1: Dark mode */ + #ifndef LV_THEME_DEFAULT_DARK + #ifdef CONFIG_LV_THEME_DEFAULT_DARK + #define LV_THEME_DEFAULT_DARK CONFIG_LV_THEME_DEFAULT_DARK + #else + #define LV_THEME_DEFAULT_DARK 0 + #endif + #endif + + /** 1: Enable grow on press */ + #ifndef LV_THEME_DEFAULT_GROW + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_THEME_DEFAULT_GROW + #define LV_THEME_DEFAULT_GROW CONFIG_LV_THEME_DEFAULT_GROW + #else + #define LV_THEME_DEFAULT_GROW 0 + #endif + #else + #define LV_THEME_DEFAULT_GROW 1 + #endif + #endif + + /** Default transition time in ms. */ + #ifndef LV_THEME_DEFAULT_TRANSITION_TIME + #ifdef CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME + #define LV_THEME_DEFAULT_TRANSITION_TIME CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME + #else + #define LV_THEME_DEFAULT_TRANSITION_TIME 80 + #endif + #endif +#endif /*LV_USE_THEME_DEFAULT*/ + +/** A very simple theme that is a good starting point for a custom theme */ +#ifndef LV_USE_THEME_SIMPLE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_THEME_SIMPLE + #define LV_USE_THEME_SIMPLE CONFIG_LV_USE_THEME_SIMPLE + #else + #define LV_USE_THEME_SIMPLE 0 + #endif + #else + #define LV_USE_THEME_SIMPLE 1 + #endif +#endif + +/** A theme designed for monochrome displays */ +#ifndef LV_USE_THEME_MONO + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_THEME_MONO + #define LV_USE_THEME_MONO CONFIG_LV_USE_THEME_MONO + #else + #define LV_USE_THEME_MONO 0 + #endif + #else + #define LV_USE_THEME_MONO 1 + #endif +#endif + +/*================== + * LAYOUTS + *==================*/ +/* Documentation for layouts can be found here: https://docs.lvgl.io/master/common-widget-features/layouts/index.html . */ + +/** A layout similar to Flexbox in CSS. */ +#ifndef LV_USE_FLEX + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_FLEX + #define LV_USE_FLEX CONFIG_LV_USE_FLEX + #else + #define LV_USE_FLEX 0 + #endif + #else + #define LV_USE_FLEX 1 + #endif +#endif + +/** A layout similar to Grid in CSS. */ +#ifndef LV_USE_GRID + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_GRID + #define LV_USE_GRID CONFIG_LV_USE_GRID + #else + #define LV_USE_GRID 0 + #endif + #else + #define LV_USE_GRID 1 + #endif +#endif + +/*==================== + * 3RD PARTS LIBRARIES + *====================*/ +/* Documentation for libraries can be found here: https://docs.lvgl.io/master/libs/index.html . */ + +/* File system interfaces for common APIs */ + +/** Setting a default driver letter allows skipping the driver prefix in filepaths. + * Documentation about how to use the below driver-identifier letters can be found at + * https://docs.lvgl.io/master/main-modules/fs.html#lv-fs-identifier-letters . */ +#ifndef LV_FS_DEFAULT_DRIVER_LETTER + #ifdef CONFIG_LV_FS_DEFAULT_DRIVER_LETTER + #define LV_FS_DEFAULT_DRIVER_LETTER CONFIG_LV_FS_DEFAULT_DRIVER_LETTER + #else + #define LV_FS_DEFAULT_DRIVER_LETTER '\0' + #endif +#endif + +/** API for fopen, fread, etc. */ +#ifndef LV_USE_FS_STDIO + #ifdef CONFIG_LV_USE_FS_STDIO + #define LV_USE_FS_STDIO CONFIG_LV_USE_FS_STDIO + #else + #define LV_USE_FS_STDIO 0 + #endif +#endif +#if LV_USE_FS_STDIO + #ifndef LV_FS_STDIO_LETTER + #ifdef CONFIG_LV_FS_STDIO_LETTER + #define LV_FS_STDIO_LETTER CONFIG_LV_FS_STDIO_LETTER + #else + #define LV_FS_STDIO_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #endif + #endif + #ifndef LV_FS_STDIO_PATH + #ifdef CONFIG_LV_FS_STDIO_PATH + #define LV_FS_STDIO_PATH CONFIG_LV_FS_STDIO_PATH + #else + #define LV_FS_STDIO_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #endif + #endif + #ifndef LV_FS_STDIO_CACHE_SIZE + #ifdef CONFIG_LV_FS_STDIO_CACHE_SIZE + #define LV_FS_STDIO_CACHE_SIZE CONFIG_LV_FS_STDIO_CACHE_SIZE + #else + #define LV_FS_STDIO_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ + #endif + #endif +#endif + +/** API for open, read, etc. */ +#ifndef LV_USE_FS_POSIX + #ifdef CONFIG_LV_USE_FS_POSIX + #define LV_USE_FS_POSIX CONFIG_LV_USE_FS_POSIX + #else + #define LV_USE_FS_POSIX 0 + #endif +#endif +#if LV_USE_FS_POSIX + #ifndef LV_FS_POSIX_LETTER + #ifdef CONFIG_LV_FS_POSIX_LETTER + #define LV_FS_POSIX_LETTER CONFIG_LV_FS_POSIX_LETTER + #else + #define LV_FS_POSIX_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #endif + #endif + #ifndef LV_FS_POSIX_PATH + #ifdef CONFIG_LV_FS_POSIX_PATH + #define LV_FS_POSIX_PATH CONFIG_LV_FS_POSIX_PATH + #else + #define LV_FS_POSIX_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #endif + #endif + #ifndef LV_FS_POSIX_CACHE_SIZE + #ifdef CONFIG_LV_FS_POSIX_CACHE_SIZE + #define LV_FS_POSIX_CACHE_SIZE CONFIG_LV_FS_POSIX_CACHE_SIZE + #else + #define LV_FS_POSIX_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ + #endif + #endif +#endif + +/** API for CreateFile, ReadFile, etc. */ +#ifndef LV_USE_FS_WIN32 + #ifdef CONFIG_LV_USE_FS_WIN32 + #define LV_USE_FS_WIN32 CONFIG_LV_USE_FS_WIN32 + #else + #define LV_USE_FS_WIN32 0 + #endif +#endif +#if LV_USE_FS_WIN32 + #ifndef LV_FS_WIN32_LETTER + #ifdef CONFIG_LV_FS_WIN32_LETTER + #define LV_FS_WIN32_LETTER CONFIG_LV_FS_WIN32_LETTER + #else + #define LV_FS_WIN32_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #endif + #endif + #ifndef LV_FS_WIN32_PATH + #ifdef CONFIG_LV_FS_WIN32_PATH + #define LV_FS_WIN32_PATH CONFIG_LV_FS_WIN32_PATH + #else + #define LV_FS_WIN32_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #endif + #endif + #ifndef LV_FS_WIN32_CACHE_SIZE + #ifdef CONFIG_LV_FS_WIN32_CACHE_SIZE + #define LV_FS_WIN32_CACHE_SIZE CONFIG_LV_FS_WIN32_CACHE_SIZE + #else + #define LV_FS_WIN32_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ + #endif + #endif +#endif + +/** API for FATFS (needs to be added separately). Uses f_open, f_read, etc. */ +#ifndef LV_USE_FS_FATFS + #ifdef CONFIG_LV_USE_FS_FATFS + #define LV_USE_FS_FATFS CONFIG_LV_USE_FS_FATFS + #else + #define LV_USE_FS_FATFS 0 + #endif +#endif +#if LV_USE_FS_FATFS + #ifndef LV_FS_FATFS_LETTER + #ifdef CONFIG_LV_FS_FATFS_LETTER + #define LV_FS_FATFS_LETTER CONFIG_LV_FS_FATFS_LETTER + #else + #define LV_FS_FATFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #endif + #endif + #ifndef LV_FS_FATFS_PATH + #ifdef CONFIG_LV_FS_FATFS_PATH + #define LV_FS_FATFS_PATH CONFIG_LV_FS_FATFS_PATH + #else + #define LV_FS_FATFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #endif + #endif + #ifndef LV_FS_FATFS_CACHE_SIZE + #ifdef CONFIG_LV_FS_FATFS_CACHE_SIZE + #define LV_FS_FATFS_CACHE_SIZE CONFIG_LV_FS_FATFS_CACHE_SIZE + #else + #define LV_FS_FATFS_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ + #endif + #endif +#endif + +/** API for memory-mapped file access. */ +#ifndef LV_USE_FS_MEMFS + #ifdef CONFIG_LV_USE_FS_MEMFS + #define LV_USE_FS_MEMFS CONFIG_LV_USE_FS_MEMFS + #else + #define LV_USE_FS_MEMFS 0 + #endif +#endif +#if LV_USE_FS_MEMFS + #ifndef LV_FS_MEMFS_LETTER + #ifdef CONFIG_LV_FS_MEMFS_LETTER + #define LV_FS_MEMFS_LETTER CONFIG_LV_FS_MEMFS_LETTER + #else + #define LV_FS_MEMFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #endif + #endif +#endif + +/** API for LittleFs. */ +#ifndef LV_USE_FS_LITTLEFS + #ifdef CONFIG_LV_USE_FS_LITTLEFS + #define LV_USE_FS_LITTLEFS CONFIG_LV_USE_FS_LITTLEFS + #else + #define LV_USE_FS_LITTLEFS 0 + #endif +#endif +#if LV_USE_FS_LITTLEFS + #ifndef LV_FS_LITTLEFS_LETTER + #ifdef CONFIG_LV_FS_LITTLEFS_LETTER + #define LV_FS_LITTLEFS_LETTER CONFIG_LV_FS_LITTLEFS_LETTER + #else + #define LV_FS_LITTLEFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #endif + #endif + #ifndef LV_FS_LITTLEFS_PATH + #ifdef CONFIG_LV_FS_LITTLEFS_PATH + #define LV_FS_LITTLEFS_PATH CONFIG_LV_FS_LITTLEFS_PATH + #else + #define LV_FS_LITTLEFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #endif + #endif +#endif + +/** API for Arduino LittleFs. */ +#ifndef LV_USE_FS_ARDUINO_ESP_LITTLEFS + #ifdef CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS + #define LV_USE_FS_ARDUINO_ESP_LITTLEFS CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS + #else + #define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0 + #endif +#endif +#if LV_USE_FS_ARDUINO_ESP_LITTLEFS + #ifndef LV_FS_ARDUINO_ESP_LITTLEFS_LETTER + #ifdef CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_LETTER + #define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_LETTER + #else + #define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #endif + #endif + #ifndef LV_FS_ARDUINO_ESP_LITTLEFS_PATH + #ifdef CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_PATH + #define LV_FS_ARDUINO_ESP_LITTLEFS_PATH CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_PATH + #else + #define LV_FS_ARDUINO_ESP_LITTLEFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #endif + #endif +#endif + +/** API for Arduino Sd. */ +#ifndef LV_USE_FS_ARDUINO_SD + #ifdef CONFIG_LV_USE_FS_ARDUINO_SD + #define LV_USE_FS_ARDUINO_SD CONFIG_LV_USE_FS_ARDUINO_SD + #else + #define LV_USE_FS_ARDUINO_SD 0 + #endif +#endif +#if LV_USE_FS_ARDUINO_SD + #ifndef LV_FS_ARDUINO_SD_LETTER + #ifdef CONFIG_LV_FS_ARDUINO_SD_LETTER + #define LV_FS_ARDUINO_SD_LETTER CONFIG_LV_FS_ARDUINO_SD_LETTER + #else + #define LV_FS_ARDUINO_SD_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #endif + #endif + #ifndef LV_FS_ARDUINO_SD_PATH + #ifdef CONFIG_LV_FS_ARDUINO_SD_PATH + #define LV_FS_ARDUINO_SD_PATH CONFIG_LV_FS_ARDUINO_SD_PATH + #else + #define LV_FS_ARDUINO_SD_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #endif + #endif +#endif + +/** API for UEFI */ +#ifndef LV_USE_FS_UEFI + #ifdef CONFIG_LV_USE_FS_UEFI + #define LV_USE_FS_UEFI CONFIG_LV_USE_FS_UEFI + #else + #define LV_USE_FS_UEFI 0 + #endif +#endif +#if LV_USE_FS_UEFI + #ifndef LV_FS_UEFI_LETTER + #ifdef CONFIG_LV_FS_UEFI_LETTER + #define LV_FS_UEFI_LETTER CONFIG_LV_FS_UEFI_LETTER + #else + #define LV_FS_UEFI_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #endif + #endif +#endif + +#ifndef LV_USE_FS_FROGFS + #ifdef CONFIG_LV_USE_FS_FROGFS + #define LV_USE_FS_FROGFS CONFIG_LV_USE_FS_FROGFS + #else + #define LV_USE_FS_FROGFS 0 + #endif +#endif +#if LV_USE_FS_FROGFS + #ifndef LV_FS_FROGFS_LETTER + #ifdef CONFIG_LV_FS_FROGFS_LETTER + #define LV_FS_FROGFS_LETTER CONFIG_LV_FS_FROGFS_LETTER + #else + #define LV_FS_FROGFS_LETTER '\0' + #endif + #endif +#endif + +/** LODEPNG decoder library */ +#ifndef LV_USE_LODEPNG + #ifdef CONFIG_LV_USE_LODEPNG + #define LV_USE_LODEPNG CONFIG_LV_USE_LODEPNG + #else + #define LV_USE_LODEPNG 0 + #endif +#endif + +/** PNG decoder(libpng) library */ +#ifndef LV_USE_LIBPNG + #ifdef CONFIG_LV_USE_LIBPNG + #define LV_USE_LIBPNG CONFIG_LV_USE_LIBPNG + #else + #define LV_USE_LIBPNG 0 + #endif +#endif + +/** BMP decoder library */ +#ifndef LV_USE_BMP + #ifdef CONFIG_LV_USE_BMP + #define LV_USE_BMP CONFIG_LV_USE_BMP + #else + #define LV_USE_BMP 0 + #endif +#endif + +/** JPG + split JPG decoder library. + * Split JPG is a custom format optimized for embedded systems. */ +#ifndef LV_USE_TJPGD + #ifdef CONFIG_LV_USE_TJPGD + #define LV_USE_TJPGD CONFIG_LV_USE_TJPGD + #else + #define LV_USE_TJPGD 0 + #endif +#endif + +/** libjpeg-turbo decoder library. + * - Supports complete JPEG specifications and high-performance JPEG decoding. */ +#ifndef LV_USE_LIBJPEG_TURBO + #ifdef CONFIG_LV_USE_LIBJPEG_TURBO + #define LV_USE_LIBJPEG_TURBO CONFIG_LV_USE_LIBJPEG_TURBO + #else + #define LV_USE_LIBJPEG_TURBO 0 + #endif +#endif + +/** WebP decoder library */ +#ifndef LV_USE_LIBWEBP + #ifdef CONFIG_LV_USE_LIBWEBP + #define LV_USE_LIBWEBP CONFIG_LV_USE_LIBWEBP + #else + #define LV_USE_LIBWEBP 0 + #endif +#endif + +/** GIF decoder library */ +#ifndef LV_USE_GIF + #ifdef CONFIG_LV_USE_GIF + #define LV_USE_GIF CONFIG_LV_USE_GIF + #else + #define LV_USE_GIF 0 + #endif +#endif +#if LV_USE_GIF + /** GIF decoder accelerate */ + #ifndef LV_GIF_CACHE_DECODE_DATA + #ifdef CONFIG_LV_GIF_CACHE_DECODE_DATA + #define LV_GIF_CACHE_DECODE_DATA CONFIG_LV_GIF_CACHE_DECODE_DATA + #else + #define LV_GIF_CACHE_DECODE_DATA 0 + #endif + #endif +#endif + +/** GStreamer library */ +#ifndef LV_USE_GSTREAMER + #ifdef CONFIG_LV_USE_GSTREAMER + #define LV_USE_GSTREAMER CONFIG_LV_USE_GSTREAMER + #else + #define LV_USE_GSTREAMER 0 + #endif +#endif + +/** Decode bin images to RAM */ +#ifndef LV_BIN_DECODER_RAM_LOAD + #ifdef CONFIG_LV_BIN_DECODER_RAM_LOAD + #define LV_BIN_DECODER_RAM_LOAD CONFIG_LV_BIN_DECODER_RAM_LOAD + #else + #define LV_BIN_DECODER_RAM_LOAD 0 + #endif +#endif + +/** RLE decompress library */ +#ifndef LV_USE_RLE + #ifdef CONFIG_LV_USE_RLE + #define LV_USE_RLE CONFIG_LV_USE_RLE + #else + #define LV_USE_RLE 0 + #endif +#endif + +/** QR code library */ +#ifndef LV_USE_QRCODE + #ifdef CONFIG_LV_USE_QRCODE + #define LV_USE_QRCODE CONFIG_LV_USE_QRCODE + #else + #define LV_USE_QRCODE 0 + #endif +#endif + +/** Barcode code library */ +#ifndef LV_USE_BARCODE + #ifdef CONFIG_LV_USE_BARCODE + #define LV_USE_BARCODE CONFIG_LV_USE_BARCODE + #else + #define LV_USE_BARCODE 0 + #endif +#endif + +/** FreeType library */ +#ifndef LV_USE_FREETYPE + #ifdef CONFIG_LV_USE_FREETYPE + #define LV_USE_FREETYPE CONFIG_LV_USE_FREETYPE + #else + #define LV_USE_FREETYPE 0 + #endif +#endif +#if LV_USE_FREETYPE + /** Let FreeType use LVGL memory and file porting */ + #ifndef LV_FREETYPE_USE_LVGL_PORT + #ifdef CONFIG_LV_FREETYPE_USE_LVGL_PORT + #define LV_FREETYPE_USE_LVGL_PORT CONFIG_LV_FREETYPE_USE_LVGL_PORT + #else + #define LV_FREETYPE_USE_LVGL_PORT 0 + #endif + #endif + + /** Cache count of glyphs in FreeType, i.e. number of glyphs that can be cached. + * The higher the value, the more memory will be used. */ + #ifndef LV_FREETYPE_CACHE_FT_GLYPH_CNT + #ifdef CONFIG_LV_FREETYPE_CACHE_FT_GLYPH_CNT + #define LV_FREETYPE_CACHE_FT_GLYPH_CNT CONFIG_LV_FREETYPE_CACHE_FT_GLYPH_CNT + #else + #define LV_FREETYPE_CACHE_FT_GLYPH_CNT 256 + #endif + #endif + + /** Enable L1 glyph metrics cache for FreeType. + * A per-font, lock-free, 2-way set-associative cache that accelerates + * repeated glyph metric lookups. Automatically disabled when an OS is + * configured (LV_USE_OS != LV_OS_NONE) because the cache is not + * thread-safe. */ + #ifndef LV_FREETYPE_CACHE_FT_GLYPH_L1 + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_FREETYPE_CACHE_FT_GLYPH_L1 + #define LV_FREETYPE_CACHE_FT_GLYPH_L1 CONFIG_LV_FREETYPE_CACHE_FT_GLYPH_L1 + #else + #define LV_FREETYPE_CACHE_FT_GLYPH_L1 0 + #endif + #else + #define LV_FREETYPE_CACHE_FT_GLYPH_L1 1 + #endif + #endif +#endif + +/** Built-in TTF decoder */ +#ifndef LV_USE_TINY_TTF + #ifdef CONFIG_LV_USE_TINY_TTF + #define LV_USE_TINY_TTF CONFIG_LV_USE_TINY_TTF + #else + #define LV_USE_TINY_TTF 0 + #endif +#endif +#if LV_USE_TINY_TTF + /* Enable loading TTF data from files */ + #ifndef LV_TINY_TTF_FILE_SUPPORT + #ifdef CONFIG_LV_TINY_TTF_FILE_SUPPORT + #define LV_TINY_TTF_FILE_SUPPORT CONFIG_LV_TINY_TTF_FILE_SUPPORT + #else + #define LV_TINY_TTF_FILE_SUPPORT 0 + #endif + #endif + #ifndef LV_TINY_TTF_CACHE_GLYPH_CNT + #ifdef CONFIG_LV_TINY_TTF_CACHE_GLYPH_CNT + #define LV_TINY_TTF_CACHE_GLYPH_CNT CONFIG_LV_TINY_TTF_CACHE_GLYPH_CNT + #else + #define LV_TINY_TTF_CACHE_GLYPH_CNT 128 + #endif + #endif + #ifndef LV_TINY_TTF_CACHE_KERNING_CNT + #ifdef CONFIG_LV_TINY_TTF_CACHE_KERNING_CNT + #define LV_TINY_TTF_CACHE_KERNING_CNT CONFIG_LV_TINY_TTF_CACHE_KERNING_CNT + #else + #define LV_TINY_TTF_CACHE_KERNING_CNT 256 + #endif + #endif +#endif + +/** Rlottie library */ +#ifndef LV_USE_RLOTTIE + #ifdef CONFIG_LV_USE_RLOTTIE + #define LV_USE_RLOTTIE CONFIG_LV_USE_RLOTTIE + #else + #define LV_USE_RLOTTIE 0 + #endif +#endif + +/** Requires `LV_USE_3DTEXTURE = 1` */ +#ifndef LV_USE_GLTF + #ifdef CONFIG_LV_USE_GLTF + #define LV_USE_GLTF CONFIG_LV_USE_GLTF + #else + #define LV_USE_GLTF 0 + #endif +#endif + +/** Enable Vector Graphic APIs + * Requires `LV_USE_MATRIX = 1` + * and a rendering engine supporting vector graphics, e.g. + * (LV_USE_DRAW_SW and LV_USE_THORVG) or LV_USE_DRAW_VG_LITE or LV_USE_NEMA_VG. */ +#ifndef LV_USE_VECTOR_GRAPHIC + #ifdef CONFIG_LV_USE_VECTOR_GRAPHIC + #define LV_USE_VECTOR_GRAPHIC CONFIG_LV_USE_VECTOR_GRAPHIC + #else + #define LV_USE_VECTOR_GRAPHIC 0 + #endif +#endif + +/** Enable ThorVG (vector graphics library) from the src/libs folder. + * Requires LV_USE_VECTOR_GRAPHIC */ +#ifndef LV_USE_THORVG_INTERNAL + #ifdef CONFIG_LV_USE_THORVG_INTERNAL + #define LV_USE_THORVG_INTERNAL CONFIG_LV_USE_THORVG_INTERNAL + #else + #define LV_USE_THORVG_INTERNAL 0 + #endif +#endif + +/** Enable ThorVG by assuming that its installed and linked to the project + * Requires LV_USE_VECTOR_GRAPHIC */ +#ifndef LV_USE_THORVG_EXTERNAL + #ifdef CONFIG_LV_USE_THORVG_EXTERNAL + #define LV_USE_THORVG_EXTERNAL CONFIG_LV_USE_THORVG_EXTERNAL + #else + #define LV_USE_THORVG_EXTERNAL 0 + #endif +#endif + +/** Enable NanoVG (vector graphics library) */ +#ifndef LV_USE_NANOVG + #ifdef CONFIG_LV_USE_NANOVG + #define LV_USE_NANOVG CONFIG_LV_USE_NANOVG + #else + #define LV_USE_NANOVG 0 + #endif +#endif + +/** Use lvgl built-in LZ4 lib */ +#ifndef LV_USE_LZ4_INTERNAL + #ifdef CONFIG_LV_USE_LZ4_INTERNAL + #define LV_USE_LZ4_INTERNAL CONFIG_LV_USE_LZ4_INTERNAL + #else + #define LV_USE_LZ4_INTERNAL 0 + #endif +#endif + +/** Use external LZ4 library */ +#ifndef LV_USE_LZ4_EXTERNAL + #ifdef CONFIG_LV_USE_LZ4_EXTERNAL + #define LV_USE_LZ4_EXTERNAL CONFIG_LV_USE_LZ4_EXTERNAL + #else + #define LV_USE_LZ4_EXTERNAL 0 + #endif +#endif + +/*SVG library + * - Requires `LV_USE_VECTOR_GRAPHIC = 1` */ +#ifndef LV_USE_SVG + #ifdef CONFIG_LV_USE_SVG + #define LV_USE_SVG CONFIG_LV_USE_SVG + #else + #define LV_USE_SVG 0 + #endif +#endif +#ifndef LV_USE_SVG_ANIMATION + #ifdef CONFIG_LV_USE_SVG_ANIMATION + #define LV_USE_SVG_ANIMATION CONFIG_LV_USE_SVG_ANIMATION + #else + #define LV_USE_SVG_ANIMATION 0 + #endif +#endif +#ifndef LV_USE_SVG_DEBUG + #ifdef CONFIG_LV_USE_SVG_DEBUG + #define LV_USE_SVG_DEBUG CONFIG_LV_USE_SVG_DEBUG + #else + #define LV_USE_SVG_DEBUG 0 + #endif +#endif + +/** FFmpeg library for image decoding and playing videos. + * Supports all major image formats so do not enable other image decoder with it. */ +#ifndef LV_USE_FFMPEG + #ifdef CONFIG_LV_USE_FFMPEG + #define LV_USE_FFMPEG CONFIG_LV_USE_FFMPEG + #else + #define LV_USE_FFMPEG 0 + #endif +#endif +#if LV_USE_FFMPEG + /** Dump input information to stderr */ + #ifndef LV_FFMPEG_DUMP_FORMAT + #ifdef CONFIG_LV_FFMPEG_DUMP_FORMAT + #define LV_FFMPEG_DUMP_FORMAT CONFIG_LV_FFMPEG_DUMP_FORMAT + #else + #define LV_FFMPEG_DUMP_FORMAT 0 + #endif + #endif + /** Use lvgl file path in FFmpeg Player widget + * You won't be able to open URLs after enabling this feature. + * Note that FFmpeg image decoder will always use lvgl file system. */ + #ifndef LV_FFMPEG_PLAYER_USE_LV_FS + #ifdef CONFIG_LV_FFMPEG_PLAYER_USE_LV_FS + #define LV_FFMPEG_PLAYER_USE_LV_FS CONFIG_LV_FFMPEG_PLAYER_USE_LV_FS + #else + #define LV_FFMPEG_PLAYER_USE_LV_FS 0 + #endif + #endif +#endif + +/*================== + * OTHERS + *==================*/ +/* Documentation for several of the below items can be found here: https://docs.lvgl.io/master/auxiliary-modules/index.html . */ + +/** 1: Enable API to take snapshot for object */ +#ifndef LV_USE_SNAPSHOT + #ifdef CONFIG_LV_USE_SNAPSHOT + #define LV_USE_SNAPSHOT CONFIG_LV_USE_SNAPSHOT + #else + #define LV_USE_SNAPSHOT 0 + #endif +#endif + +/** 1: Enable system monitor component */ +#ifndef LV_USE_SYSMON + #ifdef CONFIG_LV_USE_SYSMON + #define LV_USE_SYSMON CONFIG_LV_USE_SYSMON + #else + #define LV_USE_SYSMON 0 + #endif +#endif +#if LV_USE_SYSMON + /** Get the idle percentage. E.g. uint32_t my_get_idle(void); */ + #ifndef LV_SYSMON_GET_IDLE + #ifdef CONFIG_LV_SYSMON_GET_IDLE + #define LV_SYSMON_GET_IDLE CONFIG_LV_SYSMON_GET_IDLE + #else + #define LV_SYSMON_GET_IDLE lv_os_get_idle_percent + #endif + #endif + /** 1: Enable usage of lv_os_get_proc_idle_percent.*/ + #ifndef LV_SYSMON_PROC_IDLE_AVAILABLE + #ifdef CONFIG_LV_SYSMON_PROC_IDLE_AVAILABLE + #define LV_SYSMON_PROC_IDLE_AVAILABLE CONFIG_LV_SYSMON_PROC_IDLE_AVAILABLE + #else + #define LV_SYSMON_PROC_IDLE_AVAILABLE 0 + #endif + #endif + #if LV_SYSMON_PROC_IDLE_AVAILABLE + /** Get the applications idle percentage. + * - Requires `LV_USE_OS == LV_OS_PTHREAD` */ + #ifndef LV_SYSMON_GET_PROC_IDLE + #ifdef CONFIG_LV_SYSMON_GET_PROC_IDLE + #define LV_SYSMON_GET_PROC_IDLE CONFIG_LV_SYSMON_GET_PROC_IDLE + #else + #define LV_SYSMON_GET_PROC_IDLE lv_os_get_proc_idle_percent + #endif + #endif + #endif + + /** 1: Show CPU usage and FPS count. + * - Requires `LV_USE_SYSMON = 1` */ + #ifndef LV_USE_PERF_MONITOR + #ifdef CONFIG_LV_USE_PERF_MONITOR + #define LV_USE_PERF_MONITOR CONFIG_LV_USE_PERF_MONITOR + #else + #define LV_USE_PERF_MONITOR 0 + #endif + #endif + #if LV_USE_PERF_MONITOR + #ifndef LV_USE_PERF_MONITOR_POS + #ifdef CONFIG_LV_USE_PERF_MONITOR_POS + #define LV_USE_PERF_MONITOR_POS CONFIG_LV_USE_PERF_MONITOR_POS + #else + #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT + #endif + #endif + + /** 0: Displays performance data on the screen; 1: Prints performance data using log. */ + #ifndef LV_USE_PERF_MONITOR_LOG_MODE + #ifdef CONFIG_LV_USE_PERF_MONITOR_LOG_MODE + #define LV_USE_PERF_MONITOR_LOG_MODE CONFIG_LV_USE_PERF_MONITOR_LOG_MODE + #else + #define LV_USE_PERF_MONITOR_LOG_MODE 0 + #endif + #endif + #endif + + /** 1: Show used memory and memory fragmentation. + * - Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` + * - Requires `LV_USE_SYSMON = 1`*/ + #ifndef LV_USE_MEM_MONITOR + #ifdef CONFIG_LV_USE_MEM_MONITOR + #define LV_USE_MEM_MONITOR CONFIG_LV_USE_MEM_MONITOR + #else + #define LV_USE_MEM_MONITOR 0 + #endif + #endif + #if LV_USE_MEM_MONITOR + #ifndef LV_USE_MEM_MONITOR_POS + #ifdef CONFIG_LV_USE_MEM_MONITOR_POS + #define LV_USE_MEM_MONITOR_POS CONFIG_LV_USE_MEM_MONITOR_POS + #else + #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT + #endif + #endif + #endif +#endif /*LV_USE_SYSMON*/ + +/** 1: Enable runtime performance profiler */ +#ifndef LV_USE_PROFILER + #ifdef CONFIG_LV_USE_PROFILER + #define LV_USE_PROFILER CONFIG_LV_USE_PROFILER + #else + #define LV_USE_PROFILER 0 + #endif +#endif +#if LV_USE_PROFILER + /** 1: Enable the built-in profiler */ + #ifndef LV_USE_PROFILER_BUILTIN + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_PROFILER_BUILTIN + #define LV_USE_PROFILER_BUILTIN CONFIG_LV_USE_PROFILER_BUILTIN + #else + #define LV_USE_PROFILER_BUILTIN 0 + #endif + #else + #define LV_USE_PROFILER_BUILTIN 1 + #endif + #endif + #if LV_USE_PROFILER_BUILTIN + /** Default profiler trace buffer size */ + #ifndef LV_PROFILER_BUILTIN_BUF_SIZE + #ifdef CONFIG_LV_PROFILER_BUILTIN_BUF_SIZE + #define LV_PROFILER_BUILTIN_BUF_SIZE CONFIG_LV_PROFILER_BUILTIN_BUF_SIZE + #else + #define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /**< [bytes] */ + #endif + #endif + #ifndef LV_PROFILER_BUILTIN_DEFAULT_ENABLE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_BUILTIN_DEFAULT_ENABLE + #define LV_PROFILER_BUILTIN_DEFAULT_ENABLE CONFIG_LV_PROFILER_BUILTIN_DEFAULT_ENABLE + #else + #define LV_PROFILER_BUILTIN_DEFAULT_ENABLE 0 + #endif + #else + #define LV_PROFILER_BUILTIN_DEFAULT_ENABLE 1 + #endif + #endif + #ifndef LV_USE_PROFILER_BUILTIN_POSIX + #ifdef CONFIG_LV_USE_PROFILER_BUILTIN_POSIX + #define LV_USE_PROFILER_BUILTIN_POSIX CONFIG_LV_USE_PROFILER_BUILTIN_POSIX + #else + #define LV_USE_PROFILER_BUILTIN_POSIX 0 /**< Enable POSIX profiler port */ + #endif + #endif + #endif + + /** Header to include for profiler */ + #ifndef LV_PROFILER_INCLUDE + #ifdef CONFIG_LV_PROFILER_INCLUDE + #define LV_PROFILER_INCLUDE CONFIG_LV_PROFILER_INCLUDE + #else + #define LV_PROFILER_INCLUDE "lvgl/src/misc/lv_profiler_builtin.h" + #endif + #endif + + /** Profiler start point function */ + #ifndef LV_PROFILER_BEGIN + #ifdef CONFIG_LV_PROFILER_BEGIN + #define LV_PROFILER_BEGIN CONFIG_LV_PROFILER_BEGIN + #else + #define LV_PROFILER_BEGIN LV_PROFILER_BUILTIN_BEGIN + #endif + #endif + + /** Profiler end point function */ + #ifndef LV_PROFILER_END + #ifdef CONFIG_LV_PROFILER_END + #define LV_PROFILER_END CONFIG_LV_PROFILER_END + #else + #define LV_PROFILER_END LV_PROFILER_BUILTIN_END + #endif + #endif + + /** Profiler start point function with custom tag */ + #ifndef LV_PROFILER_BEGIN_TAG + #ifdef CONFIG_LV_PROFILER_BEGIN_TAG + #define LV_PROFILER_BEGIN_TAG CONFIG_LV_PROFILER_BEGIN_TAG + #else + #define LV_PROFILER_BEGIN_TAG LV_PROFILER_BUILTIN_BEGIN_TAG + #endif + #endif + + /** Profiler end point function with custom tag */ + #ifndef LV_PROFILER_END_TAG + #ifdef CONFIG_LV_PROFILER_END_TAG + #define LV_PROFILER_END_TAG CONFIG_LV_PROFILER_END_TAG + #else + #define LV_PROFILER_END_TAG LV_PROFILER_BUILTIN_END_TAG + #endif + #endif + + /*Enable layout profiler*/ + #ifndef LV_PROFILER_LAYOUT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_LAYOUT + #define LV_PROFILER_LAYOUT CONFIG_LV_PROFILER_LAYOUT + #else + #define LV_PROFILER_LAYOUT 0 + #endif + #else + #define LV_PROFILER_LAYOUT 1 + #endif + #endif + + /*Enable disp refr profiler*/ + #ifndef LV_PROFILER_REFR + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_REFR + #define LV_PROFILER_REFR CONFIG_LV_PROFILER_REFR + #else + #define LV_PROFILER_REFR 0 + #endif + #else + #define LV_PROFILER_REFR 1 + #endif + #endif + + /*Enable draw profiler*/ + #ifndef LV_PROFILER_DRAW + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_DRAW + #define LV_PROFILER_DRAW CONFIG_LV_PROFILER_DRAW + #else + #define LV_PROFILER_DRAW 0 + #endif + #else + #define LV_PROFILER_DRAW 1 + #endif + #endif + + /*Enable indev profiler*/ + #ifndef LV_PROFILER_INDEV + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_INDEV + #define LV_PROFILER_INDEV CONFIG_LV_PROFILER_INDEV + #else + #define LV_PROFILER_INDEV 0 + #endif + #else + #define LV_PROFILER_INDEV 1 + #endif + #endif + + /*Enable decoder profiler*/ + #ifndef LV_PROFILER_DECODER + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_DECODER + #define LV_PROFILER_DECODER CONFIG_LV_PROFILER_DECODER + #else + #define LV_PROFILER_DECODER 0 + #endif + #else + #define LV_PROFILER_DECODER 1 + #endif + #endif + + /*Enable font profiler*/ + #ifndef LV_PROFILER_FONT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_FONT + #define LV_PROFILER_FONT CONFIG_LV_PROFILER_FONT + #else + #define LV_PROFILER_FONT 0 + #endif + #else + #define LV_PROFILER_FONT 1 + #endif + #endif + + /*Enable fs profiler*/ + #ifndef LV_PROFILER_FS + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_FS + #define LV_PROFILER_FS CONFIG_LV_PROFILER_FS + #else + #define LV_PROFILER_FS 0 + #endif + #else + #define LV_PROFILER_FS 1 + #endif + #endif + + /*Enable style profiler*/ + #ifndef LV_PROFILER_STYLE + #ifdef CONFIG_LV_PROFILER_STYLE + #define LV_PROFILER_STYLE CONFIG_LV_PROFILER_STYLE + #else + #define LV_PROFILER_STYLE 0 + #endif + #endif + + /*Enable timer profiler*/ + #ifndef LV_PROFILER_TIMER + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_TIMER + #define LV_PROFILER_TIMER CONFIG_LV_PROFILER_TIMER + #else + #define LV_PROFILER_TIMER 0 + #endif + #else + #define LV_PROFILER_TIMER 1 + #endif + #endif + + /*Enable cache profiler*/ + #ifndef LV_PROFILER_CACHE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_CACHE + #define LV_PROFILER_CACHE CONFIG_LV_PROFILER_CACHE + #else + #define LV_PROFILER_CACHE 0 + #endif + #else + #define LV_PROFILER_CACHE 1 + #endif + #endif + + /*Enable event profiler*/ + #ifndef LV_PROFILER_EVENT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_PROFILER_EVENT + #define LV_PROFILER_EVENT CONFIG_LV_PROFILER_EVENT + #else + #define LV_PROFILER_EVENT 0 + #endif + #else + #define LV_PROFILER_EVENT 1 + #endif + #endif +#endif + +/** 1: Enable Monkey test */ +#ifndef LV_USE_MONKEY + #ifdef CONFIG_LV_USE_MONKEY + #define LV_USE_MONKEY CONFIG_LV_USE_MONKEY + #else + #define LV_USE_MONKEY 0 + #endif +#endif + +/** 1: Enable grid navigation */ +#ifndef LV_USE_GRIDNAV + #ifdef CONFIG_LV_USE_GRIDNAV + #define LV_USE_GRIDNAV CONFIG_LV_USE_GRIDNAV + #else + #define LV_USE_GRIDNAV 0 + #endif +#endif + +/** 1: Enable `lv_obj` fragment logic */ +#ifndef LV_USE_FRAGMENT + #ifdef CONFIG_LV_USE_FRAGMENT + #define LV_USE_FRAGMENT CONFIG_LV_USE_FRAGMENT + #else + #define LV_USE_FRAGMENT 0 + #endif +#endif + +/** 1: Support using images as font in label or span widgets */ +#ifndef LV_USE_IMGFONT + #ifdef CONFIG_LV_USE_IMGFONT + #define LV_USE_IMGFONT CONFIG_LV_USE_IMGFONT + #else + #define LV_USE_IMGFONT 0 + #endif +#endif + +/** 1: Enable an observer pattern implementation */ +#ifndef LV_USE_OBSERVER + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_OBSERVER + #define LV_USE_OBSERVER CONFIG_LV_USE_OBSERVER + #else + #define LV_USE_OBSERVER 0 + #endif + #else + #define LV_USE_OBSERVER 1 + #endif +#endif + +/** 1: Enable Pinyin input method + * - Requires: lv_keyboard */ +#ifndef LV_USE_IME_PINYIN + #ifdef CONFIG_LV_USE_IME_PINYIN + #define LV_USE_IME_PINYIN CONFIG_LV_USE_IME_PINYIN + #else + #define LV_USE_IME_PINYIN 0 + #endif +#endif +#if LV_USE_IME_PINYIN + /** 1: Use default thesaurus. + * @note If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesaurus. */ + #ifndef LV_IME_PINYIN_USE_DEFAULT_DICT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_IME_PINYIN_USE_DEFAULT_DICT + #define LV_IME_PINYIN_USE_DEFAULT_DICT CONFIG_LV_IME_PINYIN_USE_DEFAULT_DICT + #else + #define LV_IME_PINYIN_USE_DEFAULT_DICT 0 + #endif + #else + #define LV_IME_PINYIN_USE_DEFAULT_DICT 1 + #endif + #endif + /** Set maximum number of candidate panels that can be displayed. + * @note This needs to be adjusted according to size of screen. */ + #ifndef LV_IME_PINYIN_CAND_TEXT_NUM + #ifdef CONFIG_LV_IME_PINYIN_CAND_TEXT_NUM + #define LV_IME_PINYIN_CAND_TEXT_NUM CONFIG_LV_IME_PINYIN_CAND_TEXT_NUM + #else + #define LV_IME_PINYIN_CAND_TEXT_NUM 6 + #endif + #endif + + /** Use 9-key input (k9). */ + #ifndef LV_IME_PINYIN_USE_K9_MODE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_IME_PINYIN_USE_K9_MODE + #define LV_IME_PINYIN_USE_K9_MODE CONFIG_LV_IME_PINYIN_USE_K9_MODE + #else + #define LV_IME_PINYIN_USE_K9_MODE 0 + #endif + #else + #define LV_IME_PINYIN_USE_K9_MODE 1 + #endif + #endif + #if LV_IME_PINYIN_USE_K9_MODE == 1 + #ifndef LV_IME_PINYIN_K9_CAND_TEXT_NUM + #ifdef CONFIG_LV_IME_PINYIN_K9_CAND_TEXT_NUM + #define LV_IME_PINYIN_K9_CAND_TEXT_NUM CONFIG_LV_IME_PINYIN_K9_CAND_TEXT_NUM + #else + #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 + #endif + #endif + #endif /*LV_IME_PINYIN_USE_K9_MODE*/ +#endif + +/** 1: Enable file explorer. + * - Requires: lv_table */ +#ifndef LV_USE_FILE_EXPLORER + #ifdef CONFIG_LV_USE_FILE_EXPLORER + #define LV_USE_FILE_EXPLORER CONFIG_LV_USE_FILE_EXPLORER + #else + #define LV_USE_FILE_EXPLORER 0 + #endif +#endif +#if LV_USE_FILE_EXPLORER + /** Maximum length of path */ + #ifndef LV_FILE_EXPLORER_PATH_MAX_LEN + #ifdef CONFIG_LV_FILE_EXPLORER_PATH_MAX_LEN + #define LV_FILE_EXPLORER_PATH_MAX_LEN CONFIG_LV_FILE_EXPLORER_PATH_MAX_LEN + #else + #define LV_FILE_EXPLORER_PATH_MAX_LEN (128) + #endif + #endif + /** Quick access bar, 1:use, 0:do not use. + * - Requires: lv_list */ + #ifndef LV_FILE_EXPLORER_QUICK_ACCESS + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_FILE_EXPLORER_QUICK_ACCESS + #define LV_FILE_EXPLORER_QUICK_ACCESS CONFIG_LV_FILE_EXPLORER_QUICK_ACCESS + #else + #define LV_FILE_EXPLORER_QUICK_ACCESS 0 + #endif + #else + #define LV_FILE_EXPLORER_QUICK_ACCESS 1 + #endif + #endif +#endif + +/** 1: Enable Font manager */ +#ifndef LV_USE_FONT_MANAGER + #ifdef CONFIG_LV_USE_FONT_MANAGER + #define LV_USE_FONT_MANAGER CONFIG_LV_USE_FONT_MANAGER + #else + #define LV_USE_FONT_MANAGER 0 + #endif +#endif +#if LV_USE_FONT_MANAGER + +/**Font manager name max length*/ +#ifndef LV_FONT_MANAGER_NAME_MAX_LEN + #ifdef CONFIG_LV_FONT_MANAGER_NAME_MAX_LEN + #define LV_FONT_MANAGER_NAME_MAX_LEN CONFIG_LV_FONT_MANAGER_NAME_MAX_LEN + #else + #define LV_FONT_MANAGER_NAME_MAX_LEN 32 + #endif +#endif + +#endif + +/** Enable emulated input devices, time emulation, and screenshot compares. */ +#ifndef LV_USE_TEST + #ifdef CONFIG_LV_USE_TEST + #define LV_USE_TEST CONFIG_LV_USE_TEST + #else + #define LV_USE_TEST 0 + #endif +#endif +#if LV_USE_TEST + +/** Enable `lv_test_screenshot_compare`. + * Requires lodepng and a few MB of extra RAM. */ +#ifndef LV_USE_TEST_SCREENSHOT_COMPARE + #ifdef CONFIG_LV_USE_TEST_SCREENSHOT_COMPARE + #define LV_USE_TEST_SCREENSHOT_COMPARE CONFIG_LV_USE_TEST_SCREENSHOT_COMPARE + #else + #define LV_USE_TEST_SCREENSHOT_COMPARE 0 + #endif +#endif + +#if LV_USE_TEST_SCREENSHOT_COMPARE + /** 1: Automatically create missing reference images*/ + #ifndef LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE + #define LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE CONFIG_LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE + #else + #define LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE 0 + #endif + #else + #define LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE 1 + #endif + #endif +#endif /*LV_USE_TEST_SCREENSHOT_COMPARE*/ + +#endif /*LV_USE_TEST*/ + +/** 1: Enable text translation support */ +#ifndef LV_USE_TRANSLATION + #ifdef CONFIG_LV_USE_TRANSLATION + #define LV_USE_TRANSLATION CONFIG_LV_USE_TRANSLATION + #else + #define LV_USE_TRANSLATION 0 + #endif +#endif + +/*1: Enable color filter style*/ +#ifndef LV_USE_COLOR_FILTER + #ifdef CONFIG_LV_USE_COLOR_FILTER + #define LV_USE_COLOR_FILTER CONFIG_LV_USE_COLOR_FILTER + #else + #define LV_USE_COLOR_FILTER 0 + #endif +#endif + +/*================== + * DEVICES + *==================*/ + +/** Use SDL to open window on PC and handle mouse and keyboard. */ +#ifndef LV_USE_SDL + #ifdef CONFIG_LV_USE_SDL + #define LV_USE_SDL CONFIG_LV_USE_SDL + #else + #define LV_USE_SDL 0 + #endif +#endif +#if LV_USE_SDL + #ifndef LV_SDL_INCLUDE_PATH + #ifdef CONFIG_LV_SDL_INCLUDE_PATH + #define LV_SDL_INCLUDE_PATH CONFIG_LV_SDL_INCLUDE_PATH + #else + #define LV_SDL_INCLUDE_PATH + #endif + #endif + #ifndef LV_SDL_RENDER_MODE + #ifdef CONFIG_LV_SDL_RENDER_MODE + #define LV_SDL_RENDER_MODE CONFIG_LV_SDL_RENDER_MODE + #else + #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /**< LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance */ + #endif + #endif + #ifndef LV_SDL_BUF_COUNT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_SDL_BUF_COUNT + #define LV_SDL_BUF_COUNT CONFIG_LV_SDL_BUF_COUNT + #else + #define LV_SDL_BUF_COUNT 0 + #endif + #else + #define LV_SDL_BUF_COUNT 1 /**< 1 or 2 */ + #endif + #endif + #ifndef LV_SDL_ACCELERATED + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_SDL_ACCELERATED + #define LV_SDL_ACCELERATED CONFIG_LV_SDL_ACCELERATED + #else + #define LV_SDL_ACCELERATED 0 + #endif + #else + #define LV_SDL_ACCELERATED 1 /**< 1: Use hardware acceleration*/ + #endif + #endif + #ifndef LV_SDL_FULLSCREEN + #ifdef CONFIG_LV_SDL_FULLSCREEN + #define LV_SDL_FULLSCREEN CONFIG_LV_SDL_FULLSCREEN + #else + #define LV_SDL_FULLSCREEN 0 /**< 1: Make the window full screen by default */ + #endif + #endif + #ifndef LV_SDL_DIRECT_EXIT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_SDL_DIRECT_EXIT + #define LV_SDL_DIRECT_EXIT CONFIG_LV_SDL_DIRECT_EXIT + #else + #define LV_SDL_DIRECT_EXIT 0 + #endif + #else + #define LV_SDL_DIRECT_EXIT 1 /**< 1: Exit the application when all SDL windows are closed */ + #endif + #endif + #ifndef LV_SDL_MOUSEWHEEL_MODE + #ifdef CONFIG_LV_SDL_MOUSEWHEEL_MODE + #define LV_SDL_MOUSEWHEEL_MODE CONFIG_LV_SDL_MOUSEWHEEL_MODE + #else + #define LV_SDL_MOUSEWHEEL_MODE LV_SDL_MOUSEWHEEL_MODE_ENCODER /*LV_SDL_MOUSEWHEEL_MODE_ENCODER/CROWN*/ + #endif + #endif +#endif + +/** Use X11 to open window on Linux desktop and handle mouse and keyboard */ +#ifndef LV_USE_X11 + #ifdef CONFIG_LV_USE_X11 + #define LV_USE_X11 CONFIG_LV_USE_X11 + #else + #define LV_USE_X11 0 + #endif +#endif +#if LV_USE_X11 + #ifndef LV_X11_DIRECT_EXIT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_X11_DIRECT_EXIT + #define LV_X11_DIRECT_EXIT CONFIG_LV_X11_DIRECT_EXIT + #else + #define LV_X11_DIRECT_EXIT 0 + #endif + #else + #define LV_X11_DIRECT_EXIT 1 /**< Exit application when all X11 windows have been closed */ + #endif + #endif + #ifndef LV_X11_DOUBLE_BUFFER + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_X11_DOUBLE_BUFFER + #define LV_X11_DOUBLE_BUFFER CONFIG_LV_X11_DOUBLE_BUFFER + #else + #define LV_X11_DOUBLE_BUFFER 0 + #endif + #else + #define LV_X11_DOUBLE_BUFFER 1 /**< Use double buffers for rendering */ + #endif + #endif + /* Select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!). */ + #ifndef LV_X11_RENDER_MODE_PARTIAL + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_X11_RENDER_MODE_PARTIAL + #define LV_X11_RENDER_MODE_PARTIAL CONFIG_LV_X11_RENDER_MODE_PARTIAL + #else + #define LV_X11_RENDER_MODE_PARTIAL 0 + #endif + #else + #define LV_X11_RENDER_MODE_PARTIAL 1 /**< Partial render mode (preferred) */ + #endif + #endif + #ifndef LV_X11_RENDER_MODE_DIRECT + #ifdef CONFIG_LV_X11_RENDER_MODE_DIRECT + #define LV_X11_RENDER_MODE_DIRECT CONFIG_LV_X11_RENDER_MODE_DIRECT + #else + #define LV_X11_RENDER_MODE_DIRECT 0 /**< Direct render mode */ + #endif + #endif + #ifndef LV_X11_RENDER_MODE_FULL + #ifdef CONFIG_LV_X11_RENDER_MODE_FULL + #define LV_X11_RENDER_MODE_FULL CONFIG_LV_X11_RENDER_MODE_FULL + #else + #define LV_X11_RENDER_MODE_FULL 0 /**< Full render mode */ + #endif + #endif +#endif + +/** Use Wayland to open a window and handle input on Linux or BSD desktops */ +#ifndef LV_USE_WAYLAND + #ifdef CONFIG_LV_USE_WAYLAND + #define LV_USE_WAYLAND CONFIG_LV_USE_WAYLAND + #else + #define LV_USE_WAYLAND 0 + #endif +#endif +#if LV_USE_WAYLAND + #ifndef LV_WAYLAND_DIRECT_EXIT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_WAYLAND_DIRECT_EXIT + #define LV_WAYLAND_DIRECT_EXIT CONFIG_LV_WAYLAND_DIRECT_EXIT + #else + #define LV_WAYLAND_DIRECT_EXIT 0 + #endif + #else + #define LV_WAYLAND_DIRECT_EXIT 1 /**< 1: Exit the application when all Wayland windows are closed */ + #endif + #endif +#endif + +/** Driver for /dev/fb */ +#ifndef LV_USE_LINUX_FBDEV + #ifdef CONFIG_LV_USE_LINUX_FBDEV + #define LV_USE_LINUX_FBDEV CONFIG_LV_USE_LINUX_FBDEV + #else + #define LV_USE_LINUX_FBDEV 0 + #endif +#endif +#if LV_USE_LINUX_FBDEV + #ifndef LV_LINUX_FBDEV_BSD + #ifdef CONFIG_LV_LINUX_FBDEV_BSD + #define LV_LINUX_FBDEV_BSD CONFIG_LV_LINUX_FBDEV_BSD + #else + #define LV_LINUX_FBDEV_BSD 0 + #endif + #endif + #ifndef LV_LINUX_FBDEV_RENDER_MODE + #ifdef CONFIG_LV_LINUX_FBDEV_RENDER_MODE + #define LV_LINUX_FBDEV_RENDER_MODE CONFIG_LV_LINUX_FBDEV_RENDER_MODE + #else + #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL + #endif + #endif + #ifndef LV_LINUX_FBDEV_BUFFER_COUNT + #ifdef CONFIG_LV_LINUX_FBDEV_BUFFER_COUNT + #define LV_LINUX_FBDEV_BUFFER_COUNT CONFIG_LV_LINUX_FBDEV_BUFFER_COUNT + #else + #define LV_LINUX_FBDEV_BUFFER_COUNT 0 + #endif + #endif + #ifndef LV_LINUX_FBDEV_BUFFER_SIZE + #ifdef CONFIG_LV_LINUX_FBDEV_BUFFER_SIZE + #define LV_LINUX_FBDEV_BUFFER_SIZE CONFIG_LV_LINUX_FBDEV_BUFFER_SIZE + #else + #define LV_LINUX_FBDEV_BUFFER_SIZE 60 + #endif + #endif + #ifndef LV_LINUX_FBDEV_MMAP + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_LINUX_FBDEV_MMAP + #define LV_LINUX_FBDEV_MMAP CONFIG_LV_LINUX_FBDEV_MMAP + #else + #define LV_LINUX_FBDEV_MMAP 0 + #endif + #else + #define LV_LINUX_FBDEV_MMAP 1 + #endif + #endif +#endif + +/** Use Nuttx to open window and handle touchscreen */ +#ifndef LV_USE_NUTTX + #ifdef CONFIG_LV_USE_NUTTX + #define LV_USE_NUTTX CONFIG_LV_USE_NUTTX + #else + #define LV_USE_NUTTX 0 + #endif +#endif + +#if LV_USE_NUTTX + #ifndef LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP + #ifdef CONFIG_LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP + #define LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP CONFIG_LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP + #else + #define LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP 0 + #endif + #endif + + /** Use independent image heap for default draw buffer */ + #ifndef LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP + #ifdef CONFIG_LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP + #define LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP CONFIG_LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP + #else + #define LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP 0 + #endif + #endif + + #ifndef LV_USE_NUTTX_LIBUV + #ifdef CONFIG_LV_USE_NUTTX_LIBUV + #define LV_USE_NUTTX_LIBUV CONFIG_LV_USE_NUTTX_LIBUV + #else + #define LV_USE_NUTTX_LIBUV 0 + #endif + #endif + + /** Use Nuttx custom init API to open window and handle touchscreen */ + #ifndef LV_USE_NUTTX_CUSTOM_INIT + #ifdef CONFIG_LV_USE_NUTTX_CUSTOM_INIT + #define LV_USE_NUTTX_CUSTOM_INIT CONFIG_LV_USE_NUTTX_CUSTOM_INIT + #else + #define LV_USE_NUTTX_CUSTOM_INIT 0 + #endif + #endif + + /** Driver for /dev/lcd */ + #ifndef LV_USE_NUTTX_LCD + #ifdef CONFIG_LV_USE_NUTTX_LCD + #define LV_USE_NUTTX_LCD CONFIG_LV_USE_NUTTX_LCD + #else + #define LV_USE_NUTTX_LCD 0 + #endif + #endif + #if LV_USE_NUTTX_LCD + #ifndef LV_NUTTX_LCD_BUFFER_COUNT + #ifdef CONFIG_LV_NUTTX_LCD_BUFFER_COUNT + #define LV_NUTTX_LCD_BUFFER_COUNT CONFIG_LV_NUTTX_LCD_BUFFER_COUNT + #else + #define LV_NUTTX_LCD_BUFFER_COUNT 0 + #endif + #endif + #ifndef LV_NUTTX_LCD_BUFFER_SIZE + #ifdef CONFIG_LV_NUTTX_LCD_BUFFER_SIZE + #define LV_NUTTX_LCD_BUFFER_SIZE CONFIG_LV_NUTTX_LCD_BUFFER_SIZE + #else + #define LV_NUTTX_LCD_BUFFER_SIZE 60 + #endif + #endif + #endif + + /** Driver for /dev/input */ + #ifndef LV_USE_NUTTX_TOUCHSCREEN + #ifdef CONFIG_LV_USE_NUTTX_TOUCHSCREEN + #define LV_USE_NUTTX_TOUCHSCREEN CONFIG_LV_USE_NUTTX_TOUCHSCREEN + #else + #define LV_USE_NUTTX_TOUCHSCREEN 0 + #endif + #endif + + /** Touchscreen cursor size in pixels(<=0: disable cursor) */ + #ifndef LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE + #ifdef CONFIG_LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE + #define LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE CONFIG_LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE + #else + #define LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE 0 + #endif + #endif + + /** Driver for /dev/mouse */ + #ifndef LV_USE_NUTTX_MOUSE + #ifdef CONFIG_LV_USE_NUTTX_MOUSE + #define LV_USE_NUTTX_MOUSE CONFIG_LV_USE_NUTTX_MOUSE + #else + #define LV_USE_NUTTX_MOUSE 0 + #endif + #endif + + /** Mouse movement step (pixels) */ + #ifndef LV_USE_NUTTX_MOUSE_MOVE_STEP + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_NUTTX_MOUSE_MOVE_STEP + #define LV_USE_NUTTX_MOUSE_MOVE_STEP CONFIG_LV_USE_NUTTX_MOUSE_MOVE_STEP + #else + #define LV_USE_NUTTX_MOUSE_MOVE_STEP 0 + #endif + #else + #define LV_USE_NUTTX_MOUSE_MOVE_STEP 1 + #endif + #endif + + /*NuttX trace file and its path*/ + #ifndef LV_USE_NUTTX_TRACE_FILE + #ifdef CONFIG_LV_USE_NUTTX_TRACE_FILE + #define LV_USE_NUTTX_TRACE_FILE CONFIG_LV_USE_NUTTX_TRACE_FILE + #else + #define LV_USE_NUTTX_TRACE_FILE 0 + #endif + #endif + #if LV_USE_NUTTX_TRACE_FILE + #ifndef LV_NUTTX_TRACE_FILE_PATH + #ifdef CONFIG_LV_NUTTX_TRACE_FILE_PATH + #define LV_NUTTX_TRACE_FILE_PATH CONFIG_LV_NUTTX_TRACE_FILE_PATH + #else + #define LV_NUTTX_TRACE_FILE_PATH "/data/lvgl-trace.log" + #endif + #endif + #endif + +#endif + +/** Driver for /dev/dri/card */ +#ifndef LV_USE_LINUX_DRM + #ifdef CONFIG_LV_USE_LINUX_DRM + #define LV_USE_LINUX_DRM CONFIG_LV_USE_LINUX_DRM + #else + #define LV_USE_LINUX_DRM 0 + #endif +#endif + +#if LV_USE_LINUX_DRM + + /* Use the MESA GBM library to allocate DMA buffers that can be + * shared across sub-systems and libraries using the Linux DMA-BUF API. + * The GBM library aims to provide a platform independent memory management system + * it supports the major GPU vendors - This option requires linking with libgbm */ + #ifndef LV_USE_LINUX_DRM_GBM_BUFFERS + #ifdef CONFIG_LV_USE_LINUX_DRM_GBM_BUFFERS + #define LV_USE_LINUX_DRM_GBM_BUFFERS CONFIG_LV_USE_LINUX_DRM_GBM_BUFFERS + #else + #define LV_USE_LINUX_DRM_GBM_BUFFERS 0 + #endif + #endif +#endif + +/** Interface for TFT_eSPI */ +#ifndef LV_USE_TFT_ESPI + #ifdef CONFIG_LV_USE_TFT_ESPI + #define LV_USE_TFT_ESPI CONFIG_LV_USE_TFT_ESPI + #else + #define LV_USE_TFT_ESPI 0 + #endif +#endif + +/** Interface for Lovyan_GFX */ +#ifndef LV_USE_LOVYAN_GFX + #ifdef CONFIG_LV_USE_LOVYAN_GFX + #define LV_USE_LOVYAN_GFX CONFIG_LV_USE_LOVYAN_GFX + #else + #define LV_USE_LOVYAN_GFX 0 + #endif +#endif + +#if LV_USE_LOVYAN_GFX + #ifndef LV_LGFX_USER_INCLUDE + #ifdef CONFIG_LV_LGFX_USER_INCLUDE + #define LV_LGFX_USER_INCLUDE CONFIG_LV_LGFX_USER_INCLUDE + #else + #define LV_LGFX_USER_INCLUDE "lv_lgfx_user.hpp" + #endif + #endif + +#endif /*LV_USE_LOVYAN_GFX*/ + +/** Driver for evdev input devices */ +#ifndef LV_USE_EVDEV + #ifdef CONFIG_LV_USE_EVDEV + #define LV_USE_EVDEV CONFIG_LV_USE_EVDEV + #else + #define LV_USE_EVDEV 0 + #endif +#endif + +/** Driver for libinput input devices */ +#ifndef LV_USE_LIBINPUT + #ifdef CONFIG_LV_USE_LIBINPUT + #define LV_USE_LIBINPUT CONFIG_LV_USE_LIBINPUT + #else + #define LV_USE_LIBINPUT 0 + #endif +#endif + +#if LV_USE_LIBINPUT + #ifndef LV_LIBINPUT_BSD + #ifdef CONFIG_LV_LIBINPUT_BSD + #define LV_LIBINPUT_BSD CONFIG_LV_LIBINPUT_BSD + #else + #define LV_LIBINPUT_BSD 0 + #endif + #endif + + /** Full keyboard support */ + #ifndef LV_LIBINPUT_XKB + #ifdef CONFIG_LV_LIBINPUT_XKB + #define LV_LIBINPUT_XKB CONFIG_LV_LIBINPUT_XKB + #else + #define LV_LIBINPUT_XKB 0 + #endif + #endif + #if LV_LIBINPUT_XKB + /** "setxkbmap -query" can help find the right values for your keyboard */ + #ifndef LV_LIBINPUT_XKB_KEY_MAP + #ifdef CONFIG_LV_LIBINPUT_XKB_KEY_MAP + #define LV_LIBINPUT_XKB_KEY_MAP CONFIG_LV_LIBINPUT_XKB_KEY_MAP + #else + #define LV_LIBINPUT_XKB_KEY_MAP { .rules = NULL, .model = "pc101", .layout = "us", .variant = NULL, .options = NULL } + #endif + #endif + #endif +#endif + +/* Drivers for LCD devices connected via SPI/parallel port */ +#ifndef LV_USE_ST7735 + #ifdef CONFIG_LV_USE_ST7735 + #define LV_USE_ST7735 CONFIG_LV_USE_ST7735 + #else + #define LV_USE_ST7735 0 + #endif +#endif +#ifndef LV_USE_ST7789 + #ifdef CONFIG_LV_USE_ST7789 + #define LV_USE_ST7789 CONFIG_LV_USE_ST7789 + #else + #define LV_USE_ST7789 0 + #endif +#endif +#ifndef LV_USE_ST7796 + #ifdef CONFIG_LV_USE_ST7796 + #define LV_USE_ST7796 CONFIG_LV_USE_ST7796 + #else + #define LV_USE_ST7796 0 + #endif +#endif +#ifndef LV_USE_ILI9341 + #ifdef CONFIG_LV_USE_ILI9341 + #define LV_USE_ILI9341 CONFIG_LV_USE_ILI9341 + #else + #define LV_USE_ILI9341 0 + #endif +#endif +#ifndef LV_USE_FT81X + #ifdef CONFIG_LV_USE_FT81X + #define LV_USE_FT81X CONFIG_LV_USE_FT81X + #else + #define LV_USE_FT81X 0 + #endif +#endif +#ifndef LV_USE_NV3007 + #ifdef CONFIG_LV_USE_NV3007 + #define LV_USE_NV3007 CONFIG_LV_USE_NV3007 + #else + #define LV_USE_NV3007 0 + #endif +#endif + +#if (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341 | LV_USE_NV3007) + #ifndef LV_USE_GENERIC_MIPI + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_GENERIC_MIPI + #define LV_USE_GENERIC_MIPI CONFIG_LV_USE_GENERIC_MIPI + #else + #define LV_USE_GENERIC_MIPI 0 + #endif + #else + #define LV_USE_GENERIC_MIPI 1 + #endif + #endif +#else + #ifndef LV_USE_GENERIC_MIPI + #ifdef CONFIG_LV_USE_GENERIC_MIPI + #define LV_USE_GENERIC_MIPI CONFIG_LV_USE_GENERIC_MIPI + #else + #define LV_USE_GENERIC_MIPI 0 + #endif + #endif +#endif + +/** Driver for Renesas GLCD */ +#ifndef LV_USE_RENESAS_GLCDC + #ifdef CONFIG_LV_USE_RENESAS_GLCDC + #define LV_USE_RENESAS_GLCDC CONFIG_LV_USE_RENESAS_GLCDC + #else + #define LV_USE_RENESAS_GLCDC 0 + #endif +#endif + +/** Driver for ST LTDC */ +#ifndef LV_USE_ST_LTDC + #ifdef CONFIG_LV_USE_ST_LTDC + #define LV_USE_ST_LTDC CONFIG_LV_USE_ST_LTDC + #else + #define LV_USE_ST_LTDC 0 + #endif +#endif +#if LV_USE_ST_LTDC + /* Only used for partial. */ + #ifndef LV_ST_LTDC_USE_DMA2D_FLUSH + #ifdef CONFIG_LV_ST_LTDC_USE_DMA2D_FLUSH + #define LV_ST_LTDC_USE_DMA2D_FLUSH CONFIG_LV_ST_LTDC_USE_DMA2D_FLUSH + #else + #define LV_ST_LTDC_USE_DMA2D_FLUSH 0 + #endif + #endif +#endif + +/** Driver for NXP ELCDIF */ +#ifndef LV_USE_NXP_ELCDIF + #ifdef CONFIG_LV_USE_NXP_ELCDIF + #define LV_USE_NXP_ELCDIF CONFIG_LV_USE_NXP_ELCDIF + #else + #define LV_USE_NXP_ELCDIF 0 + #endif +#endif + +/** LVGL Windows backend */ +#ifndef LV_USE_WINDOWS + #ifdef CONFIG_LV_USE_WINDOWS + #define LV_USE_WINDOWS CONFIG_LV_USE_WINDOWS + #else + #define LV_USE_WINDOWS 0 + #endif +#endif + +/** LVGL UEFI backend */ +#ifndef LV_USE_UEFI + #ifdef CONFIG_LV_USE_UEFI + #define LV_USE_UEFI CONFIG_LV_USE_UEFI + #else + #define LV_USE_UEFI 0 + #endif +#endif +#if LV_USE_UEFI + #ifndef LV_USE_UEFI_INCLUDE + #ifdef CONFIG_LV_USE_UEFI_INCLUDE + #define LV_USE_UEFI_INCLUDE CONFIG_LV_USE_UEFI_INCLUDE + #else + #define LV_USE_UEFI_INCLUDE "myefi.h" /**< Header that hides the actual framework (EDK2, gnu-efi, ...) */ + #endif + #endif + #ifndef LV_UEFI_USE_MEMORY_SERVICES + #ifdef CONFIG_LV_UEFI_USE_MEMORY_SERVICES + #define LV_UEFI_USE_MEMORY_SERVICES CONFIG_LV_UEFI_USE_MEMORY_SERVICES + #else + #define LV_UEFI_USE_MEMORY_SERVICES 0 /**< Use the memory functions from the boot services table */ + #endif + #endif +#endif + +/** Use a generic OpenGL driver that can be used to embed in other applications or used with GLFW/EGL + * - Requires LV_USE_MATRIX. + */ +#ifndef LV_USE_OPENGLES + #ifdef CONFIG_LV_USE_OPENGLES + #define LV_USE_OPENGLES CONFIG_LV_USE_OPENGLES + #else + #define LV_USE_OPENGLES 0 + #endif +#endif +#if LV_USE_OPENGLES + #ifndef LV_USE_OPENGLES_DEBUG + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_USE_OPENGLES_DEBUG + #define LV_USE_OPENGLES_DEBUG CONFIG_LV_USE_OPENGLES_DEBUG + #else + #define LV_USE_OPENGLES_DEBUG 0 + #endif + #else + #define LV_USE_OPENGLES_DEBUG 1 /**< Enable or disable debug for opengles */ + #endif + #endif +#endif + +/** Use GLFW to open window on PC and handle mouse and keyboard. Requires*/ +#ifndef LV_USE_GLFW + #ifdef CONFIG_LV_USE_GLFW + #define LV_USE_GLFW CONFIG_LV_USE_GLFW + #else + #define LV_USE_GLFW 0 + #endif +#endif + + +/** QNX Screen display and input drivers */ +#ifndef LV_USE_QNX + #ifdef CONFIG_LV_USE_QNX + #define LV_USE_QNX CONFIG_LV_USE_QNX + #else + #define LV_USE_QNX 0 + #endif +#endif +#if LV_USE_QNX + #ifndef LV_QNX_BUF_COUNT + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_QNX_BUF_COUNT + #define LV_QNX_BUF_COUNT CONFIG_LV_QNX_BUF_COUNT + #else + #define LV_QNX_BUF_COUNT 0 + #endif + #else + #define LV_QNX_BUF_COUNT 1 /**< 1 or 2 */ + #endif + #endif +#endif + +/** Enable or disable for external data and destructor function */ +#ifndef LV_USE_EXT_DATA + #ifdef CONFIG_LV_USE_EXT_DATA + #define LV_USE_EXT_DATA CONFIG_LV_USE_EXT_DATA + #else + #define LV_USE_EXT_DATA 0 + #endif +#endif + +/*===================== +* BUILD OPTIONS +*======================*/ + +/** Enable examples to be built with the library. */ +#ifndef LV_BUILD_EXAMPLES + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_BUILD_EXAMPLES + #define LV_BUILD_EXAMPLES CONFIG_LV_BUILD_EXAMPLES + #else + #define LV_BUILD_EXAMPLES 0 + #endif + #else + #define LV_BUILD_EXAMPLES 1 + #endif +#endif + +/** Build the demos */ +#ifndef LV_BUILD_DEMOS + #ifdef LV_KCONFIG_PRESENT + #ifdef CONFIG_LV_BUILD_DEMOS + #define LV_BUILD_DEMOS CONFIG_LV_BUILD_DEMOS + #else + #define LV_BUILD_DEMOS 0 + #endif + #else + #define LV_BUILD_DEMOS 1 + #endif +#endif + +/*=================== + * DEMO USAGE + ====================*/ + +#if LV_BUILD_DEMOS + /** Show some widgets. This might be required to increase `LV_MEM_SIZE`. */ + #ifndef LV_USE_DEMO_WIDGETS + #ifdef CONFIG_LV_USE_DEMO_WIDGETS + #define LV_USE_DEMO_WIDGETS CONFIG_LV_USE_DEMO_WIDGETS + #else + #define LV_USE_DEMO_WIDGETS 0 + #endif + #endif + + /** Demonstrate usage of encoder and keyboard. */ + #ifndef LV_USE_DEMO_KEYPAD_AND_ENCODER + #ifdef CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER + #define LV_USE_DEMO_KEYPAD_AND_ENCODER CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER + #else + #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 + #endif + #endif + + /** Benchmark your system */ + #ifndef LV_USE_DEMO_BENCHMARK + #ifdef CONFIG_LV_USE_DEMO_BENCHMARK + #define LV_USE_DEMO_BENCHMARK CONFIG_LV_USE_DEMO_BENCHMARK + #else + #define LV_USE_DEMO_BENCHMARK 0 + #endif + #endif + + #if LV_USE_DEMO_BENCHMARK + /** Use fonts where bitmaps are aligned 16 byte and has Nx16 byte stride */ + #ifndef LV_DEMO_BENCHMARK_ALIGNED_FONTS + #ifdef CONFIG_LV_DEMO_BENCHMARK_ALIGNED_FONTS + #define LV_DEMO_BENCHMARK_ALIGNED_FONTS CONFIG_LV_DEMO_BENCHMARK_ALIGNED_FONTS + #else + #define LV_DEMO_BENCHMARK_ALIGNED_FONTS 0 + #endif + #endif + #endif + + /** Render test for each primitive. + * - Requires at least 480x272 display. */ + #ifndef LV_USE_DEMO_RENDER + #ifdef CONFIG_LV_USE_DEMO_RENDER + #define LV_USE_DEMO_RENDER CONFIG_LV_USE_DEMO_RENDER + #else + #define LV_USE_DEMO_RENDER 0 + #endif + #endif + + /** Stress test for LVGL */ + #ifndef LV_USE_DEMO_STRESS + #ifdef CONFIG_LV_USE_DEMO_STRESS + #define LV_USE_DEMO_STRESS CONFIG_LV_USE_DEMO_STRESS + #else + #define LV_USE_DEMO_STRESS 0 + #endif + #endif + + /** Music player demo */ + #ifndef LV_USE_DEMO_MUSIC + #ifdef CONFIG_LV_USE_DEMO_MUSIC + #define LV_USE_DEMO_MUSIC CONFIG_LV_USE_DEMO_MUSIC + #else + #define LV_USE_DEMO_MUSIC 0 + #endif + #endif + #if LV_USE_DEMO_MUSIC + #ifndef LV_DEMO_MUSIC_SQUARE + #ifdef CONFIG_LV_DEMO_MUSIC_SQUARE + #define LV_DEMO_MUSIC_SQUARE CONFIG_LV_DEMO_MUSIC_SQUARE + #else + #define LV_DEMO_MUSIC_SQUARE 0 + #endif + #endif + #ifndef LV_DEMO_MUSIC_LANDSCAPE + #ifdef CONFIG_LV_DEMO_MUSIC_LANDSCAPE + #define LV_DEMO_MUSIC_LANDSCAPE CONFIG_LV_DEMO_MUSIC_LANDSCAPE + #else + #define LV_DEMO_MUSIC_LANDSCAPE 0 + #endif + #endif + #ifndef LV_DEMO_MUSIC_ROUND + #ifdef CONFIG_LV_DEMO_MUSIC_ROUND + #define LV_DEMO_MUSIC_ROUND CONFIG_LV_DEMO_MUSIC_ROUND + #else + #define LV_DEMO_MUSIC_ROUND 0 + #endif + #endif + #ifndef LV_DEMO_MUSIC_LARGE + #ifdef CONFIG_LV_DEMO_MUSIC_LARGE + #define LV_DEMO_MUSIC_LARGE CONFIG_LV_DEMO_MUSIC_LARGE + #else + #define LV_DEMO_MUSIC_LARGE 0 + #endif + #endif + #ifndef LV_DEMO_MUSIC_AUTO_PLAY + #ifdef CONFIG_LV_DEMO_MUSIC_AUTO_PLAY + #define LV_DEMO_MUSIC_AUTO_PLAY CONFIG_LV_DEMO_MUSIC_AUTO_PLAY + #else + #define LV_DEMO_MUSIC_AUTO_PLAY 0 + #endif + #endif + #endif + + /** Vector graphic demo */ + #ifndef LV_USE_DEMO_VECTOR_GRAPHIC + #ifdef CONFIG_LV_USE_DEMO_VECTOR_GRAPHIC + #define LV_USE_DEMO_VECTOR_GRAPHIC CONFIG_LV_USE_DEMO_VECTOR_GRAPHIC + #else + #define LV_USE_DEMO_VECTOR_GRAPHIC 0 + #endif + #endif + + /** GLTF demo */ + #ifndef LV_USE_DEMO_GLTF + #ifdef CONFIG_LV_USE_DEMO_GLTF + #define LV_USE_DEMO_GLTF CONFIG_LV_USE_DEMO_GLTF + #else + #define LV_USE_DEMO_GLTF 0 + #endif + #endif + + /*--------------------------- + * Demos from lvgl/lv_demos + ---------------------------*/ + + /** Flex layout demo */ + #ifndef LV_USE_DEMO_FLEX_LAYOUT + #ifdef CONFIG_LV_USE_DEMO_FLEX_LAYOUT + #define LV_USE_DEMO_FLEX_LAYOUT CONFIG_LV_USE_DEMO_FLEX_LAYOUT + #else + #define LV_USE_DEMO_FLEX_LAYOUT 0 + #endif + #endif + + /** Smart-phone like multi-language demo */ + #ifndef LV_USE_DEMO_MULTILANG + #ifdef CONFIG_LV_USE_DEMO_MULTILANG + #define LV_USE_DEMO_MULTILANG CONFIG_LV_USE_DEMO_MULTILANG + #else + #define LV_USE_DEMO_MULTILANG 0 + #endif + #endif + + /*E-bike demo with Lottie animations (if LV_USE_LOTTIE is enabled)*/ + #ifndef LV_USE_DEMO_EBIKE + #ifdef CONFIG_LV_USE_DEMO_EBIKE + #define LV_USE_DEMO_EBIKE CONFIG_LV_USE_DEMO_EBIKE + #else + #define LV_USE_DEMO_EBIKE 0 + #endif + #endif + #if LV_USE_DEMO_EBIKE + #ifndef LV_DEMO_EBIKE_PORTRAIT + #ifdef CONFIG_LV_DEMO_EBIKE_PORTRAIT + #define LV_DEMO_EBIKE_PORTRAIT CONFIG_LV_DEMO_EBIKE_PORTRAIT + #else + #define LV_DEMO_EBIKE_PORTRAIT 0 /*0: for 480x270..480x320, 1: for 480x800..720x1280*/ + #endif + #endif + #endif + + /** High-resolution demo */ + #ifndef LV_USE_DEMO_HIGH_RES + #ifdef CONFIG_LV_USE_DEMO_HIGH_RES + #define LV_USE_DEMO_HIGH_RES CONFIG_LV_USE_DEMO_HIGH_RES + #else + #define LV_USE_DEMO_HIGH_RES 0 + #endif + #endif + + /* Smart watch demo */ + #ifndef LV_USE_DEMO_SMARTWATCH + #ifdef CONFIG_LV_USE_DEMO_SMARTWATCH + #define LV_USE_DEMO_SMARTWATCH CONFIG_LV_USE_DEMO_SMARTWATCH + #else + #define LV_USE_DEMO_SMARTWATCH 0 + #endif + #endif +#endif /* LV_BUILD_DEMOS */ + + + +/*---------------------------------- + * End of parsing lv_conf_template.h + -----------------------------------*/ + +/*Fix inconsistent name*/ +#define LV_USE_ANIMIMAGE LV_USE_ANIMIMG + +#ifndef __ASSEMBLY__ +LV_EXPORT_CONST_INT(LV_DPI_DEF); +LV_EXPORT_CONST_INT(LV_DRAW_BUF_STRIDE_ALIGN); +LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN); +#endif + +#undef LV_KCONFIG_PRESENT + +/* Disable VGLite drivers if VGLite drawing is disabled */ +#ifndef LV_USE_VG_LITE_DRIVER + #define LV_USE_VG_LITE_DRIVER 0 +#endif + +#ifndef LV_USE_VG_LITE_THORVG + #define LV_USE_VG_LITE_THORVG 0 +#endif + +/* Set some defines if a dependency is disabled. */ +#if LV_USE_LOG == 0 + #define LV_LOG_LEVEL LV_LOG_LEVEL_NONE + #define LV_LOG_TRACE_MEM 0 + #define LV_LOG_TRACE_TIMER 0 + #define LV_LOG_TRACE_INDEV 0 + #define LV_LOG_TRACE_DISP_REFR 0 + #define LV_LOG_TRACE_EVENT 0 + #define LV_LOG_TRACE_OBJ_CREATE 0 + #define LV_LOG_TRACE_LAYOUT 0 + #define LV_LOG_TRACE_ANIM 0 +#endif /*LV_USE_LOG*/ + +#if LV_USE_WAYLAND + /*Automatically detect wayland backend*/ + #if LV_USE_OPENGLES + #define LV_WAYLAND_USE_EGL 1 + #define LV_WAYLAND_USE_G2D 0 + #define LV_WAYLAND_USE_SHM 0 + #elif LV_USE_G2D + #define LV_WAYLAND_USE_EGL 0 + #define LV_WAYLAND_USE_G2D 1 + #define LV_WAYLAND_USE_SHM 0 + #else + #define LV_WAYLAND_USE_EGL 0 + #define LV_WAYLAND_USE_G2D 0 + #define LV_WAYLAND_USE_SHM 1 + #endif +#else + #define LV_WAYLAND_USE_G2D 0 + #define LV_WAYLAND_USE_SHM 0 + #define LV_WAYLAND_USE_EGL 0 +#endif + +#if LV_USE_LINUX_DRM + #if LV_USE_OPENGLES + #define LV_LINUX_DRM_USE_EGL 1 + #else + #define LV_LINUX_DRM_USE_EGL 0 + #endif /* LV_USE_OPENGLES */ +#else + #define LV_LINUX_DRM_USE_EGL 0 +#endif /*LV_USE_LINUX_DRM*/ + +#if LV_USE_SYSMON == 0 + #define LV_USE_PERF_MONITOR 0 + #define LV_USE_MEM_MONITOR 0 + #define LV_SYSMON_PROC_IDLE_AVAILABLE 0 +#endif /*LV_USE_SYSMON*/ + +#if LV_USE_PERF_MONITOR == 0 + #define LV_USE_PERF_MONITOR_LOG_MODE 0 +#endif /*LV_USE_PERF_MONITOR*/ + +#if LV_BUILD_DEMOS == 0 + #define LV_USE_DEMO_WIDGETS 0 + #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 + #define LV_USE_DEMO_BENCHMARK 0 + #define LV_USE_DEMO_RENDER 0 + #define LV_USE_DEMO_STRESS 0 + #define LV_USE_DEMO_MUSIC 0 + #define LV_USE_DEMO_VECTOR_GRAPHIC 0 + #define LV_USE_DEMO_FLEX_LAYOUT 0 + #define LV_USE_DEMO_MULTILANG 0 + #define LV_USE_DEMO_EBIKE 0 + #define LV_USE_DEMO_HIGH_RES 0 + #define LV_USE_DEMO_SMARTWATCH 0 + #define LV_USE_DEMO_GLTF 0 +#endif /* LV_BUILD_DEMOS */ + +#ifndef LV_USE_LZ4 + #if (LV_USE_LZ4_INTERNAL || LV_USE_LZ4_EXTERNAL) + #define LV_USE_LZ4 1 + #else + #define LV_USE_LZ4 0 + #endif +#endif + +#ifndef LV_USE_THORVG + #if (LV_USE_THORVG_INTERNAL || LV_USE_THORVG_EXTERNAL) + #define LV_USE_THORVG 1 + #else + #define LV_USE_THORVG 0 + #endif +#endif + +#if LV_USE_SDL && LV_USE_OPENGLES && (LV_USE_DRAW_OPENGLES || LV_USE_DRAW_NANOVG) + #define LV_SDL_USE_EGL 1 +#else + #define LV_SDL_USE_EGL 0 +#endif + +#ifndef LV_USE_EGL + #if LV_LINUX_DRM_USE_EGL || LV_WAYLAND_USE_EGL || LV_SDL_USE_EGL + #define LV_USE_EGL 1 + #else + #define LV_USE_EGL 0 + #endif +#endif /* LV_USE_EGL */ + + +#if LV_USE_OS + #if (LV_USE_FREETYPE || LV_USE_THORVG) && LV_DRAW_THREAD_STACK_SIZE < (32 * 1024) + #error "Increase LV_DRAW_THREAD_STACK_SIZE to at least 32KB for FreeType or ThorVG." + #endif + + #if defined(LV_DRAW_THREAD_STACKSIZE) && !defined(LV_DRAW_THREAD_STACK_SIZE) + #warning "LV_DRAW_THREAD_STACKSIZE was renamed to LV_DRAW_THREAD_STACK_SIZE. Please update lv_conf.h or run menuconfig again." + #define LV_DRAW_THREAD_STACK_SIZE LV_DRAW_THREAD_STACKSIZE + #endif +#endif + +/*Allow only upper case letters and '/' ('/' is a special case for backward compatibility)*/ +#define LV_FS_IS_VALID_LETTER(l) ((l) == '/' || ((l) >= 'A' && (l) <= 'Z')) + +/* If running without lv_conf.h, add typedefs with default value. */ +#ifdef LV_CONF_SKIP + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/ + #define _CRT_SECURE_NO_WARNINGS + #endif +#endif /*defined(LV_CONF_SKIP)*/ + +#endif /*LV_CONF_INTERNAL_H*/ diff --git a/include/lvgl/config/lv_conf_kconfig.h b/include/lvgl/config/lv_conf_kconfig.h new file mode 100644 index 0000000000..5900cf4422 --- /dev/null +++ b/include/lvgl/config/lv_conf_kconfig.h @@ -0,0 +1,325 @@ +/** * @file lv_conf_kconfig.h * Configs that need special handling when LVGL is used with Kconfig */ + +#ifndef LV_CONF_KCONFIG_H +#define LV_CONF_KCONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef LV_CONF_KCONFIG_EXTERNAL_INCLUDE +# include LV_CONF_KCONFIG_EXTERNAL_INCLUDE +#else + +# ifdef ESP_PLATFORM +# include "sdkconfig.h" +# include "esp_attr.h" +# endif + +# ifdef __NuttX__ +# include +/* + * Make sure version number in Kconfig file is correctly set. + * Mismatch can happen when user manually copy lvgl/Kconfig file to their project, like what NuttX does. + */ +# include "../lv_version.h" + +# if CONFIG_LVGL_VERSION_MAJOR != LVGL_VERSION_MAJOR || CONFIG_LVGL_VERSION_MINOR != LVGL_VERSION_MINOR \ + || CONFIG_LVGL_VERSION_PATCH != LVGL_VERSION_PATCH +# warning "Version mismatch between Kconfig and lvgl/lv_version.h" +# endif +# elif defined(__RTTHREAD__) +# define LV_CONF_INCLUDE_SIMPLE +# include +# endif + +#endif /*LV_CONF_KCONFIG_EXTERNAL_INCLUDE*/ + +/******************* + * LV_USE_STDLIB_MALLOC + *******************/ + +#ifdef CONFIG_LV_USE_BUILTIN_MALLOC +# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN +#elif defined(CONFIG_LV_USE_CLIB_MALLOC) +# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB +#elif defined(CONFIG_LV_USE_MICROPYTHON_MALLOC) +# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_MICROPYTHON +#elif defined(CONFIG_LV_USE_RTTHREAD_MALLOC) +# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_RTTHREAD +#elif defined (CONFIG_LV_USE_CUSTOM_MALLOC) +# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_CUSTOM +#endif + +/******************* + * LV_USE_STDLIB_STRING + *******************/ + +#ifdef CONFIG_LV_USE_BUILTIN_STRING +# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN +#elif defined(CONFIG_LV_USE_CLIB_STRING) +# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_CLIB +#elif defined(CONFIG_LV_USE_MICROPYTHON_STRING) +# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_MICROPYTHON +#elif defined(CONFIG_LV_USE_RTTHREAD_STRING) +# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_RTTHREAD +#elif defined (CONFIG_LV_USE_CUSTOM_STRING) +# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_CUSTOM +#endif + +/******************* + * LV_USE_STDLIB_SPRINTF + *******************/ + +#ifdef CONFIG_LV_USE_BUILTIN_SPRINTF +# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN +#elif defined(CONFIG_LV_USE_CLIB_SPRINTF) +# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_CLIB +#elif defined(CONFIG_LV_USE_MICROPYTHON_SPRINTF) +# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_MICROPYTHON +#elif defined(CONFIG_LV_USE_RTTHREAD_SPRINTF) +# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_RTTHREAD +#elif defined (CONFIG_LV_USE_CUSTOM_SPRINTF) +# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_CUSTOM +#endif + +/******************* + * LV_USE_OS + *******************/ + +#ifdef CONFIG_LV_OS_NONE +# define CONFIG_LV_USE_OS LV_OS_NONE +#elif defined(CONFIG_LV_OS_PTHREAD) +# define CONFIG_LV_USE_OS LV_OS_PTHREAD +#elif defined(CONFIG_LV_OS_FREERTOS) +# define CONFIG_LV_USE_OS LV_OS_FREERTOS +#elif defined(CONFIG_LV_OS_CMSIS_RTOS2) +# define CONFIG_LV_USE_OS LV_OS_CMSIS_RTOS2 +#elif defined (CONFIG_LV_OS_RTTHREAD) +# define CONFIG_LV_USE_OS LV_OS_RTTHREAD +#elif defined (CONFIG_LV_OS_WINDOWS) +# define CONFIG_LV_USE_OS LV_OS_WINDOWS +#elif defined (CONFIG_LV_OS_MQX) +# define CONFIG_LV_USE_OS LV_OS_MQX +#elif defined (CONFIG_LV_OS_SDL2) +# define CONFIG_LV_USE_OS LV_OS_SDL2 +#elif defined (CONFIG_LV_OS_CUSTOM) +# define CONFIG_LV_USE_OS LV_OS_CUSTOM +#endif + +/******************* + * LV_NANOVG_BACKEND + *******************/ + +#ifdef CONFIG_LV_NANOVG_BACKEND_GL2 +# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GL2 +#elif defined(CONFIG_LV_NANOVG_BACKEND_GL3) +# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GL3 +#elif defined(CONFIG_LV_NANOVG_BACKEND_GLES2) +# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GLES2 +#elif defined(CONFIG_LV_NANOVG_BACKEND_GLES3) +# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GLES3 +#endif + +/******************* + * LV_MEM_SIZE + *******************/ + +#ifdef CONFIG_LV_MEM_SIZE_KILOBYTES +# if(CONFIG_LV_MEM_SIZE_KILOBYTES < 2) +# error "LV_MEM_SIZE >= 2kB is required" +# endif + +# define CONFIG_LV_MEM_SIZE (CONFIG_LV_MEM_SIZE_KILOBYTES * 1024U) +#endif + +#ifdef CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES +# define CONFIG_LV_MEM_POOL_EXPAND_SIZE (CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES * 1024U) +#endif + +/*------------------ + * MONITOR POSITION + *-----------------*/ + +#ifdef CONFIG_LV_PERF_MONITOR_ALIGN_TOP_LEFT +# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_LEFT +#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_TOP_MID) +# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_MID +#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_TOP_RIGHT) +# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_RIGHT +#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_LEFT) +# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_LEFT +#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_MID) +# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_MID +#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT) +# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT +#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_LEFT_MID) +# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_LEFT_MID +#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_RIGHT_MID) +# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_RIGHT_MID +#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_CENTER) +# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_CENTER +#endif + +#ifdef CONFIG_LV_MEM_MONITOR_ALIGN_TOP_LEFT +# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_TOP_LEFT +#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_TOP_MID) +# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_TOP_MID +#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_TOP_RIGHT) +# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_TOP_RIGHT +#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT) +# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT +#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_MID) +# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_MID +#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_RIGHT) +# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT +#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_LEFT_MID) +# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_LEFT_MID +#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_RIGHT_MID) +# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_RIGHT_MID +#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_CENTER) +# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_CENTER +#endif + +/******************** + * FONT SELECTION + *******************/ + +/** + * NOTE: In Kconfig instead of `LV_DEFAULT_FONT` + * `CONFIG_LV_FONT_DEFAULT_` is defined + * hence the large selection with if-s + */ + +/*------------------ + * DEFAULT FONT + *-----------------*/ +#ifdef CONFIG_LV_FONT_DEFAULT_MONTSERRAT_8 +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_8 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_10) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_10 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_12 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_14) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_14 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_16) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_16 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_18) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_18 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_20) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_20 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_22) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_22 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_24) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_24 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_26 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_28 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_30) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_30 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_32 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_34) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_34 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_36) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_36 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_38) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_38 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_40) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_40 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_42) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_42 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_44) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_44 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_46) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_46 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_48) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_48 +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12_SUBPX) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_12_subpx +#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28_COMPRESSED) +# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_28_compressed +#elif defined(CONFIG_LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW) +# define CONFIG_LV_FONT_DEFAULT &lv_font_dejavu_16_persian_hebrew +#elif defined(CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK) +# define CONFIG_LV_FONT_DEFAULT &lv_font_source_han_sans_sc_14_cjk +#elif defined(CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK) +# define CONFIG_LV_FONT_DEFAULT &lv_font_source_han_sans_sc_16_cjk +#elif defined(CONFIG_LV_FONT_DEFAULT_UNSCII_8) +# define CONFIG_LV_FONT_DEFAULT &lv_font_unscii_8 +#elif defined(CONFIG_LV_FONT_DEFAULT_UNSCII_16) +# define CONFIG_LV_FONT_DEFAULT &lv_font_unscii_16 +#endif + +/*------------------ + * TEXT ENCODING + *-----------------*/ +#ifdef CONFIG_LV_TXT_ENC_UTF8 +# define CONFIG_LV_TXT_ENC LV_TXT_ENC_UTF8 +#elif defined(CONFIG_LV_TXT_ENC_ASCII) +# define CONFIG_LV_TXT_ENC LV_TXT_ENC_ASCII +#endif + +/*------------------ + * BIDI DIRECTION + *-----------------*/ + +#ifdef CONFIG_LV_BASE_DIR_LTR +# define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_LTR +#elif defined(CONFIG_LV_BASE_DIR_RTL) +# define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_RTL +#elif defined(CONFIG_LV_BASE_DIR_AUTO) +# define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO +#endif + +/*------------------ + * SDL + *-----------------*/ + +#ifdef CONFIG_LV_SDL_RENDER_MODE_PARTIAL +# define CONFIG_LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL +#elif defined(CONFIG_LV_SDL_RENDER_MODE_DIRECT) +# define CONFIG_LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT +#elif defined(CONFIG_LV_SDL_RENDER_MODE_FULL) +# define CONFIG_LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_FULL +#endif + +/*------------------ + * WAYLAND + *-----------------*/ + +#ifdef CONFIG_LV_WAYLAND_RENDER_MODE_PARTIAL +# define CONFIG_LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL +#elif defined(CONFIG_LV_WAYLAND_RENDER_MODE_DIRECT) +# define CONFIG_LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT +#elif defined(CONFIG_LV_WAYLAND_RENDER_MODE_FULL) +# define CONFIG_LV_WAYLAND_RENDER_MODE_FULL LV_DISPLAY_RENDER_MODE_FULL +#endif + +/*------------------ + * LINUX FBDEV + *-----------------*/ + +#ifdef CONFIG_LV_LINUX_FBDEV_RENDER_MODE_PARTIAL +# define CONFIG_LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL +#elif defined(CONFIG_LV_LINUX_FBDEV_RENDER_MODE_DIRECT) +# define CONFIG_LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT +#elif defined(CONFIG_LV_LINUX_FBDEV_RENDER_MODE_FULL) +# define CONFIG_LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_FULL +#endif + + +#ifdef CONFIG_LV_USE_CALENDAR +# ifdef CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY +# define CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES { CONFIG_LV_MONDAY_STR , CONFIG_LV_TUESDAY_STR, CONFIG_LV_WEDNESDAY_STR, CONFIG_LV_THURSDAY_STR, CONFIG_LV_FRIDAY_STR, CONFIG_LV_SATURDAY_STR, CONFIG_LV_SUNDAY_STR } +# else +# define CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES { CONFIG_LV_SUNDAY_STR, CONFIG_LV_MONDAY_STR , CONFIG_LV_TUESDAY_STR, CONFIG_LV_WEDNESDAY_STR, CONFIG_LV_THURSDAY_STR, CONFIG_LV_FRIDAY_STR, CONFIG_LV_SATURDAY_STR } +# endif +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CONF_KCONFIG_H*/ diff --git a/include/lvgl/core/lv_anim.h b/include/lvgl/core/lv_anim.h new file mode 100644 index 0000000000..b51b458b26 --- /dev/null +++ b/include/lvgl/core/lv_anim.h @@ -0,0 +1,591 @@ +/** + * @file lv_anim.h + * + */ + +#ifndef LV_ANIM_H +#define LV_ANIM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" +#include "../misc/lv_math.h" +#include "lv_ext_data.h" + +/********************* + * DEFINES + *********************/ + +#define LV_ANIM_REPEAT_INFINITE 0xFFFFFFFF +#define LV_ANIM_PLAYTIME_INFINITE 0xFFFFFFFF +#define LV_ANIM_PAUSE_FOREVER 0xFFFFFFFF + +/* + * Macros used to set cubic-bezier anim parameter. + * Parameters come from https://easings.net/ + * + * Usage: + * + * lv_anim_t a; + * lv_anim_init(&a); + * ... + * lv_anim_set_path_cb(&a, lv_anim_path_custom_bezier3); + * LV_ANIM_SET_EASE_IN_SINE(&a); //Set cubic-bezier anim parameter to easeInSine + * ... + * lv_anim_start(&a); + */ + +#define _PARA(a, x1, y1, x2, y2) ((a)->parameter.bezier3 = \ +(lv_anim_bezier3_para_t) { \ + LV_BEZIER_VAL_FLOAT(x1), LV_BEZIER_VAL_FLOAT(y1), \ + LV_BEZIER_VAL_FLOAT(x2), LV_BEZIER_VAL_FLOAT(y2) } \ + ) + +#define LV_ANIM_SET_EASE_IN_SINE(a) _PARA(a, 0.12, 0, 0.39, 0) +#define LV_ANIM_SET_EASE_OUT_SINE(a) _PARA(a, 0.61, 1, 0.88, 1) +#define LV_ANIM_SET_EASE_IN_OUT_SINE(a) _PARA(a, 0.37, 0, 0.63, 1) +#define LV_ANIM_SET_EASE_IN_QUAD(a) _PARA(a, 0.11, 0, 0.5, 0) +#define LV_ANIM_SET_EASE_OUT_QUAD(a) _PARA(a, 0.5, 1, 0.89, 1) +#define LV_ANIM_SET_EASE_IN_OUT_QUAD(a) _PARA(a, 0.45, 0, 0.55, 1) +#define LV_ANIM_SET_EASE_IN_CUBIC(a) _PARA(a, 0.32, 0, 0.67, 0) +#define LV_ANIM_SET_EASE_OUT_CUBIC(a) _PARA(a, 0.33, 1, 0.68, 1) +#define LV_ANIM_SET_EASE_IN_OUT_CUBIC(a) _PARA(a, 0.65, 0, 0.35, 1) +#define LV_ANIM_SET_EASE_IN_QUART(a) _PARA(a, 0.5, 0, 0.75, 0) +#define LV_ANIM_SET_EASE_OUT_QUART(a) _PARA(a, 0.25, 1, 0.5, 1) +#define LV_ANIM_SET_EASE_IN_OUT_QUART(a) _PARA(a, 0.76, 0, 0.24, 1) +#define LV_ANIM_SET_EASE_IN_QUINT(a) _PARA(a, 0.64, 0, 0.78, 0) +#define LV_ANIM_SET_EASE_OUT_QUINT(a) _PARA(a, 0.22, 1, 0.36, 1) +#define LV_ANIM_SET_EASE_IN_OUT_QUINT(a) _PARA(a, 0.83, 0, 0.17, 1) +#define LV_ANIM_SET_EASE_IN_EXPO(a) _PARA(a, 0.7, 0, 0.84, 0) +#define LV_ANIM_SET_EASE_OUT_EXPO(a) _PARA(a, 0.16, 1, 0.3, 1) +#define LV_ANIM_SET_EASE_IN_OUT_EXPO(a) _PARA(a, 0.87, 0, 0.13, 1) +#define LV_ANIM_SET_EASE_IN_CIRC(a) _PARA(a, 0.55, 0, 1, 0.45) +#define LV_ANIM_SET_EASE_OUT_CIRC(a) _PARA(a, 0, 0.55, 0.45, 1) +#define LV_ANIM_SET_EASE_IN_OUT_CIRC(a) _PARA(a, 0.85, 0, 0.15, 1) +#define LV_ANIM_SET_EASE_IN_BACK(a) _PARA(a, 0.36, 0, 0.66, -0.56) +#define LV_ANIM_SET_EASE_OUT_BACK(a) _PARA(a, 0.34, 1.56, 0.64, 1) +#define LV_ANIM_SET_EASE_IN_OUT_BACK(a) _PARA(a, 0.68, -0.6, 0.32, 1.6) + +LV_EXPORT_CONST_INT(LV_ANIM_REPEAT_INFINITE); +LV_EXPORT_CONST_INT(LV_ANIM_PLAYTIME_INFINITE); + +/********************** + * TYPEDEFS + **********************/ + +/** Can be used to indicate if animations are enabled or disabled in a case*/ +#define LV_ANIM_OFF false +#define LV_ANIM_ON true +typedef bool lv_anim_enable_t; + +/** Get the current value during an animation*/ +typedef int32_t (*lv_anim_path_cb_t)(const lv_anim_t *); + +/** Generic prototype of "animator" functions. + * First parameter is the variable to animate. + * Second parameter is the value to set. + * Compatible with `lv_xxx_set_yyy(obj, value)` functions + * The `x` in `_xcb_t` means it's not a fully generic prototype because + * it doesn't receive `lv_anim_t *` as its first argument*/ +typedef void (*lv_anim_exec_xcb_t)(void *, int32_t); + +/** Same as `lv_anim_exec_xcb_t` but receives `lv_anim_t *` as the first parameter. + * It's more consistent but less convenient. Might be used by binding generator functions.*/ +typedef void (*lv_anim_custom_exec_cb_t)(lv_anim_t *, int32_t); + +/** Callback to call when the animation is ready*/ +typedef void (*lv_anim_completed_cb_t)(lv_anim_t *); + +/** Callback to call when the animation really stars (considering `delay`)*/ +typedef void (*lv_anim_start_cb_t)(lv_anim_t *); + +/** Callback used when the animation values are relative to get the current value*/ +typedef int32_t (*lv_anim_get_value_cb_t)(lv_anim_t *); + +/** Callback used when the animation is deleted*/ +typedef void (*lv_anim_deleted_cb_t)(lv_anim_t *); + +/** Parameter used when path is custom_bezier */ +typedef struct { + int16_t x1; + int16_t y1; + int16_t x2; + int16_t y2; +} lv_anim_bezier3_para_t; + +/** Describes an animation*/ +struct _lv_anim_t { +#if LV_USE_EXT_DATA + lv_ext_data_t ext_data; +#endif + void * var; /**< Variable (Widget or other user-provided object) to animate */ + lv_anim_exec_xcb_t exec_cb; /**< Function to execute to animate */ + lv_anim_custom_exec_cb_t custom_exec_cb; /**< Function to execute to animate, + * same purpose as exec_cb but different parameters */ + lv_anim_start_cb_t start_cb; /**< Call it when animation is starts (considering `delay`) */ + lv_anim_completed_cb_t completed_cb; /**< Call it when animation is fully completed */ + lv_anim_deleted_cb_t deleted_cb; /**< Call it when animation is deleted */ + lv_anim_get_value_cb_t get_value_cb; /**< Get current value in relative mode */ + void * user_data; /**< Custom user data */ + lv_anim_path_cb_t path_cb; /**< Provides path (curve) of animation */ + int32_t start_value; /**< Start value */ + int32_t current_value; /**< Current value */ + int32_t end_value; /**< End value */ + int32_t duration; /**< Animation duration in ms */ + int32_t act_time; /**< Ms elapsed since animation started. Set to negative to make delay. */ + uint32_t reverse_delay; /**< Wait (in ms) after forward play ends and before reverse play begins. */ + uint32_t reverse_duration; /**< Reverse animation duration in ms */ + uint32_t repeat_delay; /**< Wait before repeating */ + uint32_t repeat_cnt; /**< Repeat count for animation */ + union _lv_anim_path_para_t { + lv_anim_bezier3_para_t bezier3; /**< Parameter used when path is custom_bezier */ + } parameter; + + /* Animation system use these - user shouldn't set */ + uint32_t last_timer_run; + uint32_t pause_time; /**parameter.bezier3 + * @param a pointer to an animation + * @return the current value to set + */ +int32_t lv_anim_path_custom_bezier3(const lv_anim_t * a); + +#if LV_USE_EXT_DATA +/** + * @brief Associates external user data with an animation instance + * + * Attaches arbitrary user-defined data to an LVGL animation object along with an optional + * destructor callback that will be automatically invoked when the animation completes + * or is deleted, enabling proper resource cleanup. + * + * @param anim Pointer to the animation object to configure + * @param data User-defined data pointer to associate + * @param free_cb Cleanup callback that receives ext_data when: + * - Animation completes naturally + * - Animation is deleted prematurely + * - New data replaces current association + * NULL indicates no cleanup required + */ +void lv_anim_set_external_data(lv_anim_t * anim, void * data, void (* free_cb)(void * data)); +#endif + +/********************** + * GLOBAL VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ANIM_H*/ diff --git a/include/lvgl/core/lv_anim_timeline.h b/include/lvgl/core/lv_anim_timeline.h new file mode 100644 index 0000000000..33eb9d1918 --- /dev/null +++ b/include/lvgl/core/lv_anim_timeline.h @@ -0,0 +1,180 @@ +/** + * @file lv_anim_timeline.h + * + */ + +#ifndef LV_ANIM_TIMELINE_H +#define LV_ANIM_TIMELINE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_anim.h" + +/********************* + * DEFINES + *********************/ + +#define LV_ANIM_TIMELINE_PROGRESS_MAX 0xFFFF + +/********************** + * TYPEDEFS + **********************/ + +/*Data of anim_timeline_dsc*/ +typedef struct _lv_anim_timeline_dsc_t { + lv_anim_t anim; + uint32_t start_time; + uint8_t is_started : 1; + uint8_t is_completed : 1; +} lv_anim_timeline_dsc_t; + + +/********************** +* GLOBAL PROTOTYPES +**********************/ + +/** + * Create an animation timeline. + * @return pointer to the animation timeline. + */ +lv_anim_timeline_t * lv_anim_timeline_create(void); + +/** + * Delete animation timeline. + * @param at pointer to the animation timeline. + */ +void lv_anim_timeline_delete(lv_anim_timeline_t * at); + +/** + * Add animation to the animation timeline. + * @param at pointer to the animation timeline. + * @param start_time the time the animation started on the timeline, note that start_time will override the value of delay. + * @param a pointer to an animation. + */ +void lv_anim_timeline_add(lv_anim_timeline_t * at, uint32_t start_time, const lv_anim_t * a); + +/** + * Start the animation timeline. + * @param at pointer to the animation timeline. + * @return total time spent in animation timeline. + */ +uint32_t lv_anim_timeline_start(lv_anim_timeline_t * at); + +/** + * Pause the animation timeline. + * @param at pointer to the animation timeline. + */ +void lv_anim_timeline_pause(lv_anim_timeline_t * at); + +/** + * Set the playback direction of the animation timeline. + * @param at pointer to the animation timeline. + * @param reverse whether to play in reverse. + */ +void lv_anim_timeline_set_reverse(lv_anim_timeline_t * at, bool reverse); + +/** + * Set the time to wait before starting the animation. + * Applies only when playing from the very start, or reverse from the very end. + * @param at pointer to an animation timeline + * @param delay the delay time in milliseconds + */ +void lv_anim_timeline_set_delay(lv_anim_timeline_t * at, uint32_t delay); + +/** + * Make the animation timeline repeat itself. + * @param at pointer to the animation timeline. + * @param cnt repeat count or `LV_ANIM_REPEAT_INFINITE` for infinite repetition. 0: to disable repetition. + */ +void lv_anim_timeline_set_repeat_count(lv_anim_timeline_t * at, uint32_t cnt); + +/** + * Set a delay before repeating the animation timeline. + * @param at pointer to the animation timeline. + * @param delay delay in milliseconds before repeating the animation timeline. + */ +void lv_anim_timeline_set_repeat_delay(lv_anim_timeline_t * at, uint32_t delay); + +/** + * Set the progress of the animation timeline. + * @param at pointer to the animation timeline. + * @param progress set value 0~65535 to map 0~100% animation progress. + */ +void lv_anim_timeline_set_progress(lv_anim_timeline_t * at, uint16_t progress); + +/** + * Set the user_data of a an animation timeline + * @param at pointer to the animation timeline. + * @param user_data pointer to any data. Only the pointer will be saved. + */ +void lv_anim_timeline_set_user_data(lv_anim_timeline_t * at, void * user_data); + +/** + * Get the time used to play the animation timeline. + * @param at pointer to the animation timeline. + * @return total time spent in animation timeline. + */ +uint32_t lv_anim_timeline_get_playtime(lv_anim_timeline_t * at); + +/** + * Get whether the animation timeline is played in reverse. + * @param at pointer to the animation timeline. + * @return return true if it is reverse playback. + */ +bool lv_anim_timeline_get_reverse(lv_anim_timeline_t * at); + +/** + * Get the wait time when playing from the very start, or reverse from the very end. + * @param at pointer to an animation timeline + * @return the remaining time in milliseconds + */ +uint32_t lv_anim_timeline_get_delay(lv_anim_timeline_t * at); + +/** + * Get the progress of the animation timeline. + * @param at pointer to the animation timeline. + * @return return value 0~65535 to map 0~100% animation progress. + */ +uint16_t lv_anim_timeline_get_progress(lv_anim_timeline_t * at); + +/** + * Get repeat count of the animation timeline. + * @param at pointer to the animation timeline. + */ +uint32_t lv_anim_timeline_get_repeat_count(lv_anim_timeline_t * at); + +/** + * Get repeat delay of the animation timeline. + * @param at pointer to the animation timeline. + */ +uint32_t lv_anim_timeline_get_repeat_delay(lv_anim_timeline_t * at); + +/** + * Get the user_data of a an animation timeline + * @param at pointer to the animation timeline. + */ +void * lv_anim_timeline_get_user_data(lv_anim_timeline_t * at); + +/** + * Merge (add) all animations of a timeline to another + * @param dest merge animation into this timeline + * @param src merge the animations of this timeline + * @param delay add the animations with this extra delay + */ +void lv_anim_timeline_merge(lv_anim_timeline_t * dest, const lv_anim_timeline_t * src, int32_t delay); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ANIM_TIMELINE_H*/ diff --git a/include/lvgl/core/lv_area.h b/include/lvgl/core/lv_area.h new file mode 100644 index 0000000000..13150ff67b --- /dev/null +++ b/include/lvgl/core/lv_area.h @@ -0,0 +1,254 @@ +/** + * @file lv_area.h + * + */ + +#ifndef LV_AREA_H +#define LV_AREA_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" +#include "../misc/lv_math.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Represents a point on the screen. + */ +typedef struct { + int32_t x; + int32_t y; +} lv_point_t; + +typedef struct { + lv_value_precise_t x; + lv_value_precise_t y; +} lv_point_precise_t; + +/** Represents an area of the screen.*/ +typedef struct { + int32_t x1; + int32_t y1; + int32_t x2; + int32_t y2; +} lv_area_t; + +/** Alignments*/ + +typedef enum { + LV_ALIGN_DEFAULT = 0, + LV_ALIGN_TOP_LEFT, + LV_ALIGN_TOP_MID, + LV_ALIGN_TOP_RIGHT, + LV_ALIGN_BOTTOM_LEFT, + LV_ALIGN_BOTTOM_MID, + LV_ALIGN_BOTTOM_RIGHT, + LV_ALIGN_LEFT_MID, + LV_ALIGN_RIGHT_MID, + LV_ALIGN_CENTER, + + LV_ALIGN_OUT_TOP_LEFT, + LV_ALIGN_OUT_TOP_MID, + LV_ALIGN_OUT_TOP_RIGHT, + LV_ALIGN_OUT_BOTTOM_LEFT, + LV_ALIGN_OUT_BOTTOM_MID, + LV_ALIGN_OUT_BOTTOM_RIGHT, + LV_ALIGN_OUT_LEFT_TOP, + LV_ALIGN_OUT_LEFT_MID, + LV_ALIGN_OUT_LEFT_BOTTOM, + LV_ALIGN_OUT_RIGHT_TOP, + LV_ALIGN_OUT_RIGHT_MID, + LV_ALIGN_OUT_RIGHT_BOTTOM, +} lv_align_t; + +typedef enum { + LV_DIR_NONE = 0x00, + LV_DIR_LEFT = (1 << 0), + LV_DIR_RIGHT = (1 << 1), + LV_DIR_TOP = (1 << 2), + LV_DIR_BOTTOM = (1 << 3), + LV_DIR_HOR = LV_DIR_LEFT | LV_DIR_RIGHT, + LV_DIR_VER = LV_DIR_TOP | LV_DIR_BOTTOM, + LV_DIR_ALL = LV_DIR_HOR | LV_DIR_VER, +} lv_dir_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize an area + * @param area_p pointer to an area + * @param x1 left coordinate of the area + * @param y1 top coordinate of the area + * @param x2 right coordinate of the area + * @param y2 bottom coordinate of the area + */ +void lv_area_set(lv_area_t * area_p, int32_t x1, int32_t y1, int32_t x2, int32_t y2); + +/** + * Copy an area + * @param dest pointer to the destination area + * @param src pointer to the source area + */ +inline static void lv_area_copy(lv_area_t * dest, const lv_area_t * src) +{ + dest->x1 = src->x1; + dest->y1 = src->y1; + dest->x2 = src->x2; + dest->y2 = src->y2; +} + +/** + * Get the width of an area + * @param area_p pointer to an area + * @return the width of the area (if x1 == x2 -> width = 1) + */ +int32_t lv_area_get_width(const lv_area_t * area_p); + +/** + * Get the height of an area + * @param area_p pointer to an area + * @return the height of the area (if y1 == y2 -> height = 1) + */ +int32_t lv_area_get_height(const lv_area_t * area_p); + +/** + * Set the width of an area + * @param area_p pointer to an area + * @param w the new width of the area (w == 1 makes x1 == x2) + */ +void lv_area_set_width(lv_area_t * area_p, int32_t w); + +/** + * Set the height of an area + * @param area_p pointer to an area + * @param h the new height of the area (h == 1 makes y1 == y2) + */ +void lv_area_set_height(lv_area_t * area_p, int32_t h); + +/** + * Return with area of an area (x * y) + * @param area_p pointer to an area + * @return size of area + */ +uint32_t lv_area_get_size(const lv_area_t * area_p); + +void lv_area_increase(lv_area_t * area, int32_t w_extra, int32_t h_extra); + +void lv_area_move(lv_area_t * area, int32_t x_ofs, int32_t y_ofs); + +/** + * Align an area to another + * @param base an area where the other will be aligned + * @param to_align the area to align + * @param align `LV_ALIGN_...` + * @param ofs_x X offset + * @param ofs_y Y offset + */ +void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t align, int32_t ofs_x, int32_t ofs_y); + +/** + * Transform a point + * @param point pointer to a point + * @param angle angle with 0.1 resolutions (123 means 12.3°) + * @param scale_x horizontal zoom, 256 means 100% + * @param scale_y vertical zoom, 256 means 100% + * @param pivot pointer to the pivot point of the transformation + * @param zoom_first true: zoom first and rotate after that; else: opposite order + */ +void lv_point_transform(lv_point_t * point, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t * pivot, + bool zoom_first); + +/** + * Transform an array of points + * @param points pointer to an array of points + * @param count number of points in the array + * @param angle angle with 0.1 resolutions (123 means 12.3°) + * @param scale_x horizontal zoom, 256 means 100% + * @param scale_y vertical zoom, 256 means 100% + * @param pivot pointer to the pivot point of the transformation + * @param zoom_first true: zoom first and rotate after that; else: opposite order + */ +void lv_point_array_transform(lv_point_t * points, size_t count, int32_t angle, int32_t scale_x, int32_t scale_y, + const lv_point_t * pivot, + bool zoom_first); + +lv_point_t lv_point_from_precise(const lv_point_precise_t * p); + +lv_point_precise_t lv_point_to_precise(const lv_point_t * p); + +void lv_point_set(lv_point_t * p, int32_t x, int32_t y); + +void lv_point_precise_set(lv_point_precise_t * p, lv_value_precise_t x, lv_value_precise_t y); + +void lv_point_swap(lv_point_t * p1, lv_point_t * p2); + +void lv_point_precise_swap(lv_point_precise_t * p1, lv_point_precise_t * p2); + +/********************** + * MACROS + **********************/ + +#define LV_COORD_TYPE_SHIFT (29U) + +#define LV_COORD_TYPE_MASK (3 << LV_COORD_TYPE_SHIFT) +#define LV_COORD_TYPE(x) ((x) & LV_COORD_TYPE_MASK) /*Extract type specifiers*/ +#define LV_COORD_PLAIN(x) ((x) & ~LV_COORD_TYPE_MASK) /*Remove type specifiers*/ + +#define LV_COORD_TYPE_PX (0 << LV_COORD_TYPE_SHIFT) +#define LV_COORD_TYPE_SPEC (1 << LV_COORD_TYPE_SHIFT) +#define LV_COORD_TYPE_PX_NEG (3 << LV_COORD_TYPE_SHIFT) + +#define LV_COORD_IS_PX(x) (LV_COORD_TYPE(x) == LV_COORD_TYPE_PX || LV_COORD_TYPE(x) == LV_COORD_TYPE_PX_NEG) +#define LV_COORD_IS_SPEC(x) (LV_COORD_TYPE(x) == LV_COORD_TYPE_SPEC) + +#define LV_COORD_SET_SPEC(x) ((x) | LV_COORD_TYPE_SPEC) + +/** Max coordinate value */ +#define LV_COORD_MAX ((1 << LV_COORD_TYPE_SHIFT) - 1) +#define LV_COORD_MIN (-LV_COORD_MAX) + +/*Special coordinates*/ +#define LV_SIZE_CONTENT LV_COORD_SET_SPEC(LV_COORD_MAX) +#define LV_PCT_STORED_MAX (LV_COORD_MAX - 1) +#if LV_PCT_STORED_MAX % 2 != 0 +#error LV_PCT_STORED_MAX should be an even number +#endif +#define LV_PCT_POS_MAX (LV_PCT_STORED_MAX / 2) +#define LV_PCT(x) (LV_COORD_SET_SPEC(((x) < 0 ? (LV_PCT_POS_MAX - LV_MAX((x), -LV_PCT_POS_MAX)) : LV_MIN((x), LV_PCT_POS_MAX)))) +#define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && LV_COORD_PLAIN(x) <= LV_PCT_STORED_MAX)) +#define LV_COORD_GET_PCT(x) (LV_COORD_PLAIN(x) > LV_PCT_POS_MAX ? LV_PCT_POS_MAX - LV_COORD_PLAIN(x) : LV_COORD_PLAIN(x)) + +LV_EXPORT_CONST_INT(LV_COORD_MAX); +LV_EXPORT_CONST_INT(LV_COORD_MIN); +LV_EXPORT_CONST_INT(LV_SIZE_CONTENT); + +/** + * Convert a percentage value to `int32_t`. + * Percentage values are stored in special range + * @param x the percentage (0..1000) + * @return a coordinate that stores the percentage + */ +int32_t lv_pct(int32_t x); + +int32_t lv_pct_to_px(int32_t v, int32_t base); + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif diff --git a/include/lvgl/core/lv_event.h b/include/lvgl/core/lv_event.h new file mode 100644 index 0000000000..3e663e9217 --- /dev/null +++ b/include/lvgl/core/lv_event.h @@ -0,0 +1,274 @@ +/** + * @file lv_event.h + * + */ + +#ifndef LV_EVENT_H +#define LV_EVENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../lv_types.h" +#include "../config/lv_conf_internal.h" +#include "../misc/lv_array.h" + + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef void (*lv_event_cb_t)(lv_event_t * e); + +/** + * Type of event being sent to Widget + */ +typedef enum { + LV_EVENT_ALL = 0, + + /** Input device events*/ + LV_EVENT_PRESSED, /**< Widget has been pressed */ + LV_EVENT_PRESSING, /**< Widget is being pressed (sent continuously while pressing)*/ + LV_EVENT_PRESS_LOST, /**< Widget is still being pressed but slid cursor/finger off Widget */ + LV_EVENT_SHORT_CLICKED, /**< Widget was pressed for a short period of time, then released. Not sent if scrolled. */ + LV_EVENT_SINGLE_CLICKED, /**< Sent for first short click within a small distance and short time */ + LV_EVENT_DOUBLE_CLICKED, /**< Sent for second short click within small distance and short time */ + LV_EVENT_TRIPLE_CLICKED, /**< Sent for third short click within small distance and short time */ + LV_EVENT_LONG_PRESSED, /**< Object has been pressed for at least `long_press_time`. Not sent if scrolled. */ + LV_EVENT_LONG_PRESSED_REPEAT, /**< Sent after `long_press_time` in every `long_press_repeat_time` ms. Not sent if scrolled. */ + LV_EVENT_CLICKED, /**< Sent on release if not scrolled (regardless to long press)*/ + LV_EVENT_RELEASED, /**< Sent in every cases when Widget has been released */ + LV_EVENT_SCROLL_BEGIN, /**< Scrolling begins. The event parameter is a pointer to the animation of the scroll. Can be modified */ + LV_EVENT_SCROLL_THROW_BEGIN, + LV_EVENT_SCROLL_END, /**< Scrolling ends */ + LV_EVENT_SCROLL, /**< Scrolling */ + LV_EVENT_GESTURE, /**< A gesture is detected. Get gesture with `lv_indev_get_gesture_dir(lv_indev_active());` */ + LV_EVENT_KEY, /**< A key is sent to Widget. Get key with `lv_indev_get_key(lv_indev_active());`*/ + LV_EVENT_ROTARY, /**< An encoder or wheel was rotated. Get rotation count with `lv_event_get_rotary_diff(e);`*/ + LV_EVENT_FOCUSED, /**< Widget received focus */ + LV_EVENT_DEFOCUSED, /**< Widget's focus has been lost */ + LV_EVENT_LEAVE, /**< Widget's focus has been lost but is still selected */ + LV_EVENT_HIT_TEST, /**< Perform advanced hit-testing */ + LV_EVENT_INDEV_RESET, /**< Indev has been reset */ + LV_EVENT_HOVER_OVER, /**< Indev hover over object */ + LV_EVENT_HOVER_LEAVE, /**< Indev hover leave object */ + + /** Drawing events */ + LV_EVENT_COVER_CHECK, /**< Check if Widget fully covers an area. The event parameter is `lv_cover_check_info_t *`. */ + LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get required extra draw area around Widget (e.g. for shadow). The event parameter is `int32_t *` to store the size. */ + LV_EVENT_DRAW_MAIN_BEGIN, /**< Starting the main drawing phase */ + LV_EVENT_DRAW_MAIN, /**< Perform the main drawing */ + LV_EVENT_DRAW_MAIN_END, /**< Finishing the main drawing phase */ + LV_EVENT_DRAW_POST_BEGIN, /**< Starting the post draw phase (when all children are drawn)*/ + LV_EVENT_DRAW_POST, /**< Perform the post draw phase (when all children are drawn)*/ + LV_EVENT_DRAW_POST_END, /**< Finishing the post draw phase (when all children are drawn)*/ + LV_EVENT_DRAW_TASK_ADDED, /**< Adding a draw task. The `LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS` flag needs to be set */ + + /** Special events */ + LV_EVENT_VALUE_CHANGED, /**< Widget's value has changed (i.e. slider moved)*/ + LV_EVENT_INSERT, /**< Text has been inserted into Widget. The event data is `char *` being inserted. */ + LV_EVENT_REFRESH, /**< Notify Widget to refresh something on it (for user)*/ + LV_EVENT_READY, /**< A process has finished */ + LV_EVENT_CANCEL, /**< A process has been cancelled */ + LV_EVENT_STATE_CHANGED, /**< The state of the widget changed*/ + + /** Other events */ + LV_EVENT_CREATE, /**< Object is being created */ + LV_EVENT_DELETE, /**< Object is being deleted */ + LV_EVENT_CHILD_CHANGED, /**< Child was removed, added, or its size, position were changed */ + LV_EVENT_CHILD_CREATED, /**< Child was created, always bubbles up to all parents */ + LV_EVENT_CHILD_DELETED, /**< Child was deleted, always bubbles up to all parents */ + LV_EVENT_SCREEN_UNLOAD_START, /**< A screen unload started, fired immediately when scr_load is called */ + LV_EVENT_SCREEN_LOAD_START, /**< A screen load started, fired when the screen change delay is expired */ + LV_EVENT_SCREEN_LOADED, /**< A screen was loaded */ + LV_EVENT_SCREEN_UNLOADED, /**< A screen was unloaded */ + LV_EVENT_SIZE_CHANGED, /**< Object coordinates/size have changed */ + LV_EVENT_STYLE_CHANGED, /**< Object's style has changed */ + LV_EVENT_LAYOUT_CHANGED, /**< A child's position position has changed due to a layout recalculation */ + LV_EVENT_GET_SELF_SIZE, /**< Get internal size of a widget */ + + /** Events of optional LVGL components */ + LV_EVENT_INVALIDATE_AREA, /**< An area is invalidated (marked for redraw). `lv_event_get_param(e)` + * returns a pointer to an `lv_area_t` object with the coordinates of the + * area to be invalidated. The area can be freely modified if needed to + * adapt it a special requirement of the display. Usually needed with + * monochrome displays to invalidate `N x 8` rows or columns in one pass. */ + LV_EVENT_RESOLUTION_CHANGED, /**< Sent when the resolution changes due to `lv_display_set_resolution()` or `lv_display_set_rotation()`. */ + LV_EVENT_COLOR_FORMAT_CHANGED,/**< Sent as a result of any call to `lv_display_set_color_format()`. */ + LV_EVENT_REFR_REQUEST, /**< Sent when something happened that requires redraw. */ + LV_EVENT_REFR_START, /**< Sent before a refreshing cycle starts. Sent even if there is nothing to redraw. */ + LV_EVENT_REFR_READY, /**< Sent when refreshing has been completed (after rendering and calling flush callback). Sent even if no redraw happened. */ + LV_EVENT_RENDER_START, /**< Sent just before rendering begins. */ + LV_EVENT_RENDER_READY, /**< Sent after rendering has been completed. */ + LV_EVENT_FLUSH_START, /**< Sent before flush callback is called. */ + LV_EVENT_FLUSH_FINISH, /**< Sent after flush callback call has returned. */ + LV_EVENT_FLUSH_WAIT_START, /**< Sent before flush wait callback is called. */ + LV_EVENT_FLUSH_WAIT_FINISH, /**< Sent after flush wait callback call has returned. */ + LV_EVENT_SYNC_START, /**< Sent before sync callback is called. */ + LV_EVENT_SYNC_FINISH, /**< Sent after sync callback call has returned. */ + LV_EVENT_SYNC_WAIT_START, /**< Sent before sync wait callback is called. */ + LV_EVENT_SYNC_WAIT_FINISH, /**< Sent after sync wait callback call has returned. */ + LV_EVENT_UPDATE_LAYOUT_COMPLETED, /**< Sent after layout update completes*/ + + LV_EVENT_VSYNC, + LV_EVENT_VSYNC_REQUEST, +#if LV_USE_TRANSLATION + LV_EVENT_TRANSLATION_LANGUAGE_CHANGED, /**< Sent when the translation language changed. */ +#endif /*LV_USE_TRANSLATION*/ + + LV_EVENT_LAST, /** Number of default events */ + + LV_EVENT_PREPROCESS = 0x8000, /** This is a flag that can be set with an event so it's processed + before the class default event processing */ + LV_EVENT_MARKED_DELETING = 0x10000, +} lv_event_code_t; + +typedef struct { + lv_array_t array; + uint8_t is_traversing: 1; /**< True: the list is being nested traversed */ + uint8_t has_marked_deleting: 1; /**< True: the list has marked deleting objects + when some of events are marked as deleting */ +} lv_event_list_t; + +/** + * @brief Event callback. + * Events are used to notify the user of some action being taken on Widget. + * For details, see ::lv_event_t. + */ + +lv_result_t lv_event_send(lv_event_list_t * list, lv_event_t * e, bool preprocess); + +lv_event_dsc_t * lv_event_add(lv_event_list_t * list, lv_event_cb_t cb, lv_event_code_t filter, void * user_data); +bool lv_event_remove_dsc(lv_event_list_t * list, lv_event_dsc_t * dsc); + +uint32_t lv_event_get_count(lv_event_list_t * list); + +lv_event_dsc_t * lv_event_get_dsc(lv_event_list_t * list, uint32_t index); + +lv_event_cb_t lv_event_dsc_get_cb(lv_event_dsc_t * dsc); + +void * lv_event_dsc_get_user_data(lv_event_dsc_t * dsc); + +bool lv_event_remove(lv_event_list_t * list, uint32_t index); + +void lv_event_remove_all(lv_event_list_t * list); + +/** + * Get Widget originally targeted by the event. It's the same even if event was bubbled. + * @param e pointer to the event descriptor + * @return the target of the event_code + */ +void * lv_event_get_target(lv_event_t * e); + +/** + * Get current target of the event. It's the Widget for which the event handler being called. + * If the event is not bubbled it's the same as "normal" target. + * @param e pointer to the event descriptor + * @return pointer to the current target of the event_code + */ +void * lv_event_get_current_target(lv_event_t * e); + +/** + * Get event code of an event. + * @param e pointer to the event descriptor + * @return the event code. (E.g. `LV_EVENT_CLICKED`, `LV_EVENT_FOCUSED`, etc) + */ +lv_event_code_t lv_event_get_code(lv_event_t * e); + +/** + * Get parameter passed when event was sent. + * @param e pointer to the event descriptor + * @return pointer to the parameter + */ +void * lv_event_get_param(lv_event_t * e); + +/** + * Get user_data passed when event was registered on Widget. + * @param e pointer to the event descriptor + * @return pointer to the user_data + */ +void * lv_event_get_user_data(lv_event_t * e); + +/** + * Stop event from bubbling. + * This is only valid when called in the middle of an event processing chain. + * @param e pointer to the event descriptor + */ +void lv_event_stop_bubbling(lv_event_t * e); + +/** + * Stop event from trickling down to children. + * This is only valid when called in the middle of an event processing chain. + * @param e pointer to the event descriptor + */ +void lv_event_stop_trickling(lv_event_t * e); + +/** + * Stop processing this event. + * This is only valid when called in the middle of an event processing chain. + * @param e pointer to the event descriptor + */ +void lv_event_stop_processing(lv_event_t * e); + +/** + * Helper function typically used in LV_EVENT_DELETE + * to free the event's user_data + * @param e pointer to an event descriptor + */ +void lv_event_free_user_data_cb(lv_event_t * e); + + +/** + * Register a new, custom event ID. + * It can be used the same way as e.g. `LV_EVENT_CLICKED` to send custom events + * @return the new event id + * + * Example: + * @code + * uint32_t LV_EVENT_MINE = 0; + * ... + * e = lv_event_register_id(); + * ... + * lv_obj_send_event(obj, LV_EVENT_MINE, &some_data); + * @endcode + */ +uint32_t lv_event_register_id(void); + +/** + * Get the name of an event code. + * @param code the event code + * @return the name of the event code as a string + */ +const char * lv_event_code_get_name(lv_event_code_t code); + +#if LV_USE_EXT_DATA +/** + * Set external data and its destructor for an event descriptor. + * This allows associating custom data with an event callback that will be automatically cleaned up + * when the event descriptor is removed or destroyed. + * @param dsc pointer to an event descriptor (from lv_obj_add_event_cb) + * @param data pointer to the external data to associate with the event descriptor + * @param free_cb function pointer to a destructor that will be called to clean up the external data. + * The destructor will receive the data pointer as its parameter. + */ +void lv_event_desc_set_external_data(lv_event_dsc_t * dsc, void * data, void (* free_cb)(void * data)); +#endif + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_EVENT_H */ diff --git a/src/draw/lv_draw_triangle_private.h b/include/lvgl/core/lv_ext_data.h similarity index 61% rename from src/draw/lv_draw_triangle_private.h rename to include/lvgl/core/lv_ext_data.h index 7fc8ed5a25..30f49139ef 100644 --- a/src/draw/lv_draw_triangle_private.h +++ b/include/lvgl/core/lv_ext_data.h @@ -1,10 +1,10 @@ /** - * @file lv_draw_triangle_private.h + * @file lv_ext_data.h * */ -#ifndef LV_DRAW_TRIANGLE_PRIVATE_H -#define LV_DRAW_TRIANGLE_PRIVATE_H +#ifndef LV_EXT_DATA_H +#define LV_EXT_DATA_H #ifdef __cplusplus extern "C" { @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ - -#include "lv_draw_triangle.h" +#include "../config/lv_conf_internal.h" +#if LV_USE_EXT_DATA /********************* * DEFINES @@ -23,10 +23,10 @@ extern "C" { /********************** * TYPEDEFS **********************/ - -/********************** - * TYPEDEFS - **********************/ +typedef struct { + void * data; + void (* free_cb)(void * data); +} lv_ext_data_t; /********************** * GLOBAL PROTOTYPES @@ -36,8 +36,10 @@ extern "C" { * MACROS **********************/ +#endif /*LV_USE_EXT_DATA*/ + #ifdef __cplusplus } /*extern "C"*/ #endif -#endif /*LV_DRAW_TRIANGLE_PRIVATE_H*/ +#endif /* LV_EXT_DATA_H */ diff --git a/include/lvgl/core/lv_group.h b/include/lvgl/core/lv_group.h new file mode 100644 index 0000000000..192396fa6f --- /dev/null +++ b/include/lvgl/core/lv_group.h @@ -0,0 +1,276 @@ +/** + * @file lv_group.h + * + */ + +#ifndef LV_GROUP_H +#define LV_GROUP_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ +/** Predefined keys to control which Widget has focus via lv_group_send(group, c) */ +typedef enum { + LV_KEY_UP = 17, /*0x11*/ + LV_KEY_DOWN = 18, /*0x12*/ + LV_KEY_RIGHT = 19, /*0x13*/ + LV_KEY_LEFT = 20, /*0x14*/ + LV_KEY_ESC = 27, /*0x1B*/ + LV_KEY_DEL = 127, /*0x7F*/ + LV_KEY_BACKSPACE = 8, /*0x08*/ + LV_KEY_ENTER = 10, /*0x0A, '\n'*/ + LV_KEY_NEXT = 9, /*0x09, '\t'*/ + LV_KEY_PREV = 11, /*0x0B, '*/ + LV_KEY_HOME = 2, /*0x02, STX*/ + LV_KEY_END = 3, /*0x03, ETX*/ +} lv_key_t; + +/********************** + * TYPEDEFS + **********************/ + +typedef void (*lv_group_focus_cb_t)(lv_group_t *); +typedef void (*lv_group_edge_cb_t)(lv_group_t *, bool); + +typedef enum { + LV_GROUP_REFOCUS_POLICY_NEXT = 0, + LV_GROUP_REFOCUS_POLICY_PREV = 1 +} lv_group_refocus_policy_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create new Widget group. + * @return pointer to the new Widget group + */ +lv_group_t * lv_group_create(void); + +/** + * Delete group object. + * @param group pointer to a group + */ +void lv_group_delete(lv_group_t * group); + +/** + * Set default group. New Widgets will be added to this group if it's enabled in + * their class with `add_to_def_group = true`. + * @param group pointer to a group (can be `NULL`) + */ +void lv_group_set_default(lv_group_t * group); + +/** + * Get default group. + * @return pointer to the default group + */ +lv_group_t * lv_group_get_default(void); + +/** + * Add an Widget to group. + * @param group pointer to a group + * @param obj pointer to a Widget to add + */ +void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj); + +/** + * Swap 2 Widgets in group. Widgets must be in the same group. + * @param obj1 pointer to a Widget + * @param obj2 pointer to another Widget + */ +void lv_group_swap_obj(lv_obj_t * obj1, lv_obj_t * obj2); + +/** + * Remove a Widget from its group. + * @param obj pointer to Widget to remove + */ +void lv_group_remove_obj(lv_obj_t * obj); + +/** + * Remove all Widgets from a group. + * @param group pointer to a group + */ +void lv_group_remove_all_objs(lv_group_t * group); + +/** + * Focus on a Widget (defocus the current). + * @param obj pointer to Widget to focus on + */ +void lv_group_focus_obj(lv_obj_t * obj); + +/** + * Focus on next Widget in a group (defocus the current). + * @param group pointer to a group + */ +void lv_group_focus_next(lv_group_t * group); + +/** + * Focus on previous Widget in a group (defocus the current). + * @param group pointer to a group + */ +void lv_group_focus_prev(lv_group_t * group); + +/** + * Do not allow changing focus from current Widget. + * @param group pointer to a group + * @param en true: freeze, false: release freezing (normal mode) + */ +void lv_group_focus_freeze(lv_group_t * group, bool en); + +/** + * Send a control character to Widget that has focus in a group. + * @param group pointer to a group + * @param c a character (use LV_KEY_.. to navigate) + * @return result of Widget with focus in group. + */ +lv_result_t lv_group_send_data(lv_group_t * group, uint32_t c); + +/** + * Set a function for a group which will be called when a new Widget has focus. + * @param group pointer to a group + * @param focus_cb the call back function or NULL if unused + */ +void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb); + +/** + * Set a function for a group which will be called when a focus edge is reached + * @param group pointer to a group + * @param edge_cb the call back function or NULL if unused + */ +void lv_group_set_edge_cb(lv_group_t * group, lv_group_edge_cb_t edge_cb); + +/** + * Set whether the next or previous Widget in a group gets focus when Widget that has + * focus is deleted. + * @param group pointer to a group + * @param policy new refocus policy enum + */ +void lv_group_set_refocus_policy(lv_group_t * group, lv_group_refocus_policy_t policy); + +/** + * Manually set the current mode (edit or navigate). + * @param group pointer to group + * @param edit true: edit mode; false: navigate mode + */ +void lv_group_set_editing(lv_group_t * group, bool edit); + +/** + * Set whether moving focus to next/previous Widget will allow wrapping from + * first->last or last->first Widget. + * @param group pointer to group + * @param en true: wrapping enabled; false: wrapping disabled + */ +void lv_group_set_wrap(lv_group_t * group, bool en); + +/** + * Get Widget that has focus, or NULL if there isn't one. + * @param group pointer to a group + * @return pointer to Widget with focus + */ +lv_obj_t * lv_group_get_focused(const lv_group_t * group); + +/** + * Get focus callback function of a group. + * @param group pointer to a group + * @return the call back function or NULL if not set + */ +lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group); + +/** + * Get edge callback function of a group. + * @param group pointer to a group + * @return the call back function or NULL if not set + */ +lv_group_edge_cb_t lv_group_get_edge_cb(const lv_group_t * group); + +/** + * Get current mode (edit or navigate). + * @param group pointer to group + * @return true: edit mode; false: navigate mode + */ +bool lv_group_get_editing(const lv_group_t * group); + +/** + * Get whether moving focus to next/previous Widget will allow wrapping from + * first->last or last->first Widget. + * @param group pointer to group + */ +bool lv_group_get_wrap(lv_group_t * group); + +/** + * Get number of Widgets in group. + * @param group pointer to a group + * @return number of Widgets in the group + */ +uint32_t lv_group_get_obj_count(lv_group_t * group); + +/** + * Get nth Widget within group. + * @param group pointer to a group + * @param index index of Widget within the group + * @return pointer to Widget + */ +lv_obj_t * lv_group_get_obj_by_index(lv_group_t * group, uint32_t index); + +/** + * Get the number of groups. + * @return number of groups + */ +uint32_t lv_group_get_count(void); + +/** + * Get a group by its index. + * @param index index of the group + * @return pointer to the group + */ +lv_group_t * lv_group_by_index(uint32_t index); + +#if LV_USE_EXT_DATA +/** + * @brief Attaches external user data and destructor callback to a group + * + * Associates custom user data with an LVGL group and specifies a destructor function + * that will be automatically invoked when the group is deleted to properly clean up + * the associated resources. + * + * @param group Pointer to a group + * @param data User-defined data pointer to associate with a group + * @param free_cb Callback function for cleaning up ext_data when group is deleted. + * Receives ext_data as parameter. NULL means no cleanup required. + */ +void lv_group_set_external_data(lv_group_t * group, void * data, void (* free_cb)(void * data)); +#endif + +/** + * Set user data to the group + * @param group pointer to a group + * @param user_data pointer to user data + */ +void lv_group_set_user_data(lv_group_t * group, void * user_data); + +/** + * Get a pointer to the user data of the group + * @param indev pointer to a group + * @return pointer to the user data or NULL if group is NULL + */ +void * lv_group_get_user_data(const lv_group_t * group); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_GROUP_H*/ diff --git a/include/lvgl/core/lv_init.h b/include/lvgl/core/lv_init.h new file mode 100644 index 0000000000..6ca1cb8192 --- /dev/null +++ b/include/lvgl/core/lv_init.h @@ -0,0 +1,55 @@ +/** + * @file lv_init.h + * + */ + +#ifndef LV_INIT_H +#define LV_INIT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize LVGL library. + * Should be called before any other LVGL related function. + */ +void lv_init(void); + +/** + * Deinit the 'lv' library + */ +void lv_deinit(void); + +/** + * Returns whether the 'lv' library is currently initialized + */ +bool lv_is_initialized(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_INIT_H*/ diff --git a/include/lvgl/core/lv_matrix.h b/include/lvgl/core/lv_matrix.h new file mode 100644 index 0000000000..45d2c48737 --- /dev/null +++ b/include/lvgl/core/lv_matrix.h @@ -0,0 +1,144 @@ +/** + * @file lv_matrix.h + * + */ + +#ifndef LV_MATRIX_H +#define LV_MATRIX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" + +#if LV_USE_MATRIX + +#include "../lv_types.h" +#include "lv_area.h" + +/********************* + * DEFINES + *********************/ + +#if !LV_USE_FLOAT +#error "LV_USE_FLOAT is required for lv_matrix" +#endif + +/********************** + * TYPEDEFS + **********************/ + +struct _lv_matrix_t { + float m[3][3]; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Set matrix to identity matrix + * @param matrix pointer to a matrix + */ +void lv_matrix_identity(lv_matrix_t * matrix); + +/** + * Translate the matrix to new position + * @param matrix pointer to a matrix + * @param tx the amount of translate in x direction + * @param tx the amount of translate in y direction + */ +void lv_matrix_translate(lv_matrix_t * matrix, float tx, float ty); + +/** + * Change the scale factor of the matrix + * @param matrix pointer to a matrix + * @param scale_x the scale factor for the X direction + * @param scale_y the scale factor for the Y direction + */ +void lv_matrix_scale(lv_matrix_t * matrix, float scale_x, float scale_y); + +/** + * Rotate the matrix with origin + * @param matrix pointer to a matrix + * @param degree angle to rotate + */ +void lv_matrix_rotate(lv_matrix_t * matrix, float degree); + +/** + * Change the skew factor of the matrix + * @param matrix pointer to a matrix + * @param skew_x the skew factor for x direction + * @param skew_y the skew factor for y direction + */ +void lv_matrix_skew(lv_matrix_t * matrix, float skew_x, float skew_y); + +/** + * Multiply two matrix and store the result to the first one + * @param matrix pointer to a matrix + * @param matrix2 pointer to another matrix + */ +void lv_matrix_multiply(lv_matrix_t * matrix, const lv_matrix_t * mul); + +/** + * Invert the matrix + * @param matrix pointer to a matrix + * @param m pointer to another matrix (optional) + * @return true: the matrix is invertible, false: the matrix is singular and cannot be inverted + */ +bool lv_matrix_inverse(lv_matrix_t * matrix, const lv_matrix_t * m); + +/** + * Transform a point by a matrix + * @param matrix pointer to a matrix + * @param point pointer to a point + * @return the transformed point + */ +lv_point_precise_t lv_matrix_transform_precise_point(const lv_matrix_t * matrix, const lv_point_precise_t * point); + +/** + * Transform an area by a matrix + * @param matrix pointer to a matrix + * @param area pointer to an area + * @return the transformed area + */ +lv_area_t lv_matrix_transform_area(const lv_matrix_t * matrix, const lv_area_t * area); + +/** + * Check if the matrix is identity + * @param matrix pointer to a matrix + * @return true: the matrix is identity , false: the matrix is not identity + */ +bool lv_matrix_is_identity(const lv_matrix_t * matrix); + +/** + * Check if the matrix is identity or translation matrix + * @param matrix pointer to a matrix + * @return true: the matrix is identity or translation matrix, false: the matrix is not identity or translation matrix + */ +bool lv_matrix_is_identity_or_translation(const lv_matrix_t * matrix); + +/** + * Transpose a matrix. + * @param src pointer to the source matrix. If NULL, the function returns. + * @param dst pointer to the destination matrix. If NULL, the function returns. + * Note: src and dst may point to the same matrix for in-place transposition. + */ +void lv_matrix_transpose(const lv_matrix_t * src, lv_matrix_t * dst); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_MATRIX*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_MATRIX_H*/ diff --git a/include/lvgl/core/lv_obj.h b/include/lvgl/core/lv_obj.h new file mode 100644 index 0000000000..cc31f50aeb --- /dev/null +++ b/include/lvgl/core/lv_obj.h @@ -0,0 +1,495 @@ +/** + * @file lv_obj.h + * + */ + +#ifndef LV_OBJ_H +#define LV_OBJ_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#include "../lv_types.h" +#include "lv_style.h" +#include "lv_area.h" +#include "../draw/lv_color.h" +#include "../debugging/lv_assert.h" + +#include "lv_obj_tree.h" +#include "lv_obj_pos.h" +#include "lv_obj_scroll.h" +#include "lv_obj_style.h" +#include "lv_obj_draw.h" +#include "lv_obj_class.h" +#include "lv_obj_event.h" +#include "lv_obj_property.h" +#include "lv_group.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +/** + * On/Off features controlling the object's behavior. + * OR-ed values are possible + * + * Note: update obj flags corresponding properties below + * whenever add/remove flags or change bit definition of flags. + */ +typedef enum { + LV_OBJ_FLAG_HIDDEN = (1u << 0), /**< Make the object hidden. (Like it wasn't there at all)*/ + LV_OBJ_FLAG_CLICKABLE = (1u << 1), /**< Make the object clickable by the input devices*/ + LV_OBJ_FLAG_CLICK_FOCUSABLE = (1u << 2), /**< Add focused state to the object when clicked*/ + LV_OBJ_FLAG_CHECKABLE = (1u << 3), /**< Toggle checked state when the object is clicked*/ + LV_OBJ_FLAG_SCROLLABLE = (1u << 4), /**< Make the object scrollable*/ + LV_OBJ_FLAG_SCROLL_ELASTIC = (1u << 5), /**< Allow scrolling inside but with slower speed*/ + LV_OBJ_FLAG_SCROLL_MOMENTUM = (1u << 6), /**< Make the object scroll further when "thrown"*/ + LV_OBJ_FLAG_SCROLL_ONE = (1u << 7), /**< Allow scrolling only one snappable children*/ + LV_OBJ_FLAG_SCROLL_CHAIN_HOR = (1u << 8), /**< Allow propagating the horizontal scroll to a parent*/ + LV_OBJ_FLAG_SCROLL_CHAIN_VER = (1u << 9), /**< Allow propagating the vertical scroll to a parent*/ + LV_OBJ_FLAG_SCROLL_CHAIN = (LV_OBJ_FLAG_SCROLL_CHAIN_HOR | LV_OBJ_FLAG_SCROLL_CHAIN_VER), + LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1u << 10), /**< Automatically scroll object to make it visible when focused*/ + LV_OBJ_FLAG_SCROLL_WITH_ARROW = (1u << 11), /**< Allow scrolling the focused object with arrow keys*/ + LV_OBJ_FLAG_SNAPPABLE = (1u << 12), /**< If scroll snap is enabled on the parent it can snap to this object*/ + LV_OBJ_FLAG_PRESS_LOCK = (1u << 13), /**< Keep the object pressed even if the press slid from the object*/ + LV_OBJ_FLAG_EVENT_BUBBLE = (1u << 14), /**< Propagate the events to the parent too*/ + LV_OBJ_FLAG_GESTURE_BUBBLE = (1u << 15), /**< Propagate the gestures to the parent*/ + LV_OBJ_FLAG_ADV_HITTEST = (1u << 16), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/ + LV_OBJ_FLAG_IGNORE_LAYOUT = (1u << 17), /**< Make the object not positioned by the layouts*/ + LV_OBJ_FLAG_FLOATING = (1u << 18), /**< Do not scroll the object when the parent scrolls and ignore layout*/ + LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS = (1u << 19), /**< Send `LV_EVENT_DRAW_TASK_ADDED` events*/ + LV_OBJ_FLAG_OVERFLOW_VISIBLE = (1u << 20),/**< Do not clip the children to the parent's ext draw size*/ + LV_OBJ_FLAG_EVENT_TRICKLE = (1u << 21), /**< Propagate the events to the children too*/ + LV_OBJ_FLAG_STATE_TRICKLE = (1u << 22), /**< Propagate the states to the children too*/ + + LV_OBJ_FLAG_LAYOUT_1 = (1u << 23), /**< Custom flag, free to use by layouts*/ + LV_OBJ_FLAG_LAYOUT_2 = (1u << 24), /**< Custom flag, free to use by layouts*/ +#if LV_USE_FLEX + LV_OBJ_FLAG_FLEX_IN_NEW_TRACK = LV_OBJ_FLAG_LAYOUT_1, /**< Start a new flex track on this item*/ +#endif + + LV_OBJ_FLAG_WIDGET_1 = (1u << 25), /**< Custom flag, free to use by widget*/ + LV_OBJ_FLAG_WIDGET_2 = (1u << 26), /**< Custom flag, free to use by widget*/ + LV_OBJ_FLAG_USER_1 = (1u << 27), /**< Custom flag, free to use by user*/ + LV_OBJ_FLAG_USER_2 = (1u << 28), /**< Custom flag, free to use by user*/ + LV_OBJ_FLAG_USER_3 = (1u << 29), /**< Custom flag, free to use by user*/ + LV_OBJ_FLAG_USER_4 = (1u << 30), /**< Custom flag, free to use by user*/ +} lv_obj_flag_t; + +#if LV_USE_OBJ_PROPERTY +enum _lv_signed_prop_id_t { + /*OBJ flag properties */ + LV_PROPERTY_ID(OBJ, FLAG_START, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(OBJ, FLAG_HIDDEN, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(OBJ, FLAG_CLICKABLE, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(OBJ, FLAG_CLICK_FOCUSABLE, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(OBJ, FLAG_CHECKABLE, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_ID(OBJ, FLAG_SCROLLABLE, LV_PROPERTY_TYPE_INT, 4), + LV_PROPERTY_ID(OBJ, FLAG_SCROLL_ELASTIC, LV_PROPERTY_TYPE_INT, 5), + LV_PROPERTY_ID(OBJ, FLAG_SCROLL_MOMENTUM, LV_PROPERTY_TYPE_INT, 6), + LV_PROPERTY_ID(OBJ, FLAG_SCROLL_ONE, LV_PROPERTY_TYPE_INT, 7), + LV_PROPERTY_ID(OBJ, FLAG_SCROLL_CHAIN_HOR, LV_PROPERTY_TYPE_INT, 8), + LV_PROPERTY_ID(OBJ, FLAG_SCROLL_CHAIN_VER, LV_PROPERTY_TYPE_INT, 9), + LV_PROPERTY_ID(OBJ, FLAG_SCROLL_ON_FOCUS, LV_PROPERTY_TYPE_INT, 10), + LV_PROPERTY_ID(OBJ, FLAG_SCROLL_WITH_ARROW, LV_PROPERTY_TYPE_INT, 11), + LV_PROPERTY_ID(OBJ, FLAG_SNAPPABLE, LV_PROPERTY_TYPE_INT, 12), + LV_PROPERTY_ID(OBJ, FLAG_PRESS_LOCK, LV_PROPERTY_TYPE_INT, 13), + LV_PROPERTY_ID(OBJ, FLAG_EVENT_BUBBLE, LV_PROPERTY_TYPE_INT, 14), + LV_PROPERTY_ID(OBJ, FLAG_GESTURE_BUBBLE, LV_PROPERTY_TYPE_INT, 15), + LV_PROPERTY_ID(OBJ, FLAG_ADV_HITTEST, LV_PROPERTY_TYPE_INT, 16), + LV_PROPERTY_ID(OBJ, FLAG_IGNORE_LAYOUT, LV_PROPERTY_TYPE_INT, 17), + LV_PROPERTY_ID(OBJ, FLAG_FLOATING, LV_PROPERTY_TYPE_INT, 18), + LV_PROPERTY_ID(OBJ, FLAG_SEND_DRAW_TASK_EVENTS, LV_PROPERTY_TYPE_INT, 19), + LV_PROPERTY_ID(OBJ, FLAG_OVERFLOW_VISIBLE, LV_PROPERTY_TYPE_INT, 20), + LV_PROPERTY_ID(OBJ, FLAG_EVENT_TRICKLE, LV_PROPERTY_TYPE_INT, 21), + LV_PROPERTY_ID(OBJ, FLAG_STATE_TRICKLE, LV_PROPERTY_TYPE_INT, 22), + LV_PROPERTY_ID(OBJ, FLAG_LAYOUT_1, LV_PROPERTY_TYPE_INT, 23), + LV_PROPERTY_ID(OBJ, FLAG_LAYOUT_2, LV_PROPERTY_TYPE_INT, 24), + LV_PROPERTY_ID(OBJ, FLAG_FLEX_IN_NEW_TRACK, LV_PROPERTY_TYPE_INT, 23), /*Mapped to FLAG_LAYOUT_1*/ + LV_PROPERTY_ID(OBJ, FLAG_WIDGET_1, LV_PROPERTY_TYPE_INT, 25), + LV_PROPERTY_ID(OBJ, FLAG_WIDGET_2, LV_PROPERTY_TYPE_INT, 26), + LV_PROPERTY_ID(OBJ, FLAG_USER_1, LV_PROPERTY_TYPE_INT, 27), + LV_PROPERTY_ID(OBJ, FLAG_USER_2, LV_PROPERTY_TYPE_INT, 28), + LV_PROPERTY_ID(OBJ, FLAG_USER_3, LV_PROPERTY_TYPE_INT, 29), + LV_PROPERTY_ID(OBJ, FLAG_USER_4, LV_PROPERTY_TYPE_INT, 30), + LV_PROPERTY_ID(OBJ, FLAG_END, LV_PROPERTY_TYPE_INT, 30), + + LV_PROPERTY_ID(OBJ, STATE_START, LV_PROPERTY_TYPE_INT, 31), + LV_PROPERTY_ID(OBJ, STATE_ALT, LV_PROPERTY_TYPE_INT, 31), + /*1 reserved*/ + LV_PROPERTY_ID(OBJ, STATE_CHECKED, LV_PROPERTY_TYPE_INT, 33), + LV_PROPERTY_ID(OBJ, STATE_FOCUSED, LV_PROPERTY_TYPE_INT, 34), + LV_PROPERTY_ID(OBJ, STATE_FOCUS_KEY, LV_PROPERTY_TYPE_INT, 35), + LV_PROPERTY_ID(OBJ, STATE_EDITED, LV_PROPERTY_TYPE_INT, 36), + LV_PROPERTY_ID(OBJ, STATE_HOVERED, LV_PROPERTY_TYPE_INT, 37), + LV_PROPERTY_ID(OBJ, STATE_PRESSED, LV_PROPERTY_TYPE_INT, 38), + LV_PROPERTY_ID(OBJ, STATE_SCROLLED, LV_PROPERTY_TYPE_INT, 39), + LV_PROPERTY_ID(OBJ, STATE_DISABLED, LV_PROPERTY_TYPE_INT, 40), + /*2 reserved*/ + LV_PROPERTY_ID(OBJ, STATE_USER_1, LV_PROPERTY_TYPE_INT, 43), + LV_PROPERTY_ID(OBJ, STATE_USER_2, LV_PROPERTY_TYPE_INT, 44), + LV_PROPERTY_ID(OBJ, STATE_USER_3, LV_PROPERTY_TYPE_INT, 45), + LV_PROPERTY_ID(OBJ, STATE_USER_4, LV_PROPERTY_TYPE_INT, 46), + LV_PROPERTY_ID(OBJ, STATE_ANY, LV_PROPERTY_TYPE_INT, 47), + LV_PROPERTY_ID(OBJ, STATE_END, LV_PROPERTY_TYPE_INT, 47), + + /*OBJ normal properties*/ + LV_PROPERTY_ID(OBJ, PARENT, LV_PROPERTY_TYPE_OBJ, 48), + LV_PROPERTY_ID(OBJ, X, LV_PROPERTY_TYPE_INT, 49), + LV_PROPERTY_ID(OBJ, Y, LV_PROPERTY_TYPE_INT, 50), + LV_PROPERTY_ID(OBJ, W, LV_PROPERTY_TYPE_INT, 51), + LV_PROPERTY_ID(OBJ, H, LV_PROPERTY_TYPE_INT, 52), + LV_PROPERTY_ID(OBJ, CONTENT_WIDTH, LV_PROPERTY_TYPE_INT, 53), + LV_PROPERTY_ID(OBJ, CONTENT_HEIGHT, LV_PROPERTY_TYPE_INT, 54), + LV_PROPERTY_ID(OBJ, LAYOUT, LV_PROPERTY_TYPE_INT, 55), + LV_PROPERTY_ID(OBJ, ALIGN, LV_PROPERTY_TYPE_INT, 56), + LV_PROPERTY_ID(OBJ, SCROLLBAR_MODE, LV_PROPERTY_TYPE_INT, 57), + LV_PROPERTY_ID(OBJ, SCROLL_DIR, LV_PROPERTY_TYPE_INT, 58), + LV_PROPERTY_ID(OBJ, SCROLL_SNAP_X, LV_PROPERTY_TYPE_INT, 59), + LV_PROPERTY_ID(OBJ, SCROLL_SNAP_Y, LV_PROPERTY_TYPE_INT, 60), + LV_PROPERTY_ID(OBJ, SCROLL_X, LV_PROPERTY_TYPE_INT, 61), + LV_PROPERTY_ID(OBJ, SCROLL_Y, LV_PROPERTY_TYPE_INT, 62), + LV_PROPERTY_ID(OBJ, SCROLL_TOP, LV_PROPERTY_TYPE_INT, 63), + LV_PROPERTY_ID(OBJ, SCROLL_BOTTOM, LV_PROPERTY_TYPE_INT, 64), + LV_PROPERTY_ID(OBJ, SCROLL_LEFT, LV_PROPERTY_TYPE_INT, 65), + LV_PROPERTY_ID(OBJ, SCROLL_RIGHT, LV_PROPERTY_TYPE_INT, 66), + LV_PROPERTY_ID(OBJ, SCROLL_END, LV_PROPERTY_TYPE_POINT, 67), + LV_PROPERTY_ID(OBJ, EXT_DRAW_SIZE, LV_PROPERTY_TYPE_INT, 68), + LV_PROPERTY_ID(OBJ, EVENT_COUNT, LV_PROPERTY_TYPE_INT, 69), + LV_PROPERTY_ID(OBJ, SCREEN, LV_PROPERTY_TYPE_OBJ, 70), + LV_PROPERTY_ID(OBJ, DISPLAY, LV_PROPERTY_TYPE_POINTER, 71), + LV_PROPERTY_ID(OBJ, CHILD_COUNT, LV_PROPERTY_TYPE_INT, 72), + LV_PROPERTY_ID(OBJ, INDEX, LV_PROPERTY_TYPE_INT, 73), + + LV_PROPERTY_OBJ_END, +}; +#endif + +/** + * Make the base object's class publicly available. + */ +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_obj_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a base object (a rectangle) + * @param parent pointer to a parent object. If NULL then a screen will be created. + * @return pointer to the new object + */ +lv_obj_t * lv_obj_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set one or more flags + * @param obj pointer to an object + * @param f OR-ed values from `lv_obj_flag_t` to set. + */ +void lv_obj_add_flag(lv_obj_t * obj, lv_obj_flag_t f); + +/** + * Remove one or more flags + * @param obj pointer to an object + * @param f OR-ed values from `lv_obj_flag_t` to clear. + */ +void lv_obj_remove_flag(lv_obj_t * obj, lv_obj_flag_t f); + +/** + * Set add or remove one or more flags. + * @param obj pointer to an object + * @param f OR-ed values from `lv_obj_flag_t` to update. + * @param v true: add the flags; false: remove the flags + */ +void lv_obj_set_flag(lv_obj_t * obj, lv_obj_flag_t f, bool v); + +/** + * Add one or more states to the object. The other state bits will remain unchanged. + * If specified in the styles, transition animation will be started from the previous state to the current. + * @param obj pointer to an object + * @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED` + */ +void lv_obj_add_state(lv_obj_t * obj, lv_state_t state); + +/** + * Remove one or more states to the object. The other state bits will remain unchanged. + * If specified in the styles, transition animation will be started from the previous state to the current. + * @param obj pointer to an object + * @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED` + */ +void lv_obj_remove_state(lv_obj_t * obj, lv_state_t state); + +/** + * Add or remove one or more states to the object. The other state bits will remain unchanged. + * @param obj pointer to an object + * @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED` + * @param v true: add the states; false: remove the states + */ +void lv_obj_set_state(lv_obj_t * obj, lv_state_t state, bool v); + +/** + * Set the user_data field of the object + * @param obj pointer to an object + * @param user_data pointer to the new user_data. + */ +void lv_obj_set_user_data(lv_obj_t * obj, void * user_data); + + +/** Allow only one RADIO_BUTTON sibling to be checked + * @param obj pointer to a widget + * @param en enable or disable radio button behavior + */ +void lv_obj_set_radio_button(lv_obj_t * obj, bool en); + +/*======================= + * Getter functions + *======================*/ + +/** + * Check if a given flag or all the given flags are set on an object. + * @param obj pointer to an object + * @param f the flag(s) to check (OR-ed values can be used) + * @return true: all flags are set; false: not all flags are set + */ +bool lv_obj_has_flag(const lv_obj_t * obj, lv_obj_flag_t f); + +/** + * Check if a given flag or any of the flags are set on an object. + * @param obj pointer to an object + * @param f the flag(s) to check (OR-ed values can be used) + * @return true: at least one flag is set; false: none of the flags are set + */ +bool lv_obj_has_flag_any(const lv_obj_t * obj, lv_obj_flag_t f); + +/** + * Get the state of an object + * @param obj pointer to an object + * @return the state (OR-ed values from `lv_state_t`) + */ +lv_state_t lv_obj_get_state(const lv_obj_t * obj); + +/** + * Check if the object is in a given state or not. + * @param obj pointer to an object + * @param state a state or combination of states to check + * @return true: `obj` is in `state`; false: `obj` is not in `state` + */ +bool lv_obj_has_state(const lv_obj_t * obj, lv_state_t state); + +/** Get whether the object is a radio button + * @param obj pointer to a widget + * @return true if radio button behavior is enabled + */ +bool lv_obj_is_radio_button(const lv_obj_t * obj); + +/** + * Get the group of the object + * @param obj pointer to an object + * @return the pointer to group of the object + */ +lv_group_t * lv_obj_get_group(const lv_obj_t * obj); + +/** + * Get the user_data field of the object + * @param obj pointer to an object + * @return the pointer to the user_data of the object + */ +void * lv_obj_get_user_data(lv_obj_t * obj); + +/*======================= + * Other functions + *======================*/ + +/** + * Check the type of obj. + * @param obj pointer to an object + * @param class_p a class to check (e.g. `lv_slider_class`) + * @return true: `class_p` is the `obj` class. + */ +bool lv_obj_check_type(const lv_obj_t * obj, const lv_obj_class_t * class_p); + +/** + * Check if any object has a given class (type). + * It checks the ancestor classes too. + * @param obj pointer to an object + * @param class_p a class to check (e.g. `lv_slider_class`) + * @return true: `obj` has the given class + */ +bool lv_obj_has_class(const lv_obj_t * obj, const lv_obj_class_t * class_p); + +/** + * Get the class (type) of the object + * @param obj pointer to an object + * @return the class (type) of the object + */ +const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj); + +/** + * Check if any object is still "alive". + * @param obj pointer to an object + * @return true: valid + */ +bool lv_obj_is_valid(const lv_obj_t * obj); + +/** + * Utility to set an object reference to NULL when it gets deleted. + * The reference should be in a location that will not become invalid + * during the object's lifetime, i.e. static or allocated. + * @param obj_ptr a pointer to a pointer to an object + */ +void lv_obj_null_on_delete(lv_obj_t ** obj_ptr); + +/** + * Add an event handler to a widget that will load a screen on a trigger. + * @param obj pointer to widget which should load the screen + * @param trigger an event code, e.g. `LV_EVENT_CLICKED` + * @param screen the screen to load (must be a valid widget) + * @param anim_type element of `lv_screen_load_anim_t` the screen load animation + * @param duration duration of the animation in milliseconds + * @param delay delay before the screen load in milliseconds + */ +void lv_obj_add_screen_load_event(lv_obj_t * obj, lv_event_code_t trigger, lv_obj_t * screen, + lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay); + +/** + * Add an event handler to a widget that will create a screen on a trigger. + * The created screen will be deleted when it's unloaded + * @param obj pointer to widget which should load the screen + * @param trigger an event code, e.g. `LV_EVENT_CLICKED` + * @param screen_create_cb a callback to create the screen, e.g. `lv_obj_t * myscreen_create(void)` + * @param anim_type element of `lv_screen_load_anim_t` the screen load animation + * @param duration duration of the animation in milliseconds + * @param delay delay before the screen load in milliseconds + */ +void lv_obj_add_screen_create_event(lv_obj_t * obj, lv_event_code_t trigger, lv_screen_create_cb_t screen_create_cb, + lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay); + + +/** + * Play a timeline animation on a trigger + * @param obj pointer to widget which should trigger playing the animation + * @param trigger an event code, e.g. `LV_EVENT_CLICKED` + * @param at pointer to an animation timeline + * @param delay wait time before starting the animation + * @param reverse true: play in reverse + */ +void lv_obj_add_play_timeline_event(lv_obj_t * obj, lv_event_code_t trigger, lv_anim_timeline_t * at, uint32_t delay, + bool reverse); + +#if LV_USE_OBJ_ID +/** + * Set an id for an object. + * @param obj pointer to an object + * @param id the id of the object + */ +void lv_obj_set_id(lv_obj_t * obj, void * id); + +/** + * Get the id of an object. + * @param obj pointer to an object + * @return the id of the object + */ +void * lv_obj_get_id(const lv_obj_t * obj); + +/** + * DEPRECATED IDs are used only to print the widget trees. + * To find a widget use `lv_obj_find_by_name` + * + * Get the child object by its id. + * It will check children and grandchildren recursively. + * Function `lv_obj_id_compare` is used to matched obj id with given id. + * + * @param obj pointer to an object + * @param id the id of the child object + * @return pointer to the child object or NULL if not found + */ +lv_obj_t * lv_obj_find_by_id(const lv_obj_t * obj, const void * id); + +/** + * Assign id to object if not previously assigned. + * This function gets called automatically when LV_OBJ_ID_AUTO_ASSIGN is enabled. + * + * Set `LV_USE_OBJ_ID_BUILTIN` to use the builtin method to generate object ID. + * Otherwise, these functions including `lv_obj_[set|assign|free|stringify]_id` and + * `lv_obj_id_compare`should be implemented externally. + * + * @param class_p the class this obj belongs to. Note obj->class_p is the class currently being constructed. + * @param obj pointer to an object + */ +void lv_obj_assign_id(const lv_obj_class_t * class_p, lv_obj_t * obj); + +/** + * Free resources allocated by `lv_obj_assign_id` or `lv_obj_set_id`. + * This function is also called automatically when object is deleted. + * @param obj pointer to an object + */ +void lv_obj_free_id(lv_obj_t * obj); + +/** + * Compare two obj id, return 0 if they are equal. + * + * Set `LV_USE_OBJ_ID_BUILTIN` to use the builtin method for compare. + * Otherwise, it must be implemented externally. + * + * @param id1: the first id + * @param id2: the second id + * @return 0 if they are equal, non-zero otherwise. + */ +int lv_obj_id_compare(const void * id1, const void * id2); + +/** + * Format an object's id into a string. + * @param obj pointer to an object + * @param buf buffer to write the string into + * @param len length of the buffer + */ +const char * lv_obj_stringify_id(lv_obj_t * obj, char * buf, uint32_t len); + +#if LV_USE_OBJ_ID_BUILTIN +/** + * Free resources used by builtin ID generator. + */ +void lv_objid_builtin_destroy(void); +#endif + +#endif /*LV_USE_OBJ_ID*/ + +/********************** + * MACROS + **********************/ + +#if LV_USE_ASSERT_OBJ +# define LV_ASSERT_OBJ(obj_p, obj_class) \ + do { \ + LV_ASSERT_MSG(obj_p != NULL, "The object is NULL"); \ + LV_ASSERT_MSG(lv_obj_has_class(obj_p, obj_class) == true, "Incompatible object type."); \ + LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?"); \ + } while(0) +# else +# define LV_ASSERT_OBJ(obj_p, obj_class) LV_ASSERT_NULL(obj_p) +#endif + +#if LV_USE_LOG && LV_LOG_TRACE_OBJ_CREATE +# define LV_TRACE_OBJ_CREATE(...) LV_LOG_TRACE(__VA_ARGS__) +#else +# define LV_TRACE_OBJ_CREATE(...) +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_H*/ diff --git a/include/lvgl/core/lv_obj_class.h b/include/lvgl/core/lv_obj_class.h new file mode 100644 index 0000000000..6073578dc7 --- /dev/null +++ b/include/lvgl/core/lv_obj_class.h @@ -0,0 +1,89 @@ +/** + * @file lv_obj_class.h + * + */ + +#ifndef LV_OBJ_CLASS_H +#define LV_OBJ_CLASS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" +#include "lv_area.h" +#include "lv_obj_property.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_OBJ_CLASS_EDITABLE_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/ + LV_OBJ_CLASS_EDITABLE_TRUE, + LV_OBJ_CLASS_EDITABLE_FALSE, +} lv_obj_class_editable_t; + +typedef enum { + LV_OBJ_CLASS_GROUP_DEF_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/ + LV_OBJ_CLASS_GROUP_DEF_TRUE, + LV_OBJ_CLASS_GROUP_DEF_FALSE, +} lv_obj_class_group_def_t; + +typedef enum { + LV_OBJ_CLASS_THEME_INHERITABLE_FALSE, /**< Do not inherit theme from base class. */ + LV_OBJ_CLASS_THEME_INHERITABLE_TRUE, +} lv_obj_class_theme_inheritable_t; + +typedef void (*lv_obj_class_event_cb_t)(lv_obj_class_t * class_p, lv_event_t * e); +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an object form a class descriptor + * @param class_p pointer to a class + * @param parent pointer to an object where the new object should be created + * @return pointer to the created object + */ +lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * parent); + +void lv_obj_class_init_obj(lv_obj_t * obj); + +bool lv_obj_is_editable(lv_obj_t * obj); + +bool lv_obj_is_group_def(lv_obj_t * obj); + +#if LV_USE_EXT_DATA +/** + * @brief Associates an array of external data pointers with an LVGL object + * + * Associates custom user data with an LVGL object and specifies a destructor function + * that will be automatically invoked when the object is deleted to properly clean up + * the associated resources. + * + * @param obj Target LVGL object + * @param data User-defined data pointer to associate with a object + * @param free_cb Cleanup function called for each non-NULL data pointer during + * object deletion. Receives single data pointer as parameter. + * NULL means no automatic cleanup. + */ +void lv_obj_set_external_data(lv_obj_t * obj, void * data, void (* free_cb)(void * data)); +#endif + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_CLASS_H*/ diff --git a/include/lvgl/core/lv_obj_draw.h b/include/lvgl/core/lv_obj_draw.h new file mode 100644 index 0000000000..69ee9f6673 --- /dev/null +++ b/include/lvgl/core/lv_obj_draw.h @@ -0,0 +1,142 @@ +/** + * @file lv_obj_draw.h + * + */ + +#ifndef LV_OBJ_DRAW_H +#define LV_OBJ_DRAW_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" +#include "../draw/lv_draw_rect.h" +#include "../draw/lv_draw_label.h" +#include "../draw/lv_draw_image.h" +#include "../draw/lv_draw_line.h" +#include "../draw/lv_draw_arc.h" +#include "../draw/lv_draw_triangle.h" +#include "../draw/lv_draw_blur.h" +#include "lv_obj_style.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** Store the type of layer required to render a widget.*/ +typedef enum { + /**No layer is needed. */ + LV_LAYER_TYPE_NONE, + + /**Simple layer means that the layer can be rendered in chunks. + * For example with opa_layered = 140 it's possible to render only 10 lines + * from the layer. When it's ready go to the next 10 lines. + * It avoids large memory allocations for the layer buffer. + * The buffer size for a chunk can be set by `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` in lv_conf.h.*/ + LV_LAYER_TYPE_SIMPLE, + + /**The widget is transformed and cannot be rendered in chunks. + * It's because - due to the transformations - pixel outside of + * a given area will also contribute to the final image. + * In this case there is no limitation on the buffer size. + * LVGL will allocate as large buffer as needed to render the transformed area.*/ + LV_LAYER_TYPE_TRANSFORM, +} lv_layer_type_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a rectangle draw descriptor from an object's styles in its current state + * @param obj pointer to an object + * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc + * @param draw_dsc the descriptor to initialize. + * If an `..._opa` field is set to `LV_OPA_TRANSP` the related properties won't be initialized. + * Should be initialized with `lv_draw_rect_dsc_init(draw_dsc)`. + * @note Only the relevant fields will be set. + * E.g. if `border width == 0` the other border properties won't be evaluated. + */ +void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc); + +/** + * Initialize a label draw descriptor from an object's styles in its current state + * @param obj pointer to an object + * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc + * @param draw_dsc the descriptor to initialize. + * If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized. + * Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`. + */ +void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc); + +/** + * Initialize an image draw descriptor from an object's styles in its current state + * @param obj pointer to an object + * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc + * @param draw_dsc the descriptor to initialize. + * Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`. + */ +void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc); + +/** + * Initialize a line draw descriptor from an object's styles in its current state + * @param obj pointer to an object + * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc + * @param draw_dsc the descriptor to initialize. + * Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`. + */ +void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc); + +/** + * Initialize an arc draw descriptor from an object's styles in its current state + * @param obj pointer to an object + * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc + * @param draw_dsc the descriptor to initialize. + * Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`. + */ +void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc); + + +/** + * Initialize a blur draw descriptor from an object's styles in its current state. + * draw_dsc->radius will only be calculated if it's 0 initially. Radius can be set before calling this function + * to avoid getting it twice. + * @param obj pointer to an object + * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc + * @param draw_dsc the descriptor to initialize. + * Should be initialized with `lv_draw_blur_dsc_init(draw_dsc)`. + */ +void lv_obj_init_draw_blur_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_blur_dsc_t * draw_dsc); + +/** + * Get the required extra size (around the object's part) to draw shadow, outline, value etc. + * @param obj pointer to an object + * @param part part of the object + * @return the extra size required around the object + */ +int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part); + +/** + * Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size. + * The result will be saved in `obj`. + * @param obj pointer to an object + */ +void lv_obj_refresh_ext_draw_size(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_DRAW_H*/ diff --git a/include/lvgl/core/lv_obj_event.h b/include/lvgl/core/lv_obj_event.h new file mode 100644 index 0000000000..c4eb991253 --- /dev/null +++ b/include/lvgl/core/lv_obj_event.h @@ -0,0 +1,213 @@ +/** + * @file lv_obj_event.h + * + */ + +#ifndef LV_OBJ_EVENT_H +#define LV_OBJ_EVENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_event.h" +#include "../lv_types.h" +#include "../indev/lv_indev.h" +#include "lv_obj_style.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** Cover check results.*/ +typedef enum { + LV_COVER_RES_COVER = 0, + LV_COVER_RES_NOT_COVER = 1, + LV_COVER_RES_MASKED = 2, +} lv_cover_res_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Send an event to the object + * @param obj pointer to an object + * @param event_code the type of the event from `lv_event_t` + * @param param arbitrary data depending on the widget type and the event. (Usually `NULL`) + * @return LV_RESULT_OK: `obj` was not deleted in the event; LV_RESULT_INVALID: `obj` was deleted in the event_code + */ +lv_result_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * param); + +/** + * Used by the widgets internally to call the ancestor widget types's event handler + * @param class_p pointer to the class of the widget (NOT the ancestor class) + * @param e pointer to the event descriptor + * @return LV_RESULT_OK: the target object was not deleted in the event; LV_RESULT_INVALID: it was deleted in the event_code + */ +lv_result_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e); + +/** + * Get the current target of the event. It's the object which event handler being called. + * If the event is not bubbled it's the same as "original" target. + * @param e pointer to the event descriptor + * @return the target of the event_code + */ +lv_obj_t * lv_event_get_current_target_obj(lv_event_t * e); + +/** + * Get the object originally targeted by the event. It's the same even if the event is bubbled. + * @param e pointer to the event descriptor + * @return pointer to the original target of the event_code + */ +lv_obj_t * lv_event_get_target_obj(lv_event_t * e); + +/** + * Add an event handler function for an object. + * Used by the user to react on event which happens with the object. + * An object can have multiple event handler. They will be called in the same order as they were added. + * @param obj pointer to an object + * @param filter an event code (e.g. `LV_EVENT_CLICKED`) on which the event should be called. `LV_EVENT_ALL` can be used to receive all the events. + * @param event_cb the new event function + * @param user_data custom data will be available in `event_cb` + * @return handler to the event. It can be used in `lv_obj_remove_event_dsc`. + */ +lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); + +uint32_t lv_obj_get_event_count(lv_obj_t * obj); + +lv_event_dsc_t * lv_obj_get_event_dsc(lv_obj_t * obj, uint32_t index); + +bool lv_obj_remove_event(lv_obj_t * obj, uint32_t index); + +bool lv_obj_remove_event_dsc(lv_obj_t * obj, lv_event_dsc_t * dsc); + +/** + * Remove an event_cb from an object + * @param obj pointer to a obj + * @param event_cb the event_cb of the event to remove + * @return the count of the event removed + */ +uint32_t lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb); + +/** + * Remove an event_cb with user_data + * @param obj pointer to a obj + * @param event_cb the event_cb of the event to remove + * @param user_data user_data + * @return the count of the event removed + */ +uint32_t lv_obj_remove_event_cb_with_user_data(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data); + +/** + * Get the input device passed as parameter to indev related events. + * @param e pointer to an event + * @return the indev that triggered the event or NULL if called on a not indev related event + */ +lv_indev_t * lv_event_get_indev(lv_event_t * e); + +/** + * Get the draw context which should be the first parameter of the draw functions. + * Namely: `LV_EVENT_DRAW_MAIN/POST`, `LV_EVENT_DRAW_MAIN/POST_BEGIN`, `LV_EVENT_DRAW_MAIN/POST_END` + * @param e pointer to an event + * @return pointer to a draw context or NULL if called on an unrelated event + */ +lv_layer_t * lv_event_get_layer(lv_event_t * e); + +/** + * Get the old area of the object before its size was changed. Can be used in `LV_EVENT_SIZE_CHANGED` + * @param e pointer to an event + * @return the old absolute area of the object or NULL if called on an unrelated event + */ +const lv_area_t * lv_event_get_old_size(lv_event_t * e); + +/** + * Get the key passed as parameter to an event. Can be used in `LV_EVENT_KEY` + * @param e pointer to an event + * @return the triggering key or NULL if called on an unrelated event + */ +uint32_t lv_event_get_key(lv_event_t * e); + +/** + * Get the signed rotary encoder diff. passed as parameter to an event. Can be used in `LV_EVENT_ROTARY` + * @param e pointer to an event + * @return the triggering key or NULL if called on an unrelated event + */ +int32_t lv_event_get_rotary_diff(lv_event_t * e); + +/** + * Get the animation descriptor of a scrolling. Can be used in `LV_EVENT_SCROLL_BEGIN` + * @param e pointer to an event + * @return the animation that will scroll the object. (can be modified as required) + */ +lv_anim_t * lv_event_get_scroll_anim(lv_event_t * e); + +/** + * Set the new extra draw size. Can be used in `LV_EVENT_REFR_EXT_DRAW_SIZE` + * @param e pointer to an event + * @param size The new extra draw size + */ +void lv_event_set_ext_draw_size(lv_event_t * e, int32_t size); + +/** + * Get a pointer to an `lv_point_t` variable in which the self size should be saved (width in `point->x` and height `point->y`). + * Can be used in `LV_EVENT_GET_SELF_SIZE` + * @param e pointer to an event + * @return pointer to `lv_point_t` or NULL if called on an unrelated event + */ +lv_point_t * lv_event_get_self_size_info(lv_event_t * e); + +/** + * Get a pointer to an `lv_hit_test_info_t` variable in which the hit test result should be saved. Can be used in `LV_EVENT_HIT_TEST` + * @param e pointer to an event + * @return pointer to `lv_hit_test_info_t` or NULL if called on an unrelated event + */ +lv_hit_test_info_t * lv_event_get_hit_test_info(lv_event_t * e); + +/** + * Get a pointer to an area which should be examined whether the object fully covers it or not. + * Can be used in `LV_EVENT_HIT_TEST` + * @param e pointer to an event + * @return an area with absolute coordinates to check + */ +const lv_area_t * lv_event_get_cover_area(lv_event_t * e); + +/** + * Set the result of cover checking. Can be used in `LV_EVENT_COVER_CHECK` + * @param e pointer to an event + * @param res an element of ::lv_cover_check_info_t + */ +void lv_event_set_cover_res(lv_event_t * e, lv_cover_res_t res); + +/** + * Get the draw task which was just added. + * Can be used in `LV_EVENT_DRAW_TASK_ADDED event` + * @param e pointer to an event + * @return the added draw task + */ +lv_draw_task_t * lv_event_get_draw_task(lv_event_t * e); + +/** + * Get the previous state before the state change. + * Can be used in `LV_EVENT_STATE_CHANGED` event + * @param e pointer to an event + * @return the previous state + */ +lv_state_t lv_event_get_prev_state(lv_event_t * e); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_EVENT_H*/ diff --git a/include/lvgl/core/lv_obj_pos.h b/include/lvgl/core/lv_obj_pos.h new file mode 100644 index 0000000000..6cb2d23614 --- /dev/null +++ b/include/lvgl/core/lv_obj_pos.h @@ -0,0 +1,583 @@ +/** + * @file lv_obj_pos.h + * + */ + +#ifndef LV_OBJ_POS_H +#define LV_OBJ_POS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_area.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + /** No flags */ + LV_OBJ_POINT_TRANSFORM_FLAG_NONE = 0x00, + + /** Consider the transformation properties of the parents too */ + LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE = 0x01, + + /** Execute the inverse of the transformation (-angle and 1/zoom) */ + LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE = 0x02, + + /** Both inverse and recursive*/ + LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE_RECURSIVE = 0x03, +} lv_obj_point_transform_flag_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Set the position of an object relative to the set alignment. + * @param obj pointer to an object + * @param x new x coordinate + * @param y new y coordinate + * @note With default alignment it's the distance from the top left corner + * @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent + * @note The position is interpreted on the content area of the parent + * @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)` + */ +void lv_obj_set_pos(lv_obj_t * obj, int32_t x, int32_t y); + +/** + * Set the x coordinate of an object + * @param obj pointer to an object + * @param x new x coordinate + * @note With default alignment it's the distance from the top left corner + * @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent + * @note The position is interpreted on the content area of the parent + * @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)` + */ +void lv_obj_set_x(lv_obj_t * obj, int32_t x); + +/** + * Set the y coordinate of an object + * @param obj pointer to an object + * @param y new y coordinate + * @note With default alignment it's the distance from the top left corner + * @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent + * @note The position is interpreted on the content area of the parent + * @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)` + */ +void lv_obj_set_y(lv_obj_t * obj, int32_t y); + +/** + * Set the size of an object. + * @param obj pointer to an object + * @param w the new width + * @param h the new height + * @note possible values are: + * pixel simple set the size accordingly + * LV_SIZE_CONTENT set the size to involve all children in the given direction + * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). + * x should be in [0..1000]% range + */ +void lv_obj_set_size(lv_obj_t * obj, int32_t w, int32_t h); + +/** + * Recalculate the size of the object + * @param obj pointer to an object + * @return true: the size has been changed + */ +bool lv_obj_refr_size(lv_obj_t * obj); + +/** + * Set the width of an object + * @param obj pointer to an object + * @param w the new width + * @note possible values are: + * pixel simple set the size accordingly + * LV_SIZE_CONTENT set the size to involve all children in the given direction + * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). + * x should be in [0..1000]% range + */ +void lv_obj_set_width(lv_obj_t * obj, int32_t w); + +/** + * Set the height of an object + * @param obj pointer to an object + * @param h the new height + * @note possible values are: + * pixel simple set the size accordingly + * LV_SIZE_CONTENT set the size to involve all children in the given direction + * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). + * x should be in [0..1000]% range + */ +void lv_obj_set_height(lv_obj_t * obj, int32_t h); + +/** + * Set the width reduced by the left and right padding and the border width. + * @param obj pointer to an object + * @param w the width without paddings in pixels + */ +void lv_obj_set_content_width(lv_obj_t * obj, int32_t w); + +/** + * Set the height reduced by the top and bottom padding and the border width. + * @param obj pointer to an object + * @param h the height without paddings in pixels + */ +void lv_obj_set_content_height(lv_obj_t * obj, int32_t h); + +/** + * Set a layout for an object + * @param obj pointer to an object + * @param layout pointer to a layout descriptor to set + */ +void lv_obj_set_layout(lv_obj_t * obj, uint32_t layout); + +/** + * Test whether the and object is positioned by a layout or not + * @param obj pointer to an object to test + * @return true: positioned by a layout; false: not positioned by a layout + */ +bool lv_obj_is_layout_positioned(const lv_obj_t * obj); + +/** + * Mark the object for layout update. + * @param obj pointer to an object whose children need to be updated + */ +void lv_obj_mark_layout_as_dirty(lv_obj_t * obj); + +/** + * Update the layout of an object. + * @param obj pointer to an object whose position and size needs to be updated + */ +void lv_obj_update_layout(const lv_obj_t * obj); + +/** + * Change the alignment of an object. + * @param obj pointer to an object to align + * @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used. + */ +void lv_obj_set_align(lv_obj_t * obj, lv_align_t align); + +/** + * Change the alignment of an object and set new coordinates. + * Equivalent to: + * lv_obj_set_align(obj, align); + * lv_obj_set_pos(obj, x_ofs, y_ofs); + * @param obj pointer to an object to align + * @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used. + * @param x_ofs x coordinate offset after alignment + * @param y_ofs y coordinate offset after alignment + */ +void lv_obj_align(lv_obj_t * obj, lv_align_t align, int32_t x_ofs, int32_t y_ofs); + +/** + * Align an object to another object. + * @param obj pointer to an object to align + * @param base pointer to another object (if NULL `obj`s parent is used). 'obj' will be aligned to it. + * @param align type of alignment (see 'lv_align_t' enum) + * @param x_ofs x coordinate offset after alignment + * @param y_ofs y coordinate offset after alignment + * @note if the position or size of `base` changes `obj` needs to be aligned manually again + */ +void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, int32_t x_ofs, + int32_t y_ofs); + +/** + * Align an object to the center on its parent. + * @param obj pointer to an object to align + * @note if the parent size changes `obj` needs to be aligned manually again + */ +void lv_obj_center(lv_obj_t * obj); + +/** + * Set the transform matrix of an object + * @param obj pointer to an object + * @param matrix pointer to a matrix to set + * @note `LV_DRAW_TRANSFORM_USE_MATRIX` needs to be enabled. + */ +void lv_obj_set_transform(lv_obj_t * obj, const lv_matrix_t * matrix); + +/** + * Reset the transform matrix of an object to identity matrix + * @param obj pointer to an object + * @note `LV_DRAW_TRANSFORM_USE_MATRIX` needs to be enabled. + */ +void lv_obj_reset_transform(lv_obj_t * obj); + +/** + * Copy the coordinates of an object to an area + * @param obj pointer to an object + * @param coords pointer to an area to store the coordinates + */ +void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * coords); + +/** + * Get the x coordinate of object. + * @param obj pointer to an object + * @return distance of `obj` from the left side of its parent plus the parent's left padding + * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation + * call `lv_obj_update_layout(obj)`. + * @note Zero return value means the object is on the left padding of the parent, and not on the left edge. + * @note Scrolling of the parent doesn't change the returned value. + * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. + */ +int32_t lv_obj_get_x(const lv_obj_t * obj); + +/** + * Get the x2 coordinate of object. + * @param obj pointer to an object + * @return distance of `obj` from the right side of its parent plus the parent's right padding + * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation + * call `lv_obj_update_layout(obj)`. + * @note Zero return value means the object is on the right padding of the parent, and not on the right edge. + * @note Scrolling of the parent doesn't change the returned value. + * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. + */ +int32_t lv_obj_get_x2(const lv_obj_t * obj); + +/** + * Get the y coordinate of object. + * @param obj pointer to an object + * @return distance of `obj` from the top side of its parent plus the parent's top padding + * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation + * call `lv_obj_update_layout(obj)`. + * @note Zero return value means the object is on the top padding of the parent, and not on the top edge. + * @note Scrolling of the parent doesn't change the returned value. + * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. + */ +int32_t lv_obj_get_y(const lv_obj_t * obj); + +/** + * Get the y2 coordinate of object. + * @param obj pointer to an object + * @return distance of `obj` from the bottom side of its parent plus the parent's bottom padding + * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation + * call `lv_obj_update_layout(obj)`. + * @note Zero return value means the object is on the bottom padding of the parent, and not on the bottom edge. + * @note Scrolling of the parent doesn't change the returned value. + * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. + */ +int32_t lv_obj_get_y2(const lv_obj_t * obj); + +/** + * Get the actually set x coordinate of object, i.e. the offset from the set alignment + * @param obj pointer to an object + * @return the set x coordinate + */ +int32_t lv_obj_get_x_aligned(const lv_obj_t * obj); + +/** + * Get the actually set y coordinate of object, i.e. the offset from the set alignment + * @param obj pointer to an object + * @return the set y coordinate + */ +int32_t lv_obj_get_y_aligned(const lv_obj_t * obj); + +/** + * Get the width of an object + * @param obj pointer to an object + * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation + * call `lv_obj_update_layout(obj)`. + * @return the width in pixels + */ +int32_t lv_obj_get_width(const lv_obj_t * obj); + +/** + * Get the height of an object + * @param obj pointer to an object + * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation + * call `lv_obj_update_layout(obj)`. + * @return the height in pixels + */ +int32_t lv_obj_get_height(const lv_obj_t * obj); + +/** + * Get the width reduced by the left and right padding and the border width. + * @param obj pointer to an object + * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation + * call `lv_obj_update_layout(obj)`. + * @return the width which still fits into its parent without causing overflow (making the parent scrollable) + */ +int32_t lv_obj_get_content_width(const lv_obj_t * obj); + +/** + * Get the height reduced by the top and bottom padding and the border width. + * @param obj pointer to an object + * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation + * call `lv_obj_update_layout(obj)`. + * @return the height which still fits into the parent without causing overflow (making the parent scrollable) + */ +int32_t lv_obj_get_content_height(const lv_obj_t * obj); + +/** + * Get the area reduced by the paddings and the border width. + * @param obj pointer to an object + * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation + * call `lv_obj_update_layout(obj)`. + * @param area the area which still fits into the parent without causing overflow (making the parent scrollable) + */ +void lv_obj_get_content_coords(const lv_obj_t * obj, lv_area_t * area); + +/** + * Get the width occupied by the "parts" of the widget. E.g. the width of all columns of a table. + * @param obj pointer to an object + * @return the width of the virtually drawn content + * @note This size independent from the real size of the widget. + * It just tells how large the internal ("virtual") content is. + */ +int32_t lv_obj_get_self_width(const lv_obj_t * obj); + +/** + * Get the height occupied by the "parts" of the widget. E.g. the height of all rows of a table. + * @param obj pointer to an object + * @return the width of the virtually drawn content + * @note This size independent from the real size of the widget. + * It just tells how large the internal ("virtual") content is. + */ +int32_t lv_obj_get_self_height(const lv_obj_t * obj); + +/** + * Get the style width actually used by the object after clamping the width within the min max range. + * @param obj pointer to an object + * @return the min/max/normal width set by `lv_obj_set_style__width()` + * @note This is not the calculated size, so if the size was set as `LV_SIZE_CONTENT` or `LV_PCT()` + * then that value will be returned. + */ +int32_t lv_obj_get_style_clamped_width(lv_obj_t * obj); + +/** + * Get the style height actually used by the object after clamping the height within the min max range. + * @param obj pointer to an object + * @return the min/max/normal height set by `lv_obj_set_style__height()` + * @note This is not the calculated size, so if the size was set as `LV_SIZE_CONTENT` or `LV_PCT()` + * then that value will be returned. + */ +int32_t lv_obj_get_style_clamped_height(lv_obj_t * obj); + +/** + * Determine if any of the object's width style properties are set to `LV_SIZE_CONTENT`. + * @param obj Pointer to a valid object. + * @return `true` At least one of the following width style properties is `LV_SIZE_CONTENT`: `LV_STYLE_WIDTH`, `LV_STYLE_MIN_WIDTH`, `LV_STYLE_MAX_WIDTH`. + * @return `false` No width style properties are `LV_SIZE_CONTENT`. + */ +bool lv_obj_is_style_any_width_content(lv_obj_t * obj); + +/** + * Determine if any of the object's height style properties are set to `LV_SIZE_CONTENT`. + * @param obj Pointer to a valid object. + * @return `true` At least one of the following height style properties is `LV_SIZE_CONTENT`: `LV_STYLE_HEIGHT`, `LV_STYLE_MIN_HEIGHT`, `LV_STYLE_MAX_HEIGHT`. + * @return `false` No height style properties are `LV_SIZE_CONTENT`. + */ +bool lv_obj_is_style_any_height_content(lv_obj_t * obj); + +/** + * @brief Determine if the object's resolved width was limited by its minimum width constraint. + * + * This function reports whether, in the most recent layout / size calculation, the object's + * final (used) width had to be raised to satisfy a minimum width requirement. + * + * @param obj Pointer to a valid object. + * @return true The computed width == the effective minimum width (i.e. it was clamped). + * @return false The width is larger than the minimum (not min‑clamped). + */ +bool lv_obj_is_width_min(lv_obj_t * obj); + +/** + * @brief Determine if the object's resolved height was limited by its minimum height constraint. + * + * This function reports whether, in the most recent layout / size calculation, the object's + * final (used) height had to be raised to satisfy a minimum height requirement. + * + * @param obj Pointer to a valid object. + * @return true The computed height == the effective minimum height (i.e. it was clamped). + * @return false The height is larger than the minimum (not min‑clamped). + */ +bool lv_obj_is_height_min(lv_obj_t * obj); + +/** + * @brief Determine if the object's resolved width was limited by its maximum width constraint. + * + * This function reports whether, in the most recent layout / size calculation, the object's + * final (used) width had to be raised to satisfy a maximum width requirement. + * + * @param obj Pointer to a valid object. + * @return true The computed width == the effective maximum width (i.e. it was clamped). + * @return false The width is smaller than the maximum (not min‑clamped). + */ +bool lv_obj_is_width_max(lv_obj_t * obj); + +/** + * @brief Determine if the object's resolved height was limited by its maximum height constraint. + * + * This function reports whether, in the most recent layout / size calculation, the object's + * final (used) height had to be raised to satisfy a maximum height requirement. + * + * @param obj Pointer to a valid object. + * @return true The computed height == the effective maximum height (i.e. it was clamped). + * @return false The height is smaller than the maximum (not min‑clamped). + */ +bool lv_obj_is_height_max(lv_obj_t * obj); + +/** + * Handle if the size of the internal ("virtual") content of an object has changed. + * @param obj pointer to an object + * @return false: nothing happened; true: refresh happened + */ +bool lv_obj_refresh_self_size(lv_obj_t * obj); + +void lv_obj_refr_pos(lv_obj_t * obj); + +void lv_obj_move_to(lv_obj_t * obj, int32_t x, int32_t y); + +void lv_obj_move_children_by(lv_obj_t * obj, int32_t x_diff, int32_t y_diff, bool ignore_floating); + +/** + * Get the transform matrix of an object + * @param obj pointer to an object + * @return pointer to the transform matrix or NULL if not set + */ +const lv_matrix_t * lv_obj_get_transform(const lv_obj_t * obj); + +/** + * Transform a point using the angle and zoom style properties of an object + * @param obj pointer to an object whose style properties should be used + * @param p a point to transform, the result will be written back here too + * @param flags OR-ed valued of :cpp:enum:`lv_obj_point_transform_flag_t` + */ +void lv_obj_transform_point(const lv_obj_t * obj, lv_point_t * p, lv_obj_point_transform_flag_t flags); + +/** + * Transform an array of points using the angle and zoom style properties of an object + * @param obj pointer to an object whose style properties should be used + * @param points the array of points to transform, the result will be written back here too + * @param count number of points in the array + * @param flags OR-ed valued of :cpp:enum:`lv_obj_point_transform_flag_t` + */ +void lv_obj_transform_point_array(const lv_obj_t * obj, lv_point_t points[], size_t count, + lv_obj_point_transform_flag_t flags); + +/** + * Transform an area using the angle and zoom style properties of an object + * @param obj pointer to an object whose style properties should be used + * @param area an area to transform, the result will be written back here too + * @param flags OR-ed valued of :cpp:enum:`lv_obj_point_transform_flag_t` + */ +void lv_obj_get_transformed_area(const lv_obj_t * obj, lv_area_t * area, lv_obj_point_transform_flag_t flags); + +/** + * Mark an area of an object as invalid. + * The area will be truncated to the object's area and marked for redraw. + * @param obj pointer to an object + * @param area the area to redraw + * @return LV_RESULT_OK: the area is invalidated; LV_RESULT_INVALID: the area wasn't invalidated. + * (maybe it was off-screen or fully clipped) + */ +lv_result_t lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area); + +/** + * Mark the object as invalid to redrawn its area + * @param obj pointer to an object + * @return LV_RESULT_OK: the area is invalidated; LV_RESULT_INVALID: the area wasn't invalidated. + * (maybe it was off-screen or fully clipped) + */ +lv_result_t lv_obj_invalidate(const lv_obj_t * obj); + +/** + * Tell whether an area of an object is visible (even partially) now or not + * @param obj pointer to an object + * @param area the are to check. The visible part of the area will be written back here. + * @return true visible; false not visible (hidden, out of parent, on other screen, etc) + */ +bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area); + +/** + * Tell whether an object is visible (even partially) now or not + * @param obj pointer to an object + * @return true: visible; false not visible (hidden, out of parent, on other screen, etc) + */ +bool lv_obj_is_visible(const lv_obj_t * obj); + +/** + * Set the size of an extended clickable area + * @param obj pointer to an object + * @param size extended clickable area in all 4 directions [px] + */ +void lv_obj_set_ext_click_area(lv_obj_t * obj, int32_t size); + +/** + * Get the an area where to object can be clicked. + * It's the object's normal area plus the extended click area. + * @param obj pointer to an object + * @param area store the result area here + */ +void lv_obj_get_click_area(const lv_obj_t * obj, lv_area_t * area); + +/** + * Hit-test an object given a particular point in screen space. + * @param obj object to hit-test + * @param point screen-space point (absolute coordinate) + * @return true: if the object is considered under the point + */ +bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point); + +/** + * Clamp a width between min and max width. If the min/max width is in percentage value use the ref_width + * @param width width to clamp + * @param min_width the minimal width + * @param max_width the maximal width + * @param ref_width the reference width used when min/max width is in percentage + * @return the clamped width + */ +int32_t lv_clamp_width(int32_t width, int32_t min_width, int32_t max_width, int32_t ref_width); + +/** + * Clamp a height between min and max height. If the min/max height is in percentage value use the ref_height + * @param height height to clamp + * @param min_height the minimal height + * @param max_height the maximal height + * @param ref_height the reference height used when min/max height is in percentage + * @return the clamped height + */ +int32_t lv_clamp_height(int32_t height, int32_t min_height, int32_t max_height, int32_t ref_height); + +/** + * @brief Calculates the width in pixels of an LVGL object based on its style and parent for a given width `prop`. + * @param obj Pointer to the LVGL object whose width is being calculated. + * @param prop Which style width to calculate for. Valid values are: LV_STYLE_WIDTH, LV_STYLE_MIN_WIDTH, or + * LV_STYLE_MAX_WIDTH. + * @return The computed width for the object: + * @note If the style width is a fixed value, that value is returned. + * @note If the style width is `LV_SIZE_CONTENT`, the content width is calculated and returned. + * @note If the style width is a `LV_PCT()`, the percentage is applied to the parent's width. + */ +int32_t lv_obj_calc_dynamic_width(lv_obj_t * obj, lv_style_prop_t prop); + +/** + * @brief Calculates the height in pixels of an LVGL object based on its style and parent for a given height `prop`. + * @param obj Pointer to the LVGL object whose height is being calculated. + * @param prop Which style height to calculate for. Valid values are: LV_STYLE_HEIGHT, LV_STYLE_MIN_HEIGHT, or + * LV_STYLE_MAX_HEIGHT. + * @return The computed height for the object: + * @note If the style height is a fixed value, that value is returned. + * @note If the style height is `LV_SIZE_CONTENT`, the content height is calculated and returned. + * @note If the style height is a `LV_PCT()`, the percentage is applied to the parent's height. + */ +int32_t lv_obj_calc_dynamic_height(lv_obj_t * obj, lv_style_prop_t prop); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_POS_H*/ diff --git a/include/lvgl/core/lv_obj_property.h b/include/lvgl/core/lv_obj_property.h new file mode 100644 index 0000000000..2200081904 --- /dev/null +++ b/include/lvgl/core/lv_obj_property.h @@ -0,0 +1,280 @@ +/** + * @file lv_obj_property.h + * + */ + +#ifndef LV_OBJ_PROPERTY_H +#define LV_OBJ_PROPERTY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" +#include "lv_style.h" +#include "lv_obj_style.h" + +#if LV_USE_OBJ_PROPERTY + +/********************* + * DEFINES + *********************/ + +/*All possible property value types*/ +#define LV_PROPERTY_TYPE_INVALID 0 /*Use default 0 as invalid to detect program outliers*/ +#define LV_PROPERTY_TYPE_INT 1 /*int32_t type*/ +#define LV_PROPERTY_TYPE_PRECISE 2 /*lv_value_precise_t, int32_t or float depending on LV_USE_FLOAT*/ +#define LV_PROPERTY_TYPE_COLOR 3 /*ARGB8888 type*/ +#define LV_PROPERTY_TYPE_POINT 4 /*lv_point_t */ +#define LV_PROPERTY_TYPE_POINTER 5 /*void * pointer*/ +#define LV_PROPERTY_TYPE_IMGSRC 6 /*Special pointer for image*/ +#define LV_PROPERTY_TYPE_TEXT 7 /*Special pointer of char* */ +#define LV_PROPERTY_TYPE_OBJ 8 /*Special pointer of lv_obj_t* */ +#define LV_PROPERTY_TYPE_DISPLAY 9 /*Special pointer of lv_display_t* */ +#define LV_PROPERTY_TYPE_FONT 10 /*Special pointer of lv_font_t* */ +#define LV_PROPERTY_TYPE_BOOL 11 /*int32_t type*/ + +#define LV_PROPERTY_TYPE_SHIFT 28 +#define LV_PROPERTY_TYPE2_SHIFT 24 + +/* Example: + * LV_PROPERTY_ID(OBJ, FLAG_CLICKABLE, LV_PROPERTY_TYPE_INT, 1), + * produces + * LV_PROPERTY_OBJ_FLAG_CLICKABLE = (LV_PROPERTY_OBJ_START + (1)) | ((LV_PROPERTY_TYPE_INT) << LV_PROPERTY_TYPE_SHIFT) + */ +#define LV_PROPERTY_ID(clz, name, type, index) LV_PROPERTY_## clz ##_##name = (LV_PROPERTY_## clz ##_START + ((int)index)) | ((type) << LV_PROPERTY_TYPE_SHIFT) + +/* Example: + * LV_PROPERTY_ID2(SLIDER, VALUE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_BOOL, 0) + * produces + * LV_PROPERTY_SLIDER_VALUE = (LV_PROPERTY_SLIDER_START + (0)) | ((LV_PROPERTY_TYPE_INT) << LV_PROPERTY_TYPE_SHIFT) | ((LV_PROPERTY_TYPE_BOOL) << LV_PROPERTY_TYPE2_SHIFT) + */ +#define LV_PROPERTY_ID2(clz, name, type, type2, index) LV_PROPERTY_ID(clz, name, type, index) | ((type2) << LV_PROPERTY_TYPE2_SHIFT) + +#define LV_PROPERTY_ID_TYPE(id) ((id) >> LV_PROPERTY_TYPE_SHIFT) +#define LV_PROPERTY_ID_TYPE2(id) ((id) >> LV_PROPERTY_TYPE_SHIFT) +#define LV_PROPERTY_ID_INDEX(id) ((id) & 0xfffffff) + +/*Set properties from an array of lv_property_t*/ +#define LV_OBJ_SET_PROPERTY_ARRAY(obj, array) lv_obj_set_properties(obj, array, LV_ARRAYLEN(array)) + +/* Helper to implement class definition of property and property names */ +/* *INDENT-OFF* */ +#if LV_USE_OBJ_PROPERTY_NAME +#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase) \ + .prop_index_start = LV_PROPERTY_##uppercase##_START, \ + .prop_index_end = LV_PROPERTY_##uppercase##_END, \ + .properties = lv_##widget##_properties, \ + .properties_count = LV_ARRAYLEN(lv_##widget##_properties), \ + .property_names = lv_##widget##_property_names, \ + .names_count = LV_ARRAYLEN(lv_##widget##_property_names) +#else +#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase) \ + .prop_index_start = LV_PROPERTY_##uppercase##_START, \ + .prop_index_end = LV_PROPERTY_##uppercase##_END, \ + .properties = lv_##widget##_properties, \ + .properties_count = LV_ARRAYLEN(lv_##widget##_properties) +#endif +/* *INDENT-ON* */ + + +/********************** + * TYPEDEFS + **********************/ + +/** + * Group of predefined widget ID start value. + */ +enum _lv_prop_id_range_boundary_t { + LV_PROPERTY_ID_INVALID = 0, + + /*ID 0x01 to 0xff are style ID, check lv_style_prop_t*/ + LV_PROPERTY_STYLE_START = 0x00, + + LV_PROPERTY_ID_START = 0x0100, /*ID smaller than 0xff is style ID*/ + /*Define the property ID for every widget here. */ + LV_PROPERTY_OBJ_START = 0x0100, /* lv_obj.c */ + LV_PROPERTY_IMAGE_START = 0x0200, /* lv_image.c */ + LV_PROPERTY_LABEL_START = 0x0300, /* lv_label.c */ + LV_PROPERTY_KEYBOARD_START = 0x0400, /* lv_keyboard.c */ + LV_PROPERTY_TEXTAREA_START = 0x0500, /* lv_textarea.c */ + LV_PROPERTY_ROLLER_START = 0x0600, /* lv_roller.c */ + LV_PROPERTY_DROPDOWN_START = 0x0700, /* lv_dropdown.c */ + LV_PROPERTY_SLIDER_START = 0x0800, /* lv_slider.c */ + LV_PROPERTY_ANIMIMAGE_START = 0x0900, /* lv_animimage.c */ + LV_PROPERTY_ARC_START = 0x0a00, /* lv_arc.c */ + LV_PROPERTY_BAR_START = 0x0b00, /* lv_bar.c */ + LV_PROPERTY_SWITCH_START = 0x0c00, /* lv_switch.c */ + LV_PROPERTY_CHECKBOX_START = 0x0d00, /* lv_checkbox.c */ + LV_PROPERTY_LED_START = 0x0e00, /* lv_led.c */ + LV_PROPERTY_LINE_START = 0x0f00, /* lv_line.c */ + LV_PROPERTY_SCALE_START = 0x1000, /* lv_scale.c */ + LV_PROPERTY_SPINBOX_START = 0x1100, /* lv_spinbox.c */ + LV_PROPERTY_SPINNER_START = 0x1200, /* lv_spinner.c */ + LV_PROPERTY_TABLE_START = 0x1300, /* lv_table.c */ + LV_PROPERTY_TABVIEW_START = 0x1400, /* lv_tabview.c */ + LV_PROPERTY_BUTTONMATRIX_START = 0x1500, /* lv_buttonmatrix.c */ + LV_PROPERTY_SPAN_START = 0x1600, /* lv_span.c */ + LV_PROPERTY_MENU_START = 0x1700, /* lv_menu.c */ + LV_PROPERTY_CHART_START = 0x1800, /* lv_chart.c */ + + /*Special ID, use it to extend ID and make sure it's unique and compile time determinant*/ + LV_PROPERTY_ID_BUILTIN_LAST = 0xffff, /*ID of 0x10000 ~ 0xfffffff is reserved for user*/ + + LV_PROPERTY_ID_ANY = 0x7ffffffe, /*Special ID used by lvgl to intercept all setter/getter call.*/ +}; + +struct _lv_property_name_t { + const char * name; + lv_prop_id_t id; +}; + +typedef struct { + lv_prop_id_t id; + union { + int32_t num; /**< Signed integer number (enums or "normal" numbers)*/ + uint32_t num_u; /**< Unsigned integer number (opacity, Booleans) */ + bool enable; /**< Booleans */ + const void * ptr; /**< Constant pointers (font, cone text, etc.) */ + lv_color_t color; /**< Colors */ + lv_value_precise_t precise; /**< float or int for precise value */ + lv_point_t point; /**< Point, contains two int32_t */ + + struct { + /** + * Note that place struct member `style` at first place is intended. + * `style` shares same memory with `num`, `ptr`, `color`. + * So we set the style value directly without using `prop.style.num`. + * + * E.g. + * + * static const lv_property_t obj_pos_x = { + * .id = LV_PROPERTY_STYLE_X, + * .num = 123, + * .selector = LV_STATE_PRESSED, + * } + * + * instead of: + * static const lv_property_t obj_pos_x = { + * .id = LV_PROPERTY_STYLE_X, + * .style.num = 123, // note this line. + * .selector = LV_STATE_PRESSED, + * } + */ + lv_style_value_t style; /**< Make sure it's the first element in struct. */ + uint32_t selector; /**< Style selector, lv_part_t | lv_state_t */ + }; + + /** + * For some properties like slider range, it contains two simple (4-byte) values + * so we can use `arg1.num` and `arg2.num` to set the argument. + */ + struct { + union { + int32_t num; + uint32_t num_u; + bool enable; + const void * ptr; + lv_color_t color; + lv_value_precise_t precise; + } arg1, arg2; + }; + }; +} lv_property_t; + +typedef struct { + lv_prop_id_t id; + + void * setter; /**< Callback used to set property. */ + void * getter; /**< Callback used to get property. */ +} lv_property_ops_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/*===================== + * Setter functions + *====================*/ + +/** + * Set Widget property. + * @param obj pointer to Widget + * @param value property value to set + * @return return LV_RESULT_OK if call succeeded + */ +lv_result_t lv_obj_set_property(lv_obj_t * obj, const lv_property_t * value); + +/** + * Set multiple Widget properties. Helper `LV_OBJ_SET_PROPERTY_ARRAY` can be used for constant property array. + * @param obj pointer to Widget + * @param value property value array to set + * @param count number of array elements + * @return return LV_RESULT_OK if call succeeded + */ +lv_result_t lv_obj_set_properties(lv_obj_t * obj, const lv_property_t * value, uint32_t count); + +/*===================== + * Getter functions + *====================*/ + +/** + * Read property value from Widget. + * If id is a style property, computes the style of PART_MAIN. + * @param obj pointer to Widget + * @param id ID of property to read + * @return return property value read. The returned property ID is set to `LV_PROPERTY_ID_INVALID` if read failed. + */ +lv_property_t lv_obj_get_property(lv_obj_t * obj, lv_prop_id_t id); + +/** + * Read style property value from Widget + * @param obj pointer to Widget + * @param id ID of style property + * @param part part for which the style property should be computed + * @return return property value read. The returned property ID is set to `LV_PROPERTY_ID_INVALID` if read failed. + */ +lv_property_t lv_obj_get_style_property(lv_obj_t * obj, lv_prop_id_t id, lv_part_t part); + +/** + * Get property ID by recursively searching for name in Widget's class hierarchy, and + * if still not found, then search style properties. + * Requires to enabling `LV_USE_OBJ_PROPERTY_NAME`. + * @param obj pointer to Widget whose class and base-class hierarchy are to be searched. + * @param name property name + * @return property ID found or `LV_PROPERTY_ID_INVALID` if not found. + */ +lv_prop_id_t lv_obj_property_get_id(const lv_obj_t * obj, const char * name); + +/** + * Get property ID by doing a non-recursive search for name directly in Widget class properties. + * Requires enabling `LV_USE_OBJ_PROPERTY_NAME`. + * @param clz pointer to Widget class that has specified property. + * @param name property name + * @return property ID found or `LV_PROPERTY_ID_INVALID` if not found. + */ +lv_prop_id_t lv_obj_class_property_get_id(const lv_obj_class_t * clz, const char * name); + +/** + * Get style property ID by name. Requires enabling `LV_USE_OBJ_PROPERTY_NAME`. + * @param name property name + * @return property ID found or `LV_PROPERTY_ID_INVALID` if not found. + */ +lv_prop_id_t lv_style_property_get_id(const char * name); + +/********************** + * MACROS + **********************/ + +#else +#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase) +#endif /*LV_USE_OBJ_PROPERTY*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_PROPERTY_H*/ diff --git a/include/lvgl/core/lv_obj_property_names.h b/include/lvgl/core/lv_obj_property_names.h new file mode 100644 index 0000000000..7384687773 --- /dev/null +++ b/include/lvgl/core/lv_obj_property_names.h @@ -0,0 +1,39 @@ + +/** + * @file lv_obj_property_names.h + * GENERATED FILE, DO NOT EDIT IT! + */ +#ifndef LV_OBJ_PROPERTY_NAMES_H +#define LV_OBJ_PROPERTY_NAMES_H + +#include "../lv_types.h" + +#if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME + + extern const lv_property_name_t lv_animimage_property_names[4]; + extern const lv_property_name_t lv_arc_property_names[11]; + extern const lv_property_name_t lv_bar_property_names[6]; + extern const lv_property_name_t lv_buttonmatrix_property_names[2]; + extern const lv_property_name_t lv_chart_property_names[5]; + extern const lv_property_name_t lv_checkbox_property_names[1]; + extern const lv_property_name_t lv_dropdown_property_names[9]; + extern const lv_property_name_t lv_image_property_names[11]; + extern const lv_property_name_t lv_keyboard_property_names[4]; + extern const lv_property_name_t lv_label_property_names[4]; + extern const lv_property_name_t lv_led_property_names[2]; + extern const lv_property_name_t lv_line_property_names[1]; + extern const lv_property_name_t lv_menu_property_names[2]; + extern const lv_property_name_t lv_obj_property_names[76]; + extern const lv_property_name_t lv_roller_property_names[3]; + extern const lv_property_name_t lv_scale_property_names[8]; + extern const lv_property_name_t lv_slider_property_names[8]; + extern const lv_property_name_t lv_span_property_names[5]; + extern const lv_property_name_t lv_spinbox_property_names[8]; + extern const lv_property_name_t lv_spinner_property_names[2]; + extern const lv_property_name_t lv_style_property_names[131]; + extern const lv_property_name_t lv_switch_property_names[1]; + extern const lv_property_name_t lv_table_property_names[2]; + extern const lv_property_name_t lv_tabview_property_names[2]; + extern const lv_property_name_t lv_textarea_property_names[14]; +#endif +#endif diff --git a/include/lvgl/core/lv_obj_scroll.h b/include/lvgl/core/lv_obj_scroll.h new file mode 100644 index 0000000000..a7fe5ae1ed --- /dev/null +++ b/include/lvgl/core/lv_obj_scroll.h @@ -0,0 +1,301 @@ +/** + * @file lv_obj_scroll.h + * + */ + +#ifndef LV_OBJ_SCROLL_H +#define LV_OBJ_SCROLL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_area.h" +#include "lv_anim.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Can't include lv_obj.h because it includes this header file*/ + +/** Scrollbar modes: shows when should the scrollbars be visible*/ +typedef enum { + LV_SCROLLBAR_MODE_OFF, /**< Never show scrollbars*/ + LV_SCROLLBAR_MODE_ON, /**< Always show scrollbars*/ + LV_SCROLLBAR_MODE_ACTIVE, /**< Show scroll bars when Widget is being scrolled*/ + LV_SCROLLBAR_MODE_AUTO, /**< Show scroll bars when the content is large enough to be scrolled*/ +} lv_scrollbar_mode_t; + +/** Scroll span align options. Tells where to align the snappable children when scroll stops.*/ +typedef enum { + LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is*/ + LV_SCROLL_SNAP_START, /**< Align to the left/top*/ + LV_SCROLL_SNAP_END, /**< Align to the right/bottom*/ + LV_SCROLL_SNAP_CENTER /**< Align to the center*/ +} lv_scroll_snap_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/*===================== + * Setter functions + *====================*/ + +/** + * Set how the scrollbars should behave. + * @param obj pointer to Widget + * @param mode LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE + */ +void lv_obj_set_scrollbar_mode(lv_obj_t * obj, lv_scrollbar_mode_t mode); + +/** + * Set direction Widget can be scrolled + * @param obj pointer to Widget + * @param dir one or more bit-wise OR-ed values of `lv_dir_t` enumeration + */ +void lv_obj_set_scroll_dir(lv_obj_t * obj, lv_dir_t dir); + +/** + * Set where to snap the children when scrolling ends horizontally + * @param obj pointer to Widget + * @param align value from `lv_scroll_snap_t` enumeration + */ +void lv_obj_set_scroll_snap_x(lv_obj_t * obj, lv_scroll_snap_t align); + +/** + * Set where to snap the children when scrolling ends vertically + * @param obj pointer to Widget + * @param align value from `lv_scroll_snap_t` enumeration + */ +void lv_obj_set_scroll_snap_y(lv_obj_t * obj, lv_scroll_snap_t align); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the current scroll mode (when to hide the scrollbars) + * @param obj pointer to Widget + * @return the current scroll mode from `lv_scrollbar_mode_t` + */ +lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const lv_obj_t * obj); + +/** + * Get directions Widget can be scrolled (set with `lv_obj_set_scroll_dir()`) + * @param obj pointer to Widget + * @return current scroll direction bit(s) + */ +lv_dir_t lv_obj_get_scroll_dir(const lv_obj_t * obj); + +/** + * Get where to snap child Widgets when horizontal scrolling ends. + * @param obj pointer to Widget + * @return current snap value from `lv_scroll_snap_t` + */ +lv_scroll_snap_t lv_obj_get_scroll_snap_x(const lv_obj_t * obj); + +/** + * Get where to snap child Widgets when vertical scrolling ends. + * @param obj pointer to Widget + * @return current snap value from `lv_scroll_snap_t` + */ +lv_scroll_snap_t lv_obj_get_scroll_snap_y(const lv_obj_t * obj); + +/** + * Get current X scroll position. Identical to `lv_obj_get_scroll_left()`. + * @param obj pointer to scrollable container Widget + * @return current scroll position from left edge + * - If Widget is not scrolled return 0. + * - If scrolled return > 0. + * - If scrolled inside (elastic scroll) return < 0. + */ +int32_t lv_obj_get_scroll_x(const lv_obj_t * obj); + +/** + * Get current Y scroll position. Identical to `lv_obj_get_scroll_top()`. + * @param obj pointer to scrollable container Widget + * @return current scroll position from top edge + * - If Widget is not scrolled return 0. + * - If scrolled return > 0. + * - If scrolled inside (elastic scroll) return < 0. + */ +int32_t lv_obj_get_scroll_y(const lv_obj_t * obj); + +/** + * Number of pixels a scrollable container Widget can be scrolled down + * before its top edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag + * is set in Widget, this value can go negative while Widget is being + * dragged below its normal top-edge boundary. + * @param obj pointer to scrollable container Widget + * @return pixels Widget can be scrolled down before its top edge appears + */ +int32_t lv_obj_get_scroll_top(const lv_obj_t * obj); + +/** + * Number of pixels a scrollable container Widget can be scrolled up + * before its bottom edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag + * is set in Widget, this value can go negative while Widget is being + * dragged above its normal bottom-edge boundary. + * @param obj pointer to scrollable container Widget + * @return pixels Widget can be scrolled up before its bottom edge appears + */ +int32_t lv_obj_get_scroll_bottom(const lv_obj_t * obj); + +/** + * Number of pixels a scrollable container Widget can be scrolled right + * before its left edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag + * is set in Widget, this value can go negative while Widget is being + * dragged farther right than its normal left-edge boundary. + * @param obj pointer to scrollable container Widget + * @return pixels Widget can be scrolled right before its left edge appears + */ +int32_t lv_obj_get_scroll_left(const lv_obj_t * obj); + +/** + * Number of pixels a scrollable container Widget can be scrolled left + * before its right edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag + * is set in Widget, this value can go negative while Widget is being + * dragged farther left than its normal right-edge boundary. + * @param obj pointer to scrollable container Widget + * @return pixels Widget can be scrolled left before its right edge appears + */ +int32_t lv_obj_get_scroll_right(const lv_obj_t * obj); + +/** + * Get the X and Y coordinates where the scrolling will end for Widget if a scrolling animation is in progress. + * If no scrolling animation, give the current `x` or `y` scroll position. + * @param obj pointer to scrollable Widget + * @param end pointer to `lv_point_t` object in which to store result + */ +void lv_obj_get_scroll_end(lv_obj_t * obj, lv_point_t * end); + +/*===================== + * Other functions + *====================*/ + +/** + * Scroll by given amount of pixels. + * @param obj pointer to scrollable Widget to scroll + * @param dx pixels to scroll horizontally + * @param dy pixels to scroll vertically + * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately + * @note > 0 value means scroll right/bottom (show the more content on the right/bottom) + * @note e.g. dy = -20 means scroll down 20 px + */ +void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en); + +/** + * Scroll by given amount of pixels. + * `dx` and `dy` will be limited internally to allow scrolling only on the content area. + * @param obj pointer to scrollable Widget to scroll + * @param dx pixels to scroll horizontally + * @param dy pixels to scroll vertically + * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately + * @note e.g. dy = -20 means scroll down 20 px + */ +void lv_obj_scroll_by_bounded(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en); + +/** + * Scroll to given coordinate on Widget. + * `x` and `y` will be limited internally to allow scrolling only on the content area. + * @param obj pointer to scrollable Widget to scroll + * @param x pixels to scroll horizontally + * @param y pixels to scroll vertically + * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately + */ +void lv_obj_scroll_to(lv_obj_t * obj, int32_t x, int32_t y, lv_anim_enable_t anim_en); + +/** + * Scroll to X coordinate on Widget. + * `x` will be limited internally to allow scrolling only on the content area. + * @param obj pointer to scrollable Widget to scroll + * @param x pixels to scroll horizontally + * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately + */ +void lv_obj_scroll_to_x(lv_obj_t * obj, int32_t x, lv_anim_enable_t anim_en); + +/** + * Scroll to Y coordinate on Widget. + * `y` will be limited internally to allow scrolling only on the content area. + * @param obj pointer to scrollable Widget to scroll + * @param y pixels to scroll vertically + * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately + */ +void lv_obj_scroll_to_y(lv_obj_t * obj, int32_t y, lv_anim_enable_t anim_en); + +/** + * Scroll `obj`'s parent Widget until `obj` becomes visible. + * @param obj pointer to Widget to scroll into view + * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately + */ +void lv_obj_scroll_to_view(lv_obj_t * obj, lv_anim_enable_t anim_en); + +/** + * Scroll `obj`'s parent Widgets recursively until `obj` becomes visible. + * Widget will be scrolled into view even it has nested scrollable parents. + * @param obj pointer to Widget to scroll into view + * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately + */ +void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en); + +/** + * Tell whether Widget is being scrolled or not at this moment + * @param obj pointer to Widget + * @return true: `obj` is being scrolled + */ +bool lv_obj_is_scrolling(const lv_obj_t * obj); + +/** + * Stop scrolling the current object + * + * @param obj The object being scrolled + */ +void lv_obj_stop_scroll_anim(const lv_obj_t * obj); + +/** + * Check children of `obj` and scroll `obj` to fulfill scroll_snap settings. + * @param obj Widget whose children need to be checked and snapped + * @param anim_en LV_ANIM_ON/OFF + */ +void lv_obj_update_snap(lv_obj_t * obj, lv_anim_enable_t anim_en); + +/** + * Get the area of the scrollbars + * @param obj pointer to Widget + * @param hor pointer to store the area of the horizontal scrollbar + * @param ver pointer to store the area of the vertical scrollbar + */ +void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor, lv_area_t * ver); + +/** + * Invalidate the area of the scrollbars + * @param obj pointer to Widget + */ +void lv_obj_scrollbar_invalidate(lv_obj_t * obj); + +/** + * Checks if the content is scrolled "in" and adjusts it to a normal position. + * @param obj pointer to Widget + * @param anim_en LV_ANIM_ON/OFF + */ +void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_SCROLL_H*/ diff --git a/include/lvgl/core/lv_obj_style.h b/include/lvgl/core/lv_obj_style.h new file mode 100644 index 0000000000..e9ad664173 --- /dev/null +++ b/include/lvgl/core/lv_obj_style.h @@ -0,0 +1,443 @@ +/** + * @file lv_obj_style.h + * + */ + +#ifndef LV_OBJ_STYLE_H +#define LV_OBJ_STYLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../font/lv_bidi.h" +#include "lv_style.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Possible states of a widget. + * OR-ed values are possible + */ +typedef enum { + LV_STATE_DEFAULT = 0, + LV_STATE_ALT = 1 << 0, + /*1 reserved*/ + LV_STATE_CHECKED = 1 << 2, + LV_STATE_FOCUSED = 1 << 3, + LV_STATE_FOCUS_KEY = 1 << 4, + LV_STATE_EDITED = 1 << 5, + LV_STATE_HOVERED = 1 << 6, + LV_STATE_PRESSED = 1 << 7, + LV_STATE_SCROLLED = 1 << 8, + LV_STATE_DISABLED = 1 << 9, + /*2 reserved*/ + LV_STATE_USER_1 = 1 << 12, + LV_STATE_USER_2 = 1 << 13, + LV_STATE_USER_3 = 1 << 14, + LV_STATE_USER_4 = 1 << 15, + + LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states*/ +} lv_state_t; + +/** + * The possible parts of widgets. + * The parts can be considered as the internal building block of the widgets. + * E.g. slider = background + indicator + knob + * Not all parts are used by every widget + */ + +typedef enum { + LV_PART_MAIN = 0x000000, /**< A background like rectangle*/ + LV_PART_SCROLLBAR = 0x010000, /**< The scrollbar(s)*/ + LV_PART_INDICATOR = 0x020000, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox*/ + LV_PART_KNOB = 0x030000, /**< Like handle to grab to adjust the value*/ + LV_PART_SELECTED = 0x040000, /**< Indicate the currently selected option or section*/ + LV_PART_ITEMS = 0x050000, /**< Used if the widget has multiple similar elements (e.g. table cells)*/ + LV_PART_CURSOR = 0x060000, /**< Mark a specific place e.g. for text area's cursor or on a chart*/ + + LV_PART_CUSTOM_FIRST = 0x080000, /**< Extension point for custom widgets*/ + + LV_PART_ANY = 0x0F0000, /**< Special value can be used in some functions to target all parts*/ +} lv_part_t; + +typedef enum { + LV_STYLE_STATE_CMP_SAME, /**< The style properties in the 2 states are identical */ + LV_STYLE_STATE_CMP_DIFF_REDRAW, /**< The differences can be shown with a simple redraw */ + LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /**< The differences can be shown with a simple redraw */ + LV_STYLE_STATE_CMP_DIFF_LAYOUT, /**< The differences can be shown with a simple redraw */ +} lv_style_state_cmp_t; + +/** + * A joint type for `lv_part_t` and `lv_state_t`. Example values + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRSSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +typedef uint32_t lv_style_selector_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Add a style to an object. + * @param obj pointer to an object + * @param style pointer to a style to add + * @param selector OR-ed value of parts and state to which the style should be added + * + * Examples: + * @code + * lv_obj_add_style(btn, &style_btn, 0); //Default button style + * + * lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED); //Overwrite only some colors to red when pressed + * @endcode + */ +void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector); + +/** + * Replaces a style of an object, preserving the order of the style stack (local styles and transitions are ignored). + * @param obj pointer to an object + * @param old_style pointer to a style to replace. + * @param new_style pointer to a style to replace the old style with. + * @param selector OR-ed values of states and a part to replace only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used + * + * Examples: + * @code + * lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_ANY | LV_STATE_ANY); //Replace a specific style + * + * lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_MAIN | LV_STATE_PRESSED); //Replace a specific style assigned to the main part when it is pressed + * @endcode + */ +bool lv_obj_replace_style(lv_obj_t * obj, const lv_style_t * old_style, const lv_style_t * new_style, + lv_style_selector_t selector); + +/** + * Remove a style from an object. + * @param obj pointer to an object + * @param style pointer to a style to remove. Can be NULL to check only the selector + * @param selector OR-ed values of states and a part to remove only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used + * + * Examples: + * @code + * lv_obj_remove_style(obj, &style, LV_PART_ANY | LV_STATE_ANY); //Remove a specific style + * + * lv_obj_remove_style(obj, NULL, LV_PART_MAIN | LV_STATE_ANY); //Remove all styles from the main part + * + * lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); //Remove all styles + * @endcode + */ +void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector); + + +/** + * Remove all styles added by a theme from a widget + * @param selector OR-ed values of states and a part to remove only styles with matching selectors. + * LV_STATE_ANY and LV_PART_ANY can be used + * @param obj pointer to a widget + */ +void lv_obj_remove_theme(lv_obj_t * obj, lv_style_selector_t selector); + +/** + * Remove all styles from an object + * @param obj pointer to an object + */ +void lv_obj_remove_style_all(lv_obj_t * obj); + +/** + * Notify all object if a style is modified + * @param style pointer to a style. Only the objects with this style will be notified + * (NULL to notify all objects) + */ +void lv_obj_report_style_change(lv_style_t * style); + +/** + * Notify an object and its children about its style is modified. + * @param obj pointer to an object + * @param part the part whose style was changed. E.g. `LV_PART_ANY`, `LV_PART_MAIN` + * @param prop `LV_STYLE_PROP_ANY` or an `LV_STYLE_...` property. + * It is used to optimize what needs to be refreshed. + * `LV_STYLE_PROP_INV` to perform only a style cache update + */ +void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop); + +/** + * Temporary disable a style for a selector. It will look like is the style wasn't added + * @param obj pointer to an object + * @param style pointer to a style + * @param selector the selector of a style (e.g. LV_STATE_PRESSED | LV_PART_KNOB) + * @param dis true: disable the style, false: enable the style + */ +void lv_obj_style_set_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector, bool dis); + +/** + * Get if a given style is disabled on an object. + * @param obj pointer to an object + * @param style pointer to a style + * @param selector the selector of a style (e.g. LV_STATE_PRESSED | LV_PART_KNOB) + * @return true: disable the style, false: enable the style + */ +bool lv_obj_style_get_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector); + +/** + * Enable or disable automatic style refreshing when a new style is added/removed to/from an object + * or any other style change happens. + * @param en true: enable refreshing; false: disable refreshing + */ +void lv_obj_enable_style_refresh(bool en); + +/** + * Get the value of a style property. The current state of the object will be considered. + * Inherited properties will be inherited. + * If a property is not set a default value will be returned. + * @param obj pointer to an object + * @param part a part from which the property should be get + * @param prop the property to get + * @return the value of the property. + * Should be read from the correct field of the `lv_style_value_t` according to the type of the property. + */ +lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop); + +/** + * Check if an object has a specified style property for a given style selector. + * @param obj pointer to an object + * @param selector the style selector to be checked, defining the scope of the style to be examined. + * @param prop the property to be checked. + * @return true if the object has the specified selector and property, false otherwise. + */ +bool lv_obj_has_style_prop(const lv_obj_t * obj, lv_style_selector_t selector, lv_style_prop_t prop); + +/** + * Set local style property on an object's part and state. + * @param obj pointer to an object + * @param prop the property + * @param value value of the property. The correct element should be set according to the type of the property + * @param selector OR-ed value of parts and state for which the style should be set + */ +void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value, + lv_style_selector_t selector); + +lv_style_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value, + lv_style_selector_t selector); + +/** + * Remove a local style property from a part of an object with a given state. + * @param obj pointer to an object + * @param prop a style property to remove. + * @param selector OR-ed value of parts and state for which the style should be removed + * @return true the property was found and removed; false: the property was not found + */ +bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector); + +/** + * Used internally for color filtering + */ +lv_style_value_t lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v); + +/** + * Fade in an an object and all its children. + * @param obj the object to fade in + * @param time time of fade + * @param delay delay to start the animation + */ +void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay); + +/** + * Fade out an an object and all its children. + * @param obj the object to fade out + * @param time time of fade + * @param delay delay to start the animation + */ +void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay); + +static inline lv_state_t lv_obj_style_get_selector_state(lv_style_selector_t selector) +{ + return (lv_state_t)(selector & 0xFFFF); +} + +static inline lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selector) +{ + return (lv_part_t)(selector & 0xFF0000); +} + +#include "lv_obj_style_gen.h" + +static inline void lv_obj_set_style_pad_all(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) +{ + lv_obj_set_style_pad_left(obj, value, selector); + lv_obj_set_style_pad_right(obj, value, selector); + lv_obj_set_style_pad_top(obj, value, selector); + lv_obj_set_style_pad_bottom(obj, value, selector); +} + +static inline void lv_obj_set_style_pad_hor(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) +{ + lv_obj_set_style_pad_left(obj, value, selector); + lv_obj_set_style_pad_right(obj, value, selector); +} + +static inline void lv_obj_set_style_pad_ver(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) +{ + lv_obj_set_style_pad_top(obj, value, selector); + lv_obj_set_style_pad_bottom(obj, value, selector); +} + +static inline void lv_obj_set_style_margin_all(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) +{ + lv_obj_set_style_margin_left(obj, value, selector); + lv_obj_set_style_margin_right(obj, value, selector); + lv_obj_set_style_margin_top(obj, value, selector); + lv_obj_set_style_margin_bottom(obj, value, selector); +} + +static inline void lv_obj_set_style_margin_hor(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) +{ + lv_obj_set_style_margin_left(obj, value, selector); + lv_obj_set_style_margin_right(obj, value, selector); +} + +static inline void lv_obj_set_style_margin_ver(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) +{ + lv_obj_set_style_margin_top(obj, value, selector); + lv_obj_set_style_margin_bottom(obj, value, selector); +} + +static inline void lv_obj_set_style_pad_gap(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) +{ + lv_obj_set_style_pad_row(obj, value, selector); + lv_obj_set_style_pad_column(obj, value, selector); +} + +static inline void lv_obj_set_style_size(lv_obj_t * obj, int32_t width, int32_t height, + lv_style_selector_t selector) +{ + lv_obj_set_style_width(obj, width, selector); + lv_obj_set_style_height(obj, height, selector); +} + +static inline void lv_obj_set_style_transform_scale(lv_obj_t * obj, int32_t value, + lv_style_selector_t selector) +{ + lv_obj_set_style_transform_scale_x(obj, value, selector); + lv_obj_set_style_transform_scale_y(obj, value, selector); +} + +static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, lv_part_t part) +{ + int32_t padding = lv_obj_get_style_pad_left(obj, part); + int32_t border_width = lv_obj_get_style_border_width(obj, part); + lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); + return (border_side & LV_BORDER_SIDE_LEFT) ? padding + border_width : padding; +} + +static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, lv_part_t part) +{ + int32_t padding = lv_obj_get_style_pad_right(obj, part); + int32_t border_width = lv_obj_get_style_border_width(obj, part); + lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); + return (border_side & LV_BORDER_SIDE_RIGHT) ? padding + border_width : padding; +} + +static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, lv_part_t part) +{ + int32_t padding = lv_obj_get_style_pad_top(obj, part); + int32_t border_width = lv_obj_get_style_border_width(obj, part); + lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); + return (border_side & LV_BORDER_SIDE_TOP) ? padding + border_width : padding; +} + +static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, lv_part_t part) +{ + int32_t padding = lv_obj_get_style_pad_bottom(obj, part); + int32_t border_width = lv_obj_get_style_border_width(obj, part); + lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); + return (border_side & LV_BORDER_SIDE_BOTTOM) ? padding + border_width : padding; +} + +lv_text_align_t lv_obj_calculate_style_text_align(const lv_obj_t * obj, lv_part_t part, const char * txt); + +static inline int32_t lv_obj_get_style_transform_scale_x_safe(const lv_obj_t * obj, lv_part_t part) +{ + int32_t scale = lv_obj_get_style_transform_scale_x(obj, part); + return scale > 0 ? scale : 1; +} + +static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * obj, lv_part_t part) +{ + int32_t scale = lv_obj_get_style_transform_scale_y(obj, part); + return scale > 0 ? scale : 1; +} + +/** + * Get the `opa` style property from all parents and multiply and `>> 8` them. + * @param obj the object whose opacity should be get + * @param part the part whose opacity should be get. Non-MAIN parts will consider the `opa` of the MAIN part too + * @return the final opacity considering the parents' opacity too + */ +lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part); + + +/** + * Apply recolor effect to the input color based on the object's style properties. + * @param obj the target object containing recolor style properties + * @param part the part to retrieve recolor styles. + * @param color the original color to be modified + * @return the blended color after applying recolor and opacity + */ +lv_color32_t lv_obj_style_apply_recolor(const lv_obj_t * obj, lv_part_t part, lv_color32_t color); + +/** + * Get the `recolor` style property from all parents and blend them recursively. + * @param obj the object whose recolor value should be retrieved + * @param part the target part to check. Non-MAIN parts will also consider + * the `recolor` value from the MAIN part during calculation + * @return the final blended recolor value combining all parent's recolor values + */ +lv_color32_t lv_obj_get_style_recolor_recursive(const lv_obj_t * obj, lv_part_t part); + +#if LV_USE_OBSERVER +/** + * Disable a style if a subject's value is not equal to a reference value + * @param obj pointer to Widget + * @param style pointer to a style + * @param selector pointer to a selector + * @param subject pointer to Subject + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector, + lv_subject_t * subject, int32_t ref_value); + +/** + * Connect a subject's value to a style property of a widget. + * @param obj pointer to a Widget + * @param prop a style property + * @param selector a selector for which the property should be added, e.g. `LV_PART_KNOB | LV_STATE_PRESSED` + * @param subject pointer a Subject to which value the property should be bound + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector, + lv_subject_t * subject); + +#endif + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_STYLE_H*/ diff --git a/include/lvgl/core/lv_obj_style_gen.h b/include/lvgl/core/lv_obj_style_gen.h new file mode 100644 index 0000000000..bfe9a47636 --- /dev/null +++ b/include/lvgl/core/lv_obj_style_gen.h @@ -0,0 +1,3601 @@ +/* + * @file + * + ********************************************************************** + * DO NOT EDIT + * This file is automatically generated by "style_api_gen.py" + ********************************************************************** + */ + + +#ifndef LV_OBJ_STYLE_GEN_H +#define LV_OBJ_STYLE_GEN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "lv_area.h" +#include "lv_style.h" +#include "lv_obj_style.h" +#include "../lv_types.h" + +/** + * Gets width of Widget. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. + * Percentage values are relative to the width of the parent's content area. + * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_WIDTH); + return (int32_t)v.num; +} + +/** + * Gets a minimal width. Pixel and percentage values can be used. Percentage values + * are relative to the width of the parent's content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_min_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_WIDTH); + return (int32_t)v.num; +} + +/** + * Gets a maximal width. Pixel and percentage values can be used. Percentage values + * are relative to the width of the parent's content area. + * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_max_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_WIDTH); + return (int32_t)v.num; +} + +/** + * Gets height of Widget. Pixel, percentage and `LV_SIZE_CONTENT` can be used. + * Percentage values are relative to the height of the parent's content area. + * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_height(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_HEIGHT); + return (int32_t)v.num; +} + +/** + * Gets a minimal height. Pixel and percentage values can be used. Percentage values + * are relative to the height of the parent's content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_min_height(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_HEIGHT); + return (int32_t)v.num; +} + +/** + * Gets a maximal height. Pixel and percentage values can be used. Percentage values + * are relative to the height of the parent's content area. + * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_max_height(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_HEIGHT); + return (int32_t)v.num; +} + +/** + * Its meaning depends on the type of Widget. For example in case of lv_scale it means + * the length of the ticks. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_length(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LENGTH); + return (int32_t)v.num; +} + +/** + * Get X coordinate of Widget considering the ``align`` setting. Pixel and percentage + * values can be used. Percentage values are relative to the width of the parent's + * content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_x(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_X); + return (int32_t)v.num; +} + +/** + * Get Y coordinate of Widget considering the ``align`` setting. Pixel and percentage + * values can be used. Percentage values are relative to the height of the parent's + * content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_y(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_Y); + return (int32_t)v.num; +} + +/** + * Get the alignment which tells from which point of the parent the X and Y + * coordinates should be interpreted. Possible values are: `LV_ALIGN_DEFAULT`, + * `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, + * `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means + * `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base + * direction. + * Default: `LV_ALIGN_DEFAULT`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_align_t lv_obj_get_style_align(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ALIGN); + return (lv_align_t)v.num; +} + +/** + * Make Widget wider on both sides with this value. Pixel and percentage (with + * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's width. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_transform_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH); + return (int32_t)v.num; +} + +/** + * Make Widget higher on both sides with this value. Pixel and percentage (with + * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's height. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_transform_height(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT); + return (int32_t)v.num; +} + +/** + * Move Widget with this value in X direction. Applied after layouts, aligns and other + * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage + * values are relative to Widget's width. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_translate_x(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_X); + return (int32_t)v.num; +} + +/** + * Move Widget with this value in Y direction. Applied after layouts, aligns and other + * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage + * values are relative to Widget's height. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_translate_y(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_Y); + return (int32_t)v.num; +} + +/** + * Move object around the centre of the parent object (e.g. around the circumference + * of a scale). + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_translate_radial(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_RADIAL); + return (int32_t)v.num; +} + +/** + * Zoom Widget horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 + * half size, 512 double size, and so on. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_transform_scale_x(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_X); + return (int32_t)v.num; +} + +/** + * Zoom Widget vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 + * half size, 512 double size, and so on. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_transform_scale_y(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_Y); + return (int32_t)v.num; +} + +/** + * Rotate Widget. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_transform_rotation(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ROTATION); + return (int32_t)v.num; +} + +/** + * Get pivot point's X coordinate for transformations. Relative to Widget's top left corner. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_transform_pivot_x(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_X); + return (int32_t)v.num; +} + +/** + * Get pivot point's Y coordinate for transformations. Relative to Widget's top left corner. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_transform_pivot_y(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_Y); + return (int32_t)v.num; +} + +/** + * Skew Widget horizontally. The value is interpreted in 0.1 degree units. E.g. 450 + * means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_transform_skew_x(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_X); + return (int32_t)v.num; +} + +/** + * Skew Widget vertically. The value is interpreted in 0.1 degree units. E.g. 450 + * means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_transform_skew_y(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_Y); + return (int32_t)v.num; +} + +/** + * Gets the padding on the top. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_pad_top(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP); + return (int32_t)v.num; +} + +/** + * Gets the padding on the bottom. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_pad_bottom(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_BOTTOM); + return (int32_t)v.num; +} + +/** + * Gets the padding on the left. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_pad_left(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_LEFT); + return (int32_t)v.num; +} + +/** + * Gets the padding on the right. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_pad_right(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RIGHT); + return (int32_t)v.num; +} + +/** + * Gets the padding between the rows. Used by the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_pad_row(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_ROW); + return (int32_t)v.num; +} + +/** + * Gets the padding between the columns. Used by the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_pad_column(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_COLUMN); + return (int32_t)v.num; +} + +/** + * Pad text labels away from the scale ticks/remainder of the ``LV_PART_``. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_pad_radial(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RADIAL); + return (int32_t)v.num; +} + +/** + * Gets margin on the top. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_margin_top(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_TOP); + return (int32_t)v.num; +} + +/** + * Gets margin on the bottom. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_margin_bottom(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_BOTTOM); + return (int32_t)v.num; +} + +/** + * Gets margin on the left. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_margin_left(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_LEFT); + return (int32_t)v.num; +} + +/** + * Gets margin on the right. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_margin_right(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_RIGHT); + return (int32_t)v.num; +} + +/** + * Get background color of Widget. + * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_bg_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR); + return v.color; +} + +/** + * Get background color of Widget. + * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_bg_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR)); + return v.color; +} + +/** + * Get opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_bg_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR); + return v.color; +} + +/** + * Get gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR)); + return v.color; +} + +/** + * Get direction of the gradient of the background. Possible values are + * `LV_GRAD_DIR_NONE/HOR/VER`. + * Default: `LV_GRAD_DIR_NONE`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_DIR); + return (lv_grad_dir_t)v.num; +} + +/** + * Get point from which background color should start for gradients. 0 means to + * top/left side, 255 the bottom/right side, 128 the center, and so on. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_bg_main_stop(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_STOP); + return (int32_t)v.num; +} + +/** + * Get point from which background's gradient color should start. 0 means to top/left + * side, 255 the bottom/right side, 128 the center, and so on. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_bg_grad_stop(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_STOP); + return (int32_t)v.num; +} + +/** + * Get opacity of the first gradient color. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_bg_main_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get opacity of the second gradient color. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_bg_grad_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get gradient definition. The pointed instance must exist while Widget is alive. + * NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and + * `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors + * as well. If it's set other gradient related properties will be ignored. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD); + return (const lv_grad_dsc_t *)v.ptr; +} + +/** + * Get a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or + * an `LV_SYMBOL_...`. + * Default: `NULL`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const void * lv_obj_get_style_bg_image_src(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_SRC); + return (const void *)v.ptr; +} + +/** + * Get opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means + * fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other + * values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_bg_image_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get a color to mix to the background image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR); + return v.color; +} + +/** + * Get a color to mix to the background image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR)); + return v.color; +} + +/** + * Get intensity of background image recoloring. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full + * recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted + * proportionally. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_bg_image_recolor_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR_OPA); + return (lv_opa_t)v.num; +} + +/** + * If enabled the background image will be tiled. Possible values are `true` or `false`. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline bool lv_obj_get_style_bg_image_tiled(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_TILED); + return (bool)v.num; +} + +/** + * Get color of the border. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR); + return v.color; +} + +/** + * Get color of the border. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR)); + return v.color; +} + +/** + * Get opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_border_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get width of the border. Only pixel values can be used. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_border_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_WIDTH); + return (int32_t)v.num; +} + +/** + * Get only which side(s) the border should be drawn. Possible values are + * `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as + * well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`. + * Default: `LV_BORDER_SIDE_FULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_border_side_t lv_obj_get_style_border_side(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_SIDE); + return (lv_border_side_t)v.num; +} + +/** + * Gets whether the border should be drawn before or after the children are drawn. + * `true`: after children, `false`: before children. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline bool lv_obj_get_style_border_post(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_POST); + return (bool)v.num; +} + +/** + * Get width of outline in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_outline_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_WIDTH); + return (int32_t)v.num; +} + +/** + * Get color of outline. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR); + return v.color; +} + +/** + * Get color of outline. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR)); + return v.color; +} + +/** + * Get opacity of outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_outline_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get padding of outline, i.e. the gap between Widget and the outline. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_outline_pad(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_PAD); + return (int32_t)v.num; +} + +/** + * Get width of the shadow in pixels. The value should be >= 0. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_shadow_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_WIDTH); + return (int32_t)v.num; +} + +/** + * Get an offset on the shadow in pixels in X direction. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_shadow_offset_x(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_X); + return (int32_t)v.num; +} + +/** + * Get an offset on the shadow in pixels in Y direction. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_shadow_offset_y(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_Y); + return (int32_t)v.num; +} + +/** + * Make shadow calculation to use a larger or smaller rectangle as base. The value can + * be in pixels to make the area larger/smaller. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_shadow_spread(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_SPREAD); + return (int32_t)v.num; +} + +/** + * Get color of shadow. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR); + return v.color; +} + +/** + * Get color of shadow. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR)); + return v.color; +} + +/** + * Get opacity of shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_shadow_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_image_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get color to mix with the image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR); + return v.color; +} + +/** + * Get color to mix with the image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR)); + return v.color; +} + +/** + * Get intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get image colorkey definition. The lv_image_colorkey_t contains two color values: + * `high_color` and `low_color`. the color of pixels ranging from `low_color` to + * `high_color` will be transparent. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const lv_image_colorkey_t * lv_obj_get_style_image_colorkey(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_COLORKEY); + return (const lv_image_colorkey_t *)v.ptr; +} + +/** + * Get width of lines in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_line_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_WIDTH); + return (int32_t)v.num; +} + +/** + * Get width of dashes in pixels. Note that dash works only on horizontal and vertical lines. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_line_dash_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_WIDTH); + return (int32_t)v.num; +} + +/** + * Get gap between dashes in pixels. Note that dash works only on horizontal and + * vertical lines. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_line_dash_gap(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_GAP); + return (int32_t)v.num; +} + +/** + * Make end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline bool lv_obj_get_style_line_rounded(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_ROUNDED); + return (bool)v.num; +} + +/** + * Get color of lines. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_line_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR); + return v.color; +} + +/** + * Get color of lines. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_line_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR)); + return v.color; +} + +/** + * Get opacity of lines. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_line_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get width (thickness) of arcs in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_arc_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_WIDTH); + return (int32_t)v.num; +} + +/** + * Make end points of arcs rounded. `true`: rounded, `false`: perpendicular line ending. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline bool lv_obj_get_style_arc_rounded(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_ROUNDED); + return (bool)v.num; +} + +/** + * Get color of arc. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_arc_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR); + return v.color; +} + +/** + * Get color of arc. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_arc_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR)); + return v.color; +} + +/** + * Get opacity of arcs. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_arc_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get an image from which arc will be masked out. It's useful to display complex + * effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const void * lv_obj_get_style_arc_image_src(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_IMAGE_SRC); + return (const void *)v.ptr; +} + +/** + * Gets color of text. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_text_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR); + return v.color; +} + +/** + * Gets color of text. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_text_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR)); + return v.color; +} + +/** + * Get opacity of text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_text_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get font of text (a pointer `lv_font_t *`). + * Default: `LV_FONT_DEFAULT`, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const lv_font_t * lv_obj_get_style_text_font(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_FONT); + return (const lv_font_t *)v.ptr; +} + +/** + * Get letter space in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_text_letter_space(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE); + return (int32_t)v.num; +} + +/** + * Get line space in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_text_line_space(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE); + return (int32_t)v.num; +} + +/** + * Get decoration for the text. Possible values are + * `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well. + * Default: `LV_TEXT_DECOR_NONE`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_text_decor_t lv_obj_get_style_text_decor(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_DECOR); + return (lv_text_decor_t)v.num; +} + +/** + * Get how to align the lines of the text. Note that it doesn't align the Widget + * itself, only the lines inside the Widget. Possible values are + * `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base + * direction and uses left or right alignment accordingly. + * Default: `LV_TEXT_ALIGN_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_text_align_t lv_obj_get_style_text_align(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_ALIGN); + return (lv_text_align_t)v.num; +} + +/** + * Gets the color of letter outline stroke. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_text_outline_stroke_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OUTLINE_STROKE_COLOR); + return v.color; +} + +/** + * Gets the color of letter outline stroke. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_text_outline_stroke_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OUTLINE_STROKE_COLOR)); + return v.color; +} + +/** + * Get the letter outline stroke width in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_text_outline_stroke_width(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OUTLINE_STROKE_WIDTH); + return (int32_t)v.num; +} + +/** + * Get the opacity of the letter outline stroke. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means + * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_text_outline_stroke_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OUTLINE_STROKE_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get the text leading trim mode. Removes empty space above and/or below text based + * on font metrics (cap-height, x-height, baseline). Similar to CSS `text-box-trim`. + * Possible values are `LV_TEXT_LEADING_TRIM_NONE/CAPITAL_BASELINE/LOWER_BASELINE/CAPITAL/LOWER`. + * Default: `LV_TEXT_LEADING_TRIM_NONE`, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_text_leading_trim_t lv_obj_get_style_text_leading_trim(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LEADING_TRIM); + return (lv_text_leading_trim_t)v.num; +} + +/** + * Gets the intensity of blurring. Applied on each lv_part separately before the + * children are rendered. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_blur_radius(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLUR_RADIUS); + return (int32_t)v.num; +} + +/** + * If `true` the background of the widget will be blurred. The part should have < 100% + * opacity to make it visible. If `false` the given part will be blurred when it's + * rendered but before drawing the children. + * Default: `false`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline bool lv_obj_get_style_blur_backdrop(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLUR_BACKDROP); + return (bool)v.num; +} + +/** + * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over + * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower + * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. + * Default: `LV_BLUR_QUALITY_AUTO`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_blur_quality_t lv_obj_get_style_blur_quality(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLUR_QUALITY); + return (lv_blur_quality_t)v.num; +} + +/** + * Gets the intensity of blurring. Applied on each lv_part separately before the + * children are rendered. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_drop_shadow_radius(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_RADIUS); + return (int32_t)v.num; +} + +/** + * Get an offset on the shadow in pixels in X direction. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_drop_shadow_offset_x(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_OFFSET_X); + return (int32_t)v.num; +} + +/** + * Get an offset on the shadow in pixels in Y direction. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_drop_shadow_offset_y(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_OFFSET_Y); + return (int32_t)v.num; +} + +/** + * Get the color of the shadow. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_drop_shadow_color(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_COLOR); + return v.color; +} + +/** + * Get the color of the shadow. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_drop_shadow_color_filtered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_COLOR)); + return v.color; +} + +/** + * Get the opacity of the shadow. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_drop_shadow_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_OPA); + return (lv_opa_t)v.num; +} + +/** + * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over + * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower + * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. + * Default: `LV_BLUR_QUALITY_PRECISION`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_blur_quality_t lv_obj_get_style_drop_shadow_quality(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_QUALITY); + return (lv_blur_quality_t)v.num; +} + +/** + * Get radius on every corner. The value is interpreted in pixels (>= 0) or + * `LV_RADIUS_CIRCLE` for max radius. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_radius(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS); + return (int32_t)v.num; +} + +/** + * Move start point of object (e.g. scale tick) radially. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_radial_offset(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIAL_OFFSET); + return (int32_t)v.num; +} + +/** + * Enable clipping of content that overflows rounded corners of parent Widget. Can be + * `true` or `false`. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline bool lv_obj_get_style_clip_corner(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CLIP_CORNER); + return (bool)v.num; +} + +/** + * Scale down all opacity values of the Widget by this factor. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means + * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA); + return (lv_opa_t)v.num; +} + +/** + * First draw Widget on the layer, then scale down layer opacity factor. Value 0, + * `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or + * `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc + * means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_opa_layered(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA_LAYERED); + return (lv_opa_t)v.num; +} + +/** + * Mix a color with all colors of the Widget. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC); + return (const lv_color_filter_dsc_t *)v.ptr; +} + +/** + * The intensity of mixing of color filter. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_color_filter_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_OPA); + return (lv_opa_t)v.num; +} + +/** + * Get a color to mix to the obj. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_color_t lv_obj_get_style_recolor(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RECOLOR); + return v.color; +} + +/** + * Gets the intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means + * fully transparent. A value of 255, `LV_OPA_100` or `LV_OPA_COVER` means fully + * opaque. Intermediate values like LV_OPA_10, LV_OPA_20, etc result in + * semi-transparency. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_opa_t lv_obj_get_style_recolor_opa(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RECOLOR_OPA); + return (lv_opa_t)v.num; +} + +/** + * Animation template for Widget's animation. Should be a pointer to `lv_anim_t`. The + * animation parameters are widget specific, e.g. animation time could be the E.g. + * blink time of the cursor on the Text Area or scroll time of a roller. See Widgets' + * documentation to learn more. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const lv_anim_t * lv_obj_get_style_anim(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM); + return (const lv_anim_t *)v.ptr; +} + +/** + * Animation duration in milliseconds. Its meaning is widget specific. E.g. blink time + * of the cursor on the Text Area or scroll time of a roller. See Widgets' + * documentation to learn more. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline uint32_t lv_obj_get_style_anim_duration(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_DURATION); + return (uint32_t)v.num; +} + +/** + * An initialized ``lv_style_transition_dsc_t`` to describe a transition. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION); + return (const lv_style_transition_dsc_t *)v.ptr; +} + +/** + * Describes how to blend the colors to the background. Possible values are + * `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY/DIFFERENCE`. + * Default: `LV_BLEND_MODE_NORMAL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLEND_MODE); + return (lv_blend_mode_t)v.num; +} + +/** + * Get layout of Widget. Children will be repositioned and resized according to + * policies set for the layout. For possible values see documentation of the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline uint16_t lv_obj_get_style_layout(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LAYOUT); + return (uint16_t)v.num; +} + +/** + * Get base direction of Widget. Possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`. + * Default: `LV_BASE_DIR_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BASE_DIR); + return (lv_base_dir_t)v.num; +} + +/** + * If set, a layer will be created for the widget and the layer will be masked with + * this A8 bitmap mask. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const void * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BITMAP_MASK_SRC); + return (const void *)v.ptr; +} + +/** + * Adjust sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the + * rotary to half, 512: speeds up to double, 256: no change. + * Default: `256`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline uint32_t lv_obj_get_style_rotary_sensitivity(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ROTARY_SENSITIVITY); + return (uint32_t)v.num; +} + +#if LV_USE_FLEX +/** + * Defines in which direction the flex layout should arrange the children. + * Default: `LV_FLEX_FLOW_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_FLOW); + return (lv_flex_flow_t)v.num; +} + +/** + * Defines how to align the children in the direction of flex flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_MAIN_PLACE); + return (lv_flex_align_t)v.num; +} + +/** + * Defines how to align the children perpendicular to the direction of flex flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_CROSS_PLACE); + return (lv_flex_align_t)v.num; +} + +/** + * Defines how to align the tracks of the flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_TRACK_PLACE); + return (lv_flex_align_t)v.num; +} + +/** + * Defines how much space to take proportionally from the free space of the Widget's track. + * Default: `0`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_GROW); + return (uint8_t)v.num; +} + +#endif /* LV_USE_FLEX */ + +#if LV_USE_GRID +/** + * An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. + * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY); + return (const int32_t *)v.ptr; +} + +/** + * Defines how to distribute the columns. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_ALIGN); + return (lv_grid_align_t)v.num; +} + +/** + * An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. + * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline const int32_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_DSC_ARRAY); + return (const int32_t *)v.ptr; +} + +/** + * Defines how to distribute the rows. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_ALIGN); + return (lv_grid_align_t)v.num; +} + +/** + * Get column in which Widget should be placed. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_POS); + return (int32_t)v.num; +} + +/** + * Get how to align Widget horizontally. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_X_ALIGN); + return (lv_grid_align_t)v.num; +} + +/** + * Get how many columns Widget should span. Needs to be >= 1. + * Default: 1, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_SPAN); + return (int32_t)v.num; +} + +/** + * Get row in which Widget should be placed. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS); + return (int32_t)v.num; +} + +/** + * Get how to align Widget vertically. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_Y_ALIGN); + return (lv_grid_align_t)v.num; +} + +/** + * Get how many rows Widget should span. Needs to be >= 1. + * Default: 1, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param part One of the `LV_PART_...` enum values + */ +static inline int32_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, lv_part_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_SPAN); + return (int32_t)v.num; +} + +#endif /* LV_USE_GRID */ + +/** + * Sets width of Widget. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. + * Percentage values are relative to the width of the parent's content area. + * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets a minimal width. Pixel and percentage values can be used. Percentage values + * are relative to the width of the parent's content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_min_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets a maximal width. Pixel and percentage values can be used. Percentage values + * are relative to the width of the parent's content area. + * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_max_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets height of Widget. Pixel, percentage and `LV_SIZE_CONTENT` can be used. + * Percentage values are relative to the height of the parent's content area. + * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_height(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets a minimal height. Pixel and percentage values can be used. Percentage values + * are relative to the height of the parent's content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_min_height(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets a maximal height. Pixel and percentage values can be used. Percentage values + * are relative to the height of the parent's content area. + * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_max_height(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Its meaning depends on the type of Widget. For example in case of lv_scale it means + * the length of the ticks. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_length(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set X coordinate of Widget considering the ``align`` setting. Pixel and percentage + * values can be used. Percentage values are relative to the width of the parent's + * content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set Y coordinate of Widget considering the ``align`` setting. Pixel and percentage + * values can be used. Percentage values are relative to the height of the parent's + * content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set the alignment which tells from which point of the parent the X and Y + * coordinates should be interpreted. Possible values are: `LV_ALIGN_DEFAULT`, + * `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, + * `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means + * `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base + * direction. + * Default: `LV_ALIGN_DEFAULT`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_align(lv_obj_t * obj, lv_align_t value, lv_style_selector_t selector); + +/** + * Make Widget wider on both sides with this value. Pixel and percentage (with + * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's width. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transform_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Make Widget higher on both sides with this value. Pixel and percentage (with + * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's height. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transform_height(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Move Widget with this value in X direction. Applied after layouts, aligns and other + * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage + * values are relative to Widget's width. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_translate_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Move Widget with this value in Y direction. Applied after layouts, aligns and other + * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage + * values are relative to Widget's height. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_translate_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Move object around the centre of the parent object (e.g. around the circumference + * of a scale). + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_translate_radial(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Zoom Widget horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 + * half size, 512 double size, and so on. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transform_scale_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Zoom Widget vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 + * half size, 512 double size, and so on. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transform_scale_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Rotate Widget. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transform_rotation(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set pivot point's X coordinate for transformations. Relative to Widget's top left corner. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transform_pivot_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set pivot point's Y coordinate for transformations. Relative to Widget's top left corner. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transform_pivot_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Skew Widget horizontally. The value is interpreted in 0.1 degree units. E.g. 450 + * means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transform_skew_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Skew Widget vertically. The value is interpreted in 0.1 degree units. E.g. 450 + * means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transform_skew_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets the padding on the top. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_pad_top(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets the padding on the bottom. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_pad_bottom(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets the padding on the left. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_pad_left(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets the padding on the right. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_pad_right(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets the padding between the rows. Used by the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_pad_row(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets the padding between the columns. Used by the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_pad_column(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Pad text labels away from the scale ticks/remainder of the ``LV_PART_``. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_pad_radial(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets margin on the top. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_margin_top(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets margin on the bottom. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_margin_bottom(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets margin on the left. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_margin_left(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Sets margin on the right. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_margin_right(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set background color of Widget. + * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_grad_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set direction of the gradient of the background. Possible values are + * `LV_GRAD_DIR_NONE/HOR/VER`. + * Default: `LV_GRAD_DIR_NONE`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_grad_dir(lv_obj_t * obj, lv_grad_dir_t value, lv_style_selector_t selector); + +/** + * Set point from which background color should start for gradients. 0 means to + * top/left side, 255 the bottom/right side, 128 the center, and so on. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_main_stop(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set point from which background's gradient color should start. 0 means to top/left + * side, 255 the bottom/right side, 128 the center, and so on. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_grad_stop(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set opacity of the first gradient color. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_main_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set opacity of the second gradient color. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_grad_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set gradient definition. The pointed instance must exist while Widget is alive. + * NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and + * `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors + * as well. If it's set other gradient related properties will be ignored. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to gradient descriptor + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_grad(lv_obj_t * obj, const lv_grad_dsc_t * value, lv_style_selector_t selector); + +/** + * Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or + * an `LV_SYMBOL_...`. + * Default: `NULL`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Pointer to image source + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_image_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector); + +/** + * Set opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means + * fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other + * values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_image_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set a color to mix to the background image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_image_recolor(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set intensity of background image recoloring. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full + * recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted + * proportionally. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_image_recolor_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * If enabled the background image will be tiled. Possible values are `true` or `false`. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bg_image_tiled(lv_obj_t * obj, bool value, lv_style_selector_t selector); + +/** + * Set color of the border. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_border_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_border_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set width of the border. Only pixel values can be used. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_border_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set only which side(s) the border should be drawn. Possible values are + * `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as + * well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`. + * Default: `LV_BORDER_SIDE_FULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_border_side(lv_obj_t * obj, lv_border_side_t value, lv_style_selector_t selector); + +/** + * Sets whether the border should be drawn before or after the children are drawn. + * `true`: after children, `false`: before children. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_border_post(lv_obj_t * obj, bool value, lv_style_selector_t selector); + +/** + * Set width of outline in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_outline_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set color of outline. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_outline_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set opacity of outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_outline_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set padding of outline, i.e. the gap between Widget and the outline. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_outline_pad(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set width of the shadow in pixels. The value should be >= 0. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_shadow_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set an offset on the shadow in pixels in X direction. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_shadow_offset_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set an offset on the shadow in pixels in Y direction. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_shadow_offset_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Make shadow calculation to use a larger or smaller rectangle as base. The value can + * be in pixels to make the area larger/smaller. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_shadow_spread(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set color of shadow. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_shadow_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set opacity of shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_shadow_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_image_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set color to mix with the image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_image_recolor(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_image_recolor_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set image colorkey definition. The lv_image_colorkey_t contains two color values: + * `high_color` and `low_color`. the color of pixels ranging from `low_color` to + * `high_color` will be transparent. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to image color key + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_image_colorkey(lv_obj_t * obj, const lv_image_colorkey_t * value, lv_style_selector_t selector); + +/** + * Set width of lines in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_line_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set width of dashes in pixels. Note that dash works only on horizontal and vertical lines. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_line_dash_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set gap between dashes in pixels. Note that dash works only on horizontal and + * vertical lines. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_line_dash_gap(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Make end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_line_rounded(lv_obj_t * obj, bool value, lv_style_selector_t selector); + +/** + * Set color of lines. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_line_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set opacity of lines. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_line_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set width (thickness) of arcs in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_arc_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Make end points of arcs rounded. `true`: rounded, `false`: perpendicular line ending. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_arc_rounded(lv_obj_t * obj, bool value, lv_style_selector_t selector); + +/** + * Set color of arc. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_arc_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set opacity of arcs. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_arc_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set an image from which arc will be masked out. It's useful to display complex + * effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to image source + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_arc_image_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector); + +/** + * Sets color of text. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set opacity of text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set font of text (a pointer `lv_font_t *`). + * Default: `LV_FONT_DEFAULT`, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to font + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_font(lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector); + +/** + * Set letter space in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_letter_space(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set line space in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_line_space(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set decoration for the text. Possible values are + * `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well. + * Default: `LV_TEXT_DECOR_NONE`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_decor(lv_obj_t * obj, lv_text_decor_t value, lv_style_selector_t selector); + +/** + * Set how to align the lines of the text. Note that it doesn't align the Widget + * itself, only the lines inside the Widget. Possible values are + * `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base + * direction and uses left or right alignment accordingly. + * Default: `LV_TEXT_ALIGN_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_align(lv_obj_t * obj, lv_text_align_t value, lv_style_selector_t selector); + +/** + * Sets the color of letter outline stroke. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_outline_stroke_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set the letter outline stroke width in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_outline_stroke_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set the opacity of the letter outline stroke. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means + * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_outline_stroke_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set the text leading trim mode. Removes empty space above and/or below text based + * on font metrics (cap-height, x-height, baseline). Similar to CSS `text-box-trim`. + * Possible values are `LV_TEXT_LEADING_TRIM_NONE/CAPITAL_BASELINE/LOWER_BASELINE/CAPITAL/LOWER`. + * Default: `LV_TEXT_LEADING_TRIM_NONE`, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_text_leading_trim(lv_obj_t * obj, lv_text_leading_trim_t value, lv_style_selector_t selector); + +/** + * Sets the intensity of blurring. Applied on each lv_part separately before the + * children are rendered. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_blur_radius(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * If `true` the background of the widget will be blurred. The part should have < 100% + * opacity to make it visible. If `false` the given part will be blurred when it's + * rendered but before drawing the children. + * Default: `false`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_blur_backdrop(lv_obj_t * obj, bool value, lv_style_selector_t selector); + +/** + * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over + * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower + * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. + * Default: `LV_BLUR_QUALITY_AUTO`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_blur_quality(lv_obj_t * obj, lv_blur_quality_t value, lv_style_selector_t selector); + +/** + * Sets the intensity of blurring. Applied on each lv_part separately before the + * children are rendered. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_drop_shadow_radius(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set an offset on the shadow in pixels in X direction. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_drop_shadow_offset_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set an offset on the shadow in pixels in Y direction. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_drop_shadow_offset_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set the color of the shadow. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_drop_shadow_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Set the opacity of the shadow. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_drop_shadow_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over + * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower + * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. + * Default: `LV_BLUR_QUALITY_PRECISION`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_drop_shadow_quality(lv_obj_t * obj, lv_blur_quality_t value, lv_style_selector_t selector); + +/** + * Set radius on every corner. The value is interpreted in pixels (>= 0) or + * `LV_RADIUS_CIRCLE` for max radius. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_radius(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Move start point of object (e.g. scale tick) radially. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_radial_offset(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Enable clipping of content that overflows rounded corners of parent Widget. Can be + * `true` or `false`. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_clip_corner(lv_obj_t * obj, bool value, lv_style_selector_t selector); + +/** + * Scale down all opacity values of the Widget by this factor. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means + * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * First draw Widget on the layer, then scale down layer opacity factor. Value 0, + * `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or + * `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc + * means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_opa_layered(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Mix a color with all colors of the Widget. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to color-filter descriptor + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector); + +/** + * The intensity of mixing of color filter. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_color_filter_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Set a color to mix to the obj. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Color to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_recolor(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); + +/** + * Sets the intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means + * fully transparent. A value of 255, `LV_OPA_100` or `LV_OPA_COVER` means fully + * opaque. Intermediate values like LV_OPA_10, LV_OPA_20, etc result in + * semi-transparency. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_recolor_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); + +/** + * Animation template for Widget's animation. Should be a pointer to `lv_anim_t`. The + * animation parameters are widget specific, e.g. animation time could be the E.g. + * blink time of the cursor on the Text Area or scroll time of a roller. See Widgets' + * documentation to learn more. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to animation descriptor + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_anim(lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector); + +/** + * Animation duration in milliseconds. Its meaning is widget specific. E.g. blink time + * of the cursor on the Text Area or scroll time of a roller. See Widgets' + * documentation to learn more. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_anim_duration(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector); + +/** + * An initialized ``lv_style_transition_dsc_t`` to describe a transition. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to transition descriptor + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_transition(lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector); + +/** + * Describes how to blend the colors to the background. Possible values are + * `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY/DIFFERENCE`. + * Default: `LV_BLEND_MODE_NORMAL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_blend_mode(lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector); + +/** + * Set layout of Widget. Children will be repositioned and resized according to + * policies set for the layout. For possible values see documentation of the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_layout(lv_obj_t * obj, uint16_t value, lv_style_selector_t selector); + +/** + * Set base direction of Widget. Possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`. + * Default: `LV_BASE_DIR_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_base_dir(lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector); + +/** + * If set, a layer will be created for the widget and the layer will be masked with + * this A8 bitmap mask. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to A8 bitmap mask + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector); + +/** + * Adjust sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the + * rotary to half, 512: speeds up to double, 256: no change. + * Default: `256`, inherited: Yes, layout: No, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_rotary_sensitivity(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector); + +#if LV_USE_FLEX +/** + * Defines in which direction the flex layout should arrange the children. + * Default: `LV_FLEX_FLOW_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector); + +/** + * Defines how to align the children in the direction of flex flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); + +/** + * Defines how to align the children perpendicular to the direction of flex flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); + +/** + * Defines how to align the tracks of the flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); + +/** + * Defines how much space to take proportionally from the free space of the Widget's track. + * Default: `0`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_flex_grow(lv_obj_t * obj, uint8_t value, lv_style_selector_t selector); + +#endif /* LV_USE_FLEX */ + +#if LV_USE_GRID +/** + * An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. + * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to grid-column descriptor array + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector); + +/** + * Defines how to distribute the columns. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_column_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); + +/** + * An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. + * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Pointer to grid-row descriptor array + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector); + +/** + * Defines how to distribute the rows. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_row_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); + +/** + * Set column in which Widget should be placed. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_cell_column_pos(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set how to align Widget horizontally. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_cell_x_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); + +/** + * Set how many columns Widget should span. Needs to be >= 1. + * Default: 1, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set row in which Widget should be placed. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_cell_row_pos(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +/** + * Set how to align Widget vertically. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_cell_y_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); + +/** + * Set how many rows Widget should span. Needs to be >= 1. + * Default: 1, inherited: No, layout: Yes, ext. draw: No. + * @param obj Pointer to Widget + * @param value Value to submit + * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: + * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` + * - `LV_STATE_PRESSED` + * - `LV_PART_KNOB` + * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` + */ +void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); + +#endif /* LV_USE_GRID */ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_OBJ_STYLE_GEN_H */ diff --git a/include/lvgl/core/lv_obj_tree.h b/include/lvgl/core/lv_obj_tree.h new file mode 100644 index 0000000000..8f5457684a --- /dev/null +++ b/include/lvgl/core/lv_obj_tree.h @@ -0,0 +1,321 @@ +/** + * @file lv_obj_tree.h + * + */ + +#ifndef LV_OBJ_TREE_H +#define LV_OBJ_TREE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" +#include "lv_anim.h" +#include "../display/lv_display.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_OBJ_TREE_WALK_NEXT, + LV_OBJ_TREE_WALK_SKIP_CHILDREN, + LV_OBJ_TREE_WALK_END, +} lv_obj_tree_walk_res_t; + +typedef lv_obj_tree_walk_res_t (*lv_obj_tree_walk_cb_t)(lv_obj_t *, void *); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Delete an object and all of its children. + * Also remove the objects from their group and remove all animations (if any). + * Send `LV_EVENT_DELETE` to deleted objects. + * @param obj pointer to an object + */ +void lv_obj_delete(lv_obj_t * obj); + +/** + * Delete all children of an object. + * Also remove the objects from their group and remove all animations (if any). + * Send `LV_EVENT_DELETE` to deleted objects. + * @param obj pointer to an object + */ +void lv_obj_clean(lv_obj_t * obj); + +/** + * Delete an object after some delay + * @param obj pointer to an object + * @param delay_ms time to wait before delete in milliseconds + */ +void lv_obj_delete_delayed(lv_obj_t * obj, uint32_t delay_ms); + +/** + * A function to be easily used in animation ready callback to delete an object when the animation is ready + * @param a pointer to the animation + */ +void lv_obj_delete_anim_completed_cb(lv_anim_t * a); + +/** + * Helper function for asynchronously deleting objects. + * Useful for cases where you can't delete an object directly in an `LV_EVENT_DELETE` handler (i.e. parent). + * @param obj object to delete + * @see lv_async_call + */ +void lv_obj_delete_async(lv_obj_t * obj); + +/** + * Move the parent of an object. The relative coordinates will be kept. + * + * @param obj pointer to an object whose parent needs to be changed + * @param parent pointer to the new parent + */ +void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent); + +/** + * Swap the positions of two objects. + * When used in listboxes, it can be used to sort the listbox items. + * @param obj1 pointer to the first object + * @param obj2 pointer to the second object + */ +void lv_obj_swap(lv_obj_t * obj1, lv_obj_t * obj2); + +/** + * moves the object to the given index in its parent. + * When used in listboxes, it can be used to sort the listbox items. + * @param obj pointer to the object to be moved. + * @param index new index in parent. -1 to count from the back + * @note to move to the background: lv_obj_move_to_index(obj, 0) + * @note to move forward (up): lv_obj_move_to_index(obj, lv_obj_get_index(obj) - 1) + */ +void lv_obj_move_to_index(lv_obj_t * obj, int32_t index); + +/** + * Get the screen of an object + * @param obj pointer to an object + * @return pointer to the object's screen + */ +lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj); + +/** + * Get the display of the object + * @param obj pointer to an object + * @return pointer to the object's display + */ +lv_display_t * lv_obj_get_display(const lv_obj_t * obj); + +/** + * Get the parent of an object + * @param obj pointer to an object + * @return the parent of the object. (NULL if `obj` was a screen) + */ +lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj); + +/** + * Get the child of an object by the child's index. + * @param obj pointer to an object whose child should be get + * @param idx the index of the child. + * 0: the oldest (firstly created) child + * 1: the second oldest + * child count-1: the youngest + * -1: the youngest + * -2: the second youngest + * @return pointer to the child or NULL if the index was invalid + */ +lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, int32_t idx); + +/** + * Get the child of an object by the child's index. Consider the children only with a given type. + * @param obj pointer to an object whose child should be get + * @param idx the index of the child. + * 0: the oldest (firstly created) child + * 1: the second oldest + * child count-1: the youngest + * -1: the youngest + * -2: the second youngest + * @param class_p the type of the children to check + * @return pointer to the child or NULL if the index was invalid + */ +lv_obj_t * lv_obj_get_child_by_type(const lv_obj_t * obj, int32_t idx, + const lv_obj_class_t * class_p); + +/** + * Return a sibling of an object + * @param obj pointer to an object whose sibling should be get + * @param idx 0: `obj` itself + * -1: the first older sibling + * -2: the next older sibling + * 1: the first younger sibling + * 2: the next younger sibling + * etc + * @return pointer to the requested sibling or NULL if there is no such sibling + */ +lv_obj_t * lv_obj_get_sibling(const lv_obj_t * obj, int32_t idx); + +/** + * Return a sibling of an object. Consider the siblings only with a given type. + * @param obj pointer to an object whose sibling should be get + * @param idx 0: `obj` itself + * -1: the first older sibling + * -2: the next older sibling + * 1: the first younger sibling + * 2: the next younger sibling + * etc + * @param class_p the type of the children to check + * @return pointer to the requested sibling or NULL if there is no such sibling + */ +lv_obj_t * lv_obj_get_sibling_by_type(const lv_obj_t * obj, int32_t idx, + const lv_obj_class_t * class_p); + +/** + * Get the number of children + * @param obj pointer to an object + * @return the number of children + */ +uint32_t lv_obj_get_child_count(const lv_obj_t * obj); + +/** + * Get the number of children having a given type. + * @param obj pointer to an object + * @param class_p the type of the children to check + * @return the number of children + */ + +uint32_t lv_obj_get_child_count_by_type(const lv_obj_t * obj, const lv_obj_class_t * class_p); + +#if LV_USE_OBJ_NAME + +/** + * Set a name for a widget. The name will be allocated and freed when the + * widget is deleted or a new name is set. + * @param obj pointer to an object + * @param name the name to set. If set to `NULL` the default "_#" + * name will be used. + * @note If the name ends with a `#`, older siblings with the same name + * will be counted, and the `#` will be replaced by the index of the + * given widget. For example, creating multiple widgets with the name + * "mybtn_#" will result in resolved names like "mybtn_0", "mybtn_1", + * "mybtn_2", etc. The name is resolved when `lv_obj_get_name_resolved` + * is called, so the result reflects the currently existing widgets at + * that time. + */ +void lv_obj_set_name(lv_obj_t * obj, const char * name); + +/** + * Set a name for a widget. Only a pointer will be saved. + * @param obj pointer to an object + * @param name the name to set. If set to `NULL` the default "_#" + * name will be used. + * @note If the name ends with a `#`, older siblings with the same name + * will be counted, and the `#` will be replaced by the index of the + * given widget. For example, creating multiple widgets with the name + * "mybtn_#" will result in resolved names like "mybtn_0", "mybtn_1", + * "mybtn_2", etc. The name is resolved when `lv_obj_get_name_resolved` + * is called, so the result reflects the currently existing widgets at + * that time. + */ +void lv_obj_set_name_static(lv_obj_t * obj, const char * name); + +/** + * Get the set name as it was set. + * @param obj pointer to an object + * @return get the set name or NULL if it wasn't set yet + */ +const char * lv_obj_get_name(const lv_obj_t * obj); + +/** + * Get the set name or craft a name automatically. + * @param obj pointer to an object + * @param buf buffer to store the name + * @param buf_size the size of the buffer in bytes + * @note If the name ends with a `#`, older siblings with the same name + * will be counted, and the `#` will be replaced by the index of the + * given widget. For example, creating multiple widgets with the name + * "mybtn_#" will result in resolved names like "mybtn_0", "mybtn_1", + * "mybtn_2", etc. The name is resolved when `lv_obj_get_name_resolved` + * is called, so the result reflects the currently existing widgets at + * that time. + */ +void lv_obj_get_name_resolved(const lv_obj_t * obj, char buf[], size_t buf_size); + +/** + * Find a child with a given name on a parent. This child doesn't have to be the + * direct child of the parent. First direct children of the parent will be checked, + * and the direct children of the first child, etc. (Breadth-first search). + * + * If the name of a widget was not set a name like "lv_button_1" will + * be created for it using `lv_obj_get_name_resolved`. + * + * @param parent the widget where the search should start + * @return the found widget or NULL if not found. + */ +lv_obj_t * lv_obj_find_by_name(const lv_obj_t * parent, const char * name); + +/** + * Get an object by name. The name can be a path too, for example + * "main_container/lv_button_1/label". + * In this case the first part of the name-path should be the direct child of the parent, + * the second part, should the direct child of first one, etc. + * + * If the name of a widget was not set a name like "lv_button_1" will + * be created for it using `lv_obj_get_name_resolved`. + * + * @param parent the widget where the search should start + * @return the found widget or NULL if not found. + */ +lv_obj_t * lv_obj_get_child_by_name(const lv_obj_t * parent, const char * name_path); + +#endif /*LV_USE_OBJ_NAME*/ + +/** + * Get the index of a child. + * @param obj pointer to an object + * @return the child index of the object. + * E.g. 0: the oldest (firstly created child). + * (-1 if child could not be found or no parent exists) + */ +int32_t lv_obj_get_index(const lv_obj_t * obj); + +/** + * Get the index of a child. Consider the children only with a given type. + * @param obj pointer to an object + * @param class_p the type of the children to check + * @return the child index of the object. + * E.g. 0: the oldest (firstly created child with the given class). + * (-1 if child could not be found or no parent exists) + */ +int32_t lv_obj_get_index_by_type(const lv_obj_t * obj, const lv_obj_class_t * class_p); + +/** + * Iterate through all children of any object. + * @param start_obj start integrating from this object + * @param cb call this callback on the objects + * @param user_data pointer to any user related data (will be passed to `cb`) + */ +void lv_obj_tree_walk(lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void * user_data); + +/** + * Iterate through all children of any object and print their ID. + * @param start_obj start integrating from this object + */ +void lv_obj_dump_tree(lv_obj_t * start_obj); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_TREE_H*/ diff --git a/include/lvgl/core/lv_observer.h b/include/lvgl/core/lv_observer.h new file mode 100644 index 0000000000..9ba89b7be5 --- /dev/null +++ b/include/lvgl/core/lv_observer.h @@ -0,0 +1,623 @@ +/** + * @file lv_observer.h + * + */ + +#ifndef LV_OBSERVER_H +#define LV_OBSERVER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_obj.h" +#include "lv_ext_data.h" +#include "../misc/lv_ll.h" + +#if LV_USE_OBSERVER + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Values for lv_subject_t's `type` field + */ +typedef enum { + LV_SUBJECT_TYPE_INVALID = 0, /**< indicates Subject not initialized yet */ + LV_SUBJECT_TYPE_NONE = 1, /**< a null value like None or NILt */ + LV_SUBJECT_TYPE_INT = 2, /**< an int32_t */ + LV_SUBJECT_TYPE_FLOAT = 3, /**< a float, requires `LV_USE_FLOAT 1` */ + LV_SUBJECT_TYPE_POINTER = 4, /**< a void pointer */ + LV_SUBJECT_TYPE_COLOR = 5, /**< an lv_color_t */ + LV_SUBJECT_TYPE_GROUP = 6, /**< an array of Subjects */ + LV_SUBJECT_TYPE_STRING = 7, /**< a char pointer */ +} lv_subject_type_t; + +/** + * A common type to handle all the various observable types in the same way + */ +typedef union { + int32_t num; /**< Integer number (opacity, enums, booleans or "normal" numbers) */ + const void * pointer; /**< Constant pointer (string buffer, format string, font, cone text, etc.) */ + lv_color_t color; /**< Color */ +#if LV_USE_FLOAT + float float_v; /**< Floating point value*/ +#endif +} lv_subject_value_t; + +/** + * The Subject (an observable value) + */ +struct _lv_subject_t { +#if LV_USE_EXT_DATA + lv_ext_data_t ext_data; +#endif + lv_ll_t subs_ll; /**< Subscribers */ + lv_subject_value_t value; /**< Current value */ + lv_subject_value_t prev_value; /**< Previous value */ + lv_subject_value_t min_value; /**< Minimum value for min. int or float*/ + lv_subject_value_t max_value; /**< Maximum value for max. int or float*/ + void * user_data; /**< Additional parameter, can be used freely by user */ + uint32_t type : 4; /**< One of the LV_SUBJECT_TYPE_... values */ + uint32_t size : 24; /**< String buffer size or group length */ + uint32_t notify_restart_query : 1; /**< If an Observer was deleted during notification, + * start notifying from the beginning. */ +}; + +/** + * Callback called to notify Observer that Subject's value has changed + * @param observer pointer to Observer + * @param subject pointer to Subject being observed + */ +typedef void (*lv_observer_cb_t)(lv_observer_t * observer, lv_subject_t * subject); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +#if LV_USE_EXT_DATA +/** + * @brief Attaches external user data to an integer Subject with lifecycle management + * + * Associates arbitrary user-defined data with an LVGL observer and registers a destructor + * callback that will be automatically invoked when the observer is deleted. This enables: + * - Safe resource cleanup through the destructor mechanism + * - Contextual data storage for observer callbacks + * - Proper memory management for observer-related resources + * + * @param subject pointer to Subject + * @param data User-defined data pointer to associate + * @param free_cb Cleanup function called when: + * - Observer is explicitly deleted + * - Observed object is deleted + * - New data replaces current association + * NULL indicates no cleanup required + */ +void lv_subject_set_external_data(lv_subject_t * subject, void * data, void (* free_cb)(void * data)); +#endif + +/** + * Initialize an integer-type Subject. + * @param subject pointer to Subject + * @param value initial value + */ +void lv_subject_init_int(lv_subject_t * subject, int32_t value); + +/** + * Set value of an integer Subject and notify Observers. + * @param subject pointer to Subject + * @param value new value + */ +void lv_subject_set_int(lv_subject_t * subject, int32_t value); + +/** + * Get current value of an integer Subject. + * @param subject pointer to Subject + * @return current value + */ +int32_t lv_subject_get_int(lv_subject_t * subject); + +/** + * Get previous value of an integer Subject. + * @param subject pointer to Subject + * @return current value + */ +int32_t lv_subject_get_previous_int(lv_subject_t * subject); + + +/** + * Set a minimum value for an integer subject + * @param subject pointer to Subject + * @param min_value the minimum value + */ +void lv_subject_set_min_value_int(lv_subject_t * subject, int32_t min_value); + +/** + * Set a maximum value for an integer subject + * @param subject pointer to Subject + * @param max_value the maximum value + */ +void lv_subject_set_max_value_int(lv_subject_t * subject, int32_t max_value); + +#if LV_USE_FLOAT + +/** + * Initialize an float-type Subject. + * @param subject pointer to Subject + * @param value initial value + */ +void lv_subject_init_float(lv_subject_t * subject, float value); + +/** + * Set value of an float Subject and notify Observers. + * @param subject pointer to Subject + * @param value new value + */ +void lv_subject_set_float(lv_subject_t * subject, float value); + +/** + * Get current value of an float Subject. + * @param subject pointer to Subject + * @return current value + */ +float lv_subject_get_float(lv_subject_t * subject); + +/** + * Get previous value of an float Subject. + * @param subject pointer to Subject + * @return current value + */ +float lv_subject_get_previous_float(lv_subject_t * subject); + +/** + * Set a minimum value for a float subject + * @param subject pointer to Subject + * @param min_value the minimum value + */ +void lv_subject_set_min_value_float(lv_subject_t * subject, float min_value); + +/** + * Set a maximum value for a float subject + * @param subject pointer to Subject + * @param max_value the maximum value + */ +void lv_subject_set_max_value_float(lv_subject_t * subject, float max_value); + +#endif /*LV_USE_FLOAT*/ + +/** + * Initialize a string-type Subject. + * @param subject pointer to Subject + * @param buf pointer to buffer to store string + * @param prev_buf pointer to buffer to store previous string; can be NULL if not used + * @param size size of buffer(s) + * @param value initial value of string, e.g. "hello" + * @note A string Subject stores its own copy of the string, not just the pointer. + */ +void lv_subject_init_string(lv_subject_t * subject, char * buf, char * prev_buf, size_t size, const char * value); + +/** + * Copy a string to a Subject and notify Observers if it changed. + * @param subject pointer to Subject + * @param buf new string + */ +void lv_subject_copy_string(lv_subject_t * subject, const char * buf); + +/** + * Format a new string, updating Subject, and notify Observers if it changed. + * @param subject pointer to Subject + * @param format format string + */ +void lv_subject_snprintf(lv_subject_t * subject, const char * format, ...) LV_FORMAT_ATTRIBUTE(2, 3); + +/** + * Get current value of a string Subject. + * @param subject pointer to Subject + * @return pointer to buffer containing current value + */ +const char * lv_subject_get_string(lv_subject_t * subject); + +/** + * Get previous value of a string Subject. + * @param subject pointer to Subject + * @return pointer to buffer containing previous value + * @note NULL will be returned if NULL was passed in `lv_subject_init_string()` + * as `prev_buf`. + */ +const char * lv_subject_get_previous_string(lv_subject_t * subject); + +/** + * Initialize a pointer-type Subject. + * @param subject pointer to Subject + * @param value initial value + */ +void lv_subject_init_pointer(lv_subject_t * subject, void * value); + +/** + * Set value of a pointer Subject and notify Observers (regardless of whether it changed). + * @param subject pointer to Subject + * @param ptr new value + */ +void lv_subject_set_pointer(lv_subject_t * subject, void * ptr); + +/** + * Get current value of a pointer Subject. + * @param subject pointer to Subject + * @return current value + */ +const void * lv_subject_get_pointer(lv_subject_t * subject); + +/** + * Get previous value of a pointer Subject. + * @param subject pointer to Subject + * @return previous value + */ +const void * lv_subject_get_previous_pointer(lv_subject_t * subject); + +/** + * Initialize a color-type Subject. + * @param subject pointer to Subject + * @param color initial value + */ +void lv_subject_init_color(lv_subject_t * subject, lv_color_t color); + +/** + * Set value of a color Subject and notify Observers if it changed. + * @param subject pointer to Subject + * @param color new value + */ +void lv_subject_set_color(lv_subject_t * subject, lv_color_t color); + +/** + * Get current value of a color Subject. + * @param subject pointer to Subject + * @return current value + */ +lv_color_t lv_subject_get_color(lv_subject_t * subject); + +/** + * Get previous value of a color Subject. + * @param subject pointer to Subject + * @return previous value + */ +lv_color_t lv_subject_get_previous_color(lv_subject_t * subject); + +/** + * Initialize a Group-type Subject. + * @param group_subject pointer to Group-type Subject + * @param list list of other Subject addresses; when any of these have values + updated, Observers of `group_subject` will be notified. + * @param list_len number of elements in `list[]` + */ +void lv_subject_init_group(lv_subject_t * group_subject, lv_subject_t * list[], uint32_t list_len); + +/** + * Remove all Observers from a Subject and free allocated memory, and delete + * any associated Widget-Binding events. This leaves `subject` "disconnected" from + * all Observers and all associated Widget events established through Widget Binding. + * @param subject pointer to Subject + * @note This can safely be called regardless of whether any Observers + * added with `lv_subject_add_observer_obj()` or bound to a Widget Property + * with one of the `..._bind_...()` functions. + */ +void lv_subject_deinit(lv_subject_t * subject); + +/** + * Get an element from Subject Group's list. + * @param subject pointer to Group-type Subject + * @param index index of element to get + * @return pointer to indexed Subject from list, or NULL if index is out of bounds + */ +lv_subject_t * lv_subject_get_group_element(lv_subject_t * subject, int32_t index); + +/** + * Add Observer to Subject. When Subject's value changes `observer_cb` will be called. + * @param subject pointer to Subject + * @param observer_cb notification callback + * @param user_data optional user data + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_subject_add_observer(lv_subject_t * subject, lv_observer_cb_t observer_cb, void * user_data); + +/** + * Add Observer to Subject for a Widget. + * When the Widget is deleted, Observer will be unsubscribed from Subject automatically. + * @param subject pointer to Subject + * @param observer_cb notification callback + * @param obj pointer to Widget + * @param user_data optional user data + * @return pointer to newly-created Observer + * @note Do not call `lv_observer_remove()` on Observers created this way. + * Only clean up such Observers by either: + * - deleting the Widget, or + * - calling `lv_subject_deinit()` to gracefully de-couple and + * remove all Observers. + */ +lv_observer_t * lv_subject_add_observer_obj(lv_subject_t * subject, lv_observer_cb_t observer_cb, lv_obj_t * obj, + void * user_data); + +/** + * Add an Observer to a Subject and also save a target pointer. + * @param subject pointer to Subject + * @param observer_cb notification callback + * @param target any pointer (NULL is okay) + * @param user_data optional user data + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_subject_add_observer_with_target(lv_subject_t * subject, lv_observer_cb_t observer_cb, + void * target, void * user_data); + +/** + * Remove Observer from its Subject. + * @param observer pointer to Observer + */ +void lv_observer_remove(lv_observer_t * observer); + +/** + * Remove Observers associated with Widget `obj` from specified `subject` or all Subjects. + * @param obj pointer to Widget whose Observers should be removed + * @param subject Subject to remove Widget from, or NULL to remove from all Subjects + * @note This function can be used e.g. when a Widget's Subject(s) needs to + * be replaced by other Subject(s) + */ +void lv_obj_remove_from_subject(lv_obj_t * obj, lv_subject_t * subject); + +/** + * Get target of an Observer. + * @param observer pointer to Observer + * @return pointer to saved target + */ +void * lv_observer_get_target(lv_observer_t * observer); + +/** + * Get target Widget of Observer. + * This is the same as `lv_observer_get_target()`, except it returns `target` + * as an `lv_obj_t *`. + * @param observer pointer to Observer + * @return pointer to saved Widget target + */ +lv_obj_t * lv_observer_get_target_obj(lv_observer_t * observer); + +/** + * Get Observer's user data. + * @param observer pointer to Observer + * @return void pointer to saved user data +*/ +void * lv_observer_get_user_data(const lv_observer_t * observer); + +/** + * Notify all Observers of Subject. + * @param subject pointer to Subject + */ +void lv_subject_notify(lv_subject_t * subject); + +/** + * Add an event handler to increment (or decrement) the value of a subject on a trigger. + * @param obj pointer to a widget + * @param subject pointer to a subject to change + * @param trigger the trigger on which the subject should be changed + * @param step value to add on trigger + * if the minimum value is reached, the maximum value will be set on rollover. + */ +lv_subject_increment_dsc_t * lv_obj_add_subject_increment_event(lv_obj_t * obj, lv_subject_t * subject, + lv_event_code_t trigger, int32_t step); + +/** + * Set the minimum subject value to set by the event + * @param obj pointer to the Widget to which the event is attached + * @param dsc pointer to the descriptor returned by `lv_obj_add_subject_increment_event()` + * @param min_value the minimum value to set + */ +void lv_obj_set_subject_increment_event_min_value(lv_obj_t * obj, lv_subject_increment_dsc_t * dsc, int32_t min_value); + +/** + * Set the maximum subject value to set by the event + * @param obj pointer to the Widget to which the event is attached + * @param dsc pointer to the descriptor returned by `lv_obj_add_subject_increment_event()` + * @param max_value the maximum value to set + */ +void lv_obj_set_subject_increment_event_max_value(lv_obj_t * obj, lv_subject_increment_dsc_t * dsc, int32_t max_value); + +/** + * Set what to do when the min/max value is crossed. + * @param obj pointer to the Widget to which the event is attached + * @param dsc pointer to the descriptor returned by `lv_obj_add_subject_increment_event()` + * @param rollover false: stop at the min/max value; true: jump to the other end + * @note the subject also can have min/max values and always the smaller range will be considered + */ +void lv_obj_set_subject_increment_event_rollover(lv_obj_t * obj, lv_subject_increment_dsc_t * dsc, bool rollover); + +/** +* Toggle the value of an integer subject on an event. If it was != 0 it will be 0. +* If it was 0, it will be 1. +* @param obj pointer to a widget +* @param subject pointer to a subject to toggle +* @param trigger the trigger on which the subject should be changed +*/ +void lv_obj_add_subject_toggle_event(lv_obj_t * obj, lv_subject_t * subject, lv_event_code_t trigger); + +/** + * Set the value of an integer subject. + * @param obj pointer to a widget + * @param subject pointer to a subject to change + * @param trigger the trigger on which the subject should be changed + * @param value the value to set + */ +void lv_obj_add_subject_set_int_event(lv_obj_t * obj, lv_subject_t * subject, lv_event_code_t trigger, int32_t value); + + +#if LV_USE_FLOAT +/** + * Set the value of a float subject. + * @param obj pointer to a widget + * @param subject pointer to a subject to change + * @param trigger the trigger on which the subject should be changed + * @param value the value to set + */ +void lv_obj_add_subject_set_float_event(lv_obj_t * obj, lv_subject_t * subject, lv_event_code_t trigger, float value); +#endif + +/** + * Set the value of a string subject. + * @param obj pointer to a widget + * @param subject pointer to a subject to change + * @param trigger the trigger on which the subject should be changed + * @param value the value to set + */ +void lv_obj_add_subject_set_string_event(lv_obj_t * obj, lv_subject_t * subject, lv_event_code_t trigger, + const char * value); + +/** + * Set Widget's flag(s) if an integer Subject's value is equal to a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_flag_if_eq(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); + +/** + * Set Widget's flag(s) if an integer Subject's value is not equal to a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_flag_if_not_eq(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, + int32_t ref_value); + +/** + * Set Widget's flag(s) if an integer Subject's value is greater than a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_flag_if_gt(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); + +/** + * Set Widget's flag(s) if an integer Subject's value is greater than or equal to a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_flag_if_ge(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); + +/** + * Set Widget's flag(s) if an integer Subject's value is less than a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_flag_if_lt(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); + +/** + * Set Widget's flag(s) if an integer Subject's value is less than or equal to a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_flag_if_le(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); + + +/** + * Set Widget's state(s) if an integer Subject's value is equal to a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_state_if_eq(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); + +/** + * Set a Widget's state(s) if an integer Subject's value is not equal to a reference value, clear flag otherwise + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_state_if_not_eq(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, + int32_t ref_value); + +/** + * Set Widget's state(s) if an integer Subject's value is greater than a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_state_if_gt(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); + +/** + * Set Widget's state(s) if an integer Subject's value is greater than or equal to a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_state_if_ge(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); + +/** + * Set Widget's state(s) if an integer Subject's value is less than a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_state_if_lt(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); + +/** + * Set Widget's state(s) if an integer Subject's value is less than or equal to a reference value, clear flag otherwise. + * @param obj pointer to Widget + * @param subject pointer to Subject + * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) + * @param ref_value reference value to compare Subject's value with + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_obj_bind_state_if_le(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); + +/** + * Set an integer Subject to 1 when a Widget is checked and set it 0 when unchecked, and + * clear Widget's checked state when Subject's value changes to 0 and set it when non-zero. + * @param obj pointer to Widget + * @param subject pointer to a Subject + * @return pointer to newly-created Observer + * @note Ensure Widget's `LV_OBJ_FLAG_CHECKABLE` flag is set. + */ +lv_observer_t * lv_obj_bind_checked(lv_obj_t * obj, lv_subject_t * subject); + + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_OBSERVER*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBSERVER_H*/ diff --git a/include/lvgl/core/lv_refr.h b/include/lvgl/core/lv_refr.h new file mode 100644 index 0000000000..c938d90467 --- /dev/null +++ b/include/lvgl/core/lv_refr.h @@ -0,0 +1,74 @@ +/** + * @file lv_refr.h + * + */ + +#ifndef LV_REFR_H +#define LV_REFR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_obj.h" +#include "../display/lv_display.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +/** + * Redraw the invalidated areas now. + * Normally the redrawing is periodically executed in `lv_timer_handler` but a long blocking process + * can prevent the call of `lv_timer_handler`. In this case if the GUI is updated in the process + * (e.g. progress bar) this function can be called when the screen should be updated. + * @param disp pointer to display to refresh. NULL to refresh all displays. + */ +void lv_refr_now(lv_display_t * disp); + +/** + * Redrawn on object and all its children using the passed draw context + * @param layer pointer to a layer where to draw. + * @param obj the start object from the redraw should start + */ +void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj); + +/** + * Called periodically to handle the refreshing + * @param timer pointer to the timer itself, or `NULL` + */ +void lv_display_refr_timer(lv_timer_t * timer); + +/********************** + * STATIC FUNCTIONS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_REFR_H*/ diff --git a/include/lvgl/core/lv_style.h b/include/lvgl/core/lv_style.h new file mode 100644 index 0000000000..003ffb252d --- /dev/null +++ b/include/lvgl/core/lv_style.h @@ -0,0 +1,737 @@ +/** + * @file lv_style.h + * + */ + +#ifndef LV_STYLE_H +#define LV_STYLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../font/lv_font.h" +#include "../draw/lv_color.h" +#include "lv_area.h" +#include "lv_anim.h" +#include "../font/lv_text.h" +#include "../lv_types.h" +#include "../debugging/lv_assert.h" +#include "../font/lv_bidi.h" +#include "../draw/lv_grad.h" +#include "../layouts/lv_layout.h" + +/********************* + * DEFINES + *********************/ + +#define LV_STYLE_SENTINEL_VALUE 0xAABBCCDD + +/* + * Flags for style behavior + */ +#define LV_STYLE_PROP_FLAG_NONE (0) /**< No special behavior */ +#define LV_STYLE_PROP_FLAG_INHERITABLE (1 << 0) /**< Inherited */ +#define LV_STYLE_PROP_FLAG_EXT_DRAW_UPDATE (1 << 1) /**< Requires ext. draw size update when changed */ +#define LV_STYLE_PROP_FLAG_LAYOUT_UPDATE (1 << 2) /**< Requires layout update when changed */ +#define LV_STYLE_PROP_FLAG_PARENT_LAYOUT_UPDATE (1 << 3) /**< Requires layout update on parent when changed */ +#define LV_STYLE_PROP_FLAG_LAYER_UPDATE (1 << 4) /**< Affects layer handling */ +#define LV_STYLE_PROP_FLAG_TRANSFORM (1 << 5) /**< Affects the object's transformation */ +#define LV_STYLE_PROP_FLAG_ALL (0x3F) /**< Indicating all flags */ + +/* + * Other constants + */ +#define LV_SCALE_NONE 256 /**< Value for not zooming the image */ +LV_EXPORT_CONST_INT(LV_SCALE_NONE); + +// *INDENT-OFF* +#if LV_USE_ASSERT_STYLE +#define LV_STYLE_CONST_INIT(var_name, prop_array) \ + const lv_style_t var_name = { \ + .sentinel = LV_STYLE_SENTINEL_VALUE, \ + .values_and_props = (void*)prop_array, \ + .has_group = 0xFFFFFFFF, \ + .prop_cnt = 255 \ + } +#else +#define LV_STYLE_CONST_INIT(var_name, prop_array) \ + const lv_style_t var_name = { \ + .values_and_props = (void*)prop_array, \ + .has_group = 0xFFFFFFFF, \ + .prop_cnt = 255, \ + } +#endif +// *INDENT-ON* + +#define LV_STYLE_CONST_PROPS_END { .prop = LV_STYLE_PROP_INV, .value = { .num = 0 } } + +#if LV_GRADIENT_MAX_STOPS < 2 +#error LVGL needs at least 2 stops for gradients. Please increase the LV_GRADIENT_MAX_STOPS +#endif + +#define LV_GRAD_LEFT LV_PCT(0) +#define LV_GRAD_RIGHT LV_PCT(100) +#define LV_GRAD_TOP LV_PCT(0) +#define LV_GRAD_BOTTOM LV_PCT(100) +#define LV_GRAD_CENTER LV_PCT(50) + +/********************** + * TYPEDEFS + **********************/ + +/** + * Possible options for blending opaque drawings + */ +typedef enum { + LV_BLEND_MODE_NORMAL, /**< Simply mix according to the opacity value*/ + LV_BLEND_MODE_ADDITIVE, /**< Add the respective color channels*/ + LV_BLEND_MODE_SUBTRACTIVE,/**< Subtract the foreground from the background*/ + LV_BLEND_MODE_MULTIPLY, /**< Multiply the foreground and background*/ + LV_BLEND_MODE_DIFFERENCE, /**< Absolute difference between foreground and background*/ +} lv_blend_mode_t; + +/** + * Some options to apply decorations on texts. + * 'OR'ed values can be used. + */ +typedef enum { + LV_TEXT_DECOR_NONE = 0x00, + LV_TEXT_DECOR_UNDERLINE = 0x01, + LV_TEXT_DECOR_STRIKETHROUGH = 0x02, +} lv_text_decor_t; + +/** + * Selects on which sides border should be drawn + * 'OR'ed values can be used. + */ +typedef enum { + LV_BORDER_SIDE_NONE = 0x00, + LV_BORDER_SIDE_BOTTOM = 0x01, + LV_BORDER_SIDE_TOP = 0x02, + LV_BORDER_SIDE_LEFT = 0x04, + LV_BORDER_SIDE_RIGHT = 0x08, + LV_BORDER_SIDE_FULL = 0x0F, + LV_BORDER_SIDE_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/ +} lv_border_side_t; + +typedef enum { + LV_BLUR_QUALITY_AUTO = 0, /**< Set the quality automatically */ + LV_BLUR_QUALITY_SPEED, /**< Prefer speed over precision */ + LV_BLUR_QUALITY_PRECISION, /**< Prefer precision over speed*/ +} lv_blur_quality_t; + +/** A image colorkey definition. + * The transparency within the color range of [low, high] will be set to LV_OPA_TRANSP If the "enable" flag is set to true. + */ +typedef struct { + lv_color_t low; + lv_color_t high; +} lv_image_colorkey_t; + +/** + * A common type to handle all the property types in the same way. + */ +typedef union { + int32_t num; /**< Number integer number (opacity, enums, booleans or "normal" numbers)*/ + const void * ptr; /**< Constant pointers (font, cone text, etc)*/ + lv_color_t color; /**< Colors*/ +} lv_style_value_t; + +/** + * Enumeration of all built in style properties + * + * Props are split into groups of 16. When adding a new prop to a group, ensure it does not overflow into the next one. + */ +enum _lv_style_id_t { + LV_STYLE_PROP_INV = 0, + + /*The properties are listed in a special order to make caching more effective. + *Groups are used when LV_OBJ_STYLE_CACHE is enabled. + *If a property from a groups is set, a bit will be set in + *obj->style_main_prop_is_set and style_other_prop_is_set + *to indicate that the property is set. + * + *Strategy 1: group related properties. E.g. if no "border" properties are set + * they will be skipped quickly. + * + *Strategy 2: group common property with rarely used properties. This way + * the common property is cached properly and it's rarely affected + * by other props. The other props are cached in an sub-optimal way, + * but they are used rarely. + * + *Strategy 3: group properties they are used rarely together so that caching doesn't + * interfere + * + *Each group can have 8 properties. (see STYLE_PROP_SHIFTED)*/ + + /* Size related properties*/ + LV_STYLE_WIDTH = 1, + LV_STYLE_HEIGHT, + LV_STYLE_LENGTH, + LV_STYLE_TRANSFORM_WIDTH, + LV_STYLE_TRANSFORM_HEIGHT, + + LV_STYLE_MIN_WIDTH = 8, + LV_STYLE_MAX_WIDTH, + LV_STYLE_MIN_HEIGHT, + LV_STYLE_MAX_HEIGHT, + LV_STYLE_TRANSLATE_X, + LV_STYLE_TRANSLATE_Y, + LV_STYLE_RADIAL_OFFSET, + + /*Position related properties */ + LV_STYLE_X = 16, + LV_STYLE_Y, + LV_STYLE_ALIGN, + + /*Padding related properties */ + LV_STYLE_PAD_TOP = 24, + LV_STYLE_PAD_BOTTOM, + LV_STYLE_PAD_LEFT, + LV_STYLE_PAD_RIGHT, + LV_STYLE_PAD_RADIAL, + LV_STYLE_PAD_ROW, + LV_STYLE_PAD_COLUMN, + + /*Margin related properties*/ + LV_STYLE_MARGIN_TOP = 32, + LV_STYLE_MARGIN_BOTTOM, + LV_STYLE_MARGIN_LEFT, + LV_STYLE_MARGIN_RIGHT, + + /*Bg. Gradient*/ + LV_STYLE_BG_GRAD = 40, + LV_STYLE_BG_GRAD_DIR, + LV_STYLE_BG_MAIN_OPA, + LV_STYLE_BG_GRAD_OPA, + LV_STYLE_BG_GRAD_COLOR, + LV_STYLE_BG_MAIN_STOP, + LV_STYLE_BG_GRAD_STOP, + + /*Bg image*/ + LV_STYLE_BG_IMAGE_SRC = 48, + LV_STYLE_BG_IMAGE_OPA, + LV_STYLE_BG_IMAGE_RECOLOR_OPA, + LV_STYLE_BG_IMAGE_TILED, + LV_STYLE_BG_IMAGE_RECOLOR, + + /*Group 3*/ + LV_STYLE_BORDER_WIDTH = 56, + LV_STYLE_BORDER_COLOR, + LV_STYLE_BORDER_OPA, + LV_STYLE_BORDER_POST, + LV_STYLE_BORDER_SIDE, + + /*Outline */ + LV_STYLE_OUTLINE_WIDTH = 64, + LV_STYLE_OUTLINE_COLOR, + LV_STYLE_OUTLINE_OPA, + LV_STYLE_OUTLINE_PAD, + + /*Image, Shadow, Line, Arc, and Text are rarely used together.*/ + LV_STYLE_BG_OPA = 72, + LV_STYLE_BG_COLOR, + LV_STYLE_SHADOW_WIDTH, + LV_STYLE_LINE_WIDTH, + LV_STYLE_ARC_WIDTH, + LV_STYLE_TEXT_FONT, + LV_STYLE_IMAGE_RECOLOR_OPA, + + LV_STYLE_IMAGE_OPA = 80, + LV_STYLE_SHADOW_OPA, + LV_STYLE_LINE_OPA, + LV_STYLE_ARC_OPA, + LV_STYLE_TEXT_OPA, + + LV_STYLE_SHADOW_COLOR = 88, + LV_STYLE_IMAGE_RECOLOR, + LV_STYLE_LINE_COLOR, + LV_STYLE_ARC_COLOR, + LV_STYLE_TEXT_COLOR, + + LV_STYLE_ARC_IMAGE_SRC = 96, + LV_STYLE_SHADOW_OFFSET_X, + LV_STYLE_SHADOW_OFFSET_Y, + LV_STYLE_SHADOW_SPREAD, + LV_STYLE_LINE_DASH_WIDTH, + LV_STYLE_TEXT_ALIGN, + LV_STYLE_TEXT_LETTER_SPACE, + LV_STYLE_TEXT_LINE_SPACE, + + LV_STYLE_LINE_DASH_GAP = 104, + LV_STYLE_LINE_ROUNDED, + LV_STYLE_IMAGE_COLORKEY, + LV_STYLE_TEXT_OUTLINE_STROKE_WIDTH, + LV_STYLE_TEXT_OUTLINE_STROKE_OPA, + LV_STYLE_TEXT_OUTLINE_STROKE_COLOR, + LV_STYLE_TEXT_DECOR, + LV_STYLE_ARC_ROUNDED, + + /*Group unrelated props*/ + LV_STYLE_OPA = 112, + LV_STYLE_OPA_LAYERED, + LV_STYLE_COLOR_FILTER_DSC, + LV_STYLE_COLOR_FILTER_OPA, + LV_STYLE_ANIM, + LV_STYLE_ANIM_DURATION, + LV_STYLE_TRANSITION, + + /*Radius is requested a lot, group it with rarely requested ones*/ + LV_STYLE_RADIUS = 120, + LV_STYLE_BITMAP_MASK_SRC, + LV_STYLE_BLEND_MODE, + LV_STYLE_ROTARY_SENSITIVITY, + LV_STYLE_TRANSLATE_RADIAL, + + /*Requested a lot but rarely used*/ + LV_STYLE_CLIP_CORNER = 128, + LV_STYLE_BASE_DIR, + LV_STYLE_RECOLOR, + LV_STYLE_RECOLOR_OPA, + LV_STYLE_LAYOUT, + + /*Blur*/ + LV_STYLE_BLUR_RADIUS = 136, + LV_STYLE_BLUR_BACKDROP, + LV_STYLE_BLUR_QUALITY, + + /*Drop shadow*/ + LV_STYLE_DROP_SHADOW_RADIUS = 144, + LV_STYLE_DROP_SHADOW_OFFSET_X, + LV_STYLE_DROP_SHADOW_OFFSET_Y, + LV_STYLE_DROP_SHADOW_COLOR, + LV_STYLE_DROP_SHADOW_OPA, + LV_STYLE_DROP_SHADOW_QUALITY, + + /*Scale and transform*/ + LV_STYLE_TRANSFORM_SCALE_X = 152, + LV_STYLE_TRANSFORM_SCALE_Y, + LV_STYLE_TRANSFORM_PIVOT_X, + LV_STYLE_TRANSFORM_PIVOT_Y, + LV_STYLE_TRANSFORM_ROTATION, + LV_STYLE_TRANSFORM_SKEW_X, + LV_STYLE_TRANSFORM_SKEW_Y, + + /*Flex and basic grid (rarely used together)*/ + LV_STYLE_FLEX_FLOW = 160, + LV_STYLE_FLEX_MAIN_PLACE, + LV_STYLE_FLEX_CROSS_PLACE, + LV_STYLE_FLEX_TRACK_PLACE, + LV_STYLE_FLEX_GROW, + LV_STYLE_GRID_COLUMN_DSC_ARRAY, + LV_STYLE_GRID_ROW_DSC_ARRAY, + + LV_STYLE_GRID_COLUMN_ALIGN = 168, + LV_STYLE_GRID_ROW_ALIGN, + LV_STYLE_GRID_CELL_COLUMN_POS, + LV_STYLE_GRID_CELL_COLUMN_SPAN, + LV_STYLE_GRID_CELL_X_ALIGN, + LV_STYLE_GRID_CELL_ROW_POS, + LV_STYLE_GRID_CELL_ROW_SPAN, + LV_STYLE_GRID_CELL_Y_ALIGN, + + LV_STYLE_TEXT_LEADING_TRIM = 176, + + LV_STYLE_LAST_BUILT_IN_PROP, + LV_STYLE_NUM_BUILT_IN_PROPS = LV_STYLE_LAST_BUILT_IN_PROP + 1, + + LV_STYLE_PROP_ANY = 0xFF, + LV_STYLE_PROP_CONST = 0xFF /* magic value for const styles */ +}; + +typedef enum { + LV_STYLE_RES_NOT_FOUND, + LV_STYLE_RES_FOUND, +} lv_style_res_t; + +/** + * Descriptor for style transitions + */ +typedef struct { + const lv_style_prop_t * props; /**< An array with the properties to animate.*/ + void * user_data; /**< A custom user data that will be passed to the animation's user_data */ + lv_anim_path_cb_t path_xcb; /**< A path for the animation.*/ + uint32_t time; /**< Duration of the transition in [ms]*/ + uint32_t delay; /**< Delay before the transition in [ms]*/ +} lv_style_transition_dsc_t; + +/** + * Descriptor of a constant style property. + */ +typedef struct { + lv_style_prop_t prop; + lv_style_value_t value; +} lv_style_const_prop_t; + +/** + * Descriptor of a style (a collection of properties and values). + */ +typedef struct { + +#if LV_USE_ASSERT_STYLE + uint32_t sentinel; +#endif + + void * values_and_props; + + uint32_t has_group; + uint8_t prop_cnt; /**< 255 means it's a constant style*/ +} lv_style_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a style + * @param style pointer to a style to initialize + * @note Do not call `lv_style_init` on styles that already have some properties + * because this function won't free the used memory, just sets a default state for the style. + * In other words be sure to initialize styles only once! + */ +void lv_style_init(lv_style_t * style); + +/** + * Clear all properties from a style and free all allocated memories. + * @param style pointer to a style + */ +void lv_style_reset(lv_style_t * style); + +/** + * Copy all properties of a style to an other. + * It has the same affect callying the same `lv_set_style_...` + * functions on both styles. + * It means new memory will be allocated to store the properties in + * the destination style. + * After the copy the destination style is fully independent of the source + * and source can removed without affecting the destination style. + * @param dst the destination to copy into (can not the a constant style) + * @param src the source style to copy from. + */ +void lv_style_copy(lv_style_t * dst, const lv_style_t * src); + +/** + * Copy all properties of a style to an other without resetting the dst style. + * It has the same effect as calling the same `lv_set_style_...` + * functions on both styles. + * It means new memory will be allocated to store the properties in + * the destination style. + * After the copy the destination style is fully independent of the source + * and source can removed without affecting the destination style. + * @param dst the destination to copy into (cannot be a constant style) + * @param src the source style to copy from. + */ +void lv_style_merge(lv_style_t * dst, const lv_style_t * src); + + +/** + * Check if a style is constant + * @param style pointer to a style + * @return true: the style is constant + */ +static inline bool lv_style_is_const(const lv_style_t * style) +{ + if(style->prop_cnt == 255) return true; + return false; +} + + +/** + * Register a new style property for custom usage + * @return a new property ID, or LV_STYLE_PROP_INV if there are no more available. + * + * Example: + * @code + * lv_style_prop_t MY_PROP; + * static inline void lv_style_set_my_prop(lv_style_t * style, lv_color_t value) { + * lv_style_value_t v = {.color = value}; lv_style_set_prop(style, MY_PROP, v); } + * + * ... + * MY_PROP = lv_style_register_prop(); + * ... + * lv_style_set_my_prop(&style1, lv_palette_main(LV_PALETTE_RED)); + * @endcode + */ +lv_style_prop_t lv_style_register_prop(uint8_t flag); + +/** + * Get the number of custom properties that have been registered thus far. + */ +lv_style_prop_t lv_style_get_num_custom_props(void); + +/** + * Remove a property from a style + * @param style pointer to a style + * @param prop a style property ORed with a state. + * @return true: the property was found and removed; false: the property wasn't found + */ +bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop); + +/** + * Set the value of property in a style. + * This function shouldn't be used directly by the user. + * Instead use `lv_style_set_()`. E.g. `lv_style_set_bg_color()` + * @param style pointer to style + * @param prop the ID of a property (e.g. `LV_STYLE_BG_COLOR`) + * @param value `lv_style_value_t` variable in which a field is set according to the type of `prop` + */ +void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t value); + +/** + * Get the value of a property + * @param style pointer to a style + * @param prop the ID of a property + * @param value pointer to a `lv_style_value_t` variable to store the value + * @return LV_RESULT_INVALID: the property wasn't found in the style (`value` is unchanged) + * LV_RESULT_OK: the property was fond, and `value` is set accordingly + * @note For performance reasons there are no sanity check on `style` + */ +lv_style_res_t lv_style_get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value); + +/** + * Initialize a transition descriptor. + * @param tr pointer to a transition descriptor to initialize + * @param props an array with the properties to transition. The last element must be zero. + * @param path_cb an animation path (ease) callback. If `NULL` liner path will be used. + * @param time duration of the transition in [ms] + * @param delay delay before the transition in [ms] + * @param user_data any custom data that will be saved in the transition animation and will be available when `path_cb` is called + * + * Example: + * @code + * const static lv_style_prop_t trans_props[] = { LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, 0 }; + * static lv_style_transition_dsc_t trans1; + * lv_style_transition_dsc_init(&trans1, trans_props, NULL, 300, 0, NULL); + * @endcode + */ +void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[], + lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay, void * user_data); + +/** + * Get the default value of a property + * @param prop the ID of a property + * @return the default value + */ +lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop); + +/** + * Get the value of a property + * @param style pointer to a style + * @param prop the ID of a property + * @param value pointer to a `lv_style_value_t` variable to store the value + * @return LV_RESULT_INVALID: the property wasn't found in the style (`value` is unchanged) + * LV_RESULT_OK: the property was fond, and `value` is set accordingly + * @note For performance reasons there are no sanity check on `style` + * @note This function is the same as ::lv_style_get_prop but inlined. Use it only on performance critical places + */ +static inline lv_style_res_t lv_style_get_prop_inlined(const lv_style_t * style, lv_style_prop_t prop, + lv_style_value_t * value) +{ + if(lv_style_is_const(style)) { + lv_style_const_prop_t * props = (lv_style_const_prop_t *)style->values_and_props; + uint32_t i; + for(i = 0; props[i].prop != LV_STYLE_PROP_INV; i++) { + if(props[i].prop == prop) { + *value = props[i].value; + return LV_STYLE_RES_FOUND; + } + } + } + else { + lv_style_prop_t * props = (lv_style_prop_t *)style->values_and_props + style->prop_cnt * sizeof(lv_style_value_t); + uint32_t i; + for(i = 0; i < style->prop_cnt; i++) { + if(props[i] == prop) { + lv_style_value_t * values = (lv_style_value_t *)style->values_and_props; + *value = values[i]; + return LV_STYLE_RES_FOUND; + } + } + } + return LV_STYLE_RES_NOT_FOUND; +} + +/** + * Checks if a style is empty (has no properties) + * @param style pointer to a style + * @return true if the style is empty + */ +bool lv_style_is_empty(const lv_style_t * style); + +/** + * Tell the group of a property. If the a property from a group is set in a style the (1 << group) bit of style->has_group is set. + * It allows early skipping the style if the property is not exists in the style at all. + * @param prop a style property + * @return the group [0..30] 30 means all the custom properties with index > 120 + */ +static inline uint32_t lv_style_get_prop_group(lv_style_prop_t prop) +{ + uint32_t group = prop >> 2; + if(group > 30) group = 31; /*The MSB marks all the custom properties*/ + return group; + +} + +/** + * Get the flags of a built-in or custom property. + * + * @param prop a style property + * @return the flags of the property + */ +uint8_t lv_style_prop_lookup_flags(lv_style_prop_t prop); + +#include "lv_style_gen.h" + +/** + * Set `style`s width and height. + * @param style pointer to style to be modified + * @param width width in pixels + * @param height height in pixels + */ +static inline void lv_style_set_size(lv_style_t * style, int32_t width, int32_t height) +{ + lv_style_set_width(style, width); + lv_style_set_height(style, height); +} + +/** + * Set all 4 of `style`s padding values. + * @param style pointer to style to be modified + * @param value padding dimension in pixels + */ +static inline void lv_style_set_pad_all(lv_style_t * style, int32_t value) +{ + lv_style_set_pad_left(style, value); + lv_style_set_pad_right(style, value); + lv_style_set_pad_top(style, value); + lv_style_set_pad_bottom(style, value); +} + +/** + * Set `style`s left and right padding values. + * @param style pointer to style to be modified + * @param value padding dimension in pixels + */ +static inline void lv_style_set_pad_hor(lv_style_t * style, int32_t value) +{ + lv_style_set_pad_left(style, value); + lv_style_set_pad_right(style, value); +} + +/** + * Set `style`s top and bottom padding values. + * @param style pointer to style to be modified + * @param value padding dimension in pixels + */ +static inline void lv_style_set_pad_ver(lv_style_t * style, int32_t value) +{ + lv_style_set_pad_top(style, value); + lv_style_set_pad_bottom(style, value); +} + +/** + * Set `style`s row and column padding gaps (applies only to Grid and Flex layouts). + * @param style pointer to style to be modified + * @param value gap dimension in pixels + */ +static inline void lv_style_set_pad_gap(lv_style_t * style, int32_t value) +{ + lv_style_set_pad_row(style, value); + lv_style_set_pad_column(style, value); +} + +/** + * Set `style`s left and right margin values. + * @param style pointer to style to be modified + * @param value margin dimension in pixels + */ +static inline void lv_style_set_margin_hor(lv_style_t * style, int32_t value) +{ + lv_style_set_margin_left(style, value); + lv_style_set_margin_right(style, value); +} + +/** + * Set `style`s top and bottom margin values. + * @param style pointer to style to be modified + * @param value margin dimension in pixels + */ +static inline void lv_style_set_margin_ver(lv_style_t * style, int32_t value) +{ + lv_style_set_margin_top(style, value); + lv_style_set_margin_bottom(style, value); +} + +/** + * Set all 4 of `style`s margin values. + * @param style pointer to style to be modified + * @param value margin dimension in pixels + */ +static inline void lv_style_set_margin_all(lv_style_t * style, int32_t value) +{ + lv_style_set_margin_left(style, value); + lv_style_set_margin_right(style, value); + lv_style_set_margin_top(style, value); + lv_style_set_margin_bottom(style, value); +} + +/** + * Set `style`s X and Y transform scale values. + * @param style pointer to style to be modified + * @param value scale factor. Example values: + * - 256 or LV_SCALE_NONE: no zoom + * - <256: scale down + * - >256: scale up + * - 128: half size + * - 512: double size + */ +static inline void lv_style_set_transform_scale(lv_style_t * style, int32_t value) +{ + lv_style_set_transform_scale_x(style, value); + lv_style_set_transform_scale_y(style, value); +} + +/** + * @brief Check if the style property has a specified behavioral flag. + * + * Do not pass multiple flags to this function as backwards-compatibility is not guaranteed + * for that. + * + * @param prop Property ID + * @param flag Flag + * @return true if the flag is set for this property + */ +static inline bool lv_style_prop_has_flag(lv_style_prop_t prop, uint8_t flag) +{ + return lv_style_prop_lookup_flags(prop) & flag; +} + +/************************* + * GLOBAL VARIABLES + *************************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t lv_style_const_prop_id_inv; + +/********************** + * MACROS + **********************/ + +#if LV_USE_ASSERT_STYLE +# define LV_ASSERT_STYLE(style_p) \ + do { \ + LV_ASSERT_MSG(style_p != NULL, "The style is NULL"); \ + LV_ASSERT_MSG(style_p->sentinel == LV_STYLE_SENTINEL_VALUE, "Style is not initialized or corrupted"); \ + } while(0) +#else +# define LV_ASSERT_STYLE(p) do{}while(0) +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_STYLE_H*/ diff --git a/include/lvgl/core/lv_style_gen.h b/include/lvgl/core/lv_style_gen.h new file mode 100644 index 0000000000..cea70036e1 --- /dev/null +++ b/include/lvgl/core/lv_style_gen.h @@ -0,0 +1,2549 @@ +/* + * @file + * + ********************************************************************** + * DO NOT EDIT + * This file is automatically generated by "style_api_gen.py" + ********************************************************************** + */ + + +#ifndef LV_STYLE_GEN_H +#define LV_STYLE_GEN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Sets width of Widget. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. + * Percentage values are relative to the width of the parent's content area. + * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_width(lv_style_t * style, int32_t value); + +/** + * Sets a minimal width. Pixel and percentage values can be used. Percentage values + * are relative to the width of the parent's content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_min_width(lv_style_t * style, int32_t value); + +/** + * Sets a maximal width. Pixel and percentage values can be used. Percentage values + * are relative to the width of the parent's content area. + * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_max_width(lv_style_t * style, int32_t value); + +/** + * Sets height of Widget. Pixel, percentage and `LV_SIZE_CONTENT` can be used. + * Percentage values are relative to the height of the parent's content area. + * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_height(lv_style_t * style, int32_t value); + +/** + * Sets a minimal height. Pixel and percentage values can be used. Percentage values + * are relative to the height of the parent's content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_min_height(lv_style_t * style, int32_t value); + +/** + * Sets a maximal height. Pixel and percentage values can be used. Percentage values + * are relative to the height of the parent's content area. + * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_max_height(lv_style_t * style, int32_t value); + +/** + * Its meaning depends on the type of Widget. For example in case of lv_scale it means + * the length of the ticks. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_length(lv_style_t * style, int32_t value); + +/** + * Set X coordinate of Widget considering the ``align`` setting. Pixel and percentage + * values can be used. Percentage values are relative to the width of the parent's + * content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_x(lv_style_t * style, int32_t value); + +/** + * Set Y coordinate of Widget considering the ``align`` setting. Pixel and percentage + * values can be used. Percentage values are relative to the height of the parent's + * content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_y(lv_style_t * style, int32_t value); + +/** + * Set the alignment which tells from which point of the parent the X and Y + * coordinates should be interpreted. Possible values are: `LV_ALIGN_DEFAULT`, + * `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, + * `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means + * `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base + * direction. + * Default: `LV_ALIGN_DEFAULT`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_align(lv_style_t * style, lv_align_t value); + +/** + * Make Widget wider on both sides with this value. Pixel and percentage (with + * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's width. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_transform_width(lv_style_t * style, int32_t value); + +/** + * Make Widget higher on both sides with this value. Pixel and percentage (with + * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's height. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_transform_height(lv_style_t * style, int32_t value); + +/** + * Move Widget with this value in X direction. Applied after layouts, aligns and other + * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage + * values are relative to Widget's width. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_translate_x(lv_style_t * style, int32_t value); + +/** + * Move Widget with this value in Y direction. Applied after layouts, aligns and other + * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage + * values are relative to Widget's height. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_translate_y(lv_style_t * style, int32_t value); + +/** + * Move object around the centre of the parent object (e.g. around the circumference + * of a scale). + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_translate_radial(lv_style_t * style, int32_t value); + +/** + * Zoom Widget horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 + * half size, 512 double size, and so on. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_transform_scale_x(lv_style_t * style, int32_t value); + +/** + * Zoom Widget vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 + * half size, 512 double size, and so on. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_transform_scale_y(lv_style_t * style, int32_t value); + +/** + * Rotate Widget. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_transform_rotation(lv_style_t * style, int32_t value); + +/** + * Set pivot point's X coordinate for transformations. Relative to Widget's top left corner. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_transform_pivot_x(lv_style_t * style, int32_t value); + +/** + * Set pivot point's Y coordinate for transformations. Relative to Widget's top left corner. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_transform_pivot_y(lv_style_t * style, int32_t value); + +/** + * Skew Widget horizontally. The value is interpreted in 0.1 degree units. E.g. 450 + * means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_transform_skew_x(lv_style_t * style, int32_t value); + +/** + * Skew Widget vertically. The value is interpreted in 0.1 degree units. E.g. 450 + * means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_transform_skew_y(lv_style_t * style, int32_t value); + +/** + * Sets the padding on the top. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_pad_top(lv_style_t * style, int32_t value); + +/** + * Sets the padding on the bottom. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_pad_bottom(lv_style_t * style, int32_t value); + +/** + * Sets the padding on the left. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_pad_left(lv_style_t * style, int32_t value); + +/** + * Sets the padding on the right. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_pad_right(lv_style_t * style, int32_t value); + +/** + * Sets the padding between the rows. Used by the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_pad_row(lv_style_t * style, int32_t value); + +/** + * Sets the padding between the columns. Used by the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_pad_column(lv_style_t * style, int32_t value); + +/** + * Pad text labels away from the scale ticks/remainder of the ``LV_PART_``. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_pad_radial(lv_style_t * style, int32_t value); + +/** + * Sets margin on the top. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_margin_top(lv_style_t * style, int32_t value); + +/** + * Sets margin on the bottom. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_margin_bottom(lv_style_t * style, int32_t value); + +/** + * Sets margin on the left. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_margin_left(lv_style_t * style, int32_t value); + +/** + * Sets margin on the right. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_margin_right(lv_style_t * style, int32_t value); + +/** + * Set background color of Widget. + * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_bg_color(lv_style_t * style, lv_color_t value); + +/** + * Set opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value); + +/** + * Set direction of the gradient of the background. Possible values are + * `LV_GRAD_DIR_NONE/HOR/VER`. + * Default: `LV_GRAD_DIR_NONE`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value); + +/** + * Set point from which background color should start for gradients. 0 means to + * top/left side, 255 the bottom/right side, 128 the center, and so on. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_bg_main_stop(lv_style_t * style, int32_t value); + +/** + * Set point from which background's gradient color should start. 0 means to top/left + * side, 255 the bottom/right side, 128 the center, and so on. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_bg_grad_stop(lv_style_t * style, int32_t value); + +/** + * Set opacity of the first gradient color. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_bg_main_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set opacity of the second gradient color. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_bg_grad_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set gradient definition. The pointed instance must exist while Widget is alive. + * NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and + * `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors + * as well. If it's set other gradient related properties will be ignored. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to gradient descriptor + */ +void lv_style_set_bg_grad(lv_style_t * style, const lv_grad_dsc_t * value); + +/** + * Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or + * an `LV_SYMBOL_...`. + * Default: `NULL`, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Pointer to image source + */ +void lv_style_set_bg_image_src(lv_style_t * style, const void * value); + +/** + * Set opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means + * fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other + * values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_bg_image_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set a color to mix to the background image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_bg_image_recolor(lv_style_t * style, lv_color_t value); + +/** + * Set intensity of background image recoloring. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full + * recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted + * proportionally. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_bg_image_recolor_opa(lv_style_t * style, lv_opa_t value); + +/** + * If enabled the background image will be tiled. Possible values are `true` or `false`. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_bg_image_tiled(lv_style_t * style, bool value); + +/** + * Set color of the border. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_border_color(lv_style_t * style, lv_color_t value); + +/** + * Set opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set width of the border. Only pixel values can be used. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_border_width(lv_style_t * style, int32_t value); + +/** + * Set only which side(s) the border should be drawn. Possible values are + * `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as + * well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`. + * Default: `LV_BORDER_SIDE_FULL`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_border_side(lv_style_t * style, lv_border_side_t value); + +/** + * Sets whether the border should be drawn before or after the children are drawn. + * `true`: after children, `false`: before children. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_border_post(lv_style_t * style, bool value); + +/** + * Set width of outline in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_outline_width(lv_style_t * style, int32_t value); + +/** + * Set color of outline. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_outline_color(lv_style_t * style, lv_color_t value); + +/** + * Set opacity of outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set padding of outline, i.e. the gap between Widget and the outline. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_outline_pad(lv_style_t * style, int32_t value); + +/** + * Set width of the shadow in pixels. The value should be >= 0. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_shadow_width(lv_style_t * style, int32_t value); + +/** + * Set an offset on the shadow in pixels in X direction. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_shadow_offset_x(lv_style_t * style, int32_t value); + +/** + * Set an offset on the shadow in pixels in Y direction. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_shadow_offset_y(lv_style_t * style, int32_t value); + +/** + * Make shadow calculation to use a larger or smaller rectangle as base. The value can + * be in pixels to make the area larger/smaller. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_shadow_spread(lv_style_t * style, int32_t value); + +/** + * Set color of shadow. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value); + +/** + * Set opacity of shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_image_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set color to mix with the image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_image_recolor(lv_style_t * style, lv_color_t value); + +/** + * Set intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_image_recolor_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set image colorkey definition. The lv_image_colorkey_t contains two color values: + * `high_color` and `low_color`. the color of pixels ranging from `low_color` to + * `high_color` will be transparent. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to image color key + */ +void lv_style_set_image_colorkey(lv_style_t * style, const lv_image_colorkey_t * value); + +/** + * Set width of lines in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_line_width(lv_style_t * style, int32_t value); + +/** + * Set width of dashes in pixels. Note that dash works only on horizontal and vertical lines. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_line_dash_width(lv_style_t * style, int32_t value); + +/** + * Set gap between dashes in pixels. Note that dash works only on horizontal and + * vertical lines. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_line_dash_gap(lv_style_t * style, int32_t value); + +/** + * Make end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_line_rounded(lv_style_t * style, bool value); + +/** + * Set color of lines. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_line_color(lv_style_t * style, lv_color_t value); + +/** + * Set opacity of lines. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set width (thickness) of arcs in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_arc_width(lv_style_t * style, int32_t value); + +/** + * Make end points of arcs rounded. `true`: rounded, `false`: perpendicular line ending. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_arc_rounded(lv_style_t * style, bool value); + +/** + * Set color of arc. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_arc_color(lv_style_t * style, lv_color_t value); + +/** + * Set opacity of arcs. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set an image from which arc will be masked out. It's useful to display complex + * effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to image source + */ +void lv_style_set_arc_image_src(lv_style_t * style, const void * value); + +/** + * Sets color of text. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_text_color(lv_style_t * style, lv_color_t value); + +/** + * Set opacity of text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set font of text (a pointer `lv_font_t *`). + * Default: `LV_FONT_DEFAULT`, inherited: Yes, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to font + */ +void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value); + +/** + * Set letter space in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_text_letter_space(lv_style_t * style, int32_t value); + +/** + * Set line space in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_text_line_space(lv_style_t * style, int32_t value); + +/** + * Set decoration for the text. Possible values are + * `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well. + * Default: `LV_TEXT_DECOR_NONE`, inherited: Yes, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t value); + +/** + * Set how to align the lines of the text. Note that it doesn't align the Widget + * itself, only the lines inside the Widget. Possible values are + * `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base + * direction and uses left or right alignment accordingly. + * Default: `LV_TEXT_ALIGN_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value); + +/** + * Sets the color of letter outline stroke. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_text_outline_stroke_color(lv_style_t * style, lv_color_t value); + +/** + * Set the letter outline stroke width in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_text_outline_stroke_width(lv_style_t * style, int32_t value); + +/** + * Set the opacity of the letter outline stroke. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means + * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_text_outline_stroke_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set the text leading trim mode. Removes empty space above and/or below text based + * on font metrics (cap-height, x-height, baseline). Similar to CSS `text-box-trim`. + * Possible values are `LV_TEXT_LEADING_TRIM_NONE/CAPITAL_BASELINE/LOWER_BASELINE/CAPITAL/LOWER`. + * Default: `LV_TEXT_LEADING_TRIM_NONE`, inherited: Yes, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_text_leading_trim(lv_style_t * style, lv_text_leading_trim_t value); + +/** + * Sets the intensity of blurring. Applied on each lv_part separately before the + * children are rendered. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_blur_radius(lv_style_t * style, int32_t value); + +/** + * If `true` the background of the widget will be blurred. The part should have < 100% + * opacity to make it visible. If `false` the given part will be blurred when it's + * rendered but before drawing the children. + * Default: `false`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_blur_backdrop(lv_style_t * style, bool value); + +/** + * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over + * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower + * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. + * Default: `LV_BLUR_QUALITY_AUTO`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_blur_quality(lv_style_t * style, lv_blur_quality_t value); + +/** + * Sets the intensity of blurring. Applied on each lv_part separately before the + * children are rendered. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_drop_shadow_radius(lv_style_t * style, int32_t value); + +/** + * Set an offset on the shadow in pixels in X direction. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_drop_shadow_offset_x(lv_style_t * style, int32_t value); + +/** + * Set an offset on the shadow in pixels in Y direction. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_drop_shadow_offset_y(lv_style_t * style, int32_t value); + +/** + * Set the color of the shadow. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_drop_shadow_color(lv_style_t * style, lv_color_t value); + +/** + * Set the opacity of the shadow. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_drop_shadow_opa(lv_style_t * style, lv_opa_t value); + +/** + * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over + * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower + * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. + * Default: `LV_BLUR_QUALITY_PRECISION`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_drop_shadow_quality(lv_style_t * style, lv_blur_quality_t value); + +/** + * Set radius on every corner. The value is interpreted in pixels (>= 0) or + * `LV_RADIUS_CIRCLE` for max radius. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_radius(lv_style_t * style, int32_t value); + +/** + * Move start point of object (e.g. scale tick) radially. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_radial_offset(lv_style_t * style, int32_t value); + +/** + * Enable clipping of content that overflows rounded corners of parent Widget. Can be + * `true` or `false`. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_clip_corner(lv_style_t * style, bool value); + +/** + * Scale down all opacity values of the Widget by this factor. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means + * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_opa(lv_style_t * style, lv_opa_t value); + +/** + * First draw Widget on the layer, then scale down layer opacity factor. Value 0, + * `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or + * `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc + * means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value); + +/** + * Mix a color with all colors of the Widget. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to color-filter descriptor + */ +void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value); + +/** + * The intensity of mixing of color filter. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value); + +/** + * Set a color to mix to the obj. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Color to submit + */ +void lv_style_set_recolor(lv_style_t * style, lv_color_t value); + +/** + * Sets the intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means + * fully transparent. A value of 255, `LV_OPA_100` or `LV_OPA_COVER` means fully + * opaque. Intermediate values like LV_OPA_10, LV_OPA_20, etc result in + * semi-transparency. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_recolor_opa(lv_style_t * style, lv_opa_t value); + +/** + * Animation template for Widget's animation. Should be a pointer to `lv_anim_t`. The + * animation parameters are widget specific, e.g. animation time could be the E.g. + * blink time of the cursor on the Text Area or scroll time of a roller. See Widgets' + * documentation to learn more. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to animation descriptor + */ +void lv_style_set_anim(lv_style_t * style, const lv_anim_t * value); + +/** + * Animation duration in milliseconds. Its meaning is widget specific. E.g. blink time + * of the cursor on the Text Area or scroll time of a roller. See Widgets' + * documentation to learn more. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_anim_duration(lv_style_t * style, uint32_t value); + +/** + * An initialized ``lv_style_transition_dsc_t`` to describe a transition. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to transition descriptor + */ +void lv_style_set_transition(lv_style_t * style, const lv_style_transition_dsc_t * value); + +/** + * Describes how to blend the colors to the background. Possible values are + * `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY/DIFFERENCE`. + * Default: `LV_BLEND_MODE_NORMAL`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value); + +/** + * Set layout of Widget. Children will be repositioned and resized according to + * policies set for the layout. For possible values see documentation of the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_layout(lv_style_t * style, uint16_t value); + +/** + * Set base direction of Widget. Possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`. + * Default: `LV_BASE_DIR_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value); + +/** + * If set, a layer will be created for the widget and the layer will be masked with + * this A8 bitmap mask. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to A8 bitmap mask + */ +void lv_style_set_bitmap_mask_src(lv_style_t * style, const void * value); + +/** + * Adjust sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the + * rotary to half, 512: speeds up to double, 256: no change. + * Default: `256`, inherited: Yes, layout: No, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_rotary_sensitivity(lv_style_t * style, uint32_t value); + +#if LV_USE_FLEX +/** + * Defines in which direction the flex layout should arrange the children. + * Default: `LV_FLEX_FLOW_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value); + +/** + * Defines how to align the children in the direction of flex flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value); + +/** + * Defines how to align the children perpendicular to the direction of flex flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value); + +/** + * Defines how to align the tracks of the flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value); + +/** + * Defines how much space to take proportionally from the free space of the Widget's track. + * Default: `0`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_flex_grow(lv_style_t * style, uint8_t value); + +#endif /* LV_USE_FLEX */ + +#if LV_USE_GRID +/** + * An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. + * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to grid-column descriptor array + */ +void lv_style_set_grid_column_dsc_array(lv_style_t * style, const int32_t * value); + +/** + * Defines how to distribute the columns. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value); + +/** + * An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. + * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Pointer to grid-row descriptor array + */ +void lv_style_set_grid_row_dsc_array(lv_style_t * style, const int32_t * value); + +/** + * Defines how to distribute the rows. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value); + +/** + * Set column in which Widget should be placed. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_grid_cell_column_pos(lv_style_t * style, int32_t value); + +/** + * Set how to align Widget horizontally. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_grid_align_t value); + +/** + * Set how many columns Widget should span. Needs to be >= 1. + * Default: 1, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_grid_cell_column_span(lv_style_t * style, int32_t value); + +/** + * Set row in which Widget should be placed. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_grid_cell_row_pos(lv_style_t * style, int32_t value); + +/** + * Set how to align Widget vertically. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_grid_align_t value); + +/** + * Set how many rows Widget should span. Needs to be >= 1. + * Default: 1, inherited: No, layout: Yes, ext. draw: No. + * @param style Pointer to style + * @param value Value to submit + */ +void lv_style_set_grid_cell_row_span(lv_style_t * style, int32_t value); + +#endif /* LV_USE_GRID */ + +/** + * Sets width of Widget. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. + * Percentage values are relative to the width of the parent's content area. + * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_WIDTH(val) \ + { \ + .prop = LV_STYLE_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Sets a minimal width. Pixel and percentage values can be used. Percentage values + * are relative to the width of the parent's content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_MIN_WIDTH(val) \ + { \ + .prop = LV_STYLE_MIN_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Sets a maximal width. Pixel and percentage values can be used. Percentage values + * are relative to the width of the parent's content area. + * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_MAX_WIDTH(val) \ + { \ + .prop = LV_STYLE_MAX_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Sets height of Widget. Pixel, percentage and `LV_SIZE_CONTENT` can be used. + * Percentage values are relative to the height of the parent's content area. + * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_HEIGHT(val) \ + { \ + .prop = LV_STYLE_HEIGHT, .value = { .num = (int32_t)val } \ + } + +/** + * Sets a minimal height. Pixel and percentage values can be used. Percentage values + * are relative to the height of the parent's content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_MIN_HEIGHT(val) \ + { \ + .prop = LV_STYLE_MIN_HEIGHT, .value = { .num = (int32_t)val } \ + } + +/** + * Sets a maximal height. Pixel and percentage values can be used. Percentage values + * are relative to the height of the parent's content area. + * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_MAX_HEIGHT(val) \ + { \ + .prop = LV_STYLE_MAX_HEIGHT, .value = { .num = (int32_t)val } \ + } + +/** + * Its meaning depends on the type of Widget. For example in case of lv_scale it means + * the length of the ticks. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_LENGTH(val) \ + { \ + .prop = LV_STYLE_LENGTH, .value = { .num = (int32_t)val } \ + } + +/** + * Set X coordinate of Widget considering the ``align`` setting. Pixel and percentage + * values can be used. Percentage values are relative to the width of the parent's + * content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_X(val) \ + { \ + .prop = LV_STYLE_X, .value = { .num = (int32_t)val } \ + } + +/** + * Set Y coordinate of Widget considering the ``align`` setting. Pixel and percentage + * values can be used. Percentage values are relative to the height of the parent's + * content area. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_Y(val) \ + { \ + .prop = LV_STYLE_Y, .value = { .num = (int32_t)val } \ + } + +/** + * Set the alignment which tells from which point of the parent the X and Y + * coordinates should be interpreted. Possible values are: `LV_ALIGN_DEFAULT`, + * `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, + * `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means + * `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base + * direction. + * Default: `LV_ALIGN_DEFAULT`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_ALIGN(val) \ + { \ + .prop = LV_STYLE_ALIGN, .value = { .num = (int32_t)val } \ + } + +/** + * Make Widget wider on both sides with this value. Pixel and percentage (with + * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's width. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSFORM_WIDTH(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Make Widget higher on both sides with this value. Pixel and percentage (with + * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's height. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSFORM_HEIGHT(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_HEIGHT, .value = { .num = (int32_t)val } \ + } + +/** + * Move Widget with this value in X direction. Applied after layouts, aligns and other + * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage + * values are relative to Widget's width. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSLATE_X(val) \ + { \ + .prop = LV_STYLE_TRANSLATE_X, .value = { .num = (int32_t)val } \ + } + +/** + * Move Widget with this value in Y direction. Applied after layouts, aligns and other + * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage + * values are relative to Widget's height. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSLATE_Y(val) \ + { \ + .prop = LV_STYLE_TRANSLATE_Y, .value = { .num = (int32_t)val } \ + } + +/** + * Move object around the centre of the parent object (e.g. around the circumference + * of a scale). + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSLATE_RADIAL(val) \ + { \ + .prop = LV_STYLE_TRANSLATE_RADIAL, .value = { .num = (int32_t)val } \ + } + +/** + * Zoom Widget horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 + * half size, 512 double size, and so on. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSFORM_SCALE_X(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_SCALE_X, .value = { .num = (int32_t)val } \ + } + +/** + * Zoom Widget vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 + * half size, 512 double size, and so on. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSFORM_SCALE_Y(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_SCALE_Y, .value = { .num = (int32_t)val } \ + } + +/** + * Rotate Widget. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSFORM_ROTATION(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_ROTATION, .value = { .num = (int32_t)val } \ + } + +/** + * Set pivot point's X coordinate for transformations. Relative to Widget's top left corner. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSFORM_PIVOT_X(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_PIVOT_X, .value = { .num = (int32_t)val } \ + } + +/** + * Set pivot point's Y coordinate for transformations. Relative to Widget's top left corner. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSFORM_PIVOT_Y(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_PIVOT_Y, .value = { .num = (int32_t)val } \ + } + +/** + * Skew Widget horizontally. The value is interpreted in 0.1 degree units. E.g. 450 + * means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSFORM_SKEW_X(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_SKEW_X, .value = { .num = (int32_t)val } \ + } + +/** + * Skew Widget vertically. The value is interpreted in 0.1 degree units. E.g. 450 + * means 45 deg. + * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TRANSFORM_SKEW_Y(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_SKEW_Y, .value = { .num = (int32_t)val } \ + } + +/** + * Sets the padding on the top. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_PAD_TOP(val) \ + { \ + .prop = LV_STYLE_PAD_TOP, .value = { .num = (int32_t)val } \ + } + +/** + * Sets the padding on the bottom. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_PAD_BOTTOM(val) \ + { \ + .prop = LV_STYLE_PAD_BOTTOM, .value = { .num = (int32_t)val } \ + } + +/** + * Sets the padding on the left. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_PAD_LEFT(val) \ + { \ + .prop = LV_STYLE_PAD_LEFT, .value = { .num = (int32_t)val } \ + } + +/** + * Sets the padding on the right. It makes the content area smaller in this direction. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_PAD_RIGHT(val) \ + { \ + .prop = LV_STYLE_PAD_RIGHT, .value = { .num = (int32_t)val } \ + } + +/** + * Sets the padding between the rows. Used by the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_PAD_ROW(val) \ + { \ + .prop = LV_STYLE_PAD_ROW, .value = { .num = (int32_t)val } \ + } + +/** + * Sets the padding between the columns. Used by the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_PAD_COLUMN(val) \ + { \ + .prop = LV_STYLE_PAD_COLUMN, .value = { .num = (int32_t)val } \ + } + +/** + * Pad text labels away from the scale ticks/remainder of the ``LV_PART_``. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_PAD_RADIAL(val) \ + { \ + .prop = LV_STYLE_PAD_RADIAL, .value = { .num = (int32_t)val } \ + } + +/** + * Sets margin on the top. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_MARGIN_TOP(val) \ + { \ + .prop = LV_STYLE_MARGIN_TOP, .value = { .num = (int32_t)val } \ + } + +/** + * Sets margin on the bottom. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_MARGIN_BOTTOM(val) \ + { \ + .prop = LV_STYLE_MARGIN_BOTTOM, .value = { .num = (int32_t)val } \ + } + +/** + * Sets margin on the left. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_MARGIN_LEFT(val) \ + { \ + .prop = LV_STYLE_MARGIN_LEFT, .value = { .num = (int32_t)val } \ + } + +/** + * Sets margin on the right. Widget will keep this space from its siblings in layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_MARGIN_RIGHT(val) \ + { \ + .prop = LV_STYLE_MARGIN_RIGHT, .value = { .num = (int32_t)val } \ + } + +/** + * Set background color of Widget. + * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_BG_COLOR(val) \ + { \ + .prop = LV_STYLE_BG_COLOR, .value = { .color = val } \ + } + +/** + * Set opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BG_OPA(val) \ + { \ + .prop = LV_STYLE_BG_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_BG_GRAD_COLOR(val) \ + { \ + .prop = LV_STYLE_BG_GRAD_COLOR, .value = { .color = val } \ + } + +/** + * Set direction of the gradient of the background. Possible values are + * `LV_GRAD_DIR_NONE/HOR/VER`. + * Default: `LV_GRAD_DIR_NONE`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BG_GRAD_DIR(val) \ + { \ + .prop = LV_STYLE_BG_GRAD_DIR, .value = { .num = (int32_t)val } \ + } + +/** + * Set point from which background color should start for gradients. 0 means to + * top/left side, 255 the bottom/right side, 128 the center, and so on. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BG_MAIN_STOP(val) \ + { \ + .prop = LV_STYLE_BG_MAIN_STOP, .value = { .num = (int32_t)val } \ + } + +/** + * Set point from which background's gradient color should start. 0 means to top/left + * side, 255 the bottom/right side, 128 the center, and so on. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BG_GRAD_STOP(val) \ + { \ + .prop = LV_STYLE_BG_GRAD_STOP, .value = { .num = (int32_t)val } \ + } + +/** + * Set opacity of the first gradient color. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BG_MAIN_OPA(val) \ + { \ + .prop = LV_STYLE_BG_MAIN_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set opacity of the second gradient color. + * Default: 255, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BG_GRAD_OPA(val) \ + { \ + .prop = LV_STYLE_BG_GRAD_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set gradient definition. The pointed instance must exist while Widget is alive. + * NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and + * `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors + * as well. If it's set other gradient related properties will be ignored. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param val Pointer to gradient descriptor + */ +#define LV_STYLE_CONST_BG_GRAD(val) \ + { \ + .prop = LV_STYLE_BG_GRAD, .value = { .ptr = val } \ + } + +/** + * Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or + * an `LV_SYMBOL_...`. + * Default: `NULL`, inherited: No, layout: No, ext. draw: Yes. + * @param val Pointer to image source + */ +#define LV_STYLE_CONST_BG_IMAGE_SRC(val) \ + { \ + .prop = LV_STYLE_BG_IMAGE_SRC, .value = { .ptr = val } \ + } + +/** + * Set opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means + * fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other + * values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BG_IMAGE_OPA(val) \ + { \ + .prop = LV_STYLE_BG_IMAGE_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set a color to mix to the background image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_BG_IMAGE_RECOLOR(val) \ + { \ + .prop = LV_STYLE_BG_IMAGE_RECOLOR, .value = { .color = val } \ + } + +/** + * Set intensity of background image recoloring. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full + * recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted + * proportionally. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BG_IMAGE_RECOLOR_OPA(val) \ + { \ + .prop = LV_STYLE_BG_IMAGE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * If enabled the background image will be tiled. Possible values are `true` or `false`. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BG_IMAGE_TILED(val) \ + { \ + .prop = LV_STYLE_BG_IMAGE_TILED, .value = { .num = (int32_t)val } \ + } + +/** + * Set color of the border. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_BORDER_COLOR(val) \ + { \ + .prop = LV_STYLE_BORDER_COLOR, .value = { .color = val } \ + } + +/** + * Set opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BORDER_OPA(val) \ + { \ + .prop = LV_STYLE_BORDER_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set width of the border. Only pixel values can be used. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BORDER_WIDTH(val) \ + { \ + .prop = LV_STYLE_BORDER_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Set only which side(s) the border should be drawn. Possible values are + * `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as + * well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`. + * Default: `LV_BORDER_SIDE_FULL`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BORDER_SIDE(val) \ + { \ + .prop = LV_STYLE_BORDER_SIDE, .value = { .num = (int32_t)val } \ + } + +/** + * Sets whether the border should be drawn before or after the children are drawn. + * `true`: after children, `false`: before children. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BORDER_POST(val) \ + { \ + .prop = LV_STYLE_BORDER_POST, .value = { .num = (int32_t)val } \ + } + +/** + * Set width of outline in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_OUTLINE_WIDTH(val) \ + { \ + .prop = LV_STYLE_OUTLINE_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Set color of outline. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_OUTLINE_COLOR(val) \ + { \ + .prop = LV_STYLE_OUTLINE_COLOR, .value = { .color = val } \ + } + +/** + * Set opacity of outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_OUTLINE_OPA(val) \ + { \ + .prop = LV_STYLE_OUTLINE_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set padding of outline, i.e. the gap between Widget and the outline. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_OUTLINE_PAD(val) \ + { \ + .prop = LV_STYLE_OUTLINE_PAD, .value = { .num = (int32_t)val } \ + } + +/** + * Set width of the shadow in pixels. The value should be >= 0. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_SHADOW_WIDTH(val) \ + { \ + .prop = LV_STYLE_SHADOW_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Set an offset on the shadow in pixels in X direction. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_SHADOW_OFFSET_X(val) \ + { \ + .prop = LV_STYLE_SHADOW_OFFSET_X, .value = { .num = (int32_t)val } \ + } + +/** + * Set an offset on the shadow in pixels in Y direction. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_SHADOW_OFFSET_Y(val) \ + { \ + .prop = LV_STYLE_SHADOW_OFFSET_Y, .value = { .num = (int32_t)val } \ + } + +/** + * Make shadow calculation to use a larger or smaller rectangle as base. The value can + * be in pixels to make the area larger/smaller. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_SHADOW_SPREAD(val) \ + { \ + .prop = LV_STYLE_SHADOW_SPREAD, .value = { .num = (int32_t)val } \ + } + +/** + * Set color of shadow. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_SHADOW_COLOR(val) \ + { \ + .prop = LV_STYLE_SHADOW_COLOR, .value = { .color = val } \ + } + +/** + * Set opacity of shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_SHADOW_OPA(val) \ + { \ + .prop = LV_STYLE_SHADOW_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_IMAGE_OPA(val) \ + { \ + .prop = LV_STYLE_IMAGE_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set color to mix with the image. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_IMAGE_RECOLOR(val) \ + { \ + .prop = LV_STYLE_IMAGE_RECOLOR, .value = { .color = val } \ + } + +/** + * Set intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_IMAGE_RECOLOR_OPA(val) \ + { \ + .prop = LV_STYLE_IMAGE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set image colorkey definition. The lv_image_colorkey_t contains two color values: + * `high_color` and `low_color`. the color of pixels ranging from `low_color` to + * `high_color` will be transparent. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param val Pointer to image color key + */ +#define LV_STYLE_CONST_IMAGE_COLORKEY(val) \ + { \ + .prop = LV_STYLE_IMAGE_COLORKEY, .value = { .ptr = val } \ + } + +/** + * Set width of lines in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_LINE_WIDTH(val) \ + { \ + .prop = LV_STYLE_LINE_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Set width of dashes in pixels. Note that dash works only on horizontal and vertical lines. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_LINE_DASH_WIDTH(val) \ + { \ + .prop = LV_STYLE_LINE_DASH_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Set gap between dashes in pixels. Note that dash works only on horizontal and + * vertical lines. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_LINE_DASH_GAP(val) \ + { \ + .prop = LV_STYLE_LINE_DASH_GAP, .value = { .num = (int32_t)val } \ + } + +/** + * Make end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_LINE_ROUNDED(val) \ + { \ + .prop = LV_STYLE_LINE_ROUNDED, .value = { .num = (int32_t)val } \ + } + +/** + * Set color of lines. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_LINE_COLOR(val) \ + { \ + .prop = LV_STYLE_LINE_COLOR, .value = { .color = val } \ + } + +/** + * Set opacity of lines. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_LINE_OPA(val) \ + { \ + .prop = LV_STYLE_LINE_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set width (thickness) of arcs in pixels. + * Default: 0, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_ARC_WIDTH(val) \ + { \ + .prop = LV_STYLE_ARC_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Make end points of arcs rounded. `true`: rounded, `false`: perpendicular line ending. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_ARC_ROUNDED(val) \ + { \ + .prop = LV_STYLE_ARC_ROUNDED, .value = { .num = (int32_t)val } \ + } + +/** + * Set color of arc. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_ARC_COLOR(val) \ + { \ + .prop = LV_STYLE_ARC_COLOR, .value = { .color = val } \ + } + +/** + * Set opacity of arcs. + * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_ARC_OPA(val) \ + { \ + .prop = LV_STYLE_ARC_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set an image from which arc will be masked out. It's useful to display complex + * effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param val Pointer to image source + */ +#define LV_STYLE_CONST_ARC_IMAGE_SRC(val) \ + { \ + .prop = LV_STYLE_ARC_IMAGE_SRC, .value = { .ptr = val } \ + } + +/** + * Sets color of text. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_TEXT_COLOR(val) \ + { \ + .prop = LV_STYLE_TEXT_COLOR, .value = { .color = val } \ + } + +/** + * Set opacity of text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully + * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values + * or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TEXT_OPA(val) \ + { \ + .prop = LV_STYLE_TEXT_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set font of text (a pointer `lv_font_t *`). + * Default: `LV_FONT_DEFAULT`, inherited: Yes, layout: Yes, ext. draw: No. + * @param val Pointer to font + */ +#define LV_STYLE_CONST_TEXT_FONT(val) \ + { \ + .prop = LV_STYLE_TEXT_FONT, .value = { .ptr = val } \ + } + +/** + * Set letter space in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TEXT_LETTER_SPACE(val) \ + { \ + .prop = LV_STYLE_TEXT_LETTER_SPACE, .value = { .num = (int32_t)val } \ + } + +/** + * Set line space in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TEXT_LINE_SPACE(val) \ + { \ + .prop = LV_STYLE_TEXT_LINE_SPACE, .value = { .num = (int32_t)val } \ + } + +/** + * Set decoration for the text. Possible values are + * `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well. + * Default: `LV_TEXT_DECOR_NONE`, inherited: Yes, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TEXT_DECOR(val) \ + { \ + .prop = LV_STYLE_TEXT_DECOR, .value = { .num = (int32_t)val } \ + } + +/** + * Set how to align the lines of the text. Note that it doesn't align the Widget + * itself, only the lines inside the Widget. Possible values are + * `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base + * direction and uses left or right alignment accordingly. + * Default: `LV_TEXT_ALIGN_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TEXT_ALIGN(val) \ + { \ + .prop = LV_STYLE_TEXT_ALIGN, .value = { .num = (int32_t)val } \ + } + +/** + * Sets the color of letter outline stroke. + * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_TEXT_OUTLINE_STROKE_COLOR(val) \ + { \ + .prop = LV_STYLE_TEXT_OUTLINE_STROKE_COLOR, .value = { .color = val } \ + } + +/** + * Set the letter outline stroke width in pixels. + * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TEXT_OUTLINE_STROKE_WIDTH(val) \ + { \ + .prop = LV_STYLE_TEXT_OUTLINE_STROKE_WIDTH, .value = { .num = (int32_t)val } \ + } + +/** + * Set the opacity of the letter outline stroke. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means + * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TEXT_OUTLINE_STROKE_OPA(val) \ + { \ + .prop = LV_STYLE_TEXT_OUTLINE_STROKE_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set the text leading trim mode. Removes empty space above and/or below text based + * on font metrics (cap-height, x-height, baseline). Similar to CSS `text-box-trim`. + * Possible values are `LV_TEXT_LEADING_TRIM_NONE/CAPITAL_BASELINE/LOWER_BASELINE/CAPITAL/LOWER`. + * Default: `LV_TEXT_LEADING_TRIM_NONE`, inherited: Yes, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_TEXT_LEADING_TRIM(val) \ + { \ + .prop = LV_STYLE_TEXT_LEADING_TRIM, .value = { .num = (int32_t)val } \ + } + +/** + * Sets the intensity of blurring. Applied on each lv_part separately before the + * children are rendered. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BLUR_RADIUS(val) \ + { \ + .prop = LV_STYLE_BLUR_RADIUS, .value = { .num = (int32_t)val } \ + } + +/** + * If `true` the background of the widget will be blurred. The part should have < 100% + * opacity to make it visible. If `false` the given part will be blurred when it's + * rendered but before drawing the children. + * Default: `false`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BLUR_BACKDROP(val) \ + { \ + .prop = LV_STYLE_BLUR_BACKDROP, .value = { .num = (int32_t)val } \ + } + +/** + * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over + * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower + * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. + * Default: `LV_BLUR_QUALITY_AUTO`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BLUR_QUALITY(val) \ + { \ + .prop = LV_STYLE_BLUR_QUALITY, .value = { .num = (int32_t)val } \ + } + +/** + * Sets the intensity of blurring. Applied on each lv_part separately before the + * children are rendered. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_DROP_SHADOW_RADIUS(val) \ + { \ + .prop = LV_STYLE_DROP_SHADOW_RADIUS, .value = { .num = (int32_t)val } \ + } + +/** + * Set an offset on the shadow in pixels in X direction. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_DROP_SHADOW_OFFSET_X(val) \ + { \ + .prop = LV_STYLE_DROP_SHADOW_OFFSET_X, .value = { .num = (int32_t)val } \ + } + +/** + * Set an offset on the shadow in pixels in Y direction. + * Default: `0`, inherited: No, layout: No, ext. draw: Yes. + * @param val Value to submit + */ +#define LV_STYLE_CONST_DROP_SHADOW_OFFSET_Y(val) \ + { \ + .prop = LV_STYLE_DROP_SHADOW_OFFSET_Y, .value = { .num = (int32_t)val } \ + } + +/** + * Set the color of the shadow. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_DROP_SHADOW_COLOR(val) \ + { \ + .prop = LV_STYLE_DROP_SHADOW_COLOR, .value = { .color = val } \ + } + +/** + * Set the opacity of the shadow. + * Default: `0`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_DROP_SHADOW_OPA(val) \ + { \ + .prop = LV_STYLE_DROP_SHADOW_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over + * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower + * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. + * Default: `LV_BLUR_QUALITY_PRECISION`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_DROP_SHADOW_QUALITY(val) \ + { \ + .prop = LV_STYLE_DROP_SHADOW_QUALITY, .value = { .num = (int32_t)val } \ + } + +/** + * Set radius on every corner. The value is interpreted in pixels (>= 0) or + * `LV_RADIUS_CIRCLE` for max radius. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_RADIUS(val) \ + { \ + .prop = LV_STYLE_RADIUS, .value = { .num = (int32_t)val } \ + } + +/** + * Move start point of object (e.g. scale tick) radially. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_RADIAL_OFFSET(val) \ + { \ + .prop = LV_STYLE_RADIAL_OFFSET, .value = { .num = (int32_t)val } \ + } + +/** + * Enable clipping of content that overflows rounded corners of parent Widget. Can be + * `true` or `false`. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_CLIP_CORNER(val) \ + { \ + .prop = LV_STYLE_CLIP_CORNER, .value = { .num = (int32_t)val } \ + } + +/** + * Scale down all opacity values of the Widget by this factor. Value 0, `LV_OPA_0` or + * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means + * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_OPA(val) \ + { \ + .prop = LV_STYLE_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * First draw Widget on the layer, then scale down layer opacity factor. Value 0, + * `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or + * `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc + * means semi transparency. + * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_OPA_LAYERED(val) \ + { \ + .prop = LV_STYLE_OPA_LAYERED, .value = { .num = (int32_t)val } \ + } + +/** + * Mix a color with all colors of the Widget. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param val Pointer to color-filter descriptor + */ +#define LV_STYLE_CONST_COLOR_FILTER_DSC(val) \ + { \ + .prop = LV_STYLE_COLOR_FILTER_DSC, .value = { .ptr = val } \ + } + +/** + * The intensity of mixing of color filter. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_COLOR_FILTER_OPA(val) \ + { \ + .prop = LV_STYLE_COLOR_FILTER_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Set a color to mix to the obj. + * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. + * @param val Color to submit + */ +#define LV_STYLE_CONST_RECOLOR(val) \ + { \ + .prop = LV_STYLE_RECOLOR, .value = { .color = val } \ + } + +/** + * Sets the intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means + * fully transparent. A value of 255, `LV_OPA_100` or `LV_OPA_COVER` means fully + * opaque. Intermediate values like LV_OPA_10, LV_OPA_20, etc result in + * semi-transparency. + * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_RECOLOR_OPA(val) \ + { \ + .prop = LV_STYLE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ + } + +/** + * Animation template for Widget's animation. Should be a pointer to `lv_anim_t`. The + * animation parameters are widget specific, e.g. animation time could be the E.g. + * blink time of the cursor on the Text Area or scroll time of a roller. See Widgets' + * documentation to learn more. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param val Pointer to animation descriptor + */ +#define LV_STYLE_CONST_ANIM(val) \ + { \ + .prop = LV_STYLE_ANIM, .value = { .ptr = val } \ + } + +/** + * Animation duration in milliseconds. Its meaning is widget specific. E.g. blink time + * of the cursor on the Text Area or scroll time of a roller. See Widgets' + * documentation to learn more. + * Default: 0, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_ANIM_DURATION(val) \ + { \ + .prop = LV_STYLE_ANIM_DURATION, .value = { .num = (int32_t)val } \ + } + +/** + * An initialized ``lv_style_transition_dsc_t`` to describe a transition. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param val Pointer to transition descriptor + */ +#define LV_STYLE_CONST_TRANSITION(val) \ + { \ + .prop = LV_STYLE_TRANSITION, .value = { .ptr = val } \ + } + +/** + * Describes how to blend the colors to the background. Possible values are + * `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY/DIFFERENCE`. + * Default: `LV_BLEND_MODE_NORMAL`, inherited: No, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BLEND_MODE(val) \ + { \ + .prop = LV_STYLE_BLEND_MODE, .value = { .num = (int32_t)val } \ + } + +/** + * Set layout of Widget. Children will be repositioned and resized according to + * policies set for the layout. For possible values see documentation of the layouts. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_LAYOUT(val) \ + { \ + .prop = LV_STYLE_LAYOUT, .value = { .num = (int32_t)val } \ + } + +/** + * Set base direction of Widget. Possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`. + * Default: `LV_BASE_DIR_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_BASE_DIR(val) \ + { \ + .prop = LV_STYLE_BASE_DIR, .value = { .num = (int32_t)val } \ + } + +/** + * If set, a layer will be created for the widget and the layer will be masked with + * this A8 bitmap mask. + * Default: `NULL`, inherited: No, layout: No, ext. draw: No. + * @param val Pointer to A8 bitmap mask + */ +#define LV_STYLE_CONST_BITMAP_MASK_SRC(val) \ + { \ + .prop = LV_STYLE_BITMAP_MASK_SRC, .value = { .ptr = val } \ + } + +/** + * Adjust sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the + * rotary to half, 512: speeds up to double, 256: no change. + * Default: `256`, inherited: Yes, layout: No, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_ROTARY_SENSITIVITY(val) \ + { \ + .prop = LV_STYLE_ROTARY_SENSITIVITY, .value = { .num = (int32_t)val } \ + } + +#if LV_USE_FLEX +/** + * Defines in which direction the flex layout should arrange the children. + * Default: `LV_FLEX_FLOW_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_FLEX_FLOW(val) \ + { \ + .prop = LV_STYLE_FLEX_FLOW, .value = { .num = (int32_t)val } \ + } + +/** + * Defines how to align the children in the direction of flex flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_FLEX_MAIN_PLACE(val) \ + { \ + .prop = LV_STYLE_FLEX_MAIN_PLACE, .value = { .num = (int32_t)val } \ + } + +/** + * Defines how to align the children perpendicular to the direction of flex flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_FLEX_CROSS_PLACE(val) \ + { \ + .prop = LV_STYLE_FLEX_CROSS_PLACE, .value = { .num = (int32_t)val } \ + } + +/** + * Defines how to align the tracks of the flow. + * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_FLEX_TRACK_PLACE(val) \ + { \ + .prop = LV_STYLE_FLEX_TRACK_PLACE, .value = { .num = (int32_t)val } \ + } + +/** + * Defines how much space to take proportionally from the free space of the Widget's track. + * Default: `0`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_FLEX_GROW(val) \ + { \ + .prop = LV_STYLE_FLEX_GROW, .value = { .num = (int32_t)val } \ + } + +#endif /* LV_USE_FLEX */ + +#if LV_USE_GRID +/** + * An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. + * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. + * @param val Pointer to grid-column descriptor array + */ +#define LV_STYLE_CONST_GRID_COLUMN_DSC_ARRAY(val) \ + { \ + .prop = LV_STYLE_GRID_COLUMN_DSC_ARRAY, .value = { .ptr = val } \ + } + +/** + * Defines how to distribute the columns. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_GRID_COLUMN_ALIGN(val) \ + { \ + .prop = LV_STYLE_GRID_COLUMN_ALIGN, .value = { .num = (int32_t)val } \ + } + +/** + * An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. + * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. + * @param val Pointer to grid-row descriptor array + */ +#define LV_STYLE_CONST_GRID_ROW_DSC_ARRAY(val) \ + { \ + .prop = LV_STYLE_GRID_ROW_DSC_ARRAY, .value = { .ptr = val } \ + } + +/** + * Defines how to distribute the rows. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_GRID_ROW_ALIGN(val) \ + { \ + .prop = LV_STYLE_GRID_ROW_ALIGN, .value = { .num = (int32_t)val } \ + } + +/** + * Set column in which Widget should be placed. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_GRID_CELL_COLUMN_POS(val) \ + { \ + .prop = LV_STYLE_GRID_CELL_COLUMN_POS, .value = { .num = (int32_t)val } \ + } + +/** + * Set how to align Widget horizontally. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_GRID_CELL_X_ALIGN(val) \ + { \ + .prop = LV_STYLE_GRID_CELL_X_ALIGN, .value = { .num = (int32_t)val } \ + } + +/** + * Set how many columns Widget should span. Needs to be >= 1. + * Default: 1, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_GRID_CELL_COLUMN_SPAN(val) \ + { \ + .prop = LV_STYLE_GRID_CELL_COLUMN_SPAN, .value = { .num = (int32_t)val } \ + } + +/** + * Set row in which Widget should be placed. + * Default: 0, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_GRID_CELL_ROW_POS(val) \ + { \ + .prop = LV_STYLE_GRID_CELL_ROW_POS, .value = { .num = (int32_t)val } \ + } + +/** + * Set how to align Widget vertically. + * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_GRID_CELL_Y_ALIGN(val) \ + { \ + .prop = LV_STYLE_GRID_CELL_Y_ALIGN, .value = { .num = (int32_t)val } \ + } + +/** + * Set how many rows Widget should span. Needs to be >= 1. + * Default: 1, inherited: No, layout: Yes, ext. draw: No. + * @param val Value to submit + */ +#define LV_STYLE_CONST_GRID_CELL_ROW_SPAN(val) \ + { \ + .prop = LV_STYLE_GRID_CELL_ROW_SPAN, .value = { .num = (int32_t)val } \ + } + +#endif /* LV_USE_GRID */ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_STYLE_GEN_H */ diff --git a/include/lvgl/core/lv_style_properties.h b/include/lvgl/core/lv_style_properties.h new file mode 100644 index 0000000000..4adc90f0b1 --- /dev/null +++ b/include/lvgl/core/lv_style_properties.h @@ -0,0 +1,149 @@ + +/** + * GENERATED FILE, DO NOT EDIT IT! + * @file lv_style_properties.h + */ +#ifndef LV_STYLE_PROPERTIES_H +#define LV_STYLE_PROPERTIES_H + +#include "../config/lv_conf_internal.h" +#if LV_USE_OBJ_PROPERTY + + +/* *INDENT-OFF* */ +enum _lv_property_style_id_t { + LV_PROPERTY_ID(STYLE, ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_ALIGN), + LV_PROPERTY_ID(STYLE, ANIM, LV_PROPERTY_TYPE_POINTER, LV_STYLE_ANIM), + LV_PROPERTY_ID(STYLE, ANIM_DURATION, LV_PROPERTY_TYPE_INT, LV_STYLE_ANIM_DURATION), + LV_PROPERTY_ID(STYLE, ARC_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_ARC_COLOR), + LV_PROPERTY_ID(STYLE, ARC_IMAGE_SRC, LV_PROPERTY_TYPE_IMGSRC, LV_STYLE_ARC_IMAGE_SRC), + LV_PROPERTY_ID(STYLE, ARC_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_OPA), + LV_PROPERTY_ID(STYLE, ARC_ROUNDED, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_ROUNDED), + LV_PROPERTY_ID(STYLE, ARC_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_WIDTH), + LV_PROPERTY_ID(STYLE, BASE_DIR, LV_PROPERTY_TYPE_INT, LV_STYLE_BASE_DIR), + LV_PROPERTY_ID(STYLE, BG_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BG_COLOR), + LV_PROPERTY_ID(STYLE, BG_GRAD, LV_PROPERTY_TYPE_POINTER, LV_STYLE_BG_GRAD), + LV_PROPERTY_ID(STYLE, BG_GRAD_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BG_GRAD_COLOR), + LV_PROPERTY_ID(STYLE, BG_GRAD_DIR, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD_DIR), + LV_PROPERTY_ID(STYLE, BG_GRAD_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD_OPA), + LV_PROPERTY_ID(STYLE, BG_GRAD_STOP, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD_STOP), + LV_PROPERTY_ID(STYLE, BG_IMAGE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_IMAGE_OPA), + LV_PROPERTY_ID(STYLE, BG_IMAGE_RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BG_IMAGE_RECOLOR), + LV_PROPERTY_ID(STYLE, BG_IMAGE_RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_IMAGE_RECOLOR_OPA), + LV_PROPERTY_ID(STYLE, BG_IMAGE_SRC, LV_PROPERTY_TYPE_IMGSRC, LV_STYLE_BG_IMAGE_SRC), + LV_PROPERTY_ID(STYLE, BG_IMAGE_TILED, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_IMAGE_TILED), + LV_PROPERTY_ID(STYLE, BG_MAIN_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_MAIN_OPA), + LV_PROPERTY_ID(STYLE, BG_MAIN_STOP, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_MAIN_STOP), + LV_PROPERTY_ID(STYLE, BG_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_OPA), + LV_PROPERTY_ID(STYLE, BITMAP_MASK_SRC, LV_PROPERTY_TYPE_POINTER, LV_STYLE_BITMAP_MASK_SRC), + LV_PROPERTY_ID(STYLE, BLEND_MODE, LV_PROPERTY_TYPE_INT, LV_STYLE_BLEND_MODE), + LV_PROPERTY_ID(STYLE, BLUR_BACKDROP, LV_PROPERTY_TYPE_INT, LV_STYLE_BLUR_BACKDROP), + LV_PROPERTY_ID(STYLE, BLUR_QUALITY, LV_PROPERTY_TYPE_INT, LV_STYLE_BLUR_QUALITY), + LV_PROPERTY_ID(STYLE, BLUR_RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_BLUR_RADIUS), + LV_PROPERTY_ID(STYLE, BORDER_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BORDER_COLOR), + LV_PROPERTY_ID(STYLE, BORDER_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_OPA), + LV_PROPERTY_ID(STYLE, BORDER_POST, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_POST), + LV_PROPERTY_ID(STYLE, BORDER_SIDE, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_SIDE), + LV_PROPERTY_ID(STYLE, BORDER_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_WIDTH), + LV_PROPERTY_ID(STYLE, CLIP_CORNER, LV_PROPERTY_TYPE_INT, LV_STYLE_CLIP_CORNER), + LV_PROPERTY_ID(STYLE, COLOR_FILTER_DSC, LV_PROPERTY_TYPE_POINTER, LV_STYLE_COLOR_FILTER_DSC), + LV_PROPERTY_ID(STYLE, COLOR_FILTER_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_COLOR_FILTER_OPA), + LV_PROPERTY_ID(STYLE, DROP_SHADOW_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_DROP_SHADOW_COLOR), + LV_PROPERTY_ID(STYLE, DROP_SHADOW_OFFSET_X, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_OFFSET_X), + LV_PROPERTY_ID(STYLE, DROP_SHADOW_OFFSET_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_OFFSET_Y), + LV_PROPERTY_ID(STYLE, DROP_SHADOW_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_OPA), + LV_PROPERTY_ID(STYLE, DROP_SHADOW_QUALITY, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_QUALITY), + LV_PROPERTY_ID(STYLE, DROP_SHADOW_RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_RADIUS), + LV_PROPERTY_ID(STYLE, FLEX_CROSS_PLACE, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_CROSS_PLACE), + LV_PROPERTY_ID(STYLE, FLEX_FLOW, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_FLOW), + LV_PROPERTY_ID(STYLE, FLEX_GROW, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_GROW), + LV_PROPERTY_ID(STYLE, FLEX_MAIN_PLACE, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_MAIN_PLACE), + LV_PROPERTY_ID(STYLE, FLEX_TRACK_PLACE, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_TRACK_PLACE), + LV_PROPERTY_ID(STYLE, GRID_CELL_COLUMN_POS, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_COLUMN_POS), + LV_PROPERTY_ID(STYLE, GRID_CELL_COLUMN_SPAN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_COLUMN_SPAN), + LV_PROPERTY_ID(STYLE, GRID_CELL_ROW_POS, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_ROW_POS), + LV_PROPERTY_ID(STYLE, GRID_CELL_ROW_SPAN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_ROW_SPAN), + LV_PROPERTY_ID(STYLE, GRID_CELL_X_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_X_ALIGN), + LV_PROPERTY_ID(STYLE, GRID_CELL_Y_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_Y_ALIGN), + LV_PROPERTY_ID(STYLE, GRID_COLUMN_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_COLUMN_ALIGN), + LV_PROPERTY_ID(STYLE, GRID_COLUMN_DSC_ARRAY, LV_PROPERTY_TYPE_POINTER, LV_STYLE_GRID_COLUMN_DSC_ARRAY), + LV_PROPERTY_ID(STYLE, GRID_ROW_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_ROW_ALIGN), + LV_PROPERTY_ID(STYLE, GRID_ROW_DSC_ARRAY, LV_PROPERTY_TYPE_POINTER, LV_STYLE_GRID_ROW_DSC_ARRAY), + LV_PROPERTY_ID(STYLE, HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_HEIGHT), + LV_PROPERTY_ID(STYLE, IMAGE_COLORKEY, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_COLORKEY), + LV_PROPERTY_ID(STYLE, IMAGE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_OPA), + LV_PROPERTY_ID(STYLE, IMAGE_RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_IMAGE_RECOLOR), + LV_PROPERTY_ID(STYLE, IMAGE_RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_RECOLOR_OPA), + LV_PROPERTY_ID(STYLE, LAST_BUILT_IN_PROP, LV_PROPERTY_TYPE_INVALID, LV_STYLE_LAST_BUILT_IN_PROP), + LV_PROPERTY_ID(STYLE, LAYOUT, LV_PROPERTY_TYPE_INT, LV_STYLE_LAYOUT), + LV_PROPERTY_ID(STYLE, LENGTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LENGTH), + LV_PROPERTY_ID(STYLE, LINE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_LINE_COLOR), + LV_PROPERTY_ID(STYLE, LINE_DASH_GAP, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_DASH_GAP), + LV_PROPERTY_ID(STYLE, LINE_DASH_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_DASH_WIDTH), + LV_PROPERTY_ID(STYLE, LINE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_OPA), + LV_PROPERTY_ID(STYLE, LINE_ROUNDED, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_ROUNDED), + LV_PROPERTY_ID(STYLE, LINE_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_WIDTH), + LV_PROPERTY_ID(STYLE, MARGIN_BOTTOM, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_BOTTOM), + LV_PROPERTY_ID(STYLE, MARGIN_LEFT, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_LEFT), + LV_PROPERTY_ID(STYLE, MARGIN_RIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_RIGHT), + LV_PROPERTY_ID(STYLE, MARGIN_TOP, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_TOP), + LV_PROPERTY_ID(STYLE, MAX_HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_MAX_HEIGHT), + LV_PROPERTY_ID(STYLE, MAX_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_MAX_WIDTH), + LV_PROPERTY_ID(STYLE, MIN_HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_MIN_HEIGHT), + LV_PROPERTY_ID(STYLE, MIN_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_MIN_WIDTH), + LV_PROPERTY_ID(STYLE, OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_OPA), + LV_PROPERTY_ID(STYLE, OPA_LAYERED, LV_PROPERTY_TYPE_INT, LV_STYLE_OPA_LAYERED), + LV_PROPERTY_ID(STYLE, OUTLINE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_OUTLINE_COLOR), + LV_PROPERTY_ID(STYLE, OUTLINE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_OUTLINE_OPA), + LV_PROPERTY_ID(STYLE, OUTLINE_PAD, LV_PROPERTY_TYPE_INT, LV_STYLE_OUTLINE_PAD), + LV_PROPERTY_ID(STYLE, OUTLINE_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_OUTLINE_WIDTH), + LV_PROPERTY_ID(STYLE, PAD_BOTTOM, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_BOTTOM), + LV_PROPERTY_ID(STYLE, PAD_COLUMN, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_COLUMN), + LV_PROPERTY_ID(STYLE, PAD_LEFT, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_LEFT), + LV_PROPERTY_ID(STYLE, PAD_RADIAL, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_RADIAL), + LV_PROPERTY_ID(STYLE, PAD_RIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_RIGHT), + LV_PROPERTY_ID(STYLE, PAD_ROW, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_ROW), + LV_PROPERTY_ID(STYLE, PAD_TOP, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_TOP), + LV_PROPERTY_ID(STYLE, PROP_INV, LV_PROPERTY_TYPE_INVALID, LV_STYLE_PROP_INV), + LV_PROPERTY_ID(STYLE, RADIAL_OFFSET, LV_PROPERTY_TYPE_INT, LV_STYLE_RADIAL_OFFSET), + LV_PROPERTY_ID(STYLE, RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_RADIUS), + LV_PROPERTY_ID(STYLE, RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_RECOLOR), + LV_PROPERTY_ID(STYLE, RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_RECOLOR_OPA), + LV_PROPERTY_ID(STYLE, ROTARY_SENSITIVITY, LV_PROPERTY_TYPE_INT, LV_STYLE_ROTARY_SENSITIVITY), + LV_PROPERTY_ID(STYLE, SHADOW_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_SHADOW_COLOR), + LV_PROPERTY_ID(STYLE, SHADOW_OFFSET_X, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_OFFSET_X), + LV_PROPERTY_ID(STYLE, SHADOW_OFFSET_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_OFFSET_Y), + LV_PROPERTY_ID(STYLE, SHADOW_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_OPA), + LV_PROPERTY_ID(STYLE, SHADOW_SPREAD, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_SPREAD), + LV_PROPERTY_ID(STYLE, SHADOW_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_WIDTH), + LV_PROPERTY_ID(STYLE, TEXT_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_ALIGN), + LV_PROPERTY_ID(STYLE, TEXT_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_TEXT_COLOR), + LV_PROPERTY_ID(STYLE, TEXT_DECOR, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_DECOR), + LV_PROPERTY_ID(STYLE, TEXT_FONT, LV_PROPERTY_TYPE_FONT, LV_STYLE_TEXT_FONT), + LV_PROPERTY_ID(STYLE, TEXT_LEADING_TRIM, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_LEADING_TRIM), + LV_PROPERTY_ID(STYLE, TEXT_LETTER_SPACE, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_LETTER_SPACE), + LV_PROPERTY_ID(STYLE, TEXT_LINE_SPACE, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_LINE_SPACE), + LV_PROPERTY_ID(STYLE, TEXT_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_OPA), + LV_PROPERTY_ID(STYLE, TEXT_OUTLINE_STROKE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_TEXT_OUTLINE_STROKE_COLOR), + LV_PROPERTY_ID(STYLE, TEXT_OUTLINE_STROKE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_OUTLINE_STROKE_OPA), + LV_PROPERTY_ID(STYLE, TEXT_OUTLINE_STROKE_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_OUTLINE_STROKE_WIDTH), + LV_PROPERTY_ID(STYLE, TRANSFORM_HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_HEIGHT), + LV_PROPERTY_ID(STYLE, TRANSFORM_PIVOT_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_PIVOT_X), + LV_PROPERTY_ID(STYLE, TRANSFORM_PIVOT_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_PIVOT_Y), + LV_PROPERTY_ID(STYLE, TRANSFORM_ROTATION, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_ROTATION), + LV_PROPERTY_ID(STYLE, TRANSFORM_SCALE_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SCALE_X), + LV_PROPERTY_ID(STYLE, TRANSFORM_SCALE_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SCALE_Y), + LV_PROPERTY_ID(STYLE, TRANSFORM_SKEW_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SKEW_X), + LV_PROPERTY_ID(STYLE, TRANSFORM_SKEW_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SKEW_Y), + LV_PROPERTY_ID(STYLE, TRANSFORM_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_WIDTH), + LV_PROPERTY_ID(STYLE, TRANSITION, LV_PROPERTY_TYPE_POINTER, LV_STYLE_TRANSITION), + LV_PROPERTY_ID(STYLE, TRANSLATE_RADIAL, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSLATE_RADIAL), + LV_PROPERTY_ID(STYLE, TRANSLATE_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSLATE_X), + LV_PROPERTY_ID(STYLE, TRANSLATE_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSLATE_Y), + LV_PROPERTY_ID(STYLE, WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_WIDTH), + LV_PROPERTY_ID(STYLE, X, LV_PROPERTY_TYPE_INT, LV_STYLE_X), + LV_PROPERTY_ID(STYLE, Y, LV_PROPERTY_TYPE_INT, LV_STYLE_Y), +}; + +#endif +#endif diff --git a/include/lvgl/core/lv_timer.h b/include/lvgl/core/lv_timer.h new file mode 100644 index 0000000000..372234c80e --- /dev/null +++ b/include/lvgl/core/lv_timer.h @@ -0,0 +1,221 @@ +/** + * @file lv_timer.h + */ + +#ifndef LV_TIMER_H +#define LV_TIMER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ +#ifndef LV_ATTRIBUTE_TIMER_HANDLER +#define LV_ATTRIBUTE_TIMER_HANDLER +#endif + +#define LV_NO_TIMER_READY 0xFFFFFFFF + +/********************** + * TYPEDEFS + **********************/ + +/** + * Timers execute this type of functions. + */ +typedef void (*lv_timer_cb_t)(lv_timer_t *); + +/** + * Timer handler resume this type of function. + */ +typedef void (*lv_timer_handler_resume_cb_t)(void * data); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Call it periodically to handle lv_timers. + * @return time till it needs to be run next (in ms) + */ +LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void); + +/** + * Call it in the super-loop of main() or threads. It will run lv_timer_handler() + * with a given period in ms. You can use it with sleep or delay in OS environment. + * This function is used to simplify the porting. + * @param period the period for running lv_timer_handler() + * @return the time after which it must be called again + */ +LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler_run_in_period(uint32_t period); + +/** + * Call it in the super-loop of main() or threads. It will automatically call lv_timer_handler() at the right time. + * This function is used to simplify the porting. + */ +LV_ATTRIBUTE_TIMER_HANDLER void lv_timer_periodic_handler(void); + +/** + * Set the resume callback to the timer handler + * @param cb the function to call when timer handler is resumed + * @param data pointer to a resume data + */ +void lv_timer_handler_set_resume_cb(lv_timer_handler_resume_cb_t cb, void * data); + +/** + * Create an "empty" timer. It needs to be initialized with at least + * `lv_timer_set_cb` and `lv_timer_set_period` + * @return pointer to the created timer + */ +lv_timer_t * lv_timer_create_basic(void); + +/** + * Create a new lv_timer + * @param timer_xcb a callback to call periodically. + * (the 'x' in the argument name indicates that it's not a fully generic function because it not follows + * the `func_name(object, callback, ...)` convention) + * @param period call period in ms unit + * @param user_data custom parameter + * @return pointer to the new timer + */ +lv_timer_t * lv_timer_create(lv_timer_cb_t timer_xcb, uint32_t period, void * user_data); + +/** + * Delete a lv_timer + * @param timer pointer to an lv_timer + */ +void lv_timer_delete(lv_timer_t * timer); + +/** + * Pause a timer. + * It is typically safe to call from an interrupt handler or a different thread. + * @param timer pointer to an lv_timer + */ +void lv_timer_pause(lv_timer_t * timer); + +/** + * Resume a timer. + * @param timer pointer to an lv_timer + */ +void lv_timer_resume(lv_timer_t * timer); + +/** + * Set the callback to the timer (the function to call periodically) + * @param timer pointer to a timer + * @param timer_cb the function to call periodically + */ +void lv_timer_set_cb(lv_timer_t * timer, lv_timer_cb_t timer_cb); + +/** + * Set new period for a lv_timer + * @param timer pointer to a lv_timer + * @param period the new period + */ +void lv_timer_set_period(lv_timer_t * timer, uint32_t period); + +/** + * Make a lv_timer ready. It will not wait its period. + * @param timer pointer to a lv_timer. + */ +void lv_timer_ready(lv_timer_t * timer); + +/** + * Set the number of times a timer will repeat. + * @param timer pointer to a lv_timer. + * @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times + */ +void lv_timer_set_repeat_count(lv_timer_t * timer, int32_t repeat_count); + +/** + * Set whether a lv_timer will be deleted automatically when it is called `repeat_count` times. + * @param timer pointer to a lv_timer. + * @param auto_delete true: auto delete; false: timer will be paused when it is called `repeat_count` times. + */ +void lv_timer_set_auto_delete(lv_timer_t * timer, bool auto_delete); + +/** + * Set custom parameter to the lv_timer. + * @param timer pointer to a lv_timer. + * @param user_data custom parameter + */ +void lv_timer_set_user_data(lv_timer_t * timer, void * user_data); + +/** + * Reset a lv_timer. + * It will be called the previously set period milliseconds later. + * @param timer pointer to a lv_timer. + */ +void lv_timer_reset(lv_timer_t * timer); + +/** + * Enable or disable the whole lv_timer handling + * @param en true: lv_timer handling is running, false: lv_timer handling is suspended + */ +void lv_timer_enable(bool en); + +/** + * Get idle percentage + * @return the lv_timer idle in percentage + */ +uint32_t lv_timer_get_idle(void); + +/** + * Get the time remaining until the next timer will run + * @return the time remaining in ms + */ +uint32_t lv_timer_get_time_until_next(void); + +/** + * Iterate through the timers + * @param timer NULL to start iteration or the previous return value to get the next timer + * @return the next timer or NULL if there is no more timer + */ +lv_timer_t * lv_timer_get_next(lv_timer_t * timer); + +/** + * Get the user_data passed when the timer was created + * @param timer pointer to the lv_timer + * @return pointer to the user_data + */ +void * lv_timer_get_user_data(lv_timer_t * timer); + +/** + * Get the pause state of a timer + * @param timer pointer to a lv_timer + * @return true: timer is paused; false: timer is running + */ +bool lv_timer_get_paused(lv_timer_t * timer); + +#if LV_USE_EXT_DATA +/** + * @brief Attaches external user data and destructor callback to a timer object + * + * Associates custom user data with an LVGL timer and specifies a destructor function + * that will be automatically invoked when the timer is deleted to properly clean up + * the associated resources. + * + * @param timer Pointer to the timer object + * @param data User-defined data pointer to associate with the timer + * @param destructor Callback function for cleaning up ext_data when timer is deleted. + * Receives ext_data as parameter. NULL means no cleanup required. + */ +void lv_timer_set_external_data(lv_timer_t * timer, void * data, void (* free_cb)(void * data)); +#endif + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif diff --git a/include/lvgl/core/lv_translation.h b/include/lvgl/core/lv_translation.h new file mode 100644 index 0000000000..8c87209d35 --- /dev/null +++ b/include/lvgl/core/lv_translation.h @@ -0,0 +1,147 @@ +/** + * @file lv_translation.h + * + */ + +#ifndef LV_TRANSLATION_H +#define LV_TRANSLATION_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_TRANSLATION + +#include LV_STDINT_INCLUDE +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the translation module + */ +void lv_translation_init(void); + +/** + * De-initialize the translation module and free all allocated translations + */ +void lv_translation_deinit(void); + +/** + * Register a translation pack from static arrays. + * All the pointers need to be static, that is to live while they are used + * @param languages List of languages. E.g. `{"en", "de", NULL}` + * @param tags Tags that are using in the UI. E.g. `{"dog", "cat", NULL}` + * @param translations List of translations. E.g. `{"Dog", "Cat", "Hund", "Katze"}` + * @return The created pack + */ +lv_translation_pack_t * lv_translation_add_static(const char * const languages[], const char * const tags[], + const char * const translations[]); + +/** + * Add a pack to which translations can be added dynamically. + * `pack->languages` needs to be a malloc-ed array where each language is also malloc-ed as an element. + * `pack->translation_array` stores the translation having `lv_translation_tag_dsc_t` items + * In each array element `tag` is a malloced string, `translations` is a malloc-ed array + * with malloc-ed array for each element. + * @return the created pack to which data can be added manually. + */ +lv_translation_pack_t * lv_translation_add_dynamic(void); + +/** + * Select the current language + * The `LV_EVENT_TRANSLATION_LANGUAGE_CHANGED` event will be sent to every widget + * @param lang a string from the defined languages. E.g. "en" or "de" + */ +void lv_translation_set_language(const char * lang); + +/** + * Get the current selected language + * @return the current selected language + */ +const char * lv_translation_get_language(void); + +/** + * Get the translated version of a tag on the selected language + * @param tag the tag to translate + * @return the translation + * @note fallback rules: + * - if the tag is found on the selected language return it + * - if the tag is not found on the selected language, use the fist language + * - if the tag is not found on the first language, return the tag + */ +const char * lv_translation_get(const char * tag); + +/** + * Shorthand of lv_translation_set_language + * @param tag the tag to translate + * @return the translation + */ +static inline const char * lv_tr(const char * tag) +{ + return lv_translation_get(tag); +} + +/** + * Add a new language to a dynamic language pack. + * All languages should be added before adding tags + * @param pack pointer to a dynamic translation pack + * @param lang language to add, e.g. "en", or "de" + * @return LV_RESULT_OK: success, LV_RESULT_INVALID: failed + */ +lv_result_t lv_translation_add_language(lv_translation_pack_t * pack, const char * lang); + +/** + * Get the index of a language in a pack. + * @param pack pointer to a static or dynamic language pack + * @param lang_name name of the language to find + * @return index of the language or -1 if not found. + */ +int32_t lv_translation_get_language_index(lv_translation_pack_t * pack, const char * lang_name); + +/** + * Add a new tag to a dynamic language pack. + * Once the tag is added the translations for each language can be added too by using + * `lv_translation_set_tag_translation` + * @param pack pointer to a dynamic translation pack + * @param tag_name name of the tag, e.g. "dog", or "house" + * @return pointer to the allocated tag descriptor + */ +lv_translation_tag_dsc_t * lv_translation_add_tag(lv_translation_pack_t * pack, const char * tag_name); + +/** + * Add a translation to a tag in a dynamic translation pack + * @param pack pointer to a dynamic translation pack + * @param tag return value of `lv_translation_add_tag` + * @param lang_idx index of the language for which translation should be set + * @param trans the translation on the given language + * @return LV_RESULT_OK: success, LV_RESULT_INVALID: failed + */ +lv_result_t lv_translation_set_tag_translation(lv_translation_pack_t * pack, lv_translation_tag_dsc_t * tag, + uint32_t lang_idx, const char * trans); + +/********************** + * MACROS + **********************/ +#endif /*LV_USE_TRANSLATION*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TRANSLATION_H*/ diff --git a/include/lvgl/debugging/lv_assert.h b/include/lvgl/debugging/lv_assert.h new file mode 100644 index 0000000000..3c6794c557 --- /dev/null +++ b/include/lvgl/debugging/lv_assert.h @@ -0,0 +1,87 @@ +/** + * @file lv_assert.h + * + */ + +#ifndef LV_ASSERT_H +#define LV_ASSERT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../logging/lv_log.h" +#include "../stdlib/lv_mem.h" +#include LV_ASSERT_HANDLER_INCLUDE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#define LV_ASSERT(expr) \ + do { \ + if(!(expr)) { \ + LV_LOG_ERROR("Asserted at expression: %s", #expr); \ + LV_ASSERT_HANDLER \ + } \ + } while(0) + +#define LV_ASSERT_MSG(expr, msg) \ + do { \ + if(!(expr)) { \ + LV_LOG_ERROR("Asserted at expression: %s (%s)", #expr, msg); \ + LV_ASSERT_HANDLER \ + } \ + } while(0) + +#define LV_ASSERT_FORMAT_MSG(expr, format, ...) \ + do { \ + if(!(expr)) { \ + LV_LOG_ERROR("Asserted at expression: %s " format , #expr, __VA_ARGS__); \ + LV_ASSERT_HANDLER \ + } \ + } while(0) + +/*----------------- + * ASSERTS + *-----------------*/ + +#if LV_USE_ASSERT_NULL +# define LV_ASSERT_NULL(p) LV_ASSERT_MSG(p != NULL, "NULL pointer"); +#else +# define LV_ASSERT_NULL(p) +#endif + +#if LV_USE_ASSERT_MALLOC +# define LV_ASSERT_MALLOC(p) LV_ASSERT_MSG(p != NULL, "Out of memory"); +#else +# define LV_ASSERT_MALLOC(p) +#endif + +#if LV_USE_ASSERT_MEM_INTEGRITY +# define LV_ASSERT_MEM_INTEGRITY() LV_ASSERT_MSG(lv_mem_test() == LV_RESULT_OK, "Memory integrity error"); +#else +# define LV_ASSERT_MEM_INTEGRITY() +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ASSERT_H*/ diff --git a/include/lvgl/debugging/lv_check_arg.h b/include/lvgl/debugging/lv_check_arg.h new file mode 100644 index 0000000000..c63a7b6fbd --- /dev/null +++ b/include/lvgl/debugging/lv_check_arg.h @@ -0,0 +1,109 @@ +/** + * @file lv_check_arg.h + * + */ + +#ifndef LV_CHECK_ARG_H +#define LV_CHECK_ARG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../logging/lv_log.h" +#include "lv_assert.h" + +/********************* + * DEFINES + *********************/ + +#if defined(__GNUC__) || defined(__clang__) +#define LV_LIKELY(x) (__builtin_expect(!!(x), 1)) +#define LV_UNLIKELY(x) (__builtin_expect(!!(x), 0)) +#else +#define LV_LIKELY(x) (x) +#define LV_UNLIKELY(x) (x) +#endif + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#if LV_USE_CHECK_ARG + +#if LV_CHECK_ARG_ASSERT_ON_FAIL + +/** + * Internal macro: checks a condition, logs a warning, calls the assert handler, + * and then executes the specified action on failure. + * Do not use directly; use LV_CHECK_ARG instead. + */ +#define LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...) \ + if(LV_UNLIKELY(!(cond))) { \ + LV_LOG_WARN("Check failed: " cond_str " " __VA_ARGS__); \ + LV_ASSERT_HANDLER \ + action_on_fail; \ + } else {} + +#else + +/** + * Internal macro: checks a condition, logs a warning, and executes the + * specified action on failure. + * Do not use directly; use LV_CHECK_ARG instead. + */ +#define LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...) \ + if(LV_UNLIKELY(!(cond))) { \ + LV_LOG_WARN("Check failed: " cond_str " " __VA_ARGS__); \ + action_on_fail; \ + } else {} + +#endif /*LV_CHECK_ARG_ASSERT_ON_FAIL*/ + +#else + +/** LV_CHECK_ARG is disabled; all checks compile to nothing. */ +#define LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...) ((void)0) + +#endif /*LV_USE_CHECK_ARG*/ + +/** + * Check that a condition is true. If the condition is false, log a warning + * and execute `action_on_fail` (e.g. `return`, `return val`, `break`). + * Additional printf-style arguments are appended to the log message. + * + * Can be disabled entirely by setting LV_USE_CHECK_ARG to 0 in lv_conf.h. + * If LV_CHECK_ARG_ASSERT_ON_FAIL is 1, LV_ASSERT_HANDLER is also invoked + * before the action. + * + * Example: + * @code + * LV_CHECK_ARG(ptr != NULL, return, "pointer must not be NULL"); + * LV_CHECK_ARG(len > 0, return -1, "len=%d", (int)len); + * @endcode + * + * @param cond condition to check + * @param action_on_fail statement to execute on failure (e.g. `return`, `return 0`, `break`) + * @param ... optional printf-style format string and arguments appended to the log + */ +#define LV_CHECK_ARG(cond, action_on_fail, ...) \ + LV_CHECK_ARG_INTERNAL_(cond, #cond, action_on_fail, __VA_ARGS__) + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CHECK_ARG_H*/ + diff --git a/include/lvgl/debugging/lv_monkey.h b/include/lvgl/debugging/lv_monkey.h new file mode 100644 index 0000000000..0efaa11c00 --- /dev/null +++ b/include/lvgl/debugging/lv_monkey.h @@ -0,0 +1,119 @@ +/** + * @file lv_monkey.h + * + */ +#ifndef LV_MONKEY_H +#define LV_MONKEY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../indev/lv_indev.h" + +#if LV_USE_MONKEY + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct _lv_monkey_t lv_monkey_t; + +typedef struct { + int32_t min; + int32_t max; +} lv_range_t; + +typedef struct { + uint32_t min; + uint32_t max; +} lv_urange_t; + +struct _lv_monkey_config_t { + /** Input device type */ + lv_indev_type_t type; + + /** Monkey execution period */ + lv_urange_t period_range; + + /** The range of input value */ + lv_range_t input_range; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a monkey config with default values + * @param config pointer to 'lv_monkey_config_t' variable to initialize + */ +void lv_monkey_config_init(lv_monkey_config_t * config); + +/** + * Create monkey for test + * @param config pointer to 'lv_monkey_config_t' variable + * @return pointer to the created monkey + */ +lv_monkey_t * lv_monkey_create(const lv_monkey_config_t * config); + +/** + * Get monkey input device + * @param monkey pointer to a monkey + * @return pointer to the input device + */ +lv_indev_t * lv_monkey_get_indev(lv_monkey_t * monkey); + +/** + * Enable monkey + * @param monkey pointer to a monkey + * @param en set to true to enable + */ +void lv_monkey_set_enable(lv_monkey_t * monkey, bool en); + +/** + * Get whether monkey is enabled + * @param monkey pointer to a monkey + * @return return true if monkey enabled + */ +bool lv_monkey_get_enable(lv_monkey_t * monkey); + +/** + * Set the user_data field of the monkey + * @param monkey pointer to a monkey + * @param user_data pointer to the new user_data. + */ +void lv_monkey_set_user_data(lv_monkey_t * monkey, void * user_data); + +/** + * Get the user_data field of the monkey + * @param monkey pointer to a monkey + * @return the pointer to the user_data of the monkey + */ +void * lv_monkey_get_user_data(lv_monkey_t * monkey); + +/** + * Delete monkey + * @param monkey pointer to monkey + */ +void lv_monkey_delete(lv_monkey_t * monkey); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_MONKEY*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_MONKEY_H*/ diff --git a/include/lvgl/debugging/lv_profiler.h b/include/lvgl/debugging/lv_profiler.h new file mode 100644 index 0000000000..9749def2e3 --- /dev/null +++ b/include/lvgl/debugging/lv_profiler.h @@ -0,0 +1,184 @@ +/** + * @file lv_profiler.h + * + */ + +#ifndef LV_PROFILER_H +#define LV_PROFILER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" + +#if LV_USE_PROFILER + +#include LV_PROFILER_INCLUDE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#else + +#define LV_PROFILER_BEGIN +#define LV_PROFILER_END +#define LV_PROFILER_BEGIN_TAG(tag) LV_UNUSED(tag) +#define LV_PROFILER_END_TAG(tag) LV_UNUSED(tag) + +#endif /*LV_USE_PROFILER*/ + +#if LV_USE_PROFILER && LV_PROFILER_LAYOUT +#define LV_PROFILER_LAYOUT_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_LAYOUT_END LV_PROFILER_END +#define LV_PROFILER_LAYOUT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_LAYOUT_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_LAYOUT_BEGIN +#define LV_PROFILER_LAYOUT_END +#define LV_PROFILER_LAYOUT_BEGIN_TAG(tag) +#define LV_PROFILER_LAYOUT_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_STYLE +#define LV_PROFILER_STYLE_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_STYLE_END LV_PROFILER_END +#define LV_PROFILER_STYLE_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_STYLE_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_STYLE_BEGIN +#define LV_PROFILER_STYLE_END +#define LV_PROFILER_STYLE_BEGIN_TAG(tag) +#define LV_PROFILER_STYLE_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_DRAW +#define LV_PROFILER_DRAW_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_DRAW_END LV_PROFILER_END +#define LV_PROFILER_DRAW_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_DRAW_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_DRAW_BEGIN +#define LV_PROFILER_DRAW_END +#define LV_PROFILER_DRAW_BEGIN_TAG(tag) +#define LV_PROFILER_DRAW_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_DECODER +#define LV_PROFILER_DECODER_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_DECODER_END LV_PROFILER_END +#define LV_PROFILER_DECODER_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_DECODER_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_DECODER_BEGIN +#define LV_PROFILER_DECODER_END +#define LV_PROFILER_DECODER_BEGIN_TAG(tag) +#define LV_PROFILER_DECODER_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_REFR +#define LV_PROFILER_REFR_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_REFR_END LV_PROFILER_END +#define LV_PROFILER_REFR_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_REFR_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_REFR_BEGIN +#define LV_PROFILER_REFR_END +#define LV_PROFILER_REFR_BEGIN_TAG(tag) +#define LV_PROFILER_REFR_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_INDEV +#define LV_PROFILER_INDEV_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_INDEV_END LV_PROFILER_END +#define LV_PROFILER_INDEV_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_INDEV_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_INDEV_BEGIN +#define LV_PROFILER_INDEV_END +#define LV_PROFILER_INDEV_BEGIN_TAG(tag) +#define LV_PROFILER_INDEV_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_FONT +#define LV_PROFILER_FONT_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_FONT_END LV_PROFILER_END +#define LV_PROFILER_FONT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_FONT_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_FONT_BEGIN +#define LV_PROFILER_FONT_END +#define LV_PROFILER_FONT_BEGIN_TAG(tag) +#define LV_PROFILER_FONT_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_CACHE +#define LV_PROFILER_CACHE_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_CACHE_END LV_PROFILER_END +#define LV_PROFILER_CACHE_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_CACHE_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_CACHE_BEGIN +#define LV_PROFILER_CACHE_END +#define LV_PROFILER_CACHE_BEGIN_TAG(tag) +#define LV_PROFILER_CACHE_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_FS +#define LV_PROFILER_FS_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_FS_END LV_PROFILER_END +#define LV_PROFILER_FS_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_FS_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_FS_BEGIN +#define LV_PROFILER_FS_END +#define LV_PROFILER_FS_BEGIN_TAG(tag) +#define LV_PROFILER_FS_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_TIMER +#define LV_PROFILER_TIMER_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_TIMER_END LV_PROFILER_END +#define LV_PROFILER_TIMER_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_TIMER_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_TIMER_BEGIN +#define LV_PROFILER_TIMER_END +#define LV_PROFILER_TIMER_BEGIN_TAG(tag) +#define LV_PROFILER_TIMER_END_TAG(tag) +#endif + +#if LV_USE_PROFILER && LV_PROFILER_EVENT +#define LV_PROFILER_EVENT_BEGIN LV_PROFILER_BEGIN +#define LV_PROFILER_EVENT_END LV_PROFILER_END +#define LV_PROFILER_EVENT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) +#define LV_PROFILER_EVENT_END_TAG(tag) LV_PROFILER_END_TAG(tag) +#else +#define LV_PROFILER_EVENT_BEGIN +#define LV_PROFILER_EVENT_END +#define LV_PROFILER_EVENT_BEGIN_TAG(tag) +#define LV_PROFILER_EVENT_END_TAG(tag) +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_PROFILER_H*/ diff --git a/include/lvgl/debugging/lv_profiler_builtin.h b/include/lvgl/debugging/lv_profiler_builtin.h new file mode 100644 index 0000000000..40b59ea519 --- /dev/null +++ b/include/lvgl/debugging/lv_profiler_builtin.h @@ -0,0 +1,85 @@ +/** + * @file lv_profiler_builtin.h + * + */ + +#ifndef LV_PROFILER_BUILTIN_H +#define LV_PROFILER_BUILTIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" + +#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +#define LV_PROFILER_BUILTIN_BEGIN_TAG(tag) lv_profiler_builtin_write((tag), 'B') +#define LV_PROFILER_BUILTIN_END_TAG(tag) lv_profiler_builtin_write((tag), 'E') +#define LV_PROFILER_BUILTIN_BEGIN LV_PROFILER_BUILTIN_BEGIN_TAG(__func__) +#define LV_PROFILER_BUILTIN_END LV_PROFILER_BUILTIN_END_TAG(__func__) + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Initialize the configuration of the built-in profiler + * @param config Pointer to the configuration structure of the built-in profiler + */ +void lv_profiler_builtin_config_init(lv_profiler_builtin_config_t * config); + +/** + * @brief Initialize the built-in profiler with the given configuration + * @param config Pointer to the configuration structure of the built-in profiler + */ +void lv_profiler_builtin_init(const lv_profiler_builtin_config_t * config); + +/** + * @brief Uninitialize the built-in profiler + */ +void lv_profiler_builtin_uninit(void); + +/** + * @brief Enable or disable the built-in profiler + * @param enable true to enable the built-in profiler, false to disable + */ +void lv_profiler_builtin_set_enable(bool enable); + +/** + * @brief Flush the profiling data to the console + */ +void lv_profiler_builtin_flush(void); + +/** + * @brief Write the profiling data for a function with the given tag + * @param func Name of the function being profiled + * @param tag Tag to associate with the profiling data for the function + */ +void lv_profiler_builtin_write(const char * func, char tag); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_PROFILER_BUILTIN*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_PROFILER_BUILTIN_H*/ diff --git a/include/lvgl/debugging/lv_sysmon.h b/include/lvgl/debugging/lv_sysmon.h new file mode 100644 index 0000000000..32617e8c78 --- /dev/null +++ b/include/lvgl/debugging/lv_sysmon.h @@ -0,0 +1,113 @@ +/** + * @file lv_sysmon.h + * + */ + +#ifndef LV_SYSMON_H +#define LV_SYSMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../core/lv_timer.h" +#include "../core/lv_observer.h" + +#if LV_USE_SYSMON + +#if LV_USE_LABEL == 0 +#error "lv_sysmon: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) " +#endif + +#if LV_USE_OBSERVER == 0 +#error "lv_observer: lv_observer is required. Enable it in lv_conf.h (LV_USE_OBSERVER 1) " +#endif + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a new system monitor label + * @param disp create the sys. mon. on this display's system layer + * @return the create label + */ +lv_obj_t * lv_sysmon_create(lv_display_t * disp); + +#if LV_USE_PERF_MONITOR + +/** + * Show system performance monitor: CPU usage and FPS count + * @param disp target display, NULL: use the default displays + */ +void lv_sysmon_show_performance(lv_display_t * disp); + +/** + * Hide system performance monitor + * @param disp target display, NULL: use the default + */ +void lv_sysmon_hide_performance(lv_display_t * disp); + +/** + * Dump the FPS data recorded between the last and current dump call. + * @param disp target display, NULL: use the default + */ +void lv_sysmon_performance_dump(lv_display_t * disp); + +/** + * Resume the system performance monitor. + * @param disp target display, NULL: use the default + */ +void lv_sysmon_performance_resume(lv_display_t * disp); + +/** + * Pause the system performance monitor. + * + * @param disp target display, NULL: use the default + * @note When the sysmon is stopped you can use `lv_sysmon_dump_performance` to + * get performance information. See `lv_sysmon_dump_performance` for more information. + */ +void lv_sysmon_performance_pause(lv_display_t * disp); + + +#endif /*LV_USE_PERF_MONITOR*/ + +#if LV_USE_MEM_MONITOR + +/** + * Show system memory monitor: used memory and the memory fragmentation + * @param disp target display, NULL: use the default displays + */ +void lv_sysmon_show_memory(lv_display_t * disp); + +/** + * Hide system memory monitor + * @param disp target display, NULL: use the default displays + */ +void lv_sysmon_hide_memory(lv_display_t * disp); + +#endif /*LV_USE_MEM_MONITOR*/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_SYSMON*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SYSMON_H*/ diff --git a/include/lvgl/debugging/lv_test.h b/include/lvgl/debugging/lv_test.h new file mode 100644 index 0000000000..7ec78e83b8 --- /dev/null +++ b/include/lvgl/debugging/lv_test.h @@ -0,0 +1,47 @@ +/** + * @file lv_test.h + * + */ + +#ifndef LV_TEST_H +#define LV_TEST_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_TEST + +/********************* + * DEFINES + *********************/ +#include "lv_test_indev.h" +#include "lv_test_display.h" +#include "lv_test_fs.h" +#include "lv_test_helpers.h" +#include "lv_test_screenshot_compare.h" +#include "lv_test_indev_gesture.h" + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE TEST*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEST_H*/ diff --git a/include/lvgl/debugging/lv_test_display.h b/include/lvgl/debugging/lv_test_display.h new file mode 100644 index 0000000000..04bb774d61 --- /dev/null +++ b/include/lvgl/debugging/lv_test_display.h @@ -0,0 +1,55 @@ +/** + * @file lv_test_display.h + * + */ + +#ifndef LV_TEST_DISPLAY_H +#define LV_TEST_DISPLAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_TEST + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/*** + * Create a dummy display for for the tests + * @param hor_res the maximal horizontal resolution + * @param ver_res the maximal vertical resolution + * @return the created display + * + * @note The resolution can be changed to any smaller values later + * using `lv_display_set_resolution` + * The color format can be freely changed later using `lv_display_set_color_format` + */ +lv_display_t * lv_test_display_create(int32_t hor_res, int32_t ver_res); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TEST*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEST_DISPLAY_H*/ diff --git a/include/lvgl/debugging/lv_test_fs.h b/include/lvgl/debugging/lv_test_fs.h new file mode 100644 index 0000000000..20d62855f3 --- /dev/null +++ b/include/lvgl/debugging/lv_test_fs.h @@ -0,0 +1,69 @@ +/** + * @file lv_test_fs.h + * + */ + +#ifndef LV_TEST_FS_H +#define LV_TEST_FS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" +#if LV_USE_TEST + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the test file system driver + */ +void lv_test_fs_init(void); + +/** + * Set whether the test file system is ready + * @param ready true: ready, false: not ready + */ +void lv_test_fs_set_ready(bool ready); + +/** + * Set whether the open callback of the test file system is cleared + * @param is_clear true: clear, false: not clear + */ +void lv_test_fs_clear_open_cb(bool is_clear); + +/** + * Set whether the close callback of the test file system is cleared + * @param is_clear true: clear, false: not clear + */ +void lv_test_fs_clear_close_cb(bool is_clear); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TEST*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEST_FS_H*/ + + diff --git a/include/lvgl/debugging/lv_test_helpers.h b/include/lvgl/debugging/lv_test_helpers.h new file mode 100644 index 0000000000..a2a1464914 --- /dev/null +++ b/include/lvgl/debugging/lv_test_helpers.h @@ -0,0 +1,80 @@ +/** + * @file lv_test_helpers.h + * + */ + +#ifndef LV_TEST_HELPERS_H +#define LV_TEST_HELPERS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" +#if LV_USE_TEST + +#include "../lv_types.h" +#include "../stdlib/lv_mem.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Emulate a delay. It's not real delay, but it tricks LVGL to think that the + * required time has been elapsed. + * `lv_timer_handler` is called after each millisecond, meaning all the events + * will be fired inside this function. + * At the end the animations and display will be also updated. + * @param ms the number of milliseconds to pass + */ +void lv_test_wait(uint32_t ms); + +/** + * Emulates some time passing. + * Update the animations and the display only once at the end. + * @param ms the number of milliseconds to pass + */ +void lv_test_fast_forward(uint32_t ms); + +#if LV_USE_STDLIB_MALLOC != LV_STDLIB_BUILTIN +/* Skip checking heap as we don't have the info available */ +#define LV_HEAP_CHECK(x) do {} while(0) +/* Pick a non-zero value */ +#define lv_test_get_free_mem() (65536) +#else +#define LV_HEAP_CHECK(x) x + +static inline size_t lv_test_get_free_mem(void) +{ + lv_mem_monitor_t m1; + lv_mem_monitor(&m1); + return m1.free_size; +} +#endif /* LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN */ + +/********************** + * MACROS + **********************/ + +#define LV_TEST_WIDTH_TO_STRIDE(w, px_size) ((((w) * (px_size) + (LV_DRAW_BUF_STRIDE_ALIGN - 1)) / LV_DRAW_BUF_STRIDE_ALIGN) * LV_DRAW_BUF_STRIDE_ALIGN) + +#endif /*LV_USE_TEST*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEST_HELPERS_H*/ diff --git a/include/lvgl/debugging/lv_test_indev.h b/include/lvgl/debugging/lv_test_indev.h new file mode 100644 index 0000000000..c6ab2294ed --- /dev/null +++ b/include/lvgl/debugging/lv_test_indev.h @@ -0,0 +1,171 @@ +/** + * @file lv_test_indev.h + * + */ + +#ifndef LV_TEST_INDEV_H +#define LV_TEST_INDEV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_TEST + +#include "../lv_types.h" +#include "../indev/lv_indev.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a mouse (pointer), keypad, and encoder indevs. + * They can be controlled via function calls during the test + */ +void lv_test_indev_create_all(void); + +/** + * Delete all test input devices + */ +void lv_test_indev_delete_all(void); + +/** + * Get one of the indev created in `lv_test_indev_create_all` + * @param type type of the indev to get + * @return the indev + */ +lv_indev_t * lv_test_indev_get_indev(lv_indev_type_t type); + +/** + * Move the mouse to the given coordinates. + * This function doesn't wait, but just changes the state and returns immediately. + * @param x the target absolute X coordinate + * @param y the target absolute Y coordinate + */ +void lv_test_mouse_move_to(int32_t x, int32_t y); + +/** + * Move the mouse to the center of a widget + * This function doesn't wait, but just changes the state and returns immediately. + * @param obj pointer to an widget + */ +void lv_test_mouse_move_to_obj(lv_obj_t * obj); + +/** + * Move the mouse cursor. Keep the pressed or released state + * This function doesn't wait, but just changes the state and returns immediately. + * @param x the difference in X to move + * @param y the difference in Y to move + */ +void lv_test_mouse_move_by(int32_t x, int32_t y); + +/** + * Make the mouse button pressed. + * This function doesn't wait, but just changes the state and returns immediately. + */ +void lv_test_mouse_press(void); + +/** + * Make the mouse button released. + * This function doesn't wait, but just changes the state and returns immediately. + */ +void lv_test_mouse_release(void); + +/** + * Emulate a click on a given point. + * First set the released state, wait a little, press, wait, and release again. + * The wait time is 50ms. + * Internally `lv_timer_handler` is called, meaning all the events will be fired inside this function. + * @param x the target absolute X coordinate + * @param y the target absolute Y coordinate + */ +void lv_test_mouse_click_at(int32_t x, int32_t y); + +/** + * Emulate a key press. + * This function doesn't wait, but just changes the state and returns immediately. + * @param k the key to press + */ +void lv_test_key_press(uint32_t k); + +/** + * Release the previously press key. + * This function doesn't wait, but just changes the state and returns immediately. + * @param k the key to press + */ +void lv_test_key_release(void); + +/** + * Emulate a key hit. + * First set the released state, wait a little, press, wait, and release again. + * The wait time is 50ms. + * Internally `lv_timer_handler` is called, meaning all the events will be fired inside this function. + * @param k the key to hit + */ +void lv_test_key_hit(uint32_t k); + + +/** + * Emulate encoder rotation, use positive parameter to rotate to the right + * and negative to rotate to the left. + * This function doesn't wait, but just changes the state and returns immediately. + * @param d number of encoder ticks to emulate + */ +void lv_test_encoder_add_diff(int32_t d); + +/** + * Emulate an encoder turn a wait 50ms. Use positive parameter to rotate to the right + * and negative to rotate to the left. + * Internally `lv_timer_handler` is called, meaning all the events will be fired inside this function. + * @param d number of encoder ticks to emulate + */ +void lv_test_encoder_turn(int32_t d); + +/** + * Emulate an encoder press. + * This function doesn't wait, but just changes the state and returns immediately. + */ +void lv_test_encoder_press(void); + +/** + * Emulate an encoder release. + * This function doesn't wait, but just changes the state and returns immediately. + */ +void lv_test_encoder_release(void); + +/** + * Emulate am encoder click. + * First set the released state, wait a little, press, wait, and release again. + * The wait time is 50ms. + * Internally `lv_timer_handler` is called, meaning all the events will be fired inside this function. + */ +void lv_test_encoder_click(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TEST*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEST_INDEV_H*/ + + + + diff --git a/include/lvgl/debugging/lv_test_indev_gesture.h b/include/lvgl/debugging/lv_test_indev_gesture.h new file mode 100644 index 0000000000..bbe87c4bc5 --- /dev/null +++ b/include/lvgl/debugging/lv_test_indev_gesture.h @@ -0,0 +1,93 @@ +/** + * @file lv_test_indev_gesture.h + * + */ + +#ifndef LV_TEST_INDEV_GESTURE_H +#define LV_TEST_INDEV_GESTURE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_TEST && LV_USE_GESTURE_RECOGNITION + +#include "../lv_types.h" +#include "../indev/lv_indev.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a touch (pointer) indevs. + * They can be controlled via function calls during the test + */ +void lv_test_indev_gesture_create(void); + +/** + * Delete the touch (pointer) indevs. + */ +void lv_test_indev_gesture_delete(void); + +/** + * Get one of the indev created in `lv_test_indev_gesture_create` + * @param type type of the indev to get + * @return the indev + */ +lv_indev_t * lv_test_indev_get_gesture_indev(lv_indev_type_t type); + +/** + * Set two touch points data for pinch gesture + * @param point_0 First touch point coordinates + * @param point_1 Second touch point coordinates + */ +void lv_test_gesture_set_pinch_data(lv_point_t point_0, lv_point_t point_1); + +/** + * Trigger press state of pinch gesture (both touch points pressed) + */ +void lv_test_gesture_pinch_press(void); + +/** + * Trigger release state of pinch gesture (both touch points released) + */ +void lv_test_gesture_pinch_release(void); + +/** + * Simulate a complete pinch gesture operation + * @param point_begin_0 Starting coordinates of first touch point + * @param point_begin_1 Starting coordinates of second touch point + * @param point_end_0 Ending coordinates of first touch point + * @param point_end_1 Ending coordinates of second touch point + */ +void lv_test_gesture_pinch(lv_point_t point_begin_0, lv_point_t point_begin_1, + lv_point_t point_end_0, lv_point_t point_end_1); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TEST && LV_USE_GESTURE_RECOGNITION*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEST_INDEV_GESTURE_H*/ + + + + diff --git a/include/lvgl/debugging/lv_test_screenshot_compare.h b/include/lvgl/debugging/lv_test_screenshot_compare.h new file mode 100644 index 0000000000..34baa4ff69 --- /dev/null +++ b/include/lvgl/debugging/lv_test_screenshot_compare.h @@ -0,0 +1,87 @@ +/** + * @file lv_test_screenshot_compare.h + * + */ + +#ifndef LV_TEST_SCREENSHOT_COMPARE_H +#define LV_TEST_SCREENSHOT_COMPARE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_TEST && defined(LV_USE_TEST_SCREENSHOT_COMPARE) && LV_USE_TEST_SCREENSHOT_COMPARE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Return value of `lv_test_screenshot_compare` + */ +typedef enum { + /** + * The screenshot is different than the reference image + */ + LV_TEST_SCREENSHOT_RESULT_FAILED, + + /** + * The screenshot is the same as the reference image. + * It is also returned if `LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE` is enabled + * and the reference image was missing. + */ + LV_TEST_SCREENSHOT_RESULT_PASSED, + + /** + * If `LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE` is not enabled + * and the reference image is missing. + */ + LV_TEST_SCREENSHOT_RESULT_NO_REFERENCE_IMAGE, + +} lv_test_screenshot_result_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Invalidate and redraw the current screen and compare its content with a reference PNG image + * - If the reference image is not found it will be created automatically from the rendered screen. + * - If the compare fails an `_err.png` file will be created with the rendered content next to the reference image. + * + * It requires lodepng. + * + * @param fn_ref path to the reference image. Will be appended to REF_IMGS_PATH if set. + * @return An element of `lv_test_screenshot_result_t` + * @note This function assumes that the default display is the test display that was created by + * `lv_test_display_create()` + */ +lv_test_screenshot_result_t lv_test_screenshot_compare(const char * fn_ref); + + +/** + * Works the same way as `lv_test_screenshot_compare` but it doesn't invalidate and redraw the screen + * but uses its current content. (lv_refr_now(NULL) might be called earlier) + * @param fn_ref reference image path + */ +lv_test_screenshot_result_t lv_test_screenshot_compare_core(const char * fn_ref); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TEST_SCREENSHOT_COMPARE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEST_SCREENSHOT_COMPARE_H*/ diff --git a/include/lvgl/display/lv_display.h b/include/lvgl/display/lv_display.h new file mode 100644 index 0000000000..7472df77f8 --- /dev/null +++ b/include/lvgl/display/lv_display.h @@ -0,0 +1,803 @@ +/** + * @file lv_display.h + * + */ + +#ifndef LV_DISPLAY_H +#define LV_DISPLAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" +#include "../core/lv_timer.h" +#include "../core/lv_event.h" +#include "../draw/lv_color.h" +#include "../core/lv_area.h" + +/********************* + * DEFINES + *********************/ + +#ifndef LV_ATTRIBUTE_FLUSH_READY +#define LV_ATTRIBUTE_FLUSH_READY +#endif + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_DISPLAY_ROTATION_0 = 0, + LV_DISPLAY_ROTATION_90, + LV_DISPLAY_ROTATION_180, + LV_DISPLAY_ROTATION_270 +} lv_display_rotation_t; + +typedef enum { + /** + * Use the buffer(s) to render the screen is smaller parts. + * This way the buffers can be smaller then the display to save RAM. At least 1/10 screen size buffer(s) are recommended. + */ + LV_DISPLAY_RENDER_MODE_PARTIAL, + + /** + * The buffer(s) has to be screen sized and LVGL will render into the correct location of the buffer. + * This way the buffer always contain the whole image. Only the changed ares will be updated. + * With 2 buffers the buffers' content are kept in sync automatically and in flush_cb only address change is required. + */ + LV_DISPLAY_RENDER_MODE_DIRECT, + + /** + * Always redraw the whole screen even if only one pixel has been changed. + * With 2 buffers in flush_cb only an address change is required. + */ + LV_DISPLAY_RENDER_MODE_FULL, +} lv_display_render_mode_t; + +typedef enum { + LV_SCREEN_LOAD_ANIM_NONE, + LV_SCREEN_LOAD_ANIM_OVER_LEFT, + LV_SCREEN_LOAD_ANIM_OVER_RIGHT, + LV_SCREEN_LOAD_ANIM_OVER_TOP, + LV_SCREEN_LOAD_ANIM_OVER_BOTTOM, + LV_SCREEN_LOAD_ANIM_MOVE_LEFT, + LV_SCREEN_LOAD_ANIM_MOVE_RIGHT, + LV_SCREEN_LOAD_ANIM_MOVE_TOP, + LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM, + LV_SCREEN_LOAD_ANIM_FADE_IN, + LV_SCREEN_LOAD_ANIM_FADE_ON = LV_SCREEN_LOAD_ANIM_FADE_IN, /*For backward compatibility*/ + LV_SCREEN_LOAD_ANIM_FADE_OUT, + LV_SCREEN_LOAD_ANIM_OUT_LEFT, + LV_SCREEN_LOAD_ANIM_OUT_RIGHT, + LV_SCREEN_LOAD_ANIM_OUT_TOP, + LV_SCREEN_LOAD_ANIM_OUT_BOTTOM, +} lv_screen_load_anim_t; + +typedef void (*lv_display_flush_cb_t)(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map); +typedef void (*lv_display_flush_wait_cb_t)(lv_display_t * disp); +typedef void (*lv_display_sync_cb_t)(lv_display_t * disp, const lv_area_t * area); +typedef void (*lv_display_sync_wait_cb_t)(lv_display_t * disp); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a new display with the given resolution + * @param hor_res horizontal resolution in pixels + * @param ver_res vertical resolution in pixels + * @return pointer to a display object or `NULL` on error + */ +lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res); + +/** + * Remove a display + * @param disp pointer to display + */ +void lv_display_delete(lv_display_t * disp); + +/** + * Set a default display. The new screens will be created on it by default. + * @param disp pointer to a display + */ +void lv_display_set_default(lv_display_t * disp); + +/** + * Get the default display + * @return pointer to the default display + */ +lv_display_t * lv_display_get_default(void); + +/** + * Get the next display. + * @param disp pointer to the current display. NULL to initialize. + * @return the next display or NULL if no more. Gives the first display when the parameter is NULL. + */ +lv_display_t * lv_display_get_next(lv_display_t * disp); + +/*--------------------- + * RESOLUTION + *--------------------*/ + +/** + * Sets the resolution of a display. `LV_EVENT_RESOLUTION_CHANGED` event will be sent. + * Here the native resolution of the device should be set. If the display will be rotated later with + * `lv_display_set_rotation` LVGL will swap the hor. and ver. resolution automatically. + * @param disp pointer to a display + * @param hor_res the new horizontal resolution + * @param ver_res the new vertical resolution + */ +void lv_display_set_resolution(lv_display_t * disp, int32_t hor_res, int32_t ver_res); + +/** + * It's not mandatory to use the whole display for LVGL, however in some cases physical resolution is important. + * For example the touchpad still sees whole resolution and the values needs to be converted + * to the active LVGL display area. + * @param disp pointer to a display + * @param hor_res the new physical horizontal resolution, or -1 to assume it's the same as the normal hor. res. + * @param ver_res the new physical vertical resolution, or -1 to assume it's the same as the normal hor. res. + */ +void lv_display_set_physical_resolution(lv_display_t * disp, int32_t hor_res, int32_t ver_res); + +/** + * If physical resolution is not the same as the normal resolution + * the offset of the active display area can be set here. + * @param disp pointer to a display + * @param x X offset + * @param y Y offset + */ +void lv_display_set_offset(lv_display_t * disp, int32_t x, int32_t y); + +/** + * Set the rotation of this display. LVGL will swap the horizontal and vertical resolutions internally. + * @param disp pointer to a display (NULL to use the default display) + * @param rotation `LV_DISPLAY_ROTATION_0/90/180/270` + */ +void lv_display_set_rotation(lv_display_t * disp, lv_display_rotation_t rotation); + +/** + * Use matrix rotation for the display. This function is depended on `LV_DRAW_TRANSFORM_USE_MATRIX` + * @param disp pointer to a display (NULL to use the default display) + * @param enable true: enable matrix rotation, false: disable + */ +void lv_display_set_matrix_rotation(lv_display_t * disp, bool enable); + +/** + * Set the DPI (dot per inch) of the display. + * dpi = sqrt(hor_res^2 + ver_res^2) / diagonal" + * @param disp pointer to a display + * @param dpi the new DPI + */ +void lv_display_set_dpi(lv_display_t * disp, int32_t dpi); + +/** + * Get the horizontal resolution of a display. + * @param disp pointer to a display (NULL to use the default display) + * @return the horizontal resolution of the display. + */ +int32_t lv_display_get_horizontal_resolution(const lv_display_t * disp); + +/** + * Get the vertical resolution of a display + * @param disp pointer to a display (NULL to use the default display) + * @return the vertical resolution of the display + */ +int32_t lv_display_get_vertical_resolution(const lv_display_t * disp); + +/** + * Get the original horizontal resolution of a display without considering rotation + * @param disp pointer to a display (NULL to use the default display) + * @return the horizontal resolution of the display. + */ +int32_t lv_display_get_original_horizontal_resolution(const lv_display_t * disp); + +/** + * Get the original vertical resolution of a display without considering rotation + * @param disp pointer to a display (NULL to use the default display) + * @return the vertical resolution of the display + */ +int32_t lv_display_get_original_vertical_resolution(const lv_display_t * disp); + +/** + * Get the physical horizontal resolution of a display + * @param disp pointer to a display (NULL to use the default display) + * @return the physical horizontal resolution of the display + */ +int32_t lv_display_get_physical_horizontal_resolution(const lv_display_t * disp); + +/** + * Get the physical vertical resolution of a display + * @param disp pointer to a display (NULL to use the default display) + * @return the physical vertical resolution of the display + */ +int32_t lv_display_get_physical_vertical_resolution(const lv_display_t * disp); + +/** + * Get the horizontal offset from the full / physical display + * @param disp pointer to a display (NULL to use the default display) + * @return the horizontal offset from the physical display + */ +int32_t lv_display_get_offset_x(const lv_display_t * disp); + +/** + * Get the vertical offset from the full / physical display + * @param disp pointer to a display (NULL to use the default display) + * @return the horizontal offset from the physical display + */ +int32_t lv_display_get_offset_y(const lv_display_t * disp); + +/** + * Get the current rotation of this display. + * @param disp pointer to a display (NULL to use the default display) + * @return the current rotation + */ +lv_display_rotation_t lv_display_get_rotation(lv_display_t * disp); + +/** + * Get if matrix rotation is enabled for a display or not + * @param disp pointer to a display (NULL to use the default display) + * @return true: matrix rotation is enabled; false: disabled + */ +bool lv_display_get_matrix_rotation(lv_display_t * disp); + +/** + * Get the DPI of the display + * @param disp pointer to a display (NULL to use the default display) + * @return dpi of the display + */ +int32_t lv_display_get_dpi(const lv_display_t * disp); + +/*--------------------- + * BUFFERING + *--------------------*/ + +/** + * Set the buffers for a display, similarly to `lv_display_set_draw_buffers`, but accept the raw buffer pointers. + * For DIRECT/FULL rending modes, the buffer size must be at least + * `hor_res * ver_res * lv_color_format_get_size(lv_display_get_color_format(disp))` + * @param disp pointer to a display + * @param buf1 first buffer + * @param buf2 second buffer (can be `NULL`) + * @param buf_size buffer size in byte + * @param render_mode LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL + */ +void lv_display_set_buffers(lv_display_t * disp, void * buf1, void * buf2, uint32_t buf_size, + lv_display_render_mode_t render_mode); + +/** + * Set the frame buffers for a display, similarly to `lv_display_set_buffers`, but allow + * for a custom stride as required by a display controller. + * This allows the frame buffers to have a stride alignment different from the rest of + * the buffers` + * @param disp pointer to a display + * @param buf1 first buffer + * @param buf2 second buffer (can be `NULL`) + * @param buf_size buffer size in byte + * @param stride buffer stride in bytes + * @param render_mode LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL + */ +void lv_display_set_buffers_with_stride(lv_display_t * disp, void * buf1, void * buf2, uint32_t buf_size, + uint32_t stride, lv_display_render_mode_t render_mode); + +/** + * Set the buffers for a display, accept a draw buffer pointer. + * Normally use `lv_display_set_buffers` is enough for most cases. + * Use this function when an existing lv_draw_buf_t is available. + * @param disp pointer to a display + * @param buf1 first buffer + * @param buf2 second buffer (can be `NULL`) + */ +void lv_display_set_draw_buffers(lv_display_t * disp, lv_draw_buf_t * buf1, lv_draw_buf_t * buf2); + +/** + * Set the third draw buffer for a display. + * @param disp pointer to a display + * @param buf3 third buffer + */ +void lv_display_set_3rd_draw_buffer(lv_display_t * disp, lv_draw_buf_t * buf3); + +/** + * Set display render mode + * @param disp pointer to a display + * @param render_mode LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL + */ +void lv_display_set_render_mode(lv_display_t * disp, lv_display_render_mode_t render_mode); + +/** + * Set the flush callback which will be called to copy the rendered image to the display. + * @param disp pointer to a display + * @param flush_cb the flush callback (`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display) + */ +void lv_display_set_flush_cb(lv_display_t * disp, lv_display_flush_cb_t flush_cb); + +/** + * Set a callback to be used while LVGL is waiting flushing to be finished. + * It can do any complex logic to wait, including semaphores, mutexes, polling flags, etc. + * If not set the `disp->flushing` flag is used which can be cleared with `lv_display_flush_ready()` + * @param disp pointer to a display + * @param wait_cb a callback to call while LVGL is waiting for flush ready. + * If NULL `lv_display_flush_ready()` can be used to signal that flushing is ready. + */ +void lv_display_set_flush_wait_cb(lv_display_t * disp, lv_display_flush_wait_cb_t wait_cb); + +/** + * Set the sync callback which will be called to synchronize invalidated areas between frame buffers pre-render. + * @param disp pointer to a display + * @param sync_cb the sync callback (pointer to `area` needing to be synchronized) + */ +void lv_display_set_sync_cb(lv_display_t * disp, lv_display_sync_cb_t sync_cb); + +/** + * Set a callback to be used while LVGL is waiting sync to be finished. + * It can do any complex logic to wait, including semaphores, mutexes, polling flags, etc. + * If not set the `disp->syncing` flag is used which can be cleared with `lv_display_sync_ready()` + * @param disp pointer to a display + * @param wait_cb a callback to call while LVGL is waiting for sync ready. + * If NULL `lv_display_sync_ready()` can be used to signal that syncing is ready. + */ +void lv_display_set_sync_wait_cb(lv_display_t * disp, lv_display_sync_wait_cb_t wait_cb); + +/** + * Set the color format of the display. + * @param disp pointer to a display + * @param color_format Possible values are + * - LV_COLOR_FORMAT_RGB565 + * - LV_COLOR_FORMAT_RGB888 + * - LV_COLOR_FORMAT_XRGB888 + * - LV_COLOR_FORMAT_ARGB888 + *@note To change the endianness of the rendered image in case of RGB565 format + * (i.e. swap the 2 bytes) call `lv_draw_sw_rgb565_swap` in the flush_cb + */ +void lv_display_set_color_format(lv_display_t * disp, lv_color_format_t color_format); + +/** + * Get the color format of the display + * @param disp pointer to a display + * @return the color format + */ +lv_color_format_t lv_display_get_color_format(lv_display_t * disp); + +/** + * Set the number of tiles for parallel rendering. + * @param disp pointer to a display + * @param tile_cnt number of tiles (1 =< tile_cnt < 256) + */ +void lv_display_set_tile_cnt(lv_display_t * disp, uint32_t tile_cnt); + +/** + * Get the number of tiles used for parallel rendering + * @param disp pointer to a display + * @return number of tiles + */ +uint32_t lv_display_get_tile_cnt(lv_display_t * disp); + +/** + * Disabling anti-aliasing is not supported since v9. This function will be removed. + * Enable anti-aliasing for the render engine + * @param disp pointer to a display + * @param en true/false + */ +void lv_display_set_antialiasing(lv_display_t * disp, bool en); + +/** + * Get if anti-aliasing is enabled for a display or not + * @param disp pointer to a display (NULL to use the default display) + * @return true/false + */ +bool lv_display_get_antialiasing(lv_display_t * disp); + +/** + * Call from the display driver when the flushing is finished + * @param disp pointer to display whose `flush_cb` was called + */ +LV_ATTRIBUTE_FLUSH_READY void lv_display_flush_ready(lv_display_t * disp); + +/** + * Tell if it's the last area of the refreshing process. + * Can be called from `flush_cb` to execute some special display refreshing if needed when all areas are flushed. + * @param disp pointer to display + * @return true: it's the last area to flush; + * false: there are other areas too which will be refreshed soon + */ +LV_ATTRIBUTE_FLUSH_READY bool lv_display_flush_is_last(lv_display_t * disp); + +/** + * Call from the display driver when the syncing is finished + * @param disp pointer to display whose `sync_cb` was called + */ +LV_ATTRIBUTE_SYNC_READY void lv_display_sync_ready(lv_display_t * disp); + +/** + * Tell if it's the last area of the syncing process. + * Can be called from `sync_cb` to execute some special display refreshing if needed when all areas are synced. + * @param disp pointer to display + * @return true: it's the last area to sync; + * false: there are other areas too which will be synced soon + */ +LV_ATTRIBUTE_SYNC_READY bool lv_display_sync_is_last(lv_display_t * disp); + +/** + * Get display is double buffered. + * @param disp pointer to a display (NULL to use the default display) + * @return return true if display is double buffered + */ +bool lv_display_is_double_buffered(lv_display_t * disp); + +/** + * Get display render mode + * @param disp pointer to a display + * @return display's render mode (LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL) + */ +lv_display_render_mode_t lv_display_get_render_mode(lv_display_t * disp); + +/*--------------------- + * SCREENS + *--------------------*/ + +/** + * Return a pointer to the active screen on a display + * @param disp pointer to display which active screen should be get. + * (NULL to use the default screen) + * @return pointer to the active screen object (loaded by 'lv_screen_load()') + */ +lv_obj_t * lv_display_get_screen_active(lv_display_t * disp); + +/** + * Return with a pointer to the previous screen. Only used during screen transitions. + * @param disp pointer to display which previous screen should be get. + * (NULL to use the default screen) + * @return pointer to the previous screen object or NULL if not used now + */ +lv_obj_t * lv_display_get_screen_prev(lv_display_t * disp); + +/** + * Return the screen that is currently being loaded by the display + * @param disp pointer to a display object (NULL to use the default screen) + * @return pointer to the screen being loaded or NULL if no screen is currently being loaded + */ +lv_obj_t * lv_display_get_screen_loading(lv_display_t * disp); + +/** + * Return the top layer. The top layer is the same on all screens and it is above the normal screen layer. + * @param disp pointer to display which top layer should be get. (NULL to use the default screen) + * @return pointer to the top layer object + */ +lv_obj_t * lv_display_get_layer_top(lv_display_t * disp); + +/** + * Return the sys. layer. The system layer is the same on all screen and it is above the normal screen and the top layer. + * @param disp pointer to display which sys. layer should be retrieved. (NULL to use the default screen) + * @return pointer to the sys layer object + */ +lv_obj_t * lv_display_get_layer_sys(lv_display_t * disp); + +/** + * Return the bottom layer. The bottom layer is the same on all screen and it is under the normal screen layer. + * It's visible only if the screen is transparent. + * @param disp pointer to display (NULL to use the default screen) + * @return pointer to the bottom layer object + */ +lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp); + + +#if LV_USE_OBJ_NAME + +/** + * Get screen by its name on a display. The name should be set by + * `lv_obj_set_name()` or `lv_obj_set_name_static()`. + * @param disp pointer to a display or NULL to use default display + * @param screen_name name of the screen to get + * @return pointer to the screen, or NULL if not found. + */ +lv_obj_t * lv_display_get_screen_by_name(const lv_display_t * disp, const char * screen_name); + +#endif /*LV_USE_OBJ_NAME*/ + +/** + * Load a screen on the default display + * @param scr pointer to a screen + */ +void lv_screen_load(struct _lv_obj_t * scr); + +/** + * Switch screen with animation + * @param scr pointer to the new screen to load + * @param anim_type type of the animation from `lv_screen_load_anim_t`, e.g. `LV_SCREEN_LOAD_ANIM_MOVE_LEFT` + * @param time time of the animation + * @param delay delay before the transition + * @param auto_del true: automatically delete the old screen + */ +void lv_screen_load_anim(lv_obj_t * scr, lv_screen_load_anim_t anim_type, uint32_t time, uint32_t delay, + bool auto_del); + +/** + * Get the active screen of the default display + * @return pointer to the active screen + */ +lv_obj_t * lv_screen_active(void); + +/** + * Get the top layer of the default display + * @return pointer to the top layer + */ +lv_obj_t * lv_layer_top(void); + +/** + * Get the system layer of the default display + * @return pointer to the sys layer + */ +lv_obj_t * lv_layer_sys(void); + +/** + * Get the bottom layer of the default display + * @return pointer to the bottom layer + */ +lv_obj_t * lv_layer_bottom(void); + +/*--------------------- + * OTHERS + *--------------------*/ + +/** + * Add an event handler to the display + * @param disp pointer to a display + * @param event_cb an event callback + * @param filter event code to react or `LV_EVENT_ALL` + * @param user_data optional user_data + * @return the event descriptor or NULL if the event couldn't be created + */ +lv_event_dsc_t * lv_display_add_event_cb(lv_display_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, + void * user_data); + +/** + * Get the number of event attached to a display + * @param disp pointer to a display + * @return number of events + */ +uint32_t lv_display_get_event_count(lv_display_t * disp); + +/** + * Get an event descriptor for an event + * @param disp pointer to a display + * @param index the index of the event + * @return the event descriptor + */ +lv_event_dsc_t * lv_display_get_event_dsc(lv_display_t * disp, uint32_t index); + +/** + * Remove an event + * @param disp pointer to a display + * @param index the index of the event to remove + * @return true: and event was removed; false: no event was removed + */ +bool lv_display_remove_event(lv_display_t * disp, uint32_t index); + +/** + * Remove an event_cb with user_data + * @param disp pointer to a display + * @param event_cb the event_cb of the event to remove + * @param user_data user_data + * @return the count of the event removed + */ +uint32_t lv_display_remove_event_cb_with_user_data(lv_display_t * disp, lv_event_cb_t event_cb, void * user_data); + +/** + * Send an event to a display + * @param disp pointer to a display + * @param code an event code. LV_EVENT_... + * @param param optional param + * @return LV_RESULT_OK: disp wasn't deleted in the event. + */ +lv_result_t lv_display_send_event(lv_display_t * disp, lv_event_code_t code, void * param); + +/** + * Get the area to be invalidated. Can be used in `LV_EVENT_INVALIDATE_AREA` + * @param e pointer to an event + * @return the area to invalidated (can be modified as required) + */ +lv_area_t * lv_event_get_invalidated_area(lv_event_t * e); + +/** + * Set the theme of a display. If there are no user created widgets yet the screens' theme will be updated + * @param disp pointer to a display + * @param th pointer to a theme + */ +void lv_display_set_theme(lv_display_t * disp, lv_theme_t * th); + +/** + * Get the theme of a display + * @param disp pointer to a display + * @return the display's theme (can be NULL) + */ +lv_theme_t * lv_display_get_theme(lv_display_t * disp); + +/** + * Get elapsed time since last user activity on a display (e.g. click) + * @param disp pointer to a display (NULL to get the overall smallest inactivity) + * @return elapsed ticks (milliseconds) since the last activity + */ +uint32_t lv_display_get_inactive_time(const lv_display_t * disp); + +/** + * Manually trigger an activity on a display + * @param disp pointer to a display (NULL to use the default display) + */ +void lv_display_trigger_activity(lv_display_t * disp); + +/** + * Temporarily enable and disable the invalidation of the display. + * @param disp pointer to a display (NULL to use the default display) + * @param en true: enable invalidation; false: invalidation + */ +void lv_display_enable_invalidation(lv_display_t * disp, bool en); + +/** + * Get display invalidation is enabled. + * @param disp pointer to a display (NULL to use the default display) + * @return return true if invalidation is enabled + */ +bool lv_display_is_invalidation_enabled(lv_display_t * disp); + +/** + * Get a pointer to the screen refresher timer to + * modify its parameters with `lv_timer_...` functions. + * @param disp pointer to a display + * @return pointer to the display refresher timer. (NULL on error) + */ +lv_timer_t * lv_display_get_refr_timer(lv_display_t * disp); + +/** + * Delete screen refresher timer + * @param disp pointer to a display + */ +void lv_display_delete_refr_timer(lv_display_t * disp); + +/** + * Register vsync event of a display. `LV_EVENT_VSYNC` event will be sent periodically. + * Please don't use it in display event listeners, as it may cause memory leaks and illegal access issues. + * + * @param disp pointer to a display + * @param event_cb an event callback + * @param user_data optional user_data + */ +bool lv_display_register_vsync_event(lv_display_t * disp, lv_event_cb_t event_cb, void * user_data); + +/** + * Unregister vsync event of a display. `LV_EVENT_VSYNC` event won't be sent periodically. + * Please don't use it in display event listeners, as it may cause memory leaks and illegal access issues. + * @param disp pointer to a display + * @param event_cb an event callback + * @param user_data optional user_data + */ +bool lv_display_unregister_vsync_event(lv_display_t * disp, lv_event_cb_t event_cb, void * user_data); + +/** + * Send an vsync event to a display + * @param disp pointer to a display + * @param param optional param + * @return LV_RESULT_OK: disp wasn't deleted in the event. + */ +lv_result_t lv_display_send_vsync_event(lv_display_t * disp, void * param); + +void lv_display_set_user_data(lv_display_t * disp, void * user_data); +void lv_display_set_driver_data(lv_display_t * disp, void * driver_data); +void * lv_display_get_user_data(lv_display_t * disp); +void * lv_display_get_driver_data(lv_display_t * disp); +lv_draw_buf_t * lv_display_get_buf_active(lv_display_t * disp); + +/** + * Rotate an area in-place according to the display's rotation + * @param disp pointer to a display + * @param area pointer to an area to rotate + */ +void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area); + +/** + * Rotate a point in-place according to the display's rotation + * @param disp pointer to a display + * @param point pointer to a point to rotate + */ +void lv_display_rotate_point(lv_display_t * disp, lv_point_t * point); + +/** + * Get the size of the draw buffers + * @param disp pointer to a display + * @return the size of the draw buffer in bytes for valid display, 0 otherwise + */ +uint32_t lv_display_get_draw_buf_size(lv_display_t * disp); + +/** + * Get the size of the invalidated draw buffer. Can be used in the flush callback + * to get the number of bytes used in the current render buffer. + * @param disp pointer to a display + * @param width the width of the invalidated area + * @param height the height of the invalidated area + * @return the size of the invalidated draw buffer in bytes, not accounting for + * any preceding palette information for a valid display, 0 otherwise + */ +uint32_t lv_display_get_invalidated_draw_buf_size(lv_display_t * disp, uint32_t width, uint32_t height); + +/********************** + * MACROS + **********************/ + +/*------------------------------------------------ + * To improve backward compatibility + * Recommended only if you have one display + *------------------------------------------------*/ + +#ifndef LV_HOR_RES +/** + * The horizontal resolution of the currently active display. + */ +#define LV_HOR_RES lv_display_get_horizontal_resolution(lv_display_get_default()) +#endif + +#ifndef LV_VER_RES +/** + * The vertical resolution of the currently active display. + */ +#define LV_VER_RES lv_display_get_vertical_resolution(lv_display_get_default()) +#endif + +/** + * See `lv_dpx()` and `lv_display_dpx()`. + * Same as Android's DIP. (Different name is chosen to avoid mistype between LV_DPI and LV_DIP) + * + * - 40 dip is 40 px on a 160 DPI screen (distance = 1/4 inch). + * - 40 dip is 80 px on a 320 DPI screen (distance still = 1/4 inch). + * + * @sa https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp + */ +#define LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/ +#define LV_DPX(n) LV_DPX_CALC(lv_display_get_dpi(NULL), n) + +/** + * For default display, computes the number of pixels (a distance or size) as if the + * display had 160 DPI. This allows you to specify 1/160-th fractions of an inch to + * get real distance on the display that will be consistent regardless of its current + * DPI. It ensures `lv_dpx(100)`, for example, will have the same physical size + * regardless to the DPI of the display. + * @param n number of 1/160-th-inch units to compute with + * @return number of pixels to use to make that distance + */ +int32_t lv_dpx(int32_t n); + +/** + * For specified display, computes the number of pixels (a distance or size) as if the + * display had 160 DPI. This allows you to specify 1/160-th fractions of an inch to + * get real distance on the display that will be consistent regardless of its current + * DPI. It ensures `lv_dpx(100)`, for example, will have the same physical size + * regardless to the DPI of the display. + * @param disp pointer to display whose dpi should be considered + * @param n number of 1/160-th-inch units to compute with + * @return number of pixels to use to make that distance + */ +int32_t lv_display_dpx(const lv_display_t * disp, int32_t n); + +#if LV_USE_EXT_DATA +/** + * @brief Attaches external user data and destructor callback to a display + * + * Associates custom user data with an LVGL display and specifies a destructor function + * that will be automatically invoked when the display is deleted to properly clean up + * the associated resources. + * + * @param disp Pointer to a display + * @param data User-defined data pointer to associate with the display + * @param free_cb Callback function for cleaning up data when display is deleted. + * Receives data as parameter. NULL means no cleanup required. + */ +void lv_display_set_external_data(lv_display_t * disp, void * data, void (* free_cb)(void * data)); +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DISPLAY_H*/ diff --git a/include/lvgl/draw/lv_color.h b/include/lvgl/draw/lv_color.h new file mode 100644 index 0000000000..572ebb61bc --- /dev/null +++ b/include/lvgl/draw/lv_color.h @@ -0,0 +1,494 @@ +/** + * @file lv_color.h + * + */ + +#ifndef LV_COLOR_H +#define LV_COLOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../debugging/lv_assert.h" +#include "../misc/lv_math.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ +LV_EXPORT_CONST_INT(LV_COLOR_DEPTH); + +#if LV_COLOR_DEPTH == 8 +#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 2 +#elif LV_COLOR_DEPTH == 16 +#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 3 +#elif LV_COLOR_DEPTH == 24 +#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 4 +#elif LV_COLOR_DEPTH == 32 +#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 4 +#endif + +/** + * Opacity percentages. + */ + +enum _lv_opacity_level_t { + LV_OPA_TRANSP = 0, + LV_OPA_0 = 0, + LV_OPA_10 = 25, + LV_OPA_20 = 51, + LV_OPA_30 = 76, + LV_OPA_40 = 102, + LV_OPA_50 = 127, + LV_OPA_60 = 153, + LV_OPA_70 = 178, + LV_OPA_80 = 204, + LV_OPA_90 = 229, + LV_OPA_100 = 255, + LV_OPA_COVER = 255, +}; + +#define LV_OPA_MIN 2 /**< Fully transparent if opa <= LV_OPA_MIN */ +#define LV_OPA_MAX 253 /**< Fully cover if opa >= LV_OPA_MAX */ + +/** + * Get the pixel size of a color format in bits, bpp + * @param cf a color format (`LV_COLOR_FORMAT_...`) + * @return the pixel size in bits + * @sa lv_color_format_get_bpp + */ +#define LV_COLOR_FORMAT_GET_BPP(cf) ( \ + (cf) == LV_COLOR_FORMAT_I1 ? 1 : \ + (cf) == LV_COLOR_FORMAT_A1 ? 1 : \ + (cf) == LV_COLOR_FORMAT_I2 ? 2 : \ + (cf) == LV_COLOR_FORMAT_A2 ? 2 : \ + (cf) == LV_COLOR_FORMAT_I4 ? 4 : \ + (cf) == LV_COLOR_FORMAT_A4 ? 4 : \ + (cf) == LV_COLOR_FORMAT_NEMA_TSC4 ? 4 : \ + (cf) == LV_COLOR_FORMAT_NEMA_TSC6 ? 6 : \ + (cf) == LV_COLOR_FORMAT_NEMA_TSC6A ? 6 : \ + (cf) == LV_COLOR_FORMAT_NEMA_TSC6AP ? 6 : \ + (cf) == LV_COLOR_FORMAT_L8 ? 8 : \ + (cf) == LV_COLOR_FORMAT_A8 ? 8 : \ + (cf) == LV_COLOR_FORMAT_I8 ? 8 : \ + (cf) == LV_COLOR_FORMAT_ARGB2222 ? 8 : \ + (cf) == LV_COLOR_FORMAT_NEMA_TSC12 ? 12 : \ + (cf) == LV_COLOR_FORMAT_NEMA_TSC12A ? 12 : \ + (cf) == LV_COLOR_FORMAT_AL88 ? 16 : \ + (cf) == LV_COLOR_FORMAT_RGB565 ? 16 : \ + (cf) == LV_COLOR_FORMAT_RGB565_SWAPPED ? 16 : \ + (cf) == LV_COLOR_FORMAT_RGB565A8 ? 16 : \ + (cf) == LV_COLOR_FORMAT_YUY2 ? 16 : \ + (cf) == LV_COLOR_FORMAT_ARGB1555 ? 16 : \ + (cf) == LV_COLOR_FORMAT_ARGB4444 ? 16 : \ + (cf) == LV_COLOR_FORMAT_ARGB8565 ? 24 : \ + (cf) == LV_COLOR_FORMAT_RGB888 ? 24 : \ + (cf) == LV_COLOR_FORMAT_ARGB8888 ? 32 : \ + (cf) == LV_COLOR_FORMAT_ARGB8888_PREMULTIPLIED ? 32 : \ + (cf) == LV_COLOR_FORMAT_XRGB8888 ? 32 : \ + 0 \ + ) + +/** + * Get the pixel size of a color format in bytes + * @param cf a color format (`LV_COLOR_FORMAT_...`) + * @return the pixel size in bytes + * @sa lv_color_format_get_size + */ +#define LV_COLOR_FORMAT_GET_SIZE(cf) ((LV_COLOR_FORMAT_GET_BPP(cf) + 7) >> 3) + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + uint8_t blue; + uint8_t green; + uint8_t red; +} lv_color_t; + +typedef struct { + uint16_t blue : 5; + uint16_t green : 6; + uint16_t red : 5; +} lv_color16_t; + +typedef struct { + uint8_t blue; + uint8_t green; + uint8_t red; + uint8_t alpha; +} lv_color32_t; + +typedef struct { + uint16_t h; + uint8_t s; + uint8_t v; +} lv_color_hsv_t; + +typedef struct { + uint8_t lumi; + uint8_t alpha; +} lv_color16a_t; + +typedef enum { + LV_COLOR_FORMAT_UNKNOWN = 0, + + LV_COLOR_FORMAT_RAW = 0x01, + LV_COLOR_FORMAT_RAW_ALPHA = 0x02, + + /*<=1 byte (+alpha) formats*/ + LV_COLOR_FORMAT_L8 = 0x06, + LV_COLOR_FORMAT_I1 = 0x07, + LV_COLOR_FORMAT_I2 = 0x08, + LV_COLOR_FORMAT_I4 = 0x09, + LV_COLOR_FORMAT_I8 = 0x0A, + LV_COLOR_FORMAT_A8 = 0x0E, + + /*2 byte (+alpha) formats*/ + LV_COLOR_FORMAT_RGB565 = 0x12, + LV_COLOR_FORMAT_ARGB8565 = 0x13, /**< Not supported by sw renderer yet. */ + LV_COLOR_FORMAT_RGB565A8 = 0x14, /**< Color array followed by Alpha array*/ + LV_COLOR_FORMAT_AL88 = 0x15, /**< L8 with alpha >*/ + LV_COLOR_FORMAT_RGB565_SWAPPED = 0x1B, + + /*3 byte (+alpha) formats*/ + LV_COLOR_FORMAT_RGB888 = 0x0F, + LV_COLOR_FORMAT_ARGB8888 = 0x10, + LV_COLOR_FORMAT_XRGB8888 = 0x11, + LV_COLOR_FORMAT_ARGB8888_PREMULTIPLIED = 0x1A, + + /*Formats not supported by software renderer but kept here so GPU can use it*/ + LV_COLOR_FORMAT_A1 = 0x0B, + LV_COLOR_FORMAT_A2 = 0x0C, + LV_COLOR_FORMAT_A4 = 0x0D, + LV_COLOR_FORMAT_ARGB1555 = 0x16, + LV_COLOR_FORMAT_ARGB4444 = 0x17, + LV_COLOR_FORMAT_ARGB2222 = 0X18, + + /* reference to https://wiki.videolan.org/YUV/ */ + /*YUV planar formats*/ + LV_COLOR_FORMAT_YUV_START = 0x20, + LV_COLOR_FORMAT_I420 = LV_COLOR_FORMAT_YUV_START, /*YUV420 planar(3 plane)*/ + LV_COLOR_FORMAT_I422 = 0x21, /*YUV422 planar(3 plane)*/ + LV_COLOR_FORMAT_I444 = 0x22, /*YUV444 planar(3 plane)*/ + LV_COLOR_FORMAT_I400 = 0x23, /*YUV400 no chroma channel*/ + LV_COLOR_FORMAT_NV21 = 0x24, /*YUV420 planar(2 plane), UV plane in 'V, U, V, U'*/ + LV_COLOR_FORMAT_NV12 = 0x25, /*YUV420 planar(2 plane), UV plane in 'U, V, U, V'*/ + + /*YUV packed formats*/ + LV_COLOR_FORMAT_YUY2 = 0x26, /*YUV422 packed like 'Y U Y V'*/ + LV_COLOR_FORMAT_UYVY = 0x27, /*YUV422 packed like 'U Y V Y'*/ + + LV_COLOR_FORMAT_YUV_END = LV_COLOR_FORMAT_UYVY, + + LV_COLOR_FORMAT_PROPRIETARY_START = 0x30, + + LV_COLOR_FORMAT_NEMA_TSC_START = LV_COLOR_FORMAT_PROPRIETARY_START, + LV_COLOR_FORMAT_NEMA_TSC4 = LV_COLOR_FORMAT_NEMA_TSC_START, + LV_COLOR_FORMAT_NEMA_TSC6 = 0x31, + LV_COLOR_FORMAT_NEMA_TSC6A = 0x32, + LV_COLOR_FORMAT_NEMA_TSC6AP = 0x33, + LV_COLOR_FORMAT_NEMA_TSC12 = 0x34, + LV_COLOR_FORMAT_NEMA_TSC12A = 0x35, + LV_COLOR_FORMAT_NEMA_TSC_END = LV_COLOR_FORMAT_NEMA_TSC12A, + + /*Color formats in which LVGL can render*/ +#if LV_COLOR_DEPTH == 1 + LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_I1, + LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_I1, +#elif LV_COLOR_DEPTH == 8 + LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_L8, + LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_AL88, +#elif LV_COLOR_DEPTH == 16 + LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB565, + LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_RGB565A8, +#elif LV_COLOR_DEPTH == 24 + LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB888, + LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888, +#elif LV_COLOR_DEPTH == 32 + LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_XRGB8888, + LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888, +#else +#error "LV_COLOR_DEPTH should be 1, 8, 16, 24 or 32" +#endif + +} lv_color_format_t; + +#define LV_COLOR_FORMAT_IS_ALPHA_ONLY(cf) ((cf) >= LV_COLOR_FORMAT_A1 && (cf) <= LV_COLOR_FORMAT_A8) +#define LV_COLOR_FORMAT_IS_INDEXED(cf) ((cf) >= LV_COLOR_FORMAT_I1 && (cf) <= LV_COLOR_FORMAT_I8) +#define LV_COLOR_FORMAT_IS_YUV(cf) ((cf) >= LV_COLOR_FORMAT_YUV_START && (cf) <= LV_COLOR_FORMAT_YUV_END) +#define LV_COLOR_INDEXED_PALETTE_SIZE(cf) ((cf) == LV_COLOR_FORMAT_I1 ? 2 :\ + (cf) == LV_COLOR_FORMAT_I2 ? 4 :\ + (cf) == LV_COLOR_FORMAT_I4 ? 16 :\ + (cf) == LV_COLOR_FORMAT_I8 ? 256 : 0) + +/********************** + * MACROS + **********************/ + +#define LV_COLOR_MAKE(r8, g8, b8) {b8, g8, r8} + +#define LV_OPA_MIX2(a1, a2) ((lv_opa_t)(((int32_t)(a1) * (a2)) >> 8)) +#define LV_OPA_MIX3(a1, a2, a3) ((lv_opa_t)(((int32_t)(a1) * (a2) * (a3)) >> 16)) + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Get the pixel size of a color format in bits, bpp + * @param cf a color format (`LV_COLOR_FORMAT_...`) + * @return the pixel size in bits + * @sa LV_COLOR_FORMAT_GET_BPP + */ +uint8_t lv_color_format_get_bpp(lv_color_format_t cf); + +/** + * Get the pixel size of a color format in bytes + * @param cf a color format (`LV_COLOR_FORMAT_...`) + * @return the pixel size in bytes + * @sa LV_COLOR_FORMAT_GET_SIZE + */ +uint8_t lv_color_format_get_size(lv_color_format_t cf); + +/** + * Check if a color format has alpha channel or not + * @param src_cf a color format (`LV_COLOR_FORMAT_...`) + * @return true: has alpha channel; false: doesn't have alpha channel + */ +bool lv_color_format_has_alpha(lv_color_format_t src_cf); + +/** + * Create an ARGB8888 color from RGB888 + alpha + * @param color an RGB888 color + * @param opa the alpha value + * @return the ARGB8888 color + */ +lv_color32_t lv_color_to_32(lv_color_t color, lv_opa_t opa); + +/** + * Convert an RGB888 color to an integer + * @param c an RGB888 color + * @return `c` as an integer + */ +uint32_t lv_color_to_int(lv_color_t c); + +/** + * Check if two RGB888 color are equal + * @param c1 the first color + * @param c2 the second color + * @return true: equal + */ +bool lv_color_eq(lv_color_t c1, lv_color_t c2); + +/** + * Check if two ARGB8888 color are equal + * @param c1 the first color + * @param c2 the second color + * @return true: equal + */ +bool lv_color32_eq(lv_color32_t c1, lv_color32_t c2); + +/** + * Create a color from 0x000000..0xffffff input + * @param c the hex input + * @return the color + */ +lv_color_t lv_color_hex(uint32_t c); + +/** + * Create an RGB888 color + * @param r the red channel (0..255) + * @param g the green channel (0..255) + * @param b the blue channel (0..255) + * @return the color + */ +lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b); + +/** + * Create an ARGB8888 color + * @param r the red channel (0..255) + * @param g the green channel (0..255) + * @param b the blue channel (0..255) + * @param a the alpha channel (0..255) + * @return the color + */ +lv_color32_t lv_color32_make(uint8_t r, uint8_t g, uint8_t b, uint8_t a); + +/** + * Create a color from 0x000..0xfff input + * @param c the hex input (e.g. 0x123 will be 0x112233) + * @return the color + */ +lv_color_t lv_color_hex3(uint32_t c); + +/** + * Check if a color with an RGB888 color is within the color range defined by l_color and h_color. + * @param color the color to check + * @param l_color the lower bound color + * @param h_color the upper bound color + * @return true: pixel is within the color range + */ +static inline bool lv_color_is_in_range(lv_color_t color, lv_color_t l_color, lv_color_t h_color) +{ + return (color.red <= h_color.red && + color.green <= h_color.green && + color.blue <= h_color.blue && + color.red >= l_color.red && + color.green >= l_color.green && + color.blue >= l_color.blue); +} + +/** + * Convert a RGB565 color to RGB888 + * @param c a RGB565 color on lv_color16_t + * @return the color + */ +static inline lv_color_t lv_color16_to_color(lv_color16_t c) +{ + return lv_color_make((uint8_t)(c.red << 3), (uint8_t)(c.green << 2), (uint8_t)(c.blue << 3)); +} + +/** + * Convert am RGB888 color to RGB565 stored in `uint16_t` + * @param color and RGB888 color + * @return `color` as RGB565 on `uin16_t` + */ +uint16_t lv_color_to_u16(lv_color_t color); + +/** + * Convert am RGB888 color to XRGB8888 stored in `uint32_t` + * @param color and RGB888 color + * @return `color` as XRGB8888 on `uin32_t` (the alpha channel is always set to 0xFF) + */ +uint32_t lv_color_to_u32(lv_color_t color); + +/** + * Mix two RGB565 colors + * @param c1 the first color (typically the foreground color) + * @param c2 the second color (typically the background color) + * @param mix 0..255, or LV_OPA_0/10/20... + * @return mix == 0: c2 + * mix == 255: c1 + * mix == 128: 0.5 x c1 + 0.5 x c2 + */ +uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_16_16_mix(uint16_t c1, uint16_t c2, uint8_t mix); + +/** + * Mix white to a color + * @param c the base color + * @param lvl the intensity of white (0: no change, 255: fully white) + * @return the mixed color + */ +lv_color_t lv_color_lighten(lv_color_t c, lv_opa_t lvl); + +/** + * Mix black to a color + * @param c the base color + * @param lvl the intensity of black (0: no change, 255: fully black) + * @return the mixed color + */ +lv_color_t lv_color_darken(lv_color_t c, lv_opa_t lvl); + +/** + * Convert a HSV color to RGB + * @param h hue [0..359] + * @param s saturation [0..100] + * @param v value [0..100] + * @return the given RGB color in RGB (with LV_COLOR_DEPTH depth) + */ +lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v); + +/** + * Convert a 32-bit RGB color to HSV + * @param r8 8-bit red + * @param g8 8-bit green + * @param b8 8-bit blue + * @return the given RGB color in HSV + */ +lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8); + +/** + * Convert a color to HSV + * @param color color + * @return the given color in HSV + */ +lv_color_hsv_t lv_color_to_hsv(lv_color_t color); + +/*Source: https://vuetifyjs.com/en/styles/colors/#material-colors*/ + +/** + * A helper for white color + * @return a white color + */ +lv_color_t lv_color_white(void); + +/** + * A helper for black color + * @return a black color + */ +lv_color_t lv_color_black(void); + +void lv_color_premultiply(lv_color32_t * c); + +void lv_color16_premultiply(lv_color16_t * c, lv_opa_t a); + +/** + * Get the luminance of a color: luminance = 0.3 R + 0.59 G + 0.11 B + * @param c a color + * @return the brightness [0..255] + */ +uint8_t lv_color_luminance(lv_color_t c); + +/** + * Get the luminance of a color16: luminance = 0.3 R + 0.59 G + 0.11 B + * @param c a color + * @return the brightness [0..255] + */ +uint8_t lv_color16_luminance(const lv_color16_t c); + +/** + * Get the luminance of a color24: luminance = 0.3 R + 0.59 G + 0.11 B + * @param c a color + * @return the brightness [0..255] + */ +uint8_t lv_color24_luminance(const uint8_t * c); + +/** + * Get the luminance of a color32: luminance = 0.3 R + 0.59 G + 0.11 B + * @param c a color + * @return the brightness [0..255] + */ +uint8_t lv_color32_luminance(lv_color32_t c); + + +/** + * Swap the endianness of an rgb565 color + * @param c a color + * @return the swapped color + */ +static inline uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_swap_16(uint16_t c) +{ + return (c >> 8) | (c << 8); +} + +/********************** + * MACROS + **********************/ + +#include "lv_palette.h" +#include "lv_color_op.h" + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_color_filter_dsc_t lv_color_filter_shade; + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_COLOR_H*/ diff --git a/include/lvgl/draw/lv_color_op.h b/include/lvgl/draw/lv_color_op.h new file mode 100644 index 0000000000..bfc7c32ac8 --- /dev/null +++ b/include/lvgl/draw/lv_color_op.h @@ -0,0 +1,105 @@ +/** + * @file lv_color_op.h + * + */ + +#ifndef LV_COLOR_OP_H +#define LV_COLOR_OP_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../debugging/lv_assert.h" +#include "../misc/lv_math.h" +#include "../draw/lv_color.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct _lv_color_filter_dsc_t; + +typedef lv_color_t (*lv_color_filter_cb_t)(const struct _lv_color_filter_dsc_t *, lv_color_t, lv_opa_t); + +struct _lv_color_filter_dsc_t { + lv_color_filter_cb_t filter_cb; + void * user_data; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Mix two colors with a given ratio. + * @param c1 the first color to mix (usually the foreground) + * @param c2 the second color to mix (usually the background) + * @param mix The ratio of the colors. 0: full `c2`, 255: full `c1`, 127: half `c1` and half`c2` + * @return the mixed color + */ +lv_color_t LV_ATTRIBUTE_FAST_MEM lv_color_mix(lv_color_t c1, lv_color_t c2, uint8_t mix); + +/** + * + * @param fg + * @param bg + * @return + * @note Use bg.alpha in the return value + * @note Use fg.alpha as mix ratio + */ +lv_color32_t lv_color_mix32(lv_color32_t fg, lv_color32_t bg); + +/** + * @brief Blends two premultiplied ARGB8888 colors while maintaining correct alpha compositing. + * + * This function correctly blends the foreground (fg) and background (bg) colors, + * ensuring that the output remains in a premultiplied alpha format. + * + * @param fg The foreground color in premultiplied ARGB8888 format. + * @param bg The background color in premultiplied ARGB8888 format. + * @return The resulting blended color in premultiplied ARGB8888 format. + * + * @note If the foreground is fully opaque, it is returned as is. + * @note If the foreground is fully transparent, the background is returned. + */ +lv_color32_t lv_color_mix32_premultiplied(lv_color32_t fg, lv_color32_t bg); + +/** + * Get the brightness of a color + * @param c a color + * @return brightness in range [0..255] + */ +uint8_t lv_color_brightness(lv_color_t c); + +void lv_color_filter_dsc_init(lv_color_filter_dsc_t * dsc, lv_color_filter_cb_t cb); + +/** + * Blend two colors that have not been pre-multiplied using their alpha values + * @param fg the foreground color + * @param bg the background color + * @return result color + */ +lv_color32_t lv_color_over32(lv_color32_t fg, lv_color32_t bg); + +/********************** + * PREDEFINED COLORS + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_COLOR_OP_H*/ diff --git a/include/lvgl/draw/lv_draw.h b/include/lvgl/draw/lv_draw.h new file mode 100644 index 0000000000..ab188217a5 --- /dev/null +++ b/include/lvgl/draw/lv_draw.h @@ -0,0 +1,393 @@ +/** + * @file lv_draw.h + * + */ + +/** + * Modified by NXP in 2024 + */ + +#ifndef LV_DRAW_H +#define LV_DRAW_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#include "../lv_types.h" +#include "../core/lv_style.h" +#include "../font/lv_text.h" +#include "../debugging/lv_profiler.h" +#include "../core/lv_matrix.h" +#include "../core/lv_event.h" +#include "lv_draw_buf.h" + +/********************* + * DEFINES + *********************/ +#define LV_DRAW_UNIT_NONE 0 +#define LV_DRAW_UNIT_IDLE -1 /**< The draw unit is idle, new dispatching might be requested to try again */ + +#if LV_DRAW_TRANSFORM_USE_MATRIX +#if !LV_USE_MATRIX +#error "LV_DRAW_TRANSFORM_USE_MATRIX requires LV_USE_MATRIX = 1" +#endif +#endif + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_DRAW_TASK_TYPE_NONE = 0, + LV_DRAW_TASK_TYPE_FILL, + LV_DRAW_TASK_TYPE_BORDER, + LV_DRAW_TASK_TYPE_BOX_SHADOW, + LV_DRAW_TASK_TYPE_LETTER, + LV_DRAW_TASK_TYPE_LABEL, + LV_DRAW_TASK_TYPE_IMAGE, + LV_DRAW_TASK_TYPE_LAYER, + LV_DRAW_TASK_TYPE_LINE, + LV_DRAW_TASK_TYPE_ARC, + LV_DRAW_TASK_TYPE_TRIANGLE, + LV_DRAW_TASK_TYPE_MASK_RECTANGLE, + LV_DRAW_TASK_TYPE_MASK_BITMAP, + LV_DRAW_TASK_TYPE_BLUR, +#if LV_USE_VECTOR_GRAPHIC + LV_DRAW_TASK_TYPE_VECTOR, +#endif +#if LV_USE_3DTEXTURE + LV_DRAW_TASK_TYPE_3D, +#endif +} lv_draw_task_type_t; + +typedef enum { + /** Waiting for an other task to be finished. + * For example in case of `LV_DRAW_TASK_TYPE_LAYER` (used to blend a layer) + * is blocked until all the draw tasks of the layer is rendered. */ + LV_DRAW_TASK_STATE_BLOCKED, + + /** The draw task is added to the layers list and waits to be rendered. */ + LV_DRAW_TASK_STATE_WAITING, + + /** The draw task is added to the command queue of the draw unit. + * As the queued task are executed in order it's possible to queue multiple draw task + * (for the same draw unit) even if they are depending on each other. + * Therefore `lv_draw_get_available_task` and `lv_draw_get_next_available_task` can return + * draw task for the same draw unit even if a dependent draw task is not finished ready yet.*/ + LV_DRAW_TASK_STATE_QUEUED, + + /** The draw task is being rendered. This draw task needs to be finished before + * `lv_draw_get_available_task` and `lv_draw_get_next_available_task` would + * return any depending draw tasks.*/ + LV_DRAW_TASK_STATE_IN_PROGRESS, + + /** The draw task is rendered. It will be removed from the draw task list of the layer + * and freed automatically. */ + LV_DRAW_TASK_STATE_FINISHED, +} lv_draw_task_state_t; + +struct _lv_layer_t { + /** Target draw buffer of the layer */ + lv_draw_buf_t * draw_buf; + + /** Linked list of draw tasks */ + lv_draw_task_t * draw_task_head; + + /** Parent layer */ + lv_layer_t * parent; + + /** Next layer */ + lv_layer_t * next; + + /** User data */ + void * user_data; + + /** The absolute coordinates of the buffer */ + lv_area_t buf_area; + + /** The physical clipping area relative to the display */ + lv_area_t phy_clip_area; + + /** + * NEVER USE IT DRAW UNITS. USED INTERNALLY DURING DRAW TASK CREATION. + * The current clip area with absolute coordinates, always the same or smaller than `buf_area` + * Can be set before new draw tasks are added to indicate the clip area of the draw tasks. + * Therefore `lv_draw_add_task()` always saves it in the new draw task to know the clip area when the draw task was added. + * During drawing the draw units also sees the saved clip_area and should use it during drawing. + * During drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks. + */ + lv_area_t _clip_area; + +#if LV_DRAW_TRANSFORM_USE_MATRIX + /** Transform matrix to be applied when rendering the layer */ + lv_matrix_t matrix; +#endif + + /** Partial y offset */ + int32_t partial_y_offset; + + /** Recolor of the layer */ + lv_color32_t recolor; + + /** The color format of the layer. LV_COLOR_FORMAT_... */ + lv_color_format_t color_format; + + /** Flag indicating all tasks are added */ + bool all_tasks_added; + + /** Opacity of the layer */ + lv_opa_t opa; +}; + +typedef struct { + /**The widget for which draw descriptor was created */ + lv_obj_t * obj; + + /**The widget part for which draw descriptor was created */ + uint32_t part; + + /**A widget type specific ID (e.g. table row index). See the docs of the given widget.*/ + uint32_t id1; + + /**A widget type specific ID (e.g. table column index). See the docs of the given widget.*/ + uint32_t id2; + + /**The target layer */ + lv_layer_t * layer; + + /*Drop shadow is part of every draw dsc as anything can have drop shadow*/ + + /**Drop shadow offset in X*/ + int16_t drop_shadow_ofs_x; + + /**Drop shadow offset in Y*/ + int16_t drop_shadow_ofs_y; + + /**Drop shadow color*/ + lv_color_t drop_shadow_color; + + /**Drop shadow opacity*/ + lv_opa_t drop_shadow_opa; + + /**Drop shadow blur radius*/ + int32_t drop_shadow_blur_radius: 20; + + /**Drop shadow blur quality*/ + lv_blur_quality_t drop_shadow_quality : 3; + + /**Size of the specific draw descriptor into which this base descriptor is embedded*/ + size_t dsc_size; + + /**Any custom user data*/ + void * user_data; +} lv_draw_dsc_base_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Used internally to initialize the drawing module + */ +void lv_draw_init(void); + +/** + * Deinitialize the drawing module + */ +void lv_draw_deinit(void); + +/** + * Allocate a new draw unit with the given size and appends it to the list of draw units + * @param size the size to allocate. E.g. `sizeof(my_draw_unit_t)`, + * where the first element of `my_draw_unit_t` is `lv_draw_unit_t`. + */ +void * lv_draw_create_unit(size_t size); + +/** + * Add an empty draw task to the draw task list of a layer. + * @param layer pointer to a layer + * @param coords the coordinates of the draw task + * @return the created draw task which needs to be + * further configured e.g. by added a draw descriptor + */ +lv_draw_task_t * lv_draw_add_task(lv_layer_t * layer, const lv_area_t * coords, lv_draw_task_type_t type); + +/** + * Needs to be called when a draw task is created and configured. + * It will send an event about the new draw task to the widget + * and assign it to a draw unit. + * @param layer pointer to a layer + * @param t pointer to a draw task + */ +void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t); + +/** + * Try dispatching draw tasks to draw units + */ +void lv_draw_dispatch(void); + +/** + * Used internally to try dispatching draw tasks of a specific layer + * @param disp pointer to a display on which the dispatching was requested + * @param layer pointer to a layer + * @return at least one draw task is being rendered (maybe it was taken earlier) + */ +bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer); + +/** + * Wait for a new dispatch request. + * It's blocking if `LV_USE_OS == 0` else it yields + */ +void lv_draw_dispatch_wait_for_request(void); + +/** + * Wait for draw finish in case of asynchronous task execution. + * If `LV_USE_OS == 0` it just return. + */ +void lv_draw_wait_for_finish(void); + +/** + * When a draw unit finished a draw task it needs to request dispatching + * to let LVGL assign a new draw task to it + */ +void lv_draw_dispatch_request(void); + +/** + * Get the total number of draw units. + */ +uint32_t lv_draw_get_unit_count(void); + +/** + * If there is only one draw unit check the first draw task if it's available. + * If there are multiple draw units call `lv_draw_get_next_available_task` to find a task. + * @param layer the draw layer to search in + * @param t_prev continue searching from this task + * @param draw_unit_id check the task where `preferred_draw_unit_id` equals this value or `LV_DRAW_UNIT_NONE` + * @return an available draw task or NULL if there is not any + */ +lv_draw_task_t * lv_draw_get_available_task(lv_layer_t * layer, lv_draw_task_t * t_prev, uint8_t draw_unit_id); + +/** + * Find and available draw task + * @param layer the draw layer to search in + * @param t_prev continue searching from this task + * @param draw_unit_id check the task where `preferred_draw_unit_id` equals this value or `LV_DRAW_UNIT_NONE` + * @return an available draw task or NULL if there is not any + */ +lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_task_t * t_prev, uint8_t draw_unit_id); + +/** + * Tell how many draw task are waiting to be drawn on the area of `t_check`. + * It can be used to determine if a GPU shall combine many draw tasks into one or not. + * If a lot of tasks are waiting for the current ones it makes sense to draw them one-by-one + * to not block the dependent tasks' rendering + * @param t_check the task whose dependent tasks shall be counted + * @return number of tasks depending on `t_check` + */ +uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check); + + +/** + * Send an event to the draw units + * @param name the name of the draw unit to send the event to + * @param code the event code + * @param param the event parameter + */ +void lv_draw_unit_send_event(const char * name, lv_event_code_t code, void * param); + +/** + * Initialize a layer + * @param layer pointer to a layer to initialize + */ +void lv_layer_init(lv_layer_t * layer); + +/** + * Reset the layer to a drawable state + * @param layer pointer to a layer to reset + */ +void lv_layer_reset(lv_layer_t * layer); + +/** + * Create (allocate) a new layer on a parent layer + * @param parent_layer the parent layer to which the layer will be merged when it's rendered + * @param color_format the color format of the layer + * @param area the areas of the layer (absolute coordinates) + * @return the new target_layer or NULL on error + */ +lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t color_format, const lv_area_t * area); + +/** + * Initialize a layer which is allocated by the user + * @param layer pointer the layer to initialize (its lifetime needs to be managed by the user) + * @param parent_layer the parent layer to which the layer will be merged when it's rendered + * @param color_format the color format of the layer + * @param area the areas of the layer (absolute coordinates) + * @return the new target_layer or NULL on error + */ +void lv_draw_layer_init(lv_layer_t * layer, lv_layer_t * parent_layer, lv_color_format_t color_format, + const lv_area_t * area); + +/** + * Try to allocate a buffer for the layer. + * @param layer pointer to a layer + * @return pointer to the allocated aligned buffer or NULL on failure + */ +void * lv_draw_layer_alloc_buf(lv_layer_t * layer); + +/** + * Got to a pixel at X and Y coordinate on a layer + * @param layer pointer to a layer + * @param x the target X coordinate + * @param y the target X coordinate + * @return `buf` offset to point to the given X and Y coordinate + */ +void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y); + +/** + * Get the type of a draw task + * @param t the draw task to get the type of + * @return the draw task type +*/ +lv_draw_task_type_t lv_draw_task_get_type(const lv_draw_task_t * t); + +/** + * Get the draw descriptor of a draw task + * @param t the draw task to get the draw descriptor of + * @return a void pointer to the draw descriptor +*/ +void * lv_draw_task_get_draw_dsc(const lv_draw_task_t * t); + +/** + * Get the draw area of a draw task + * @param t the draw task to get the draw area of + * @param area the destination where the draw area will be stored +*/ +void lv_draw_task_get_area(const lv_draw_task_t * t, lv_area_t * area); + + + +lv_layer_t * lv_draw_layer_create_drop_shadow(lv_layer_t * parent_layer, const lv_draw_dsc_base_t * base, + const lv_area_t * area); + +void lv_draw_layer_finish_drop_shadow(lv_layer_t * drop_shadow_layer, const lv_draw_dsc_base_t * base); + + +/********************** + * GLOBAL VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_H*/ diff --git a/include/lvgl/draw/lv_draw_3d.h b/include/lvgl/draw/lv_draw_3d.h new file mode 100644 index 0000000000..8a049a7dd1 --- /dev/null +++ b/include/lvgl/draw/lv_draw_3d.h @@ -0,0 +1,71 @@ +/** + * @file lv_draw_3d.h + * + */ + +#ifndef LV_DRAW_3D_H +#define LV_DRAW_3D_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw.h" + +#if LV_USE_3DTEXTURE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_draw_dsc_base_t base; + lv_3dtexture_id_t tex_id; + bool h_flip; + bool v_flip; + lv_opa_t opa; +} lv_draw_3d_dsc_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a 3D draw descriptor + * @param dsc pointer to a draw descriptor + */ +void lv_draw_3d_dsc_init(lv_draw_3d_dsc_t * dsc); + +/** + * Try to get a 3D draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_3D + */ +lv_draw_3d_dsc_t * lv_draw_task_get_3d_dsc(lv_draw_task_t * task); + +/** + * Create a 3D draw task + * @param layer pointer to a layer + * @param dsc pointer to an initialized `lv_draw_3d_dsc_t` variable + */ +void lv_draw_3d(lv_layer_t * layer, const lv_draw_3d_dsc_t * dsc, const lv_area_t * coords); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_3DTEXTURE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_3D_H*/ diff --git a/include/lvgl/draw/lv_draw_arc.h b/include/lvgl/draw/lv_draw_arc.h new file mode 100644 index 0000000000..18b12fc713 --- /dev/null +++ b/include/lvgl/draw/lv_draw_arc.h @@ -0,0 +1,109 @@ +/** + * @file lv_draw_arc.h + * + */ + +#ifndef LV_DRAW_ARC_H +#define LV_DRAW_ARC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_draw.h" +#include "lv_color.h" +#include "../core/lv_area.h" +#include "../core/lv_style.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_draw_dsc_base_t base; + + /**The color of the arc*/ + lv_color_t color; + + /**The width (thickness) of the arc */ + int32_t width; + + /**The start angle in 1 degree units (if `LV_USE_FLOAT` is enabled a float number can be also used) + * 0° is the 3 o'clock position, 90° is the 6 o'clock, etc. */ + lv_value_precise_t start_angle; + + /**The end angle, similarly to start_angle. */ + lv_value_precise_t end_angle; + + /**The center point of the arc. */ + lv_point_t center; + + /**An image source to be used instead of `color`. `NULL` if unused*/ + const void * img_src; + + /**The outer radius of the arc*/ + uint16_t radius; + + /**Opacity of the arc in 0...255 range. + * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ + lv_opa_t opa; + + /**1: Make the arc ends rounded*/ + uint8_t rounded : 1; +} lv_draw_arc_dsc_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize an arc draw descriptor. + * @param dsc pointer to a draw descriptor + */ +void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc); + +/** + * Try to get an arc draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_ARC + */ +lv_draw_arc_dsc_t * lv_draw_task_get_arc_dsc(lv_draw_task_t * task); + +/** + * Create an arc draw task. + * @param layer pointer to a layer + * @param dsc pointer to an initialized draw descriptor variable + */ +void lv_draw_arc(lv_layer_t * layer, const lv_draw_arc_dsc_t * dsc); + +/** + * Get an area the should be invalidated when the arcs angle changed between start_angle and end_ange + * @param x the x coordinate of the center of the arc + * @param y the y coordinate of the center of the arc + * @param radius the radius of the arc + * @param start_angle the start angle of the arc (0 deg on the bottom, 90 deg on the right) + * @param end_angle the end angle of the arc + * @param w width of the arc + * @param rounded true: the arc is rounded + * @param area store the area to invalidate here + */ +void lv_draw_arc_get_area(int32_t x, int32_t y, uint16_t radius, lv_value_precise_t start_angle, + lv_value_precise_t end_angle, + int32_t w, bool rounded, lv_area_t * area); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_ARC_H*/ diff --git a/include/lvgl/draw/lv_draw_blur.h b/include/lvgl/draw/lv_draw_blur.h new file mode 100644 index 0000000000..1b129e26f5 --- /dev/null +++ b/include/lvgl/draw/lv_draw_blur.h @@ -0,0 +1,83 @@ +/** + * @file lv_draw_blur.h + * + */ + +#ifndef LV_DRAW_BLUR_H +#define LV_DRAW_BLUR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "lv_draw.h" +#include "lv_color.h" +#include "../core/lv_area.h" +#include "../core/lv_style.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_draw_dsc_base_t base; + + /** + * The intensity of blur. + */ + int32_t blur_radius; + + /** + * The corner radius of the blurred area + */ + int32_t corner_radius; + + /** + * Sets whether to prefer speed or precision + */ + lv_blur_quality_t quality; + +} lv_draw_blur_dsc_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a blur draw descriptor + * @param dsc pointer to a draw descriptor + */ +void lv_draw_blur_dsc_init(lv_draw_blur_dsc_t * dsc); + +/** + * Try to get a blur draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_BLUR + */ +lv_draw_blur_dsc_t * lv_draw_task_get_blur_dsc(lv_draw_task_t * task); + +/** + * Create a blur draw task + * @param layer pointer to a layer + * @param dsc pointer to an initialized `lv_draw_blur_dsc_t` variable + * @param coords coordinates of the character + */ +void lv_draw_blur(lv_layer_t * layer, const lv_draw_blur_dsc_t * dsc, const lv_area_t * coords); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_BLUR_H*/ diff --git a/include/lvgl/draw/lv_draw_buf.h b/include/lvgl/draw/lv_draw_buf.h new file mode 100644 index 0000000000..78d684354d --- /dev/null +++ b/include/lvgl/draw/lv_draw_buf.h @@ -0,0 +1,389 @@ +/** + * @file lv_draw_buf.h + * + */ + +#ifndef LV_DRAW_BUF_H +#define LV_DRAW_BUF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" +#include "../core/lv_area.h" +#include "lv_color.h" +#include "../stdlib/lv_string.h" +#include "lv_image_dsc.h" + +/********************* + * DEFINES + *********************/ + +/** Use this value to let LVGL calculate stride automatically */ +#define LV_STRIDE_AUTO 0 +LV_EXPORT_CONST_INT(LV_STRIDE_AUTO); + +/** + * Stride alignment for draw buffers. + * It may vary between different color formats and hardware. + * Refine it to suit your needs. + */ + +#define LV_DRAW_BUF_STRIDE(w, cf) \ + LV_ROUND_UP(((w) * LV_COLOR_FORMAT_GET_BPP(cf) + 7) / 8, LV_DRAW_BUF_STRIDE_ALIGN) + +/** Allocate a slightly larger buffer, so we can adjust the start address to meet alignment */ +#define LV_DRAW_BUF_SIZE(w, h, cf) \ + (LV_DRAW_BUF_STRIDE(w, cf) * (h) + LV_DRAW_BUF_ALIGN + \ + LV_COLOR_INDEXED_PALETTE_SIZE(cf) * sizeof(lv_color32_t)) + +/** + * Define a static draw buffer with the given width, height, and color format. + * Stride alignment is set to LV_DRAW_BUF_STRIDE_ALIGN. + * + * For platform that needs special buffer alignment, call LV_DRAW_BUF_INIT_STATIC. + */ +#define LV_DRAW_BUF_DEFINE_STATIC(name, _w, _h, _cf) \ + static LV_ATTRIBUTE_MEM_ALIGN uint8_t buf_##name[LV_DRAW_BUF_SIZE(_w, _h, _cf)]; \ + static lv_draw_buf_t name = { \ + .header = { \ + .magic = LV_IMAGE_HEADER_MAGIC, \ + .cf = (_cf), \ + .flags = LV_IMAGE_FLAGS_MODIFIABLE, \ + .w = (_w), \ + .h = (_h), \ + .stride = LV_DRAW_BUF_STRIDE(_w, _cf), \ + .reserved_2 = 0, \ + }, \ + .data_size = sizeof(buf_##name), \ + .data = buf_##name, \ + .unaligned_data = buf_##name, \ + } + +#define LV_DRAW_BUF_INIT_STATIC(name) \ + do { \ + lv_image_header_t * header = &name.header; \ + lv_draw_buf_init(&name, header->w, header->h, (lv_color_format_t)header->cf, header->stride, buf_##name, sizeof(buf_##name)); \ + lv_draw_buf_set_flag(&name, LV_IMAGE_FLAGS_MODIFIABLE); \ + } while(0) + +/********************** + * TYPEDEFS + **********************/ + +typedef void * (*lv_draw_buf_malloc_cb_t)(size_t size, lv_color_format_t color_format); + +typedef void (*lv_draw_buf_free_cb_t)(void * draw_buf); + +typedef void (*lv_draw_buf_copy_cb_t)(lv_draw_buf_t * dest, const lv_area_t * dest_area, + const lv_draw_buf_t * src, const lv_area_t * src_area); + +typedef void * (*lv_draw_buf_align_cb_t)(void * buf, lv_color_format_t color_format); + +typedef void (*lv_draw_buf_cache_operation_cb_t)(const lv_draw_buf_t * draw_buf, const lv_area_t * area); + +typedef uint32_t (*lv_draw_buf_width_to_stride_cb_t)(uint32_t w, lv_color_format_t color_format); + +struct _lv_draw_buf_t { + lv_image_header_t header; + uint32_t data_size; /**< Total buf size in bytes */ + uint8_t * data; + void * unaligned_data; /**< Unaligned address of `data`, used internally by lvgl */ + const lv_draw_buf_handlers_t * handlers; /**< draw buffer alloc/free ops. */ +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the draw buffer with the default handlers. + * + * @param handlers the draw buffer handlers to set + */ +void lv_draw_buf_init_with_default_handlers(lv_draw_buf_handlers_t * handlers); + +/** + * Initialize the draw buffer with given handlers. + * + * @param handlers the draw buffer handlers to set + * @param buf_malloc_cb the callback to allocate memory for the buffer + * @param buf_free_cb the callback to free memory of the buffer + * @param buf_copy_cb the callback to copy a draw buffer to an other + * @param align_pointer_cb the callback to align the buffer + * @param invalidate_cache_cb the callback to invalidate the cache of the buffer + * @param flush_cache_cb the callback to flush buffer + * @param width_to_stride_cb the callback to calculate the stride based on the width and color format + */ +void lv_draw_buf_handlers_init(lv_draw_buf_handlers_t * handlers, + lv_draw_buf_malloc_cb_t buf_malloc_cb, + lv_draw_buf_free_cb_t buf_free_cb, + lv_draw_buf_copy_cb_t buf_copy_cb, + lv_draw_buf_align_cb_t align_pointer_cb, + lv_draw_buf_cache_operation_cb_t invalidate_cache_cb, + lv_draw_buf_cache_operation_cb_t flush_cache_cb, + lv_draw_buf_width_to_stride_cb_t width_to_stride_cb); + +/** + * Get the struct which holds the callbacks for draw buf management. + * Custom callback can be set on the returned value + * @return pointer to the struct of handlers + */ +lv_draw_buf_handlers_t * lv_draw_buf_get_handlers(void); +lv_draw_buf_handlers_t * lv_draw_buf_get_font_handlers(void); +lv_draw_buf_handlers_t * lv_draw_buf_get_image_handlers(void); + + +/** + * Align the address of a buffer. The buffer needs to be large enough for the real data after alignment + * @param buf the data to align + * @param color_format the color format of the buffer + * @return the aligned buffer + */ +void * lv_draw_buf_align(void * buf, lv_color_format_t color_format); + +/** + * Align the address of a buffer with custom draw buffer handlers. + * The buffer needs to be large enough for the real data after alignment + * @param handlers the draw buffer handlers + * @param buf the data to align + * @param color_format the color format of the buffer + * @return the aligned buffer + */ +void * lv_draw_buf_align_ex(const lv_draw_buf_handlers_t * handlers, void * buf, lv_color_format_t color_format); + +/** + * Invalidate the cache of the buffer + * @param draw_buf the draw buffer needs to be invalidated + * @param area the area to invalidate in the buffer, + * use NULL to invalidate the whole draw buffer address range + */ +void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area); + +/** + * Flush the cache of the buffer + * @param draw_buf the draw buffer needs to be flushed + * @param area the area to flush in the buffer, + * use NULL to flush the whole draw buffer address range + */ +void lv_draw_buf_flush_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area); + +/** + * Calculate the stride in bytes based on a width and color format + * @param w the width in pixels + * @param color_format the color format + * @return the stride in bytes + */ +uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format); + +/** + * Calculate the stride in bytes based on a width and color format + * @param handlers the draw buffer handlers + * @param w the width in pixels + * @param color_format the color format + * @return the stride in bytes + */ +uint32_t lv_draw_buf_width_to_stride_ex(const lv_draw_buf_handlers_t * handlers, uint32_t w, + lv_color_format_t color_format); + +/** + * Clear an area on the buffer + * @param draw_buf pointer to draw buffer + * @param a the area to clear, or NULL to clear the whole buffer + */ +void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a); + + +/** + * Note: Eventually, lv_draw_buf_malloc/free will be kept as private. + * For now, we use `create` to distinguish with malloc. + * + * Create an draw buf by allocating struct for `lv_draw_buf_t` and allocating a buffer for it + * that meets specified requirements. + * + * @param w the buffer width in pixels + * @param h the buffer height in pixels + * @param cf the color format for image + * @param stride the stride in bytes for image. Use 0 for automatic calculation based on + * w, cf, and global stride alignment configuration. + */ +lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride); + +/** + * Note: Eventually, lv_draw_buf_malloc/free will be kept as private. + * For now, we use `create` to distinguish with malloc. + * + * Create an draw buf by allocating struct for `lv_draw_buf_t` and allocating a buffer for it + * that meets specified requirements. + * + * @param handlers the draw buffer handlers + * @param w the buffer width in pixels + * @param h the buffer height in pixels + * @param cf the color format for image + * @param stride the stride in bytes for image. Use 0 for automatic calculation based on + * w, cf, and global stride alignment configuration. + */ +lv_draw_buf_t * lv_draw_buf_create_ex(const lv_draw_buf_handlers_t * handlers, uint32_t w, uint32_t h, + lv_color_format_t cf, uint32_t stride); + +/** + * Duplicate a draw buf with same image size, stride and color format. Copy the image data too. + * @param draw_buf the draw buf to duplicate + * @return the duplicated draw buf on success, NULL if failed + */ +lv_draw_buf_t * lv_draw_buf_dup(const lv_draw_buf_t * draw_buf); + +/** + * Duplicate a draw buf with same image size, stride and color format. Copy the image data too. + * @param handlers the draw buffer handlers + * @param draw_buf the draw buf to duplicate + * @return the duplicated draw buf on success, NULL if failed + */ +lv_draw_buf_t * lv_draw_buf_dup_ex(const lv_draw_buf_handlers_t * handlers, const lv_draw_buf_t * draw_buf); + +/** + * Initialize a draw buf with the given buffer and parameters. Clear draw buffer flag to zero. + * @param draw_buf the draw buf to initialize + * @param w the buffer width in pixels + * @param h the buffer height in pixels + * @param cf the color format + * @param stride the stride in bytes. Use 0 for automatic calculation + * @param data the buffer used for drawing. Unaligned `data` will be aligned internally + * @param data_size the size of the buffer in bytes + * @return return LV_RESULT_OK on success, LV_RESULT_INVALID otherwise + */ +lv_result_t lv_draw_buf_init(lv_draw_buf_t * draw_buf, uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride, + void * data, uint32_t data_size); + +/** + * Keep using the existing memory, reshape the draw buffer to the given width and height. + * Return NULL if data_size is smaller than the required size. + * @param draw_buf pointer to a draw buffer + * @param cf the new color format, use 0 or LV_COLOR_FORMAT_UNKNOWN to keep using the original color format. + * @param w the new width in pixels + * @param h the new height in pixels + * @param stride the stride in bytes for image. Use 0 for automatic calculation. + */ +lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t cf, uint32_t w, uint32_t h, + uint32_t stride); + +/** + * Destroy a draw buf by freeing the actual buffer if it's marked as LV_IMAGE_FLAGS_ALLOCATED in header. + * Then free the lv_draw_buf_t struct. + * + * @param draw_buf the draw buffer to destroy + */ +void lv_draw_buf_destroy(lv_draw_buf_t * draw_buf); + +/** + * Copy an area from a buffer to another + * @param dest pointer to the destination draw buffer + * @param dest_area the area to copy from the destination buffer, if NULL, use the whole buffer + * @param src pointer to the source draw buffer + * @param src_area the area to copy from the destination buffer, if NULL, use the whole buffer + * @note `dest_area` and `src_area` should have the same width and height + * @note The default copy function required `dest` and `src` to have the same color format. + * Overwriting dest->handlers->buf_copy_cb can resolve this limitation. + */ +void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area, + const lv_draw_buf_t * src, const lv_area_t * src_area); + +/** + * Return pointer to the buffer at the given coordinates + */ +void * lv_draw_buf_goto_xy(const lv_draw_buf_t * buf, uint32_t x, uint32_t y); + +/** + * Adjust the stride of a draw buf in place. + * @param src pointer to a draw buffer + * @param stride the new stride in bytes for image. Use LV_STRIDE_AUTO for automatic calculation. + * @return LV_RESULT_OK: success or LV_RESULT_INVALID: failed + */ +lv_result_t lv_draw_buf_adjust_stride(lv_draw_buf_t * src, uint32_t stride); + +/** + * Premultiply draw buffer color with alpha channel. + * If it's already premultiplied, return directly. + * Only color formats with alpha channel will be processed. + * + * @return LV_RESULT_OK: premultiply success + */ +lv_result_t lv_draw_buf_premultiply(lv_draw_buf_t * draw_buf); + + +/** + * Check if a draw buffer has a given flag. + * @param draw_buf pointer to a draw buffer + * @param flag the flag to check + * @return true: the flag is set, false: the flag is not set + */ +static inline bool lv_draw_buf_has_flag(const lv_draw_buf_t * draw_buf, lv_image_flags_t flag) +{ + return draw_buf->header.flags & flag; +} + +/** + * Set a flag to a draw buffer. + * @param draw_buf pointer to a draw buffer + * @param flag the flag to set + */ +static inline void lv_draw_buf_set_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) +{ + draw_buf->header.flags |= flag; +} + +/** + * Clear a flag from a draw buffer. + * @param draw_buf pointer to a draw buffer + * @param flag the flag to clear + */ +static inline void lv_draw_buf_clear_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) +{ + draw_buf->header.flags &= ~flag; +} + +/** + * As of now, draw buf share same definition as `lv_image_dsc_t`. + * And is interchangeable with `lv_image_dsc_t`. + */ + +lv_result_t lv_draw_buf_from_image(lv_draw_buf_t * buf, const lv_image_dsc_t * img); + +void lv_draw_buf_to_image(const lv_draw_buf_t * buf, lv_image_dsc_t * img); + +/** + * Set the palette color of an indexed image. Valid only for `LV_COLOR_FORMAT_I1/2/4/8` + * @param draw_buf pointer to an image descriptor + * @param index the palette color to set: + * - for `LV_COLOR_FORMAT_I1`: 0..1 + * - for `LV_COLOR_FORMAT_I2`: 0..3 + * - for `LV_COLOR_FORMAT_I4`: 0..15 + * - for `LV_COLOR_FORMAT_I8`: 0..255 + * @param color the color to set in lv_color32_t format + */ +void lv_draw_buf_set_palette(lv_draw_buf_t * draw_buf, uint8_t index, lv_color32_t color); + +/** + * @deprecated Use lv_draw_buf_set_palette instead. + */ +void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c); + +/** + * @deprecated Use lv_draw_buffer_create/destroy instead. + * Free the data pointer and dsc struct of an image. + */ +void lv_image_buf_free(lv_image_dsc_t * dsc); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_BUF_H*/ diff --git a/include/lvgl/draw/lv_draw_image.h b/include/lvgl/draw/lv_draw_image.h new file mode 100644 index 0000000000..3c011648b6 --- /dev/null +++ b/include/lvgl/draw/lv_draw_image.h @@ -0,0 +1,167 @@ +/** + * @file lv_draw_image.h + * + */ + +#ifndef LV_DRAW_IMAGE_H +#define LV_DRAW_IMAGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_draw.h" +#include "../image/lv_image_decoder.h" +#include "lv_draw_buf.h" +#include "../core/lv_style.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * MACROS + **********************/ + +struct _lv_draw_image_dsc_t { + lv_draw_dsc_base_t base; + + /**The image source: pointer to `lv_image_dsc_t` or a path to a file*/ + const void * src; + + /**The header of the image. Initialized internally in `lv_draw_image` */ + lv_image_header_t header; + + /**Clip the corner of the image with this radius. Use `LV_RADIUS_CIRCLE` for max. radius */ + int32_t clip_radius; + + /**The rotation of the image in 0.1 degree unit. E.g. 234 means 23.4° */ + int32_t rotation; + + /**Horizontal scale (zoom) of the image. + * 256 (LV_SCALE_NONE): means no zoom, 512 double size, 128 half size.*/ + int32_t scale_x; + + /**Same as `scale_y` but vertically*/ + int32_t scale_y; + + /**Parallelogram like transformation of the image horizontally in 0.1 degree unit. E.g. 456 means 45.6°.*/ + int32_t skew_x; + + /**Same as `skew_x` but vertically*/ + int32_t skew_y; + + /**The pivot point of transformation (scale and rotation). + * 0;0 is the top left corner of the image. Can be outside of the image too.*/ + lv_point_t pivot; + + /**Mix this color to the images. In case of `LV_COLOR_FORMAT_A8` it will be the color of the visible pixels*/ + lv_color_t recolor; + + /**The intensity of recoloring. 0 means, no recolor, 255 means full cover (transparent pixels remain transparent)*/ + lv_opa_t recolor_opa; + + /**Opacity in 0...255 range. + * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ + lv_opa_t opa; + + /**Describes how to blend the pixels of the image to the background. + * See `lv_blend_mode_t` for more details. + */ + lv_blend_mode_t blend_mode : 4; + + /**1: perform the transformation with anti-aliasing */ + uint16_t antialias : 1; + + /**If the image is smaller than the `image_area` field of `lv_draw_image_dsc_t` + * tile the image (repeat is both horizontally and vertically) to fill the + * `image_area` area*/ + uint16_t tile : 1; + + const lv_image_colorkey_t * colorkey; + + /**Used internally to store some information about the palette or the color of A8 images*/ + lv_draw_image_sup_t * sup; + + /** Used to indicate the entire original, non-clipped area where the image is to be drawn. + * This is important for: + * 1. Layer rendering, where it might happen that only a smaller area of the layer is rendered and e.g. + * `clip_radius` needs to know what the original image was. + * 2. Tiled images, where the target draw area is larger than the image to be tiled. + */ + lv_area_t image_area; + + /**Pointer to an A8 or L8 image descriptor to mask the image with. + * The mask is always center aligned. */ + const lv_image_dsc_t * bitmap_mask_src; +}; + +/** + * PErform the actual rendering of a decoded image + * @param t pointer to a draw task + * @param draw_dsc the draw descriptor of the image + * @param decoder_dsc pointer to the decoded image's descriptor + * @param sup supplementary data + * @param img_coords the absolute coordinates of the image + * @param clipped_img_area the absolute clip coordinates + */ +typedef void (*lv_draw_image_core_cb)(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc, + const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup, + const lv_area_t * img_coords, const lv_area_t * clipped_img_area); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize an image draw descriptor. + * @param dsc pointer to a draw descriptor + */ +void lv_draw_image_dsc_init(lv_draw_image_dsc_t * dsc); + +/** + * Try to get an image draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_IMAGE + */ +lv_draw_image_dsc_t * lv_draw_task_get_image_dsc(lv_draw_task_t * task); + +/** + * Create an image draw task + * @param layer pointer to a layer + * @param dsc pointer to an initialized draw descriptor + * @param coords the coordinates of the image + * @note `coords` can be small than the real image area + * (if only a part of the image is rendered) + * or can be larger (in case of tiled images). . + */ +void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords); + +/** + * Create a draw task to blend a layer to another layer + * @param layer pointer to a layer + * @param dsc pointer to an initialized draw descriptor. `src` must be set to the layer to blend + * @param coords the coordinates of the layer. + * @note `coords` can be small than the total widget area from which the layer is created + * (if only a part of the widget was rendered to a layer) + */ +void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords); + +/** + * Get the type of an image source + * @param src pointer to an image source: + * - pointer to an 'lv_image_t' variable (image stored internally and compiled into the code) + * - a path to a file (e.g. "S:/folder/image.bin") + * - or a symbol (e.g. LV_SYMBOL_CLOSE) + * @return type of the image source LV_IMAGE_SRC_VARIABLE/FILE/SYMBOL/UNKNOWN + */ +lv_image_src_t lv_image_src_get_type(const void * src); + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_IMAGE_H*/ diff --git a/include/lvgl/draw/lv_draw_label.h b/include/lvgl/draw/lv_draw_label.h new file mode 100644 index 0000000000..e6594774bd --- /dev/null +++ b/include/lvgl/draw/lv_draw_label.h @@ -0,0 +1,252 @@ +/** + * @file lv_draw_label.h + * + */ + +#ifndef LV_DRAW_LABEL_H +#define LV_DRAW_LABEL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_draw.h" +#include "lv_draw_rect.h" +#include "../font/lv_bidi.h" +#include "../font/lv_text.h" +#include "lv_color.h" +#include "../core/lv_style.h" + +/********************* + * DEFINES + *********************/ +#define LV_DRAW_LABEL_NO_TXT_SEL (0xFFFF) + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_draw_dsc_base_t base; + + /**The text to draw*/ + const char * text; + + /**The size of the text*/ + lv_point_t text_size; + + /**The font to use. Fallback fonts are also handled.*/ + const lv_font_t * font; + + /**Color of the text*/ + lv_color_t color; + + /**Extra space between the lines*/ + int32_t line_space; + + /**Extra space between the characters*/ + int32_t letter_space; + + /**Offset the text with this value horizontally*/ + int32_t ofs_x; + + /**Offset the text with this value vertically*/ + int32_t ofs_y; + + /**Rotation of the letters in 0.1 degree unit*/ + int32_t rotation; + + /**The first characters index for selection (not byte index). `LV_DRAW_LABEL_NO_TXT_SEL` for no selection*/ + uint32_t sel_start; + + /**The last characters's index for selection (not byte index). `LV_DRAW_LABEL_NO_TXT_SEL` for no selection*/ + uint32_t sel_end; + + /**Color of the selected characters*/ + lv_color_t sel_color; + + /**Background color of the selected characters*/ + lv_color_t sel_bg_color; + + /**The number of characters to render. 0: means render until reaching the `\0` termination.*/ + uint32_t text_length; + + /**The alignment of the text `LV_TEXT_ALIGN_LEFT/RIGHT/CENTER`*/ + lv_text_align_t align; + + /**The base direction. Used when type setting Right-to-left (e.g. Arabic) texts*/ + lv_base_dir_t bidi_dir; + + /**Opacity of the text in 0...255 range. + * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ + lv_opa_t opa; + + /**Letter outline stroke opacity */ + lv_opa_t outline_stroke_opa; + + /**Text decoration, e.g. underline*/ + lv_text_decor_t decor : 3; + + /**Some flags to control type setting*/ + lv_text_flag_t flag : 5; + + /**1: malloc a buffer and copy `text` there. + * 0: `text` will be valid during rendering.*/ + uint8_t text_local : 1; + + /**Indicate that the text is constant and its pointer can be safely saved e.g. in a cache.*/ + uint8_t text_static : 1; + + /**1: already executed lv_bidi_process_paragraph. + * 0: has not been executed lv_bidi_process_paragraph.*/ + uint8_t has_bided : 1; + + /**Pointer to an externally stored struct where some data can be cached to speed up rendering*/ + lv_draw_label_hint_t * hint; + + /* Properties of the letter outlines */ + lv_color_t outline_stroke_color; + int32_t outline_stroke_width; + +} lv_draw_label_dsc_t; + +typedef struct { + lv_draw_dsc_base_t base; + + uint32_t unicode; + const lv_font_t * font; + lv_color_t color; + + int32_t rotation; + int32_t scale_x; + int32_t scale_y; + int32_t skew_x; + int32_t skew_y; + lv_point_t pivot; + + lv_opa_t opa; + lv_text_decor_t decor : 3; + lv_blend_mode_t blend_mode : 4; + + /* Properties of the letter outlines */ + lv_opa_t outline_stroke_opa; + int32_t outline_stroke_width; + lv_color_t outline_stroke_color; + +} lv_draw_letter_dsc_t; + +/** + * Passed as a parameter to `lv_draw_label_iterate_characters` to + * draw the characters one by one + * @param t pointer to a draw task + * @param dsc pointer to `lv_draw_glyph_dsc_t` to describe the character to draw + * if NULL don't draw character + * @param fill_dsc pointer to a fill descriptor to draw a background for the character or + * underline or strike through + * if NULL do not fill anything + * @param fill_area the area to fill + * if NULL do not fill anything + */ +typedef void(*lv_draw_glyph_cb_t)(lv_draw_task_t * t, lv_draw_glyph_dsc_t * dsc, lv_draw_fill_dsc_t * fill_dsc, + const lv_area_t * fill_area); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_letter_dsc_init(lv_draw_letter_dsc_t * dsc); + +/** + * Initialize a label draw descriptor + * @param dsc pointer to a draw descriptor + */ +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc); + +/** + * Try to get a label draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_LABEL + */ +lv_draw_label_dsc_t * lv_draw_task_get_label_dsc(lv_draw_task_t * task); + +/** + * Initialize a glyph draw descriptor. + * Used internally. + * @param dsc pointer to a draw descriptor + */ +void lv_draw_glyph_dsc_init(lv_draw_glyph_dsc_t * dsc); + +/** + * Create a draw task to render a text + * @param layer pointer to a layer + * @param dsc pointer to draw descriptor + * @param coords coordinates of the character + */ +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_label(lv_layer_t * layer, const lv_draw_label_dsc_t * dsc, + const lv_area_t * coords); + +/** + * Create a draw task to render a single character + * @param layer pointer to a layer + * @param dsc pointer to draw descriptor + * @param point position of the label + * @param unicode_letter the letter to draw + */ +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_character(lv_layer_t * layer, lv_draw_label_dsc_t * dsc, + const lv_point_t * point, uint32_t unicode_letter); + +/** + * Draw a single letter + * @param layer pointer to a layer + * @param dsc pointer to draw descriptor + * @param point position of the label + */ +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_letter(lv_layer_t * layer, lv_draw_letter_dsc_t * dsc, + const lv_point_t * point); + +/** + * Should be used during rendering the characters to get the position and other + * parameters of the characters + * @param t pointer to a draw task + * @param dsc pointer to draw descriptor + * @param coords coordinates of the label + * @param cb a callback to call to draw each glyphs one by one + */ +void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_dsc_t * dsc, + const lv_area_t * coords, lv_draw_glyph_cb_t cb); + +/** + * @brief Draw a single letter using the provided draw unit, glyph descriptor, position, font, and callback. + * + * This function is responsible for rendering a single character from a text string, + * applying the necessary styling described by the glyph descriptor (`dsc`). It handles + * the retrieval of the glyph's description, checks its visibility within the clipping area, + * and invokes the callback (`cb`) to render the glyph at the specified position (`pos`) + * using the given font (`font`). + * + * @param t Pointer to the drawing task. + * @param dsc Pointer to the descriptor containing styling for the glyph to be drawn. + * @param pos Pointer to the point coordinates where the letter should be drawn. + * @param font Pointer to the font containing the glyph. + * @param letter The Unicode code point of the letter to be drawn. + * @param cb Callback function to execute the actual rendering of the glyph. + */ +void lv_draw_unit_draw_letter(lv_draw_task_t * t, lv_draw_glyph_dsc_t * dsc, const lv_point_t * pos, + const lv_font_t * font, uint32_t letter, lv_draw_glyph_cb_t cb); + +/*********************** + * GLOBAL VARIABLES + ***********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_LABEL_H*/ diff --git a/include/lvgl/draw/lv_draw_line.h b/include/lvgl/draw/lv_draw_line.h new file mode 100644 index 0000000000..760fdcc2bd --- /dev/null +++ b/include/lvgl/draw/lv_draw_line.h @@ -0,0 +1,123 @@ +/** + * @file lv_draw_line.h + * + */ + +#ifndef LV_DRAW_LINE_H +#define LV_DRAW_LINE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_draw.h" +#include "lv_color.h" +#include "../core/lv_area.h" +#include "../core/lv_style.h" + +/********************* + * DEFINES + *********************/ +#if LV_USE_FLOAT +#include +#define LV_DRAW_LINE_POINT_NONE FLT_MAX +#else +#define LV_DRAW_LINE_POINT_NONE INT32_MAX +#endif + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_draw_dsc_base_t base; + + /**The first point of the line. If `LV_USE_FLOAT` is enabled float number can be also used. + *Ignored if `points` are set*/ + lv_point_precise_t p1; + + /**The second point of the line. If `LV_USE_FLOAT` is enabled float number can be also used + * Ignored if `points` are set*/ + lv_point_precise_t p2; + + /**Array of points to draw. If `LV_USE_FLOAT` is enabled, float numbers can also be used.*/ + lv_point_precise_t * points; + + /** + * Number of points in the `points` + */ + int32_t point_cnt; + + /**The color of the line*/ + lv_color_t color; + + /**The width (thickness) of the line*/ + int32_t width; + + /** The length of a dash (0: don't dash)*/ + int32_t dash_width; + + /** The length of the gaps between dashes (0: don't dash)*/ + int32_t dash_gap; + + /**Opacity of the line in 0...255 range. + * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ + lv_opa_t opa; + + /**Make the line start rounded*/ + uint8_t round_start : 1; + + /**Make the line end rounded*/ + uint8_t round_end : 1; + + /**1: Do not bother with line ending (if it's not visible for any reason) */ + uint8_t raw_end : 1; +} lv_draw_line_dsc_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a line draw descriptor + * @param dsc pointer to a draw descriptor + */ +void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc); + +/** + * Try to get a line draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_LINE + */ +lv_draw_line_dsc_t * lv_draw_task_get_line_dsc(lv_draw_task_t * task); + +/** + * Create a line draw task + * @param layer pointer to a layer + * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable + */ +void lv_draw_line(lv_layer_t * layer, const lv_draw_line_dsc_t * dsc); + +/** + * A helper function to call a callback which draws a line between two points. + * This way it doesn't matter if ``p1, p2`` or ``points`` were used as it calls the + * ``callback`` as needed. + * @param t draw task + * @param dsc pointer to a draw descriptor + * @param draw_line_cb a callback that draws a line between ``dsc->p1`` and ``dsc->p2`` + */ +void lv_draw_line_iterate(lv_draw_task_t * t, lv_draw_line_dsc_t * dsc, + void (*draw_line_cb)(lv_draw_task_t * t, const lv_draw_line_dsc_t * dsc)); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_LINE_H*/ diff --git a/include/lvgl/draw/lv_draw_mask.h b/include/lvgl/draw/lv_draw_mask.h new file mode 100644 index 0000000000..ec8144541b --- /dev/null +++ b/include/lvgl/draw/lv_draw_mask.h @@ -0,0 +1,75 @@ +/** + * @file lv_draw_mask.h + * + */ + +#ifndef LV_DRAW_MASK_H +#define LV_DRAW_MASK_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_draw.h" +#include "lv_color.h" +#include "../core/lv_area.h" +#include "../core/lv_style.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct _lv_draw_mask_rect_dsc_t { + lv_draw_dsc_base_t base; + + /**The area to mask.*/ + lv_area_t area; + + /**The radius of masking*/ + int32_t radius; + + /**0: clear the content out of the `area`. + * 1: don't touch the area out of `area`*/ + uint32_t keep_outside : 1; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a rectangle mask draw descriptor. + * @param dsc pointer to a draw descriptor + */ +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_rect_dsc_init(lv_draw_mask_rect_dsc_t * dsc); + +/** + * Try to get a rectangle mask draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_MASK_RECTANGLE + */ +lv_draw_mask_rect_dsc_t * lv_draw_task_get_mask_rect_dsc(lv_draw_task_t * task); + +/** + * Create a draw task to mask a rectangle from the buffer + * @param layer pointer to a layer + * @param dsc pointer to a draw descriptor + */ +void lv_draw_mask_rect(lv_layer_t * layer, const lv_draw_mask_rect_dsc_t * dsc); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_MASK_H*/ diff --git a/include/lvgl/draw/lv_draw_rect.h b/include/lvgl/draw/lv_draw_rect.h new file mode 100644 index 0000000000..8dde6dcb19 --- /dev/null +++ b/include/lvgl/draw/lv_draw_rect.h @@ -0,0 +1,239 @@ +/** + * @file lv_draw_rect.h + * + */ + +#ifndef LV_DRAW_RECT_H +#define LV_DRAW_RECT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_draw.h" +#include "lv_color.h" +#include "../core/lv_area.h" +#include "../core/lv_style.h" + +/********************* + * DEFINES + *********************/ +#define LV_RADIUS_CIRCLE 0x7FFF /**< A very big radius to always draw as circle*/ +LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE); + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_draw_dsc_base_t base; + + int32_t radius; + + /*Background img*/ + const void * bg_image_src; + const void * bg_image_symbol_font; + lv_color_t bg_image_recolor; + lv_opa_t bg_image_opa; + lv_opa_t bg_image_recolor_opa; + uint8_t bg_image_tiled; + /*Background*/ + lv_opa_t bg_opa; + /*Border*/ + lv_opa_t border_opa; + /*Outline */ + lv_opa_t outline_opa; + /*Shadow*/ + lv_opa_t shadow_opa; + + /*Background*/ + lv_color_t bg_color; /**< First element of a gradient is a color, so it maps well here*/ + lv_grad_dsc_t bg_grad; + + const lv_image_colorkey_t * bg_image_colorkey; + + /*Border*/ + lv_color_t border_color; + int32_t border_width; + lv_border_side_t border_side : 5; + uint8_t border_post : 1; /*The border will be drawn later*/ + + /*Outline*/ + lv_color_t outline_color; + int32_t outline_width; + int32_t outline_pad; + + /*Shadow*/ + lv_color_t shadow_color; + int32_t shadow_width; + int32_t shadow_offset_x; + int32_t shadow_offset_y; + int32_t shadow_spread; +} lv_draw_rect_dsc_t; + +typedef struct { + lv_draw_dsc_base_t base; + + /**Radius, LV_RADIUS_CIRCLE for max. radius */ + int32_t radius; + + /**Opacity in 0...255 range. + * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ + lv_opa_t opa; + + /**The color of the rectangle. + * If the gradient is set (grad.dir!=LV_GRAD_DIR_NONE) it's ignored. */ + lv_color_t color; + + /**Describe a gradient. If `grad.dir` is not `LV_GRAD_DIR_NONE` `color` will be ignored*/ + lv_grad_dsc_t grad; +} lv_draw_fill_dsc_t; + +typedef struct { + lv_draw_dsc_base_t base; + + /**Radius, LV_RADIUS_CIRCLE for max. radius */ + int32_t radius; + + /**The color of the border. */ + lv_color_t color; + + + /**The width of the border in pixels */ + int32_t width; + + /**Opacity in 0...255 range. + * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ + lv_opa_t opa; + + /**LV_BORDER_SIDE_NONE/LEFT/RIGHT/TOP/BOTTOM/FULL. + * LV_BORDER_SIDE_INTERNAL is an information for upper layers + * and shouldn't be used here. */ + lv_border_side_t side : 5; + +} lv_draw_border_dsc_t; + +typedef struct { + lv_draw_dsc_base_t base; + + /**Radius, LV_RADIUS_CIRCLE for max. radius */ + int32_t radius; + + /**Color of shadow */ + lv_color_t color; + + /**Width of the shadow. (radius of the blur)*/ + int32_t width; + + /**Make the rectangle larger with this value in all directions. Can be negative too. */ + int32_t spread; + + /**Offset the rectangle horizontally.*/ + int32_t ofs_x; + + /**Offset the rectangle vertically.*/ + int32_t ofs_y; + + /**Opacity in 0...255 range. + * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ + lv_opa_t opa; + + /**Set `bg_cover` to 1 if the background will cover the shadow. + * It's a hint to the renderer about it might skip some masking.*/ + uint8_t bg_cover : 1; +} lv_draw_box_shadow_dsc_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a rectangle draw descriptor. + * @param dsc pointer to a draw descriptor + */ +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc); + +/** + * Initialize a fill draw descriptor. + * @param dsc pointer to a draw descriptor + */ +void lv_draw_fill_dsc_init(lv_draw_fill_dsc_t * dsc); + +/** + * Try to get a fill draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_FILL + */ +lv_draw_fill_dsc_t * lv_draw_task_get_fill_dsc(lv_draw_task_t * task); + +/** + * Fill an area + * @param layer pointer to a layer + * @param dsc pointer to an initialized draw descriptor variable + * @param coords the coordinates of the rectangle + */ +void lv_draw_fill(lv_layer_t * layer, const lv_draw_fill_dsc_t * dsc, const lv_area_t * coords); + +/** + * Initialize a border draw descriptor. + * @param dsc pointer to a draw descriptor + */ +void lv_draw_border_dsc_init(lv_draw_border_dsc_t * dsc); + +/** + * Try to get a border draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_BORDER + */ +lv_draw_border_dsc_t * lv_draw_task_get_border_dsc(lv_draw_task_t * task); + +/** + * Draw a border + * @param layer pointer to a layer + * @param dsc pointer to an initialized draw descriptor variable + * @param coords the coordinates of the rectangle + */ +void lv_draw_border(lv_layer_t * layer, const lv_draw_border_dsc_t * dsc, const lv_area_t * coords); + +/** + * Initialize a box shadow draw descriptor. + * @param dsc pointer to a draw descriptor + */ +void lv_draw_box_shadow_dsc_init(lv_draw_box_shadow_dsc_t * dsc); + +/** + * Try to get a box shadow draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_BOX_SHADOW + */ +lv_draw_box_shadow_dsc_t * lv_draw_task_get_box_shadow_dsc(lv_draw_task_t * task); + +/** + * Draw a box shadow + * @param layer pointer to a layer + * @param dsc pointer to an initialized draw descriptor variable + * @param coords the coordinates of the rectangle + */ +void lv_draw_box_shadow(lv_layer_t * layer, const lv_draw_box_shadow_dsc_t * dsc, const lv_area_t * coords); + +/** + * The rectangle is a wrapper for fill, border, bg. image and box shadow. + * Internally fill, border, image and box shadow draw tasks will be created. + * @param layer pointer to a layer + * @param dsc pointer to an initialized draw descriptor variable + * @param coords the coordinates of the rectangle + */ +void lv_draw_rect(lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_RECT_H*/ diff --git a/include/lvgl/draw/lv_draw_triangle.h b/include/lvgl/draw/lv_draw_triangle.h new file mode 100644 index 0000000000..ec0e5b0e7d --- /dev/null +++ b/include/lvgl/draw/lv_draw_triangle.h @@ -0,0 +1,76 @@ +/** + * @file lv_draw_triangle.h + * + */ + +#ifndef LV_DRAW_TRIANGLE_H +#define LV_DRAW_TRIANGLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_rect.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef struct { + lv_draw_dsc_base_t base; + + /**Points of the triangle. If `LV_USE_FLOAT` is enabled floats can be used here*/ + lv_point_precise_t p[3]; + + /**Color of the triangle*/ + lv_color_t color; + + /**Opacity of the arc in 0...255 range. + * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ + lv_opa_t opa; + + /**Describe a gradient. If `grad.dir` is not `LV_GRAD_DIR_NONE` `color` will be ignored*/ + lv_grad_dsc_t grad; + +} lv_draw_triangle_dsc_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a triangle draw descriptor + * @param draw_dsc pointer to a draw descriptor + */ +void lv_draw_triangle_dsc_init(lv_draw_triangle_dsc_t * draw_dsc); + +/** + * Try to get a triangle draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_TRIANGLE + */ +lv_draw_triangle_dsc_t * lv_draw_task_get_triangle_dsc(lv_draw_task_t * task); + +/** + * Create a triangle draw task + * @param layer pointer to a layer + * @param draw_dsc pointer to an initialized `lv_draw_triangle_dsc_t` object + */ +void lv_draw_triangle(lv_layer_t * layer, const lv_draw_triangle_dsc_t * draw_dsc); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_TRIANGLE_H*/ diff --git a/include/lvgl/draw/lv_draw_vector.h b/include/lvgl/draw/lv_draw_vector.h new file mode 100644 index 0000000000..c5d445560c --- /dev/null +++ b/include/lvgl/draw/lv_draw_vector.h @@ -0,0 +1,572 @@ +/** + * @file lv_draw_vector.h + * + */ + +#ifndef LV_DRAW_VECTOR_H +#define LV_DRAW_VECTOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../misc/lv_array.h" +#include "../core/lv_matrix.h" +#include "lv_draw_image.h" + +#if LV_USE_VECTOR_GRAPHIC + +#if !LV_USE_MATRIX +#error "lv_draw_vector needs LV_USE_MATRIX = 1" +#endif + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_VECTOR_FILL_NONZERO = 0, + LV_VECTOR_FILL_EVENODD, +} lv_vector_fill_t; + +typedef enum { + LV_VECTOR_STROKE_CAP_BUTT = 0, + LV_VECTOR_STROKE_CAP_SQUARE, + LV_VECTOR_STROKE_CAP_ROUND, +} lv_vector_stroke_cap_t; + +typedef enum { + LV_VECTOR_STROKE_JOIN_MITER = 0, + LV_VECTOR_STROKE_JOIN_BEVEL, + LV_VECTOR_STROKE_JOIN_ROUND, +} lv_vector_stroke_join_t; + +typedef enum { + LV_VECTOR_PATH_QUALITY_MEDIUM = 0, /* default*/ + LV_VECTOR_PATH_QUALITY_HIGH, + LV_VECTOR_PATH_QUALITY_LOW, +} lv_vector_path_quality_t; + +typedef enum { + LV_VECTOR_BLEND_SRC_OVER = 0, + LV_VECTOR_BLEND_SRC_IN, + LV_VECTOR_BLEND_DST_OVER, + LV_VECTOR_BLEND_DST_IN, + LV_VECTOR_BLEND_SCREEN, + LV_VECTOR_BLEND_MULTIPLY, + LV_VECTOR_BLEND_NONE, + LV_VECTOR_BLEND_ADDITIVE, + LV_VECTOR_BLEND_SUBTRACTIVE, +} lv_vector_blend_t; + +typedef enum { + LV_VECTOR_PATH_OP_MOVE_TO = 0, + LV_VECTOR_PATH_OP_LINE_TO, + LV_VECTOR_PATH_OP_QUAD_TO, + LV_VECTOR_PATH_OP_CUBIC_TO, + LV_VECTOR_PATH_OP_CLOSE, +} lv_vector_path_op_t; + +typedef enum { + LV_VECTOR_DRAW_STYLE_SOLID = 0, + LV_VECTOR_DRAW_STYLE_PATTERN, + LV_VECTOR_DRAW_STYLE_GRADIENT, +} lv_vector_draw_style_t; + +typedef enum { + LV_VECTOR_GRADIENT_SPREAD_PAD = 0, + LV_VECTOR_GRADIENT_SPREAD_REPEAT, + LV_VECTOR_GRADIENT_SPREAD_REFLECT, +} lv_vector_gradient_spread_t; + +typedef enum { + LV_VECTOR_GRADIENT_STYLE_LINEAR = 0, + LV_VECTOR_GRADIENT_STYLE_RADIAL, +} lv_vector_gradient_style_t; + +typedef enum { + LV_VECTOR_FILL_UNITS_OBJECT_BOUNDING_BOX = 0, /** Relative coordinates relative to the object bounding box. */ + LV_VECTOR_FILL_UNITS_USER_SPACE_ON_USE, /** Absolute coordinates relative to the layer's coordinate system */ +} lv_vector_fill_units_t; + +struct _lv_fpoint_t { + float x; + float y; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Transform the coordinates of a point using given matrix + * @param matrix pointer to a matrix + * @param point pointer to a point + */ +void lv_matrix_transform_point(const lv_matrix_t * matrix, lv_fpoint_t * point); + +/** + * Transform all the coordinates of a path using given matrix + * @param matrix pointer to a matrix + * @param path pointer to a path + */ +void lv_matrix_transform_path(const lv_matrix_t * matrix, lv_vector_path_t * path); + +/** + * Create a vector graphic path object + * @param quality the quality hint of path + * @return pointer to the created path object + */ +lv_vector_path_t * lv_vector_path_create(lv_vector_path_quality_t quality); + +/** + * Copy a path data to another + * @param target_path pointer to a path + * @param path pointer to source path + */ +void lv_vector_path_copy(lv_vector_path_t * target_path, const lv_vector_path_t * path); + +/** + * Clear path data + * @param path pointer to a path + */ +void lv_vector_path_clear(lv_vector_path_t * path); + +/** + * Delete the graphic path object + * @param path pointer to a path + */ +void lv_vector_path_delete(lv_vector_path_t * path); + +/** + * Begin a new sub path and set a point to path + * @param path pointer to a path + * @param p pointer to a `lv_fpoint_t` variable + */ +void lv_vector_path_move_to(lv_vector_path_t * path, const lv_fpoint_t * p); + +/** + * Add a line to the path from last point to the point + * @param path pointer to a path + * @param p pointer to a `lv_fpoint_t` variable + */ +void lv_vector_path_line_to(lv_vector_path_t * path, const lv_fpoint_t * p); + +/** + * Add a quadratic bezier line to the path from last point to the point + * @param path pointer to a path + * @param p1 pointer to a `lv_fpoint_t` variable for control point + * @param p2 pointer to a `lv_fpoint_t` variable for end point + */ +void lv_vector_path_quad_to(lv_vector_path_t * path, const lv_fpoint_t * p1, const lv_fpoint_t * p2); + +/** + * Add a cubic bezier line to the path from last point to the point + * @param path pointer to a path + * @param p1 pointer to a `lv_fpoint_t` variable for first control point + * @param p2 pointer to a `lv_fpoint_t` variable for second control point + * @param p3 pointer to a `lv_fpoint_t` variable for end point + */ +void lv_vector_path_cubic_to(lv_vector_path_t * path, const lv_fpoint_t * p1, const lv_fpoint_t * p2, + const lv_fpoint_t * p3); + +/** + * Add ellipse arc to the path from last point to the point + * @param path pointer to a path + * @param radius_x the x radius for ellipse arc + * @param radius_y the y radius for ellipse arc + * @param rotate_angle the rotate angle for arc + * @param large_arc true for large arc, otherwise small + * @param clockwise true for clockwise, otherwise anticlockwise + * @param p pointer to a `lv_fpoint_t` variable for end point + */ +void lv_vector_path_arc_to(lv_vector_path_t * path, float radius_x, float radius_y, float rotate_angle, + bool large_arc, + bool clockwise, const lv_fpoint_t * p); + +/** + * Close the sub path + * @param path pointer to a path + */ +void lv_vector_path_close(lv_vector_path_t * path); + +/** + * Get the bounding box of a path + * @param path pointer to a path + * @param area pointer to a `lv_area_t` variable for bounding box + */ +void lv_vector_path_get_bounding(const lv_vector_path_t * path, lv_area_t * area); + +/** + * Add a rectangle to the path by x/y/w/h. rx/ry are corner radii + * @param path pointer to a path + * @param x the x coordinate of the top-left corner of the rectangle + * @param y the y coordinate of the top-left corner of the rectangle + * @param w the width of the rectangle + * @param h the height of the rectangle + * @param rx the horizontal radius for rounded rectangle + * @param ry the vertical radius for rounded rectangle + */ +void lv_vector_path_append_rectangle(lv_vector_path_t * path, float x, float y, float w, float h, float rx, float ry); + +/** + * Add a rectangle to the path (legacy api, recommend use lv_vector_path_append_rectangle instead) + * @param path pointer to a path + * @param rect pointer to a `lv_area_t` variable + * @param rx the horizontal radius for rounded rectangle + * @param ry the vertical radius for rounded rectangle + */ +static inline void lv_vector_path_append_rect(lv_vector_path_t * path, const lv_area_t * rect, float rx, float ry) +{ + LV_ASSERT_NULL(path); + LV_ASSERT_NULL(rect); + + lv_vector_path_append_rectangle(path, rect->x1, rect->y1, (float)lv_area_get_width(rect), + (float)lv_area_get_height(rect), rx, ry); +} + +/** + * Add a circle to the path + * @param path pointer to a path + * @param c pointer to a `lv_fpoint_t` variable for center of the circle + * @param rx the horizontal radius for circle + * @param ry the vertical radius for circle + */ +void lv_vector_path_append_circle(lv_vector_path_t * path, const lv_fpoint_t * c, float rx, float ry); + +/** + * Add a arc to the path + * @param path pointer to a path + * @param c pointer to a `lv_fpoint_t` variable for center of the circle + * @param radius the radius for arc + * @param start_angle the start angle for arc + * @param sweep the sweep angle for arc, could be negative + * @param pie true: draw a pie, false: draw a arc + */ +void lv_vector_path_append_arc(lv_vector_path_t * path, const lv_fpoint_t * c, float radius, float start_angle, + float sweep, bool pie); + +/** + * Add an sub path to the path + * @param path pointer to a path + * @param subpath pointer to another path which will be added + */ +void lv_vector_path_append_path(lv_vector_path_t * path, const lv_vector_path_t * subpath); + +/** + * Create a vector graphic descriptor + * @param layer pointer to a layer + * @return pointer to the created descriptor + */ +lv_draw_vector_dsc_t * lv_draw_vector_dsc_create(lv_layer_t * layer); + +/** + * Delete the vector graphic descriptor + * @param dsc pointer to a vector graphic descriptor + */ +void lv_draw_vector_dsc_delete(lv_draw_vector_dsc_t * dsc); + +/** + * Set a matrix to current transformation matrix. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix. + * @param dsc pointer to a vector graphic descriptor + * @param matrix pointer to a matrix + */ +void lv_draw_vector_dsc_set_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix); + +/** + * Set blend mode for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this blend mode. + * @param dsc pointer to a vector graphic descriptor + * @param blend the blend mode to be set in `lv_vector_blend_t` + */ +void lv_draw_vector_dsc_set_blend_mode(lv_draw_vector_dsc_t * dsc, lv_vector_blend_t blend); + +/** + * Set the fill color for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color. + * @param dsc pointer to a vector graphic descriptor + * @param color the color to be set in lv_color32_t format + */ +void lv_draw_vector_dsc_set_fill_color32(lv_draw_vector_dsc_t * dsc, lv_color32_t color); + +/** + * Set fill color for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color. + * @param dsc pointer to a vector graphic descriptor + * @param color the color to be set in lv_color_t format + */ +void lv_draw_vector_dsc_set_fill_color(lv_draw_vector_dsc_t * dsc, lv_color_t color); + +/** + * Set fill opacity for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this opacity. + * @param dsc pointer to a vector graphic descriptor + * @param opa the opacity to be set in lv_opa_t format + */ +void lv_draw_vector_dsc_set_fill_opa(lv_draw_vector_dsc_t * dsc, lv_opa_t opa); + +/** + * Set fill rule for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this fill rule. + * @param dsc pointer to a vector graphic descriptor + * @param rule the fill rule to be set in lv_vector_fill_t format + */ +void lv_draw_vector_dsc_set_fill_rule(lv_draw_vector_dsc_t * dsc, lv_vector_fill_t rule); + +/** + * Set the fill units for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this fill units. + * @param dsc pointer to a vector graphic descriptor + * @param units the units to be set in lv_vector_fill_units_t format + * @note The units can be either relative to the object bounding box or absolute in user space. + * This API specifically affects the drawing position of the fill image and does not impact other elements. + */ +void lv_draw_vector_dsc_set_fill_units(lv_draw_vector_dsc_t * dsc, const lv_vector_fill_units_t units); + +/** + * Set fill image for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this fill image. + * @param dsc pointer to a vector graphic descriptor + * @param img_dsc pointer to a `lv_draw_image_dsc_t` variable + */ +void lv_draw_vector_dsc_set_fill_image(lv_draw_vector_dsc_t * dsc, const lv_draw_image_dsc_t * img_dsc); + +/** + * Set fill linear gradient for descriptor + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient. + * @param dsc pointer to a vector graphic descriptor + * @param x1 the x for start point + * @param y1 the y for start point + * @param x2 the x for end point + * @param y2 the y for end point + */ +void lv_draw_vector_dsc_set_fill_linear_gradient(lv_draw_vector_dsc_t * dsc, float x1, float y1, float x2, float y2); + +/** + * Set fill radial gradient radius for descriptor + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient. + * @param dsc pointer to a vector graphic descriptor + * @param cx the x for center of the circle + * @param cy the y for center of the circle + * @param radius the radius for circle + */ +void lv_draw_vector_dsc_set_fill_radial_gradient(lv_draw_vector_dsc_t * dsc, float cx, float cy, float radius); + +/** + * Set fill radial gradient spread for descriptor + * @param dsc pointer to a vector graphic descriptor + * @param spread the gradient spread to be set in lv_vector_gradient_spread_t format + */ +void lv_draw_vector_dsc_set_fill_gradient_spread(lv_draw_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread); + +/** + * Set fill gradient color stops for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient color stops. + * @param dsc pointer to a vector graphic descriptor + * @param stops an array of `lv_grad_stop_t` variables + * @param count the number of stops in the array, range: 0..LV_GRADIENT_MAX_STOPS + */ +void lv_draw_vector_dsc_set_fill_gradient_color_stops(lv_draw_vector_dsc_t * dsc, const lv_grad_stop_t * stops, + uint16_t count); + +/** + * Set a matrix to current fill transformation matrix + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix. + * @param dsc pointer to a vector graphic descriptor + * @param matrix pointer to a matrix + */ +void lv_draw_vector_dsc_set_fill_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix); + +/** + * Set stroke color for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color. + * @param dsc pointer to a vector graphic descriptor + * @param color the color to be set in lv_color32_t format + */ +void lv_draw_vector_dsc_set_stroke_color32(lv_draw_vector_dsc_t * dsc, lv_color32_t color); + +/** + * Set stroke color for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color. + * @param dsc pointer to a vector graphic descriptor + * @param color the color to be set in lv_color_t format + */ +void lv_draw_vector_dsc_set_stroke_color(lv_draw_vector_dsc_t * dsc, lv_color_t color); + +/** + * Set stroke opacity for descriptor + * @param dsc pointer to a vector graphic descriptor + * @param opa the opacity to be set in lv_opa_t format + */ +void lv_draw_vector_dsc_set_stroke_opa(lv_draw_vector_dsc_t * dsc, lv_opa_t opa); + +/** + * Set stroke line width for descriptor. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this stroke width. + * @param dsc pointer to a vector graphic descriptor + * @param width the stroke line width + */ +void lv_draw_vector_dsc_set_stroke_width(lv_draw_vector_dsc_t * dsc, float width); + +/** + * Set stroke line dash pattern for descriptor + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this dash. + * @param dsc pointer to a vector graphic descriptor + * @param dash_pattern an array of values that specify the segments of dash line + * @param dash_count the length of dash pattern array + */ +void lv_draw_vector_dsc_set_stroke_dash(lv_draw_vector_dsc_t * dsc, float * dash_pattern, uint16_t dash_count); + +/** + * Set stroke line cap style for descriptor + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this line cap. + * @param dsc pointer to a vector graphic descriptor + * @param cap the line cap to be set in lv_vector_stroke_cap_t format + */ +void lv_draw_vector_dsc_set_stroke_cap(lv_draw_vector_dsc_t * dsc, lv_vector_stroke_cap_t cap); + +/** + * Set stroke line join style for descriptor + * @param dsc pointer to a vector graphic descriptor + * @param join the line join to be set in lv_vector_stroke_join_t format + */ +void lv_draw_vector_dsc_set_stroke_join(lv_draw_vector_dsc_t * dsc, lv_vector_stroke_join_t join); + +/** + * Set stroke miter limit for descriptor + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this miter limit. + * @param dsc pointer to a vector graphic descriptor + * @param miter_limit the stroke miter_limit + */ +void lv_draw_vector_dsc_set_stroke_miter_limit(lv_draw_vector_dsc_t * dsc, uint16_t miter_limit); + +/** + * Set stroke linear gradient for descriptor + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient. + * @param dsc pointer to a vector graphic descriptor + * @param x1 the x for start point + * @param y1 the y for start point + * @param x2 the x for end point + * @param y2 the y for end point + */ +void lv_draw_vector_dsc_set_stroke_linear_gradient(lv_draw_vector_dsc_t * dsc, float x1, float y1, float x2, float y2); +/** + * Set stroke radial gradient for descriptor + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient. + * @param dsc pointer to a vector graphic descriptor + * @param cx the x for center of the circle + * @param cy the y for center of the circle + * @param radius the radius for circle + */ +void lv_draw_vector_dsc_set_stroke_radial_gradient(lv_draw_vector_dsc_t * dsc, float cx, float cy, float radius); + +/** + * Set stroke color stops for descriptor + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient spread. + * @param dsc pointer to a vector graphic descriptor + * @param spread the gradient spread to be set in lv_vector_gradient_spread_t format + */ +void lv_draw_vector_dsc_set_stroke_gradient_spread(lv_draw_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread); + +/** + * Set stroke color stops for descriptor + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color stops. + * @param dsc pointer to a vector graphic descriptor + * @param stops an array of `lv_grad_stop_t` variables + * @param count the number of stops in the array + */ +void lv_draw_vector_dsc_set_stroke_gradient_color_stops(lv_draw_vector_dsc_t * dsc, const lv_grad_stop_t * stops, + uint16_t count); + +/** + * Set a matrix to current stroke transformation matrix. + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix. + * @param dsc pointer to a vector graphic descriptor + * @param matrix pointer to a matrix + */ +void lv_draw_vector_dsc_set_stroke_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix); + +/** + * Set current transformation matrix to identity matrix + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix. + * @param dsc pointer to a vector graphic descriptor + */ +void lv_draw_vector_dsc_identity(lv_draw_vector_dsc_t * dsc); + +/** + * Change the scale factor of current transformation matrix + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this scale. + * @param dsc pointer to a vector graphic descriptor + * @param scale_x the scale factor for the X direction + * @param scale_y the scale factor for the Y direction + */ +void lv_draw_vector_dsc_scale(lv_draw_vector_dsc_t * dsc, float scale_x, float scale_y); + +/** + * Rotate current transformation matrix with origin + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this rotation. + * @param dsc pointer to a vector graphic descriptor + * @param degree angle to rotate + */ +void lv_draw_vector_dsc_rotate(lv_draw_vector_dsc_t * dsc, float degree); + +/** + * Translate current transformation matrix to new position + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this rotation. + * @param dsc pointer to a vector graphic descriptor + * @param tx the amount of translate in x direction + * @param ty the amount of translate in y direction + */ +void lv_draw_vector_dsc_translate(lv_draw_vector_dsc_t * dsc, float tx, float ty); + +/** + * Change the skew factor of current transformation matrix + * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this skew. + * @param dsc pointer to a vector graphic descriptor + * @param skew_x the skew factor for x direction + * @param skew_y the skew factor for y direction + */ +void lv_draw_vector_dsc_skew(lv_draw_vector_dsc_t * dsc, float skew_x, float skew_y); + +/** + * Add a graphic path to the draw list. + * It will use colors, opacity, matrix and other parameters set + * by `lv_draw_vector_dsc_set_fill_color()` and similar functions. + * @param dsc pointer to a vector graphic descriptor + * @param path pointer to a path + */ +void lv_draw_vector_dsc_add_path(lv_draw_vector_dsc_t * dsc, const lv_vector_path_t * path); + +/** + * Clear a rectangle area use current fill color + * @param dsc pointer to a vector graphic descriptor + * @param rect the area to clear in the buffer + */ +void lv_draw_vector_dsc_clear_area(lv_draw_vector_dsc_t * dsc, const lv_area_t * rect); + +/** + * Draw all the vector graphic paths + * @param dsc pointer to a vector graphic descriptor + */ +void lv_draw_vector(lv_draw_vector_dsc_t * dsc); + +/** + * Try to get a vector draw descriptor from a draw task. + * @param task draw task + * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_VECTOR + */ +lv_draw_vector_dsc_t * lv_draw_task_get_vector_dsc(lv_draw_task_t * task); + +/* Traverser for task list */ +typedef void (*vector_draw_task_cb)(void * ctx, const lv_vector_path_t * path, const lv_vector_path_ctx_t * dsc); + +#endif /* LV_USE_VECTOR_GRAPHIC */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_DRAW_VECTOR_H */ diff --git a/include/lvgl/draw/lv_grad.h b/include/lvgl/draw/lv_grad.h new file mode 100644 index 0000000000..813540fc9c --- /dev/null +++ b/include/lvgl/draw/lv_grad.h @@ -0,0 +1,176 @@ +/** + * @file lv_grad.h + * + */ + +#ifndef LV_GRAD_H +#define LV_GRAD_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "lv_color.h" +#include "../core/lv_area.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * The direction of the gradient. + */ +typedef enum { + LV_GRAD_DIR_NONE, /**< No gradient (the `grad_color` property is ignored)*/ + LV_GRAD_DIR_VER, /**< Simple vertical (top to bottom) gradient*/ + LV_GRAD_DIR_HOR, /**< Simple horizontal (left to right) gradient*/ + LV_GRAD_DIR_LINEAR, /**< Linear gradient defined by start and end points. Can be at any angle.*/ + LV_GRAD_DIR_RADIAL, /**< Radial gradient defined by start and end circles*/ + LV_GRAD_DIR_CONICAL, /**< Conical gradient defined by center point, start and end angles*/ +} lv_grad_dir_t; + +/** + * Gradient behavior outside the defined range. + */ +typedef enum { + LV_GRAD_EXTEND_PAD, /**< Repeat the same color*/ + LV_GRAD_EXTEND_REPEAT, /**< Repeat the pattern*/ + LV_GRAD_EXTEND_REFLECT, /**< Repeat the pattern mirrored*/ +} lv_grad_extend_t; + +/** A gradient stop definition. + * This matches a color and a position in a virtual 0-255 scale. + */ +typedef struct { + lv_color_t color; /**< The stop color */ + lv_opa_t opa; /**< The opacity of the color*/ + uint8_t frac; /**< The stop position in 1/255 unit */ +} lv_grad_stop_t; + +/** A descriptor of a gradient. */ +typedef struct { + lv_grad_stop_t stops[LV_GRADIENT_MAX_STOPS]; /**< A gradient stop array */ + uint8_t stops_count; /**< The number of used stops in the array */ + lv_grad_dir_t dir : 4; /**< The gradient direction. + * Any of LV_GRAD_DIR_NONE, LV_GRAD_DIR_VER, LV_GRAD_DIR_HOR, + * LV_GRAD_TYPE_LINEAR, LV_GRAD_TYPE_RADIAL, LV_GRAD_TYPE_CONICAL */ + lv_grad_extend_t extend : 3; /**< Behaviour outside the defined range. + * LV_GRAD_EXTEND_NONE, LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT, LV_GRAD_EXTEND_REFLECT */ + union { + /*Linear gradient parameters*/ + struct { + lv_point_t start; /**< Linear gradient vector start point */ + lv_point_t end; /**< Linear gradient vector end point */ + } linear; + /*Radial gradient parameters*/ + struct { + lv_point_t focal; /**< Center of the focal (starting) circle in local coordinates */ + /* (can be the same as the ending circle to create concentric circles) */ + lv_point_t focal_extent; /**< Point on the circle (can be the same as the center) */ + lv_point_t end; /**< Center of the ending circle in local coordinates */ + lv_point_t end_extent; /**< Point on the circle determining the radius of the gradient */ + } radial; + /*Conical gradient parameters*/ + struct { + lv_point_t center; /**< Conical gradient center point */ + int16_t start_angle; /**< Start angle 0..3600 */ + int16_t end_angle; /**< End angle 0..3600 */ + } conical; + } params; + void * state; +} lv_grad_dsc_t; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize gradient color map from a table + * @param grad pointer to a gradient descriptor + * @param colors color array + * @param fracs position array (0..255): if NULL, then colors are distributed evenly + * @param opa opacity array: if NULL, then LV_OPA_COVER is assumed + * @param num_stops number of gradient stops (1..LV_GRADIENT_MAX_STOPS) + */ +void lv_grad_init_stops(lv_grad_dsc_t * grad, const lv_color_t colors[], const lv_opa_t opa[], + const uint8_t fracs[], int num_stops); + +/** + * Helper function to initialize a horizontal gradient. + * @param dsc gradient descriptor + */ +void lv_grad_horizontal_init(lv_grad_dsc_t * dsc); + +/** + * Helper function to initialize a vertical gradient. + * @param dsc gradient descriptor + */ +void lv_grad_vertical_init(lv_grad_dsc_t * dsc); + +/** + * Helper function to initialize linear gradient + * @param dsc gradient descriptor + * @param from_x start x position: can be a coordinate or an lv_pct() value + * predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well + * @param from_y start y position + * @param to_x end x position + * @param to_y end y position + * @param extend one of LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT or LV_GRAD_EXTEND_REFLECT + */ +void lv_grad_linear_init(lv_grad_dsc_t * dsc, int32_t from_x, int32_t from_y, int32_t to_x, int32_t to_y, + lv_grad_extend_t extend); + +/** + * Helper function to initialize radial gradient + * @param dsc gradient descriptor + * @param center_x center x position: can be a coordinate or an lv_pct() value + * predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well + * @param center_y center y position + * @param to_x point on the end circle x position + * @param to_y point on the end circle y position + * @param extend one of LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT or LV_GRAD_EXTEND_REFLECT + */ +void lv_grad_radial_init(lv_grad_dsc_t * dsc, int32_t center_x, int32_t center_y, int32_t to_x, int32_t to_y, + lv_grad_extend_t extend); + +/** + * Set focal (starting) circle of a radial gradient + * @param dsc gradient descriptor + * @param center_x center x position: can be a coordinate or an lv_pct() value + * predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well + * @param center_y center y position + * @param radius radius of the starting circle (NOTE: this must be a scalar number, not percentage) + */ +void lv_grad_radial_set_focal(lv_grad_dsc_t * dsc, int32_t center_x, int32_t center_y, int32_t radius); + +/** + * Helper function to initialize conical gradient + * @param dsc gradient descriptor + * @param center_x center x position: can be a coordinate or an lv_pct() value + * predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well + * @param center_y center y position + * @param start_angle start angle in degrees + * @param end_angle end angle in degrees + * @param extend one of LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT or LV_GRAD_EXTEND_REFLECT + */ +void lv_grad_conical_init(lv_grad_dsc_t * dsc, int32_t center_x, int32_t center_y, int32_t start_angle, + int32_t end_angle, lv_grad_extend_t extend); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_GRAD_H*/ diff --git a/include/lvgl/draw/lv_image_dsc.h b/include/lvgl/draw/lv_image_dsc.h new file mode 100644 index 0000000000..790961ce17 --- /dev/null +++ b/include/lvgl/draw/lv_image_dsc.h @@ -0,0 +1,152 @@ +/** + * @file lv_image_dsc.h + * + */ + +#ifndef LV_IMAGE_DSC_H +#define LV_IMAGE_DSC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +/********************* + * DEFINES + *********************/ + +/** Magic number for lvgl image, 9 means lvgl version 9 + * It must be neither a valid ASCII character nor larger than 0x80. See `lv_image_src_get_type`. + */ +#define LV_IMAGE_HEADER_MAGIC (0x19) +LV_EXPORT_CONST_INT(LV_IMAGE_HEADER_MAGIC); + +/** + * Flags reserved for user, lvgl won't use these bits. + */ +#define LV_IMAGE_FLAGS_USER_MASK (0xFF00) + +/********************** + * TYPEDEFS + **********************/ + +typedef enum _lvimage_flags_t { + /** + * For RGB map of the image data, mark if it's pre-multiplied with alpha. + * For indexed image, this bit indicated palette data is pre-multiplied with alpha. + */ + LV_IMAGE_FLAGS_PREMULTIPLIED = 0x0001, + /** + * The image data is compressed, so decoder needs to decode image firstly. + * If this flag is set, the whole image will be decompressed upon decode, and + * `get_area_cb` won't be necessary. + */ + LV_IMAGE_FLAGS_COMPRESSED = 0x0008, + + /*Below flags are applicable only for draw buffer header.*/ + + /** + * The image is allocated from heap, thus should be freed after use. + */ + LV_IMAGE_FLAGS_ALLOCATED = 0x0010, + + /** + * If the image data is malloced and can be processed in place. + * In image decoder post processing, this flag means we modify it in-place. + */ + LV_IMAGE_FLAGS_MODIFIABLE = 0x0020, + + /** + * The image has custom drawing methods. + */ + LV_IMAGE_FLAGS_CUSTOM_DRAW = 0x0040, + + /** + * Flags reserved for user, lvgl won't use these bits. + */ + LV_IMAGE_FLAGS_USER1 = 0x0100, + LV_IMAGE_FLAGS_USER2 = 0x0200, + LV_IMAGE_FLAGS_USER3 = 0x0400, + LV_IMAGE_FLAGS_USER4 = 0x0800, + LV_IMAGE_FLAGS_USER5 = 0x1000, + LV_IMAGE_FLAGS_USER6 = 0x2000, + LV_IMAGE_FLAGS_USER7 = 0x4000, + LV_IMAGE_FLAGS_USER8 = 0x8000, +} lv_image_flags_t; + +typedef enum { + LV_IMAGE_COMPRESS_NONE = 0, + LV_IMAGE_COMPRESS_RLE, /**< LVGL custom RLE compression */ + LV_IMAGE_COMPRESS_LZ4, +} lv_image_compress_t; + +#if LV_BIG_ENDIAN_SYSTEM +typedef struct { + uint32_t reserved_2: 16; /**< Reserved to be used later*/ + uint32_t stride: 16; /**< Number of bytes in a row*/ + uint32_t h: 16; + uint32_t w: 16; + uint32_t flags: 16; /**< Image flags, see `lv_image_flags_t`*/ + uint32_t cf : 8; /**< Color format: See `lv_color_format_t`*/ + uint32_t magic: 8; /**< Magic number. Must be LV_IMAGE_HEADER_MAGIC*/ +} lv_image_header_t; +#else +typedef struct { + uint32_t magic: 8; /**< Magic number. Must be LV_IMAGE_HEADER_MAGIC*/ + uint32_t cf : 8; /**< Color format: See `lv_color_format_t`*/ + uint32_t flags: 16; /**< Image flags, see `lv_image_flags_t`*/ + + uint32_t w: 16; + uint32_t h: 16; + uint32_t stride: 16; /**< Number of bytes in a row*/ + uint32_t reserved_2: 16; /**< Reserved to be used later*/ +} lv_image_header_t; +#endif + +typedef struct { + void * buf; + uint32_t stride; /**< Number of bytes in a row*/ +} lv_yuv_plane_t; + +typedef union { + lv_yuv_plane_t yuv; /**< packed format*/ + struct { + lv_yuv_plane_t y; + lv_yuv_plane_t u; + lv_yuv_plane_t v; + } planar; /**< planar format with 3 plane*/ + struct { + lv_yuv_plane_t y; + lv_yuv_plane_t uv; + } semi_planar; /**< planar format with 2 plane*/ +} lv_yuv_buf_t; + +/** + * Struct to describe a constant image resource. + * It's similar to lv_draw_buf_t, but the data is constant. + */ +typedef struct { + lv_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; /**< A reserved field to make it has same size as lv_draw_buf_t*/ + const void * reserved_2; /**< A reserved field to make it has same size as lv_draw_buf_t*/ +} lv_image_dsc_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_IMAGE_DSC_H*/ diff --git a/include/lvgl/draw/lv_palette.h b/include/lvgl/draw/lv_palette.h new file mode 100644 index 0000000000..3512537ace --- /dev/null +++ b/include/lvgl/draw/lv_palette.h @@ -0,0 +1,68 @@ +/** + * @file lv_palette.h + * + */ + +#ifndef LV_PALETTE_H +#define LV_PALETTE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_color.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_PALETTE_RED, + LV_PALETTE_PINK, + LV_PALETTE_PURPLE, + LV_PALETTE_DEEP_PURPLE, + LV_PALETTE_INDIGO, + LV_PALETTE_BLUE, + LV_PALETTE_LIGHT_BLUE, + LV_PALETTE_CYAN, + LV_PALETTE_TEAL, + LV_PALETTE_GREEN, + LV_PALETTE_LIGHT_GREEN, + LV_PALETTE_LIME, + LV_PALETTE_YELLOW, + LV_PALETTE_AMBER, + LV_PALETTE_ORANGE, + LV_PALETTE_DEEP_ORANGE, + LV_PALETTE_BROWN, + LV_PALETTE_BLUE_GREY, + LV_PALETTE_GREY, + LV_PALETTE_LAST, + LV_PALETTE_NONE = 0xff, +} lv_palette_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/*Source: https://vuetifyjs.com/en/styles/colors/#material-colors*/ + +lv_color_t lv_palette_main(lv_palette_t p); +lv_color_t lv_palette_lighten(lv_palette_t p, uint8_t lvl); +lv_color_t lv_palette_darken(lv_palette_t p, uint8_t lvl); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_PALETTE_H*/ diff --git a/include/lvgl/draw/lv_snapshot.h b/include/lvgl/draw/lv_snapshot.h new file mode 100644 index 0000000000..81b523ce6f --- /dev/null +++ b/include/lvgl/draw/lv_snapshot.h @@ -0,0 +1,101 @@ +/** + * @file lv_snapshot.h + * + */ + +#ifndef LV_SNAPSHOT_H +#define LV_SNAPSHOT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +#if LV_USE_SNAPSHOT + +#include +#include + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Take snapshot for object with its children, create the draw buffer as needed. + * @param obj the object to generate snapshot. + * @param cf color format for generated image. + * @return a pointer to an draw buffer containing snapshot image, or NULL if failed. + */ +lv_draw_buf_t * lv_snapshot_take(lv_obj_t * obj, lv_color_format_t cf); + +/** + * Create a draw buffer to store the snapshot image for object. + * @param obj the object to generate snapshot. + * @param cf color format for generated image. + * @return a pointer to an draw buffer ready for taking snapshot, or NULL if failed. + */ +lv_draw_buf_t * lv_snapshot_create_draw_buf(lv_obj_t * obj, lv_color_format_t cf); + +/** + * Reshape the draw buffer to prepare for taking snapshot for obj. + * This is usually used to check if the existing draw buffer is enough for + * obj snapshot. If return LV_RESULT_INVALID, you should create a new one. + * @param draw_buf the draw buffer to reshape. + * @param obj the object to generate snapshot. + */ +lv_result_t lv_snapshot_reshape_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf); + +/** + * Take snapshot for object with its children, save image info to provided buffer. + * @param obj the object to generate snapshot. + * @param cf color format for new snapshot image. + * It could differ with cf of `draw_buf` as long as the new cf will fit in. + * @param draw_buf the draw buffer to store the image result. It's reshaped automatically. + * @return LV_RESULT_OK on success, LV_RESULT_INVALID on error. + */ +lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * obj, lv_color_format_t cf, lv_draw_buf_t * draw_buf); + +/** + * @deprecated Use `lv_draw_buf_destroy` instead. + * + * Free the snapshot image returned by @ref lv_snapshot_take + * @param dsc the image descriptor generated by lv_snapshot_take. + */ +void lv_snapshot_free(lv_image_dsc_t * dsc); + +/** + * Take snapshot for object with its children, save image info to provided buffer. + * @param obj the object to generate snapshot. + * @param cf color format for generated image. + * @param dsc image descriptor to store the image result. + * @param buf the buffer to store image data. It must meet align requirement. + * @param buf_size provided buffer size in bytes. + * @return LV_RESULT_OK on success, LV_RESULT_INVALID on error. + * @deprecated Use lv_snapshot_take_to_draw_buf instead. + */ +lv_result_t lv_snapshot_take_to_buf(lv_obj_t * obj, lv_color_format_t cf, lv_image_dsc_t * dsc, + void * buf, + uint32_t buf_size); + +/********************** + * MACROS + **********************/ +#endif /*LV_USE_SNAPSHOT*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif diff --git a/include/lvgl/draw/sw/lv_draw_sw_utils.h b/include/lvgl/draw/sw/lv_draw_sw_utils.h new file mode 100644 index 0000000000..c859c1e018 --- /dev/null +++ b/include/lvgl/draw/sw/lv_draw_sw_utils.h @@ -0,0 +1,111 @@ +/** + * @file lv_draw_sw_utils.h + * + */ + +#ifndef LV_DRAW_SW_UTILS_H +#define LV_DRAW_SW_UTILS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" + +#if LV_USE_DRAW_SW + +#include "../../lv_types.h" +#include "../../display/lv_display.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Converts an I1 buffer to ARGB8888 format. + * @param buf_i1 pointer to buffer with I1 formatted render + * @param buf_argb8888 pointer to buffer for ARGB8888 render + * @param width width in pixels of the area. + * must be a multiple of 8. + * @param height height in pixels of the area + * @param buf_i1_stride stride of i1 buffer in bytes + * @param buf_argb8888_stride stride of argb8888 buffer in bytes + * @param index0_color color of the 0 bits of i1 buf + * @param index1_color color of the 1 bits of i1 buf + */ +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); + +/** + * 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. + * @param buf pointer to buffer + * @param buf_size_px number of pixels in the buffer + */ +void lv_draw_sw_rgb565_swap(void * buf, uint32_t buf_size_px); + +/** + * 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. + * @param buf pointer to the buffer to be inverted + * @param buf_size size of the buffer in bytes + */ +void lv_draw_sw_i1_invert(void * buf, uint32_t buf_size); + + +/** + * 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. + * @param buf pointer to the buffer to be converted + * @param buf_size size of the buffer in bytes + * @param width width of the buffer + * @param height height of the buffer + * @param out_buf pointer to the output buffer + * @param out_buf_size size of the output buffer in bytes + * @param bit_order_lsb bit order of the resulting vtiled buffer + */ +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); + +/** + * Rotate a buffer into another buffer + * @param src the source buffer + * @param dest the destination buffer + * @param src_width source width in pixels + * @param src_height source height in pixels + * @param src_stride source stride in bytes (number of bytes in a row) + * @param dest_stride destination stride in bytes (number of bytes in a row) + * @param rotation LV_DISPLAY_ROTATION_0/90/180/270 + * @param color_format LV_COLOR_FORMAT_RGB565/RGB888/XRGB8888/ARGB8888 + */ +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); + +/*********************** + * GLOBAL VARIABLES + ***********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_DRAW_SW*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_SW_UTILS_H*/ diff --git a/include/lvgl/drivers/display/lv_draw_eve_display.h b/include/lvgl/drivers/display/lv_draw_eve_display.h new file mode 100644 index 0000000000..8ff28b2636 --- /dev/null +++ b/include/lvgl/drivers/display/lv_draw_eve_display.h @@ -0,0 +1,151 @@ +/** + * @file lv_draw_eve_display.h + * + */ + +#ifndef LV_DRAW_EVE_DISPLAY_H +#define LV_DRAW_EVE_DISPLAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" +#if LV_USE_DRAW_EVE + +#include "lv_draw_eve_target.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a display for the EVE draw unit. + * @param params Pointer to a struct of display parameters. Can be a temporary variable + * @param op_cb A callback that will be called to perform pin and SPI IO operations with the EVE chip + * @param user_data use `lv_draw_eve_display_get_user_data` to get this pointer inside the `op_cb` + * @return the EVE display + */ +lv_display_t * lv_draw_eve_display_create(const lv_draw_eve_parameters_t * params, lv_draw_eve_operation_cb_t op_cb, + void * user_data); + +/** + * Get the `user_data` parameter that was passed to `lv_draw_eve_display_create`. Useful in the operation callback. + * @param disp pointer to the lv_draw_eve display + * @return the `user_data` pointer + */ +void * lv_draw_eve_display_get_user_data(lv_display_t * disp); + +/** + * Create a touchscreen indev for the EVE display. + * @param disp pointer to the lv_draw_eve display + * @return the EVE touchscreen indev + */ +lv_indev_t * lv_draw_eve_touch_create(lv_display_t * disp); + + +/* RAM_G asset pre-upload functions */ + +/** + * Upload an image src to RAM_G now instead of as-needed during rendering. + * @param disp pointer to the lv_draw_eve display + * @param src image src. The value passed to `lv_image_set_src` + */ +void lv_draw_eve_pre_upload_image(lv_display_t * disp, const void * src); + +/** + * Upload font glyphs to RAM_G now instead of as-needed during rendering. + * Upload all the glyphs in the range of unicode code points (inclusive of the start and end values). + * It can be called multiple times with different ranges. + * @param disp pointer to the lv_draw_eve display + * @param font the font to upload glyphs from + * @param unicode_range_start the first unicode code point in the range of glyphs to upload + * @param unicode_range_end the last unicode code point (inclusive) in the range of glyphs to upload + */ +void lv_draw_eve_pre_upload_font_range(lv_display_t * disp, const lv_font_t * font, uint32_t unicode_range_start, + uint32_t unicode_range_end); + +/** + * Upload font glyphs to RAM_G now instead of as-needed during rendering. + * It will upload all the glyphs needed to render the string `text`. + * It can be called multiple times with different strings. + * @param disp pointer to the lv_draw_eve display + * @param font the font to upload glyphs from + * @param text the ASCII or UTF-8 string that will be iterated for glyphs to upload + */ +void lv_draw_eve_pre_upload_font_text(lv_display_t * disp, const lv_font_t * font, const char * text); + + +/* Low-level EVE control functions */ + +/** + * Call `EVE_memRead8` for custom low-level control of the display. + * @param disp the display returned by `lv_draw_eve_display_create` + * @param address the EVE address to read from + * @return the read value + */ +uint8_t lv_draw_eve_memread8(lv_display_t * disp, uint32_t address); + +/** + * Call `EVE_memRead16` for custom low-level control of the display. + * @param disp the display returned by `lv_draw_eve_display_create` + * @param address the EVE address to read from + * @return the read value + */ +uint16_t lv_draw_eve_memread16(lv_display_t * disp, uint32_t address); + +/** + * Call `EVE_memRead32` for custom low-level control of the display. + * @param disp the display returned by `lv_draw_eve_display_create` + * @param address the EVE address to read from + * @return the read value + */ +uint32_t lv_draw_eve_memread32(lv_display_t * disp, uint32_t address); + +/** + * Call `EVE_memWrite8` for custom low-level control of the display. + * @param disp the display returned by `lv_draw_eve_display_create` + * @param address the EVE address to write to + * @param data the value to write + */ +void lv_draw_eve_memwrite8(lv_display_t * disp, uint32_t address, uint8_t data); + +/** + * Call `EVE_memWrite16` for custom low-level control of the display. + * @param disp the display returned by `lv_draw_eve_display_create` + * @param address the EVE address to write to + * @param data the value to write + */ +void lv_draw_eve_memwrite16(lv_display_t * disp, uint32_t address, uint16_t data); + +/** + * Call `EVE_memWrite32` for custom low-level control of the display. + * @param disp the display returned by `lv_draw_eve_display_create` + * @param address the EVE address to write to + * @param data the value to write + */ +void lv_draw_eve_memwrite32(lv_display_t * disp, uint32_t address, uint32_t data); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_DRAW_EVE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_EVE_DISPLAY_H*/ diff --git a/include/lvgl/drivers/display/lv_draw_eve_display_defines.h b/include/lvgl/drivers/display/lv_draw_eve_display_defines.h new file mode 100644 index 0000000000..b1309b1ef3 --- /dev/null +++ b/include/lvgl/drivers/display/lv_draw_eve_display_defines.h @@ -0,0 +1,1210 @@ +/** + * @file lv_draw_eve_display_defines.h + * + */ + +#ifndef LV_DRAW_EVE_DISPLAY_DEFINES_H +#define LV_DRAW_EVE_DISPLAY_DEFINES_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" + +#if LV_USE_DRAW_EVE + +#include "../../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/* Memory */ +#define LV_EVE_EVE_RAM_G ((uint32_t) 0x00000000UL) +#define LV_EVE_EVE_ROM_CHIPID ((uint32_t) 0x000C0000UL) +#define LV_EVE_EVE_ROM_FONT ((uint32_t) 0x001E0000UL) +#define LV_EVE_EVE_ROM_FONTROOT ((uint32_t) 0x002FFFFCUL) +#define LV_EVE_EVE_RAM_DL ((uint32_t) 0x00300000UL) +#define LV_EVE_EVE_RAM_REG ((uint32_t) 0x00302000UL) +#define LV_EVE_EVE_RAM_CMD ((uint32_t) 0x00308000UL) + +/* Memory buffer sizes */ +#define LV_EVE_EVE_RAM_G_SIZE ((uint32_t) 1024U*1024UL) +#define LV_EVE_EVE_CMDFIFO_SIZE ((uint32_t) 4U*1024UL) +#define LV_EVE_EVE_RAM_DL_SIZE ((uint32_t) 8U*1024UL) + +/* display list commands, most need OR's arguments */ +#define LV_EVE_DL_DISPLAY ((uint32_t) 0x00000000UL) +#define LV_EVE_DL_BITMAP_SOURCE ((uint32_t) 0x01000000UL) +#define LV_EVE_DL_CLEAR_COLOR_RGB ((uint32_t) 0x02000000UL) +#define LV_EVE_DL_TAG ((uint32_t) 0x03000000UL) +#define LV_EVE_DL_COLOR_RGB ((uint32_t) 0x04000000UL) +#define LV_EVE_DL_BITMAP_HANDLE ((uint32_t) 0x05000000UL) +#define LV_EVE_DL_CELL ((uint32_t) 0x06000000UL) +#define LV_EVE_DL_BITMAP_LAYOUT ((uint32_t) 0x07000000UL) +#define LV_EVE_DL_BITMAP_SIZE ((uint32_t) 0x08000000UL) +#define LV_EVE_DL_ALPHA_FUNC ((uint32_t) 0x09000000UL) +#define LV_EVE_DL_STENCIL_FUNC ((uint32_t) 0x0A000000UL) +#define LV_EVE_DL_BLEND_FUNC ((uint32_t) 0x0B000000UL) +#define LV_EVE_DL_STENCIL_OP ((uint32_t) 0x0C000000UL) +#define LV_EVE_DL_POINT_SIZE ((uint32_t) 0x0D000000UL) +#define LV_EVE_DL_LINE_WIDTH ((uint32_t) 0x0E000000UL) +#define LV_EVE_DL_CLEAR_COLOR_A ((uint32_t) 0x0F000000UL) +#define LV_EVE_DL_COLOR_A ((uint32_t) 0x10000000UL) +#define LV_EVE_DL_CLEAR_STENCIL ((uint32_t) 0x11000000UL) +#define LV_EVE_DL_CLEAR_TAG ((uint32_t) 0x12000000UL) +#define LV_EVE_DL_STENCIL_MASK ((uint32_t) 0x13000000UL) +#define LV_EVE_DL_TAG_MASK ((uint32_t) 0x14000000UL) +#define LV_EVE_DL_BITMAP_TRANSFORM_A ((uint32_t) 0x15000000UL) +#define LV_EVE_DL_BITMAP_TRANSFORM_B ((uint32_t) 0x16000000UL) +#define LV_EVE_DL_BITMAP_TRANSFORM_C ((uint32_t) 0x17000000UL) +#define LV_EVE_DL_BITMAP_TRANSFORM_D ((uint32_t) 0x18000000UL) +#define LV_EVE_DL_BITMAP_TRANSFORM_E ((uint32_t) 0x19000000UL) +#define LV_EVE_DL_BITMAP_TRANSFORM_F ((uint32_t) 0x1A000000UL) +#define LV_EVE_DL_SCISSOR_XY ((uint32_t) 0x1B000000UL) +#define LV_EVE_DL_SCISSOR_SIZE ((uint32_t) 0x1C000000UL) +#define LV_EVE_DL_CALL ((uint32_t) 0x1D000000UL) +#define LV_EVE_DL_JUMP ((uint32_t) 0x1E000000UL) +#define LV_EVE_DL_BEGIN ((uint32_t) 0x1F000000UL) +#define LV_EVE_DL_COLOR_MASK ((uint32_t) 0x20000000UL) +#define LV_EVE_DL_END ((uint32_t) 0x21000000UL) +#define LV_EVE_DL_SAVE_CONTEXT ((uint32_t) 0x22000000UL) +#define LV_EVE_DL_RESTORE_CONTEXT ((uint32_t) 0x23000000UL) +#define LV_EVE_DL_RETURN ((uint32_t) 0x24000000UL) +#define LV_EVE_DL_MACRO ((uint32_t) 0x25000000UL) +#define LV_EVE_DL_CLEAR ((uint32_t) 0x26000000UL) +#define LV_EVE_DL_VERTEX_FORMAT ((uint32_t) 0x27000000UL) +#define LV_EVE_DL_BITMAP_LAYOUT_H ((uint32_t) 0x28000000UL) +#define LV_EVE_DL_BITMAP_SIZE_H ((uint32_t) 0x29000000UL) +#define LV_EVE_DL_PALETTE_SOURCE ((uint32_t) 0x2A000000UL) +#define LV_EVE_DL_VERTEX_TRANSLATE_X ((uint32_t) 0x2B000000UL) +#define LV_EVE_DL_VERTEX_TRANSLATE_Y ((uint32_t) 0x2C000000UL) +#define LV_EVE_DL_NOP ((uint32_t) 0x2D000000UL) + +#define LV_EVE_DL_VERTEX2F ((uint32_t) 0x40000000UL) +#define LV_EVE_DL_VERTEX2II ((uint32_t) 0x80000000UL) + +#define LV_EVE_CLR_COL ((uint8_t) 0x4U) +#define LV_EVE_CLR_STN ((uint8_t) 0x2U) +#define LV_EVE_CLR_TAG ((uint8_t) 0x1U) + +/* Host commands */ +#define LV_EVE_EVE_ACTIVE ((uint8_t) 0x00U) /* place EVE in active state */ +#define LV_EVE_EVE_STANDBY ((uint8_t) 0x41U) /* place EVE in Standby (clk running) */ +#define LV_EVE_EVE_SLEEP ((uint8_t) 0x42U) /* place EVE in Sleep (clk off) */ +#define LV_EVE_EVE_CLKEXT ((uint8_t) 0x44U) /* select external clock source */ +#define LV_EVE_EVE_CLKINT ((uint8_t) 0x48U) /* select internal clock source, not a valid option for BT817 / BT818 */ +#define LV_EVE_EVE_PWRDOWN ((uint8_t) 0x50U) /* place EVE in Power Down (core off) */ +#define LV_EVE_EVE_CLKSEL ((uint8_t) 0x61U) /* configure system clock */ +#define LV_EVE_EVE_RST_PULSE ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ +#define LV_EVE_EVE_CORERST ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ +#define LV_EVE_EVE_PINDRIVE ((uint8_t) 0x70U) /* setup drive strength for various pins */ +#define LV_EVE_EVE_PIN_PD_STATE ((uint8_t) 0x71U) /* setup how pins behave during power down */ + +/* Graphic command defines */ +#define LV_EVE_EVE_NEVER ((uint8_t) 0UL) +#define LV_EVE_EVE_LESS ((uint8_t) 1UL) +#define LV_EVE_EVE_LEQUAL ((uint8_t) 2UL) +#define LV_EVE_EVE_GREATER ((uint8_t) 3UL) +#define LV_EVE_EVE_GEQUAL ((uint8_t) 4UL) +#define LV_EVE_EVE_EQUAL ((uint8_t) 5UL) +#define LV_EVE_EVE_NOTEQUAL ((uint8_t) 6UL) +#define LV_EVE_EVE_ALWAYS ((uint8_t) 7UL) + +/* Bitmap formats */ +#define LV_EVE_EVE_ARGB1555 ((uint8_t) 0UL) +#define LV_EVE_EVE_L1 ((uint8_t) 1UL) +#define LV_EVE_EVE_L4 ((uint8_t) 2UL) +#define LV_EVE_EVE_L8 ((uint8_t) 3UL) +#define LV_EVE_EVE_RGB332 ((uint8_t) 4UL) +#define LV_EVE_EVE_ARGB2 ((uint8_t) 5UL) +#define LV_EVE_EVE_ARGB4 ((uint8_t) 6UL) +#define LV_EVE_EVE_RGB565 ((uint8_t) 7UL) +#define LV_EVE_EVE_PALETTED ((uint8_t) 8UL) +#define LV_EVE_EVE_TEXT8X8 ((uint8_t) 9UL) +#define LV_EVE_EVE_TEXTVGA ((uint8_t) 10UL) +#define LV_EVE_EVE_BARGRAPH ((uint8_t) 11UL) + +/* Bitmap filter types */ +#define LV_EVE_EVE_NEAREST ((uint8_t) 0UL) +#define LV_EVE_EVE_BILINEAR ((uint8_t) 1UL) + +/* Bitmap wrap types */ +#define LV_EVE_EVE_BORDER ((uint8_t) 0UL) +#define LV_EVE_EVE_REPEAT ((uint8_t) 1UL) + +/* Stencil defines */ +#define LV_EVE_EVE_KEEP ((uint8_t) 1UL) +#define LV_EVE_EVE_REPLACE ((uint8_t) 2UL) +#define LV_EVE_EVE_INCR ((uint8_t) 3UL) +#define LV_EVE_EVE_DECR ((uint8_t) 4UL) +#define LV_EVE_EVE_INVERT ((uint8_t) 5UL) + +/* Graphics display list swap defines */ +#define LV_EVE_EVE_DLSWAP_DONE ((uint8_t) 0UL) +#define LV_EVE_EVE_DLSWAP_LINE ((uint8_t) 1UL) +#define LV_EVE_EVE_DLSWAP_FRAME ((uint8_t) 2UL) + +/* Interrupt bits */ +#define LV_EVE_EVE_INT_SWAP ((uint8_t) 0x01) +#define LV_EVE_EVE_INT_TOUCH ((uint8_t) 0x02) +#define LV_EVE_EVE_INT_TAG ((uint8_t) 0x04) +#define LV_EVE_EVE_INT_SOUND ((uint8_t) 0x08) +#define LV_EVE_EVE_INT_PLAYBACK ((uint8_t) 0x10) +#define LV_EVE_EVE_INT_CMDEMPTY ((uint8_t) 0x20) +#define LV_EVE_EVE_INT_CMDFLAG ((uint8_t) 0x40) +#define LV_EVE_EVE_INT_CONVCOMPLETE ((uint8_t) 0x80) + +/* Touch mode */ +#define LV_EVE_EVE_TMODE_OFF ((uint8_t) 0U) +#define LV_EVE_EVE_TMODE_ONESHOT ((uint8_t) 1U) +#define LV_EVE_EVE_TMODE_FRAME ((uint8_t) 2U) +#define LV_EVE_EVE_TMODE_CONTINUOUS ((uint8_t) 3U) + +/* Alpha blending */ +#define LV_EVE_EVE_ZERO ((uint32_t) 0UL) +#define LV_EVE_EVE_ONE ((uint32_t) 1UL) +#define LV_EVE_EVE_SRC_ALPHA ((uint32_t) 2UL) +#define LV_EVE_EVE_DST_ALPHA ((uint32_t) 3UL) +#define LV_EVE_EVE_ONE_MINUS_SRC_ALPHA ((uint32_t) 4UL) +#define LV_EVE_EVE_ONE_MINUS_DST_ALPHA ((uint32_t) 5UL) + +/* Graphics primitives */ +#define LV_EVE_EVE_BITMAPS ((uint32_t) 1UL) +#define LV_EVE_EVE_POINTS ((uint32_t) 2UL) +#define LV_EVE_EVE_LINES ((uint32_t) 3UL) +#define LV_EVE_EVE_LINE_STRIP ((uint32_t) 4UL) +#define LV_EVE_EVE_EDGE_STRIP_R ((uint32_t) 5UL) +#define LV_EVE_EVE_EDGE_STRIP_L ((uint32_t) 6UL) +#define LV_EVE_EVE_EDGE_STRIP_A ((uint32_t) 7UL) +#define LV_EVE_EVE_EDGE_STRIP_B ((uint32_t) 8UL) +#define LV_EVE_EVE_RECTS ((uint32_t) 9UL) +#define LV_EVE_EVE_INT_G8 ((uint32_t) 18UL) +#define LV_EVE_EVE_INT_L8C ((uint32_t) 12UL) +#define LV_EVE_EVE_INT_VGA ((uint32_t) 13UL) +#define LV_EVE_EVE_PALETTED565 ((uint32_t) 14UL) +#define LV_EVE_EVE_PALETTED4444 ((uint32_t) 15UL) +#define LV_EVE_EVE_PALETTED8 ((uint32_t) 16UL) +#define LV_EVE_EVE_L2 ((uint32_t) 17UL) + +/* Widget command options */ +#define LV_EVE_EVE_OPT_MONO ((uint16_t) 1U) +#define LV_EVE_EVE_OPT_NODL ((uint16_t) 2U) +#define LV_EVE_EVE_OPT_FLAT ((uint16_t) 256U) +#define LV_EVE_EVE_OPT_CENTERX ((uint16_t) 512U) +#define LV_EVE_EVE_OPT_CENTERY ((uint16_t) 1024U) +#define LV_EVE_EVE_OPT_CENTER (LV_EVE_EVE_OPT_CENTERX | LV_EVE_EVE_OPT_CENTERY) +#define LV_EVE_EVE_OPT_NOBACK ((uint16_t) 4096U) +#define LV_EVE_EVE_OPT_NOTICKS ((uint16_t) 8192U) +#define LV_EVE_EVE_OPT_NOHM ((uint16_t) 16384U) +#define LV_EVE_EVE_OPT_NOPOINTER ((uint16_t) 16384U) +#define LV_EVE_EVE_OPT_NOSECS ((uint16_t) 32768U) +#define LV_EVE_EVE_OPT_NOHANDS ((uint16_t) 49152U) +#define LV_EVE_EVE_OPT_RIGHTX ((uint16_t) 2048U) +#define LV_EVE_EVE_OPT_SIGNED ((uint16_t) 256U) + +#define LV_EVE_EVE_OPT_MEDIAFIFO ((uint16_t) 16U) +#define LV_EVE_EVE_OPT_FULLSCREEN ((uint16_t) 8U) +#define LV_EVE_EVE_OPT_NOTEAR ((uint16_t) 4U) +#define LV_EVE_EVE_OPT_SOUND ((uint16_t) 32U) + +/* ADC */ +#define LV_EVE_EVE_ADC_DIFFERENTIAL ((uint32_t) 1UL) +#define LV_EVE_EVE_ADC_SINGLE_ENDED ((uint32_t) 0UL) + +/* Fonts */ +#define LV_EVE_EVE_NUMCHAR_PERFONT ((uint32_t) 128UL) /* number of font characters per bitmap handle */ +#define LV_EVE_EVE_FONT_TABLE_SIZE ((uint32_t) 148UL) /* size of the font table - utilized for loopup by the graphics engine */ +#define LV_EVE_EVE_FONT_TABLE_POINTER ((uint32_t) 0xFFFFCUL) /* pointer to the inbuilt font tables starting from bitmap handle 16 */ + +/* Audio sample type defines */ +#define LV_EVE_EVE_LINEAR_SAMPLES ((uint32_t) 0UL) /* 8bit signed samples */ +#define LV_EVE_EVE_ULAW_SAMPLES ((uint32_t) 1UL) /* 8bit ulaw samples */ +#define LV_EVE_EVE_ADPCM_SAMPLES ((uint32_t) 2UL) /* 4bit ima adpcm samples */ + +/* Synthesized sound */ +#define LV_EVE_EVE_SILENCE ((uint8_t) 0x00U) +#define LV_EVE_EVE_SQUAREWAVE ((uint8_t) 0x01U) +#define LV_EVE_EVE_SINEWAVE ((uint8_t) 0x02U) +#define LV_EVE_EVE_SAWTOOTH ((uint8_t) 0x03U) +#define LV_EVE_EVE_TRIANGLE ((uint8_t) 0x04U) +#define LV_EVE_EVE_BEEPING ((uint8_t) 0x05U) +#define LV_EVE_EVE_ALARM ((uint8_t) 0x06U) +#define LV_EVE_EVE_WARBLE ((uint8_t) 0x07U) +#define LV_EVE_EVE_CAROUSEL ((uint8_t) 0x08U) +#define LV_EVE_EVE_PIPS(n) ((uint8_t) (0x0FU + (n))) +#define LV_EVE_EVE_HARP ((uint8_t) 0x40U) +#define LV_EVE_EVE_XYLOPHONE ((uint8_t) 0x41U) +#define LV_EVE_EVE_TUBA ((uint8_t) 0x42U) +#define LV_EVE_EVE_GLOCKENSPIEL ((uint8_t) 0x43U) +#define LV_EVE_EVE_ORGAN ((uint8_t) 0x44U) +#define LV_EVE_EVE_TRUMPET ((uint8_t) 0x45U) +#define LV_EVE_EVE_PIANO ((uint8_t) 0x46U) +#define LV_EVE_EVE_CHIMES ((uint8_t) 0x47U) +#define LV_EVE_EVE_MUSICBOX ((uint8_t) 0x48U) +#define LV_EVE_EVE_BELL ((uint8_t) 0x49U) +#define LV_EVE_EVE_CLICK ((uint8_t) 0x50U) +#define LV_EVE_EVE_SWITCH ((uint8_t) 0x51U) +#define LV_EVE_EVE_COWBELL ((uint8_t) 0x52U) +#define LV_EVE_EVE_NOTCH ((uint8_t) 0x53U) +#define LV_EVE_EVE_HIHAT ((uint8_t) 0x54U) +#define LV_EVE_EVE_KICKDRUM ((uint8_t) 0x55U) +#define LV_EVE_EVE_POP ((uint8_t) 0x56U) +#define LV_EVE_EVE_CLACK ((uint8_t) 0x57U) +#define LV_EVE_EVE_CHACK ((uint8_t) 0x58U) +#define LV_EVE_EVE_MUTE ((uint8_t) 0x60U) +#define LV_EVE_EVE_UNMUTE ((uint8_t) 0x61U) + +/* Synthesized sound frequencies, midi note */ +#define LV_EVE_EVE_MIDI_A0 ((uint8_t) 21U) +#define LV_EVE_EVE_MIDI_A_0 ((uint8_t) 22U) +#define LV_EVE_EVE_MIDI_B0 ((uint8_t) 23U) +#define LV_EVE_EVE_MIDI_C1 ((uint8_t) 24U) +#define LV_EVE_EVE_MIDI_C_1 ((uint8_t) 25U) +#define LV_EVE_EVE_MIDI_D1 ((uint8_t) 26U) +#define LV_EVE_EVE_MIDI_D_1 ((uint8_t) 27U) +#define LV_EVE_EVE_MIDI_E1 ((uint8_t) 28U) +#define LV_EVE_EVE_MIDI_F1 ((uint8_t) 29U) +#define LV_EVE_EVE_MIDI_F_1 ((uint8_t) 30U) +#define LV_EVE_EVE_MIDI_G1 ((uint8_t) 31U) +#define LV_EVE_EVE_MIDI_G_1 ((uint8_t) 32U) +#define LV_EVE_EVE_MIDI_A1 ((uint8_t) 33U) +#define LV_EVE_EVE_MIDI_A_1 ((uint8_t) 34U) +#define LV_EVE_EVE_MIDI_B1 ((uint8_t) 35U) +#define LV_EVE_EVE_MIDI_C2 ((uint8_t) 36U) +#define LV_EVE_EVE_MIDI_C_2 ((uint8_t) 37U) +#define LV_EVE_EVE_MIDI_D2 ((uint8_t) 38U) +#define LV_EVE_EVE_MIDI_D_2 ((uint8_t) 39U) +#define LV_EVE_EVE_MIDI_E2 ((uint8_t) 40U) +#define LV_EVE_EVE_MIDI_F2 ((uint8_t) 41U) +#define LV_EVE_EVE_MIDI_F_2 ((uint8_t) 42U) +#define LV_EVE_EVE_MIDI_G2 ((uint8_t) 43U) +#define LV_EVE_EVE_MIDI_G_2 ((uint8_t) 44U) +#define LV_EVE_EVE_MIDI_A2 ((uint8_t) 45U) +#define LV_EVE_EVE_MIDI_A_2 ((uint8_t) 46U) +#define LV_EVE_EVE_MIDI_B2 ((uint8_t) 47U) +#define LV_EVE_EVE_MIDI_C3 ((uint8_t) 48U) +#define LV_EVE_EVE_MIDI_C_3 ((uint8_t) 49U) +#define LV_EVE_EVE_MIDI_D3 ((uint8_t) 50U) +#define LV_EVE_EVE_MIDI_D_3 ((uint8_t) 51U) +#define LV_EVE_EVE_MIDI_E3 ((uint8_t) 52U) +#define LV_EVE_EVE_MIDI_F3 ((uint8_t) 53U) +#define LV_EVE_EVE_MIDI_F_3 ((uint8_t) 54U) +#define LV_EVE_EVE_MIDI_G3 ((uint8_t) 55U) +#define LV_EVE_EVE_MIDI_G_3 ((uint8_t) 56U) +#define LV_EVE_EVE_MIDI_A3 ((uint8_t) 57U) +#define LV_EVE_EVE_MIDI_A_3 ((uint8_t) 58U) +#define LV_EVE_EVE_MIDI_B3 ((uint8_t) 59U) +#define LV_EVE_EVE_MIDI_C4 ((uint8_t) 60U) +#define LV_EVE_EVE_MIDI_C_4 ((uint8_t) 61U) +#define LV_EVE_EVE_MIDI_D4 ((uint8_t) 62U) +#define LV_EVE_EVE_MIDI_D_4 ((uint8_t) 63U) +#define LV_EVE_EVE_MIDI_E4 ((uint8_t) 64U) +#define LV_EVE_EVE_MIDI_F4 ((uint8_t) 65U) +#define LV_EVE_EVE_MIDI_F_4 ((uint8_t) 66U) +#define LV_EVE_EVE_MIDI_G4 ((uint8_t) 67U) +#define LV_EVE_EVE_MIDI_G_4 ((uint8_t) 68U) +#define LV_EVE_EVE_MIDI_A4 ((uint8_t) 69U) +#define LV_EVE_EVE_MIDI_A_4 ((uint8_t) 70U) +#define LV_EVE_EVE_MIDI_B4 ((uint8_t) 71U) +#define LV_EVE_EVE_MIDI_C5 ((uint8_t) 72U) +#define LV_EVE_EVE_MIDI_C_5 ((uint8_t) 73U) +#define LV_EVE_EVE_MIDI_D5 ((uint8_t) 74U) +#define LV_EVE_EVE_MIDI_D_5 ((uint8_t) 75U) +#define LV_EVE_EVE_MIDI_E5 ((uint8_t) 76U) +#define LV_EVE_EVE_MIDI_F5 ((uint8_t) 77U) +#define LV_EVE_EVE_MIDI_F_5 ((uint8_t) 78U) +#define LV_EVE_EVE_MIDI_G5 ((uint8_t) 79U) +#define LV_EVE_EVE_MIDI_G_5 ((uint8_t) 80U) +#define LV_EVE_EVE_MIDI_A5 ((uint8_t) 81U) +#define LV_EVE_EVE_MIDI_A_5 ((uint8_t) 82U) +#define LV_EVE_EVE_MIDI_B5 ((uint8_t) 83U) +#define LV_EVE_EVE_MIDI_C6 ((uint8_t) 84U) +#define LV_EVE_EVE_MIDI_C_6 ((uint8_t) 85U) +#define LV_EVE_EVE_MIDI_D6 ((uint8_t) 86U) +#define LV_EVE_EVE_MIDI_D_6 ((uint8_t) 87U) +#define LV_EVE_EVE_MIDI_E6 ((uint8_t) 88U) +#define LV_EVE_EVE_MIDI_F6 ((uint8_t) 89U) +#define LV_EVE_EVE_MIDI_F_6 ((uint8_t) 90U) +#define LV_EVE_EVE_MIDI_G6 ((uint8_t) 91U) +#define LV_EVE_EVE_MIDI_G_6 ((uint8_t) 92U) +#define LV_EVE_EVE_MIDI_A6 ((uint8_t) 93U) +#define LV_EVE_EVE_MIDI_A_6 ((uint8_t) 94U) +#define LV_EVE_EVE_MIDI_B6 ((uint8_t) 95U) +#define LV_EVE_EVE_MIDI_C7 ((uint8_t) 96U) +#define LV_EVE_EVE_MIDI_C_7 ((uint8_t) 97U) +#define LV_EVE_EVE_MIDI_D7 ((uint8_t) 98U) +#define LV_EVE_EVE_MIDI_D_7 ((uint8_t) 99U) +#define LV_EVE_EVE_MIDI_E7 ((uint8_t) 100U) +#define LV_EVE_EVE_MIDI_F7 ((uint8_t) 101U) +#define LV_EVE_EVE_MIDI_F_7 ((uint8_t) 102U) +#define LV_EVE_EVE_MIDI_G7 ((uint8_t) 103U) +#define LV_EVE_EVE_MIDI_G_7 ((uint8_t) 104U) +#define LV_EVE_EVE_MIDI_A7 ((uint8_t) 105U) +#define LV_EVE_EVE_MIDI_A_7 ((uint8_t) 106U) +#define LV_EVE_EVE_MIDI_B7 ((uint8_t) 107U) +#define LV_EVE_EVE_MIDI_C8 ((uint8_t) 108U) + +/* GPIO bits */ +#define LV_EVE_EVE_GPIO0 ((uint8_t) 0U) +#define LV_EVE_EVE_GPIO1 ((uint8_t) 1U) /* default gpio pin for audio shutdown, 1 - enable, 0 - disable */ +#define LV_EVE_EVE_GPIO7 ((uint8_t) 7U) /* default gpio pin for display enable, 1 - enable, 0 - disable */ + +/* Display rotation */ +#define LV_EVE_EVE_DISPLAY_0 ((uint8_t) 0U) /* 0 degrees rotation */ +#define LV_EVE_EVE_DISPLAY_180 ((uint8_t) 1U) /* 180 degrees rotation */ + +/* Commands */ +#define LV_EVE_CMD_APPEND ((uint32_t) 0xFFFFFF1EUL) +#define LV_EVE_CMD_BGCOLOR ((uint32_t) 0xFFFFFF09UL) +#define LV_EVE_CMD_BUTTON ((uint32_t) 0xFFFFFF0DUL) +#define LV_EVE_CMD_CALIBRATE ((uint32_t) 0xFFFFFF15UL) +#define LV_EVE_CMD_CLOCK ((uint32_t) 0xFFFFFF14UL) +#define LV_EVE_CMD_COLDSTART ((uint32_t) 0xFFFFFF32UL) +#define LV_EVE_CMD_DIAL ((uint32_t) 0xFFFFFF2DUL) +#define LV_EVE_CMD_DLSTART ((uint32_t) 0xFFFFFF00UL) +#define LV_EVE_CMD_FGCOLOR ((uint32_t) 0xFFFFFF0AUL) +#define LV_EVE_CMD_GAUGE ((uint32_t) 0xFFFFFF13UL) +#define LV_EVE_CMD_GETMATRIX ((uint32_t) 0xFFFFFF33UL) +#define LV_EVE_CMD_GETPROPS ((uint32_t) 0xFFFFFF25UL) +#define LV_EVE_CMD_GETPTR ((uint32_t) 0xFFFFFF23UL) +#define LV_EVE_CMD_GRADCOLOR ((uint32_t) 0xFFFFFF34UL) +#define LV_EVE_CMD_GRADIENT ((uint32_t) 0xFFFFFF0BUL) +#define LV_EVE_CMD_INFLATE ((uint32_t) 0xFFFFFF22UL) +#define LV_EVE_CMD_INTERRUPT ((uint32_t) 0xFFFFFF02UL) +#define LV_EVE_CMD_KEYS ((uint32_t) 0xFFFFFF0EUL) +#define LV_EVE_CMD_LOADIDENTITY ((uint32_t) 0xFFFFFF26UL) +#define LV_EVE_CMD_LOADIMAGE ((uint32_t) 0xFFFFFF24UL) +#define LV_EVE_CMD_LOGO ((uint32_t) 0xFFFFFF31UL) +#define LV_EVE_CMD_MEDIAFIFO ((uint32_t) 0xFFFFFF39UL) +#define LV_EVE_CMD_MEMCPY ((uint32_t) 0xFFFFFF1DUL) +#define LV_EVE_CMD_MEMCRC ((uint32_t) 0xFFFFFF18UL) +#define LV_EVE_CMD_MEMSET ((uint32_t) 0xFFFFFF1BUL) +#define LV_EVE_CMD_MEMWRITE ((uint32_t) 0xFFFFFF1AUL) +#define LV_EVE_CMD_MEMZERO ((uint32_t) 0xFFFFFF1CUL) +#define LV_EVE_CMD_NUMBER ((uint32_t) 0xFFFFFF2EUL) +#define LV_EVE_CMD_PLAYVIDEO ((uint32_t) 0xFFFFFF3AUL) +#define LV_EVE_CMD_PROGRESS ((uint32_t) 0xFFFFFF0FUL) +#define LV_EVE_CMD_REGREAD ((uint32_t) 0xFFFFFF19UL) +#define LV_EVE_CMD_ROMFONT ((uint32_t) 0xFFFFFF3FUL) +#define LV_EVE_CMD_ROTATE ((uint32_t) 0xFFFFFF29UL) +#define LV_EVE_CMD_SCALE ((uint32_t) 0xFFFFFF28UL) +#define LV_EVE_CMD_SCREENSAVER ((uint32_t) 0xFFFFFF2FUL) +#define LV_EVE_CMD_SCROLLBAR ((uint32_t) 0xFFFFFF11UL) +#define LV_EVE_CMD_SETBASE ((uint32_t) 0xFFFFFF38UL) +#define LV_EVE_CMD_SETBITMAP ((uint32_t) 0xFFFFFF43UL) +#define LV_EVE_CMD_SETFONT ((uint32_t) 0xFFFFFF2BUL) +#define LV_EVE_CMD_SETFONT2 ((uint32_t) 0xFFFFFF3BUL) +#define LV_EVE_CMD_SETMATRIX ((uint32_t) 0xFFFFFF2AUL) +#define LV_EVE_CMD_SETROTATE ((uint32_t) 0xFFFFFF36UL) +#define LV_EVE_CMD_SETSCRATCH ((uint32_t) 0xFFFFFF3CUL) +#define LV_EVE_CMD_SKETCH ((uint32_t) 0xFFFFFF30UL) +#define LV_EVE_CMD_SLIDER ((uint32_t) 0xFFFFFF10UL) +#define LV_EVE_CMD_SNAPSHOT ((uint32_t) 0xFFFFFF1FUL) +#define LV_EVE_CMD_SNAPSHOT2 ((uint32_t) 0xFFFFFF37UL) +#define LV_EVE_CMD_SPINNER ((uint32_t) 0xFFFFFF16UL) +#define LV_EVE_CMD_STOP ((uint32_t) 0xFFFFFF17UL) +#define LV_EVE_CMD_SWAP ((uint32_t) 0xFFFFFF01UL) +#define LV_EVE_CMD_TEXT ((uint32_t) 0xFFFFFF0CUL) +#define LV_EVE_CMD_TOGGLE ((uint32_t) 0xFFFFFF12UL) +#define LV_EVE_CMD_TRACK ((uint32_t) 0xFFFFFF2CUL) +#define LV_EVE_CMD_TRANSLATE ((uint32_t) 0xFFFFFF27UL) +#define LV_EVE_CMD_VIDEOFRAME ((uint32_t) 0xFFFFFF41UL) +#define LV_EVE_CMD_VIDEOSTART ((uint32_t) 0xFFFFFF40UL) + +/* Registers */ +#define LV_EVE_REG_ANA_COMP ((uint32_t) 0x00302184UL) /* only listed in datasheet */ +#define LV_EVE_REG_BIST_EN ((uint32_t) 0x00302174UL) /* only listed in datasheet */ +#define LV_EVE_REG_CLOCK ((uint32_t) 0x00302008UL) +#define LV_EVE_REG_CMDB_SPACE ((uint32_t) 0x00302574UL) +#define LV_EVE_REG_CMDB_WRITE ((uint32_t) 0x00302578UL) +#define LV_EVE_REG_CMD_DL ((uint32_t) 0x00302100UL) +#define LV_EVE_REG_CMD_READ ((uint32_t) 0x003020f8UL) +#define LV_EVE_REG_CMD_WRITE ((uint32_t) 0x003020fcUL) +#define LV_EVE_REG_CPURESET ((uint32_t) 0x00302020UL) +#define LV_EVE_REG_CSPREAD ((uint32_t) 0x00302068UL) +#define LV_EVE_REG_CTOUCH_EXTENDED ((uint32_t) 0x00302108UL) +#define LV_EVE_REG_CTOUCH_TOUCH0_XY ((uint32_t) 0x00302124UL) /* only listed in datasheet */ +#define LV_EVE_REG_CTOUCH_TOUCH4_X ((uint32_t) 0x0030216cUL) +#define LV_EVE_REG_CTOUCH_TOUCH4_Y ((uint32_t) 0x00302120UL) +#define LV_EVE_REG_CTOUCH_TOUCH1_XY ((uint32_t) 0x0030211cUL) +#define LV_EVE_REG_CTOUCH_TOUCH2_XY ((uint32_t) 0x0030218cUL) +#define LV_EVE_REG_CTOUCH_TOUCH3_XY ((uint32_t) 0x00302190UL) +#define LV_EVE_REG_TOUCH_CONFIG ((uint32_t) 0x00302168UL) +#define LV_EVE_REG_DATESTAMP ((uint32_t) 0x00302564UL) /* only listed in datasheet */ +#define LV_EVE_REG_DITHER ((uint32_t) 0x00302060UL) +#define LV_EVE_REG_DLSWAP ((uint32_t) 0x00302054UL) +#define LV_EVE_REG_FRAMES ((uint32_t) 0x00302004UL) +#define LV_EVE_REG_FREQUENCY ((uint32_t) 0x0030200cUL) +#define LV_EVE_REG_GPIO ((uint32_t) 0x00302094UL) +#define LV_EVE_REG_GPIOX ((uint32_t) 0x0030209cUL) +#define LV_EVE_REG_GPIOX_DIR ((uint32_t) 0x00302098UL) +#define LV_EVE_REG_GPIO_DIR ((uint32_t) 0x00302090UL) +#define LV_EVE_REG_HCYCLE ((uint32_t) 0x0030202cUL) +#define LV_EVE_REG_HOFFSET ((uint32_t) 0x00302030UL) +#define LV_EVE_REG_HSIZE ((uint32_t) 0x00302034UL) +#define LV_EVE_REG_HSYNC0 ((uint32_t) 0x00302038UL) +#define LV_EVE_REG_HSYNC1 ((uint32_t) 0x0030203cUL) +#define LV_EVE_REG_ID ((uint32_t) 0x00302000UL) +#define LV_EVE_REG_INT_EN ((uint32_t) 0x003020acUL) +#define LV_EVE_REG_INT_FLAGS ((uint32_t) 0x003020a8UL) +#define LV_EVE_REG_INT_MASK ((uint32_t) 0x003020b0UL) +#define LV_EVE_REG_MACRO_0 ((uint32_t) 0x003020d8UL) +#define LV_EVE_REG_MACRO_1 ((uint32_t) 0x003020dcUL) +#define LV_EVE_REG_MEDIAFIFO_READ ((uint32_t) 0x00309014UL) /* only listed in programmers guide */ +#define LV_EVE_REG_MEDIAFIFO_WRITE ((uint32_t) 0x00309018UL) /* only listed in programmers guide */ +#define LV_EVE_REG_OUTBITS ((uint32_t) 0x0030205cUL) +#define LV_EVE_REG_PCLK ((uint32_t) 0x00302070UL) +#define LV_EVE_REG_PCLK_POL ((uint32_t) 0x0030206cUL) +#define LV_EVE_REG_PLAY ((uint32_t) 0x0030208cUL) +#define LV_EVE_REG_PLAYBACK_FORMAT ((uint32_t) 0x003020c4UL) +#define LV_EVE_REG_PLAYBACK_FREQ ((uint32_t) 0x003020c0UL) +#define LV_EVE_REG_PLAYBACK_LENGTH ((uint32_t) 0x003020b8UL) +#define LV_EVE_REG_PLAYBACK_LOOP ((uint32_t) 0x003020c8UL) +#define LV_EVE_REG_PLAYBACK_PLAY ((uint32_t) 0x003020ccUL) +#define LV_EVE_REG_PLAYBACK_READPTR ((uint32_t) 0x003020bcUL) +#define LV_EVE_REG_PLAYBACK_START ((uint32_t) 0x003020b4UL) +#define LV_EVE_REG_PWM_DUTY ((uint32_t) 0x003020d4UL) +#define LV_EVE_REG_PWM_HZ ((uint32_t) 0x003020d0UL) +#define LV_EVE_REG_RENDERMODE ((uint32_t) 0x00302010UL) /* only listed in datasheet */ +#define LV_EVE_REG_ROTATE ((uint32_t) 0x00302058UL) +#define LV_EVE_REG_SNAPFORMAT ((uint32_t) 0x0030201cUL) /* only listed in datasheet */ +#define LV_EVE_REG_SNAPSHOT ((uint32_t) 0x00302018UL) /* only listed in datasheet */ +#define LV_EVE_REG_SNAPY ((uint32_t) 0x00302014UL) /* only listed in datasheet */ +#define LV_EVE_REG_SOUND ((uint32_t) 0x00302088UL) +#define LV_EVE_REG_SPI_WIDTH ((uint32_t) 0x00302188UL) /* listed with false offset in programmers guide V1.1 */ +#define LV_EVE_REG_SWIZZLE ((uint32_t) 0x00302064UL) +#define LV_EVE_REG_TAG ((uint32_t) 0x0030207cUL) +#define LV_EVE_REG_TAG_X ((uint32_t) 0x00302074UL) +#define LV_EVE_REG_TAG_Y ((uint32_t) 0x00302078UL) +#define LV_EVE_REG_TAP_CRC ((uint32_t) 0x00302024UL) /* only listed in datasheet */ +#define LV_EVE_REG_TAP_MASK ((uint32_t) 0x00302028UL) /* only listed in datasheet */ +#define LV_EVE_REG_TOUCH_ADC_MODE ((uint32_t) 0x00302108UL) +#define LV_EVE_REG_TOUCH_CHARGE ((uint32_t) 0x0030210cUL) +#define LV_EVE_REG_TOUCH_DIRECT_XY ((uint32_t) 0x0030218cUL) +#define LV_EVE_REG_TOUCH_DIRECT_Z1Z2 ((uint32_t) 0x00302190UL) +#define LV_EVE_REG_TOUCH_MODE ((uint32_t) 0x00302104UL) +#define LV_EVE_REG_TOUCH_OVERSAMPLE ((uint32_t) 0x00302114UL) +#define LV_EVE_REG_TOUCH_RAW_XY ((uint32_t) 0x0030211cUL) +#define LV_EVE_REG_TOUCH_RZ ((uint32_t) 0x00302120UL) +#define LV_EVE_REG_TOUCH_RZTHRESH ((uint32_t) 0x00302118UL) +#define LV_EVE_REG_TOUCH_SCREEN_XY ((uint32_t) 0x00302124UL) +#define LV_EVE_REG_TOUCH_SETTLE ((uint32_t) 0x00302110UL) +#define LV_EVE_REG_TOUCH_TAG ((uint32_t) 0x0030212cUL) +#define LV_EVE_REG_TOUCH_TAG1 ((uint32_t) 0x00302134UL) /* only listed in datasheet */ +#define LV_EVE_REG_TOUCH_TAG1_XY ((uint32_t) 0x00302130UL) /* only listed in datasheet */ +#define LV_EVE_REG_TOUCH_TAG2 ((uint32_t) 0x0030213cUL) /* only listed in datasheet */ +#define LV_EVE_REG_TOUCH_TAG2_XY ((uint32_t) 0x00302138UL) /* only listed in datasheet */ +#define LV_EVE_REG_TOUCH_TAG3 ((uint32_t) 0x00302144UL) /* only listed in datasheet */ +#define LV_EVE_REG_TOUCH_TAG3_XY ((uint32_t) 0x00302140UL) /* only listed in datasheet */ +#define LV_EVE_REG_TOUCH_TAG4 ((uint32_t) 0x0030214cUL)/* only listed in datasheet */ +#define LV_EVE_REG_TOUCH_TAG4_XY ((uint32_t) 0x00302148UL) /* only listed in datasheet */ +#define LV_EVE_REG_TOUCH_TAG_XY ((uint32_t) 0x00302128UL) +#define LV_EVE_REG_TOUCH_TRANSFORM_A ((uint32_t) 0x00302150UL) +#define LV_EVE_REG_TOUCH_TRANSFORM_B ((uint32_t) 0x00302154UL) +#define LV_EVE_REG_TOUCH_TRANSFORM_C ((uint32_t) 0x00302158UL) +#define LV_EVE_REG_TOUCH_TRANSFORM_D ((uint32_t) 0x0030215cUL) +#define LV_EVE_REG_TOUCH_TRANSFORM_E ((uint32_t) 0x00302160UL) +#define LV_EVE_REG_TOUCH_TRANSFORM_F ((uint32_t) 0x00302164UL) +#define LV_EVE_REG_TRACKER ((uint32_t) 0x00309000UL) /* only listed in programmers guide */ +#define LV_EVE_REG_TRACKER_1 ((uint32_t) 0x00309004UL) /* only listed in programmers guide */ +#define LV_EVE_REG_TRACKER_2 ((uint32_t) 0x00309008UL) /* only listed in programmers guide */ +#define LV_EVE_REG_TRACKER_3 ((uint32_t) 0x0030900cUL) /* only listed in programmers guide */ +#define LV_EVE_REG_TRACKER_4 ((uint32_t) 0x00309010UL) /* only listed in programmers guide */ +#define LV_EVE_REG_TRIM ((uint32_t) 0x00302180UL) +#define LV_EVE_REG_VCYCLE ((uint32_t) 0x00302040UL) +#define LV_EVE_REG_VOFFSET ((uint32_t) 0x00302044UL) +#define LV_EVE_REG_VOL_PB ((uint32_t) 0x00302080UL) +#define LV_EVE_REG_VOL_SOUND ((uint32_t) 0x00302084UL) +#define LV_EVE_REG_VSIZE ((uint32_t) 0x00302048UL) +#define LV_EVE_REG_VSYNC0 ((uint32_t) 0x0030204cUL) +#define LV_EVE_REG_VSYNC1 ((uint32_t) 0x00302050UL) + + +/* Macros for static display list generation */ + +//#define LV_EVE_ALPHA_FUNC(func,ref) ((LV_EVE_DL_ALPHA_FUNC) | (((func) & 7UL) << 8U) | ((ref) & 0xFFUL)) +/** + * @brief Set the alpha test function. + * + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_ALPHA_FUNC(uint8_t func, uint8_t ref) +{ + uint32_t const funcv = ((uint32_t) func & 7U) << 8U; + return (LV_EVE_DL_ALPHA_FUNC | funcv | ref); +} + +//#define LV_EVE_BITMAP_HANDLE(handle) ((LV_EVE_DL_BITMAP_HANDLE) | ((handle) & 0x1FUL)) +/** + * @brief Set the bitmap handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_HANDLE(uint8_t handle) +{ + return (LV_EVE_DL_BITMAP_HANDLE | ((handle) & 0x1FUL)); +} + +//#define LV_EVE_BITMAP_LAYOUT(format,linestride,height) ((LV_EVE_DL_BITMAP_LAYOUT) | (((format) & 0x1FUL) << 19U) | (((linestride) & 0x3FFUL) << 9U) | ((height) & 0x1FFUL)) +/** + * @brief Set the source bitmap memory format and layout for the current handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_LAYOUT(uint8_t format, uint16_t linestride, uint16_t height) +{ + uint32_t const formatv = ((uint32_t) format & 0x1FUL) << 19U; + uint32_t const linestridev = ((uint32_t) linestride & 0x3FFUL) << 9U; + uint32_t const heightv = height & 0x1FFUL; + return (LV_EVE_DL_BITMAP_LAYOUT | formatv | linestridev | heightv); +} + +//#define LV_EVE_BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((LV_EVE_DL_BITMAP_SIZE) | (((filter) & 1UL) << 20U) | (((wrapx) & 1UL) << 19U) | (((wrapy) & 1UL) << 18U) | (((width) & 0x1FFUL) << 9U) | ((height) & 0x1FFUL)) +/** + * @brief Set the source bitmap memory format and layout for the current handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_SIZE(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height) +{ + uint32_t const filterv = (filter & 0x1UL) << 20U; + uint32_t const wrapxv = (wrapx & 0x1UL) << 19U; + uint32_t const wrapyv = (wrapy & 0x1UL) << 18U; + uint32_t const widthv = (width & 0x1FFUL) << 9U; + uint32_t const heightv = height & 0x1FFUL; + return (LV_EVE_DL_BITMAP_SIZE | filterv | wrapxv | wrapyv | widthv | heightv); +} + +//#define LV_EVE_BITMAP_LAYOUT_H(linestride,height) ((LV_EVE_DL_BITMAP_LAYOUT_H) | (((((linestride) & 0xC00U) >> 10U)&3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +/** + * @brief Set the 2 most significant bits of the source bitmap memory format and layout for the current handle. + * @param linestride 12-bit value specified to BITMAP_LAYOUT + * @param height 11-bit value specified to BITMAP_LAYOUT + * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_LAYOUT_H(uint16_t linestride, uint16_t height) +{ + uint32_t const linestridev = (uint32_t)((((linestride & 0xC00U) >> 10U) & 3UL) << 2U); + uint32_t const heightv = (uint32_t)(((height & 0x600U) >> 9U) & 3UL); + return (LV_EVE_DL_BITMAP_LAYOUT_H | linestridev | heightv); +} + +//#define LV_EVE_BITMAP_SIZE_H(width,height) ((LV_EVE_DL_BITMAP_SIZE_H) | (((((width) & 0x600U) >> 9U) & 3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +/** + * @brief Set the 2 most significant bits of bitmaps dimension for the current handle. + * @param linestride 11-bit value of bitmap width, the 2 most significant bits are used + * @param height 11-bit value of bitmap width, the 2 most significant bits are used + * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_SIZE_H(uint16_t width, uint16_t height) +{ + uint32_t const widthv = (uint32_t)((((width & 0x600U) >> 9U) & 3UL) << 2U); + uint32_t const heightv = (uint32_t)(((height & 0x600U) >> 9U) & 3UL); + return ((LV_EVE_DL_BITMAP_SIZE_H) | widthv | heightv); +} + +//#define LV_EVE_BITMAP_SOURCE(addr) ((LV_EVE_DL_BITMAP_SOURCE) | ((addr) & 0x3FFFFFUL)) +/** + * @brief Set the source address of bitmap data in RAM_G or flash memory. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_SOURCE(uint32_t addr) +{ + return (LV_EVE_DL_BITMAP_SOURCE | (addr & 0x3FFFFFUL)); +} + +#if LV_DRAW_EVE_EVE_GENERATION < 3 /* only define these for FT81x */ +//#define LV_EVE_BITMAP_TRANSFORM_A(a) ((LV_EVE_DL_BITMAP_TRANSFORM_A) | ((a) & 0x1FFFFUL)) +/** + * @brief Set the A coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_A(uint32_t val) +{ + return (LV_EVE_DL_BITMAP_TRANSFORM_A | (val & 0x1FFFFUL)); +} + +//#define LV_EVE_BITMAP_TRANSFORM_B(b) ((LV_EVE_DL_BITMAP_TRANSFORM_B) | ((b) & 0x1FFFFUL)) +/** + * @brief Set the B coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_B(uint32_t val) +{ + return (LV_EVE_DL_BITMAP_TRANSFORM_B | (val & 0x1FFFFUL)); +} + +//#define LV_EVE_BITMAP_TRANSFORM_D(d) ((LV_EVE_DL_BITMAP_TRANSFORM_D) | ((d) & 0x1FFFFUL)) +/** + * @brief Set the D coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_D(uint32_t val) +{ + return (LV_EVE_DL_BITMAP_TRANSFORM_D | (val & 0x1FFFFUL)); +} + +//#define LV_EVE_BITMAP_TRANSFORM_E(e) ((LV_EVE_DL_BITMAP_TRANSFORM_E) | ((e) & 0x1FFFFUL)) +/** + * @brief Set he E coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_E(uint32_t val) +{ + return (LV_EVE_DL_BITMAP_TRANSFORM_E | (val & 0x1FFFFUL)); +} + +#endif + +//#define LV_EVE_BITMAP_TRANSFORM_C(c) ((LV_EVE_DL_BITMAP_TRANSFORM_C) | ((c) & 0x1FFFFUL)) +/** + * @brief Set the C coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_C(uint32_t val) +{ + return (LV_EVE_DL_BITMAP_TRANSFORM_C | (val & 0x1FFFFUL)); +} + +//#define LV_EVE_BITMAP_TRANSFORM_F(f) ((LV_EVE_DL_BITMAP_TRANSFORM_F) | ((f) & 0x1FFFFUL)) +/** + * @brief Set the F coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_F(uint32_t val) +{ + return (LV_EVE_DL_BITMAP_TRANSFORM_F | (val & 0x1FFFFUL)); +} + +//#define LV_EVE_BLEND_FUNC(src,dst) ((LV_EVE_DL_BLEND_FUNC) | (((src) & 7UL) << 3U) | ((dst) & 7UL)) +/** + * @brief Execute a sequence of commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BLEND_FUNC(uint8_t src, uint8_t dst) +{ + uint32_t const srcv = (uint32_t)((src & 7UL) << 3U); + uint32_t const dstv = (uint32_t)(dst & 7UL); + return (LV_EVE_DL_BLEND_FUNC | srcv | dstv); +} + +//#define LV_EVE_CALL(dest) ((LV_EVE_DL_CALL) | ((dest) & 0xFFFFUL)) +/** + * @brief Execute a sequence of commands at another location in the display list. + * @note valid range for dest is from zero to 2047 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_CALL(uint16_t dest) +{ + return (LV_EVE_DL_CALL | (dest & 0x7FFUL)); +} + +//#define LV_EVE_JUMP(dest) ((LV_EVE_DL_JUMP) | ((dest) & 0xFFFFUL)) +/** + * @brief Execute commands at another location in the display list. + * @note valid range for dest is from zero to 2047 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_JUMP(uint16_t dest) +{ + return (LV_EVE_DL_JUMP | (dest & 0x7FFUL)); +} + +//#define LV_EVE_CELL(cell) ((LV_EVE_DL_CELL) | ((cell) & 0x7FUL)) +/** + * @brief Set the bitmap cell number for the VERTEX2F command. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_CELL(uint8_t cell) +{ + return (LV_EVE_DL_CELL | (cell & 0x7FUL)); +} + +//#define LV_EVE_CLEAR(c,s,t) ((LV_EVE_DL_CLEAR) | (((c) & 1UL) << 2U) | (((s) & 1UL) << 1U) | ((t) & 1UL)) +/** + * @brief Clear buffers to preset values. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_CLEAR(uint8_t color, uint8_t stencil, uint8_t tag) +{ + uint32_t const colorv = (color & 1UL) << 2U; + uint32_t const stencilv = (stencil & 1UL) << 1U; + uint32_t const tagv = (tag & 1UL); + return (LV_EVE_DL_CLEAR | colorv | stencilv | tagv); +} + +//#define LV_EVE_CLEAR_COLOR_A(alpha) ((LV_EVE_DL_CLEAR_COLOR_A) | ((alpha) & 0xFFUL)) +/** + * @brief Set clear value for the alpha channel. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_CLEAR_COLOR_A(uint8_t alpha) +{ + return (LV_EVE_DL_CLEAR_COLOR_A | alpha); +} + +//#define LV_EVE_CLEAR_COLOR_RGB(red,green,blue) ((LV_EVE_DL_CLEAR_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) +/** + * @brief Set clear values for red, green and blue channels. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) +{ + uint32_t const redv = ((red & 0xFFUL) << 16U); + uint32_t const greenv = ((green & 0xFFUL) << 8U); + uint32_t const bluev = (blue & 0xFFUL); + return (LV_EVE_DL_CLEAR_COLOR_RGB | redv | greenv | bluev); +} + +//#define LV_EVE_CLEAR_STENCIL(s) ((LV_EVE_DL_CLEAR_STENCIL) | ((s) & 0xFFUL)) +/** + * @brief Set clear value for the stencil buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_CLEAR_STENCIL(uint8_t val) +{ + return (LV_EVE_DL_CLEAR_STENCIL | val); +} + +//#define LV_EVE_CLEAR_TAG(s) ((LV_EVE_DL_CLEAR_TAG) | ((s) & 0xFFUL)) +/** + * @brief Set clear value for the tag buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_CLEAR_TAG(uint8_t val) +{ + return (LV_EVE_DL_CLEAR_TAG | val); +} + +//#define LV_EVE_COLOR_A(alpha) ((LV_EVE_DL_COLOR_A) | ((alpha) & 0xFFUL)) +/** + * @brief Set the current color alpha. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_COLOR_A(uint8_t alpha) +{ + return (LV_EVE_DL_COLOR_A | alpha); +} + +//#define LV_EVE_COLOR_MASK(r,g,b,a) ((LV_EVE_DL_COLOR_MASK) | (((r) & 1UL) << 3U) | (((g) & 1UL) << 2U) | (((b) & 1UL) << 1U) | ((a) & 1UL)) +/** + * @brief Enable or disable writing of color components. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_COLOR_MASK(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +{ + uint32_t const redv = ((red & 1UL) << 3U); + uint32_t const greenv = ((green & 1UL) << 2U); + uint32_t const bluev = ((blue & 1UL) << 1U); + uint32_t const alphav = (alpha & 1UL); + return (LV_EVE_DL_COLOR_MASK | redv | greenv | bluev | alphav); +} + +//#define LV_EVE_COLOR_RGB(red,green,blue) ((LV_EVE_DL_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) +/** + * @brief Set the current color red, green and blue. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) +{ + uint32_t const redv = ((red & 0xFFUL) << 16U); + uint32_t const greenv = ((green & 0xFFUL) << 8U); + uint32_t const bluev = (blue & 0xFFUL); + return (LV_EVE_DL_COLOR_RGB | redv | greenv | bluev); +} + +//#define LV_EVE_LINE_WIDTH(width) ((LV_EVE_DL_LINE_WIDTH) | (((uint32_t) (width)) & 0xFFFUL)) +/** + * @brief Set the width of lines to be drawn with primitive LINES in 1/16 pixel precision. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_LINE_WIDTH(uint16_t width) +{ + return (LV_EVE_DL_LINE_WIDTH | (width & 0xFFFUL)); +} + +//#define LV_EVE_MACRO(m) ((LV_EVE_DL_MACRO) | ((m) & 1UL)) +/** + * @brief Execute a single command from a macro register. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_MACRO(uint8_t macro) +{ + return (LV_EVE_DL_MACRO | (macro & 0x1UL)); +} + +//#define LV_EVE_PALETTE_SOURCE(addr) ((LV_EVE_DL_PALETTE_SOURCE) | ((addr) & 0x3FFFFF3UL)) +/** + * @brief Set the base address of the palette. + * @note 2-byte alignment is required if pixel format is PALETTE4444 or PALETTE565. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_PALETTE_SOURCE(uint32_t addr) +{ + return (LV_EVE_DL_PALETTE_SOURCE | (addr & 0x3FFFFFUL)); +} + +//#define LV_EVE_POINT_SIZE(size) ((LV_EVE_DL_POINT_SIZE) | ((size) & 0x1FFFUL)) +/** + * @brief Set the radius of points to be drawn with primitive POINTS in 1/16 pixel precision. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_POINT_SIZE(uint16_t size) +{ + return (LV_EVE_DL_POINT_SIZE | (size & 0x1FFFUL)); +} + +//#define LV_EVE_SCISSOR_SIZE(width,height) ((LV_EVE_DL_SCISSOR_SIZE) | (((width) & 0xFFFUL) << 12U) | ((height) & 0xFFFUL)) +/** + * @brief Set the size of the scissor clip rectangle. + * @note valid range for width and height is from zero to 2048 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_SCISSOR_SIZE(uint16_t width, uint16_t height) +{ + uint32_t const widthv = (uint32_t)((width & 0xFFFUL) << 12U); + uint32_t const heightv = (uint32_t)(height & 0xFFFUL); + return (LV_EVE_DL_SCISSOR_SIZE | widthv | heightv); +} + +//#define LV_EVE_SCISSOR_XY(x,y) ((LV_EVE_DL_SCISSOR_XY) | (((x) & 0x7FFUL) << 11U) | ((y) & 0x7FFUL)) +/** + * @brief Set the top left corner of the scissor clip rectangle. + * @note valid range for width and height is from zero to 2047 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_SCISSOR_XY(uint16_t xc0, uint16_t yc0) +{ + uint32_t const xc0v = (uint32_t)((xc0 & 0x7FFUL) << 11U); + uint32_t const yc0v = (uint32_t)(yc0 & 0x7FFUL); + return (LV_EVE_DL_SCISSOR_XY | xc0v | yc0v); +} + +//#define LV_EVE_STENCIL_FUNC(func,ref,mask) ((LV_EVE_DL_STENCIL_FUNC) | (((func) & 7UL) << 16U) | (((ref) & 0xFFUL) << 8U)|((mask) & 0xFFUL)) +/** + * @brief Set function and reference value for stencil testing. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_STENCIL_FUNC(uint8_t func, uint8_t ref, uint8_t mask) +{ + uint32_t const funcv = (uint32_t)((func & 7UL) << 16U); + uint32_t const refv = (uint32_t)((ref & 0xFFUL) << 8U); + uint32_t const maskv = (uint32_t)(mask & 0xFFUL); + return (LV_EVE_DL_STENCIL_FUNC | funcv | refv | maskv); +} + +//#define LV_EVE_STENCIL_MASK(mask) ((LV_EVE_DL_STENCIL_MASK) | ((mask) & 0xFFUL)) +/** + * @brief Control the writing of individual bits in the stencil planes. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_STENCIL_MASK(uint8_t mask) +{ + return (LV_EVE_DL_STENCIL_MASK | mask); +} + +//#define LV_EVE_STENCIL_OP(sfail,spass) ((LV_EVE_DL_STENCIL_OP) | (((sfail) & 7UL) << 3U) | ((spass) & 7UL)) +/** + * @brief Set stencil test actions. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_STENCIL_OP(uint8_t sfail, uint8_t spass) +{ + uint32_t const sfailv = (uint32_t)((sfail & 0x07UL) << 3U); + uint32_t const spassv = (uint32_t)(spass & 0x07UL); + return (LV_EVE_DL_STENCIL_OP | sfailv | spassv); +} + +//#define LV_EVE_TAG(s) ((LV_EVE_DL_TAG) | ((s) & 0xFFUL)) +/** + * @brief Attach the tag value for the following graphics objects drawn on the screen. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_TAG(uint8_t tagval) +{ + return (LV_EVE_DL_TAG | tagval); +} + +//#define LV_EVE_TAG_MASK(mask) ((LV_EVE_DL_TAG_MASK) | ((mask) & 1UL)) +/** + * @brief Control the writing of the tag buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_TAG_MASK(uint8_t mask) +{ + return (LV_EVE_DL_TAG_MASK | ((mask) & 1UL)); +} + +//#define LV_EVE_VERTEX2F(x,y) ((LV_EVE_DL_VERTEX2F) | ((((uint32_t) (x)) & 0x7FFFUL) << 15U) | (((uint32_t) (y)) & 0x7FFFUL)) +/** + * @brief Set coordinates for graphics primitives. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_VERTEX2F(int16_t xc0, int16_t yc0) +{ + uint32_t const xc0v = ((((uint32_t)((uint16_t) xc0)) & 0x7FFFUL) << 15U); + uint32_t const yc0v = (((uint32_t)((uint16_t) yc0)) & 0x7FFFUL); + return (LV_EVE_DL_VERTEX2F | xc0v | yc0v); +} + +//#define LV_EVE_VERTEX2II(x,y,handle,cell) ((LV_EVE_DL_VERTEX2II) | (((x) & 0x1FFUL) << 21U) | (((y) & 0x1FFUL) << 12U) | (((handle) & 0x1FUL) << 7U) | ((cell) & 0x7FUL)) +/** + * @brief Set coordinates, bitmap-handle and cell-number for graphics primitives. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_VERTEX2II(uint16_t xc0, uint16_t yc0, uint8_t handle, uint8_t cell) +{ + uint32_t const xc0v = ((((uint32_t) xc0) & 0x1FFUL) << 21U); + uint32_t const yc0v = ((((uint32_t) yc0) & 0x1FFUL) << 12U); + uint32_t const handlev = ((((uint32_t) handle) & 0x1FUL) << 7U); + uint32_t const cellv = (((uint32_t) cell) & 0x7FUL); + return (LV_EVE_DL_VERTEX2II | xc0v | yc0v | handlev | cellv); +} + +//#define LV_EVE_VERTEX_FORMAT(frac) ((LV_EVE_DL_VERTEX_FORMAT) | ((frac) & 7UL)) +/** + * @brief Set the precision of VERTEX2F coordinates. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_VERTEX_FORMAT(uint8_t frac) +{ + return (LV_EVE_DL_VERTEX_FORMAT | ((frac) & 7UL)); +} + +//#define LV_EVE_VERTEX_TRANSLATE_X(x) ((LV_EVE_DL_VERTEX_TRANSLATE_X) | ((x) & 0x1FFFFUL)) +/** + * @brief Set the vertex transformations X translation component. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_VERTEX_TRANSLATE_X(int32_t xco) +{ + return (LV_EVE_DL_VERTEX_TRANSLATE_X | (((uint32_t) xco) & 0x1FFFFUL)); +} + +//#define LV_EVE_VERTEX_TRANSLATE_Y(y) ((LV_EVE_DL_VERTEX_TRANSLATE_Y) | ((y) & 0x1FFFFUL)) +/** + * @brief Set the vertex transformations Y translation component. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_VERTEX_TRANSLATE_Y(int32_t yco) +{ + return (LV_EVE_DL_VERTEX_TRANSLATE_Y | (((uint32_t) yco) & 0x1FFFFUL)); +} + +/* #define LV_EVE_BEGIN(prim) ((LV_EVE_DL_BEGIN) | ((prim) & 15UL)) */ /* use define LV_EVE_DL_BEGIN */ +/* #define LV_EVE_DISPLAY() ((LV_EVE_DL_DISPLAY)) */ /* use define LV_EVE_DL_DISPLAY */ +/* #define LV_EVE_END() ((LV_EVE_DL_END)) */ /* use define LV_EVE_DL_END */ +/* #define LV_EVE_RESTORE_CONTEXT() ((LV_EVE_DL_RESTORE_CONTEXT)) */ /* use define LV_EVE_DL_RESTORE_CONTEXT */ +/* #define LV_EVE_RETURN() ((LV_EVE_DL_RETURN)) */ /* use define LV_EVE_DL_RETURN */ +/* #define LV_EVE_SAVE_CONTEXT() ((LV_EVE_DL_SAVE_CONTEXT)) */ /* use define LV_EVE_DL_SAVE_CONTEXT */ +/* #define LV_EVE_NOP() ((LV_EVE_DL_NOP)) */ + +/* ########## EVE Generation 3: BT815 / BT816 definitions ########## */ + +#if LV_DRAW_EVE_EVE_GENERATION > 2 + +#define LV_EVE_EVE_GLFORMAT ((uint32_t) 31UL) /* used with BITMAP_LAYOUT to indicate bitmap-format is specified by BITMAP_EXT_FORMAT */ + +#define LV_EVE_DL_BITMAP_EXT_FORMAT ((uint32_t) 0x2E000000UL) /* requires OR'd arguments */ +#define LV_EVE_DL_BITMAP_SWIZZLE ((uint32_t) 0x2F000000UL) +/* #define LV_EVE_DL_INT_FRR ((uint32_t) 0x30000000UL) */ /* ESE displays "Internal: flash read result" - undocumented display list command */ + +/* Extended Bitmap formats */ +#define LV_EVE_EVE_ASTC_4X4 ((uint32_t) 37808UL) +#define LV_EVE_EVE_ASTC_5X4 ((uint32_t) 37809UL) +#define LV_EVE_EVE_ASTC_5X5 ((uint32_t) 37810UL) +#define LV_EVE_EVE_ASTC_6X5 ((uint32_t) 37811UL) +#define LV_EVE_EVE_ASTC_6X6 ((uint32_t) 37812UL) +#define LV_EVE_EVE_ASTC_8X5 ((uint32_t) 37813UL) +#define LV_EVE_EVE_ASTC_8X6 ((uint32_t) 37814UL) +#define LV_EVE_EVE_ASTC_8X8 ((uint32_t) 37815UL) +#define LV_EVE_EVE_ASTC_10X5 ((uint32_t) 37816UL) +#define LV_EVE_EVE_ASTC_10X6 ((uint32_t) 37817UL) +#define LV_EVE_EVE_ASTC_10X8 ((uint32_t) 37818UL) +#define LV_EVE_EVE_ASTC_10X10 ((uint32_t) 37819UL) +#define LV_EVE_EVE_ASTC_12X10 ((uint32_t) 37820UL) +#define LV_EVE_EVE_ASTC_12X12 ((uint32_t) 37821UL) + +#define LV_EVE_EVE_RAM_ERR_REPORT ((uint32_t) 0x309800UL) /* max 128 bytes null terminated string */ +#define LV_EVE_EVE_RAM_FLASH ((uint32_t) 0x800000UL) +#define LV_EVE_EVE_RAM_FLASH_POSTBLOB ((uint32_t) 0x801000UL) + +#define LV_EVE_EVE_OPT_FLASH ((uint16_t) 64U) +#define LV_EVE_EVE_OPT_OVERLAY ((uint16_t) 128U) +#define LV_EVE_EVE_OPT_FORMAT ((uint16_t) 4096U) +#define LV_EVE_EVE_OPT_FILL ((uint16_t) 8192U) + +/* Commands for BT815 / BT816 */ +#define LV_EVE_CMD_BITMAP_TRANSFORM ((uint32_t) 0xFFFFFF21UL) +#define LV_EVE_CMD_SYNC ((uint32_t) 0xFFFFFF42UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_SYNC) */ +#define LV_EVE_CMD_FLASHERASE ((uint32_t) 0xFFFFFF44UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHERASE) */ +#define LV_EVE_CMD_FLASHWRITE ((uint32_t) 0xFFFFFF45UL) +#define LV_EVE_CMD_FLASHREAD ((uint32_t) 0xFFFFFF46UL) +#define LV_EVE_CMD_FLASHUPDATE ((uint32_t) 0xFFFFFF47UL) +#define LV_EVE_CMD_FLASHDETACH ((uint32_t) 0xFFFFFF48UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHDETACH) */ +#define LV_EVE_CMD_FLASHATTACH ((uint32_t) 0xFFFFFF49UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHATTACH) */ +#define LV_EVE_CMD_FLASHFAST ((uint32_t) 0xFFFFFF4AUL) +#define LV_EVE_CMD_FLASHSPIDESEL ((uint32_t) 0xFFFFFF4BUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHSPIDESEL) */ +#define LV_EVE_CMD_FLASHSPITX ((uint32_t) 0xFFFFFF4CUL) +#define LV_EVE_CMD_FLASHSPIRX ((uint32_t) 0xFFFFFF4DUL) +#define LV_EVE_CMD_FLASHSOURCE ((uint32_t) 0xFFFFFF4EUL) +#define LV_EVE_CMD_CLEARCACHE ((uint32_t) 0xFFFFFF4FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_CLEARCACHE) */ +#define LV_EVE_CMD_INFLATE2 ((uint32_t) 0xFFFFFF50UL) +#define LV_EVE_CMD_ROTATEAROUND ((uint32_t) 0xFFFFFF51UL) +#define LV_EVE_CMD_RESETFONTS ((uint32_t) 0xFFFFFF52UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RESETFONTS) */ +#define LV_EVE_CMD_ANIMSTART ((uint32_t) 0xFFFFFF53UL) +#define LV_EVE_CMD_ANIMSTOP ((uint32_t) 0xFFFFFF54UL) +#define LV_EVE_CMD_ANIMXY ((uint32_t) 0xFFFFFF55UL) +#define LV_EVE_CMD_ANIMDRAW ((uint32_t) 0xFFFFFF56UL) +#define LV_EVE_CMD_GRADIENTA ((uint32_t) 0xFFFFFF57UL) +#define LV_EVE_CMD_FILLWIDTH ((uint32_t) 0xFFFFFF58UL) +#define LV_EVE_CMD_APPENDF ((uint32_t) 0xFFFFFF59UL) +#define LV_EVE_CMD_ANIMFRAME ((uint32_t) 0xFFFFFF5AUL) +#define LV_EVE_CMD_VIDEOSTARTF ((uint32_t) 0xFFFFFF5FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_VIDEOSTARTF) */ + +/* Registers for BT815 / BT816 */ +#define LV_EVE_REG_ADAPTIVE_FRAMERATE ((uint32_t) 0x0030257cUL) +#define LV_EVE_REG_PLAYBACK_PAUSE ((uint32_t) 0x003025ecUL) +#define LV_EVE_REG_FLASH_STATUS ((uint32_t) 0x003025f0UL) +#define LV_EVE_REG_FLASH_SIZE ((uint32_t) 0x00309024UL) +#define LV_EVE_REG_PLAY_CONTROL ((uint32_t) 0x0030914eUL) +#define LV_EVE_REG_COPRO_PATCH_PTR ((uint32_t) 0x00309162UL) + +/* Macros for BT815 / BT816 */ + +//#define LV_EVE_BITMAP_EXT_FORMAT(format) ((LV_EVE_DL_BITMAP_EXT_FORMAT) | ((format) & 0xFFFFUL)) +/** + * @brief Set the extended format of the bitmap. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_EXT_FORMAT(uint16_t format) +{ + return (LV_EVE_DL_BITMAP_EXT_FORMAT | format); +} + +//#define LV_EVE_BITMAP_SWIZZLE(r,g,b,a) ((LV_EVE_DL_BITMAP_SWIZZLE) | (((r) & 7UL) << 9U) | (((g) & 7UL) << 6U) | (((b) & 7UL) << 3U) | ((a) & 7UL)) +/** + * @brief Set the source for the red, green, blue and alpha channels of a bitmap. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_SWIZZLE(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +{ + uint32_t const redv = ((red & 7UL) << 9U); + uint32_t const greenv = ((green & 7UL) << 6U); + uint32_t const bluev = ((blue & 7UL) << 3U); + uint32_t const alphav = (alpha & 7UL); + return (LV_EVE_DL_BITMAP_SWIZZLE | redv | greenv | bluev | alphav); +} + +//#define LV_EVE_BITMAP_TRANSFORM_A_EXT(p,v) ((LV_EVE_DL_BITMAP_TRANSFORM_A) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the A coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_A(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (LV_EVE_DL_BITMAP_TRANSFORM_A | prcv | valv); +} + +//#define LV_EVE_BITMAP_TRANSFORM_B_EXT(p,v) ((LV_EVE_DL_BITMAP_TRANSFORM_B) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the B coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_B(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (LV_EVE_DL_BITMAP_TRANSFORM_B | prcv | valv); +} + +//#define LV_EVE_BITMAP_TRANSFORM_D_EXT(p,v) ((LV_EVE_DL_BITMAP_TRANSFORM_D) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the D coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_D(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (LV_EVE_DL_BITMAP_TRANSFORM_D | prcv | valv); +} + +//#define LV_EVE_BITMAP_TRANSFORM_E_EXT(p,v) ((LV_EVE_DL_BITMAP_TRANSFORM_E) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the E coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LV_EVE_BITMAP_TRANSFORM_E(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (LV_EVE_DL_BITMAP_TRANSFORM_E | prcv | valv); +} + +//#define LV_EVE_BITMAP_TRANSFORM_A(a) LV_EVE_BITMAP_TRANSFORM_A_EXT(0UL,(a)) +//#define LV_EVE_BITMAP_TRANSFORM_B(b) LV_EVE_BITMAP_TRANSFORM_B_EXT(0UL,(b)) +//#define LV_EVE_BITMAP_TRANSFORM_D(d) LV_EVE_BITMAP_TRANSFORM_D_EXT(0UL,(d)) +//#define LV_EVE_BITMAP_TRANSFORM_E(e) LV_EVE_BITMAP_TRANSFORM_E_EXT(0UL,(e)) + +#endif /* LV_DRAW_EVE_EVE_GENERATION > 2 */ + +/* ########## EVE Generation 4: BT817 / BT818 definitions ########## */ + +#if LV_DRAW_EVE_EVE_GENERATION > 3 + +/* Commands for BT817 / BT818 */ +#define LV_EVE_CMD_ANIMFRAMERAM ((uint32_t) 0xFFFFFF6DUL) +#define LV_EVE_CMD_ANIMSTARTRAM ((uint32_t) 0xFFFFFF6EUL) +#define LV_EVE_CMD_APILEVEL ((uint32_t) 0xFFFFFF63UL) +#define LV_EVE_CMD_CALIBRATESUB ((uint32_t) 0xFFFFFF60UL) +#define LV_EVE_CMD_CALLLIST ((uint32_t) 0xFFFFFF67UL) +#define LV_EVE_CMD_ENDLIST ((uint32_t) 0xFFFFFF69UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_ENDLIST) */ +#define LV_EVE_CMD_FLASHPROGRAM ((uint32_t) 0xFFFFFF70UL) +#define LV_EVE_CMD_FONTCACHE ((uint32_t) 0xFFFFFF6BUL) +#define LV_EVE_CMD_FONTCACHEQUERY ((uint32_t) 0xFFFFFF6CUL) +#define LV_EVE_CMD_GETIMAGE ((uint32_t) 0xFFFFFF64UL) +#define LV_EVE_CMD_HSF ((uint32_t) 0xFFFFFF62UL) +#define LV_EVE_CMD_LINETIME ((uint32_t) 0xFFFFFF5EUL) +#define LV_EVE_CMD_NEWLIST ((uint32_t) 0xFFFFFF68UL) +#define LV_EVE_CMD_PCLKFREQ ((uint32_t) 0xFFFFFF6AUL) +#define LV_EVE_CMD_RETURN ((uint32_t) 0xFFFFFF66UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RETURN) */ +#define LV_EVE_CMD_RUNANIM ((uint32_t) 0xFFFFFF6FUL) +#define LV_EVE_CMD_TESTCARD ((uint32_t) 0xFFFFFF61UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_TESTCARD) */ +#define LV_EVE_CMD_WAIT ((uint32_t) 0xFFFFFF65UL) + +/* Registers for BT817 / BT818 */ +#define LV_EVE_REG_UNDERRUN ((uint32_t) 0x0030260cUL) +#define LV_EVE_REG_AH_HCYCLE_MAX ((uint32_t) 0x00302610UL) +#define LV_EVE_REG_PCLK_FREQ ((uint32_t) 0x00302614UL) +#define LV_EVE_REG_PCLK_2X ((uint32_t) 0x00302618UL) +#define LV_EVE_REG_ANIM_ACTIVE ((uint32_t) 0x0030902CUL) + +#endif /* LV_DRAW_EVE_EVE_GENERATION > 3 */ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_DRAW_EVE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_EVE_DISPLAY_DEFINES_H*/ diff --git a/include/lvgl/drivers/display/lv_draw_eve_target.h b/include/lvgl/drivers/display/lv_draw_eve_target.h new file mode 100644 index 0000000000..72092c7507 --- /dev/null +++ b/include/lvgl/drivers/display/lv_draw_eve_target.h @@ -0,0 +1,79 @@ +/** + * @file lv_draw_eve_target.h + * + */ + +#ifndef LV_DRAW_EVE_TARGET_H +#define LV_DRAW_EVE_TARGET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" +#if LV_USE_DRAW_EVE + +#include "../../lv_types.h" +#include LV_STDBOOL_INCLUDE +#include LV_STDINT_INCLUDE + +typedef struct { + uint16_t hor_res; /**< active display width */ + uint16_t ver_res; /**< active display height */ + uint16_t hcycle; /**< total number of clocks per line, incl front/back porch */ + uint16_t hoffset; /**< start of active line */ + uint16_t hsync0; /**< start of horizontal sync pulse */ + uint16_t hsync1; /**< end of horizontal sync pulse */ + uint16_t vcycle; /**< total number of lines per screen, including pre/post */ + uint16_t voffset; /**< start of active screen */ + uint16_t vsync0; /**< start of vertical sync pulse */ + uint16_t vsync1; /**< end of vertical sync pulse */ + uint8_t swizzle; /**< FT8xx output to LCD - pin order */ + uint8_t pclkpol; /**< LCD data is clocked in on this PCLK edge */ + uint8_t cspread; /**< helps with noise, when set to 1 fewer signals are changed simultaneously, reset-default: 1 */ + uint8_t pclk; /**< 60MHz / pclk = pclk frequency */ + bool has_crystal; /**< has an external clock crystal */ + bool has_gt911; /**< has a touch controller */ + uint8_t backlight_pwm; /**< backlight PWM duty cycle 0 = off, 128 = max */ + uint16_t backlight_freq; /**< backlight PWM frequency. try 4000 if unsure */ +} lv_draw_eve_parameters_t; + +typedef enum { + LV_DRAW_EVE_OPERATION_POWERDOWN_SET, /**< set the "PD_N" pin low */ + LV_DRAW_EVE_OPERATION_POWERDOWN_CLEAR, /**< set the "PD_N" pin high */ + LV_DRAW_EVE_OPERATION_CS_ASSERT, /**< set the "CS_N" pin low */ + LV_DRAW_EVE_OPERATION_CS_DEASSERT, /**< set the "CS_N" pin high */ + LV_DRAW_EVE_OPERATION_SPI_SEND, /**< send `length` bytes of `data` over SPI */ + LV_DRAW_EVE_OPERATION_SPI_RECEIVE /**< receive `length` bytes into `data` from SPI */ +} lv_draw_eve_operation_t; + +typedef void (*lv_draw_eve_operation_cb_t)(lv_display_t * disp, lv_draw_eve_operation_t operation, void * data, + uint32_t length); + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_DRAW_EVE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_EVE_TARGET_H*/ diff --git a/include/lvgl/drivers/display/lv_ft81x.h b/include/lvgl/drivers/display/lv_ft81x.h new file mode 100644 index 0000000000..56a3767b5d --- /dev/null +++ b/include/lvgl/drivers/display/lv_ft81x.h @@ -0,0 +1,94 @@ +/** + * @file lv_ft81x.h + * + */ + +#ifndef LV_FT81X_H +#define LV_FT81X_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" +#if LV_USE_FT81X + +#include "../../display/lv_display.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + uint16_t hor_res; /**< active display width */ + uint16_t ver_res; /**< active display height */ + + uint16_t hcycle; /**< total number of clocks per line, incl front/back porch */ + uint16_t hoffset; /**< start of active line */ + uint16_t hsync0; /**< start of horizontal sync pulse */ + uint16_t hsync1; /**< end of horizontal sync pulse */ + uint16_t vcycle; /**< total number of lines per screen, including pre/post */ + uint16_t voffset; /**< start of active screen */ + uint16_t vsync0; /**< start of vertical sync pulse */ + uint16_t vsync1; /**< end of vertical sync pulse */ + uint8_t swizzle; /**< FT8xx output to LCD - pin order */ + uint8_t pclkpol; /**< LCD data is clocked in on this PCLK edge */ + uint8_t cspread; /**< helps with noise, when set to 1 fewer signals are changed simultaneously, reset-default: 1 */ + uint8_t pclk; /**< 60MHz / pclk = pclk frequency */ + + bool has_crystal; /**< has an external clock crystal */ + bool is_bt81x; /**< is a BT series model, not FT */ +} lv_ft81x_parameters_t; + +typedef enum { + LV_FT81X_SPI_OPERATION_CS_ASSERT, + LV_FT81X_SPI_OPERATION_CS_DEASSERT, + LV_FT81X_SPI_OPERATION_SEND, + LV_FT81X_SPI_OPERATION_RECEIVE +} lv_ft81x_spi_operation_t; + +typedef void (*lv_ft81x_spi_cb_t)(lv_display_t * disp, lv_ft81x_spi_operation_t operation, void * data, + uint32_t length); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a framebuffer-based ft81x driver display. + * @param params pointer to a struct of display panel properties. does not need to be static. + * @param partial_buf a single partial buffer + * @param buf_size size of the partial buffer + * @param spi_cb a callback called by the driver to perform SPI operations + * @param user_data use `lv_ft81x_get_user_data` to get this pointer inside the SPI callback + * @return pointer to the display + */ +lv_display_t * lv_ft81x_create(const lv_ft81x_parameters_t * params, void * partial_buf, uint32_t buf_size, + lv_ft81x_spi_cb_t spi_cb, void * user_data); + +/** + * Get the `user_data` parameter that was passed to `lv_ft81x_create`. Useful in the SPI callback. + * @param disp pointer to the ft81x display + * @return the `user_data` pointer + */ +void * lv_ft81x_get_user_data(lv_display_t * disp); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_FT81X*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FT81X_H*/ diff --git a/include/lvgl/drivers/display/lv_ili9341.h b/include/lvgl/drivers/display/lv_ili9341.h new file mode 100644 index 0000000000..ed636024b3 --- /dev/null +++ b/include/lvgl/drivers/display/lv_ili9341.h @@ -0,0 +1,94 @@ +/** + * @file lv_ili9341.h + * + * This driver is just a wrapper around the generic MIPI compatible LCD controller driver + * + */ + +#ifndef LV_ILI9341_H +#define LV_ILI9341_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_lcd_generic_mipi.h" + +#if LV_USE_ILI9341 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef lv_lcd_send_cmd_cb_t lv_ili9341_send_cmd_cb_t; +typedef lv_lcd_send_color_cb_t lv_ili9341_send_color_cb_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an LCD display with ILI9341 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ +lv_display_t * lv_ili9341_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_ili9341_send_cmd_cb_t send_cmd_cb, lv_ili9341_send_color_cb_t send_color_cb); + +/** + * Set gap, i.e., the offset of the (0,0) pixel in the VRAM + * @param disp display object + * @param x x offset + * @param y y offset + */ +void lv_ili9341_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); + +/** + * Set color inversion + * @param disp display object + * @param invert false: normal, true: invert + */ +void lv_ili9341_set_invert(lv_display_t * disp, bool invert); + +/** + * Set gamma curve + * @param disp display object + * @param gamma gamma curve + */ +void lv_ili9341_set_gamma_curve(lv_display_t * disp, uint8_t gamma); + +/** + * Send list of commands. + * @param disp display object + * @param cmd_list controller and panel-specific commands + */ +void lv_ili9341_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); + +/********************** + * OTHERS + **********************/ + +/********************** + * MACROS + **********************/ + + +#endif /*LV_USE_ILI9341*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ILI9341_H*/ diff --git a/include/lvgl/drivers/display/lv_lcd_generic_mipi.h b/include/lvgl/drivers/display/lv_lcd_generic_mipi.h new file mode 100644 index 0000000000..fd99421171 --- /dev/null +++ b/include/lvgl/drivers/display/lv_lcd_generic_mipi.h @@ -0,0 +1,243 @@ +/** + * @file lv_lcd_generic_mipi.h + * + * Generic driver for controllers adhering to the MIPI DBI/DCS specification + * + * Works with: + * + * ST7735 + * ST7789 + * ST7796 + * ILI9341 + * ILI9488 (NOTE: in SPI mode ILI9488 only supports RGB666 mode, which is currently not supported) + * + * any probably many more + * + */ + +#ifndef LV_LCD_GENERIC_MIPI_H +#define LV_LCD_GENERIC_MIPI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" + +#if LV_USE_GENERIC_MIPI + +/********************* + * DEFINES + *********************/ + +/* MIPI DCS (Display Command Set) v1.02.00 User Command Set */ +#define LV_LCD_CMD_NOP 0x00 /* No Operation */ +#define LV_LCD_CMD_SOFT_RESET 0x01 /* Software Reset */ +#define LV_LCD_CMD_GET_POWER_MODE 0x0A /* Get the current power mode */ +#define LV_LCD_CMD_GET_ADDRESS_MODE 0x0B /* Get the data order for transfers from the Host to the display module and from the frame memory to the display device */ +#define LV_LCD_CMD_GET_PIXEL_FORMAT 0x0C /* Get the current pixel format */ +#define LV_LCD_CMD_GET_DISPLAY_MODE 0x0D /* Get the current display mode from the peripheral */ +#define LV_LCD_CMD_GET_SIGNAL_MODE 0x0E /* Get display module signaling mode */ +#define LV_LCD_CMD_GET_DIAGNOSTIC_RESULT 0x0F /* Get Peripheral Self-Diagnostic Result */ +#define LV_LCD_CMD_ENTER_SLEEP_MODE 0x10 /* Power for the display panel is off */ +#define LV_LCD_CMD_EXIT_SLEEP_MODE 0x11 /* Power for the display panel is on */ +#define LV_LCD_CMD_ENTER_PARTIAL_MODE 0x12 /* Part of the display area is used for image display */ +#define LV_LCD_CMD_ENTER_NORMAL_MODE 0x13 /* The whole display area is used for image display */ +#define LV_LCD_CMD_EXIT_INVERT_MODE 0x20 /* Displayed image colors are not inverted */ +#define LV_LCD_CMD_ENTER_INVERT_MODE 0x21 /* Displayed image colors are inverted */ +#define LV_LCD_CMD_SET_GAMMA_CURVE 0x26 /* Selects the gamma curve used by the display device */ +#define LV_LCD_CMD_SET_DISPLAY_OFF 0x28 /* Blanks the display device */ +#define LV_LCD_CMD_SET_DISPLAY_ON 0x29 /* Show the image on the display device */ +#define LV_LCD_CMD_SET_COLUMN_ADDRESS 0x2A /* Set the column extent */ +#define LV_LCD_CMD_SET_PAGE_ADDRESS 0x2B /* Set the page extent */ +#define LV_LCD_CMD_WRITE_MEMORY_START 0x2C /* Transfer image data from the Host Processor to the peripheral starting at the location provided by set_column_address and set_page_address */ +#define LV_LCD_CMD_READ_MEMORY_START 0x2E /* Transfer image data from the peripheral to the Host Processor interface starting at the location provided by set_column_address and set_page_address */ +#define LV_LCD_CMD_SET_PARTIAL_ROWS 0x30 /* Defines the number of rows in the partial display area on the display device */ +#define LV_LCD_CMD_SET_PARTIAL_COLUMNS 0x31 /* Defines the number of columns in the partial display area on the display device */ +#define LV_LCD_CMD_SET_SCROLL_AREA 0x33 /* Defines the vertical scrolling and fixed area on display device */ +#define LV_LCD_CMD_SET_TEAR_OFF 0x34 /* Synchronization information is not sent from the display module to the host processor */ +#define LV_LCD_CMD_SET_TEAR_ON 0x35 /* Synchronization information is sent from the display module to the host processor at the start of VFP */ +#define LV_LCD_CMD_SET_ADDRESS_MODE 0x36 /* Set the data order for transfers from the Host to the display module and from the frame memory to the display device */ +#define LV_LCD_CMD_SET_SCROLL_START 0x37 /* Defines the vertical scrolling starting point */ +#define LV_LCD_CMD_EXIT_IDLE_MODE 0x38 /* Full color depth is used on the display panel */ +#define LV_LCD_CMD_ENTER_IDLE_MODE 0x39 /* Reduced color depth is used on the display panel */ +#define LV_LCD_CMD_SET_PIXEL_FORMAT 0x3A /* Defines how many bits per pixel are used in the interface */ +#define LV_LCD_CMD_WRITE_MEMORY_CONTINUE 0x3C /* Transfer image information from the Host Processor interface to the peripheral from the last written location */ +#define LV_LCD_CMD_READ_MEMORY_CONTINUE 0x3E /* Read image data from the peripheral continuing after the last read_memory_continue or read_memory_start */ +#define LV_LCD_CMD_SET_TEAR_SCANLINE 0x44 /* Synchronization information is sent from the display module to the host processor when the display device refresh reaches the provided scanline */ +#define LV_LCD_CMD_GET_SCANLINE 0x45 /* Get the current scanline */ +#define LV_LCD_CMD_READ_DDB_CONTINUE 0xA8 /* Continue reading the DDB from the last read location */ +#define LV_LCD_CMD_READ_DDB_START 0xA1 /* Read the DDB from the provided location */ + +/* address mode flag masks */ +#define LV_LCD_MASK_FLIP_VERTICAL (1 << 0) /* This bit flips the image shown on the display device top to bottom. No change is made to the frame memory */ +#define LV_LCD_MASK_FLIP_HORIZONTAL (1 << 1) /* This bit flips the image shown on the display device left to right. No change is made to the frame memory */ +#define LV_LCD_MASK_DATA_LATCH_DATA_ORDER (1 << 2) /* Display Data Latch Order */ +#define LV_LCD_MASK_RGB_ORDER (1 << 3) /* RGB/BGR Order */ +#define LV_LCD_MASK_LINE_ADDRESS_ORDER (1 << 4) /* Line Address Order */ +#define LV_LCD_MASK_PAGE_COLUMN_ORDER (1 << 5) /* Page/Column Order */ +#define LV_LCD_MASK_COLUMN_ADDRESS_ORDER (1 << 6) /* Column Address Order */ +#define LV_LCD_MASK_PAGE_ADDRESS_ORDER (1 << 7) /* Page Address Order */ + +#define LV_LCD_BIT_FLIP_VERTICAL__NOT_FLIPPED 0 +#define LV_LCD_BIT_FLIP_VERTICAL__FLIPPED LV_LCD_MASK_FLIP_VERTICAL /* This bit flips the image shown on the display device top to bottom. No change is made to the frame memory */ +#define LV_LCD_BIT_FLIP_HORIZONTAL__NOT_FLIPPED 0 +#define LV_LCD_BIT_FLIP_HORIZONTAL__FLIPPED LV_LCD_MASK_FLIP_HORIZONTAL /* This bit flips the image shown on the display device left to right. No change is made to the frame memory */ +#define LV_LCD_BIT_DATA_LATCH_DATA_ORDER__LTOR 0 /* Display Data Latch Order: LCD Refresh Left to Right */ +#define LV_LCD_BIT_DATA_LATCH_DATA_ORDER__RTOL LV_LCD_MASK_DATA_LATCH_DATA_ORDER /* Display Data Latch Order: LCD Refresh Right to Left */ +#define LV_LCD_BIT_RGB_ORDER__RGB 0 /* RGB/BGR Order: RGB */ +#define LV_LCD_BIT_RGB_ORDER__BGR LV_LCD_MASK_RGB_ORDER /* RGB/BGR Order: BGR */ +#define LV_LCD_BIT_LINE_ADDRESS_ORDER__TTOB 0 /* Line Address Order: LCD Refresh Top to Bottom */ +#define LV_LCD_BIT_LINE_ADDRESS_ORDER__BTOT LV_LCD_MASK_LINE_ADDRESS_ORDER /* Line Address Order: LCD Refresh Bottom to Top */ +#define LV_LCD_BIT_PAGE_COLUMN_ORDER__NORMAL 0 /* Page/Column Order: Normal Mode */ +#define LV_LCD_BIT_PAGE_COLUMN_ORDER__REVERSE LV_LCD_MASK_PAGE_COLUMN_ORDER /* Page/Column Order: Reverse Mode */ +#define LV_LCD_BIT_COLUMN_ADDRESS_ORDER__LTOR 0 /* Column Address Order: Left to Right */ +#define LV_LCD_BIT_COLUMN_ADDRESS_ORDER__RTOL LV_LCD_MASK_COLUMN_ADDRESS_ORDER /* Column Address Order: Right to Left */ +#define LV_LCD_BIT_PAGE_ADDRESS_ORDER__TTOB 0 /* Page Address Order: Top to Bottom */ +#define LV_LCD_BIT_PAGE_ADDRESS_ORDER__BTOT LV_LCD_MASK_PAGE_ADDRESS_ORDER /* Page Address Order: Bottom to Top */ + +/* predefined gamma curves */ +#define LV_LCD_GAMMA_2_2 0x01 /* 2.2 */ +#define LV_LCD_GAMMA_1_8 0x02 /* 1.8 */ +#define LV_LCD_GAMMA_2_5 0x04 /* 2.5 */ +#define LV_LCD_GAMMA_1_0 0x08 /* 1.0 */ + +/* common pixel formats */ +#define LV_LCD_PIXEL_FORMAT_RGB565 0x55 /* bus: 16 bits, pixel: 16 bits */ +#define LV_LCD_PIXEL_FORMAT_RGB666 0x66 /* bus: 18 bits, pixel: 18 bits */ + +/* flags for lv_lcd_xxx_create() */ +#define LV_LCD_FLAG_NONE 0x00000000UL +#define LV_LCD_FLAG_MIRROR_X 0x00000001UL +#define LV_LCD_FLAG_MIRROR_Y 0x00000002UL +#define LV_LCD_FLAG_BGR 0x00000008UL +#define LV_LCD_FLAG_RGB666 0x00000010UL + +/* command list */ +#define LV_LCD_CMD_DELAY_MS 0xff +#define LV_LCD_CMD_EOF 0xff + +/********************** + * TYPEDEFS + **********************/ + +/** + * Configuration flags for lv_lcd_xxx_create() + * + */ +typedef uint32_t lv_lcd_flag_t; + +/** + * Prototype of a platform-dependent callback to transfer commands and data to the LCD controller. + * @param disp display object + * @param cmd command buffer (can handle 16 bit commands as well) + * @param cmd_size number of bytes of the command + * @param param parameter buffer + * @param param_size number of bytes of the parameters + */ +typedef void (*lv_lcd_send_cmd_cb_t)(lv_display_t * disp, const uint8_t * cmd, size_t cmd_size, const uint8_t * param, + size_t param_size); + +/** + * Prototype of a platform-dependent callback to transfer pixel data to the LCD controller. + * @param disp display object + * @param cmd command buffer (can handle 16 bit commands as well) + * @param cmd_size number of bytes of the command + * @param param parameter buffer + * @param param_size number of bytes of the parameters + */ +typedef void (*lv_lcd_send_color_cb_t)(lv_display_t * disp, const uint8_t * cmd, size_t cmd_size, uint8_t * param, + size_t param_size); + +/** + * Generic MIPI compatible LCD driver + */ +typedef struct { + lv_display_t * disp; /* the associated LVGL display object */ + lv_lcd_send_cmd_cb_t send_cmd; /* platform-specific implementation to send a command to the LCD controller */ + lv_lcd_send_color_cb_t send_color; /* platform-specific implementation to send pixel data to the LCD controller */ + uint16_t x_gap; /* x offset of the (0,0) pixel in VRAM */ + uint16_t y_gap; /* y offset of the (0,0) pixel in VRAM */ + uint8_t madctl_reg; /* current value of MADCTL register */ + uint8_t colmod_reg; /* current value of COLMOD register */ + bool mirror_x; + bool mirror_y; + bool swap_xy; +} lv_lcd_generic_mipi_driver_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a MIPI DCS compatible LCD display + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer). + * `lv_display_flush_ready` must be called after the transfer has finished. + * @return pointer to the created display + */ +lv_display_t * lv_lcd_generic_mipi_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_lcd_send_cmd_cb_t send_cmd_cb, lv_lcd_send_color_cb_t send_color_cb); + +/** + * Set gap, i.e., the offset of the (0,0) pixel in the VRAM + * @param disp display object + * @param x x offset + * @param y y offset + */ +void lv_lcd_generic_mipi_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); + +/** + * Set color inversion + * @param disp display object + * @param invert false: normal, true: invert + */ +void lv_lcd_generic_mipi_set_invert(lv_display_t * disp, bool invert); + +/** + * Set address mode + * @param disp display object + * @param mirror_x horizontal mirror (false: normal, true: mirrored) + * @param mirror_y vertical mirror (false: normal, true: mirrored) + * @param swap_xy swap axes (false: normal, true: swap) + * @param bgr RGB/BGR order (false: RGB, true: BGR) + */ +void lv_lcd_generic_mipi_set_address_mode(lv_display_t * disp, bool mirror_x, bool mirror_y, bool swap_xy, bool bgr); + +/** + * Set gamma curve + * @param disp display object + * @param gamma gamma curve + */ +void lv_lcd_generic_mipi_set_gamma_curve(lv_display_t * disp, uint8_t gamma); + +/** + * Send list of commands. + * @param disp display object + * @param cmd_list controller and panel-specific commands + */ +void lv_lcd_generic_mipi_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); + +/********************** + * OTHERS + **********************/ + +/********************** + * MACROS + **********************/ + + +#endif /*LV_USE_GENERIC_MIPI*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LCD_GENERIC_MIPI_H*/ diff --git a/include/lvgl/drivers/display/lv_linux_drm.h b/include/lvgl/drivers/display/lv_linux_drm.h new file mode 100644 index 0000000000..c55c2acd28 --- /dev/null +++ b/include/lvgl/drivers/display/lv_linux_drm.h @@ -0,0 +1,131 @@ +/** + * @file lv_linux_drm.h + * + */ + +#ifndef LV_LINUX_DRM_H +#define LV_LINUX_DRM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" + +#if LV_USE_LINUX_DRM +#include + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef drmModeModeInfo lv_linux_drm_mode_t; + +/** + * Callback function type for selecting a DRM display mode + * @param disp pointer to the display object + * @param modes array of available DRM modes + * @param mode_count number of modes in the array + * @return index of the selected mode from the modes array + */ +typedef size_t (*lv_linux_drm_select_mode_cb_t)(lv_display_t * disp, + const lv_linux_drm_mode_t * modes, + size_t mode_count); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Create a new Linux DRM display + * + * Creates and initializes a new LVGL display using the Linux DRM (Direct Rendering Manager) + * subsystem for hardware-accelerated graphics output. + * + * @return Pointer to the created display object, or NULL on failure + */ +lv_display_t * lv_linux_drm_create(void); + +/** + * @brief Configure the DRM device file and connector for a display + * + * Sets the DRM device file path and connector ID to use for the specified display. + * The DRM device file is typically located at /dev/dri/cardN where N is the card number. + * The connector ID specifies which physical output (HDMI, VGA, etc.) to use. + * + * @param disp Pointer to the display object created with lv_linux_drm_create() + * @param file Path to the DRM device file (e.g., "/dev/dri/card0") + * @param connector_id ID of the DRM connector to use, or -1 to auto-select the first available + * @return LV_RESULT_OK if the initialization succeeded or LV_RESULT_INVALID if it failed + */ +lv_result_t lv_linux_drm_set_file(lv_display_t * disp, const char * file, int64_t connector_id); + +/** + * @brief Automatically find a suitable DRM device path + * + * Scans the system for available DRM devices and returns the path to a suitable + * device file that can be used with lv_linux_drm_set_file(). + * + * @return Dynamically allocated string containing the device path (must be freed with lv_free()), + * or NULL if no suitable device is found + */ +char * lv_linux_drm_find_device_path(void); + +/** + * Set a callback function for custom DRM mode selection to override the default mode selection behavior + * + * The default mode selection behavior is selecting the native mode + * + * @param disp pointer to the display object + * @param callback function to be called when a display mode needs to be selected, + * or NULL to use the default mode selection behavior + */ +void lv_linux_drm_set_mode_cb(lv_display_t * disp, lv_linux_drm_select_mode_cb_t callback); + +/** + * Get the horizontal resolution of a DRM mode + * @param mode pointer to the DRM mode object + * @return horizontal resolution in pixels, or 0 if mode is invalid + */ +int32_t lv_linux_drm_mode_get_horizontal_resolution(const lv_linux_drm_mode_t * mode); + +/** + * Get the vertical resolution of a DRM mode + * @param mode pointer to the DRM mode object + * @return vertical resolution in pixels, or 0 if mode is invalid + */ +int32_t lv_linux_drm_mode_get_vertical_resolution(const lv_linux_drm_mode_t * mode); + +/** + * Get the refresh rate of a DRM mode + * @param mode pointer to the DRM mode object + * @return refresh rate in Hz, or 0 if mode is invalid + */ +int32_t lv_linux_drm_mode_get_refresh_rate(const lv_linux_drm_mode_t * mode); + +/** + * Check if a DRM mode is the preferred mode for the display + * @param mode pointer to the DRM mode object + * @return true if this is the preferred/native mode, false otherwise + */ +bool lv_linux_drm_mode_is_preferred(const lv_linux_drm_mode_t * mode); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_LINUX_DRM */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_LINUX_DRM_H */ diff --git a/include/lvgl/drivers/display/lv_linux_fbdev.h b/include/lvgl/drivers/display/lv_linux_fbdev.h new file mode 100644 index 0000000000..3361e894b1 --- /dev/null +++ b/include/lvgl/drivers/display/lv_linux_fbdev.h @@ -0,0 +1,52 @@ +/** + * @file lv_linux_fbdev.h + * + */ + +#ifndef LV_LINUX_FBDEV_H +#define LV_LINUX_FBDEV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" + +#if LV_USE_LINUX_FBDEV + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ +lv_display_t * lv_linux_fbdev_create(void); + +lv_result_t lv_linux_fbdev_set_file(lv_display_t * disp, const char * file); + +/** + * Force the display to be refreshed on every change. + * Expected to be used with LV_DISPLAY_RENDER_MODE_DIRECT or LV_DISPLAY_RENDER_MODE_FULL. + */ +void lv_linux_fbdev_set_force_refresh(lv_display_t * disp, bool enabled); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_LINUX_FBDEV */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_LINUX_FBDEV_H */ diff --git a/include/lvgl/drivers/display/lv_lovyan_gfx.h b/include/lvgl/drivers/display/lv_lovyan_gfx.h new file mode 100644 index 0000000000..e1052d4bd5 --- /dev/null +++ b/include/lvgl/drivers/display/lv_lovyan_gfx.h @@ -0,0 +1,45 @@ +/** + * @file lv_lovyan_gfx.h + * + */ + +#ifndef LV_LOVYAN_GFX_H +#define LV_LOVYAN_GFX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../display/lv_display.h" +#include "../../indev/lv_indev.h" + +#if LV_USE_LOVYAN_GFX + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ +lv_display_t * lv_lovyan_gfx_create(uint32_t hor_res, uint32_t ver_res, void * buf, uint32_t buf_size_bytes, + bool touch); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_LOVYAN_GFX */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_LOVYAN_GFX_H */ diff --git a/include/lvgl/drivers/display/lv_nv3007.h b/include/lvgl/drivers/display/lv_nv3007.h new file mode 100644 index 0000000000..79bcb873ad --- /dev/null +++ b/include/lvgl/drivers/display/lv_nv3007.h @@ -0,0 +1,94 @@ +/** + * @file lv_nv3007.h + * + * This driver is just a wrapper around the generic MIPI compatible LCD controller driver + * + */ + +#ifndef LV_NV3007_H +#define LV_NV3007_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_lcd_generic_mipi.h" + +#if LV_USE_NV3007 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef lv_lcd_send_cmd_cb_t lv_nv3007_send_cmd_cb_t; +typedef lv_lcd_send_color_cb_t lv_nv3007_send_color_cb_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an LCD display with NV3007 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ +lv_display_t * lv_nv3007_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_nv3007_send_cmd_cb_t send_cmd_cb, lv_nv3007_send_color_cb_t send_color_cb); + +/** + * Set gap, i.e., the offset of the (0,0) pixel in the VRAM + * @param disp display object + * @param x x offset + * @param y y offset + */ +void lv_nv3007_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); + +/** + * Set color inversion + * @param disp display object + * @param invert false: normal, true: invert + */ +void lv_nv3007_set_invert(lv_display_t * disp, bool invert); + +/** + * Set gamma curve + * @param disp display object + * @param gamma gamma curve + */ +void lv_nv3007_set_gamma_curve(lv_display_t * disp, uint8_t gamma); + +/** + * Send list of commands. + * @param disp display object + * @param cmd_list controller and panel-specific commands + */ +void lv_nv3007_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); + +/********************** + * OTHERS + **********************/ + +/********************** + * MACROS + **********************/ + + +#endif /*LV_USE_NV3007*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_NV3007_H*/ diff --git a/include/lvgl/drivers/display/lv_nxp_elcdif.h b/include/lvgl/drivers/display/lv_nxp_elcdif.h new file mode 100644 index 0000000000..968f68d593 --- /dev/null +++ b/include/lvgl/drivers/display/lv_nxp_elcdif.h @@ -0,0 +1,83 @@ +/** + * @file lv_nxp_elcdif.h + * Driver for NXP's ELCD + */ + +#ifndef LV_NXP_ELCDIF_H +#define LV_NXP_ELCDIF_H + +#include "../../display/lv_display.h" + +#if LV_USE_NXP_ELCDIF + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "fsl_elcdif.h" +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Attach LVGL to ELCDIF using DIRECT rendering mode. + * ELCDIF should be already initialized. + * @param base The NXP eLCD controller base address + * @param config NXP eLCD config object + * @param frame_buffer1 pointer the first frame buffers + * @param frame_buffer2 pointer the second frame buffers + * @param buf_size size of a buffer in bytes (must be at least as large as the screen) + * @return a display object initialized and registered on the LVGL runtime + */ +lv_display_t * lv_nxp_display_elcdif_create_direct(LCDIF_Type * base, const elcdif_rgb_mode_config_t * config, + void * frame_buffer1, + void * frame_buffer2, size_t buf_size); + + +/** +* Attach LVGL to ELCDIF using PARTIAL rendering mode. +* ELCDIF should be already initialized. +* @param base The NXP eLCD controller base address +* @param config NXP eLCD config object +* @param frame_buffer1 pointer the first frame buffers +* @param frame_buffer2 pointer the second frame buffers +* @param buf_size size of a buffer in bytes +* @return a display object initialized and registered on the LVGL runtime +*/ +lv_display_t * lv_nxp_display_elcdif_create_partial(LCDIF_Type * base, const elcdif_rgb_mode_config_t * config, + void * frame_buffer1, + void * frame_buffer2, size_t buf_size); + +/** + * Call this function on the LCD Interrupt Service Routine + * It tells to LVGL what to do when a framebuffer is transmitted + * to the LCD panel + * @param disp The display instance that contains the eLCD related data + * + * @note: the parameter disp is typically the return value after + * `lv_nxp_display_elcdif_create_direct` has been successfully executed + */ +void lv_nxp_display_elcdif_event_handler(const lv_display_t * disp); +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_USE_NXP_ELCDIF*/ + +#endif /* LV_NXP_ELCDIF_H */ diff --git a/include/lvgl/drivers/display/lv_renesas_glcdc.h b/include/lvgl/drivers/display/lv_renesas_glcdc.h new file mode 100644 index 0000000000..0c65813931 --- /dev/null +++ b/include/lvgl/drivers/display/lv_renesas_glcdc.h @@ -0,0 +1,57 @@ +/** + * @file lv_renesas_glcdc.h + * + */ + +#ifndef LV_RENESAS_GLCDC_H +#define LV_RENESAS_GLCDC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../display/lv_display.h" + +#if LV_USE_RENESAS_GLCDC + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a display using Renesas' GLCDC peripheral in DIRECT render mode + * @return pointer to the created display + */ +lv_display_t * lv_renesas_glcdc_direct_create(void); + +/** + * Create a display using Renesas' GLCDC peripheral in PARTIAL render mode + * @param buf1 first buffer + * @param buf2 second buffer (can be `NULL`) + * @param buf_size buffer size in byte + * @return pointer to the created display + */ +lv_display_t * lv_renesas_glcdc_partial_create(void * buf1, void * buf2, size_t buf_size); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_RENESAS_GLCDC */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_RENESAS_GLCDC_H */ diff --git a/include/lvgl/drivers/display/lv_st7735.h b/include/lvgl/drivers/display/lv_st7735.h new file mode 100644 index 0000000000..667c2af913 --- /dev/null +++ b/include/lvgl/drivers/display/lv_st7735.h @@ -0,0 +1,93 @@ +/** + * @file lv_st7735.h + * + * This driver is just a wrapper around the generic MIPI compatible LCD controller driver + * + */ + +#ifndef LV_ST7735_H +#define LV_ST7735_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_lcd_generic_mipi.h" + +#if LV_USE_ST7735 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef lv_lcd_send_cmd_cb_t lv_st7735_send_cmd_cb_t; +typedef lv_lcd_send_color_cb_t lv_st7735_send_color_cb_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an LCD display with ST7735 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ +lv_display_t * lv_st7735_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_st7735_send_cmd_cb_t send_cmd_cb, lv_st7735_send_color_cb_t send_color_cb); + +/** + * Set gap, i.e., the offset of the (0,0) pixel in the VRAM + * @param disp display object + * @param x x offset + * @param y y offset + */ +void lv_st7735_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); + +/** + * Set color inversion + * @param disp display object + * @param invert false: normal, true: invert + */ +void lv_st7735_set_invert(lv_display_t * disp, bool invert); + +/** + * Set gamma curve + * @param disp display object + * @param gamma gamma curve + */ +void lv_st7735_set_gamma_curve(lv_display_t * disp, uint8_t gamma); + +/** + * Send list of commands. + * @param disp display object + * @param cmd_list controller and panel-specific commands + */ +void lv_st7735_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); + +/********************** + * OTHERS + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_ST7735*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ST7735_H*/ diff --git a/include/lvgl/drivers/display/lv_st7789.h b/include/lvgl/drivers/display/lv_st7789.h new file mode 100644 index 0000000000..b0588b51a1 --- /dev/null +++ b/include/lvgl/drivers/display/lv_st7789.h @@ -0,0 +1,94 @@ +/** + * @file lv_st7789.h + * + * This driver is just a wrapper around the generic MIPI compatible LCD controller driver + * + */ + +#ifndef LV_ST7789_H +#define LV_ST7789_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_lcd_generic_mipi.h" + +#if LV_USE_ST7789 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef lv_lcd_send_cmd_cb_t lv_st7789_send_cmd_cb_t; +typedef lv_lcd_send_color_cb_t lv_st7789_send_color_cb_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an LCD display with ST7789 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ +lv_display_t * lv_st7789_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_st7789_send_cmd_cb_t send_cmd_cb, lv_st7789_send_color_cb_t send_color_cb); + +/** + * Set gap, i.e., the offset of the (0,0) pixel in the VRAM + * @param disp display object + * @param x x offset + * @param y y offset + */ +void lv_st7789_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); + +/** + * Set color inversion + * @param disp display object + * @param invert false: normal, true: invert + */ +void lv_st7789_set_invert(lv_display_t * disp, bool invert); + +/** + * Set gamma curve + * @param disp display object + * @param gamma gamma curve + */ +void lv_st7789_set_gamma_curve(lv_display_t * disp, uint8_t gamma); + +/** + * Send list of commands. + * @param disp display object + * @param cmd_list controller and panel-specific commands + */ +void lv_st7789_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); + +/********************** + * OTHERS + **********************/ + +/********************** + * MACROS + **********************/ + + +#endif /*LV_USE_ST7789*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ST7789_H*/ diff --git a/include/lvgl/drivers/display/lv_st7796.h b/include/lvgl/drivers/display/lv_st7796.h new file mode 100644 index 0000000000..e0922e74b9 --- /dev/null +++ b/include/lvgl/drivers/display/lv_st7796.h @@ -0,0 +1,93 @@ +/** + * @file lv_st7796.h + * + * This driver is just a wrapper around the generic MIPI compatible LCD controller driver + * + */ + +#ifndef LV_ST7796_H +#define LV_ST7796_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_lcd_generic_mipi.h" + +#if LV_USE_ST7796 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef lv_lcd_send_cmd_cb_t lv_st7796_send_cmd_cb_t; +typedef lv_lcd_send_color_cb_t lv_st7796_send_color_cb_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an LCD display with ST7796 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ +lv_display_t * lv_st7796_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_st7796_send_cmd_cb_t send_cmd_cb, lv_st7796_send_color_cb_t send_color_cb); + +/** + * Set gap, i.e., the offset of the (0,0) pixel in the VRAM + * @param disp display object + * @param x x offset + * @param y y offset + */ +void lv_st7796_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); + +/** + * Set color inversion + * @param disp display object + * @param invert false: normal, true: invert + */ +void lv_st7796_set_invert(lv_display_t * disp, bool invert); + +/** + * Set gamma curve + * @param disp display object + * @param gamma gamma curve + */ +void lv_st7796_set_gamma_curve(lv_display_t * disp, uint8_t gamma); + +/** + * Send list of commands. + * @param disp display object + * @param cmd_list controller and panel-specific commands + */ +void lv_st7796_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); + +/********************** + * OTHERS + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_ST7796*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ST7796_H*/ diff --git a/include/lvgl/drivers/display/lv_st_ltdc.h b/include/lvgl/drivers/display/lv_st_ltdc.h new file mode 100644 index 0000000000..a9a8e1703e --- /dev/null +++ b/include/lvgl/drivers/display/lv_st_ltdc.h @@ -0,0 +1,65 @@ +/** + * @file lv_st_ltdc.h + * + */ + +#ifndef LV_ST_LTDC_H +#define LV_ST_LTDC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" +#if LV_USE_ST_LTDC + +#include "../../display/lv_display.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a direct render mode display bound to a LTDC layer. + * @param fb_adr_1 The LTDC layer's framebuffer memory address. + * @param fb_adr_2 An additional framebuffer-sized buffer to use for double buffering, or `NULL`. + * @param layer_idx The LTDC layer number to bind the display to. Typically 0 or 1. + * @return The display. + */ +lv_display_t * lv_st_ltdc_create_direct(void * fb_adr_1, void * fb_adr_2, uint32_t layer_idx); + +/** + * Create a partial render mode display bound to a LTDC layer. The layer's framebuffer is flushed to internally. + * Enable `LV_ST_LTDC_USE_DMA2D_FLUSH` for parallel flushing. + * @param render_buf_1 A render buffer. + * @param render_buf_2 An additional render buffer for double-buffering, or `NULL`. + * @param buf_size The size of the buffer(s) in bytes. + * @param layer_idx The LTDC layer number to bind the display to. Typically 0 or 1. + * @return The display. + */ +lv_display_t * lv_st_ltdc_create_partial(void * render_buf_1, void * render_buf_2, uint32_t buf_size, + uint32_t layer_idx); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_ST_LTDC*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ST_LTDC_H*/ diff --git a/include/lvgl/drivers/display/lv_tft_espi.h b/include/lvgl/drivers/display/lv_tft_espi.h new file mode 100644 index 0000000000..68b4919eea --- /dev/null +++ b/include/lvgl/drivers/display/lv_tft_espi.h @@ -0,0 +1,43 @@ +/** + * @file lv_tft_espi.h + * + */ + +#ifndef LV_TFT_ESPI_H +#define LV_TFT_ESPI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../display/lv_display.h" + +#if LV_USE_TFT_ESPI + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ +lv_display_t * lv_tft_espi_create(uint32_t hor_res, uint32_t ver_res, void * buf, uint32_t buf_size_bytes); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_TFT_ESPI */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_TFT_ESPI_H */ diff --git a/include/lvgl/drivers/ffmpeg/lv_ffmpeg.h b/include/lvgl/drivers/ffmpeg/lv_ffmpeg.h new file mode 100644 index 0000000000..1d56354141 --- /dev/null +++ b/include/lvgl/drivers/ffmpeg/lv_ffmpeg.h @@ -0,0 +1,110 @@ +/** + * @file lv_ffmpeg.h + * + */ +#ifndef LV_FFMPEG_H +#define LV_FFMPEG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../config/lv_conf_internal.h" + +#if LV_USE_FFMPEG + +#include "../../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +struct ffmpeg_context_s; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_ffmpeg_player_class; + +typedef enum { + LV_FFMPEG_PLAYER_CMD_START, + LV_FFMPEG_PLAYER_CMD_STOP, + LV_FFMPEG_PLAYER_CMD_PAUSE, + LV_FFMPEG_PLAYER_CMD_RESUME, + LV_FFMPEG_PLAYER_CMD_LAST +} lv_ffmpeg_player_cmd_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Register FFMPEG image decoder + */ +void lv_ffmpeg_init(void); + +/** + * De-initialize FFMPEG image decoder + */ +void lv_ffmpeg_deinit(void); + +/** + * Get the number of frames contained in the file + * @param path image or video file name + * @return Number of frames, less than 0 means failed + */ +int lv_ffmpeg_get_frame_num(const char * path); + +/** + * Create ffmpeg_player object + * @param parent pointer to an object, it will be the parent of the new player + * @return pointer to the created ffmpeg_player + */ +lv_obj_t * lv_ffmpeg_player_create(lv_obj_t * parent); + +/** + * Set the path of the file to be played. + * @param obj pointer to a ffmpeg_player object + * @param path video file path + * @return LV_RESULT_OK: no error; LV_RESULT_INVALID: can't get the info. + */ +lv_result_t lv_ffmpeg_player_set_src(lv_obj_t * obj, const char * path); + +/** + * Set command control video player + * @param obj pointer to a ffmpeg_player object + * @param cmd control commands + */ +void lv_ffmpeg_player_set_cmd(lv_obj_t * obj, lv_ffmpeg_player_cmd_t cmd); + +/** + * Set the video to automatically replay + * @param obj pointer to a ffmpeg_player object + * @param en true: enable the auto restart + */ +void lv_ffmpeg_player_set_auto_restart(lv_obj_t * obj, bool en); + +/** + * Set the video decoder + * @param obj pointer to a ffmpeg_player object + * @param decoder_name decoder name + */ +void lv_ffmpeg_player_set_decoder(lv_obj_t * obj, const char * decoder_name); +/*===================== + * Other functions + *====================*/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_FFMPEG*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FFMPEG_H*/ diff --git a/include/lvgl/drivers/indev/lv_evdev.h b/include/lvgl/drivers/indev/lv_evdev.h new file mode 100644 index 0000000000..ed00bb1e65 --- /dev/null +++ b/include/lvgl/drivers/indev/lv_evdev.h @@ -0,0 +1,106 @@ +/** + * @file lv_evdev.h + * + */ + +#ifndef LV_EVDEV_H +#define LV_EVDEV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../indev/lv_indev.h" + +#if LV_USE_EVDEV + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_EVDEV_TYPE_REL, /**< mice */ + LV_EVDEV_TYPE_ABS, /**< touch screens, mousepads */ + LV_EVDEV_TYPE_KEY /**< keyboards, keypads, buttons */ +} lv_evdev_type_t; + +/** + * @param indev the indev created for the newly discovered evdev + * @param type the type of the evdev + * @param user_data a custom parameter + */ +typedef void (*lv_evdev_discovery_cb_t)(lv_indev_t * indev, lv_evdev_type_t type, void * user_data); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create evdev input device from a given path. + * @param type LV_INDEV_TYPE_POINTER or LV_INDEV_TYPE_KEYPAD + * @param dev_path device path, e.g., /dev/input/event0 + * @return pointer to input device or NULL if opening failed + */ +lv_indev_t * lv_evdev_create(lv_indev_type_t indev_type, const char * dev_path); + +/** + * Create evdev input device, taking ownership of the given file descriptor. + * @param type LV_INDEV_TYPE_POINTER or LV_INDEV_TYPE_KEYPAD + * @param fd file descriptor of the evdev device + * @return pointer to input device or NULL if opening failed + */ +lv_indev_t * lv_evdev_create_fd(lv_indev_type_t indev_type, int fd); + +/** + * Begin automatically creating evdev indevs for all new and existing + * evdev devices found in /dev/input/ + * @param cb function to call when a new evdev indev is discovered, or `NULL` + * @param user_data parameter to pass to the callback + * @return the success or failure status. It will fail if it's + * already running or resources could not be initialized. + */ +lv_result_t lv_evdev_discovery_start(lv_evdev_discovery_cb_t cb, void * user_data); + +/** + * Stop automatically creating evdev indevs. Safe to call from the + * discovery callback. + * @return the success or failure status. It will fail if it's already running. + */ +lv_result_t lv_evdev_discovery_stop(void); + +/** + * Set whether coordinates of pointer device should be swapped. Defaults to + * false. + * @param indev evdev input device + * @param swap_axes whether to swap x and y axes + */ +void lv_evdev_set_swap_axes(lv_indev_t * indev, bool swap_axes); + +/** + * Configure a coordinate transformation for pointer devices. Applied after + * axis swap, if any. Defaults to apply no transformation. + * @param indev evdev input device + * @param min_x pointer coordinate mapped to min x of display + * @param min_y pointer coordinate mapped to min y of display + * @param max_x pointer coordinate mapped to max x of display + * @param max_y pointer coordinate mapped to max y of display + */ +void lv_evdev_set_calibration(lv_indev_t * indev, int min_x, int min_y, int max_x, int max_y); + +/** + * Remove evdev input device. + * @param indev evdev input device to close and free + */ +void lv_evdev_delete(lv_indev_t * indev); + +#endif /*LV_USE_EVDEV*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_EVDEV_H*/ diff --git a/include/lvgl/drivers/indev/lv_libinput.h b/include/lvgl/drivers/indev/lv_libinput.h new file mode 100644 index 0000000000..ce19a33b5c --- /dev/null +++ b/include/lvgl/drivers/indev/lv_libinput.h @@ -0,0 +1,101 @@ +/** + * @file lv_libinput.h + * + */ + +#ifndef LV_LIBINPUT_H +#define LV_LIBINPUT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../indev/lv_indev.h" + +#if LV_USE_LIBINPUT + +#include +#include + +#if LV_LIBINPUT_XKB +#include "lv_xkb.h" +#endif /* LV_LIBINPUT_XKB */ + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_LIBINPUT_CAPABILITY_NONE = 0, + LV_LIBINPUT_CAPABILITY_KEYBOARD = 1U << 0, + LV_LIBINPUT_CAPABILITY_POINTER = 1U << 1, + LV_LIBINPUT_CAPABILITY_TOUCH = 1U << 2 +} lv_libinput_capability; + +struct libinput_device; + +#define LV_LIBINPUT_MAX_EVENTS 32 + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Determine the capabilities of a specific libinput device. + * @param device the libinput device to query + * @return the supported input capabilities + */ +lv_libinput_capability lv_libinput_query_capability(struct libinput_device * device); + +/** + * Find connected input device with specific capabilities + * @param capabilities required device capabilities + * @param force_rescan erase the device cache (if any) and rescan the file system for available devices + * @return device node path (e.g. /dev/input/event0) for the first matching device or NULL if no device was found. + * The pointer is safe to use until the next forceful device search. + */ +char * lv_libinput_find_dev(lv_libinput_capability capabilities, bool force_rescan); + +/** + * Find connected input devices with specific capabilities + * @param capabilities required device capabilities + * @param devices pre-allocated array to store the found device node paths (e.g. /dev/input/event0). The pointers are + * safe to use until the next forceful device search. + * @param count maximum number of devices to find (the devices array should be at least this long) + * @param force_rescan erase the device cache (if any) and rescan the file system for available devices + * @return number of devices that were found + */ +size_t lv_libinput_find_devs(lv_libinput_capability capabilities, char ** found, size_t count, bool force_rescan); + +/** + * Create a new libinput input device + * @param type LV_INDEV_TYPE_POINTER or LV_INDEV_TYPE_KEYPAD + * @param dev_path device path, e.g. /dev/input/event0 + * @return pointer to input device or NULL if opening failed + */ +lv_indev_t * lv_libinput_create(lv_indev_type_t indev_type, const char * dev_path); + +/** + * Delete a libinput input device + * @param indev pointer to input device + */ +void lv_libinput_delete(lv_indev_t * indev); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_LIBINPUT */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_LIBINPUT_H */ diff --git a/include/lvgl/drivers/indev/lv_xkb.h b/include/lvgl/drivers/indev/lv_xkb.h new file mode 100644 index 0000000000..4b108e4de3 --- /dev/null +++ b/include/lvgl/drivers/indev/lv_xkb.h @@ -0,0 +1,64 @@ +/** + * @file lv_xkb.h + * + */ + +#ifndef LV_XKB_H +#define LV_XKB_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" + +#if defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB + +#include "../../lv_types.h" +#include +#include + +/********************* + * DEFINES + *********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialise an XKB descriptor. + * @return true if the initialisation was successful + */ +bool lv_xkb_init(lv_xkb_t * dsc, struct xkb_rule_names names); + +/** + * De-initialise an XKB descriptor. + * @param dsc Pointer to descriptor + */ +void lv_xkb_deinit(lv_xkb_t * dsc); + +/** + * Process an evdev scancode using a specific XKB descriptor. + * @param state XKB descriptor to use + * @param scancode evdev scancode to process + * @param down true if the key was pressed, false if it was releases + * @return the (first) UTF-8 character produced by the event or 0 if no output was produced + */ +uint32_t lv_xkb_process_key(lv_xkb_t * dsc, uint32_t scancode, bool down); + +/********************** + * MACROS + **********************/ + +#endif /* defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_XKB_H */ diff --git a/include/lvgl/drivers/nuttx/lv_nuttx_entry.h b/include/lvgl/drivers/nuttx/lv_nuttx_entry.h new file mode 100644 index 0000000000..f6d8c702ed --- /dev/null +++ b/include/lvgl/drivers/nuttx/lv_nuttx_entry.h @@ -0,0 +1,116 @@ +/** + * @file lv_nuttx_entry.h + * + */ + +/********************* + * INCLUDES + *********************/ + +#ifndef LV_NUTTX_ENTRY_H +#define LV_NUTTX_ENTRY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" +#include "../../display/lv_display.h" +#include "../../indev/lv_indev.h" + +#if LV_USE_NUTTX + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef struct { + const char * fb_path; + const char * input_path; + const char * utouch_path; + const char * mouse_path; + const char * trace_path; +} lv_nuttx_dsc_t; + +typedef struct { + lv_display_t * disp; + lv_indev_t * indev; + lv_indev_t * utouch_indev; + lv_indev_t * mouse_indev; +} lv_nuttx_result_t; + +typedef struct _lv_nuttx_ctx_t { + void * image_cache; + int trace_fd; +} lv_nuttx_ctx_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the lv_nuttx_dsc_t structure with default values for the NuttX port of LVGL. + * @param dsc Pointer to the lv_nuttx_dsc_t structure to be initialized. + */ +void lv_nuttx_dsc_init(lv_nuttx_dsc_t * dsc); + +/** + * Initialize the LVGL display driver for NuttX using the provided configuration information. + * @param dsc Pointer to the lv_nuttx_dsc_t structure containing the configuration information for the display driver. + * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler. + */ +void lv_nuttx_init(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result); + +/** + * Deinitialize the LVGL display driver for NuttX. + * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler. + */ +void lv_nuttx_deinit(lv_nuttx_result_t * result); + +#if LV_USE_NUTTX_CUSTOM_INIT +/** + * Initialize the LVGL display driver for NuttX using the provided custom configuration information. + * @param dsc Pointer to the lv_nuttx_dsc_t structure containing the custom configuration for the display driver. + * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler. + */ +void lv_nuttx_init_custom(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result); + +/** + * Deinitialize the LVGL display driver for NuttX using the provided custom configuration information. + * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler. + */ +void lv_nuttx_deinit_custom(lv_nuttx_result_t * result); +#endif /* LV_USE_NUTTX_CUSTOM_INIT */ + +/** + * Call `lv_timer_handler()` (LVGL's super loop) in an endless loop. + * If LV_USE_NUTTX_LIBUV is enabled an UV timer will be created, + * else `lv_timer_handler()` will be called in a loop with some sleep. + * @param result pointer to a variable initialized by `lv_nuttx_init()` or `lv_nuttx_init_custom()` + */ +void lv_nuttx_run(lv_nuttx_result_t * result); + +/** + * Get the idle percentage of the system. + * @return The idle percentage of the system. + */ +uint32_t lv_nuttx_get_idle(void); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_NUTTX*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_NUTTX_ENTRY_H */ diff --git a/include/lvgl/drivers/nuttx/lv_nuttx_fbdev.h b/include/lvgl/drivers/nuttx/lv_nuttx_fbdev.h new file mode 100644 index 0000000000..4310aa9c1d --- /dev/null +++ b/include/lvgl/drivers/nuttx/lv_nuttx_fbdev.h @@ -0,0 +1,55 @@ +/** + * @file lv_nuttx_fbdev.h + * + */ + +#ifndef LV_NUTTX_FBDEV_H +#define LV_NUTTX_FBDEV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" + +#if LV_USE_NUTTX + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a new display with NuttX backend. + */ +lv_display_t * lv_nuttx_fbdev_create(void); + +/** + * Initialize display with specified framebuffer device + * @param disp pointer to display with NuttX backend + * @param file the name of framebuffer device + */ +int lv_nuttx_fbdev_set_file(lv_display_t * disp, const char * file); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_NUTTX */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_NUTTX_FBDEV_H */ diff --git a/include/lvgl/drivers/nuttx/lv_nuttx_lcd.h b/include/lvgl/drivers/nuttx/lv_nuttx_lcd.h new file mode 100644 index 0000000000..16e24ff8f1 --- /dev/null +++ b/include/lvgl/drivers/nuttx/lv_nuttx_lcd.h @@ -0,0 +1,49 @@ +/** + * @file lv_nuttx_lcd.h + * + */ + +#ifndef LV_NUTTX_LCD_H +#define LV_NUTTX_LCD_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" + +#if LV_USE_NUTTX + +#if LV_USE_NUTTX_LCD + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +lv_display_t * lv_nuttx_lcd_create(const char * dev_path); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_NUTTX_LCD */ + +#endif /* LV_USE_NUTTX*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_NUTTX_LCD_H */ diff --git a/include/lvgl/drivers/nuttx/lv_nuttx_libuv.h b/include/lvgl/drivers/nuttx/lv_nuttx_libuv.h new file mode 100644 index 0000000000..0799e67b12 --- /dev/null +++ b/include/lvgl/drivers/nuttx/lv_nuttx_libuv.h @@ -0,0 +1,66 @@ +/** + * @file lv_nuttx_libuv.h + * + */ + +#ifndef LV_NUTTX_LIBUV_H +#define LV_NUTTX_LIBUV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" +#include "../../indev/lv_indev.h" + +#if LV_USE_NUTTX + +#if LV_USE_NUTTX_LIBUV + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + void * loop; + lv_display_t * disp; + lv_indev_t * indev; +} lv_nuttx_uv_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the uv_loop using the provided configuration information. + * @param uv_info Pointer to the lv_nuttx_uv_t structure to be initialized. + */ +void * lv_nuttx_uv_init(lv_nuttx_uv_t * uv_info); + +/** + * Deinitialize the uv_loop configuration for NuttX porting layer. + * @param data Pointer to user data. + */ +void lv_nuttx_uv_deinit(void ** data); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_NUTTX_LIBUV*/ + +#endif /*LV_USE_NUTTX*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_NUTTX_LIBUV_H*/ diff --git a/include/lvgl/drivers/nuttx/lv_nuttx_touchscreen.h b/include/lvgl/drivers/nuttx/lv_nuttx_touchscreen.h new file mode 100644 index 0000000000..e0dd1f14f7 --- /dev/null +++ b/include/lvgl/drivers/nuttx/lv_nuttx_touchscreen.h @@ -0,0 +1,57 @@ +/** + * @file lv_nuttx_touchscreen.h + * + */ + +/********************* + * INCLUDES + *********************/ + +#ifndef LV_NUTTX_TOUCHSCREEN_H +#define LV_NUTTX_TOUCHSCREEN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../indev/lv_indev.h" + +#if LV_USE_NUTTX + +#if LV_USE_NUTTX_TOUCHSCREEN + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize indev with specified input device. + * @param dev_path path of input device + */ +lv_indev_t * lv_nuttx_touchscreen_create(const char * dev_path); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_NUTTX_TOUCHSCREEN */ + +#endif /* LV_USE_NUTTX*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_NUTTX_TOUCHSCREEN_H */ diff --git a/include/lvgl/drivers/opengles/lv_opengles_driver.h b/include/lvgl/drivers/opengles/lv_opengles_driver.h new file mode 100644 index 0000000000..6ed5e221db --- /dev/null +++ b/include/lvgl/drivers/opengles/lv_opengles_driver.h @@ -0,0 +1,108 @@ +/** + * @file lv_opengles_driver.h + * + */ + +#ifndef LV_OPENGLES_DRIVER_H +#define LV_OPENGLES_DRIVER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" +#if LV_USE_OPENGLES + +#include "../../core/lv_area.h" +#include "../../draw/lv_color.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize OpenGL + * @note it is not necessary to call this if you use `lv_opengles_glfw_window_create` + */ +void lv_opengles_init(void); + +/** + * Deinitialize OpenGL + * @note it is not necessary to call this if you use `lv_opengles_glfw_window_create` + */ +void lv_opengles_deinit(void); + +/** + * Render a texture using alternate blending mode for smoother translucent materials and correct anti-aliasing of glTF elements when using transparent background + * @param texture OpenGL texture ID + * @param texture_area the area in the window to render the texture in + * @param opa opacity to blend the texture with existing contents + * @param disp_w width of the window/framebuffer being rendered to + * @param disp_h height of the window/framebuffer being rendered to + * @param h_flip horizontal flip + * @param v_flip vertical flip + */ +void lv_opengles_render_texture(unsigned int texture, const lv_area_t * texture_area, lv_opa_t opa, int32_t disp_w, + int32_t disp_h, const lv_area_t * texture_clip_area, bool h_flip, bool v_flip); + +/** + * Render a display texture - Supports rotation - Switches red and blue channels + * @param display LVGL Texture display. Created with the `lv_opengles_texture` module + * @param h_flip horizontal flip + * @param v_flip vertical flip + */ +void lv_opengles_render_display_texture(lv_display_t * display, bool h_flip, bool v_flip); + +/** + * Render a fill + * @param color the color of the fill + * @param area the area in the window to render the fill + * @param opa opacity to blend the fill with existing contents + * @param disp_w width of the window/framebuffer being rendered to + * @param disp_h height of the window/framebuffer being rendered to + */ +void lv_opengles_render_fill(lv_color_t color, const lv_area_t * area, lv_opa_t opa, int32_t disp_w, int32_t disp_h); + +/** + * Clear the window/display + */ +void lv_opengles_render_clear(void); + +/** + * Set the OpenGL viewport + * @param x x position of the viewport + * @param y y position of the viewport + * @param w width of the viewport + * @param h height of the viewport + */ +void lv_opengles_viewport(int32_t x, int32_t y, int32_t w, int32_t h); + +/** + * Reinitialize OpenGL state after external GL operations (e.g., NanoVG) + * This rebinds VAO, VBO, IBO and resets vertex attributes + */ +void lv_opengles_reinit_state(void); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_OPENGLES */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_OPENGLES_DRIVER_H */ diff --git a/include/lvgl/drivers/opengles/lv_opengles_glfw.h b/include/lvgl/drivers/opengles/lv_opengles_glfw.h new file mode 100644 index 0000000000..3c546fb4ce --- /dev/null +++ b/include/lvgl/drivers/opengles/lv_opengles_glfw.h @@ -0,0 +1,88 @@ +/** + * @file lv_opengles_glfw.h + * + */ + +#ifndef LV_OPENGLES_GLFW_H +#define LV_OPENGLES_GLFW_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "../../config/lv_conf_internal.h" +#if LV_USE_GLFW + +#include "../../lv_types.h" + +/********************* + * INCLUDES + *********************/ + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a GLFW OpenGL window with no textures and initialize OpenGL + * @param hor_res width in pixels of the window + * @param ver_res height in pixels of the window + * @param use_mouse_indev send pointer indev input to LVGL display textures + * @return the new GLFW OpenGL window handle + */ +lv_opengles_window_t * lv_opengles_glfw_window_create(int32_t hor_res, int32_t ver_res, bool use_mouse_indev); + +/** + * Create a GLFW window with no textures and initialize OpenGL + * @param hor_res width in pixels of the window + * @param ver_res height in pixels of the window + * @param use_mouse_indev send pointer indev input to LVGL display textures + * @param h_flip Should the window contents be horizontally mirrored? + * @param v_flip Should the window contents be vertically mirrored? + * @param title The window title + * @return the new GLFW window handle + */ +lv_opengles_window_t * lv_opengles_glfw_window_create_ex(int32_t hor_res, int32_t ver_res, bool use_mouse_indev, + bool h_flip, bool v_flip, const char * title); + +/** + * Set the window's title text + * @param window GLFW window to configure + * @param new_title The new title text + */ +void lv_opengles_glfw_window_set_title(lv_opengles_window_t * window, const char * new_title); + +/** + * Set the horizontal / vertical flipping of a GLFW window + * @param window GLFW window to configure + * @param h_flip Should the window contents be horizontally mirrored? + * @param v_flip Should the window contents be vertically mirrored? + */ +void lv_opengles_glfw_window_set_flip(lv_opengles_window_t * window, bool h_flip, bool v_flip); + +/** + * Get the GLFW window handle for a GLFW lv_opengles_window_t + * @param window GLFW window to return the handle of + * @return the GLFW window handle + */ +void * lv_opengles_glfw_window_get_glfw_window(lv_opengles_window_t * window); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_GLFW*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OPENGLES_GLFW_H*/ diff --git a/include/lvgl/drivers/opengles/lv_opengles_texture.h b/include/lvgl/drivers/opengles/lv_opengles_texture.h new file mode 100644 index 0000000000..298f1474c1 --- /dev/null +++ b/include/lvgl/drivers/opengles/lv_opengles_texture.h @@ -0,0 +1,79 @@ +/** + * @file lv_opengles_texture.h + * + */ + +#ifndef LV_OPENGLES_TEXTURE_H +#define LV_OPENGLES_TEXTURE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" +#if LV_USE_OPENGLES + +#include "../../display/lv_display.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a display that flushes to an OpenGL texture + * If you already have a texture and want to bind it to the display, + * see `lv_opengles_texture_create_from_texture_id` + * @param w width in pixels of the texture + * @param h height in pixels of the texture + * @return the new display or NULL on failure + */ +lv_display_t * lv_opengles_texture_create(int32_t w, int32_t h); + +/** + * Create a display that flushes to the provided OpenGL texture + * If you don't have a texture to bind it to the display, + * see `lv_opengles_texture_create` + * @param w width in pixels of the texture + * @param h height in pixels of the texture + * @param texture_id the texture LVGL will render to + * @return the new display or NULL on failure + */ +lv_display_t * lv_opengles_texture_create_from_texture_id(int32_t w, int32_t h, unsigned int texture_id); + +/** + * Get the OpenGL texture ID of the display + * @param disp display + * @return texture ID + */ +unsigned int lv_opengles_texture_get_texture_id(lv_display_t * disp); + +/** + * Get the display of an OpenGL texture if it is associated with one + * @param texture_id OpenGL texture ID + * @return display or `NULL` if there no display with that texture ID + */ +lv_display_t * lv_opengles_texture_get_from_texture_id(unsigned int texture_id); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_OPENGLES */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OPENGLES_TEXTURE_H*/ diff --git a/include/lvgl/drivers/opengles/lv_opengles_window.h b/include/lvgl/drivers/opengles/lv_opengles_window.h new file mode 100644 index 0000000000..85e721ebaa --- /dev/null +++ b/include/lvgl/drivers/opengles/lv_opengles_window.h @@ -0,0 +1,102 @@ +/** + * @file lv_opengles_window.h + * + */ + +#ifndef LV_OPENGLES_WINDOW_H +#define LV_OPENGLES_WINDOW_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" +#if LV_USE_OPENGLES + +#include "../../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Delete an OpenGL window. If it is the last one, the process will exit + * @param window OpenGL window to delete + */ +void lv_opengles_window_delete(lv_opengles_window_t * window); + +/** + * Add a texture to the OpenGL window. It can be an LVGL display texture, or any OpenGL texture + * @param window OpenGL window + * @param texture_id OpenGL texture ID + * @param w width in pixels of the texture + * @param h height in pixels of the texture + * @return the new texture handle + */ +lv_opengles_window_texture_t * lv_opengles_window_add_texture(lv_opengles_window_t * window, unsigned int texture_id, + int32_t w, int32_t h); + +lv_display_t * lv_opengles_window_display_create(lv_opengles_window_t * window, int32_t w, int32_t h); + +lv_opengles_window_texture_t * lv_opengles_window_display_get_window_texture(lv_display_t * window_display); + +/** + * Remove a texture from its OpenGL window and delete it + * @param texture handle of an OpenGL window texture + */ +void lv_opengles_window_texture_remove(lv_opengles_window_texture_t * texture); + +/** + * Set the x position of a texture within its OpenGL window + * @param texture handle of an OpenGL window texture + * @param x new x position of the texture + */ +void lv_opengles_window_texture_set_x(lv_opengles_window_texture_t * texture, int32_t x); + +/** + * Set the y position of a texture within its OpenGL window + * @param texture handle of an OpenGL window texture + * @param y new y position of the texture + */ +void lv_opengles_window_texture_set_y(lv_opengles_window_texture_t * texture, int32_t y); + +/** + * Set the opacity of a texture in an OpenGL window + * @param texture handle of an OpenGL window texture + * @param opa new opacity of the texture + */ +void lv_opengles_window_texture_set_opa(lv_opengles_window_texture_t * texture, lv_opa_t opa); + +/** + * Get the mouse indev associated with a texture in an OpenGL window, if it exists + * @param texture handle of an OpenGL window texture + * @return the indev or `NULL` + * @note there will only be an indev if the texture is based on an + * LVGL display texture and the window was created with + * `use_mouse_indev` as `true` + */ +lv_indev_t * lv_opengles_window_texture_get_mouse_indev(lv_opengles_window_texture_t * texture); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_OPENGLES */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_OPENGLES_WINDOW_H */ diff --git a/include/lvgl/drivers/qnx/lv_qnx.h b/include/lvgl/drivers/qnx/lv_qnx.h new file mode 100644 index 0000000000..bb8f9409a2 --- /dev/null +++ b/include/lvgl/drivers/qnx/lv_qnx.h @@ -0,0 +1,86 @@ +/** + * @file lv_qnx.h + * @brief LVGL driver for the QNX Screen compositing window manager + */ + +#ifndef LV_QNX_H +#define LV_QNX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" +#include "../../indev/lv_indev.h" + +#if LV_USE_QNX + +#include +#include + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a window to use as a display for LVGL. + * @param hor_res The horizontal resolution (size) of the window + * @param ver_res The vertical resolution (size) of the window + * @return A pointer to a new display object if successful, NULL otherwise + */ +lv_display_t * lv_qnx_window_create(int32_t hor_res, int32_t ver_res); + +/** + * Set the title of the window identified by the given display. + * @param disp The display object for the window + * @param title The new title to set + */ +void lv_qnx_window_set_title(lv_display_t * disp, const char * title); + +/** + * Create a pointer input device for the display. + * Only one pointer object is currently supported. + * @param disp The display object associated with the device + * @return true if successful, false otherwise + */ +bool lv_qnx_add_pointer_device(lv_display_t * disp); + +/** + * Create a keyboard input device for the display. + * Only one keyboard object is currently supported. + * @param disp The display object associated with the device + * @return true if successful, false otherwise + */ +bool lv_qnx_add_keyboard_device(lv_display_t * disp); + +/** + * Runs the event loop for the display. + * The function only returns in response to a close event. + * @param disp The display for the event loop + * @return Exit code + */ +int lv_qnx_event_loop(lv_display_t * disp); + +/********************** + * MACROS + **********************/ + +#endif /* LV_DRV_QNX */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_QNX_H */ diff --git a/include/lvgl/drivers/sdl/lv_sdl_keyboard.h b/include/lvgl/drivers/sdl/lv_sdl_keyboard.h new file mode 100644 index 0000000000..a18b09d8ac --- /dev/null +++ b/include/lvgl/drivers/sdl/lv_sdl_keyboard.h @@ -0,0 +1,46 @@ +/** + * @file lv_sdl_keyboard.h + * + */ + +#ifndef LV_SDL_KEYBOARD_H +#define LV_SDL_KEYBOARD_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_sdl_window.h" +#if LV_USE_SDL + +/********************* + * DEFINES + *********************/ +#ifndef KEYBOARD_BUFFER_SIZE +#define KEYBOARD_BUFFER_SIZE 32 +#endif + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +lv_indev_t * lv_sdl_keyboard_create(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_SDL*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_SDL_KEYBOARD_H */ diff --git a/src/misc/lv_style_private.h b/include/lvgl/drivers/sdl/lv_sdl_mouse.h similarity index 65% rename from src/misc/lv_style_private.h rename to include/lvgl/drivers/sdl/lv_sdl_mouse.h index 8a88185d6b..ef60685f42 100644 --- a/src/misc/lv_style_private.h +++ b/include/lvgl/drivers/sdl/lv_sdl_mouse.h @@ -1,10 +1,10 @@ /** - * @file lv_style_private.h + * @file lv_sdl_mouse.h * */ -#ifndef LV_STYLE_PRIVATE_H -#define LV_STYLE_PRIVATE_H +#ifndef LV_SDL_MOUSE_H +#define LV_SDL_MOUSE_H #ifdef __cplusplus extern "C" { @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ - -#include "lv_style.h" +#include "lv_sdl_window.h" +#if LV_USE_SDL /********************* * DEFINES @@ -28,12 +28,16 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ +lv_indev_t * lv_sdl_mouse_create(void); + /********************** * MACROS **********************/ +#endif /*LV_USE_SDL*/ + #ifdef __cplusplus -} /*extern "C"*/ +} /* extern "C" */ #endif -#endif /*LV_STYLE_PRIVATE_H*/ +#endif /* LV_SDL_MOUSE_H */ diff --git a/include/lvgl/drivers/sdl/lv_sdl_mousewheel.h b/include/lvgl/drivers/sdl/lv_sdl_mousewheel.h new file mode 100644 index 0000000000..dab3dea4b3 --- /dev/null +++ b/include/lvgl/drivers/sdl/lv_sdl_mousewheel.h @@ -0,0 +1,43 @@ +/** + * @file lv_sdl_mousewheel.h + * + */ + +#ifndef LV_SDL_MOUSEWHEEL_H +#define LV_SDL_MOUSEWHEEL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_sdl_window.h" +#if LV_USE_SDL && LV_SDL_MOUSEWHEEL_MODE == LV_SDL_MOUSEWHEEL_MODE_ENCODER + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +lv_indev_t * lv_sdl_mousewheel_create(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_SDL*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_SDL_MOUSEWHEEL_H */ diff --git a/include/lvgl/drivers/sdl/lv_sdl_window.h b/include/lvgl/drivers/sdl/lv_sdl_window.h new file mode 100644 index 0000000000..e30b458289 --- /dev/null +++ b/include/lvgl/drivers/sdl/lv_sdl_window.h @@ -0,0 +1,75 @@ +/** + * @file lv_sdl_window.h + * + */ + +/** + * Modified by NXP in 2025 + */ + +#ifndef LV_SDL_WINDOW_H +#define LV_SDL_WINDOW_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" +#include "../../indev/lv_indev.h" + +#if LV_USE_SDL + +/********************* + * DEFINES + *********************/ + +/* Possible values of LV_SDL_MOUSEWHEEL_MODE */ +#define LV_SDL_MOUSEWHEEL_MODE_ENCODER 0 /* The mousewheel emulates an encoder input device*/ +#define LV_SDL_MOUSEWHEEL_MODE_CROWN 1 /* The mousewheel emulates a smart watch crown*/ + +/********************** + * TYPEDEFS + **********************/ + +struct SDL_Window; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +lv_display_t * lv_sdl_window_create(int32_t hor_res, int32_t ver_res); + +void lv_sdl_window_set_resizeable(lv_display_t * disp, bool value); + +void lv_sdl_window_set_size(lv_display_t * disp, int32_t hor_res, int32_t ver_res); + +void lv_sdl_window_set_zoom(lv_display_t * disp, float zoom); + +float lv_sdl_window_get_zoom(lv_display_t * disp); + +void lv_sdl_window_set_title(lv_display_t * disp, const char * title); + +void lv_sdl_window_set_icon(lv_display_t * disp, void * icon, int32_t width, int32_t height); + +void * lv_sdl_window_get_renderer(lv_display_t * disp); + +void lv_sdl_quit(void); + +struct SDL_Window * lv_sdl_window_get_window(lv_display_t * disp); + +/********************** + * MACROS + **********************/ + + +#endif /* LV_DRV_SDL */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_SDL_WINDOW_H */ diff --git a/include/lvgl/drivers/uefi/lv_uefi.h b/include/lvgl/drivers/uefi/lv_uefi.h new file mode 100644 index 0000000000..6302555c11 --- /dev/null +++ b/include/lvgl/drivers/uefi/lv_uefi.h @@ -0,0 +1,106 @@ +/** + * @file lv_uefi.h + * + */ + +#ifndef LV_UEFI_H +#define LV_UEFI_H + +#if LV_USE_UEFI + + #include LV_USE_UEFI_INCLUDE + + #if defined(__clang__) || defined(__GNUC__) + #if defined(__x86_64__) + #define __LV_UEFI_ARCH_X64__ + #define __LV_UEFI_64BIT__ + #elif defined(__i386__) + #define __LV_UEFI_ARCH_X86__ + #define __LV_UEFI_32BIT__ + #elif defined(__aarch64__) + #define __LV_UEFI_ARCH_AARCH64__ + #define __LV_UEFI_64BIT__ + #else + #error Architecture is not supported + #endif + #define LV_UEFI_STATIC_ASSERT _Static_assert + #elif defined(_MSC_VER) + #if defined(_M_AMD64) && !defined(_M_ARM64) + #define __LV_UEFI_ARCH_X64__ + #define __LV_UEFI_64BIT__ + #elif defined(_M_IX86) + #define __LV_UEFI_ARCH_X86__ + #define __LV_UEFI_32BIT__ + #elif defined(_M_ARM64) + #define __LV_UEFI_ARCH_AARCH64__ + #define __LV_UEFI_64BIT__ + #else + #error Architecture is not supported + #endif + #define LV_UEFI_STATIC_ASSERT static_assert + #else + #error Your compiler is not supported + #endif + + #ifdef LV_USE_UEFI_INCLUDE + #include LV_USE_UEFI_INCLUDE + #else + #error No UEFI headers available + #endif + + // Verify that all required protocols are known + #if !defined(EFI_LOADED_IMAGE_PROTOCOL_GUID) + #error Missing support for EFI_LOADED_IMAGE_PROTOCOL + #endif + #if !defined(EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID) + #error Missing support for EFI_SIMPLE_FILE_SYSTEM_PROTOCOL + #endif + #if !defined(EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID) + #error Missing support for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL + #endif + #if !defined(EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID) + #error Missing support for EFI_SIMPLE_TEXT_INPUT_PROTOCOL + #endif + #if !defined(EFI_SIMPLE_POINTER_PROTOCOL_GUID) + #error Missing support for EFI_SIMPLE_POINTER_PROTOCOL + #endif + #if !defined(EFI_ABSOLUTE_POINTER_PROTOCOL_GUID) + #error Missing support for EFI_ABSOLUTE_POINTER_PROTOCOL + #endif + #if !defined(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID) + #error Missing support for EFI_GRAPHICS_OUTPUT_PROTOCOL + #endif + #if !defined(EFI_EDID_ACTIVE_PROTOCOL_GUID) + #error Missing support for EFI_EDID_ACTIVE_PROTOCOL + #endif + #if !defined(EFI_FILE_INFO_ID) + #error Missing support for EFI_FILE_INFO + #endif + #if !defined(EFI_TIMESTAMP_PROTOCOL_GUID) + #error Missing support for EFI_TIMESTAMP_PROTOCOL_GUID + #endif + + // Verify that all types have the correct size + LV_UEFI_STATIC_ASSERT(sizeof(BOOLEAN) == 1, "Size check for 'BOOLEAN' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(INT8) == 1, "Size check for 'INT8' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(UINT8) == 1, "Size check for 'UINT8' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(INT16) == 2, "Size check for 'INT16' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(UINT16) == 2, "Size check for 'UINT16' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(INT32) == 4, "Size check for 'INT32' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(UINT32) == 4, "Size check for 'UINT32' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(INT64) == 8, "Size check for 'INT64' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(UINT64) == 8, "Size check for 'UINT64' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(CHAR8) == 1, "Size check for 'CHAR8' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(CHAR16) == 2, "Size check for 'CHAR16' failed."); + + #ifdef __LV_UEFI_32BIT__ + LV_UEFI_STATIC_ASSERT(sizeof(INTN) == 4, "Size check for 'INTN' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(UINTN) == 4, "Size check for 'UINTN' failed."); + #else + LV_UEFI_STATIC_ASSERT(sizeof(INTN) == 8, "Size check for 'INTN' failed."); + LV_UEFI_STATIC_ASSERT(sizeof(UINTN) == 8, "Size check for 'UINTN' failed."); + #endif + +#endif + +#endif \ No newline at end of file diff --git a/include/lvgl/drivers/uefi/lv_uefi_context.h b/include/lvgl/drivers/uefi/lv_uefi_context.h new file mode 100644 index 0000000000..0871db51a5 --- /dev/null +++ b/include/lvgl/drivers/uefi/lv_uefi_context.h @@ -0,0 +1,72 @@ +/** + * @file lv_uefi_context.h + * + */ + +#ifndef __LV_UEFI_CONTEXT_H__ +#define __LV_UEFI_CONTEXT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" + +#if LV_USE_UEFI + +#include "lv_uefi.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Initialize the UEFI cache variables. + * @param image_handle The handle of the current image + * @param system_table Pointer to the system table + * @remark This has to be called before lv_init(). +*/ +void lv_uefi_init( + EFI_HANDLE image_handle, + EFI_SYSTEM_TABLE * system_table); + +/** + * @brief Initialize the LVGL UEFI backend. + * @remark This is a private API which is used for LVGL UEFI backend + * implementation. LVGL users shouldn't use that because the + * LVGL has already used it in lv_init. +*/ +void lv_uefi_platform_init(void); + +/** + * @brief Cleanup the LVGL UEFI backend. + * @remark This is a private API which is used for LVGL UEFI backend + * implementation. LVGL users shouldn't use that because the + * LVGL has already used it in lv_deinit. +*/ +void lv_uefi_platform_deinit(void); + +/********************** + * MACROS + **********************/ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif //__LV_UEFI_CONTEXT_H__ + diff --git a/include/lvgl/drivers/uefi/lv_uefi_display.h b/include/lvgl/drivers/uefi/lv_uefi_display.h new file mode 100644 index 0000000000..ec09b26aed --- /dev/null +++ b/include/lvgl/drivers/uefi/lv_uefi_display.h @@ -0,0 +1,66 @@ +/** + * @file lv_uefi_display.h + * + */ + +#ifndef __LV_UEFI_DISPLAY_H__ +#define __LV_UEFI_DISPLAY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" + +#if LV_USE_UEFI + +#include "lv_uefi.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Create a LVGL display object. + * @param handle The handle on which an instance of the EFI_GRAPHICS_OUTPUT_PROTOCOL protocol is installed. + * @return The created LVGL display object. +*/ +lv_display_t * lv_uefi_display_create(void * handle); + +/** + * @brief Try to find the active display handle. + * @return The handle or NULL if not found. + * @remark The active display need interfaces for EFI_GRAPHICS_OUTPUT_PROTOCOL and EFI_EDID_ACTIVE_PROTOCOL +*/ +void * lv_uefi_display_get_active(void); + +/** + * @brief Try to find any display handle. + * @return The handle or NULL if not found. +*/ +void * lv_uefi_display_get_any(void); + +/********************** + * MACROS + **********************/ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif //__LV_UEFI_DISPLAY_H__ + diff --git a/include/lvgl/drivers/uefi/lv_uefi_edk2.h b/include/lvgl/drivers/uefi/lv_uefi_edk2.h new file mode 100644 index 0000000000..870b997829 --- /dev/null +++ b/include/lvgl/drivers/uefi/lv_uefi_edk2.h @@ -0,0 +1,28 @@ +/** + * @file lv_uefi_edk2.h + * + */ + +#ifndef LV_UEFI_EDK2_H +#define LV_UEFI_EDK2_H + +#if LV_USE_UEFI + + #define LV_UEFI_EDK2_HEADERS 1 + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + +#endif + +#endif \ No newline at end of file diff --git a/include/lvgl/drivers/uefi/lv_uefi_gnu_efi.h b/include/lvgl/drivers/uefi/lv_uefi_gnu_efi.h new file mode 100644 index 0000000000..23e9e49559 --- /dev/null +++ b/include/lvgl/drivers/uefi/lv_uefi_gnu_efi.h @@ -0,0 +1,17 @@ +/** + * @file lv_uefi_gnu_efi.h + * + */ + +#ifndef LV_UEFI_GNU_EFI_H +#define LV_UEFI_GNU_EFI_H + +#if LV_USE_UEFI + + #define LV_UEFI_GNU_EFI_HEADERS 1 + + #include + +#endif + +#endif \ No newline at end of file diff --git a/include/lvgl/drivers/uefi/lv_uefi_indev.h b/include/lvgl/drivers/uefi/lv_uefi_indev.h new file mode 100644 index 0000000000..654899f886 --- /dev/null +++ b/include/lvgl/drivers/uefi/lv_uefi_indev.h @@ -0,0 +1,109 @@ +/** + * @file lv_uefi_indev.h + * + */ + +#ifndef __LV_UEFI_INDEV_H__ +#define __LV_UEFI_INDEV_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../indev/lv_indev.h" + +#if LV_USE_UEFI + +#include "lv_uefi.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Create an indev object. + * @param display_res The resolution of the display in pixels, needed to scale the input. + * If NULL the resolution of the current default display will be used. + * @return The created LVGL indev object. +*/ +lv_indev_t * lv_uefi_simple_pointer_indev_create(lv_point_t * display_res); + +/** + * @brief Add an EFI_SIMPLE_POINTER_PROTOCOL interface to the indev. + * @param indev Indev that was created with lv_uefi_simple_pointer_indev_create. + * @param handle The handle on which an instance of the EFI_SIMPLE_POINTER_PROTOCOL protocol is installed. + * @return True if the interface was added. +*/ +bool lv_uefi_simple_pointer_indev_add_handle(lv_indev_t * indev, EFI_HANDLE handle); + +/** + * @brief Add all available EFI_SIMPLE_POINTER_PROTOCOL interfaces to the indev. + * @param indev Indev that was created with lv_uefi_simple_pointer_indev_create. +*/ +void lv_uefi_simple_pointer_indev_add_all(lv_indev_t * indev); + +/** + * @brief Create a LVGL indev object. + * @param display_res The resolution of the display in pixels, needed to scale the input. + * @return The created LVGL indev object. +*/ +lv_indev_t * lv_uefi_absolute_pointer_indev_create(lv_point_t * display_res); + +/** + * @brief Add an EFI_ABSOLUTE_POINTER_PROTOCOL interface to the indev. + * @param indev Indev that was created with lv_uefi_absolute_pointer_indev_create. + * @param handle The handle on which an instance of the EFI_ABSOLUTE_POINTER_PROTOCOL protocol is installed. + * @return True if the interface was added. +*/ +bool lv_uefi_absolute_pointer_indev_add_handle(lv_indev_t * indev, EFI_HANDLE handle); + +/** + * @brief Add all available EFI_ABSOLUTE_POINTER_PROTOCOL interfaces to the indev. + * @param indev Indev that was created with lv_uefi_absolute_pointer_indev_create. +*/ +void lv_uefi_absolute_pointer_indev_add_all(lv_indev_t * indev); + +/** + * @brief Create an indev object. + * @return The created LVGL indev object. +*/ +lv_indev_t * lv_uefi_simple_text_input_indev_create(void); + +/** + * @brief Add an EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL interface to the indev. + * @param indev Indev that was created with lv_uefi_simple_text_input_indev_create. + * @param handle The handle on which an instance of the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL protocol is installed. + * @return True if the interface was added. +*/ +bool lv_uefi_simple_text_input_indev_add_handle(lv_indev_t * indev, EFI_HANDLE handle); + +/** + * @brief Add all available EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL interfaces to the indev. + * @param indev Indev that was created with lv_uefi_simple_text_input_indev_create. +*/ +void lv_uefi_simple_text_input_indev_add_all(lv_indev_t * indev); + +/********************** + * MACROS + **********************/ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif //__LV_UEFI_INDEV_H__ + diff --git a/include/lvgl/drivers/wayland/lv_wayland.h b/include/lvgl/drivers/wayland/lv_wayland.h new file mode 100644 index 0000000000..ca995de722 --- /dev/null +++ b/include/lvgl/drivers/wayland/lv_wayland.h @@ -0,0 +1,53 @@ +/** + * @file lv_wayland.h + */ + +#ifndef LV_WAYLAND_H +#define LV_WAYLAND_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../config/lv_conf_internal.h" + +#if LV_USE_WAYLAND + +#include "lv_wayland_keyboard.h" +#include "lv_wayland_pointer.h" +#include "lv_wayland_touch.h" +#include "lv_wayland_window.h" +#include "lv_wayland_pointer_axis.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Retrieves the file descriptor of the wayland socket + */ +int lv_wayland_get_fd(void); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_WAYLAND */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_WAYLAND_H */ diff --git a/include/lvgl/drivers/wayland/lv_wayland_keyboard.h b/include/lvgl/drivers/wayland/lv_wayland_keyboard.h new file mode 100644 index 0000000000..c568497f6d --- /dev/null +++ b/include/lvgl/drivers/wayland/lv_wayland_keyboard.h @@ -0,0 +1,52 @@ +/** + * @file lv_wayland_keyboard.h + * + */ + +#ifndef LV_WAYLAND_KEYBOARD_H +#define LV_WAYLAND_KEYBOARD_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../indev/lv_indev.h" +#include "../../indev/lv_indev_gesture.h" +#if LV_USE_WAYLAND + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +lv_indev_t * lv_wayland_keyboard_create(void); + +/** + * Get keyboard input device for given LVGL display + * @param display LVGL display + * @return input device connected to keyboard, or NULL on error + */ +lv_indev_t * lv_wayland_get_keyboard(lv_display_t * display); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_WAYLAND */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_WAYLAND_KEYBOARD_H*/ diff --git a/include/lvgl/drivers/wayland/lv_wayland_pointer.h b/include/lvgl/drivers/wayland/lv_wayland_pointer.h new file mode 100644 index 0000000000..dc02773a5e --- /dev/null +++ b/include/lvgl/drivers/wayland/lv_wayland_pointer.h @@ -0,0 +1,54 @@ + +/** + * @file lv_wayland_pointer.h + * + */ + +#ifndef LV_WAYLAND_POINTER_H +#define LV_WAYLAND_POINTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../indev/lv_indev.h" +#include "../../indev/lv_indev_gesture.h" +#if LV_USE_WAYLAND + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +lv_indev_t * lv_wayland_pointer_create(void); + +/** + * Obtains the input device of the mouse pointer + * @note It is used to create an input group on application start + * @param disp Reference to the LVGL display associated to the window + * @return The input device + */ +lv_indev_t * lv_wayland_get_pointer(lv_display_t * disp); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_WAYLAND */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_WAYLAND_POINTER_H*/ diff --git a/include/lvgl/drivers/wayland/lv_wayland_pointer_axis.h b/include/lvgl/drivers/wayland/lv_wayland_pointer_axis.h new file mode 100644 index 0000000000..8299bfa736 --- /dev/null +++ b/include/lvgl/drivers/wayland/lv_wayland_pointer_axis.h @@ -0,0 +1,54 @@ +/** + * @file lv_wayland_pointer_axis.h + * + */ + +#ifndef LV_WAYLAND_POINTER_AXIS_H +#define LV_WAYLAND_POINTER_AXIS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "../../indev/lv_indev.h" +#include "../../indev/lv_indev_gesture.h" + +#if LV_USE_WAYLAND + +/********************* + * INCLUDES + *********************/ + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +lv_indev_t * lv_wayland_pointer_axis_create(void); + +/** + * Obtains the input device of the encoder + * @note It is used to create an input group on application start + * @param display Reference to the LVGL display associated to the window + * @return The input device + */ +lv_indev_t * lv_wayland_get_pointeraxis(lv_display_t * display); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_WAYLAND */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_WAYLAND_POINTER_AXIS_H*/ diff --git a/include/lvgl/drivers/wayland/lv_wayland_touch.h b/include/lvgl/drivers/wayland/lv_wayland_touch.h new file mode 100644 index 0000000000..132f1e6eeb --- /dev/null +++ b/include/lvgl/drivers/wayland/lv_wayland_touch.h @@ -0,0 +1,52 @@ +/** + * @file lv_wayland_touch.h + * + */ + +#ifndef LV_WAYLAND_TOUCH_H +#define LV_WAYLAND_TOUCH_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../indev/lv_indev.h" +#include "../../indev/lv_indev_gesture.h" +#if LV_USE_WAYLAND + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +lv_indev_t * lv_wayland_touch_create(void); + +/** + * Get touchscreen input device for given LVGL display + * @param display LVGL display + * @return input device connected to touchscreen, or NULL on error + */ +lv_indev_t * lv_wayland_get_touchscreen(lv_display_t * display); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_WAYLAND */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_WAYLAND_TOUCH_H*/ diff --git a/include/lvgl/drivers/wayland/lv_wayland_window.h b/include/lvgl/drivers/wayland/lv_wayland_window.h new file mode 100644 index 0000000000..336b50a898 --- /dev/null +++ b/include/lvgl/drivers/wayland/lv_wayland_window.h @@ -0,0 +1,104 @@ + +/** + * @file lv_wayland_window.h + * + */ + +#ifndef LV_WAYLAND_WINDOW_H +#define LV_WAYLAND_WINDOW_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" + +#if LV_USE_WAYLAND + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef bool (*lv_wayland_display_close_cb_t)(lv_display_t * disp); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Creates a window + * @param hor_res The width of the window in pixels + * @param ver_res The height of the window in pixels + * @param title The title of the window + * @param close_cb The callback that will be execute when the user closes the window + * @return The LVGL display associated to the window + */ +lv_display_t * lv_wayland_window_create(uint32_t hor_res, uint32_t ver_res, char * title, + lv_wayland_display_close_cb_t close_cb); + +/** + * Closes the window programmatically + * @param disp Reference to the LVGL display associated to the window + */ +void lv_wayland_window_close(lv_display_t * disp); + +/** + * Check if the window is open + * @param disp Reference to the LVGL display associated to the window + * @return true: The window is open + */ +bool lv_wayland_window_is_open(lv_display_t * disp); + +/** + * Assigns the window to a specific physical display + * @param disp Reference to the LVGL display associated to the window + * @param display Physical display number + */ +void lv_wayland_assign_physical_display(lv_display_t * disp, uint8_t display); + +/** + * Unassigns the current physical display attached to the window + * @param disp Reference to the LVGL display associated to the window + */ +void lv_wayland_unassign_physical_display(lv_display_t * disp); + +/** + * Sets the fullscreen state of the window + * @param disp Reference to the LVGL display associated to the window + * @param fullscreen If true the window enters fullscreen + */ + +void lv_wayland_window_set_fullscreen(lv_display_t * disp, bool fullscreen); + +/** + * Sets the maximized state of the window + * @param disp Reference to the LVGL display associated to the window + * @param fullscreen If true the window is maximized + */ +void lv_wayland_window_set_maximized(lv_display_t * disp, bool maximize); + +/** + * Minimizes the window + * @param disp Reference to the LVGL display associated to the window + */ +void lv_wayland_window_set_minimized(lv_display_t * disp); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_WAYLAND */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_WAYLAND_WINDOW_H*/ diff --git a/include/lvgl/drivers/windows/lv_windows_display.h b/include/lvgl/drivers/windows/lv_windows_display.h new file mode 100644 index 0000000000..673705202e --- /dev/null +++ b/include/lvgl/drivers/windows/lv_windows_display.h @@ -0,0 +1,128 @@ +/** + * @file lv_windows_display.h + * + */ + +#ifndef LV_WINDOWS_DISPLAY_H +#define LV_WINDOWS_DISPLAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" +#include "../../indev/lv_indev.h" + +#if LV_USE_WINDOWS + +/********************* + * DEFINES + *********************/ + +#define LV_WINDOWS_ZOOM_BASE_LEVEL 100 + +#ifndef USER_DEFAULT_SCREEN_DPI +#define USER_DEFAULT_SCREEN_DPI 96 +#endif + +/********************** + * TYPEDEFS + **********************/ + +struct HWND__; +typedef struct HWND__ * HWND; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Create a LVGL display object. + * @param title The window title of LVGL display. + * @param hor_res The horizontal resolution value of LVGL display. + * @param ver_res The vertical resolution value of LVGL display. + * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%. + * @param allow_dpi_override Allow DPI override if true, or follow the + * Windows DPI scaling setting dynamically. + * @param simulator_mode Create simulator mode display if true (not resizable), + * or create application mode display (resizable). + * @return The created LVGL display object. +*/ +lv_display_t * lv_windows_create_display( + const wchar_t * title, + int32_t hor_res, + int32_t ver_res, + int32_t zoom_level, + bool allow_dpi_override, + bool simulator_mode); + +/** + * @brief Get the window handle from specific LVGL display object. + * @param display The specific LVGL display object. + * @return The window handle from specific LVGL display object. +*/ +HWND lv_windows_get_display_window_handle(lv_display_t * display); + +/** + * @brief Get logical pixel value from physical pixel value taken account + * with zoom level. + * @param physical The physical pixel value taken account with zoom level. + * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%. + * @return The logical pixel value. + * @remark It uses the same calculation style as Windows OS implementation. + * It will be useful for integrate LVGL Windows backend to other + * Windows applications. +*/ +int32_t lv_windows_zoom_to_logical(int32_t physical, int32_t zoom_level); + +/** + * @brief Get physical pixel value taken account with zoom level from + * logical pixel value. + * @param logical The logical pixel value. + * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%. + * @return The physical pixel value taken account with zoom level. + * @remark It uses the same calculation style as Windows OS implementation. + * It will be useful for integrate LVGL Windows backend to other + * Windows applications. +*/ +int32_t lv_windows_zoom_to_physical(int32_t logical, int32_t zoom_level); + +/** + * @brief Get logical pixel value from physical pixel value taken account + * with DPI scaling. + * @param physical The physical pixel value taken account with DPI scaling. + * @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI. + * @return The logical pixel value. + * @remark It uses the same calculation style as Windows OS implementation. + * It will be useful for integrate LVGL Windows backend to other + * Windows applications. +*/ +int32_t lv_windows_dpi_to_logical(int32_t physical, int32_t dpi); + +/** + * @brief Get physical pixel value taken account with DPI scaling from + * logical pixel value. + * @param logical The logical pixel value. + * @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI. + * @return The physical pixel value taken account with DPI scaling. + * @remark It uses the same calculation style as Windows OS implementation. + * It will be useful for integrate LVGL Windows backend to other + * Windows applications. +*/ +int32_t lv_windows_dpi_to_physical(int32_t logical, int32_t dpi); + +/********************** + * MACROS + **********************/ + +#endif // LV_USE_WINDOWS + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_WINDOWS_DISPLAY_H*/ diff --git a/include/lvgl/drivers/windows/lv_windows_input.h b/include/lvgl/drivers/windows/lv_windows_input.h new file mode 100644 index 0000000000..05c0bb395f --- /dev/null +++ b/include/lvgl/drivers/windows/lv_windows_input.h @@ -0,0 +1,82 @@ +/** + * @file lv_windows_input.h + * + */ + +#ifndef LV_WINDOWS_INPUT_H +#define LV_WINDOWS_INPUT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_windows_display.h" +#include "../../display/lv_display.h" +#include "../../indev/lv_indev.h" + +#if LV_USE_WINDOWS + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Get the window handle from specific LVGL input device object. + * @param indev The specific LVGL input device object. + * @return The window handle from specific LVGL input device object. +*/ +HWND lv_windows_get_indev_window_handle(lv_indev_t * indev); + +/** + * @brief Open a LVGL pointer input device object for the specific LVGL + * display object, or create it if the LVGL pointer input device + * object is not created or removed before. + * @param display The specific LVGL display object. + * @return The LVGL pointer input device object for the specific LVGL + * display object. +*/ +lv_indev_t * lv_windows_acquire_pointer_indev(lv_display_t * display); + +/** + * @brief Open a LVGL keypad input device object for the specific LVGL + * display object, or create it if the LVGL keypad input device + * object is not created or removed before. + * @param display The specific LVGL display object. + * @return The LVGL keypad input device object for the specific LVGL + * display object. +*/ +lv_indev_t * lv_windows_acquire_keypad_indev(lv_display_t * display); + +/** + * @brief Open a LVGL encoder input device object for the specific LVGL + * display object, or create it if the LVGL encoder input device + * object is not created or removed before. + * @param display The specific LVGL display object. + * @return The LVGL encoder input device object for the specific LVGL + * display object. +*/ +lv_indev_t * lv_windows_acquire_encoder_indev(lv_display_t * display); + +/********************** + * MACROS + **********************/ + +#endif // LV_USE_WINDOWS + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_WINDOWS_INPUT_H*/ diff --git a/include/lvgl/drivers/x11/lv_x11.h b/include/lvgl/drivers/x11/lv_x11.h new file mode 100644 index 0000000000..bb98b51f93 --- /dev/null +++ b/include/lvgl/drivers/x11/lv_x11.h @@ -0,0 +1,82 @@ +/** + * @file lv_x11.h + * + */ + +#ifndef LV_X11_H +#define LV_X11_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../display/lv_display.h" +#include "../../indev/lv_indev.h" +#include "../../draw/lv_image_dsc.h" + +#if LV_USE_X11 + +/********************* + * DEFINES + *********************/ + +/** Header of private display driver user data - for internal use only */ +typedef struct { + struct _XDisplay * display; /**< X11 display object */ + struct _x11_inp_data * inp_data; /**< input user data object */ +} _x11_user_hdr_t; + +/** optional window close callback function type + * @see lv_x11_window_set_close_cb +*/ +typedef void(*lv_x11_close_cb)(void * user_data); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * create and add keyboard, mouse and scrollwheel objects and connect them to x11 display. + * + * This is a convenience method handling the typical input initialisation of an X11 window: + * - create keyboard (lv_x11_keyboard_create) + * - create mouse (with scrollwheel, lv_x11_mouse_create lv_x11_mousewheel_create) + * + * @param[in] disp the created X11 display object from @ref lv_x11_window_create + * @param[in] mouse_img optional image description for the mouse cursor (NULL for no/invisible mouse cursor) + */ +void lv_x11_inputs_create(lv_display_t * disp, lv_image_dsc_t const * mouse_img); + +/** + * create the X11 display + * + * The minimal initialisation for initializing the X11 display driver with keyboard/mouse support: + * @code + * lv_display_t* disp = lv_x11_window_create("My Window Title", window_width, window_width); + * lv_x11_inputs_create(disp, NULL); + * @endcode + * or with mouse cursor icon: + * @code + * lv_image_dsc_t mouse_symbol = {.....}; + * lv_display_t* disp = lv_x11_window_create("My Window Title", window_width, window_width); + * lv_x11_inputs_create(disp, &mouse_symbol); + * @endcode + * + * @param[in] title title of the created X11 window + * @param[in] hor_res horizontal resolution (=width) of the X11 window + * @param[in] ver_res vertical resolution (=height) of the X11 window + * @return pointer to the display object + */ +lv_display_t * lv_x11_window_create(char const * title, int32_t hor_res, int32_t ver_res); + +#endif /* LV_USE_X11 */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_X11_H */ diff --git a/include/lvgl/font/lv_bidi.h b/include/lvgl/font/lv_bidi.h new file mode 100644 index 0000000000..98e2575b19 --- /dev/null +++ b/include/lvgl/font/lv_bidi.h @@ -0,0 +1,83 @@ +/** + * @file lv_bidi.h + * + */ + +#ifndef LV_BIDI_H +#define LV_BIDI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" +#include "lv_text.h" + +/********************* + * DEFINES + *********************/ +/** Special non printable strong characters. + * They can be inserted to texts to affect the run's direction */ +#define LV_BIDI_LRO "\xE2\x80\xAD" /*U+202D*/ +#define LV_BIDI_RLO "\xE2\x80\xAE" /*U+202E*/ + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_BASE_DIR_LTR = 0x00, + LV_BASE_DIR_RTL = 0x01, + LV_BASE_DIR_AUTO = 0x02, + + LV_BASE_DIR_NEUTRAL = 0x20, + LV_BASE_DIR_WEAK = 0x21, +} lv_base_dir_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ +#if LV_USE_BIDI + +/** + * Get the real text alignment from the a text alignment, base direction and a text. + * @param align LV_TEXT_ALIGN_..., write back the calculated align here (LV_TEXT_ALIGN_LEFT/RIGHT/CENTER) + * @param base_dir LV_BASE_DIR_..., write the calculated base dir here (LV_BASE_DIR_LTR/RTL) + * @param txt a text, used with LV_BASE_DIR_AUTO to determine the base direction + */ +void lv_bidi_calculate_align(lv_text_align_t * align, lv_base_dir_t * base_dir, const char * txt); + +/** + * Set custom neutrals string + * @param neutrals default " \t\n\r.,:;'\"`!?%/\\-=()[]{}<>@#&$|" + */ +void lv_bidi_set_custom_neutrals_static(const char * neutrals); + +/********************** + * MACROS + **********************/ + +#else /*LV_USE_BIDI*/ +/** + * For compatibility if LV_USE_BIDI = 0 + * Get the real text alignment from the a text alignment, base direction and a text. + * @param align For LV_TEXT_ALIGN_AUTO give LV_TEXT_ALIGN_LEFT else leave unchanged, write back the calculated align here + * @param base_dir Unused + * @param txt Unused + */ +static inline void lv_bidi_calculate_align(lv_text_align_t * align, lv_base_dir_t * base_dir, const char * txt) +{ + LV_UNUSED(txt); + LV_UNUSED(base_dir); + if(*align == LV_TEXT_ALIGN_AUTO) * align = LV_TEXT_ALIGN_LEFT; +} +#endif /*LV_USE_BIDI*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BIDI_H*/ diff --git a/include/lvgl/font/lv_binfont_loader.h b/include/lvgl/font/lv_binfont_loader.h new file mode 100644 index 0000000000..e3feaee446 --- /dev/null +++ b/include/lvgl/font/lv_binfont_loader.h @@ -0,0 +1,72 @@ +/** + * @file lv_binfont_loader.h + * + */ + +#ifndef LV_BINFONT_LOADER_H +#define LV_BINFONT_LOADER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + + +typedef struct { + uint32_t font_size; /**< Size of the font in pixels*/ + const char * path; /**< Path to font file*/ + const void * buffer; /**< Address of the font file in the memory*/ + uint32_t buffer_size; /**< Size of the font file buffer*/ +} lv_binfont_font_src_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_binfont_font_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Loads a `lv_font_t` object from a binary font file + * @param path path to font file + * @return pointer to font where to load + */ +lv_font_t * lv_binfont_create(const char * path); + +#if LV_USE_FS_MEMFS +/** + * Loads a `lv_font_t` object from a memory buffer containing the binary font file. + * Requires LV_USE_FS_MEMFS + * @param buffer address of the font file in the memory + * @param size size of the font file buffer + * @return pointer to font where to load + */ +lv_font_t * lv_binfont_create_from_buffer(void * buffer, uint32_t size); +#endif + +/** + * Frees the memory allocated by the `lv_binfont_create()` function + * @param font lv_font_t object created by the lv_binfont_create function + */ +void lv_binfont_destroy(lv_font_t * font); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_BINFONT_LOADER_H */ diff --git a/include/lvgl/font/lv_font.h b/include/lvgl/font/lv_font.h new file mode 100644 index 0000000000..59760fb410 --- /dev/null +++ b/include/lvgl/font/lv_font.h @@ -0,0 +1,397 @@ +/** + * @file lv_font.h + * + */ + +#ifndef LV_FONT_H +#define LV_FONT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" +#include "lv_symbol_def.h" +#include "../draw/lv_draw_buf.h" +#include "../core/lv_area.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*------------------ + * General types + *-----------------*/ + +/** The font format.*/ +typedef enum { + LV_FONT_GLYPH_FORMAT_NONE = 0, /**< Maybe not visible*/ + + /**< Legacy simple formats*/ + LV_FONT_GLYPH_FORMAT_A1 = 0x01, /**< 1 bit per pixel*/ + LV_FONT_GLYPH_FORMAT_A2 = 0x02, /**< 2 bit per pixel*/ + LV_FONT_GLYPH_FORMAT_A3 = 0x03, /**< 3 bit per pixel*/ + LV_FONT_GLYPH_FORMAT_A4 = 0x04, /**< 4 bit per pixel*/ + LV_FONT_GLYPH_FORMAT_A8 = 0x08, /**< 8 bit per pixel*/ + + LV_FONT_GLYPH_FORMAT_IMAGE = 0x19, /**< Image format*/ + + /**< Advanced formats*/ + LV_FONT_GLYPH_FORMAT_VECTOR = 0x1A, /**< Vectorial format*/ + LV_FONT_GLYPH_FORMAT_SVG = 0x1B, /**< SVG format*/ + LV_FONT_GLYPH_FORMAT_CUSTOM = 0xFF, /**< Custom format*/ +} lv_font_glyph_format_t; + + +/** Describes the properties of a glyph.*/ +typedef struct { + const lv_font_t * resolved_font; /**< Pointer to a font where the glyph was actually found after handling fallbacks*/ + void * entry; /**< The cache entry of the glyph draw data. Used by the font cache*/ + union { + uint32_t index; /**< Glyph descriptor index*/ + const void * src; /**< Pointer to the source data used by image fonts*/ + } gid; /**< The index of the glyph in the font file. Used by the font cache*/ + lv_font_glyph_format_t format; /**< Font format of the glyph see lv_font_glyph_format_t */ + int32_t outline_stroke_width; /**< used with freetype vector fonts - width of the letter border */ + uint16_t adv_w; /**< The glyph needs this space. Draw the next glyph after this width.*/ + uint16_t box_w; /**< Width of the glyph's bounding box*/ + uint16_t box_h; /**< Height of the glyph's bounding box*/ + int16_t ofs_x; /**< x offset of the bounding box*/ + int16_t ofs_y; /**< y offset of the bounding box*/ + uint16_t stride;/**< Bytes in each line. If 0 than there is no padding at the end of the line. */ + uint8_t is_placeholder: 1; /**< Glyph is missing. But placeholder will still be displayed*/ + + /** 0: Get bitmap should return an A8 or ARGB8888 image. + * 1: return the bitmap as it is (Maybe A1/2/4 or any proprietary formats). */ + uint8_t req_raw_bitmap: 1; +} lv_font_glyph_dsc_t; + +/** The bitmaps might be upscaled by 3 to achieve subpixel rendering.*/ +typedef enum { + LV_FONT_SUBPX_NONE, + LV_FONT_SUBPX_HOR, + LV_FONT_SUBPX_VER, + LV_FONT_SUBPX_BOTH, +} lv_font_subpx_t; + +/** Adjust letter spacing for specific character pairs.*/ +typedef enum { + LV_FONT_KERNING_NORMAL, + LV_FONT_KERNING_NONE, +} lv_font_kerning_t; + +/** Describe the properties of a font*/ +struct _lv_font_t { + const void * dsc; /**< Store implementation specific or run_time data or caching here*/ + const lv_font_t * fallback; /**< Fallback font for missing glyph. Resolved recursively */ + void * user_data; /**< Custom user data for font.*/ + + /** Get a glyph's descriptor from a font. + * + * Fills `dsc_out` with metrics for the glyph corresponding to `letter` in `font`. + * `letter_next` is provided for kerning. The implementation may adjust `dsc_out->adv_w` + * based on the following character. Pass 0 if there is no next character. + * + * @param font the font to query + * @param dsc_out output descriptor to fill + * @param letter Unicode codepoint of the glyph to look up + * @param letter_next Unicode codepoint of the following glyph, or 0 if none + * @return true if the glyph was found, false otherwise + */ + bool (*get_glyph_dsc)(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, + uint32_t letter, uint32_t letter_next); + + /** Get glyph draw data from a font. + * + * Returns an opaque pointer to draw data for the glyph described by `g_dsc`. The + * concrete type and interpretation of the returned pointer depend on + * `g_dsc->format` (and related flags, e.g. whether a raw bitmap was requested). + * + * For legacy bitmap formats (e.g. A1/A2/A3/A4/A8), the implementation may either: + * - decode/decompress into the caller-provided `draw_buf` and return a pointer to + * that draw buffer (typically an `lv_draw_buf_t *`), or + * - return a pointer to font-internal bitmap storage. + * + * For non-bitmap formats (e.g. `LV_FONT_GLYPH_FORMAT_IMAGE`, vector/outline/SVG, + * or custom formats), the implementation typically ignores `draw_buf` and returns + * a format-specific object (such as an image source or `lv_vector_path_t *`). + * + * The caller must always treat the return value as the authoritative glyph draw + * data and interpret it according to `g_dsc->format`. Do not assume the data was + * written into `draw_buf` or that it is always an alpha bitmap. The returned + * pointer is only valid until `release_glyph` is called. + * + * @param g_dsc glyph descriptor previously filled by `get_glyph_dsc`. + * `g_dsc->entry` may be set by this call to track an internal + * cache entry that must later be released via `release_glyph`. + * @param draw_buf caller-provided scratch buffer offered to the implementation + * as a decode/render target for bitmap formats. May be ignored + * by the implementation. + * @return pointer to glyph draw data appropriate for `g_dsc->format`, + * or NULL on failure + */ + const void * (*get_glyph_bitmap)(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf); + + /** Release a glyph and any resources acquired during `get_glyph_dsc` or `get_glyph_bitmap`. + * + * Must be called after the glyph bitmap is no longer needed. Releases any internal + * cache entry stored in `g_dsc->entry` by the font implementation. + * Calling this with a `g_dsc` whose `entry` is NULL must be treated as a no-op. + * + * @param font the font that owns the glyph + * @param g_dsc glyph descriptor to release + */ + void (*release_glyph)(const lv_font_t * font, lv_font_glyph_dsc_t * g_dsc); + + /*Pointer to the font in a font pack (must have the same line height)*/ + int32_t line_height; /**< The real line height where any text fits*/ + int32_t base_line; /**< Base line measured from the bottom of the line_height*/ + int32_t cap_height; /**< Cap height of the font*/ + int32_t x_height; /**< x-height of the font*/ + + uint8_t subpx : 2; /**< An element of `lv_font_subpx_t`*/ + uint8_t kerning : 1; /**< An element of `lv_font_kerning_t`*/ + uint8_t static_bitmap : 1; /**< The font will be used as static bitmap */ + + int8_t underline_position; /**< Distance between the top of the underline and base line (< 0 means below the base line)*/ + int8_t underline_thickness; /**< Thickness of the underline*/ +}; + +struct _lv_font_class_t { + lv_font_t * (*create_cb)(const lv_font_info_t * info, const void * src); /**< Font creation callback function*/ + void (*delete_cb)(lv_font_t * font); /**< Font deletion callback function*/ + void * (*dup_src_cb)(const void * src); /**< Font source duplication callback function*/ + void (*free_src_cb)(void * src); /**< Font source free callback function*/ +}; + +struct _lv_font_info_t { + const char * name; /**< Font name, used to distinguish different font resources*/ + const lv_font_class_t * class_p; /**< Font backend implementation*/ + uint32_t size; /**< Font size in pixel*/ + uint32_t render_mode; /**< Font rendering mode, see `lv_freetype_font_render_mode_t`*/ + uint32_t style; /**< Font style, see `lv_freetype_font_style_t`*/ + lv_font_kerning_t kerning; /**< Font kerning, see `lv_font_kerning_t`*/ +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Return with the bitmap of a font. + * It always converts the normal fonts to A8 format in a draw_buf with + * LV_DRAW_BUF_ALIGN and LV_DRAW_BUF_STRIDE_ALIGN + * @note You must call lv_font_get_glyph_dsc() to get `g_dsc` (lv_font_glyph_dsc_t) + * before you can call this function. + * @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index + * and the format. + * @param draw_buf a draw buffer that can be used to store the bitmap of the glyph. + * @return pointer to the glyph's data. + * It can be a draw buffer for bitmap fonts or an image source for imgfonts. + */ +const void * lv_font_get_glyph_bitmap(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf); + + +/** + * Return the bitmap as it is. It works only if the font stores the bitmap in + * a non-volitile memory. + * @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index + * and the format. + * @return the bitmap as it is + */ +const void * lv_font_get_glyph_static_bitmap(lv_font_glyph_dsc_t * g_dsc); + +/** + * Get the descriptor of a glyph + * @param font pointer to font + * @param dsc_out store the result descriptor here + * @param letter a UNICODE letter code + * @param letter_next the next letter after `letter`. Used for kerning + * @return true: descriptor is successfully loaded into `dsc_out`. + * false: the letter was not found, no data is loaded to `dsc_out` + */ +bool lv_font_get_glyph_dsc(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t letter, + uint32_t letter_next); +/** + * Release the bitmap of a font. + * @note You must call lv_font_get_glyph_dsc() to get `g_dsc` (lv_font_glyph_dsc_t) before you can call this function. + * @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index and the format. + */ +void lv_font_glyph_release_draw_data(lv_font_glyph_dsc_t * g_dsc); + +/** + * Get the width of a glyph with kerning + * @param font pointer to a font + * @param letter a UNICODE letter + * @param letter_next the next letter after `letter`. Used for kerning + * @return the width of the glyph + */ +uint16_t lv_font_get_glyph_width(const lv_font_t * font, uint32_t letter, uint32_t letter_next); + +/** + * Get the line height of a font. All characters fit into this height + * @param font pointer to a font + * @return the height of a font + */ +int32_t lv_font_get_line_height(const lv_font_t * font); + +/** + * Configure the use of kerning information stored in a font + * @param font pointer to a font + * @param kerning `LV_FONT_KERNING_NORMAL` (default) or `LV_FONT_KERNING_NONE` + */ +void lv_font_set_kerning(lv_font_t * font, lv_font_kerning_t kerning); + +/** + * Get the default font, defined by LV_FONT_DEFAULT + * @return return pointer to the default font + */ +const lv_font_t * lv_font_get_default(void); + +/** + * Compare font information. + * @param ft_info_1 font information 1. + * @param ft_info_2 font information 2. + * @return return true if the fonts are equal. + */ +bool lv_font_info_is_equal(const lv_font_info_t * ft_info_1, const lv_font_info_t * ft_info_2); + +/** + * Checks if a font has a static rendering bitmap. + * @param font pointer to a font + * @return return true if the font has a bitmap generated for static rendering. + */ +bool lv_font_has_static_bitmap(const lv_font_t * font); + +/********************** + * MACROS + **********************/ + +#define LV_FONT_DECLARE(font_name) LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_t font_name; + +#if LV_FONT_MONTSERRAT_8 +LV_FONT_DECLARE(lv_font_montserrat_8) +#endif + +#if LV_FONT_MONTSERRAT_10 +LV_FONT_DECLARE(lv_font_montserrat_10) +#endif + +#if LV_FONT_MONTSERRAT_12 +LV_FONT_DECLARE(lv_font_montserrat_12) +#endif + +#if LV_FONT_MONTSERRAT_14 +LV_FONT_DECLARE(lv_font_montserrat_14) +#endif + +#if LV_FONT_MONTSERRAT_16 +LV_FONT_DECLARE(lv_font_montserrat_16) +#endif + +#if LV_FONT_MONTSERRAT_18 +LV_FONT_DECLARE(lv_font_montserrat_18) +#endif + +#if LV_FONT_MONTSERRAT_20 +LV_FONT_DECLARE(lv_font_montserrat_20) +#endif + +#if LV_FONT_MONTSERRAT_22 +LV_FONT_DECLARE(lv_font_montserrat_22) +#endif + +#if LV_FONT_MONTSERRAT_24 +LV_FONT_DECLARE(lv_font_montserrat_24) +#endif + +#if LV_FONT_MONTSERRAT_26 +LV_FONT_DECLARE(lv_font_montserrat_26) +#endif + +#if LV_FONT_MONTSERRAT_28 +LV_FONT_DECLARE(lv_font_montserrat_28) +#endif + +#if LV_FONT_MONTSERRAT_30 +LV_FONT_DECLARE(lv_font_montserrat_30) +#endif + +#if LV_FONT_MONTSERRAT_32 +LV_FONT_DECLARE(lv_font_montserrat_32) +#endif + +#if LV_FONT_MONTSERRAT_34 +LV_FONT_DECLARE(lv_font_montserrat_34) +#endif + +#if LV_FONT_MONTSERRAT_36 +LV_FONT_DECLARE(lv_font_montserrat_36) +#endif + +#if LV_FONT_MONTSERRAT_38 +LV_FONT_DECLARE(lv_font_montserrat_38) +#endif + +#if LV_FONT_MONTSERRAT_40 +LV_FONT_DECLARE(lv_font_montserrat_40) +#endif + +#if LV_FONT_MONTSERRAT_42 +LV_FONT_DECLARE(lv_font_montserrat_42) +#endif + +#if LV_FONT_MONTSERRAT_44 +LV_FONT_DECLARE(lv_font_montserrat_44) +#endif + +#if LV_FONT_MONTSERRAT_46 +LV_FONT_DECLARE(lv_font_montserrat_46) +#endif + +#if LV_FONT_MONTSERRAT_48 +LV_FONT_DECLARE(lv_font_montserrat_48) +#endif + +#if LV_FONT_MONTSERRAT_28_COMPRESSED +LV_FONT_DECLARE(lv_font_montserrat_28_compressed) +#endif + +#if LV_FONT_DEJAVU_16_PERSIAN_HEBREW +LV_FONT_DECLARE(lv_font_dejavu_16_persian_hebrew) +#endif + +#if LV_FONT_SOURCE_HAN_SANS_SC_14_CJK +LV_FONT_DECLARE(lv_font_source_han_sans_sc_14_cjk) +#endif + +#if LV_FONT_SOURCE_HAN_SANS_SC_16_CJK +LV_FONT_DECLARE(lv_font_source_han_sans_sc_16_cjk) +#endif + +#if LV_FONT_UNSCII_8 +LV_FONT_DECLARE(lv_font_unscii_8) +#endif + +#if LV_FONT_UNSCII_16 +LV_FONT_DECLARE(lv_font_unscii_16) +#endif + +/*Declare the custom (user defined) fonts*/ +#ifdef LV_FONT_CUSTOM_DECLARE +LV_FONT_CUSTOM_DECLARE +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FONT_H*/ diff --git a/include/lvgl/font/lv_font_fmt_txt.h b/include/lvgl/font/lv_font_fmt_txt.h new file mode 100644 index 0000000000..014c91a8f0 --- /dev/null +++ b/include/lvgl/font/lv_font_fmt_txt.h @@ -0,0 +1,239 @@ +/** + * @file lv_font_fmt_txt.h + * + */ + +#ifndef LV_FONT_FMT_TXT_H +#define LV_FONT_FMT_TXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_font.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** This describes a glyph.*/ +typedef struct { +#if LV_FONT_FMT_TXT_LARGE == 0 + uint32_t bitmap_index : 20; /**< Start index of the bitmap. A font can be max 1 MB.*/ + uint32_t adv_w : 12; /**< Draw the next glyph after this width. 8.4 format (real_value * 16 is stored).*/ + uint8_t box_w; /**< Width of the glyph's bounding box*/ + uint8_t box_h; /**< Height of the glyph's bounding box*/ + int8_t ofs_x; /**< x offset of the bounding box*/ + int8_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/ +#else + uint32_t bitmap_index; /**< Start index of the bitmap. A font can be max 4 GB.*/ + uint32_t adv_w; /**< Draw the next glyph after this width. 28.4 format (real_value * 16 is stored).*/ + uint16_t box_w; /**< Width of the glyph's bounding box*/ + uint16_t box_h; /**< Height of the glyph's bounding box*/ + int16_t ofs_x; /**< x offset of the bounding box*/ + int16_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/ +#endif +} lv_font_fmt_txt_glyph_dsc_t; + +/** Format of font character map.*/ +typedef enum { + LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL, + LV_FONT_FMT_TXT_CMAP_SPARSE_FULL, + LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY, + LV_FONT_FMT_TXT_CMAP_SPARSE_TINY, +} lv_font_fmt_txt_cmap_type_t; + +/** + * Map codepoints to a `glyph_dsc`s + * Several formats are supported to optimize memory usage + * See https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md + */ +typedef struct { + /** First Unicode character for this range*/ + uint32_t range_start; + + /** Number of Unicode characters related to this range. + * Last Unicode character = range_start + range_length - 1*/ + uint16_t range_length; + + /** First glyph ID (array index of `glyph_dsc`) for this range*/ + uint16_t glyph_id_start; + + /* + According the specification there are 4 formats: + https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md + + For simplicity introduce "relative code point": + rcp = codepoint - range_start + + and a search function: + search a "value" in an "array" and returns the index of "value". + + Format 0 tiny + unicode_list == NULL && glyph_id_ofs_list == NULL + glyph_id = glyph_id_start + rcp + + Format 0 full + unicode_list == NULL && glyph_id_ofs_list != NULL + glyph_id = glyph_id_start + glyph_id_ofs_list[rcp] + + Sparse tiny + unicode_list != NULL && glyph_id_ofs_list == NULL + glyph_id = glyph_id_start + search(unicode_list, rcp) + + Sparse full + unicode_list != NULL && glyph_id_ofs_list != NULL + glyph_id = glyph_id_start + glyph_id_ofs_list[search(unicode_list, rcp)] + */ + + const uint16_t * unicode_list; + + /** if(type == LV_FONT_FMT_TXT_CMAP_FORMAT0_...) it's `uint8_t *` + * if(type == LV_FONT_FMT_TXT_CMAP_SPARSE_...) it's `uint16_t *` + */ + const void * glyph_id_ofs_list; + + /** Length of `unicode_list` and/or `glyph_id_ofs_list`*/ + uint16_t list_length; + + /** Type of this character map*/ + lv_font_fmt_txt_cmap_type_t type; +} lv_font_fmt_txt_cmap_t; + +/** A simple mapping of kern values from pairs*/ +typedef struct { + /*To get a kern value of two code points: + 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t + 2. for(i = 0; i < pair_cnt * 2; i += 2) + if(glyph_ids[i] == glyph_id_left && + glyph_ids[i+1] == glyph_id_right) + return values[i / 2]; + */ + const void * glyph_ids; + const int8_t * values; + uint32_t pair_cnt : 30; + uint32_t glyph_ids_size : 2; /**< 0: `glyph_ids` is stored as `uint8_t`; 1: as `uint16_t` */ +} lv_font_fmt_txt_kern_pair_t; + +/** More complex but more optimal class based kern value storage*/ +typedef struct { + /*To get a kern value of two code points: + 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t + 2. Get the class of the left and right glyphs as `left_class` and `right_class` + left_class = left_class_mapping[glyph_id_left]; + right_class = right_class_mapping[glyph_id_right]; + 3. value = class_pair_values[(left_class-1)*right_class_cnt + (right_class-1)] + */ + + const int8_t * class_pair_values; /**< left_class_cnt * right_class_cnt value */ + const uint8_t * left_class_mapping; /**< Map the glyph_ids to classes: index -> glyph_id -> class_id */ + const uint8_t * right_class_mapping; /**< Map the glyph_ids to classes: index -> glyph_id -> class_id */ + uint8_t left_class_cnt; + uint8_t right_class_cnt; +} lv_font_fmt_txt_kern_classes_t; + +/** Bitmap formats*/ +typedef enum { + LV_FONT_FMT_TXT_PLAIN = 0, + LV_FONT_FMT_TXT_COMPRESSED = 1, + LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER = 2, +} lv_font_fmt_txt_bitmap_format_t; + +/** Describe store for additional data for fonts */ +typedef struct { + /** The bitmaps of all glyphs */ + const uint8_t * glyph_bitmap; + + /** Describe the glyphs */ + const lv_font_fmt_txt_glyph_dsc_t * glyph_dsc; + + /** Map the glyphs to Unicode characters. + *Array of `lv_font_cmap_fmt_txt_t` variables */ + const lv_font_fmt_txt_cmap_t * cmaps; + + /** + * Store kerning values. + * Can be `lv_font_fmt_txt_kern_pair_t * or `lv_font_kern_classes_fmt_txt_t *` + * depending on `kern_classes` + */ + const void * kern_dsc; + + /** Scale kern values in 12.4 format */ + uint16_t kern_scale; + + /** Number of cmap tables */ + uint16_t cmap_num : 9; + + /** Bit per pixel: 1, 2, 3, 4, 8 */ + uint16_t bpp : 4; + + /** Type of `kern_dsc` */ + uint16_t kern_classes : 1; + + /** + * storage format of the bitmap + * from `lv_font_fmt_txt_bitmap_format_t` + */ + uint16_t bitmap_format : 2; + + /** + * Bytes to which each line is padded. + * 0: means no align and padding + * 1: e.g. with bpp=4 lines are aligned to 1 byte, so there can be a 4 bits of padding + * 4, 8, 16, 32, 64: each line is padded to the given byte boundaries + */ + uint8_t stride; +} lv_font_fmt_txt_dsc_t; + +typedef struct { + const lv_font_t * font_p; /**< Pointer to built-in font*/ + uint32_t size; /** < Size of the built-in font*/ +} lv_builtin_font_src_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_builtin_font_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Used as `get_glyph_bitmap` callback in lvgl's native font format if the font is uncompressed. + * @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index and format. + * @param draw_buf a draw buffer that can be used to store the bitmap of the glyph, it's OK not to use it. + * @return pointer to an A8 bitmap (not necessarily bitmap_out) or NULL if `unicode_letter` not found + */ +const void * lv_font_get_bitmap_fmt_txt(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf); + +/** + * Used as `get_glyph_dsc` callback in lvgl's native font format if the font is uncompressed. + * @param font pointer to font + * @param dsc_out store the result descriptor here + * @param unicode_letter a UNICODE letter code + * @param unicode_letter_next the unicode letter succeeding the letter under test + * @return true: descriptor is successfully loaded into `dsc_out`. + * false: the letter was not found, no data is loaded to `dsc_out` + */ +bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, + uint32_t unicode_letter_next); + +/********************** + * MACROS + **********************/ + +/********************** + * ADD BUILT IN FONTS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FONT_FMT_TXT_H*/ diff --git a/include/lvgl/font/lv_font_manager.h b/include/lvgl/font/lv_font_manager.h new file mode 100755 index 0000000000..66d68e8a79 --- /dev/null +++ b/include/lvgl/font/lv_font_manager.h @@ -0,0 +1,115 @@ +/** + * @file lv_font_manager.h + * + */ +#ifndef LV_FONT_MANAGER_H +#define LV_FONT_MANAGER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_font.h" + +#if LV_USE_FONT_MANAGER + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create main font manager. + * @param recycle_cache_size number of fonts that were recently deleted from the cache. + * @return pointer to main font manager. + */ +lv_font_manager_t * lv_font_manager_create(uint32_t recycle_cache_size); + +/** + * Delete main font manager. + * @param manager pointer to main font manager. + * @return return true if the deletion was successful. + */ +bool lv_font_manager_delete(lv_font_manager_t * manager); + +/** + * Add font resource. + * @param manager pointer to main font manager. + * @param name font name. + * @param src font source. Need to strictly correspond to the font class. + * @param class_p font class. eg. lv_freetype_font_class, lv_builtin_font_class. + * @return return true if the add was successful. + */ +bool lv_font_manager_add_src(lv_font_manager_t * manager, + const char * name, + const void * src, + const lv_font_class_t * class_p); + +/** + * Add font resource with static memory. + * @param manager pointer to main font manager. + * @param name font name. It cannot be a local variable. + * @param src font source. Need to strictly correspond to the font class. And it cannot be a local variable. + * @param class_p font class. E.g. lv_freetype_font_class, lv_builtin_font_class. + * @return return true if the add was successful. + */ +bool lv_font_manager_add_src_static(lv_font_manager_t * manager, + const char * name, + const void * src, + const lv_font_class_t * class_p); + +/** + * Remove font resource. + * @param manager pointer to main font manager. + * @param name font name. + * @return return true if the remove was successful. + */ +bool lv_font_manager_remove_src(lv_font_manager_t * manager, const char * name); + +/** + * Create font. + * @param manager pointer to main font manager. + * @param font_family font family name. Matches the font resource name, using commas to separate different names. E.g. "my_font_1,my_font_2". + * @param render_mode font render mode. see `lv_freetype_font_render_mode_t`. + * @param size font size in pixel. + * @param style font style. see `lv_freetype_font_style_t`. + * @param kerning kerning mode. see `lv_font_kerning_t`. + * @return point to the created font. + */ +lv_font_t * lv_font_manager_create_font(lv_font_manager_t * manager, + const char * font_family, + uint32_t render_mode, + uint32_t size, + uint32_t style, + lv_font_kerning_t kerning); + +/** + * Delete font. + * @param manager pointer to main font manager. + * @param font point to the font. + * @return return true if the deletion was successful. + */ +void lv_font_manager_delete_font(lv_font_manager_t * manager, lv_font_t * font); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_FONT_MANAGER */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_FONT_MANAGER_H */ diff --git a/include/lvgl/font/lv_freetype.h b/include/lvgl/font/lv_freetype.h new file mode 100755 index 0000000000..aecf81abf2 --- /dev/null +++ b/include/lvgl/font/lv_freetype.h @@ -0,0 +1,148 @@ +/** + * @file lv_freetype.h + * + */ +#ifndef LV_FREETYPE_H +#define LV_FREETYPE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_FREETYPE + +#include "../lv_types.h" +#include "../core/lv_event.h" +#include "../draw/lv_color.h" + +#include LV_STDBOOL_INCLUDE + +/********************* +* DEFINES +*********************/ + +#define LV_FREETYPE_F26DOT6_TO_INT(x) ((x) >> 6) +#define LV_FREETYPE_F26DOT6_TO_FLOAT(x) ((float)(x) / 64) + +#define FT_FONT_STYLE_NORMAL LV_FREETYPE_FONT_STYLE_NORMAL +#define FT_FONT_STYLE_ITALIC LV_FREETYPE_FONT_STYLE_ITALIC +#define FT_FONT_STYLE_BOLD LV_FREETYPE_FONT_STYLE_BOLD + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_FREETYPE_FONT_STYLE_NORMAL = 0, + LV_FREETYPE_FONT_STYLE_ITALIC = 1 << 0, + LV_FREETYPE_FONT_STYLE_BOLD = 1 << 1, +} lv_freetype_font_style_t; + +typedef lv_freetype_font_style_t LV_FT_FONT_STYLE; + +typedef enum { + LV_FREETYPE_FONT_RENDER_MODE_BITMAP = 0, + LV_FREETYPE_FONT_RENDER_MODE_OUTLINE = 1, +} lv_freetype_font_render_mode_t; + +typedef void * lv_freetype_outline_t; + +typedef enum { + LV_FREETYPE_OUTLINE_END, + LV_FREETYPE_OUTLINE_MOVE_TO, + LV_FREETYPE_OUTLINE_LINE_TO, + LV_FREETYPE_OUTLINE_CUBIC_TO, + LV_FREETYPE_OUTLINE_CONIC_TO, +} lv_freetype_outline_type_t; + +/* Only path string is required */ +typedef const char lv_freetype_font_src_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_freetype_font_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the freetype library. + * @return LV_RESULT_OK on success, otherwise LV_RESULT_INVALID. + */ +lv_result_t lv_freetype_init(uint32_t max_glyph_cnt); + +/** + * Uninitialize the freetype library + */ +void lv_freetype_uninit(void); + +/** + * Initialize a font info structure. + * @param font_info font info structure to be initialized. + */ +void lv_freetype_init_font_info(lv_font_info_t * font_info); + +/** + * Create a freetype font with a font info structure. + * @param font_info font info structure. + * @return Created font, or NULL on failure. + */ +lv_font_t * lv_freetype_font_create_with_info(const lv_font_info_t * font_info); + +/** + * Create a freetype font. + * @param pathname font file path. + * @param render_mode font render mode(see @lv_freetype_font_render_mode_t for details). + * @param size font size. + * @param style font style(see lv_freetype_font_style_t for details). + * @return Created font, or NULL on failure. + */ +lv_font_t * lv_freetype_font_create(const char * pathname, lv_freetype_font_render_mode_t render_mode, uint32_t size, + lv_freetype_font_style_t style); + +/** + * Delete a freetype font. + * @param font freetype font to be deleted. + */ +void lv_freetype_font_delete(lv_font_t * font); + +/** + * Register a callback function to generate outlines for FreeType fonts. + * + * @param cb The callback function to be registered. + * @param user_data User data to be passed to the callback function. + * @return The ID of the registered callback function, or a negative value on failure. + */ +void lv_freetype_outline_add_event(lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); + +/** + * Get the scale of a FreeType font. + * + * @param font The FreeType font to get the scale of. + * @return The scale of the FreeType font. + */ +uint32_t lv_freetype_outline_get_scale(const lv_font_t * font); + +/** + * Check if the font is an outline font. + * + * @param font The FreeType font. + * @return Is outline font on success, otherwise false. + */ +bool lv_freetype_is_outline_font(const lv_font_t * font); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_FREETYPE*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV_FREETYPE_H */ diff --git a/include/lvgl/font/lv_imgfont.h b/include/lvgl/font/lv_imgfont.h new file mode 100644 index 0000000000..9cb90ee69b --- /dev/null +++ b/include/lvgl/font/lv_imgfont.h @@ -0,0 +1,63 @@ +/** + * @file lv_imgfont.h + * + */ + +#ifndef LV_IMGFONT_H +#define LV_IMGFONT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "lv_font.h" + +#if LV_USE_IMGFONT + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/* gets the image path name of this character */ +typedef const void * (*lv_imgfont_get_path_cb_t)(const lv_font_t * font, + uint32_t unicode, uint32_t unicode_next, + int32_t * offset_y, void * user_data); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Creates a image font with info parameter specified. + * @param height font size + * @param path_cb a function to get the image path name of character. + * @param user_data pointer to user data + * @return pointer to the new imgfont or NULL if create error. + */ +lv_font_t * lv_imgfont_create(uint16_t height, lv_imgfont_get_path_cb_t path_cb, void * user_data); + +/** + * Destroy a image font that has been created. + * @param font pointer to image font handle. + */ +void lv_imgfont_destroy(lv_font_t * font); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_IMGFONT*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_IMGFONT_H */ diff --git a/include/lvgl/font/lv_symbol_def.h b/include/lvgl/font/lv_symbol_def.h new file mode 100644 index 0000000000..a46e3aa284 --- /dev/null +++ b/include/lvgl/font/lv_symbol_def.h @@ -0,0 +1,357 @@ +/** + * @file lv_symbol_def.h + * + */ + +#ifndef LV_SYMBOL_DEF_H +#define LV_SYMBOL_DEF_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "../config/lv_conf_internal.h" + +/*------------------------------- + * Symbols from "normal" font + *-----------------------------*/ +#if !defined LV_SYMBOL_BULLET +#define LV_SYMBOL_BULLET "\xE2\x80\xA2" /*20042, 0x2022*/ +#endif + +/*------------------------------- + * Symbols from FontAwesome font + *-----------------------------*/ + +/*In the font converter use this list as range: + 61441, 61448, 61451, 61452, 61453, 61457, 61459, 61461, 61465, 61468, + 61473, 61478, 61479, 61480, 61502, 61507, 61512, 61515, 61516, 61517, + 61521, 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556, + 61559, 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61641, + 61664, 61671, 61674, 61683, 61724, 61732, 61787, 61931, 62016, 62017, + 62018, 62019, 62020, 62087, 62099, 62189, 62212, 62810, 63426, 63650 +*/ + +/* These symbols can be predefined in the lv_conf.h file. + * If they are not predefined, they will use the following values + */ + +#if !defined LV_SYMBOL_AUDIO +#define LV_SYMBOL_AUDIO "\xEF\x80\x81" /*61441, 0xF001*/ +#endif + +#if !defined LV_SYMBOL_VIDEO +#define LV_SYMBOL_VIDEO "\xEF\x80\x88" /*61448, 0xF008*/ +#endif + +#if !defined LV_SYMBOL_LIST +#define LV_SYMBOL_LIST "\xEF\x80\x8B" /*61451, 0xF00B*/ +#endif + +#if !defined LV_SYMBOL_OK +#define LV_SYMBOL_OK "\xEF\x80\x8C" /*61452, 0xF00C*/ +#endif + +#if !defined LV_SYMBOL_CLOSE +#define LV_SYMBOL_CLOSE "\xEF\x80\x8D" /*61453, 0xF00D*/ +#endif + +#if !defined LV_SYMBOL_POWER +#define LV_SYMBOL_POWER "\xEF\x80\x91" /*61457, 0xF011*/ +#endif + +#if !defined LV_SYMBOL_SETTINGS +#define LV_SYMBOL_SETTINGS "\xEF\x80\x93" /*61459, 0xF013*/ +#endif + +#if !defined LV_SYMBOL_HOME +#define LV_SYMBOL_HOME "\xEF\x80\x95" /*61461, 0xF015*/ +#endif + +#if !defined LV_SYMBOL_DOWNLOAD +#define LV_SYMBOL_DOWNLOAD "\xEF\x80\x99" /*61465, 0xF019*/ +#endif + +#if !defined LV_SYMBOL_DRIVE +#define LV_SYMBOL_DRIVE "\xEF\x80\x9C" /*61468, 0xF01C*/ +#endif + +#if !defined LV_SYMBOL_REFRESH +#define LV_SYMBOL_REFRESH "\xEF\x80\xA1" /*61473, 0xF021*/ +#endif + +#if !defined LV_SYMBOL_MUTE +#define LV_SYMBOL_MUTE "\xEF\x80\xA6" /*61478, 0xF026*/ +#endif + +#if !defined LV_SYMBOL_VOLUME_MID +#define LV_SYMBOL_VOLUME_MID "\xEF\x80\xA7" /*61479, 0xF027*/ +#endif + +#if !defined LV_SYMBOL_VOLUME_MAX +#define LV_SYMBOL_VOLUME_MAX "\xEF\x80\xA8" /*61480, 0xF028*/ +#endif + +#if !defined LV_SYMBOL_IMAGE +#define LV_SYMBOL_IMAGE "\xEF\x80\xBE" /*61502, 0xF03E*/ +#endif + +#if !defined LV_SYMBOL_TINT +#define LV_SYMBOL_TINT "\xEF\x81\x83" /*61507, 0xF043*/ +#endif + +#if !defined LV_SYMBOL_PREV +#define LV_SYMBOL_PREV "\xEF\x81\x88" /*61512, 0xF048*/ +#endif + +#if !defined LV_SYMBOL_PLAY +#define LV_SYMBOL_PLAY "\xEF\x81\x8B" /*61515, 0xF04B*/ +#endif + +#if !defined LV_SYMBOL_PAUSE +#define LV_SYMBOL_PAUSE "\xEF\x81\x8C" /*61516, 0xF04C*/ +#endif + +#if !defined LV_SYMBOL_STOP +#define LV_SYMBOL_STOP "\xEF\x81\x8D" /*61517, 0xF04D*/ +#endif + +#if !defined LV_SYMBOL_NEXT +#define LV_SYMBOL_NEXT "\xEF\x81\x91" /*61521, 0xF051*/ +#endif + +#if !defined LV_SYMBOL_EJECT +#define LV_SYMBOL_EJECT "\xEF\x81\x92" /*61522, 0xF052*/ +#endif + +#if !defined LV_SYMBOL_LEFT +#define LV_SYMBOL_LEFT "\xEF\x81\x93" /*61523, 0xF053*/ +#endif + +#if !defined LV_SYMBOL_RIGHT +#define LV_SYMBOL_RIGHT "\xEF\x81\x94" /*61524, 0xF054*/ +#endif + +#if !defined LV_SYMBOL_PLUS +#define LV_SYMBOL_PLUS "\xEF\x81\xA7" /*61543, 0xF067*/ +#endif + +#if !defined LV_SYMBOL_MINUS +#define LV_SYMBOL_MINUS "\xEF\x81\xA8" /*61544, 0xF068*/ +#endif + +#if !defined LV_SYMBOL_EYE_OPEN +#define LV_SYMBOL_EYE_OPEN "\xEF\x81\xAE" /*61550, 0xF06E*/ +#endif + +#if !defined LV_SYMBOL_EYE_CLOSE +#define LV_SYMBOL_EYE_CLOSE "\xEF\x81\xB0" /*61552, 0xF070*/ +#endif + +#if !defined LV_SYMBOL_WARNING +#define LV_SYMBOL_WARNING "\xEF\x81\xB1" /*61553, 0xF071*/ +#endif + +#if !defined LV_SYMBOL_SHUFFLE +#define LV_SYMBOL_SHUFFLE "\xEF\x81\xB4" /*61556, 0xF074*/ +#endif + +#if !defined LV_SYMBOL_UP +#define LV_SYMBOL_UP "\xEF\x81\xB7" /*61559, 0xF077*/ +#endif + +#if !defined LV_SYMBOL_DOWN +#define LV_SYMBOL_DOWN "\xEF\x81\xB8" /*61560, 0xF078*/ +#endif + +#if !defined LV_SYMBOL_LOOP +#define LV_SYMBOL_LOOP "\xEF\x81\xB9" /*61561, 0xF079*/ +#endif + +#if !defined LV_SYMBOL_DIRECTORY +#define LV_SYMBOL_DIRECTORY "\xEF\x81\xBB" /*61563, 0xF07B*/ +#endif + +#if !defined LV_SYMBOL_UPLOAD +#define LV_SYMBOL_UPLOAD "\xEF\x82\x93" /*61587, 0xF093*/ +#endif + +#if !defined LV_SYMBOL_CALL +#define LV_SYMBOL_CALL "\xEF\x82\x95" /*61589, 0xF095*/ +#endif + +#if !defined LV_SYMBOL_CUT +#define LV_SYMBOL_CUT "\xEF\x83\x84" /*61636, 0xF0C4*/ +#endif + +#if !defined LV_SYMBOL_COPY +#define LV_SYMBOL_COPY "\xEF\x83\x85" /*61637, 0xF0C5*/ +#endif + +#if !defined LV_SYMBOL_SAVE +#define LV_SYMBOL_SAVE "\xEF\x83\x87" /*61639, 0xF0C7*/ +#endif + +#if !defined LV_SYMBOL_BARS +#define LV_SYMBOL_BARS "\xEF\x83\x89" /*61641, 0xF0C9*/ +#endif + +#if !defined LV_SYMBOL_ENVELOPE +#define LV_SYMBOL_ENVELOPE "\xEF\x83\xA0" /*61664, 0xF0E0*/ +#endif + +#if !defined LV_SYMBOL_CHARGE +#define LV_SYMBOL_CHARGE "\xEF\x83\xA7" /*61671, 0xF0E7*/ +#endif + +#if !defined LV_SYMBOL_PASTE +#define LV_SYMBOL_PASTE "\xEF\x83\xAA" /*61674, 0xF0EA*/ +#endif + +#if !defined LV_SYMBOL_BELL +#define LV_SYMBOL_BELL "\xEF\x83\xB3" /*61683, 0xF0F3*/ +#endif + +#if !defined LV_SYMBOL_KEYBOARD +#define LV_SYMBOL_KEYBOARD "\xEF\x84\x9C" /*61724, 0xF11C*/ +#endif + +#if !defined LV_SYMBOL_GPS +#define LV_SYMBOL_GPS "\xEF\x84\xA4" /*61732, 0xF124*/ +#endif + +#if !defined LV_SYMBOL_FILE +#define LV_SYMBOL_FILE "\xEF\x85\x9B" /*61787, 0xF158*/ +#endif + +#if !defined LV_SYMBOL_WIFI +#define LV_SYMBOL_WIFI "\xEF\x87\xAB" /*61931, 0xF1EB*/ +#endif + +#if !defined LV_SYMBOL_BATTERY_FULL +#define LV_SYMBOL_BATTERY_FULL "\xEF\x89\x80" /*62016, 0xF240*/ +#endif + +#if !defined LV_SYMBOL_BATTERY_3 +#define LV_SYMBOL_BATTERY_3 "\xEF\x89\x81" /*62017, 0xF241*/ +#endif + +#if !defined LV_SYMBOL_BATTERY_2 +#define LV_SYMBOL_BATTERY_2 "\xEF\x89\x82" /*62018, 0xF242*/ +#endif + +#if !defined LV_SYMBOL_BATTERY_1 +#define LV_SYMBOL_BATTERY_1 "\xEF\x89\x83" /*62019, 0xF243*/ +#endif + +#if !defined LV_SYMBOL_BATTERY_EMPTY +#define LV_SYMBOL_BATTERY_EMPTY "\xEF\x89\x84" /*62020, 0xF244*/ +#endif + +#if !defined LV_SYMBOL_USB +#define LV_SYMBOL_USB "\xEF\x8a\x87" /*62087, 0xF287*/ +#endif + +#if !defined LV_SYMBOL_BLUETOOTH +#define LV_SYMBOL_BLUETOOTH "\xEF\x8a\x93" /*62099, 0xF293*/ +#endif + +#if !defined LV_SYMBOL_TRASH +#define LV_SYMBOL_TRASH "\xEF\x8B\xAD" /*62189, 0xF2ED*/ +#endif + +#if !defined LV_SYMBOL_EDIT +#define LV_SYMBOL_EDIT "\xEF\x8C\x84" /*62212, 0xF304*/ +#endif + +#if !defined LV_SYMBOL_BACKSPACE +#define LV_SYMBOL_BACKSPACE "\xEF\x95\x9A" /*62810, 0xF55A*/ +#endif + +#if !defined LV_SYMBOL_SD_CARD +#define LV_SYMBOL_SD_CARD "\xEF\x9F\x82" /*63426, 0xF7C2*/ +#endif + +#if !defined LV_SYMBOL_NEW_LINE +#define LV_SYMBOL_NEW_LINE "\xEF\xA2\xA2" /*63650, 0xF8A2*/ +#endif + +#if !defined LV_SYMBOL_DUMMY +/** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will show it as a label*/ +#define LV_SYMBOL_DUMMY "\xEF\xA3\xBF" +#endif + +/* + * The following list is generated using + * cat src/font/lv_symbol_def.h | sed -E -n 's/^#define\s+LV_(SYMBOL_\w+).*".*$/ LV_STR_\1,/p' + */ +enum _lv_str_symbol_id_t { + LV_STR_SYMBOL_BULLET, + LV_STR_SYMBOL_AUDIO, + LV_STR_SYMBOL_VIDEO, + LV_STR_SYMBOL_LIST, + LV_STR_SYMBOL_OK, + LV_STR_SYMBOL_CLOSE, + LV_STR_SYMBOL_POWER, + LV_STR_SYMBOL_SETTINGS, + LV_STR_SYMBOL_HOME, + LV_STR_SYMBOL_DOWNLOAD, + LV_STR_SYMBOL_DRIVE, + LV_STR_SYMBOL_REFRESH, + LV_STR_SYMBOL_MUTE, + LV_STR_SYMBOL_VOLUME_MID, + LV_STR_SYMBOL_VOLUME_MAX, + LV_STR_SYMBOL_IMAGE, + LV_STR_SYMBOL_TINT, + LV_STR_SYMBOL_PREV, + LV_STR_SYMBOL_PLAY, + LV_STR_SYMBOL_PAUSE, + LV_STR_SYMBOL_STOP, + LV_STR_SYMBOL_NEXT, + LV_STR_SYMBOL_EJECT, + LV_STR_SYMBOL_LEFT, + LV_STR_SYMBOL_RIGHT, + LV_STR_SYMBOL_PLUS, + LV_STR_SYMBOL_MINUS, + LV_STR_SYMBOL_EYE_OPEN, + LV_STR_SYMBOL_EYE_CLOSE, + LV_STR_SYMBOL_WARNING, + LV_STR_SYMBOL_SHUFFLE, + LV_STR_SYMBOL_UP, + LV_STR_SYMBOL_DOWN, + LV_STR_SYMBOL_LOOP, + LV_STR_SYMBOL_DIRECTORY, + LV_STR_SYMBOL_UPLOAD, + LV_STR_SYMBOL_CALL, + LV_STR_SYMBOL_CUT, + LV_STR_SYMBOL_COPY, + LV_STR_SYMBOL_SAVE, + LV_STR_SYMBOL_BARS, + LV_STR_SYMBOL_ENVELOPE, + LV_STR_SYMBOL_CHARGE, + LV_STR_SYMBOL_PASTE, + LV_STR_SYMBOL_BELL, + LV_STR_SYMBOL_KEYBOARD, + LV_STR_SYMBOL_GPS, + LV_STR_SYMBOL_FILE, + LV_STR_SYMBOL_WIFI, + LV_STR_SYMBOL_BATTERY_FULL, + LV_STR_SYMBOL_BATTERY_3, + LV_STR_SYMBOL_BATTERY_2, + LV_STR_SYMBOL_BATTERY_1, + LV_STR_SYMBOL_BATTERY_EMPTY, + LV_STR_SYMBOL_USB, + LV_STR_SYMBOL_BLUETOOTH, + LV_STR_SYMBOL_TRASH, + LV_STR_SYMBOL_EDIT, + LV_STR_SYMBOL_BACKSPACE, + LV_STR_SYMBOL_SD_CARD, + LV_STR_SYMBOL_NEW_LINE, + LV_STR_SYMBOL_DUMMY, +}; + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SYMBOL_DEF_H*/ diff --git a/include/lvgl/font/lv_text.h b/include/lvgl/font/lv_text.h new file mode 100644 index 0000000000..6bc10383bf --- /dev/null +++ b/include/lvgl/font/lv_text.h @@ -0,0 +1,151 @@ +/** + * @file lv_text.h + * + */ + +#ifndef LV_TEXT_H +#define LV_TEXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" +#include "../core/lv_area.h" +#include "lv_font.h" +#include "../stdlib/lv_sprintf.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Options for text rendering. + */ +typedef enum { + LV_TEXT_FLAG_NONE = 0x00, + + /** Ignore max-width to avoid automatic word wrapping*/ + LV_TEXT_FLAG_EXPAND = 0x01, + + /** Max-width is already equal to the longest line. (Used to skip some calculation)*/ + LV_TEXT_FLAG_FIT = 0x02, + + /** To prevent overflow, insert breaks between any two characters. + * Otherwise breaks are inserted at word boundaries, as configured via LV_TXT_BREAK_CHARS + * or according to LV_TXT_LINE_BREAK_LONG_LEN, LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN, + * and LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN.*/ + LV_TEXT_FLAG_BREAK_ALL = 0x04, + + /**Enable parsing of recolor command*/ + LV_TEXT_FLAG_RECOLOR = 0x08, + +} lv_text_flag_t; + +/** Label align policy*/ +typedef enum { + LV_TEXT_ALIGN_AUTO, /**< Align text auto*/ + LV_TEXT_ALIGN_LEFT, /**< Align text to left*/ + LV_TEXT_ALIGN_CENTER, /**< Align text to center*/ + LV_TEXT_ALIGN_RIGHT, /**< Align text to right*/ +} lv_text_align_t; + +/**Text leading trim mode (similar to CSS text-box-trim / text-box-edge) + * using more intuitive naming. + * See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/text-box-edge*/ +typedef enum { + + /** No trimming (default behavior)*/ + LV_TEXT_LEADING_TRIM_NONE = 0, + + /** Trim to the top of the capital letters (cap height) + * and the bottom to the (alphabetic) baseline*/ + LV_TEXT_LEADING_TRIM_CAPITAL_BASELINE, + + /** Trim to the top of the lower case letters (x-height) + * and the bottom to the (alphabetic) baseline*/ + LV_TEXT_LEADING_TRIM_LOWER_BASELINE, + + /**< Trim only the top to the height of the capital letters (cap-height)*/ + LV_TEXT_LEADING_TRIM_CAPITAL, + + /**< Trim only the top to the height of the lower case letters (x-height)*/ + LV_TEXT_LEADING_TRIM_LOWER, + +} lv_text_leading_trim_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Get the number of pixels to trim from the top of text for a given + * leading-trim mode. + * @param font pointer to a font + * @param trim leading-trim mode + * @return pixels to trim from the top (0 if no trimming) + */ +static inline int32_t lv_font_get_top_trim(const lv_font_t * font, + lv_text_leading_trim_t trim) +{ + switch(trim) { + case LV_TEXT_LEADING_TRIM_CAPITAL_BASELINE: + case LV_TEXT_LEADING_TRIM_CAPITAL: + return (font->line_height - font->base_line) - font->cap_height; + case LV_TEXT_LEADING_TRIM_LOWER_BASELINE: + case LV_TEXT_LEADING_TRIM_LOWER: + return (font->line_height - font->base_line) - font->x_height; + default: + return 0; + } +} + +/** + * Get the number of pixels to trim from the bottom of text for a given + * leading-trim mode. + * @param font pointer to a font + * @param trim leading-trim mode + * @return pixels to trim from the bottom (0 if no trimming) + */ +static inline int32_t lv_font_get_bottom_trim(const lv_font_t * font, + lv_text_leading_trim_t trim) +{ + switch(trim) { + case LV_TEXT_LEADING_TRIM_CAPITAL_BASELINE: + case LV_TEXT_LEADING_TRIM_LOWER_BASELINE: + return font->base_line; + default: + return 0; + } +} + +/** + * Get size of a text + * @param size_res pointer to a 'point_t' variable to store the result + * @param text pointer to a text + * @param font pointer to font of the text + * @param letter_space letter space of the text + * @param line_space line space of the text + * @param max_width max width of the text (break the lines to fit this size). Set COORD_MAX to avoid + * @param flag settings for the text from ::lv_text_flag_t + */ +void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, int32_t letter_space, + int32_t line_space, int32_t max_width, lv_text_flag_t flag); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEXT_H*/ diff --git a/include/lvgl/font/lv_tiny_ttf.h b/include/lvgl/font/lv_tiny_ttf.h new file mode 100644 index 0000000000..ddb63a13f7 --- /dev/null +++ b/include/lvgl/font/lv_tiny_ttf.h @@ -0,0 +1,109 @@ +/** + * @file lv_tiny_ttf.h + * + */ + +#ifndef LV_TINY_TTF_H +#define LV_TINY_TTF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_TINY_TTF + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + const char * path; /**< Path to the font file*/ + const void * data; /**< Pointer to the font data*/ + size_t data_size; /**< Size of the font data*/ + size_t cache_size; /**< Size of the font cache*/ +} lv_tiny_ttf_font_src_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_tiny_ttf_font_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +#if LV_TINY_TTF_FILE_SUPPORT != 0 +/** + * Create a font from the specified file or path with the specified line height. + * @param path the path or file name of the font + * @param font_size the font size in pixel + * @return a font object + */ +lv_font_t * lv_tiny_ttf_create_file(const char * path, int32_t font_size); + +/** + * Create a font from the specified file or path with the specified line height with the specified cache size. + * @param path the path or file name of the font + * @param font_size the font size in pixel + * @param kerning kerning value in pixel + * @param cache_size the cache size in count + * @return a font object + */ +lv_font_t * lv_tiny_ttf_create_file_ex(const char * path, int32_t font_size, lv_font_kerning_t kerning, + size_t cache_size); +#endif + +/** + * Create a font from the specified data pointer with the specified line height. + * @param data the data pointer + * @param data_size the data size + * @param font_size the font size in pixel + * @return a font object + */ +lv_font_t * lv_tiny_ttf_create_data(const void * data, size_t data_size, int32_t font_size); + +/** + * Create a font from the specified data pointer with the specified line height and the specified cache size. + * @param data the data pointer + * @param data_size the data size + * @param font_size the font size in pixel + * @param kerning kerning value in pixel + * @param cache_size the cache size in count + * @return + */ +lv_font_t * lv_tiny_ttf_create_data_ex(const void * data, size_t data_size, int32_t font_size, + lv_font_kerning_t kerning, size_t cache_size); + +/** + * Set the size of the font to a new font_size + * @note the font bitmap cache and glyph cache will be flushed. + * @param font the font object + * @param font_size the font size in pixel + */ +void lv_tiny_ttf_set_size(lv_font_t * font, int32_t font_size); + +/** + * Destroy a font previously created with lv_tiny_ttf_create_xxxx() + * @param font the font object + */ +void lv_tiny_ttf_destroy(lv_font_t * font); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TINY_TTF*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TINY_TTF_H*/ diff --git a/include/lvgl/fs/lv_fs.h b/include/lvgl/fs/lv_fs.h new file mode 100644 index 0000000000..dd143bac8d --- /dev/null +++ b/include/lvgl/fs/lv_fs.h @@ -0,0 +1,344 @@ +/** + * @file lv_fs.h + * + */ + +#ifndef LV_FS_H +#define LV_FS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ +#define LV_FS_MAX_FN_LENGTH 64 +#define LV_FS_MAX_PATH_LENGTH 256 + +#define LV_FS_CACHE_FROM_BUFFER UINT32_MAX + +/********************** + * TYPEDEFS + **********************/ + +/** + * Errors in the file system module. + */ +typedef enum { + LV_FS_RES_OK = 0, + LV_FS_RES_HW_ERR, /*Low level hardware error*/ + LV_FS_RES_FS_ERR, /*Error in the file system structure*/ + LV_FS_RES_NOT_EX, /*Driver, file or directory is not exists*/ + LV_FS_RES_FULL, /*Disk full*/ + LV_FS_RES_LOCKED, /*The file is already opened*/ + LV_FS_RES_DENIED, /*Access denied. Check 'fs_open' modes and write protect*/ + LV_FS_RES_BUSY, /*The file system now can't handle it, try later*/ + LV_FS_RES_TOUT, /*Process time outed*/ + LV_FS_RES_NOT_IMP, /*Requested function is not implemented*/ + LV_FS_RES_OUT_OF_MEM, /*Not enough memory for an internal operation*/ + LV_FS_RES_INV_PARAM, /*Invalid parameter among arguments*/ + LV_FS_RES_DRIVE_LETTER_ALREADY_USED, /*A drive with this letter is already registered*/ + LV_FS_RES_UNKNOWN, /*Other unknown error*/ +} lv_fs_res_t; + +/** + * File open mode. + */ +typedef enum { + LV_FS_MODE_WR = 0x01, + LV_FS_MODE_RD = 0x02, +} lv_fs_mode_t; + +/** + * Seek modes. + */ +typedef enum { + LV_FS_SEEK_SET = 0x00, /**< Set the position from absolutely (from the start of file)*/ + LV_FS_SEEK_CUR = 0x01, /**< Set the position from the current position*/ + LV_FS_SEEK_END = 0x02, /**< Set the position from the end of the file*/ +} lv_fs_whence_t; + +struct _lv_fs_drv_t; +typedef struct _lv_fs_drv_t lv_fs_drv_t; +struct _lv_fs_drv_t { + char letter; + uint32_t cache_size; + bool (*ready_cb)(lv_fs_drv_t * drv); + + void(*remove_cb)(lv_fs_drv_t * drv); /*Optional*/ + + void * (*open_cb)(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode); + lv_fs_res_t (*close_cb)(lv_fs_drv_t * drv, void * file_p); + lv_fs_res_t (*read_cb)(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br); + lv_fs_res_t (*write_cb)(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw); + lv_fs_res_t (*seek_cb)(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence); + lv_fs_res_t (*tell_cb)(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p); + + void * (*dir_open_cb)(lv_fs_drv_t * drv, const char * path); + lv_fs_res_t (*dir_read_cb)(lv_fs_drv_t * drv, void * rddir_p, char * fn, uint32_t fn_len); + lv_fs_res_t (*dir_close_cb)(lv_fs_drv_t * drv, void * rddir_p); + + void * user_data; /**< Custom file user data*/ +}; + +typedef struct { + void * file_d; + lv_fs_drv_t * drv; + lv_fs_file_cache_t * cache; +} lv_fs_file_t; + + +typedef struct { + void * dir_d; + lv_fs_drv_t * drv; +} lv_fs_dir_t; + + +/** Extended path object to specify buffer for memory-mapped files */ +typedef struct { + char path[64]; /**< Store the driver letter address and size*/ +} lv_fs_path_ex_t; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a file system driver with default values. + * It is used to ensure all fields have known values and not memory junk. + * After it you can set the fields. + * @param drv pointer to driver variable to initialize + */ +void lv_fs_drv_init(lv_fs_drv_t * drv); + +/** + * Add a new drive + * @param drv pointer to an lv_fs_drv_t structure which is inited with the + * corresponding function pointers. Only pointer is saved, so the + * driver should be static or dynamically allocated. + */ +void lv_fs_drv_register(lv_fs_drv_t * drv); + +/** + * Give a pointer to a driver from its letter + * @param letter the driver-identifier letter + * @return pointer to a driver or NULL if not found + */ +lv_fs_drv_t * lv_fs_get_drv(char letter); + +/** + * Remove a drive and call its remove function if available + * @param letter letter identifier of the drive to remove + */ +void lv_fs_remove_drive(char letter); + +/** + * Test if a drive is ready or not. If the `ready` function was not initialized `true` will be + * returned. + * @param letter letter of the drive + * @return true: drive is ready; false: drive is not ready + */ +bool lv_fs_is_ready(char letter); + +/** + * Open a file + * @param file_p pointer to a lv_fs_file_t variable + * @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt) + * @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +lv_fs_res_t lv_fs_open(lv_fs_file_t * file_p, const char * path, lv_fs_mode_t mode); + +/** + * Create a special object from buffer/ memory address which looks like a file and can be passed + * as path to `lv_fs_open` and other functions accepting a path. + * + * For example + * @code + * //Create a PNG file from t a buffer and use it + * lv_fs_path_ex_t p; + * lv_fs_make_path_from_buffer(&p, 'A', my_buf, my_buf_size, "png"); + * lv_image_set_src(image1, &p); + * + * @endcode + * @param path path to a lv_fs_path_ex object + * @param letter the identifier letter of the driver. E.g. `LV_FS_MEMFS_LETTER` + * @param buf address of the memory buffer + * @param size size of the memory buffer in bytes + * @param ext the extension, e.g. "png", if NULL no extension will be added. + */ +void lv_fs_make_path_from_buffer(lv_fs_path_ex_t * path, char letter, const void * buf, uint32_t size, + const char * ext); + +/** + * Get the buffer address and size from a path object + * @param path pointer to an initialized `lv_fs_path_ex` data + * @param buffer pointer to a `void *` variable to store the address + * @param size pointer to an `uint32_t` data to store the size + * @return LV_RESULT_OK: buffer and size are set; LV_RESULT_INVALID: an error happened. + */ +lv_result_t lv_fs_get_buffer_from_path(lv_fs_path_ex_t * path, void ** buffer, uint32_t * size); + +/** + * Close an already opened file + * @param file_p pointer to a lv_fs_file_t variable + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p); + +/** + * Read from a file + * @param file_p pointer to a lv_fs_file_t variable + * @param buf pointer to a buffer where the read bytes are stored + * @param btr Bytes To Read + * @param br the number of real read bytes (Bytes Read). NULL if unused. + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +lv_fs_res_t lv_fs_read(lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t * br); + +/** + * Write into a file + * @param file_p pointer to a lv_fs_file_t variable + * @param buf pointer to a buffer with the bytes to write + * @param btw Bytes To Write + * @param bw the number of real written bytes (Bytes Written). NULL if unused. + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +lv_fs_res_t lv_fs_write(lv_fs_file_t * file_p, const void * buf, uint32_t btw, uint32_t * bw); + +/** + * Set the position of the 'cursor' (read write pointer) in a file + * @param file_p pointer to a lv_fs_file_t variable + * @param pos the new position expressed in bytes index (0: start of file) + * @param whence tells from where to set position. See lv_fs_whence_t + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +lv_fs_res_t lv_fs_seek(lv_fs_file_t * file_p, uint32_t pos, lv_fs_whence_t whence); + +/** + * Give the position of the read write pointer + * @param file_p pointer to a lv_fs_file_t variable + * @param pos pointer to store the position of the read write pointer + * @return LV_FS_RES_OK or any error from 'fs_res_t' + */ +lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos); + +/** + * Get the size in bytes of an open file. + * The file read/write position will not be affected. + * @param file_p pointer to a lv_fs_file_t variable + * @param size_res pointer to store the file size + * @return LV_FS_RES_OK or any error from `lv_fs_res_t` + */ +lv_fs_res_t lv_fs_get_size(lv_fs_file_t * file_p, uint32_t * size_res); + +/** + * Get the size in bytes of a file at the given path. + * @param path the path of the file + * @param size_res pointer to store the file size + * @return LV_FS_RES_OK or any error from `lv_fs_res_t` + */ +lv_fs_res_t lv_fs_path_get_size(const char * path, uint32_t * size_res); + +/** + * Read the contents of a file at the given path into a buffer. + * @param buf a buffer to read the contents of the file into + * @param buf_size the size of the buffer and the amount to read from the file + * @param path the path of the file + * @return LV_FS_RES_OK on success, LV_FS_RES_UNKNOWN if fewer than + * `buf_size` bytes could be read from the file, + * or any error from `lv_fs_res_t` + */ +lv_fs_res_t lv_fs_load_to_buf(void * buf, uint32_t buf_size, const char * path); + +/** + * Load a file into a memory buffer. + * @param filename the path of the file + * @param size pointer to store the size of the loaded file + * @return a pointer to the loaded file buffer, or NULL if an error occurred + */ +void * lv_fs_load_with_alloc(const char * path, uint32_t * size); + +/** + * Initialize a 'fs_dir_t' variable for directory reading + * @param rddir_p pointer to a 'lv_fs_dir_t' variable + * @param path path to a directory + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path); + +/** + * Read the next filename form a directory. + * The name of the directories will begin with '/' + * @param rddir_p pointer to an initialized 'fs_dir_t' variable + * @param fn pointer to a buffer to store the filename + * @param fn_len length of the buffer to store the filename + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn, uint32_t fn_len); + +/** + * Close the directory reading + * @param rddir_p pointer to an initialized 'fs_dir_t' variable + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p); + +/** + * Fill a buffer with the letters of existing drivers + * @param buf buffer to store the letters ('\0' added after the last letter) + * @return the buffer + */ +char * lv_fs_get_letters(char * buf); + +/** + * Return with the extension of the filename + * @param fn string with a filename + * @return pointer to the beginning extension or empty string if no extension + */ +const char * lv_fs_get_ext(const char * fn); + +/** + * Step up one level + * @param path pointer to a file name + * @return the truncated file name + */ +char * lv_fs_up(char * path); + +/** + * Get the last element of a path (e.g. U:/folder/file -> file) + * @param path pointer to a file name + * @return pointer to the beginning of the last element in the path + */ +const char * lv_fs_get_last(const char * path); + +/** + * Concatenate two path components and automatically add/remove a separator as needed. + * buf, buf_sz, and the return value are analogous to lv_snprintf + * @param buf the buffer to place the result in + * @param buf_sz the size of buf. At most buf_sz - 1 characters will be written to buf, + * and a null terminator + * @param base the first path component + * @param end the second path component + * @return the number of characters (not including the null terminator) + * that would be written to buf, even if buf_sz-1 was smaller + */ +int lv_fs_path_join(char * buf, size_t buf_sz, const char * base, const char * end); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FS_H*/ diff --git a/include/lvgl/fs/lv_fsdrv.h b/include/lvgl/fs/lv_fsdrv.h new file mode 100644 index 0000000000..0dc9b00d9f --- /dev/null +++ b/include/lvgl/fs/lv_fsdrv.h @@ -0,0 +1,119 @@ +/** + * @file lv_fsdrv.h + * + */ + +#ifndef LV_FSDRV_H +#define LV_FSDRV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +/********************* + * DEFINES + *********************/ + +#define LV_FS_MAX_PATH_LEN 256 + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +#if LV_USE_FS_FATFS +void lv_fs_fatfs_init(void); +#endif + +#if LV_USE_FS_STDIO +void lv_fs_stdio_init(void); +#endif + +#if LV_USE_FS_POSIX +void lv_fs_posix_init(void); +#endif + +#if LV_USE_FS_WIN32 +void lv_fs_win32_init(void); +#endif + +#if LV_USE_FS_MEMFS +void lv_fs_memfs_init(void); +#endif + +#if LV_USE_FS_LITTLEFS +#include "lfs.h" +struct lfs; +/** + * Set the default LittleFS handler to be used by LVGL + * @param lfs pointer to an initialized LittleFS filesystem structure + */ +void lv_littlefs_set_handler(struct lfs * lfs); + +/** + * Initialize LittleFS file system driver + */ +void lv_fs_littlefs_init(void); + +/** + * Register a LittleFS drive with LVGL + * @param lfs pointer to an initialized LittleFS filesystem structure + * @param letter driver letter to register (e.g. 'A') + * @return LV_FS_RES_OK: success, LV_FS_RES_INV_PARAM: lfs is NULL or letter not in range A-Z, + * LV_FS_RES_DRIVE_LETTER_ALREADY_USED: A drive with this letter is already registered + */ +lv_fs_res_t lv_fs_littlefs_register_drive(lfs_t * lfs, char letter); +#endif + +#if LV_USE_FS_ARDUINO_ESP_LITTLEFS +void lv_fs_arduino_esp_littlefs_init(void); +#endif + +#if LV_USE_FS_ARDUINO_SD +void lv_fs_arduino_sd_init(void); +#endif + +#if LV_USE_FS_UEFI +void lv_fs_uefi_init(void); +#endif + +#if LV_USE_FS_FROGFS +void lv_fs_frogfs_init(void); +void lv_fs_frogfs_deinit(void); + +/** + * Mount a frogfs blob at the path prefix. If there is a file "foo.txt" + * in the blob and the blob is registered with `path_prefix` as "my_blob", + * it can be opened later at path "my_blob/foo.txt". + * @param blob a frogfs blob/image from mkfrogfs.py + * @param path_prefix a prefix that will be used to refer to this blob when accessing it. + * @return LV_RESULT_OK or LV_RESULT_INVALID if there was an issue with the blob + */ +lv_result_t lv_fs_frogfs_register_blob(const void * blob, const char * path_prefix); + +/** + * Unmount a frogfs blob that was previously mounted by `lv_fs_frogfs_register_blob`. + * All files and dirs should be closed before calling this. + * @param path_prefix the path prefix that the blob was registered with + */ +void lv_fs_frogfs_unregister_blob(const char * path_prefix); + +#endif /*LV_USE_FS_FROGFS*/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_FSDRV_H*/ diff --git a/include/lvgl/image/lv_bin_decoder.h b/include/lvgl/image/lv_bin_decoder.h new file mode 100644 index 0000000000..b54f9530e5 --- /dev/null +++ b/include/lvgl/image/lv_bin_decoder.h @@ -0,0 +1,70 @@ +/** + * @file lv_bin_decoder.h + * + */ + +#ifndef LV_BIN_DECODER_H +#define LV_BIN_DECODER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_image_decoder.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the binary image decoder module + */ +void lv_bin_decoder_init(void); + +/** + * Get info about a lvgl binary image + * @param decoder the decoder where this function belongs + * @param dsc image descriptor containing the source and type of the image and other info. + * @param header store the image data here + * @return LV_RESULT_OK: the info is successfully stored in `header`; LV_RESULT_INVALID: unknown format or other error. + */ +lv_result_t lv_bin_decoder_info(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc, lv_image_header_t * header); + +lv_result_t lv_bin_decoder_get_area(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc, + const lv_area_t * full_area, lv_area_t * decoded_area); + +/** + * Open a lvgl binary image + * @param decoder the decoder where this function belongs + * @param dsc pointer to decoder descriptor. `src`, `style` are already initialized in it. + * @return LV_RESULT_OK: the info is successfully stored in `header`; LV_RESULT_INVALID: unknown format or other error. + */ +lv_result_t lv_bin_decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); + +/** + * Close the pending decoding. Free resources etc. + * @param decoder pointer to the decoder the function associated with + * @param dsc pointer to decoder descriptor + */ +void lv_bin_decoder_close(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BIN_DECODER_H*/ diff --git a/src/misc/lv_color_op_private.h b/include/lvgl/image/lv_bmp.h similarity index 65% rename from src/misc/lv_color_op_private.h rename to include/lvgl/image/lv_bmp.h index d6516ebd02..87ef17e34a 100644 --- a/src/misc/lv_color_op_private.h +++ b/include/lvgl/image/lv_bmp.h @@ -1,10 +1,10 @@ /** - * @file lv_color_op_private.h + * @file lv_bmp.h * */ -#ifndef LV_COLOR_OP_PRIVATE_H -#define LV_COLOR_OP_PRIVATE_H +#ifndef LV_BMP_H +#define LV_BMP_H #ifdef __cplusplus extern "C" { @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ - -#include "lv_color_op.h" +#include "../config/lv_conf_internal.h" +#if LV_USE_BMP /********************* * DEFINES @@ -27,13 +27,17 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ +void lv_bmp_init(void); +void lv_bmp_deinit(void); /********************** * MACROS **********************/ +#endif /*LV_USE_BMP*/ + #ifdef __cplusplus -} /*extern "C"*/ +} /* extern "C" */ #endif -#endif /*LV_COLOR_OP_PRIVATE_H*/ +#endif /*LV_BMP_H*/ diff --git a/include/lvgl/image/lv_image_decoder.h b/include/lvgl/image/lv_image_decoder.h new file mode 100644 index 0000000000..68192124e0 --- /dev/null +++ b/include/lvgl/image/lv_image_decoder.h @@ -0,0 +1,199 @@ +/** + * @file lv_image_decoder.h + * + */ + +#ifndef LV_IMAGE_DECODER_H +#define LV_IMAGE_DECODER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#include "../draw/lv_draw_buf.h" +#include "../fs/lv_fs.h" +#include "../lv_types.h" +#include "../core/lv_area.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Source of image.*/ +typedef enum { + LV_IMAGE_SRC_VARIABLE, /** Binary/C variable*/ + LV_IMAGE_SRC_FILE, /** File in filesystem*/ + LV_IMAGE_SRC_SYMBOL, /** Symbol (@ref lv_symbol_def.h)*/ + LV_IMAGE_SRC_UNKNOWN, /** Unknown source*/ +} lv_image_src_t; + +/** + * Get info from an image and store in the `header` + * @param decoder pointer to decoder object + * @param dsc pointer to decoder descriptor + * @param header store the info here + * @return LV_RESULT_OK: info written correctly; LV_RESULT_INVALID: failed + */ +typedef lv_result_t (*lv_image_decoder_info_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc, + lv_image_header_t * header); + +/** + * Open an image for decoding. Prepare it as it is required to read it later + * @param decoder pointer to the decoder the function associated with + * @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it. + */ +typedef lv_result_t (*lv_image_decoder_open_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); + +/** + * Decode `full_area` pixels incrementally by calling in a loop. Set `decoded_area` values to `LV_COORD_MIN` on first call. + * Required only if the "open" function can't return with the whole decoded pixel array. + * @param decoder pointer to the decoder the function associated with + * @param dsc pointer to decoder descriptor + * @param full_area input parameter. the full area to decode after enough subsequent calls + * @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call and to reset decoding. + * the decoded area is stored here after each call. + * @return LV_RESULT_OK: ok; LV_RESULT_INVALID: failed or there is nothing left to decode + */ +typedef lv_result_t (*lv_image_decoder_get_area_cb_t)(lv_image_decoder_t * decoder, + lv_image_decoder_dsc_t * dsc, + const lv_area_t * full_area, lv_area_t * decoded_area); + +/** + * Close the pending decoding. Free resources etc. + * @param decoder pointer to the decoder the function associated with + * @param dsc pointer to decoder descriptor + */ +typedef void (*lv_image_decoder_close_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); + +/** + * Custom drawing functions for special image formats. + * @param layer pointer to a layer + * @param dsc pointer to decoder descriptor + * @param coords the coordinates of the image + * @param draw_dsc the draw image descriptor + * @param clip_area the clip area of the image + */ +typedef void (*lv_image_decoder_custom_draw_t)(lv_layer_t * layer, const lv_image_decoder_dsc_t * dsc, + const lv_area_t * coords, const lv_draw_image_dsc_t * draw_dsc, const lv_area_t * clip_area); +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Get information about an image. + * Try the created image decoder one by one. Once one is able to get info that info will be used. + * @param src the image source. Can be + * 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register()`) + * 2) Variable: Pointer to an `lv_image_dsc_t` variable + * 3) Symbol: E.g. `LV_SYMBOL_OK` + * @param header the image info will be stored here + * @return LV_RESULT_OK: success; LV_RESULT_INVALID: wasn't able to get info about the image + */ +lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header); + +/** + * Open an image. + * Try the created image decoders one by one. Once one is able to open the image that decoder is saved in `dsc` + * @param dsc describes a decoding session. Simply a pointer to an `lv_image_decoder_dsc_t` variable. + * @param src the image source. Can be + * 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register())`) + * 2) Variable: Pointer to an `lv_image_dsc_t` variable + * 3) Symbol: E.g. `LV_SYMBOL_OK` + * @param args args about how the image should be opened. + * @return LV_RESULT_OK: opened the image. `dsc->decoded` and `dsc->header` are set. + * LV_RESULT_INVALID: none of the registered image decoders were able to open the image. + */ +lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, const lv_image_decoder_args_t * args); + +/** + * Decode `full_area` pixels incrementally by calling in a loop. Set `decoded_area` to `LV_COORD_MIN` on first call. + * @param dsc image decoder descriptor + * @param full_area input parameter. the full area to decode after enough subsequent calls + * @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call and to reset decoding. + * the decoded area is stored here after each call. + * @return LV_RESULT_OK: success; LV_RESULT_INVALID: an error occurred or there is nothing left to decode + */ +lv_result_t lv_image_decoder_get_area(lv_image_decoder_dsc_t * dsc, const lv_area_t * full_area, + lv_area_t * decoded_area); + +/** + * Close a decoding session + * @param dsc pointer to `lv_image_decoder_dsc_t` used in `lv_image_decoder_open` + */ +void lv_image_decoder_close(lv_image_decoder_dsc_t * dsc); + +/** + * Create a new image decoder + * @return pointer to the new image decoder + */ +lv_image_decoder_t * lv_image_decoder_create(void); + +/** + * Delete an image decoder + * @param decoder pointer to an image decoder + */ +void lv_image_decoder_delete(lv_image_decoder_t * decoder); + +/** + * Get the next image decoder in the linked list of image decoders + * @param decoder pointer to an image decoder or NULL to get the first one + * @return the next image decoder or NULL if no more image decoder exists + */ +lv_image_decoder_t * lv_image_decoder_get_next(lv_image_decoder_t * decoder); + +/** + * Set a callback to get information about the image + * @param decoder pointer to an image decoder + * @param info_cb a function to collect info about an image (fill an `lv_image_header_t` struct) + */ +void lv_image_decoder_set_info_cb(lv_image_decoder_t * decoder, lv_image_decoder_info_f_t info_cb); + +/** + * Set a callback to open an image + * @param decoder pointer to an image decoder + * @param open_cb a function to open an image + */ +void lv_image_decoder_set_open_cb(lv_image_decoder_t * decoder, lv_image_decoder_open_f_t open_cb); + +/** + * Set a callback to a decoded line of an image + * @param decoder pointer to an image decoder + * @param read_line_cb a function to read a line of an image + */ +void lv_image_decoder_set_get_area_cb(lv_image_decoder_t * decoder, lv_image_decoder_get_area_cb_t read_line_cb); + +/** + * Set a callback to close a decoding session. E.g. close files and free other resources. + * @param decoder pointer to an image decoder + * @param close_cb a function to close a decoding session + */ +void lv_image_decoder_set_close_cb(lv_image_decoder_t * decoder, lv_image_decoder_close_f_t close_cb); + +/** + * Check the decoded image, make any modification if decoder `args` requires. + * @note A new draw buf will be allocated if provided `decoded` is not modifiable or stride mismatch etc. + * @param dsc pointer to a decoder descriptor + * @param decoded pointer to a decoded image to post process to meet dsc->args requirement. + * @return post processed draw buffer, when it differs with `decoded`, it's newly allocated. + */ +lv_draw_buf_t * lv_image_decoder_post_process(lv_image_decoder_dsc_t * dsc, lv_draw_buf_t * decoded); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_IMAGE_DECODER_H*/ diff --git a/include/lvgl/image/lv_libjpeg_turbo.h b/include/lvgl/image/lv_libjpeg_turbo.h new file mode 100644 index 0000000000..7bf6391896 --- /dev/null +++ b/include/lvgl/image/lv_libjpeg_turbo.h @@ -0,0 +1,48 @@ +/** + * @file lv_libjpeg_turbo.h + * + */ + +#ifndef LV_LIBJPEG_TURBO_H +#define LV_LIBJPEG_TURBO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_LIBJPEG_TURBO + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Register the JPEG-Turbo decoder functions in LVGL + */ +void lv_libjpeg_turbo_init(void); + +void lv_libjpeg_turbo_deinit(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_LIBJPEG_TURBO*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_LIBJPEG_TURBO_H*/ diff --git a/include/lvgl/image/lv_libpng.h b/include/lvgl/image/lv_libpng.h new file mode 100644 index 0000000000..0701e6df85 --- /dev/null +++ b/include/lvgl/image/lv_libpng.h @@ -0,0 +1,48 @@ +/** + * @file lv_libpng.h + * + */ + +#ifndef LV_LIBPNG_H +#define LV_LIBPNG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_LIBPNG + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Register the PNG decoder functions in LVGL + */ +void lv_libpng_init(void); + +void lv_libpng_deinit(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_LIBPNG*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_LIBPNG_H*/ diff --git a/include/lvgl/image/lv_libwebp.h b/include/lvgl/image/lv_libwebp.h new file mode 100644 index 0000000000..6a7138c56b --- /dev/null +++ b/include/lvgl/image/lv_libwebp.h @@ -0,0 +1,48 @@ +/** + * @file lv_libwebp.h + * + */ + +#ifndef LV_LIBWEBP_H +#define LV_LIBWEBP_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_LIBWEBP + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Register the WEBP decoder functions in LVGL + */ +void lv_libwebp_init(void); + +void lv_libwebp_deinit(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_LIBWEBP*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_LIBWEBP_H*/ diff --git a/include/lvgl/image/lv_lodepng.h b/include/lvgl/image/lv_lodepng.h new file mode 100644 index 0000000000..88713c16a6 --- /dev/null +++ b/include/lvgl/image/lv_lodepng.h @@ -0,0 +1,48 @@ +/** + * @file lv_lodepng.h + * + */ + +#ifndef LV_LODEPNG_H +#define LV_LODEPNG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_LODEPNG + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Register the PNG decoder functions in LVGL + */ +void lv_lodepng_init(void); + +void lv_lodepng_deinit(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_LODEPNG*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_LODEPNG_H*/ diff --git a/include/lvgl/image/lv_svg.h b/include/lvgl/image/lv_svg.h new file mode 100644 index 0000000000..7e23780ea0 --- /dev/null +++ b/include/lvgl/image/lv_svg.h @@ -0,0 +1,344 @@ +/** + * @file lv_svg.h + * + */ + +#ifndef LV_SVG_H +#define LV_SVG_H + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_SVG + +#include "../misc/lv_array.h" +#include "../misc/lv_tree.h" +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +enum _lv_svg_tag_t { + LV_SVG_TAG_INVALID = -1, + LV_SVG_TAG_CONTENT, + LV_SVG_TAG_SVG, + LV_SVG_TAG_USE, + LV_SVG_TAG_G, + LV_SVG_TAG_PATH, + LV_SVG_TAG_RECT, + LV_SVG_TAG_CIRCLE, + LV_SVG_TAG_ELLIPSE, + LV_SVG_TAG_LINE, + LV_SVG_TAG_POLYLINE, + LV_SVG_TAG_POLYGON, + LV_SVG_TAG_SOLID_COLOR, + LV_SVG_TAG_LINEAR_GRADIENT, + LV_SVG_TAG_RADIAL_GRADIENT, + LV_SVG_TAG_STOP, + LV_SVG_TAG_DEFS, + LV_SVG_TAG_IMAGE, +#if LV_USE_SVG_ANIMATION + LV_SVG_TAG_MPATH, + LV_SVG_TAG_SET, + LV_SVG_TAG_ANIMATE, + LV_SVG_TAG_ANIMATE_COLOR, + LV_SVG_TAG_ANIMATE_TRANSFORM, + LV_SVG_TAG_ANIMATE_MOTION, +#endif + LV_SVG_TAG_TEXT, + LV_SVG_TAG_TSPAN, + LV_SVG_TAG_TEXT_AREA, +}; +typedef int8_t lv_svg_tag_t; + +enum _lv_svg_attr_type_t { + LV_SVG_ATTR_INVALID = 0, + LV_SVG_ATTR_ID, + LV_SVG_ATTR_XML_ID, + LV_SVG_ATTR_VERSION, + LV_SVG_ATTR_BASE_PROFILE, + LV_SVG_ATTR_VIEWBOX, + LV_SVG_ATTR_PRESERVE_ASPECT_RATIO, + LV_SVG_ATTR_VIEWPORT_FILL, + LV_SVG_ATTR_VIEWPORT_FILL_OPACITY, + LV_SVG_ATTR_DISPLAY, + LV_SVG_ATTR_VISIBILITY, + LV_SVG_ATTR_X, + LV_SVG_ATTR_Y, + LV_SVG_ATTR_WIDTH, + LV_SVG_ATTR_HEIGHT, + LV_SVG_ATTR_RX, + LV_SVG_ATTR_RY, + LV_SVG_ATTR_CX, + LV_SVG_ATTR_CY, + LV_SVG_ATTR_R, + LV_SVG_ATTR_X1, + LV_SVG_ATTR_Y1, + LV_SVG_ATTR_X2, + LV_SVG_ATTR_Y2, + LV_SVG_ATTR_POINTS, + LV_SVG_ATTR_D, + LV_SVG_ATTR_PATH_LENGTH, + LV_SVG_ATTR_XLINK_HREF, + LV_SVG_ATTR_STYLE, + LV_SVG_ATTR_FILL, + LV_SVG_ATTR_FILL_RULE, + LV_SVG_ATTR_FILL_OPACITY, + LV_SVG_ATTR_STROKE, + LV_SVG_ATTR_STROKE_WIDTH, + LV_SVG_ATTR_STROKE_LINECAP, + LV_SVG_ATTR_STROKE_LINEJOIN, + LV_SVG_ATTR_STROKE_MITER_LIMIT, + LV_SVG_ATTR_STROKE_DASH_ARRAY, + LV_SVG_ATTR_STROKE_DASH_OFFSET, + LV_SVG_ATTR_STROKE_OPACITY, + LV_SVG_ATTR_OPACITY, + LV_SVG_ATTR_SOLID_COLOR, + LV_SVG_ATTR_SOLID_OPACITY, + LV_SVG_ATTR_GRADIENT_UNITS, + LV_SVG_ATTR_GRADIENT_STOP_OFFSET, + LV_SVG_ATTR_GRADIENT_STOP_COLOR, + LV_SVG_ATTR_GRADIENT_STOP_OPACITY, + LV_SVG_ATTR_FONT_FAMILY, + LV_SVG_ATTR_FONT_STYLE, + LV_SVG_ATTR_FONT_VARIANT, + LV_SVG_ATTR_FONT_WEIGHT, + LV_SVG_ATTR_FONT_SIZE, + LV_SVG_ATTR_TRANSFORM, + LV_SVG_ATTR_TEXT_ANCHOR, +#if LV_USE_SVG_ANIMATION + LV_SVG_ATTR_ATTRIBUTE_NAME, + LV_SVG_ATTR_ATTRIBUTE_TYPE, + LV_SVG_ATTR_BEGIN, + LV_SVG_ATTR_END, + LV_SVG_ATTR_DUR, + LV_SVG_ATTR_MIN, + LV_SVG_ATTR_MAX, + LV_SVG_ATTR_RESTART, + LV_SVG_ATTR_REPEAT_COUNT, + LV_SVG_ATTR_REPEAT_DUR, + LV_SVG_ATTR_CALC_MODE, + LV_SVG_ATTR_VALUES, + LV_SVG_ATTR_KEY_TIMES, + LV_SVG_ATTR_KEY_SPLINES, + LV_SVG_ATTR_KEY_POINTS, + LV_SVG_ATTR_FROM, + LV_SVG_ATTR_TO, + LV_SVG_ATTR_BY, + LV_SVG_ATTR_ADDITIVE, + LV_SVG_ATTR_ACCUMULATE, + LV_SVG_ATTR_PATH, + LV_SVG_ATTR_ROTATE, + LV_SVG_ATTR_TRANSFORM_TYPE, +#endif +}; +typedef uint8_t lv_svg_attr_type_t; + +enum _lv_svg_transform_type_t { + LV_SVG_TRANSFORM_TYPE_MATRIX = 1, + LV_SVG_TRANSFORM_TYPE_TRANSLATE, + LV_SVG_TRANSFORM_TYPE_ROTATE, + LV_SVG_TRANSFORM_TYPE_SCALE, + LV_SVG_TRANSFORM_TYPE_SKEW_X, + LV_SVG_TRANSFORM_TYPE_SKEW_Y, +}; +typedef uint8_t lv_svg_transform_type_t; + +#if LV_USE_SVG_ANIMATION +enum lv_svg_anim_action_t { + LV_SVG_ANIM_REMOVE = 0, + LV_SVG_ANIM_FREEZE, +}; + +enum _lv_svg_anim_restart_type_t { + LV_SVG_ANIM_RESTART_ALWAYS = 0, + LV_SVG_ANIM_RESTART_WHEN_NOT_ACTIVE, + LV_SVG_ANIM_RESTART_NEVER, +}; + +enum _lv_svg_anim_calc_mode_t { + LV_SVG_ANIM_CALC_MODE_LINEAR = 0, + LV_SVG_ANIM_CALC_MODE_PACED, + LV_SVG_ANIM_CALC_MODE_SPLINE, + LV_SVG_ANIM_CALC_MODE_DISCRETE, +}; + +enum _lv_svg_anim_additive_type_t { + LV_SVG_ANIM_ADDITIVE_REPLACE = 0, + LV_SVG_ANIM_ADDITIVE_SUM, +}; + +enum _lv_svg_anim_accumulate_type_t { + LV_SVG_ANIM_ACCUMULATE_NONE = 0, + LV_SVG_ANIM_ACCUMULATE_SUM, +}; +#endif + +enum _lv_svg_aspect_ratio_t { + LV_SVG_ASPECT_RATIO_NONE = 0, + LV_SVG_ASPECT_RATIO_XMIN_YMIN = (1 << 1), + LV_SVG_ASPECT_RATIO_XMID_YMIN = (2 << 1), + LV_SVG_ASPECT_RATIO_XMAX_YMIN = (3 << 1), + LV_SVG_ASPECT_RATIO_XMIN_YMID = (4 << 1), + LV_SVG_ASPECT_RATIO_XMID_YMID = (5 << 1), + LV_SVG_ASPECT_RATIO_XMAX_YMID = (6 << 1), + LV_SVG_ASPECT_RATIO_XMIN_YMAX = (7 << 1), + LV_SVG_ASPECT_RATIO_XMID_YMAX = (8 << 1), + LV_SVG_ASPECT_RATIO_XMAX_YMAX = (9 << 1), +}; +typedef uint32_t lv_svg_aspect_ratio_t; + +enum _lv_svg_aspect_ratio_opt_t { + LV_SVG_ASPECT_RATIO_OPT_MEET = 0, + LV_SVG_ASPECT_RATIO_OPT_SLICE, +}; + +typedef struct { + float x; + float y; +} lv_svg_point_t; + +typedef struct { + float m[3][3]; +} lv_svg_matrix_t; + +typedef uint32_t lv_svg_color_t; + +enum _lv_svg_fill_rule_t { + LV_SVG_FILL_NONZERO = 0, + LV_SVG_FILL_EVENODD, +}; +typedef uint8_t lv_svg_fill_rule_t; + +enum _lv_svg_line_cap_t { + LV_SVG_LINE_CAP_BUTT = 0, + LV_SVG_LINE_CAP_SQUARE, + LV_SVG_LINE_CAP_ROUND, +}; +typedef uint8_t lv_svg_line_cap_t; + +enum _lv_svg_line_join_t { + LV_SVG_LINE_JOIN_MITER = 0, + LV_SVG_LINE_JOIN_BEVEL, + LV_SVG_LINE_JOIN_ROUND, +}; +typedef uint8_t lv_svg_line_join_t; + +enum _lv_svg_gradient_units_t { + LV_SVG_GRADIENT_UNITS_OBJECT = 0, + LV_SVG_GRADIENT_UNITS_USER_SPACE, +}; +typedef uint8_t lv_svg_gradient_units_t; + +typedef union { + int32_t ival; + uint32_t uval; + float fval; + char * sval; + void * val; +} lv_svg_attr_value_t; + +/* + * to simplify list buffer management, allocate enough memory for all data and length. + * | size | data[0] | data[1] | data[2] | ... | + */ +typedef struct { + uint32_t length; + uint8_t data[1]; +} lv_svg_attr_values_list_t; + +/* https://www.w3.org/TR/SVGTiny12/svgudomidl.html */ +enum _lv_svg_path_cmd_t { + LV_SVG_PATH_CMD_MOVE_TO = 77, + LV_SVG_PATH_CMD_LINE_TO = 76, + LV_SVG_PATH_CMD_CURVE_TO = 67, + LV_SVG_PATH_CMD_QUAD_TO = 81, + LV_SVG_PATH_CMD_ARC_TO = 65, /*svg2 extension*/ + LV_SVG_PATH_CMD_CLOSE = 90, +}; + +/* + * to simplify list buffer management, allocate enough memory for all path data and cmd. + * | cmd | data[0] | data[1] | data[2] | ... | + */ +typedef struct { + uint32_t cmd; + uint8_t data[1]; +} lv_svg_attr_path_value_t; + +enum _lv_svg_attr_value_type_t { + LV_SVG_ATTR_VALUE_DATA = 0, + LV_SVG_ATTR_VALUE_PTR, +}; +typedef uint8_t lv_svg_attr_value_type_t; + +enum _lv_svg_attr_value_class_t { + LV_SVG_ATTR_VALUE_NONE = 0, + LV_SVG_ATTR_VALUE_INITIAL, + LV_SVG_ATTR_VALUE_INHERIT, +}; +typedef uint8_t lv_svg_attr_value_class_t; + +typedef struct { + lv_svg_attr_type_t id; + lv_svg_attr_value_type_t val_type; + lv_svg_attr_value_class_t class_type; + lv_svg_attr_value_t value; +} lv_svg_attr_t; + +struct _lv_svg_render_obj; + +typedef struct { + lv_tree_node_t base; + char * xml_id; /* xml_id or content */ + lv_svg_tag_t type; + lv_array_t attrs; + struct _lv_svg_render_obj * render_obj; +} lv_svg_node_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Loading SVG data and creating the DOM tree + * @param svg_data pointer to the SVG data + * @param data_len the SVG data length + */ +lv_svg_node_t * lv_svg_load_data(const char * svg_data, uint32_t data_len); + +/** + * @brief Create an SVG DOM node + * @param parent pointer to the parent node + * @return true: an new SVG DOM node, false: NULL + */ +lv_svg_node_t * lv_svg_node_create(lv_svg_node_t * parent); + +/** + * @brief Draw an SVG document to a layer + * @param layer pointer to the target layer + * @param svg_doc pointer to the SVG document to draw + */ +void lv_draw_svg(lv_layer_t * layer, const lv_svg_node_t * svg_doc); + + +/** + * @brief Delete an SVG DOM subtree + * @param node pointer to an SVG DOM subtree + */ +void lv_svg_node_delete(lv_svg_node_t * node); + +/********************** + * MACROS + **********************/ +#define LV_SVG_NODE_CHILD(n, i) \ + ((lv_svg_node_t *)(LV_TREE_NODE((n))->children[i])) + +#define LV_SVG_NODE(n) ((lv_svg_node_t*)(n)) + +#endif /*LV_USE_SVG*/ + +#endif /*LV_SVG_H*/ diff --git a/src/stdlib/lv_mem_private.h b/include/lvgl/image/lv_tjpgd.h similarity index 69% rename from src/stdlib/lv_mem_private.h rename to include/lvgl/image/lv_tjpgd.h index 9e70ae1af9..ec35800b23 100644 --- a/src/stdlib/lv_mem_private.h +++ b/include/lvgl/image/lv_tjpgd.h @@ -1,10 +1,10 @@ /** - * @file lv_mem_private.h + * @file lv_tjpgd.h * */ -#ifndef LV_MEM_PRIVATE_H -#define LV_MEM_PRIVATE_H +#ifndef LV_TJPGD_H +#define LV_TJPGD_H #ifdef __cplusplus extern "C" { @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_mem.h" +#if LV_USE_TJPGD /********************* * DEFINES @@ -28,12 +28,18 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ +void lv_tjpgd_init(void); + +void lv_tjpgd_deinit(void); + /********************** * MACROS **********************/ +#endif /*LV_USE_TJPGD*/ + #ifdef __cplusplus -} /*extern "C"*/ +} #endif -#endif /*LV_MEM_PRIVATE_H*/ +#endif /* LV_TJPGD_H */ diff --git a/include/lvgl/indev/lv_gridnav.h b/include/lvgl/indev/lv_gridnav.h new file mode 100644 index 0000000000..59fb80d166 --- /dev/null +++ b/include/lvgl/indev/lv_gridnav.h @@ -0,0 +1,95 @@ +/** + * @file lv_gridnav.h + * + */ + +#ifndef LV_GRIDNAV_H +#define LV_GRIDNAV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +#if LV_USE_GRIDNAV + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_GRIDNAV_CTRL_NONE = 0x0, + + /** + * If there is no next/previous object in a direction, + * the focus goes to the object in the next/previous row (on left/right keys) + * or first/last row (on up/down keys) + */ + LV_GRIDNAV_CTRL_ROLLOVER = 0x1, + + /** + * If an arrow is pressed and the focused object can be scrolled in that direction + * then it will be scrolled instead of going to the next/previous object. + * If there is no more room for scrolling the next/previous object will be focused normally */ + LV_GRIDNAV_CTRL_SCROLL_FIRST = 0x2, + + /** + * Only use left/right keys for grid navigation. Up/down key events will be sent to the + * focused object. + */ + LV_GRIDNAV_CTRL_HORIZONTAL_MOVE_ONLY = 0x4, + + /** + * Only use up/down keys for grid navigation. Left/right key events will be sent to the + * focused object. + */ + LV_GRIDNAV_CTRL_VERTICAL_MOVE_ONLY = 0x8 + +} lv_gridnav_ctrl_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Add grid navigation feature to an object. It expects the children to be arranged + * into a grid-like layout. Although it's not required to have pixel perfect alignment. + * This feature makes possible to use keys to navigate among the children and focus them. + * The keys other than arrows and press/release related events + * are forwarded to the focused child. + * @param obj pointer to an object on which navigation should be applied. + * @param ctrl control flags from `lv_gridnav_ctrl_t`. + */ +void lv_gridnav_add(lv_obj_t * obj, lv_gridnav_ctrl_t ctrl); + +/** + * Remove the grid navigation support from an object + * @param obj pointer to an object + */ +void lv_gridnav_remove(lv_obj_t * obj); + +/** + * Manually focus an object on gridnav container + * @param cont pointer to a gridnav container + * @param to_focus pointer to an object to focus + * @param anim_en LV_ANIM_ON/OFF + */ +void lv_gridnav_set_focused(lv_obj_t * cont, lv_obj_t * to_focus, lv_anim_enable_t anim_en); + +/********************** + * MACROS + **********************/ +#endif /*LV_USE_GRIDNAV*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_GRIDNAV_H */ diff --git a/include/lvgl/indev/lv_indev.h b/include/lvgl/indev/lv_indev.h new file mode 100644 index 0000000000..d70778d081 --- /dev/null +++ b/include/lvgl/indev/lv_indev.h @@ -0,0 +1,502 @@ +/** + * @file lv_indev.h + * + */ + +#ifndef LV_INDEV_H +#define LV_INDEV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_group.h" +#include "../core/lv_area.h" +#include "../core/lv_timer.h" +#include "../core/lv_event.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** Possible input device types*/ +typedef enum { + LV_INDEV_TYPE_NONE, /**< Uninitialized state*/ + LV_INDEV_TYPE_POINTER, /**< Touch pad, mouse, external button*/ + LV_INDEV_TYPE_KEYPAD, /**< Keypad or keyboard*/ + LV_INDEV_TYPE_BUTTON, /**< External (hardware button) which is assigned to a specific point of the screen*/ + LV_INDEV_TYPE_ENCODER, /**< Encoder with only Left, Right turn and a Button*/ +} lv_indev_type_t; + +/** States for input devices*/ +typedef enum { + LV_INDEV_STATE_RELEASED = 0, + LV_INDEV_STATE_PRESSED +} lv_indev_state_t; + +typedef enum { + LV_INDEV_MODE_NONE = 0, + LV_INDEV_MODE_TIMER, + LV_INDEV_MODE_EVENT, +} lv_indev_mode_t; + + +/* Supported types of gestures */ +typedef enum { + LV_INDEV_GESTURE_NONE = 0, + LV_INDEV_GESTURE_PINCH, + LV_INDEV_GESTURE_SWIPE, + LV_INDEV_GESTURE_ROTATE, + LV_INDEV_GESTURE_TWO_FINGERS_SWIPE, + LV_INDEV_GESTURE_SCROLL, /* Used with scrollwheels */ + LV_INDEV_GESTURE_CNT, /* Total number of gestures types */ +} lv_indev_gesture_type_t; + +/** Data structure passed to an input driver to fill*/ +typedef struct { + lv_indev_gesture_type_t gesture_type[LV_INDEV_GESTURE_CNT]; /* Current gesture types, per gesture */ + void * gesture_data[LV_INDEV_GESTURE_CNT]; /* Used to store data per gesture */ + + lv_indev_state_t state; /**< LV_INDEV_STATE_RELEASED or LV_INDEV_STATE_PRESSED*/ + + lv_point_t point; /**< For LV_INDEV_TYPE_POINTER the currently pressed point*/ + uint32_t key; /**< For LV_INDEV_TYPE_KEYPAD the currently pressed key*/ + uint32_t btn_id; /**< For LV_INDEV_TYPE_BUTTON the currently pressed button*/ + int16_t enc_diff; /**< For LV_INDEV_TYPE_ENCODER number of steps since the previous read*/ + + uint32_t timestamp; /**< Initialized to lv_tick_get(). Driver may provide more accurate timestamp for buffered events*/ + bool continue_reading; /**< If set to true, the read callback is invoked again, unless the device is in event-driven mode*/ +} lv_indev_data_t; + +typedef void (*lv_indev_read_cb_t)(lv_indev_t * indev, lv_indev_data_t * data); + +/** Indev key remapping callback */ +typedef lv_key_t (*lv_indev_key_remap_cb_t)(lv_indev_t * indev, lv_key_t key); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an indev + * @return Pointer to the created indev or NULL when allocation failed + */ +lv_indev_t * lv_indev_create(void); + +/** + * Remove the provided input device. Make sure not to use the provided input device afterwards anymore. + * @param indev pointer to delete + */ +void lv_indev_delete(lv_indev_t * indev); + +/** + * Get the next input device. + * @param indev pointer to the current input device. NULL to initialize. + * @return the next input device or NULL if there are no more. Provide the first input device when + * the parameter is NULL + */ +lv_indev_t * lv_indev_get_next(lv_indev_t * indev); + +/** + * Read data from an input device. + * @param indev pointer to an input device + */ +void lv_indev_read(lv_indev_t * indev); + +/** + * Called periodically to read the input devices + * @param timer pointer to a timer to read + */ +void lv_indev_read_timer_cb(lv_timer_t * timer); + +/** + * Enable or disable one or all input devices (default enabled) + * @param indev pointer to an input device or NULL to enable/disable all of them + * @param enable true to enable, false to disable + */ +void lv_indev_enable(lv_indev_t * indev, bool enable); + +/** + * Get the currently processed input device. Can be used in action functions too. + * @return pointer to the currently processed input device or NULL if no input device processing + * right now + */ +lv_indev_t * lv_indev_active(void); + +/** + * Set the type of an input device + * @param indev pointer to an input device + * @param indev_type the type of the input device from `lv_indev_type_t` (`LV_INDEV_TYPE_...`) + */ +void lv_indev_set_type(lv_indev_t * indev, lv_indev_type_t indev_type); + +/** + * Set a callback function to read input device data to the indev + * @param indev pointer to an input device + * @param read_cb pointer to callback function to read input device data + */ +void lv_indev_set_read_cb(lv_indev_t * indev, lv_indev_read_cb_t read_cb); + +/** + * Set user data to the indev + * @param indev pointer to an input device + * @param user_data pointer to user data + */ +void lv_indev_set_user_data(lv_indev_t * indev, void * user_data); + +/** + * Set driver data to the indev + * @param indev pointer to an input device + * @param driver_data pointer to driver data + */ +void lv_indev_set_driver_data(lv_indev_t * indev, void * driver_data); + +/** + * Assign a display to the indev + * @param indev pointer to an input device + * @param disp pointer to an display + */ +void lv_indev_set_display(lv_indev_t * indev, struct _lv_display_t * disp); + +/** + * Set long press time to indev + * @param indev pointer to input device + * @param long_press_time time long press time in ms + */ +void lv_indev_set_long_press_time(lv_indev_t * indev, uint16_t long_press_time); + +/** + * Set long press repeat time to indev + * @param indev pointer to input device + * @param long_press_repeat_time long press repeat time in ms + */ +void lv_indev_set_long_press_repeat_time(lv_indev_t * indev, uint16_t long_press_repeat_time); + +/** + * Set scroll limit to the input device + * @param indev pointer to an input device + * @param scroll_limit the number of pixels to slide before actually drag the object + */ +void lv_indev_set_scroll_limit(lv_indev_t * indev, uint8_t scroll_limit); + +/** + * Set scroll throw slow-down to the indev. Greater value means faster slow-down + * @param indev pointer to an input device + * @param scroll_throw the slow-down in [%] + */ +void lv_indev_set_scroll_throw(lv_indev_t * indev, uint8_t scroll_throw); + +/** + * Set the minimum velocity threshold for gesture detection. + * The difference between consecutive points must exceed this value (in pixels) + * for the movement to be considered fast enough to trigger a gesture. + * + * @param indev pointer to an input device + * @param min_velocity minimum velocity threshold in pixels (default: 3) + */ +void lv_indev_set_gesture_min_velocity(lv_indev_t * indev, uint8_t min_velocity); + +/** + * Set the minimum distance threshold for gesture detection. + * The total distance from the first point to the current point must exceed + * this value (in pixels) for the movement to be considered large enough + * to trigger a gesture. + * + * @param indev pointer to an input device + * @param min_distance minimum distance threshold in pixels (default: 50) + */ +void lv_indev_set_gesture_min_distance(lv_indev_t * indev, uint8_t min_distance); + +/** + * Get the type of an input device + * @param indev pointer to an input device + * @return the type of the input device from `lv_hal_indev_type_t` (`LV_INDEV_TYPE_...`) + */ +lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev); + +/** + * Get the callback function to read input device data to the indev + * @param indev pointer to an input device + * @return Pointer to callback function to read input device data or NULL if indev is NULL + */ +lv_indev_read_cb_t lv_indev_get_read_cb(lv_indev_t * indev); + +/** + * Get the indev state + * @param indev pointer to an input device + * @return Indev state or LV_INDEV_STATE_RELEASED if indev is NULL + */ +lv_indev_state_t lv_indev_get_state(const lv_indev_t * indev); + +/** + * Get the indev assigned group + * @param indev pointer to an input device + * @return Pointer to indev assigned group or NULL if indev is NULL + */ +lv_group_t * lv_indev_get_group(const lv_indev_t * indev); + +/** + * Get a pointer to the assigned display of the indev + * @param indev pointer to an input device + * @return pointer to the assigned display or NULL if indev is NULL + */ +lv_display_t * lv_indev_get_display(const lv_indev_t * indev); + +/** + * Get a pointer to the user data of the indev + * @param indev pointer to an input device + * @return pointer to the user data or NULL if indev is NULL + */ +void * lv_indev_get_user_data(const lv_indev_t * indev); + +/** + * Get a pointer to the driver data of the indev + * @param indev pointer to an input device + * @return pointer to the driver data or NULL if indev is NULL + */ +void * lv_indev_get_driver_data(const lv_indev_t * indev); + +/** + * Get whether indev is moved while pressed + * @param indev pointer to an input device + * @return true: indev is moved while pressed; false: indev is not moved while pressed + */ +bool lv_indev_get_press_moved(const lv_indev_t * indev); + +/** + * Reset one or all input devices + * @param indev pointer to an input device to reset or NULL to reset all of them + * @param obj pointer to an object which triggers the reset. + */ +void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj); + +/** + * Touch and key related events are sent to the input device first and to the widget after that. + * If this functions called in an indev event, the event won't be sent to the widget. + * @param indev pointer to an input device + */ +void lv_indev_stop_processing(lv_indev_t * indev); + +/** + * Reset the long press state of an input device + * @param indev pointer to an input device + */ +void lv_indev_reset_long_press(lv_indev_t * indev); + +/** + * Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON) + * @param indev pointer to an input device + * @param cur_obj pointer to an object to be used as cursor + */ +void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj); + +/** + * Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD) + * @param indev pointer to an input device + * @param group pointer to a group + */ +void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group); + +/** + * Set the an array of points for LV_INDEV_TYPE_BUTTON. + * These points will be assigned to the buttons to press a specific point on the screen + * @param indev pointer to an input device + * @param points array of points + */ +void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t points[]); + +/** + * Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON) + * @param indev pointer to an input device + * @param point pointer to a point to store the result + */ +void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point); + +/** +* Get the current gesture direct +* @param indev pointer to an input device +* @return current gesture direct +*/ +lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev); + +/** + * Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD) + * @param indev pointer to an input device + * @return the last pressed key (0 on error) + */ +uint32_t lv_indev_get_key(const lv_indev_t * indev); + + +/** + * Get the counter for consecutive clicks within a short distance and time. + * The counter is updated before LV_EVENT_SHORT_CLICKED is fired. + * @param indev pointer to an input device + * @return short click streak counter + */ +uint8_t lv_indev_get_short_click_streak(const lv_indev_t * indev); + +/** + * Check the current scroll direction of an input device (for LV_INDEV_TYPE_POINTER and + * LV_INDEV_TYPE_BUTTON) + * @param indev pointer to an input device + * @return LV_DIR_NONE: no scrolling now + * LV_DIR_HOR/VER + */ +lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t * indev); + +/** + * Get the currently scrolled object (for LV_INDEV_TYPE_POINTER and + * LV_INDEV_TYPE_BUTTON) + * @param indev pointer to an input device + * @return pointer to the currently scrolled object or NULL if no scrolling by this indev + */ +lv_obj_t * lv_indev_get_scroll_obj(const lv_indev_t * indev); + +/** + * Get the movement vector of an input device (for LV_INDEV_TYPE_POINTER and + * LV_INDEV_TYPE_BUTTON) + * @param indev pointer to an input device + * @param point pointer to a point to store the types.pointer.vector + */ +void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point); + +/** + * Get the cursor object of an input device (for LV_INDEV_TYPE_POINTER only) + * @param indev pointer to an input device + * @return pointer to the cursor object + */ +lv_obj_t * lv_indev_get_cursor(lv_indev_t * indev); + +/** + * Do nothing until the next release + * @param indev pointer to an input device + */ +void lv_indev_wait_release(lv_indev_t * indev); + +/** + * Gets a pointer to the currently active object in the currently processed input device. + * @return pointer to currently active object or NULL if no active object + */ +lv_obj_t * lv_indev_get_active_obj(void); + +/** + * Get a pointer to the indev read timer to + * modify its parameters with `lv_timer_...` functions. + * @param indev pointer to an input device + * @return pointer to the indev read refresher timer. (NULL on error) + */ +lv_timer_t * lv_indev_get_read_timer(lv_indev_t * indev); + +/** +* Set the input device's event model: event-driven mode or timer mode. +* @param indev pointer to an input device +* @param mode the mode of input device +*/ +void lv_indev_set_mode(lv_indev_t * indev, lv_indev_mode_t mode); + +/** + * Get the input device's running mode. + * @param indev pointer to an input device + * @return the running mode for the specified input device. + */ +lv_indev_mode_t lv_indev_get_mode(lv_indev_t * indev); + +/** + * Search the most top, clickable object by a point + * @param obj pointer to a start object, typically the screen + * @param point pointer to a point for searching the most top child + * @return pointer to the found object or NULL if there was no suitable object + */ +lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point); + +/** + * Add an event handler to the indev + * @param indev pointer to an indev + * @param event_cb an event callback + * @param filter event code to react or `LV_EVENT_ALL` + * @param user_data optional user_data + * @return the event descriptor or NULL if the event couldn't be created + */ +lv_event_dsc_t * lv_indev_add_event_cb(lv_indev_t * indev, lv_event_cb_t event_cb, lv_event_code_t filter, + void * user_data); + +/** + * Get the number of event attached to an indev + * @param indev pointer to an indev + * @return number of events + */ +uint32_t lv_indev_get_event_count(lv_indev_t * indev); + +/** + * Get an event descriptor for an event + * @param indev pointer to an indev + * @param index the index of the event + * @return the event descriptor + */ +lv_event_dsc_t * lv_indev_get_event_dsc(lv_indev_t * indev, uint32_t index); + +/** + * Remove an event + * @param indev pointer to an indev + * @param index the index of the event to remove + * @return true: and event was removed; false: no event was removed + */ +bool lv_indev_remove_event(lv_indev_t * indev, uint32_t index); + +/** + * Remove an event_cb with user_data + * @param indev pointer to a indev + * @param event_cb the event_cb of the event to remove + * @param user_data user_data + * @return the count of the event removed + */ +uint32_t lv_indev_remove_event_cb_with_user_data(lv_indev_t * indev, lv_event_cb_t event_cb, void * user_data); + +/** + * Send an event to an indev + * @param indev pointer to an indev + * @param code an event code. LV_EVENT_... + * @param param optional param + * @return LV_RESULT_OK: indev wasn't deleted in the event. + */ +lv_result_t lv_indev_send_event(lv_indev_t * indev, lv_event_code_t code, void * param); + +/** + * Set key remapping callback (LV_INDEV_TYPE_KEYPAD) + * @param indev pointer to an indev + * @param remap_cb remapping function callback. Use NULL to disable callback. + */ +void lv_indev_set_key_remap_cb(lv_indev_t * indev, lv_indev_key_remap_cb_t remap_cb); + +#if LV_USE_EXT_DATA +/** + * @brief Attaches external user data and destructor callback to an indev + * + * Associates custom user data with an LVGL indev and specifies a destructor function + * that will be automatically invoked when the indev is deleted to properly clean up + * the associated resources. + * + * @param indev Pointer to an indev + * @param data User-defined data pointer to associate with the indev + * @param free_cb Callback function for cleaning up ext_data when indev is deleted. + * Receives ext_data as parameter. NULL means no cleanup required. + */ +void lv_indev_set_external_data(lv_indev_t * indev, void * data, void (* free_cb)(void * data)); +#endif + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_INDEV_H*/ diff --git a/include/lvgl/indev/lv_indev_gesture.h b/include/lvgl/indev/lv_indev_gesture.h new file mode 100644 index 0000000000..0129264ca6 --- /dev/null +++ b/include/lvgl/indev/lv_indev_gesture.h @@ -0,0 +1,249 @@ +/******************************************************************* + * + * @file lv_indev_gesture.h + * + * Copyright (c) 2024 EDGEMTech Ltd. + * + * Author EDGEMTech Ltd, (erik.tagirov@edgemtech.ch) + * + ******************************************************************/ + +#ifndef LV_INDEV_GESTURE_H +#define LV_INDEV_GESTURE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +#if LV_USE_GESTURE_RECOGNITION + +#if LV_USE_FLOAT == 0 +#error "LV_USE_FLOAT is required for gesture detection." +#endif + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/* Opaque types defined in the private header */ +struct lv_indev_gesture; +struct lv_indev_gesture_configuration; + +typedef struct lv_indev_gesture_recognizer lv_indev_gesture_recognizer_t; +typedef struct lv_indev_touch_data lv_indev_touch_data_t; + +typedef struct lv_indev_gesture lv_indev_gesture_t; +typedef struct lv_indev_gesture_configuration lv_indev_gesture_configuration_t; + +typedef void (*lv_recognizer_func_t)(lv_indev_gesture_recognizer_t *, lv_indev_touch_data_t *, uint16_t); + +/* The states of a gesture recognizer */ +typedef enum { + LV_INDEV_GESTURE_STATE_NONE = 0, /* Beginning & end */ + LV_INDEV_GESTURE_STATE_ONGOING, /* Set when there is a probability */ + LV_INDEV_GESTURE_STATE_RECOGNIZED, /* Recognized, the event will contain touch info */ + LV_INDEV_GESTURE_STATE_ENDED, /* A recognized gesture has ended */ + LV_INDEV_GESTURE_STATE_CANCELED, /* Canceled - usually a finger is lifted */ +} lv_indev_gesture_state_t; + +/* Data structures for touch events - used to repsensent a libinput event */ +/* Emitted by devices capable of tracking identifiable contacts (type B) */ +struct lv_indev_touch_data { + lv_point_t point; /* Coordinates of the touch */ + lv_indev_state_t state; /* The state i.e PRESSED or RELEASED */ + uint8_t id; /* Identification/slot of the contact point */ + uint32_t timestamp; /* Timestamp in milliseconds */ +}; + +/* Gesture recognizer */ +struct lv_indev_gesture_recognizer { + lv_indev_gesture_type_t type; /* The detected gesture type */ + lv_indev_gesture_state_t state; /* The gesture state ongoing, recognized */ + lv_indev_gesture_t * info; /* Information on the motion of each touch point */ + float scale; /* Relevant for the pinch gesture */ + float rotation; /* Relevant for rotation */ + float distance; /* Relevant for swipes */ + float speed; + lv_dir_t two_fingers_swipe_dir; /* Relevant for swipes */ + + lv_indev_gesture_configuration_t * config; /* The recognizer config, containing the gestures + thresholds */ + lv_recognizer_func_t recog_fn; /* The recognizer function that this recognizer must execute */ +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize this indev's recognizers. It specifies their recognizer functions + * @param indev pointer to the indev containing the recognizers to initialize + */ +void lv_indev_gesture_init(lv_indev_t * indev); + +/* PINCH Gesture */ + +/** + * Pinch gesture recognizer function + * Will update the recognizer data + * @param recognizer pointer to a gesture recognizer + * @param touches pointer to the first element of the collected touch events + * @param touch_cnt length of passed touch event array. + */ +void lv_indev_gesture_detect_pinch(lv_indev_gesture_recognizer_t * recognizer, lv_indev_touch_data_t * touches, + uint16_t touch_cnt); + +/** + * Rotation gesture recognizer function + * Will update the recognizer data + * @param recognizer pointer to a gesture recognizer + * @param touches pointer to the first element of the collected touch events + * @param touch_cnt length of passed touch event array. + */ +void lv_indev_gesture_detect_rotation(lv_indev_gesture_recognizer_t * recognizer, lv_indev_touch_data_t * touches, + uint16_t touch_cnt); + +/** + * Two finger swipe gesture recognizer function + * Will update the recognizer data + * @param recognizer pointer to a gesture recognizer + * @param touches pointer to the first element of the collected touch events + * @param touch_cnt length of passed touch event array. + */ +void lv_indev_gesture_detect_two_fingers_swipe(lv_indev_gesture_recognizer_t * recognizer, + lv_indev_touch_data_t * touches, + uint16_t touch_cnt); + +/** + * Set the threshold for the pinch gesture scale up, when the scale factor of gesture + * reaches the threshold events get sent + * @param indev pointer to the indev device containing the pinch recognizer + * @param threshold threshold for a pinch up gesture to be recognized + */ +void lv_indev_set_pinch_up_threshold(lv_indev_t * indev, float threshold); + +/** + * Set the threshold for the pinch gesture scale down, when the scale factor of gesture + * reaches the threshold events get sent + * @param indev pointer to the indev device containing the pinch recognizer + * @param threshold threshold for a pinch down gesture to be recognized + */ +void lv_indev_set_pinch_down_threshold(lv_indev_t * indev, float threshold); + +/** + * Set the rotation threshold in radian for the rotation gesture + * @param indev pointer to the indev device containing the rotation recognizer + * @param threshold threshold in radian for a rotation gesture to be recognized + */ +void lv_indev_set_rotation_rad_threshold(lv_indev_t * indev, float threshold); + +/** + * Obtains the current scale of a pinch gesture + * @param gesture_event pointer to a gesture event + * @return the scale of the current gesture + */ +float lv_event_get_pinch_scale(lv_event_t * gesture_event); + +/** + * Obtains the current angle in radian of a rotation gesture + * @param gesture_event pointer to a gesture event + * @return the rotation angle in radian of the current gesture + */ +float lv_event_get_rotation(lv_event_t * gesture_event); + +/** + * Obtains the current distance in pixels of a two fingers swipe gesture, from the starting center + * @param gesture_event pointer to a gesture event + * @return the distance from the center, in pixels, of the current gesture + */ +float lv_event_get_two_fingers_swipe_distance(lv_event_t * gesture_event); + +/** + * Obtains the current direction from the center of a two finger swipe + * @param gesture_event pointer to a gesture event + * @return the rotation angle in radian of the current gesture + */ +lv_dir_t lv_event_get_two_fingers_swipe_dir(lv_event_t * gesture_event); + +/** + * Sets the state of the recognizer to a indev data structure, + * it is usually called from the indev read callback + * @param data the indev data + * @param recognizer pointer to a gesture recognizer + */ +void lv_indev_set_gesture_data(lv_indev_data_t * data, lv_indev_gesture_recognizer_t * recognizer, + lv_indev_gesture_type_t type); + +/** + * Obtains the center point of a gesture + * @param gesture_event pointer to a gesture recognizer event + * @param point pointer to a point + */ +void lv_indev_get_gesture_center_point(lv_indev_gesture_recognizer_t * recognizer, lv_point_t * point); + +/** + * Obtains the current state of the gesture recognizer attached to an event + * @param gesture_event pointer to a gesture recognizer event + * @return current state of the gesture recognizer + */ +lv_indev_gesture_state_t lv_event_get_gesture_state(lv_event_t * gesture_event, lv_indev_gesture_type_t type); + +/** + * Obtains the current event type of the gesture recognizer attached to an event + * @param gesture_event pointer to a gesture recognizer event + * @return current event type of the gesture recognizer + */ +lv_indev_gesture_type_t lv_event_get_gesture_type(lv_event_t * gesture_event); + +/** + * Obtains the coordinates of the current primary point + * @param recognizer pointer to a gesture recognizer + * @param point pointer to a point + */ +void lv_indev_get_gesture_primary_point(lv_indev_gesture_recognizer_t * recognizer, lv_point_t * point); + +/** + * Allows to determine if there is an are ongoing gesture + * @param recognizer pointer to a gesture recognizer + * @return false if there are no contact points, or the gesture has ended - true otherwise + */ +bool lv_indev_recognizer_is_active(lv_indev_gesture_recognizer_t * recognizer); + +/** + * Update the recognizers. It execute the recognizers functions and checks for + * LV_GESTURE_STATE_RECOGNIZED or LV_GESTURE_STATE_ENDED gestures. + * To be called in the indev read_cb. + * @param indev pointer to the indev containing from which the recognizer need an update + * @param touches indev touch data array, containing the last touch data from indev + * since the last recognizers update + * @param touch_cnt number of indev touch data in touches + */ +void lv_indev_gesture_recognizers_update(lv_indev_t * indev, lv_indev_touch_data_t * touches, uint16_t touch_cnt); + +/** + * Set the lv_indev_data_t struct from the recognizer data. + * To be called in the indev read_cb. + */ +void lv_indev_gesture_recognizers_set_data(lv_indev_t * indev, lv_indev_data_t * data); + + +/********************** + * MACROS + **********************/ + +#endif /* END LV_USE_RECOGNITION */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_INDEV_GESTURE_H */ diff --git a/include/lvgl/layouts/lv_flex.h b/include/lvgl/layouts/lv_flex.h new file mode 100644 index 0000000000..17f6e2d552 --- /dev/null +++ b/include/lvgl/layouts/lv_flex.h @@ -0,0 +1,102 @@ +/** + * @file lv_flex.h + * + */ + +#ifndef LV_FLEX_H +#define LV_FLEX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../core/lv_area.h" + +#if LV_USE_FLEX + +/********************* + * DEFINES + *********************/ + +#define LV_FLEX_COLUMN (1 << 0) +#define LV_FLEX_WRAP (1 << 2) +#define LV_FLEX_REVERSE (1 << 3) + +/********************** + * TYPEDEFS + **********************/ + +/*Can't include lv_obj.h because it includes this header file*/ + +typedef enum { + LV_FLEX_ALIGN_START, + LV_FLEX_ALIGN_END, + LV_FLEX_ALIGN_CENTER, + LV_FLEX_ALIGN_SPACE_EVENLY, + LV_FLEX_ALIGN_SPACE_AROUND, + LV_FLEX_ALIGN_SPACE_BETWEEN, +} lv_flex_align_t; + +typedef enum { + LV_FLEX_FLOW_ROW = 0x00, + LV_FLEX_FLOW_COLUMN = LV_FLEX_COLUMN, + LV_FLEX_FLOW_ROW_WRAP = LV_FLEX_FLOW_ROW | LV_FLEX_WRAP, + LV_FLEX_FLOW_ROW_REVERSE = LV_FLEX_FLOW_ROW | LV_FLEX_REVERSE, + LV_FLEX_FLOW_ROW_WRAP_REVERSE = LV_FLEX_FLOW_ROW | LV_FLEX_WRAP | LV_FLEX_REVERSE, + LV_FLEX_FLOW_COLUMN_WRAP = LV_FLEX_FLOW_COLUMN | LV_FLEX_WRAP, + LV_FLEX_FLOW_COLUMN_REVERSE = LV_FLEX_FLOW_COLUMN | LV_FLEX_REVERSE, + LV_FLEX_FLOW_COLUMN_WRAP_REVERSE = LV_FLEX_FLOW_COLUMN | LV_FLEX_WRAP | LV_FLEX_REVERSE, +} lv_flex_flow_t; + +/********************** + * GLOBAL VARIABLES + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize a flex layout to default values + */ +void lv_flex_init(void); + +/** + * Set how the item should flow + * @param obj pointer to an object. The parent must have flex layout else nothing will happen. + * @param flow an element of `lv_flex_flow_t`. + */ +void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow); + +/** + * Set how to place (where to align) the items and tracks + * @param obj pointer to an object. The parent must have flex layout else nothing will happen. + * @param main_place where to place the items on main axis (in their track). Any value of `lv_flex_align_t`. + * @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_ALIGN_START/END/CENTER` + * @param track_cross_place where to place the tracks in the cross direction. Any value of `lv_flex_align_t`. + */ +void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place, + lv_flex_align_t track_cross_place); + +/** + * Sets the width or height (on main axis) to grow the object in order fill the free space + * @param obj pointer to an object. The parent must have flex layout else nothing will happen. + * @param grow a value to set how much free space to take proportionally to other growing items. + */ +void lv_obj_set_flex_grow(lv_obj_t * obj, uint8_t grow); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_FLEX*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FLEX_H*/ diff --git a/include/lvgl/layouts/lv_grid.h b/include/lvgl/layouts/lv_grid.h new file mode 100644 index 0000000000..977c874489 --- /dev/null +++ b/include/lvgl/layouts/lv_grid.h @@ -0,0 +1,99 @@ +/** + * @file lv_grid.h + * + */ + +#ifndef LV_GRID_H +#define LV_GRID_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../core/lv_area.h" + +#if LV_USE_GRID + +/********************* + * DEFINES + *********************/ +/** + * Can be used track size to make the track fill the free space. + * @param x how much space to take proportionally to other FR tracks + * @return a special track size + */ +#define LV_GRID_FR(x) (LV_COORD_MAX - 100 + x) + +#define LV_GRID_CONTENT (LV_COORD_MAX - 101) +LV_EXPORT_CONST_INT(LV_GRID_CONTENT); + +#define LV_GRID_TEMPLATE_LAST (LV_COORD_MAX) +LV_EXPORT_CONST_INT(LV_GRID_TEMPLATE_LAST); + +/********************** + * TYPEDEFS + **********************/ + +/*Can't include lv_obj.h because it includes this header file*/ + +typedef enum { + LV_GRID_ALIGN_START, + LV_GRID_ALIGN_CENTER, + LV_GRID_ALIGN_END, + LV_GRID_ALIGN_STRETCH, + LV_GRID_ALIGN_SPACE_EVENLY, + LV_GRID_ALIGN_SPACE_AROUND, + LV_GRID_ALIGN_SPACE_BETWEEN, +} lv_grid_align_t; + +/********************** + * GLOBAL VARIABLES + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +void lv_grid_init(void); + +void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const int32_t col_dsc[], const int32_t row_dsc[]); + +void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align); + +/** + * Set the cell of an object. The object's parent needs to have grid layout, else nothing will happen + * @param obj pointer to an object + * @param column_align the vertical alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH` + * @param col_pos column ID + * @param col_span number of columns to take (>= 1) + * @param row_align the horizontal alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH` + * @param row_pos row ID + * @param row_span number of rows to take (>= 1) + */ +void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t column_align, int32_t col_pos, int32_t col_span, + lv_grid_align_t row_align, int32_t row_pos, int32_t row_span); + +/** + * Just a wrapper to `LV_GRID_FR` for bindings. + */ +int32_t lv_grid_fr(uint8_t x); + +/********************** + * GLOBAL VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_GRID*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_GRID_H*/ diff --git a/include/lvgl/layouts/lv_layout.h b/include/lvgl/layouts/lv_layout.h new file mode 100644 index 0000000000..7d1d215253 --- /dev/null +++ b/include/lvgl/layouts/lv_layout.h @@ -0,0 +1,85 @@ +/** + * @file lv_layout.h + * + */ + +#ifndef LV_LAYOUT_H +#define LV_LAYOUT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef void (*lv_layout_update_cb_t)(lv_obj_t *, void * user_data); +typedef bool (*lv_layout_get_min_size_cb_t)(lv_obj_t *, int32_t * req_size, bool width, void * user_data); + +typedef struct { + lv_layout_update_cb_t layout_update_cb; + lv_layout_get_min_size_cb_t get_min_size_cb; +} lv_layout_callbacks_t; + + +typedef enum { + LV_LAYOUT_NONE = 0, + +#if LV_USE_FLEX + LV_LAYOUT_FLEX, +#endif + +#if LV_USE_GRID + LV_LAYOUT_GRID, +#endif + + LV_LAYOUT_LAST +} lv_layout_t; + + +/** + * Create a new layout + * @param callbacks the layout callbacks + * @param user_data custom data that will be passed when a callback is invoked + * @return the ID of the new layout + */ +uint32_t lv_layout_create(lv_layout_callbacks_t callbacks, void * user_data); + +/** + * DEPRECATED: `lv_layout_register` is deprecated. `lv_layout_create` should be used instead. + * + * Register a new layout + * @param cb the layout update callback + * @param user_data custom data that will be passed to `cb` + * @return the ID of the new layout + */ +uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data); + +/********************** + * MACROS + **********************/ + +#if LV_USE_FLEX +#include "lv_flex.h" +#endif /* LV_USE_FLEX */ + +#if LV_USE_GRID +#include "lv_grid.h" +#endif /* LV_USE_GRID */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LAYOUT_H*/ diff --git a/include/lvgl/logging/lv_log.h b/include/lvgl/logging/lv_log.h new file mode 100644 index 0000000000..37f0473e0b --- /dev/null +++ b/include/lvgl/logging/lv_log.h @@ -0,0 +1,162 @@ +/** + * @file lv_log.h + * + */ + +#ifndef LV_LOG_H +#define LV_LOG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/*Possible log level. For compatibility declare it independently from `LV_USE_LOG`*/ + +#define LV_LOG_LEVEL_TRACE 0 /**< Log detailed information. */ +#define LV_LOG_LEVEL_INFO 1 /**< Log important events. */ +#define LV_LOG_LEVEL_WARN 2 /**< Log if something unwanted happened but didn't caused problem. */ +#define LV_LOG_LEVEL_ERROR 3 /**< Log only critical issues, when system may fail. */ +#define LV_LOG_LEVEL_USER 4 /**< Log only custom log messages added by the user. */ +#define LV_LOG_LEVEL_NONE 5 /**< Do not log anything. */ +#define LV_LOG_LEVEL_NUM 5 /**< Number of log levels */ + +LV_EXPORT_CONST_INT(LV_LOG_LEVEL_TRACE); +LV_EXPORT_CONST_INT(LV_LOG_LEVEL_INFO); +LV_EXPORT_CONST_INT(LV_LOG_LEVEL_WARN); +LV_EXPORT_CONST_INT(LV_LOG_LEVEL_ERROR); +LV_EXPORT_CONST_INT(LV_LOG_LEVEL_USER); +LV_EXPORT_CONST_INT(LV_LOG_LEVEL_NONE); + +typedef int8_t lv_log_level_t; + +#if LV_USE_LOG + +#if LV_LOG_USE_FILE_LINE +#define LV_LOG_FILE __FILE__ +#define LV_LOG_LINE __LINE__ +#else +#define LV_LOG_FILE NULL +#define LV_LOG_LINE 0 +#endif + +/********************** + * TYPEDEFS + **********************/ + +/** + * Log print function. Receives a string buffer to print". + */ +typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char * buf); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Register custom print/write function to call when a log is added. + * It can format its "File path", "Line number" and "Description" as required + * and send the formatted log message to a console or serial port. + * @param print_cb a function pointer to print a log + */ +void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb); + +/** + * Print a log message via `printf` if enabled with `LV_LOG_PRINTF` in `lv_conf.h` + * and/or a print callback if registered with `lv_log_register_print_cb` + * @param format printf-like format string + * @param ... parameters for `format` + */ +void lv_log(const char * format, ...) LV_FORMAT_ATTRIBUTE(1, 2); + +/** + * Add a log + * @param level the level of log. (From `lv_log_level_t` enum) + * @param file name of the file when the log added + * @param line line number in the source code where the log added + * @param func name of the function when the log added + * @param format printf-like format string + * @param ... parameters for `format` + */ +void lv_log_add(lv_log_level_t level, const char * file, int line, + const char * func, const char * format, ...) LV_FORMAT_ATTRIBUTE(5, 6); + +/********************** + * MACROS + **********************/ +#ifndef LV_LOG_TRACE +# if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE +# define LV_LOG_TRACE(...) lv_log_add(LV_LOG_LEVEL_TRACE, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# else +# define LV_LOG_TRACE(...) do {}while(0) +# endif +#endif + +#ifndef LV_LOG_INFO +# if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO +# define LV_LOG_INFO(...) lv_log_add(LV_LOG_LEVEL_INFO, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# else +# define LV_LOG_INFO(...) do {}while(0) +# endif +#endif + +#ifndef LV_LOG_WARN +# if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN +# define LV_LOG_WARN(...) lv_log_add(LV_LOG_LEVEL_WARN, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# else +# define LV_LOG_WARN(...) do {}while(0) +# endif +#endif + +#ifndef LV_LOG_ERROR +# if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR +# define LV_LOG_ERROR(...) lv_log_add(LV_LOG_LEVEL_ERROR, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# else +# define LV_LOG_ERROR(...) do {}while(0) +# endif +#endif + +#ifndef LV_LOG_USER +# if LV_LOG_LEVEL <= LV_LOG_LEVEL_USER +# define LV_LOG_USER(...) lv_log_add(LV_LOG_LEVEL_USER, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# else +# define LV_LOG_USER(...) do {}while(0) +# endif +#endif + +#ifndef LV_LOG +# if LV_LOG_LEVEL < LV_LOG_LEVEL_NONE +# define LV_LOG(...) lv_log(__VA_ARGS__) +# else +# define LV_LOG(...) do {} while(0) +# endif +#endif + +#else /*LV_USE_LOG*/ + +/*Do nothing if `LV_USE_LOG 0`*/ +#define lv_log_add(level, file, line, ...) +#define LV_LOG_TRACE(...) do {}while(0) +#define LV_LOG_INFO(...) do {}while(0) +#define LV_LOG_WARN(...) do {}while(0) +#define LV_LOG_ERROR(...) do {}while(0) +#define LV_LOG_USER(...) do {}while(0) +#define LV_LOG(...) do {}while(0) + +#endif /*LV_USE_LOG*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LOG_H*/ diff --git a/include/lvgl/lv_types.h b/include/lvgl/lv_types.h new file mode 100644 index 0000000000..8e1978b4a2 --- /dev/null +++ b/include/lvgl/lv_types.h @@ -0,0 +1,448 @@ +/** + * @file lv_types.h + * + */ + +#ifndef LV_TYPES_H +#define LV_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "config/lv_conf_internal.h" + +#ifndef __ASSEMBLY__ +#include LV_STDINT_INCLUDE +#include LV_STDDEF_INCLUDE +#include LV_STDBOOL_INCLUDE +#include LV_INTTYPES_INCLUDE +#include LV_LIMITS_INCLUDE +#include LV_STDARG_INCLUDE +#endif + +/********************* + * DEFINES + *********************/ + +/*If __UINTPTR_MAX__ or UINTPTR_MAX are available, use them to determine arch size*/ +#if defined(__UINTPTR_MAX__) && __UINTPTR_MAX__ > 0xFFFFFFFF +#define LV_ARCH_64 + +#elif defined(UINTPTR_MAX) && UINTPTR_MAX > 0xFFFFFFFF +#define LV_ARCH_64 + +/*Otherwise use compiler-dependent means to determine arch size*/ +#elif defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined (__aarch64__) +#define LV_ARCH_64 + +#endif + +#if LV_USE_3DTEXTURE +#if LV_USE_OPENGLES +#define LV_3DTEXTURE_ID_NULL 0u +#endif + +#ifndef LV_3DTEXTURE_ID_NULL +#error enable LV_USE_OPENGLES to use LV_USE_3DTEXTURE +#endif +#endif /*LV_USE_3DTEXTURE*/ + +/********************** + * TYPEDEFS + **********************/ + +/* Exclude C enum and struct definitions when included by assembly code */ +#ifndef __ASSEMBLY__ + +/** + * LVGL error codes. + */ +typedef enum { + LV_RESULT_INVALID = 0, /*Typically indicates that the object is deleted (become invalid) in the action + function or an operation was failed*/ + LV_RESULT_OK, /*The object is valid (no deleted) after the action*/ +} lv_result_t; + +#if defined(__cplusplus) || __STDC_VERSION__ >= 199901L +/*If c99 or newer, use the definition of uintptr_t directly from */ +typedef uintptr_t lv_uintptr_t; +typedef intptr_t lv_intptr_t; + +#else + +/*Otherwise, use the arch size determination*/ +#ifdef LV_ARCH_64 +typedef uint64_t lv_uintptr_t; +typedef int64_t lv_intptr_t; +#else +typedef uint32_t lv_uintptr_t; +typedef int32_t lv_intptr_t; +#endif + +#endif + +#if LV_USE_FLOAT +typedef float lv_value_precise_t; +#else +typedef int32_t lv_value_precise_t; +#endif + +#if LV_USE_3DTEXTURE +#if LV_USE_OPENGLES +typedef unsigned int lv_3dtexture_id_t; +#endif +#endif + +/** + * Typedefs from various lvgl modules. + * They are defined here to avoid circular dependencies. + */ + +typedef struct _lv_obj_t lv_obj_t; + +typedef lv_obj_t * (*lv_screen_create_cb_t)(void); + +typedef uint8_t lv_opa_t; + +typedef uint8_t lv_style_prop_t; + +typedef struct _lv_obj_class_t lv_obj_class_t; + +typedef struct _lv_group_t lv_group_t; + +typedef struct _lv_display_t lv_display_t; + +typedef struct _lv_layer_t lv_layer_t; +typedef struct _lv_draw_unit_t lv_draw_unit_t; +typedef struct _lv_draw_task_t lv_draw_task_t; + +typedef struct _lv_indev_t lv_indev_t; + +typedef struct _lv_event_t lv_event_t; + +typedef struct _lv_timer_t lv_timer_t; + +typedef struct _lv_theme_t lv_theme_t; + +typedef struct _lv_anim_t lv_anim_t; + +typedef struct _lv_anim_timeline_t lv_anim_timeline_t; + +typedef struct _lv_font_t lv_font_t; +typedef struct _lv_font_class_t lv_font_class_t; +typedef struct _lv_font_info_t lv_font_info_t; + +typedef struct _lv_font_manager_t lv_font_manager_t; + +typedef struct _lv_image_decoder_t lv_image_decoder_t; + +typedef struct _lv_image_decoder_dsc_t lv_image_decoder_dsc_t; + +typedef struct _lv_draw_image_dsc_t lv_draw_image_dsc_t; + +typedef struct _lv_fragment_t lv_fragment_t; +typedef struct _lv_fragment_class_t lv_fragment_class_t; +typedef struct _lv_fragment_managed_states_t lv_fragment_managed_states_t; + +typedef struct _lv_profiler_builtin_config_t lv_profiler_builtin_config_t; + +typedef struct _lv_color_filter_dsc_t lv_color_filter_dsc_t; + +typedef struct _lv_event_dsc_t lv_event_dsc_t; + +typedef struct _lv_fs_file_cache_t lv_fs_file_cache_t; + +typedef struct _lv_image_decoder_args_t lv_image_decoder_args_t; + +typedef struct _lv_image_cache_data_t lv_image_cache_data_t; + +typedef struct _lv_image_header_cache_data_t lv_image_header_cache_data_t; + +typedef struct _lv_draw_mask_t lv_draw_mask_t; + +typedef struct _lv_draw_label_hint_t lv_draw_label_hint_t; + +typedef struct _lv_draw_glyph_dsc_t lv_draw_glyph_dsc_t; + +typedef struct _lv_draw_image_sup_t lv_draw_image_sup_t; + +typedef struct _lv_draw_mask_rect_dsc_t lv_draw_mask_rect_dsc_t; + +typedef struct _lv_obj_style_t lv_obj_style_t; + +typedef struct _lv_obj_style_transition_dsc_t lv_obj_style_transition_dsc_t; + +typedef struct _lv_hit_test_info_t lv_hit_test_info_t; + +typedef struct _lv_cover_check_info_t lv_cover_check_info_t; + +typedef struct _lv_image_t lv_image_t; + +typedef struct _lv_animimg_t lv_animimg_t; + +typedef struct _lv_arc_t lv_arc_t; + +typedef struct _lv_arclabel_t lv_arclabel_t; + +typedef struct _lv_label_t lv_label_t; + +typedef struct _lv_bar_anim_t lv_bar_anim_t; + +typedef struct _lv_bar_t lv_bar_t; + +typedef struct _lv_button_t lv_button_t; + +typedef struct _lv_buttonmatrix_t lv_buttonmatrix_t; + +typedef struct _lv_calendar_t lv_calendar_t; + +typedef struct _lv_canvas_t lv_canvas_t; + +typedef struct _lv_chart_series_t lv_chart_series_t; + +typedef struct _lv_chart_cursor_t lv_chart_cursor_t; + +typedef struct _lv_chart_t lv_chart_t; + +typedef struct _lv_checkbox_t lv_checkbox_t; + +typedef struct _lv_dropdown_t lv_dropdown_t; + +typedef struct _lv_dropdown_list_t lv_dropdown_list_t; + +typedef struct _lv_imagebutton_src_info_t lv_imagebutton_src_info_t; + +typedef struct _lv_imagebutton_t lv_imagebutton_t; + +typedef struct _lv_keyboard_t lv_keyboard_t; + +typedef struct _lv_led_t lv_led_t; + +typedef struct _lv_line_t lv_line_t; + +typedef struct _lv_menu_load_page_event_data_t lv_menu_load_page_event_data_t; + +typedef struct _lv_menu_history_t lv_menu_history_t; + +typedef struct _lv_menu_t lv_menu_t; + +typedef struct _lv_menu_page_t lv_menu_page_t; + +typedef struct _lv_msgbox_t lv_msgbox_t; + +typedef struct _lv_roller_t lv_roller_t; + +typedef struct _lv_scale_section_t lv_scale_section_t; + +typedef struct _lv_scale_t lv_scale_t; + +typedef struct _lv_slider_t lv_slider_t; + +typedef struct _lv_span_t lv_span_t; + +typedef struct _lv_spangroup_t lv_spangroup_t; + +typedef struct _lv_textarea_t lv_textarea_t; + +typedef struct _lv_spinbox_t lv_spinbox_t; + +typedef struct _lv_switch_t lv_switch_t; + +typedef struct _lv_table_cell_t lv_table_cell_t; + +typedef struct _lv_table_t lv_table_t; + +typedef struct _lv_tabview_t lv_tabview_t; + +typedef struct _lv_tileview_t lv_tileview_t; + +typedef struct _lv_tileview_tile_t lv_tileview_tile_t; + +typedef struct _lv_win_t lv_win_t; + +typedef struct _lv_spinner_t lv_spinner_t; + +typedef struct _lv_3dtexture_t lv_3dtexture_t; + +typedef struct _lv_gltf_t lv_gltf_t; + +typedef struct _lv_gltf_model_t lv_gltf_model_t; + +typedef struct _lv_gltf_model_node_t lv_gltf_model_node_t; + +typedef struct _lv_gltf_environment lv_gltf_environment_t; + +typedef struct _lv_gltf_ibl_sampler lv_gltf_ibl_sampler_t; + +typedef struct _lv_subject_t lv_subject_t; + +typedef struct _lv_observer_t lv_observer_t; + +typedef struct _lv_subject_increment_dsc_t lv_subject_increment_dsc_t; + +typedef struct _lv_monkey_config_t lv_monkey_config_t; + +typedef struct _lv_ime_pinyin_t lv_ime_pinyin_t; + +typedef struct _lv_file_explorer_t lv_file_explorer_t; + +typedef struct _lv_barcode_t lv_barcode_t; + +typedef struct _lv_qrcode_t lv_qrcode_t; + +typedef struct _lv_freetype_outline_vector_t lv_freetype_outline_vector_t; + +typedef struct _lv_freetype_outline_event_param_t lv_freetype_outline_event_param_t; + +typedef struct _lv_fpoint_t lv_fpoint_t; + +typedef struct _lv_matrix_t lv_matrix_t; + +typedef struct _lv_vector_path_t lv_vector_path_t; + +typedef struct _lv_vector_gradient_t lv_vector_gradient_t; + +typedef struct _lv_vector_fill_dsc_t lv_vector_fill_dsc_t; + +typedef struct _lv_vector_stroke_dsc_t lv_vector_stroke_dsc_t; + +typedef struct _lv_vector_path_ctx_t lv_vector_path_ctx_t; + +typedef struct _lv_draw_vector_dsc_t lv_draw_vector_dsc_t; + +typedef struct _lv_xkb_t lv_xkb_t; + +typedef struct _lv_libinput_event_t lv_libinput_event_t; + +typedef struct _lv_libinput_t lv_libinput_t; + +typedef struct _lv_draw_sw_unit_t lv_draw_sw_unit_t; + +typedef struct _lv_draw_sw_mask_common_dsc_t lv_draw_sw_mask_common_dsc_t; + +typedef struct _lv_draw_sw_mask_line_param_t lv_draw_sw_mask_line_param_t; + +typedef struct _lv_draw_sw_mask_angle_param_t lv_draw_sw_mask_angle_param_t; + +typedef struct _lv_draw_sw_mask_radius_param_t lv_draw_sw_mask_radius_param_t; + +typedef struct _lv_draw_sw_mask_fade_param_t lv_draw_sw_mask_fade_param_t; + +typedef struct _lv_draw_sw_mask_map_param_t lv_draw_sw_mask_map_param_t; + +typedef struct _lv_draw_sw_blend_dsc_t lv_draw_sw_blend_dsc_t; + +typedef struct _lv_draw_sw_blend_fill_dsc_t lv_draw_sw_blend_fill_dsc_t; + +typedef struct _lv_draw_sw_blend_image_dsc_t lv_draw_sw_blend_image_dsc_t; + +typedef struct _lv_draw_buf_handlers_t lv_draw_buf_handlers_t; + +typedef struct _lv_rlottie_t lv_rlottie_t; + +typedef struct _lv_ffmpeg_player_t lv_ffmpeg_player_t; + +typedef struct _lv_opengles_window_t lv_opengles_window_t; +typedef struct _lv_opengles_window_texture_t lv_opengles_window_texture_t; + +typedef struct _lv_tree_class_t lv_tree_class_t; +typedef struct _lv_tree_node_t lv_tree_node_t; +typedef uint32_t lv_prop_id_t; + + +typedef struct _lv_draw_buf_t lv_draw_buf_t; + +#if LV_USE_OBJ_PROPERTY +typedef struct _lv_property_name_t lv_property_name_t; +#endif + +#if LV_USE_SYSMON + +typedef struct _lv_sysmon_backend_data_t lv_sysmon_backend_data_t; + +#if LV_USE_PERF_MONITOR +typedef struct _lv_sysmon_perf_info_t lv_sysmon_perf_info_t; +#endif /*LV_USE_PERF_MONITOR*/ + +#endif /*LV_USE_SYSMON*/ + + +#if LV_USE_EVDEV +typedef struct _lv_evdev_discovery_t lv_evdev_discovery_t; +#endif + +#if LV_USE_TRANSLATION +typedef struct _lv_translation_tag_dsc_t lv_translation_tag_dsc_t; + +typedef struct _lv_translation_pack_t lv_translation_pack_t; +#endif + +#if LV_USE_DRAW_EVE +typedef struct _lv_draw_eve_unit_t lv_draw_eve_unit_t; +#endif + +#endif /*__ASSEMBLY__*/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#define LV_UNUSED(x) ((void)x) + +#define _LV_CONCAT(x, y) x ## y +#define LV_CONCAT(x, y) _LV_CONCAT(x, y) +#undef _LV_CONCAT + +#define _LV_CONCAT3(x, y, z) x ## y ## z +#define LV_CONCAT3(x, y, z) _LV_CONCAT3(x, y, z) +#undef _LV_CONCAT3 + +#if defined(PYCPARSER) || defined(__CC_ARM) +#define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) +#elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __GNUC__ > 4) +#define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) __attribute__((format(gnu_printf, fmtstr, vararg))) +#elif (defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(__IAR_SYSTEMS_ICC__)) +#define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) __attribute__((format(printf, fmtstr, vararg))) +#else +#define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) +#endif + +#ifndef LV_NORETURN +#if defined(PYCPARSER) +#define LV_NORETURN +#elif defined(__GNUC__) +#define LV_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define LV_NORETURN __declspec(noreturn) +#else +#define LV_NORETURN +#endif +#endif /* LV_NORETURN not defined */ + +#ifndef LV_UNREACHABLE +#if defined(__GNUC__) +#define LV_UNREACHABLE() __builtin_unreachable() +#elif defined(_MSC_VER) +#define LV_UNREACHABLE() __assume(0) +#else +#define LV_UNREACHABLE() while(1) +#endif +#endif /* LV_UNREACHABLE not defined */ + +#ifndef LV_ARRAYLEN +#define LV_ARRAYLEN(a) (sizeof(a)/sizeof((a)[0])) +#endif /*LV_ARRAYLEN*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TYPES_H*/ diff --git a/include/lvgl/lv_version.h b/include/lvgl/lv_version.h new file mode 100644 index 0000000000..f22718ae5b --- /dev/null +++ b/include/lvgl/lv_version.h @@ -0,0 +1,14 @@ +/** + * @file lv_version.h + * The current version of LVGL + */ + +#ifndef LV_VERSION_H +#define LV_VERSION_H + +#define LVGL_VERSION_MAJOR 9 +#define LVGL_VERSION_MINOR 6 +#define LVGL_VERSION_PATCH 0 +#define LVGL_VERSION_INFO "dev" + +#endif /* LV_VERSION_H */ diff --git a/include/lvgl/lvgl.h b/include/lvgl/lvgl.h new file mode 100644 index 0000000000..1ad2dd7cf0 --- /dev/null +++ b/include/lvgl/lvgl.h @@ -0,0 +1,267 @@ +#ifndef LVGL_H +#define LVGL_H + +#include "lv_version.h" +#include "3d/lv_3dmath.h" +#include "3d/lv_gltf_environment.h" +#include "3d/lv_gltf_model.h" +#include "3d/lv_gltf_model_loader.h" +#include "3d/lv_gltf_model_node.h" + +/* Define LV_DISABLE_API_MAPPING using a compiler option + * to make sure your application is not using deprecated names */ +#ifndef LV_DISABLE_API_MAPPING + #include "api_map/lv_api_map_v8.h" + #include "api_map/lv_api_map_v9_0.h" + #include "api_map/lv_api_map_v9_1.h" + #include "api_map/lv_api_map_v9_2.h" + #include "api_map/lv_api_map_v9_3.h" + #include "api_map/lv_api_map_v9_4.h" + #include "api_map/lv_api_map_v9_5.h" +#endif /*LV_DISABLE_API_MAPPING*/ + +#include "config/lv_conf_internal.h" +#include "config/lv_conf_kconfig.h" +#include "core/lv_anim.h" +#include "core/lv_anim_timeline.h" +#include "core/lv_area.h" +#include "core/lv_event.h" +#include "core/lv_group.h" +#include "core/lv_init.h" +#include "core/lv_matrix.h" +#include "core/lv_obj.h" +#include "core/lv_obj_class.h" +#include "core/lv_obj_draw.h" +#include "core/lv_obj_event.h" +#include "core/lv_obj_pos.h" +#include "core/lv_obj_property.h" +#include "core/lv_obj_property_names.h" +#include "core/lv_obj_scroll.h" +#include "core/lv_obj_style.h" +#include "core/lv_obj_style_gen.h" +#include "core/lv_obj_tree.h" +#include "core/lv_observer.h" +#include "core/lv_refr.h" +#include "core/lv_style.h" +#include "core/lv_style_gen.h" +#include "core/lv_style_properties.h" +#include "core/lv_timer.h" +#include "core/lv_translation.h" +#include "debugging/lv_assert.h" +#include "debugging/lv_check_arg.h" +#include "debugging/lv_monkey.h" +#include "debugging/lv_profiler.h" +#include "debugging/lv_profiler_builtin.h" +#include "debugging/lv_sysmon.h" +#include "debugging/lv_test.h" +#include "debugging/lv_test_display.h" +#include "debugging/lv_test_fs.h" +#include "debugging/lv_test_helpers.h" +#include "debugging/lv_test_indev.h" +#include "debugging/lv_test_indev_gesture.h" +#include "debugging/lv_test_screenshot_compare.h" +#include "display/lv_display.h" +#include "draw/lv_color.h" +#include "draw/lv_color_op.h" +#include "draw/lv_draw.h" +#include "draw/lv_draw_3d.h" +#include "draw/lv_draw_arc.h" +#include "draw/lv_draw_blur.h" +#include "draw/lv_draw_buf.h" +#include "draw/lv_draw_image.h" +#include "draw/lv_draw_label.h" +#include "draw/lv_draw_line.h" +#include "draw/lv_draw_mask.h" +#include "draw/lv_draw_rect.h" +#include "draw/lv_draw_triangle.h" +#include "draw/lv_draw_vector.h" +#include "draw/lv_grad.h" +#include "draw/lv_image_dsc.h" +#include "draw/lv_palette.h" +#include "draw/lv_snapshot.h" +#include "draw/sw/lv_draw_sw_utils.h" +#include "drivers/display/lv_linux_drm.h" +#include "drivers/display/lv_draw_eve_display.h" +#include "drivers/display/lv_draw_eve_display_defines.h" +#include "drivers/display/lv_draw_eve_target.h" +#include "drivers/display/lv_linux_fbdev.h" +#include "drivers/display/lv_ft81x.h" +#include "drivers/display/lv_ili9341.h" +#include "drivers/display/lv_lcd_generic_mipi.h" +#include "drivers/display/lv_lovyan_gfx.h" +#include "drivers/display/lv_nv3007.h" +#include "drivers/display/lv_nxp_elcdif.h" +#include "drivers/display/lv_renesas_glcdc.h" +#include "drivers/display/lv_st7735.h" +#include "drivers/display/lv_st7789.h" +#include "drivers/display/lv_st7796.h" +#include "drivers/display/lv_st_ltdc.h" +#include "drivers/display/lv_tft_espi.h" +#include "drivers/ffmpeg/lv_ffmpeg.h" +#include "drivers/indev/lv_evdev.h" +#include "drivers/indev/lv_libinput.h" +#include "drivers/indev/lv_xkb.h" +#include "drivers/nuttx/lv_nuttx_entry.h" +#include "drivers/nuttx/lv_nuttx_fbdev.h" +#include "drivers/nuttx/lv_nuttx_lcd.h" +#include "drivers/nuttx/lv_nuttx_libuv.h" +#include "drivers/nuttx/lv_nuttx_touchscreen.h" +#include "drivers/opengles/lv_opengles_driver.h" +#include "drivers/opengles/lv_opengles_glfw.h" +#include "drivers/opengles/lv_opengles_texture.h" +#include "drivers/opengles/lv_opengles_window.h" +#include "drivers/qnx/lv_qnx.h" +#include "drivers/sdl/lv_sdl_keyboard.h" +#include "drivers/sdl/lv_sdl_mouse.h" +#include "drivers/sdl/lv_sdl_mousewheel.h" +#include "drivers/sdl/lv_sdl_window.h" +#include "drivers/uefi/lv_uefi.h" +#include "drivers/uefi/lv_uefi_context.h" +#include "drivers/uefi/lv_uefi_display.h" +#include "drivers/uefi/lv_uefi_edk2.h" +#include "drivers/uefi/lv_uefi_gnu_efi.h" +#include "drivers/uefi/lv_uefi_indev.h" +#include "drivers/wayland/lv_wayland.h" +#include "drivers/wayland/lv_wayland_keyboard.h" +#include "drivers/wayland/lv_wayland_pointer.h" +#include "drivers/wayland/lv_wayland_pointer_axis.h" +#include "drivers/wayland/lv_wayland_touch.h" +#include "drivers/wayland/lv_wayland_window.h" +#include "drivers/windows/lv_windows_display.h" +#include "drivers/windows/lv_windows_input.h" +#include "drivers/x11/lv_x11.h" +#include "font/lv_bidi.h" +#include "font/lv_binfont_loader.h" +#include "font/lv_font.h" +#include "font/lv_font_fmt_txt.h" +#include "font/lv_font_manager.h" +#include "font/lv_freetype.h" +#include "font/lv_imgfont.h" +#include "font/lv_symbol_def.h" +#include "font/lv_text.h" +#include "font/lv_tiny_ttf.h" +#include "fs/lv_fs.h" +#include "fs/lv_fsdrv.h" +#include "image/lv_bin_decoder.h" +#include "image/lv_bmp.h" +#include "image/lv_libjpeg_turbo.h" +#include "image/lv_libpng.h" +#include "image/lv_libwebp.h" +#include "image/lv_lodepng.h" +#include "image/lv_image_decoder.h" +#include "image/lv_svg.h" +#include "image/lv_tjpgd.h" +#include "indev/lv_gridnav.h" +#include "indev/lv_indev.h" +#include "indev/lv_indev_gesture.h" +#include "layouts/lv_flex.h" +#include "layouts/lv_grid.h" +#include "layouts/lv_layout.h" +#include "logging/lv_log.h" +#include "lv_types.h" +#include "misc/lv_async.h" +#include "misc/lv_math.h" +#include "misc/lv_tree.h" +#include "osal/lv_os.h" +#include "others/file_explorer/lv_file_explorer.h" +#include "others/fragment/lv_fragment.h" +#include "stdlib/lv_mem.h" +#include "stdlib/lv_sprintf.h" +#include "stdlib/lv_string.h" +#include "themes/default/lv_theme_default.h" +#include "themes/lv_theme.h" +#include "themes/mono/lv_theme_mono.h" +#include "themes/simple/lv_theme_simple.h" +#include "tick/lv_tick.h" +#include "widgets/lv_3dtexture.h" +#include "widgets/lv_animimage.h" +#include "widgets/lv_arc.h" +#include "widgets/lv_arclabel.h" +#include "widgets/lv_bar.h" +#include "widgets/lv_barcode.h" +#include "widgets/lv_button.h" +#include "widgets/lv_buttonmatrix.h" +#include "widgets/lv_calendar.h" +#include "widgets/lv_calendar_chinese.h" +#include "widgets/lv_calendar_header_arrow.h" +#include "widgets/lv_calendar_header_dropdown.h" +#include "widgets/lv_canvas.h" +#include "widgets/lv_chart.h" +#include "widgets/lv_checkbox.h" +#include "widgets/lv_dropdown.h" +#include "widgets/lv_gif.h" +#include "widgets/lv_gltf.h" +#include "widgets/lv_gstreamer.h" +#include "widgets/lv_image.h" +#include "widgets/lv_imagebutton.h" +#include "widgets/lv_ime_pinyin.h" +#include "widgets/lv_keyboard.h" +#include "widgets/lv_label.h" +#include "widgets/lv_led.h" +#include "widgets/lv_line.h" +#include "widgets/lv_list.h" +#include "widgets/lv_lottie.h" +#include "widgets/lv_menu.h" +#include "widgets/lv_msgbox.h" +#include "widgets/lv_qrcode.h" +#include "widgets/lv_rlottie.h" +#include "widgets/lv_roller.h" +#include "widgets/lv_scale.h" +#include "widgets/lv_slider.h" +#include "widgets/lv_span.h" +#include "widgets/lv_spinbox.h" +#include "widgets/lv_spinner.h" +#include "widgets/lv_switch.h" +#include "widgets/lv_table.h" +#include "widgets/lv_tabview.h" +#include "widgets/lv_textarea.h" +#include "widgets/lv_tileview.h" +#include "widgets/lv_win.h" + +/** Gives 1 if the x.y.z version is supported in the current version + * Usage: + * + * - Require v6 + * #if LV_VERSION_CHECK(6,0,0) + * new_func_in_v6(); + * #endif + * + * + * - Require at least v5.3 + * #if LV_VERSION_CHECK(5,3,0) + * new_feature_from_v5_3(); + * #endif + * + * + * - Require v5.3.2 bugfixes + * #if LV_VERSION_CHECK(5,3,2) + * bugfix_in_v5_3_2(); + * #endif + * + */ +#define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH))) + +/** + * Wrapper functions for VERSION macros + */ + +static inline int lv_version_major(void) +{ + return LVGL_VERSION_MAJOR; +} + +static inline int lv_version_minor(void) +{ + return LVGL_VERSION_MINOR; +} + +static inline int lv_version_patch(void) +{ + return LVGL_VERSION_PATCH; +} + +static inline const char * lv_version_info(void) +{ + return LVGL_VERSION_INFO; +} +#endif /*LVGL_H*/ diff --git a/include/lvgl/misc/lv_array.h b/include/lvgl/misc/lv_array.h new file mode 100644 index 0000000000..1888bffe9d --- /dev/null +++ b/include/lvgl/misc/lv_array.h @@ -0,0 +1,240 @@ +/** + * @file lv_array.h + * Array. The elements are dynamically allocated by the 'lv_mem' module. + */ + +#ifndef LV_ARRAY_H +#define LV_ARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +#ifndef LV_ARRAY_DEFAULT_CAPACITY +#define LV_ARRAY_DEFAULT_CAPACITY 4 +#endif + +#ifndef LV_ARRAY_DEFAULT_SHRINK_RATIO +#define LV_ARRAY_DEFAULT_SHRINK_RATIO 2 +#endif + +/********************** + * TYPEDEFS + **********************/ + +/** Description of a array*/ +typedef struct _lv_array_t { + uint8_t * data; + uint32_t size; + uint32_t capacity; + uint32_t element_size; + + bool inner_alloc; /* true: data is allocated by the array; false: data is allocated by the user */ +} lv_array_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Init an array. + * @param array pointer to an `lv_array_t` variable to initialize + * @param capacity the initial capacity of the array + * @param element_size the size of an element in bytes + */ +void lv_array_init(lv_array_t * array, uint32_t capacity, uint32_t element_size); + +/** + * Init an array from a buffer. + * @note The buffer must be large enough to store `capacity` elements. The array will not release the buffer and reallocate it. + * The user must ensure that the buffer is valid during the lifetime of the array. And release the buffer when the array is no longer needed. + * @param array pointer to an `lv_array_t` variable to initialize + * @param buf pointer to a buffer to use as the array's data + * @param capacity the initial capacity of the array + * @param element_size the size of an element in bytes + */ +void lv_array_init_from_buf(lv_array_t * array, void * buf, uint32_t capacity, uint32_t element_size); + +/** + * Resize the array to the given capacity. + * @note if the new capacity is smaller than the current size, the array will be truncated. + * @param array pointer to an `lv_array_t` variable + * @param new_capacity the new capacity of the array + */ +bool lv_array_resize(lv_array_t * array, uint32_t new_capacity); + +/** + * Deinit the array, and free the allocated memory + * @param array pointer to an `lv_array_t` variable to deinitialize + */ +void lv_array_deinit(lv_array_t * array); + +/** + * Return how many elements are stored in the array. + * @param array pointer to an `lv_array_t` variable + * @return the number of elements stored in the array + */ +static inline uint32_t lv_array_size(const lv_array_t * array) +{ + return array->size; +} + +/** + * Return the capacity of the array, i.e. how many elements can be stored. + * @param array pointer to an `lv_array_t` variable + * @return the capacity of the array + */ +static inline uint32_t lv_array_capacity(const lv_array_t * array) +{ + return array->capacity; +} + +/** + * Return if the array is empty + * @param array pointer to an `lv_array_t` variable + * @return true: array is empty; false: array is not empty + */ +static inline bool lv_array_is_empty(const lv_array_t * array) +{ + return array->size == 0; +} + +/** + * Return if the array is full + * @param array pointer to an `lv_array_t` variable + * @return true: array is full; false: array is not full + */ +static inline bool lv_array_is_full(const lv_array_t * array) +{ + return array->size == array->capacity; +} + +/** + * Copy an array to another. + * @note this will create a new array with the same capacity and size as the source array. + * @param target pointer to an `lv_array_t` variable to copy to + * @param source pointer to an `lv_array_t` variable to copy from + */ +void lv_array_copy(lv_array_t * target, const lv_array_t * source); + +/** + * Remove all elements in array. + * @param array pointer to an `lv_array_t` variable + */ +static inline void lv_array_clear(lv_array_t * array) +{ + array->size = 0; +} + +/** + * Shrink the memory capacity of array if necessary. + * @param array pointer to an `lv_array_t` variable + */ +void lv_array_shrink(lv_array_t * array); + +/** + * Remove the element at the specified position in the array. + * + * This function keeps the array order. Complexity is O(n) + * + * @param array pointer to an `lv_array_t` variable + * @param index the index of the element to remove + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_remove(lv_array_t * array, uint32_t index); + +/** + * Remove the element at the specified position in the array. + * + * This function does not guarantee the array order. Complexity is O(1) + * + * @param array pointer to an `lv_array_t` variable + * @param index the index of the element to remove + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_remove_unordered(lv_array_t * array, uint32_t index); + +/** + * Remove from the array either a single element or a range of elements ([start, end)). + * @note This effectively reduces the container size by the number of elements removed. + * @note When start equals to end, the function has no effect. + * @param array pointer to an `lv_array_t` variable + * @param start the index of the first element to be removed + * @param end the index of the first element that is not to be removed + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_erase(lv_array_t * array, uint32_t start, uint32_t end); + +/** + * Concatenate two arrays. Adds new elements to the end of the array. + * @note The destination array is automatically expanded as necessary. + * @param array pointer to an `lv_array_t` variable + * @param other pointer to the array to concatenate + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_concat(lv_array_t * array, const lv_array_t * other); + +/** + * Push back element. Adds a new element to the end of the array. + * If the array capacity is not enough for the new element, the array will be resized automatically. + * @note If the element is NULL, it will be added as an empty element. + * @param array pointer to an `lv_array_t` variable + * @param element pointer to the element to add. NULL to push an empty element. + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_push_back(lv_array_t * array, const void * element); + +/** + * Assigns one content to the array, replacing its current content. + * @param array pointer to an `lv_array_t` variable + * @param index the index of the element to replace + * @param value pointer to the elements to add + * @return true: success; false: error + */ +lv_result_t lv_array_assign(lv_array_t * array, uint32_t index, const void * value); + +/** + * Returns a pointer to the element at position n in the array. + * @param array pointer to an `lv_array_t` variable + * @param index the index of the element to return + * @return a pointer to the requested element, NULL if `index` is out of range + */ +void * lv_array_at(const lv_array_t * array, uint32_t index); + +/** + * Returns a pointer to the first element in the array. + * @param array pointer to an `lv_array_t` variable + * @return a pointer to the first element in the array + */ +static inline void * lv_array_front(const lv_array_t * array) +{ + return lv_array_at(array, 0); +} + +/** + * Returns a pointer to the last element in the array. + * @param array pointer to an `lv_array_t` variable + */ +static inline void * lv_array_back(const lv_array_t * array) +{ + return lv_array_at(array, lv_array_size(array) - 1); +} + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif diff --git a/include/lvgl/misc/lv_async.h b/include/lvgl/misc/lv_async.h new file mode 100644 index 0000000000..c84eb08818 --- /dev/null +++ b/include/lvgl/misc/lv_async.h @@ -0,0 +1,61 @@ +/** + * @file lv_async.h + * + */ + +#ifndef LV_ASYNC_H +#define LV_ASYNC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Type for async callback. + */ +typedef void (*lv_async_cb_t)(void *); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Call an asynchronous function the next time lv_timer_handler() is run. This function is likely to return + * **before** the call actually happens! + * @param async_xcb a callback which is the task itself. + * (the 'x' in the argument name indicates that it's not a fully generic function because it not follows + * the `func_name(object, callback, ...)` convention) + * @param user_data custom parameter + */ +lv_result_t lv_async_call(lv_async_cb_t async_xcb, void * user_data); + +/** + * Cancel an asynchronous function call + * @param async_xcb a callback which is the task itself. + * @param user_data custom parameter + */ +lv_result_t lv_async_call_cancel(lv_async_cb_t async_xcb, void * user_data); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ASYNC_H*/ diff --git a/include/lvgl/misc/lv_ll.h b/include/lvgl/misc/lv_ll.h new file mode 100644 index 0000000000..f7d359a294 --- /dev/null +++ b/include/lvgl/misc/lv_ll.h @@ -0,0 +1,168 @@ +/** + * @file lv_ll.h + * Handle linked lists. The nodes are dynamically allocated by the 'lv_mem' module. + */ + +#ifndef LV_LL_H +#define LV_LL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** Dummy type to make handling easier*/ +typedef uint8_t lv_ll_node_t; + +/** Description of a linked list*/ +typedef struct { + uint32_t n_size; + lv_ll_node_t * head; + lv_ll_node_t * tail; +} lv_ll_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize linked list + * @param ll_p pointer to lv_ll_t variable + * @param node_size the size of 1 node in bytes + */ +void lv_ll_init(lv_ll_t * ll_p, uint32_t node_size); + +/** + * Add a new head to a linked list + * @param ll_p pointer to linked list + * @return pointer to the new head + */ +void * lv_ll_ins_head(lv_ll_t * ll_p); + +/** + * Insert a new node in front of the n_act node + * @param ll_p pointer to linked list + * @param n_act pointer a node + * @return pointer to the new node + */ +void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act); + +/** + * Add a new tail to a linked list + * @param ll_p pointer to linked list + * @return pointer to the new tail + */ +void * lv_ll_ins_tail(lv_ll_t * ll_p); + +/** + * Remove the node 'node_p' from 'll_p' linked list. + * It does not free the memory of node. + * @param ll_p pointer to the linked list of 'node_p' + * @param node_p pointer to node in 'll_p' linked list + */ +void lv_ll_remove(lv_ll_t * ll_p, void * node_p); + +void lv_ll_clear_custom(lv_ll_t * ll_p, void(*cleanup)(void *)); + +/** + * Remove and free all elements from a linked list. The list remain valid but become empty. + * @param ll_p pointer to linked list + */ +void lv_ll_clear(lv_ll_t * ll_p); + +/** + * Move a node to a new linked list + * @param ll_ori_p pointer to the original (old) linked list + * @param ll_new_p pointer to the new linked list + * @param node pointer to a node + * @param head true: be the head in the new list + * false be the tail in the new list + */ +void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head); + +/** + * Return with head node of the linked list + * @param ll_p pointer to linked list + * @return pointer to the head of 'll_p' + */ +void * lv_ll_get_head(const lv_ll_t * ll_p); + +/** + * Return with tail node of the linked list + * @param ll_p pointer to linked list + * @return pointer to the tail of 'll_p' + */ +void * lv_ll_get_tail(const lv_ll_t * ll_p); + +/** + * Return with the pointer of the next node after 'n_act' + * @param ll_p pointer to linked list + * @param n_act pointer a node + * @return pointer to the next node + */ +void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act); + +/** + * Return with the pointer of the previous node after 'n_act' + * @param ll_p pointer to linked list + * @param n_act pointer a node + * @return pointer to the previous node + */ +void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act); + +/** + * Return the length of the linked list. + * @param ll_p pointer to linked list + * @return length of the linked list + */ +uint32_t lv_ll_get_len(const lv_ll_t * ll_p); + +/* + * TODO + * @param ll_p + * @param n1_p + * @param n2_p +void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p); + */ + +/** + * Move a node before another node in the same linked list + * + * @param ll_p pointer to a linked list + * @param n_act pointer to node to move + * @param n_after pointer to a node which should be after `n_act` + */ +void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after); + +/** + * Check if a linked list is empty + * @param ll_p pointer to a linked list + * @return true: the linked list is empty; false: not empty + */ +bool lv_ll_is_empty(lv_ll_t * ll_p); + +/********************** + * MACROS + **********************/ + +#define LV_LL_READ(list, i) for(i = lv_ll_get_head(list); i != NULL; i = lv_ll_get_next(list, i)) + +#define LV_LL_READ_BACK(list, i) for(i = lv_ll_get_tail(list); i != NULL; i = lv_ll_get_prev(list, i)) + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif diff --git a/include/lvgl/misc/lv_math.h b/include/lvgl/misc/lv_math.h new file mode 100644 index 0000000000..2cfa7e0776 --- /dev/null +++ b/include/lvgl/misc/lv_math.h @@ -0,0 +1,174 @@ +/** + * @file lv_math.h + * + */ + +#ifndef LV_MATH_H +#define LV_MATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ +#define LV_TRIGO_SIN_MAX 32768 +#define LV_TRIGO_SHIFT 15 /**< >> LV_TRIGO_SHIFT to normalize*/ + +#define LV_BEZIER_VAL_SHIFT 10 /**< log2(LV_BEZIER_VAL_MAX): used to normalize up scaled values*/ +#define LV_BEZIER_VAL_MAX (1L << LV_BEZIER_VAL_SHIFT) /**< Max time in Bezier functions (not [0..1] to use integers)*/ +#define LV_BEZIER_VAL_FLOAT(f) ((int32_t)((f) * LV_BEZIER_VAL_MAX)) /**< Convert const float number cubic-bezier values to fix-point value*/ + +/** Align up value x to align, align must be a power of two */ +#define LV_ALIGN_UP(x, align) (((x) + ((align) - 1)) & ~((align) - 1)) + +/** Round up value x to round, round can be any integer number */ +#define LV_ROUND_UP(x, round) ((((x) + ((round) - 1)) / (round)) * (round)) + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + uint16_t i; + uint16_t f; +} lv_sqrt_res_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Return with sinus of an angle + * @param angle + * @return sinus of 'angle'. sin(-90) = -32767, sin(90) = 32767 + */ +int32_t /* LV_ATTRIBUTE_FAST_MEM */ lv_trigo_sin(int16_t angle); + +int32_t LV_ATTRIBUTE_FAST_MEM lv_trigo_cos(int16_t angle); + +/** + * Calculate the y value of cubic-bezier(x1, y1, x2, y2) function as specified x. + * @param x time in range of [0..LV_BEZIER_VAL_MAX] + * @param x1 x of control point 1 in range of [0..LV_BEZIER_VAL_MAX] + * @param y1 y of control point 1 in range of [0..LV_BEZIER_VAL_MAX] + * @param x2 x of control point 2 in range of [0..LV_BEZIER_VAL_MAX] + * @param y2 y of control point 2 in range of [0..LV_BEZIER_VAL_MAX] + * @return the value calculated + */ +int32_t lv_cubic_bezier(int32_t x, int32_t x1, int32_t y1, int32_t x2, int32_t y2); + +/** + * Calculate a value of a Cubic Bezier function. + * @param t time in range of [0..LV_BEZIER_VAL_MAX] + * @param u0 must be 0 + * @param u1 control value 1 values in range of [0..LV_BEZIER_VAL_MAX] + * @param u2 control value 2 in range of [0..LV_BEZIER_VAL_MAX] + * @param u3 must be LV_BEZIER_VAL_MAX + * @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX] + */ +int32_t lv_bezier3(int32_t t, int32_t u0, uint32_t u1, int32_t u2, int32_t u3); + + +/** + * Calculate the atan2 of a vector. + * @param x + * @param y + * @return the angle in degree calculated from the given parameters in range of [0..360] + */ +uint16_t lv_atan2(int x, int y); + +/** + * Get the square root of a number + * @param x integer which square root should be calculated + * @param q store the result here. q->i: integer part, q->f: fractional part in 1/256 unit + * @param mask optional to skip some iterations if the magnitude of the root is known. + * Set to 0x8000 by default. + * If root < 16: mask = 0x80 + * If root < 256: mask = 0x800 + * Else: mask = 0x8000 + */ +void /* LV_ATTRIBUTE_FAST_MEM */ lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask); + +/** + * Alternative (fast, approximate) implementation for getting the square root of an integer. + * @param x integer which square root should be calculated + */ +int32_t /* LV_ATTRIBUTE_FAST_MEM */ lv_sqrt32(uint32_t x); + +/** + * Calculate the square of an integer (input range is 0..32767). + * @param x input + * @return square + */ +static inline int32_t lv_sqr(int32_t x) +{ + return x * x; +} + +/** + * Calculate the integer exponents. + * @param base + * @param exp + * @return base raised to the power exponent + */ +int64_t lv_pow(int64_t base, int8_t exp); + +/** + * Get the mapped of a number given an input and output range + * @param x integer which mapped value should be calculated + * @param min_in min input range + * @param max_in max input range + * @param min_out max output range + * @param max_out max output range + * @return the mapped number + */ +int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min_out, int32_t max_out); + +/** + * Set the seed of the pseudo random number generator + * @param seed a number to initialize the random generator + */ +void lv_rand_set_seed(uint32_t seed); + +/** + * Get a pseudo random number in the given range + * @param min the minimum value + * @param max the maximum value + * @return return the random number. min <= return_value <= max + */ +uint32_t lv_rand(uint32_t min, uint32_t max); + +/********************** + * MACROS + **********************/ +#define LV_MIN(a, b) ((a) < (b) ? (a) : (b)) +#define LV_MIN3(a, b, c) (LV_MIN(LV_MIN(a,b), c)) +#define LV_MIN4(a, b, c, d) (LV_MIN(LV_MIN(a,b), LV_MIN(c,d))) + +#define LV_MAX(a, b) ((a) > (b) ? (a) : (b)) +#define LV_MAX3(a, b, c) (LV_MAX(LV_MAX(a,b), c)) +#define LV_MAX4(a, b, c, d) (LV_MAX(LV_MAX(a,b), LV_MAX(c,d))) + +#define LV_CLAMP(min, val, max) (LV_MAX(min, (LV_MIN(val, max)))) + +#define LV_ABS(x) ((x) > 0 ? (x) : (-(x))) +#define LV_UDIV255(x) (((x) * 0x8081U) >> 0x17) + +#define LV_IS_SIGNED(t) (((t)(-1)) < ((t)0)) +#define LV_UMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0xFULL << ((sizeof(t) * 8ULL) - 4ULL))) +#define LV_SMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0x7ULL << ((sizeof(t) * 8ULL) - 4ULL))) +#define LV_MAX_OF(t) ((unsigned long)(LV_IS_SIGNED(t) ? LV_SMAX_OF(t) : LV_UMAX_OF(t))) + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif diff --git a/include/lvgl/misc/lv_tree.h b/include/lvgl/misc/lv_tree.h new file mode 100644 index 0000000000..7021652172 --- /dev/null +++ b/include/lvgl/misc/lv_tree.h @@ -0,0 +1,107 @@ +/** + * @file lv_tree.h + * Tree. The tree nodes are dynamically allocated by the 'lv_mem' module. + */ + +#ifndef LV_TREE_H +#define LV_TREE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +#define LV_TREE_NODE(n) ((lv_tree_node_t*)(n)) + +/********************** + * TYPEDEFS + **********************/ + + +typedef void (*lv_tree_constructor_cb_t)(const lv_tree_class_t * class_p, lv_tree_node_t * node); +typedef void (*lv_tree_destructor_cb_t)(const lv_tree_class_t * class_p, lv_tree_node_t * node); + +/** + * Describe the common methods of every object. + * Similar to a C++ class. + */ +struct _lv_tree_class_t { + const lv_tree_class_t * base_class; + uint32_t instance_size; + lv_tree_constructor_cb_t constructor_cb; + lv_tree_destructor_cb_t destructor_cb; +}; + +/** Description of a tree node*/ +struct _lv_tree_node_t { + lv_tree_node_t * parent; + lv_tree_node_t ** children; + uint32_t child_cnt; + uint32_t child_cap; + const lv_tree_class_t * class_p; +}; + +enum _lv_tree_walk_mode_t { + LV_TREE_WALK_PRE_ORDER = 0, + LV_TREE_WALK_POST_ORDER, +}; +typedef uint8_t lv_tree_walk_mode_t; + +typedef bool (*lv_tree_traverse_cb_t)(const lv_tree_node_t * node, void * user_data); +typedef bool (*lv_tree_before_cb_t)(const lv_tree_node_t * node, void * user_data); +typedef void (*lv_tree_after_cb_t)(const lv_tree_node_t * node, void * user_data); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +extern const lv_tree_class_t lv_tree_node_class; + +/** + * @brief Create a tree node + * @param class_p pointer to a class of the node + * @param parent pointer to the parent node (or NULL if it's the root node) + * @return pointer to the new node + */ +lv_tree_node_t * lv_tree_node_create(const lv_tree_class_t * class_p, lv_tree_node_t * parent); + +/** + * @brief Delete a tree node and all its children recursively + * @param node pointer to the node to delete + */ +void lv_tree_node_delete(lv_tree_node_t * node); + +/** + * @brief Walk the tree recursively and call a callback function on each node + * @param node pointer to the root node of the tree + * @param mode LV_TREE_WALK_PRE_ORDER or LV_TREE_WALK_POST_ORDER + * @param cb callback function to call on each node + * @param bcb callback function to call before visiting a node + * @param acb callback function to call after visiting a node + * @param user_data user data to pass to the callback functions + * @return true: traversal is finished; false: traversal broken + */ +bool lv_tree_walk(const lv_tree_node_t * node, + lv_tree_walk_mode_t mode, + lv_tree_traverse_cb_t cb, + lv_tree_before_cb_t bcb, + lv_tree_after_cb_t acb, + void * user_data); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif diff --git a/include/lvgl/osal/lv_os.h b/include/lvgl/osal/lv_os.h new file mode 100644 index 0000000000..8457131293 --- /dev/null +++ b/include/lvgl/osal/lv_os.h @@ -0,0 +1,71 @@ +/** + * @file lv_os.h + * + */ + +#ifndef LV_OS_H +#define LV_OS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * OS OPTIONS + *********************/ + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Lock LVGL's general mutex. + * LVGL is not thread safe, so a mutex is used to avoid executing multiple LVGL functions at the same time + * from different threads. It shall be called when calling LVGL functions from threads + * different than lv_timer_handler's thread. It doesn't need to be called in LVGL events because + * they are called from lv_timer_handler(). + * It is called internally in lv_timer_handler(). + */ +void lv_lock(void); + +/** + * Same as `lv_lock()` but can be called from an interrupt. + * @return LV_RESULT_OK: success; LV_RESULT_INVALID: failure + */ +lv_result_t lv_lock_isr(void); + +/** + * The pair of `lv_lock()` and `lv_lock_isr()`. + * It unlocks LVGL general mutex. + * It is called internally in lv_timer_handler(). + */ +void lv_unlock(void); + +/** + * Sleeps the current thread by an amount of milliseconds. + * @param ms amount of milliseconds to sleep the current thread. + */ +void lv_sleep_ms(uint32_t ms); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OS_H*/ diff --git a/include/lvgl/others/file_explorer/lv_file_explorer.h b/include/lvgl/others/file_explorer/lv_file_explorer.h new file mode 100644 index 0000000000..99469775b5 --- /dev/null +++ b/include/lvgl/others/file_explorer/lv_file_explorer.h @@ -0,0 +1,175 @@ +/** + * @file lv_file_explorer.h + * + */ + +#ifndef LV_FILE_EXPLORER_H +#define LV_FILE_EXPLORER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../config/lv_conf_internal.h" +#include "../../core/lv_obj.h" + +#if LV_USE_FILE_EXPLORER != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_EXPLORER_SORT_NONE, + LV_EXPLORER_SORT_KIND, +} lv_file_explorer_sort_t; + +#if LV_FILE_EXPLORER_QUICK_ACCESS +typedef enum { + LV_EXPLORER_HOME_DIR, + LV_EXPLORER_MUSIC_DIR, + LV_EXPLORER_PICTURES_DIR, + LV_EXPLORER_VIDEO_DIR, + LV_EXPLORER_DOCS_DIR, + LV_EXPLORER_FS_DIR, +} lv_file_explorer_dir_t; +#endif + +extern const lv_obj_class_t lv_file_explorer_class; + +/*********************** + * GLOBAL VARIABLES + ***********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ +lv_obj_t * lv_file_explorer_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +#if LV_FILE_EXPLORER_QUICK_ACCESS +/** + * Set file_explorer + * @param obj pointer to a label object + * @param dir the dir from 'lv_file_explorer_dir_t' enum. + * @param path path + + */ +void lv_file_explorer_set_quick_access_path(lv_obj_t * obj, lv_file_explorer_dir_t dir, const char * path); +#endif + +/** + * Set file_explorer sort + * @param obj pointer to a file explorer object + * @param sort the sort from 'lv_file_explorer_sort_t' enum. + */ +void lv_file_explorer_set_sort(lv_obj_t * obj, lv_file_explorer_sort_t sort); + +/** + * Set the visibility of the "< Back" button + * @param obj pointer to a file explorer object + * @param show bool true/false, enable or disable button + */ +void lv_file_explorer_show_back_button(lv_obj_t * obj, bool show); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get file explorer Selected file + * @param obj pointer to a file explorer object + * @return pointer to the file explorer selected file name + */ +const char * lv_file_explorer_get_selected_file_name(const lv_obj_t * obj); + +/** + * Get file explorer cur path + * @param obj pointer to a file explorer object + * @return pointer to the file explorer cur path + */ +const char * lv_file_explorer_get_current_path(const lv_obj_t * obj); + +/** + * Get file explorer file list obj(lv_table) + * @param obj pointer to a file explorer object + * @return pointer to the file explorer file table obj(lv_table) + */ +lv_obj_t * lv_file_explorer_get_file_table(lv_obj_t * obj); + +/** + * Get file explorer head area obj + * @param obj pointer to a file explorer object + * @return pointer to the file explorer head area obj(lv_obj) + */ +lv_obj_t * lv_file_explorer_get_header(lv_obj_t * obj); + +/** + * Get file explorer path obj(label) + * @param obj pointer to a file explorer object + * @return pointer to the file explorer path obj(lv_label) + */ +lv_obj_t * lv_file_explorer_get_path_label(lv_obj_t * obj); + +#if LV_FILE_EXPLORER_QUICK_ACCESS +/** + * Get file explorer head area obj + * @param obj pointer to a file explorer object + * @return pointer to the file explorer quick access area obj(lv_obj) + */ +lv_obj_t * lv_file_explorer_get_quick_access_area(lv_obj_t * obj); + +/** + * Get file explorer places list obj(lv_list) + * @param obj pointer to a file explorer object + * @return pointer to the file explorer places list obj(lv_list) + */ +lv_obj_t * lv_file_explorer_get_places_list(lv_obj_t * obj); + +/** + * Get file explorer device list obj(lv_list) + * @param obj pointer to a file explorer object + * @return pointer to the file explorer device list obj(lv_list) + */ +lv_obj_t * lv_file_explorer_get_device_list(lv_obj_t * obj); +#endif + +/** + * Set file_explorer sort + * @param obj pointer to a file explorer object + * @return the current mode from 'lv_file_explorer_sort_t' + */ +lv_file_explorer_sort_t lv_file_explorer_get_sort(const lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +/** + * Open a specified path + * @param obj pointer to a file explorer object + * @param dir pointer to the path + */ +void lv_file_explorer_open_dir(lv_obj_t * obj, const char * dir); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_FILE_EXPLORER*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FILE_EXPLORER_H*/ diff --git a/include/lvgl/others/fragment/lv_fragment.h b/include/lvgl/others/fragment/lv_fragment.h new file mode 100644 index 0000000000..1e7d29fcff --- /dev/null +++ b/include/lvgl/others/fragment/lv_fragment.h @@ -0,0 +1,297 @@ +/** + * Public header for Fragment + * @file lv_fragment.h + */ + +#ifndef LV_FRAGMENT_H +#define LV_FRAGMENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../core/lv_obj.h" + +#if LV_USE_FRAGMENT + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct _lv_fragment_manager_t lv_fragment_manager_t; + +struct _lv_fragment_t { + /** + * Class of this fragment + */ + const lv_fragment_class_t * cls; + /** + * Managed fragment states. If not null, then this fragment is managed. + * + * @warning Don't modify values inside this struct! + */ + lv_fragment_managed_states_t * managed; + /** + * Child fragment manager + */ + lv_fragment_manager_t * child_manager; + /** + * lv_obj returned by create_obj_cb + */ + lv_obj_t * obj; + +}; + +struct _lv_fragment_class_t { + /** + * Constructor function for fragment class + * @param self Fragment instance + * @param args Arguments assigned by fragment manager + */ + void (*constructor_cb)(lv_fragment_t * self, void * args); + + /** + * Destructor function for fragment class + * @param self Fragment instance, will be freed after this call + */ + void (*destructor_cb)(lv_fragment_t * self); + + /** + * Fragment attached to manager + * @param self Fragment instance + */ + void (*attached_cb)(lv_fragment_t * self); + + /** + * Fragment detached from manager + * @param self Fragment instance + */ + void (*detached_cb)(lv_fragment_t * self); + + /** + * Create objects + * @param self Fragment instance + * @param container Container of the objects should be created upon + * @return Created object, NULL if multiple objects has been created + */ + lv_obj_t * (*create_obj_cb)(lv_fragment_t * self, lv_obj_t * container); + + /** + * + * @param self Fragment instance + * @param obj lv_obj returned by create_obj_cb + */ + void (*obj_created_cb)(lv_fragment_t * self, lv_obj_t * obj); + + /** + * Called before objects in the fragment will be deleted. + * + * @param self Fragment instance + * @param obj object with this fragment + */ + void (*obj_will_delete_cb)(lv_fragment_t * self, lv_obj_t * obj); + + /** + * Called when the object created by fragment received `LV_EVENT_DELETE` event + * @param self Fragment instance + * @param obj object with this fragment + */ + void (*obj_deleted_cb)(lv_fragment_t * self, lv_obj_t * obj); + + /** + * Handle event + * @param self Fragment instance + * @param which User-defined ID of event + * @param data1 User-defined data + * @param data2 User-defined data + */ + bool (*event_cb)(lv_fragment_t * self, int code, void * userdata); + + /** + * *REQUIRED*: Allocation size of fragment + */ + size_t instance_size; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create fragment manager instance + * @param parent Parent fragment if this manager is placed inside another fragment, can be null. + * @return Fragment manager instance + */ +lv_fragment_manager_t * lv_fragment_manager_create(lv_fragment_t * parent); + +/** + * Destroy fragment manager instance + * @param manager Fragment manager instance + */ +void lv_fragment_manager_delete(lv_fragment_manager_t * manager); + +/** + * Create object of all fragments managed by this manager. + * @param manager Fragment manager instance + */ +void lv_fragment_manager_create_obj(lv_fragment_manager_t * manager); + +/** + * Delete object created by all fragments managed by this manager. Instance of fragments will not be deleted. + * @param manager Fragment manager instance + */ +void lv_fragment_manager_delete_obj(lv_fragment_manager_t * manager); + +/** + * Attach fragment to manager, and add to container. + * @param manager Fragment manager instance + * @param fragment Fragment instance + * @param container Pointer to container object for manager to add objects to + */ +void lv_fragment_manager_add(lv_fragment_manager_t * manager, lv_fragment_t * fragment, lv_obj_t * const * container); + +/** + * Detach and destroy fragment. If fragment is in navigation stack, remove from it. + * @param manager Fragment manager instance + * @param fragment Fragment instance + */ +void lv_fragment_manager_remove(lv_fragment_manager_t * manager, lv_fragment_t * fragment); + +/** + * Attach fragment to manager and add to navigation stack. + * @param manager Fragment manager instance + * @param fragment Fragment instance + * @param container Pointer to container object for manager to add objects to + */ +void lv_fragment_manager_push(lv_fragment_manager_t * manager, lv_fragment_t * fragment, lv_obj_t * const * container); + +/** + * Remove the top-most fragment for stack + * @param manager Fragment manager instance + * @return true if there is fragment to pop + */ +bool lv_fragment_manager_pop(lv_fragment_manager_t * manager); + +/** + * Replace fragment. Old item in the stack will be removed. + * @param manager Fragment manager instance + * @param fragment Fragment instance + * @param container Pointer to container object for manager to add objects to + */ +void lv_fragment_manager_replace(lv_fragment_manager_t * manager, lv_fragment_t * fragment, + lv_obj_t * const * container); + +/** + * Send event to top-most fragment + * @param manager Fragment manager instance + * @param code User-defined ID of event + * @param userdata User-defined data + * @return true if fragment returned true + */ +bool lv_fragment_manager_send_event(lv_fragment_manager_t * manager, int code, void * userdata); + +/** + * Get stack size of this fragment manager + * @param manager Fragment manager instance + * @return Stack size of this fragment manager + */ +size_t lv_fragment_manager_get_stack_size(lv_fragment_manager_t * manager); + +/** + * Get top most fragment instance + * @param manager Fragment manager instance + * @return Top most fragment instance + */ +lv_fragment_t * lv_fragment_manager_get_top(lv_fragment_manager_t * manager); + +/** + * Find first fragment instance in the container + * @param manager Fragment manager instance + * @param container Container which target fragment added to + * @return First fragment instance in the container + */ +lv_fragment_t * lv_fragment_manager_find_by_container(lv_fragment_manager_t * manager, const lv_obj_t * container); + +/** + * Get parent fragment + * @param manager Fragment manager instance + * @return Parent fragment instance + */ +lv_fragment_t * lv_fragment_manager_get_parent_fragment(lv_fragment_manager_t * manager); + +/** + * Create a fragment instance. + * + * @param cls Fragment class. This fragment must return non null object. + * @param args Arguments assigned by fragment manager + * @return Fragment instance + */ +lv_fragment_t * lv_fragment_create(const lv_fragment_class_t * cls, void * args); + +/** + * Destroy a fragment. + * @param fragment Fragment instance. + */ +void lv_fragment_delete(lv_fragment_t * fragment); + +/** + * Get associated manager of this fragment + * @param fragment Fragment instance + * @return Fragment manager instance + */ +lv_fragment_manager_t * lv_fragment_get_manager(lv_fragment_t * fragment); + +/** + * Get container object of this fragment + * @param fragment Fragment instance + * @return Reference to container object + */ +lv_obj_t * const * lv_fragment_get_container(lv_fragment_t * fragment); + +/** + * Get parent fragment of this fragment + * @param fragment Fragment instance + * @return Parent fragment + */ +lv_fragment_t * lv_fragment_get_parent(lv_fragment_t * fragment); + +/** + * Create object by fragment. + * + * @param fragment Fragment instance. + * @param container Container of the objects should be created upon. + * @return Created object + */ +lv_obj_t * lv_fragment_create_obj(lv_fragment_t * fragment, lv_obj_t * container); + +/** + * Delete created object of a fragment + * + * @param fragment Fragment instance. + */ +void lv_fragment_delete_obj(lv_fragment_t * fragment); + +/** + * Destroy obj in fragment, and recreate them. + * @param fragment Fragment instance + */ +void lv_fragment_recreate_obj(lv_fragment_t * fragment); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_FRAGMENT*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FRAGMENT_H*/ diff --git a/include/lvgl/stdlib/lv_mem.h b/include/lvgl/stdlib/lv_mem.h new file mode 100644 index 0000000000..494a202499 --- /dev/null +++ b/include/lvgl/stdlib/lv_mem.h @@ -0,0 +1,164 @@ +/** + * @file lv_mem.h + * + */ + +#ifndef LV_MEM_H +#define LV_MEM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef void * lv_mem_pool_t; + +/** + * Heap information structure. + */ +typedef struct { + size_t total_size; /**< Total heap size */ + size_t free_cnt; + size_t free_size; /**< Size of available memory */ + size_t free_biggest_size; + size_t used_cnt; + size_t max_used; /**< Max size of Heap memory used */ + uint8_t used_pct; /**< Percentage used */ + uint8_t frag_pct; /**< Amount of fragmentation */ +} lv_mem_monitor_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize to use malloc/free/realloc etc + */ +void lv_mem_init(void); + +/** + * Drop all dynamically allocated memory and reset the memory pools' state + */ +void lv_mem_deinit(void); + +lv_mem_pool_t lv_mem_add_pool(void * mem, size_t bytes); + +void lv_mem_remove_pool(lv_mem_pool_t pool); + +/** + * Allocate memory dynamically + * @param size requested size in bytes + * @return pointer to allocated uninitialized memory, or NULL on failure + */ +void * lv_malloc(size_t size); + +/** + * Allocate a block of zeroed memory dynamically + * @param num requested number of element to be allocated. + * @param size requested size of each element in bytes. + * @return pointer to allocated zeroed memory, or NULL on failure + */ +void * lv_calloc(size_t num, size_t size); + +/** + * Allocate zeroed memory dynamically + * @param size requested size in bytes + * @return pointer to allocated zeroed memory, or NULL on failure + */ +void * lv_zalloc(size_t size); + +/** + * Allocate zeroed memory dynamically + * @param size requested size in bytes + * @return pointer to allocated zeroed memory, or NULL on failure + */ +void * lv_malloc_zeroed(size_t size); + +/** + * Free an allocated data + * @param data pointer to an allocated memory + */ +void lv_free(void * data); + +/** + * Reallocate a memory with a new size. The old content will be kept. + * @param data_p pointer to an allocated memory. + * Its content will be copied to the new memory block and freed + * @param new_size the desired new size in byte + * @return pointer to the new memory, NULL on failure + */ +void * lv_realloc(void * data_p, size_t new_size); + +/** + * Reallocate a memory with a new size. The old content will be kept. + * In case of failure, the old pointer is free'd. + * @param data_p pointer to an allocated memory. + * Its content will be copied to the new memory block and freed + * @param new_size the desired new size in byte + * @return pointer to the new memory, NULL on failure + */ +void * lv_reallocf(void * data_p, size_t new_size); + +/** + * Used internally to execute a plain `malloc` operation + * @param size size in bytes to `malloc` + */ +void * lv_malloc_core(size_t size); + +/** + * Used internally to execute a plain `free` operation + * @param p memory address to free + */ +void lv_free_core(void * p); + +/** + * Used internally to execute a plain realloc operation + * @param p memory address to realloc + * @param new_size size in bytes to realloc + */ +void * lv_realloc_core(void * p, size_t new_size); + +/** + * Used internally by lv_mem_monitor() to gather LVGL heap state information. + * @param mon_p pointer to lv_mem_monitor_t object to be populated. + */ +void lv_mem_monitor_core(lv_mem_monitor_t * mon_p); + +lv_result_t lv_mem_test_core(void); + +/** + * @brief Tests the memory allocation system by allocating and freeing a block of memory. + * @return LV_RESULT_OK if the memory allocation system is working properly, or LV_RESULT_INVALID if there is an error. + */ +lv_result_t lv_mem_test(void); + +/** + * Give information about the work memory of dynamic allocation + * @param mon_p pointer to a lv_mem_monitor_t variable, + * the result of the analysis will be stored here + */ +void lv_mem_monitor(lv_mem_monitor_t * mon_p); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_MEM_H*/ diff --git a/include/lvgl/stdlib/lv_sprintf.h b/include/lvgl/stdlib/lv_sprintf.h new file mode 100644 index 0000000000..44704981eb --- /dev/null +++ b/include/lvgl/stdlib/lv_sprintf.h @@ -0,0 +1,62 @@ +/** + * @file lv_sprintf.h + * + */ + +#ifndef LV_SPRINTF_H +#define LV_SPRINTF_H + +#include "../config/lv_conf_internal.h" + +#if defined(__has_include) + #if __has_include(LV_INTTYPES_INCLUDE) + #include LV_INTTYPES_INCLUDE + /* platform-specific printf format for int32_t, usually "d" or "ld" */ + #define LV_PRId32 PRId32 + #define LV_PRIu32 PRIu32 + #define LV_PRIx32 PRIx32 + #define LV_PRIX32 PRIX32 + + #define LV_PRId64 PRId64 + #define LV_PRIu64 PRIu64 + #define LV_PRIx64 PRIx64 + #define LV_PRIX64 PRIX64 + #else + #define LV_PRId32 "d" + #define LV_PRIu32 "u" + #define LV_PRIx32 "x" + #define LV_PRIX32 "X" + + #define LV_PRId64 "lld" + #define LV_PRIu64 "llu" + #define LV_PRIx64 "llx" + #define LV_PRIX64 "llX" + #endif +#else + /* hope this is correct for ports without __has_include or without inttypes.h */ + #define LV_PRId32 "d" + #define LV_PRIu32 "u" + #define LV_PRIx32 "x" + #define LV_PRIX32 "X" + + #define LV_PRId64 "lld" + #define LV_PRIu64 "llu" + #define LV_PRIx64 "llx" + #define LV_PRIX64 "llX" +#endif + +#include "../lv_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int lv_snprintf(char * buffer, size_t count, const char * format, ...); + +int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va); + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_SPRINTF_H */ diff --git a/include/lvgl/stdlib/lv_string.h b/include/lvgl/stdlib/lv_string.h new file mode 100644 index 0000000000..f0861d86cb --- /dev/null +++ b/include/lvgl/stdlib/lv_string.h @@ -0,0 +1,204 @@ +/** + * @file lv_string.h + * + */ + +#ifndef LV_STRING_H +#define LV_STRING_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Copies a block of memory from a source address to a destination address. + * @param dst Pointer to the destination array where the content is to be copied. + * @param src Pointer to the source of data to be copied. + * @param len Number of bytes to copy. + * @return Pointer to the destination array. + * @note The function does not check for any overlapping of the source and destination memory blocks. + */ +void * lv_memcpy(void * dst, const void * src, size_t len); + +/** + * @brief Fills a block of memory with a specified value. + * @param dst Pointer to the destination array to fill with the specified value. + * @param v Value to be set. The value is passed as an int, but the function fills + * the block of memory using the unsigned char conversion of this value. + * @param len Number of bytes to be set to the value. + */ +void lv_memset(void * dst, uint8_t v, size_t len); + +/** + * @brief Move a block of memory from source to destination + * @param dst Pointer to the destination array where the content is to be copied. + * @param src Pointer to the source of data to be copied. + * @param len Number of bytes to copy + * @return Pointer to the destination array. + */ +void * lv_memmove(void * dst, const void * src, size_t len); + +/** + * @brief This function will compare two memory blocks + * @param p1 Pointer to the first memory block + * @param p2 Pointer to the second memory block + * @param len Number of bytes to compare + * @return The difference between the value of the first unmatching byte. + */ +int lv_memcmp(const void * p1, const void * p2, size_t len); + +/** + * Same as `memset(dst, 0x00, len)`. + * @param dst pointer to the destination buffer + * @param len number of byte to set + */ +static inline void lv_memzero(void * dst, size_t len) +{ + lv_memset(dst, 0x00, len); +} + +/** + * @brief Computes the length of the string str up to (but not including) the terminating null character. + * @param str Pointer to the null-terminated byte string to be examined. + * @return The length of the string in bytes. + */ +size_t lv_strlen(const char * str); + +/** + * @brief Computes the length of the string str up to (but not including) the terminating null character, + * or the given maximum length. + * @param str Pointer to byte string that is null-terminated or at least max_len bytes long. + * @param max_len Maximum number of characters to examine. + * @return The length of the string in bytes. + */ +size_t lv_strnlen(const char * str, size_t max_len); + +/** + * @brief Copies up to dst_size-1 (non-null) characters from src to dst. A null terminator is always added. + * @param dst Pointer to the destination array where the content is to be copied. + * @param src Pointer to the source of data to be copied. + * @param dst_size Maximum number of characters to be copied to dst, including the null character. + * @return The length of src. The return value is equivalent to the value returned by lv_strlen(src) + */ +size_t lv_strlcpy(char * dst, const char * src, size_t dst_size); + +/** + * @brief Copies up to dest_size characters from the string pointed to by src to the character array pointed to by dst + * and fills the remaining length with null bytes. + * @param dst Pointer to the destination array where the content is to be copied. + * @param src Pointer to the source of data to be copied. + * @param dest_size Maximum number of characters to be copied to dst. + * @return A pointer to the destination array, which is dst. + * @note dst will not be null terminated if dest_size bytes were copied from src before the end of src was reached. + */ +char * lv_strncpy(char * dst, const char * src, size_t dest_size); + +/** + * @brief Copies the string pointed to by src, including the terminating null character, + * to the character array pointed to by dst. + * @param dst Pointer to the destination array where the content is to be copied. + * @param src Pointer to the source of data to be copied. + * @return A pointer to the destination array, which is dst. + */ +char * lv_strcpy(char * dst, const char * src); + +/** + * @brief This function will compare two strings without specified length. + * @param s1 pointer to the first string + * @param s2 pointer to the second string + * @return the difference between the value of the first unmatching character. + */ +int lv_strcmp(const char * s1, const char * s2); + +/** + * @brief This function will compare two strings up to the given length. + * @param s1 pointer to the first string + * @param s2 pointer to the second string + * @param len the maximum amount of characters to compare + * @return the difference between the value of the first unmatching character. + */ +int lv_strncmp(const char * s1, const char * s2, size_t len); + +/** Returns true if the two strings are equal. + * Just a wrapper around strcmp for convenience. + * @param s1 pointer to the first string + * @param s2 pointer to the second string + * @return true: the strings are equal; false: otherwise + */ +static inline bool lv_streq(const char * s1, const char * s2) +{ + return lv_strcmp(s1, s2) == 0; +} + +/** + * @brief Duplicate a string by allocating a new one and copying the content. + * @param src Pointer to the source of data to be copied. + * @return A pointer to the new allocated string. NULL if failed. + */ +char * lv_strdup(const char * src); + +/** + * @brief Duplicate a string by allocating a new one and copying the content + * up to the end or the specified maximum length, whichever comes first. + * @param src Pointer to the source of data to be copied. + * @param max_len Maximum number of characters to be copied. + * @return Pointer to a newly allocated null-terminated string. NULL if failed. + */ +char * lv_strndup(const char * src, size_t max_len); + +/** + * @brief Copies the string pointed to by src, including the terminating null character, + * to the end of the string pointed to by dst. + * @param dst Pointer to the destination string where the content is to be appended. + * @param src Pointer to the source of data to be copied. + * @return A pointer to the destination string, which is dst. + */ +char * lv_strcat(char * dst, const char * src); + +/** + * @brief Copies up to src_len characters from the string pointed to by src + * to the end of the string pointed to by dst. + * A terminating null character is appended to dst even if no null character + * was encountered in src after src_len characters were copied. + * @param dst Pointer to the destination string where the content is to be appended. + * @param src Pointer to the source of data to be copied. + * @param src_len Maximum number of characters from src to be copied to the end of dst. + * @return A pointer to the destination string, which is dst. + */ +char * lv_strncat(char * dst, const char * src, size_t src_len); + +/** + * @brief Searches for the first occurrence of character c in the string str. + * @param str Pointer to the null-terminated byte string to be searched. + * @param c The character to be searched for. + * @return A pointer to the first occurrence of character c in the string str, or a null pointer if c is not found. + */ +char * lv_strchr(const char * str, int c); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_STRING_H*/ diff --git a/include/lvgl/themes/default/lv_theme_default.h b/include/lvgl/themes/default/lv_theme_default.h new file mode 100644 index 0000000000..26fad8de1e --- /dev/null +++ b/include/lvgl/themes/default/lv_theme_default.h @@ -0,0 +1,71 @@ +/** + * @file lv_theme_default.h + * + */ + +#ifndef LV_THEME_DEFAULT_H +#define LV_THEME_DEFAULT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_theme.h" + +#if LV_USE_THEME_DEFAULT + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the theme + * @param disp pointer to display + * @param color_primary the primary color of the theme + * @param color_secondary the secondary color for the theme + * @param dark + * @param font pointer to a font to use. + * @return a pointer to reference this theme later + */ +lv_theme_t * lv_theme_default_init(lv_display_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark, + const lv_font_t * font); + +/** + * Check if default theme is initialized + * @return true if default theme is initialized, false otherwise + */ +bool lv_theme_default_is_inited(void); + +/** + * Get default theme + * @return a pointer to default theme, or NULL if this is not initialized + */ +lv_theme_t * lv_theme_default_get(void); + +/** + * Deinitialize the default theme + */ +void lv_theme_default_deinit(void); + +/********************** + * MACROS + **********************/ + +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_THEME_DEFAULT_H*/ diff --git a/include/lvgl/themes/lv_theme.h b/include/lvgl/themes/lv_theme.h new file mode 100644 index 0000000000..dab88a4e4b --- /dev/null +++ b/include/lvgl/themes/lv_theme.h @@ -0,0 +1,144 @@ +/** + *@file lv_theme.h + * + */ + +#ifndef LV_THEME_H +#define LV_THEME_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef void (*lv_theme_apply_cb_t)(lv_theme_t *, lv_obj_t *); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Creates a new theme + * @return the new theme or NULL if allocation failed + */ +lv_theme_t * lv_theme_create(void); + +/** + * Copy 'src' theme into 'dst' + * @param dst pointer to the destination theme + * @param src pointer to the source theme + */ +void lv_theme_copy(lv_theme_t * dst, const lv_theme_t * src); + +/** + * Get the theme assigned to the display of the object + * @param obj pointer to a theme object + * @return the theme of the object's display (can be NULL) + */ +lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj); + +/** + * Apply the active theme on an object + * @param obj pointer to an object + */ +void lv_theme_apply(lv_obj_t * obj); + +/** + * Set a base theme for a theme. + * The styles from the base them will be added before the styles of the current theme. + * Arbitrary long chain of themes can be created by setting base themes. + * @param theme pointer to theme which base should be set + * @param parent pointer to the base theme + */ +void lv_theme_set_parent(lv_theme_t * theme, lv_theme_t * parent); + +/** + * Set an apply callback for a theme. + * The apply callback is used to add styles to different objects + * @param theme pointer to theme which callback should be set + * @param apply_cb pointer to the callback + */ +void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb); + +/** + * Get the small font of the theme + * @param obj pointer to an object + * @return pointer to the font + */ +const lv_font_t * lv_theme_get_font_small(lv_obj_t * obj); +/** + * Get the normal font of the theme + * @param obj pointer to an object + * @return pointer to the font + */ +const lv_font_t * lv_theme_get_font_normal(lv_obj_t * obj); + +/** + * Get the subtitle font of the theme + * @param obj pointer to an object + * @return pointer to the font + */ +const lv_font_t * lv_theme_get_font_large(lv_obj_t * obj); + +/** + * Get the primary color of the theme + * @param obj pointer to an object + * @return the color + */ +lv_color_t lv_theme_get_color_primary(lv_obj_t * obj); + +/** + * Get the secondary color of the theme + * @param obj pointer to an object + * @return the color + */ +lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj); + + +/** + * Delete a theme + * @param theme the theme to destroy + */ +void lv_theme_delete(lv_theme_t * theme); + +#if LV_USE_EXT_DATA +/** + * @brief Attaches external user data and destructor callback to the theme + * + * Associates custom user data with an LVGL theme and specifies a destructor function + * that will be automatically invoked when the theme is deleted to properly clean up + * the associated resources. + * + * @param theme Pointer to theme which callback should be set + * @param data User-defined data pointer to associate with the theme + * @param free_cb Callback function for cleaning up ext_data when theme is deleted. + * Receives ext_data as parameter. NULL means no cleanup required. + */ +void lv_theme_set_external_data(lv_theme_t * theme, void * data, void (* free_cb)(void * data)); +#endif + +/********************** + * MACROS + **********************/ + +#include "default/lv_theme_default.h" +#include "mono/lv_theme_mono.h" +#include "simple/lv_theme_simple.h" + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_THEME_H*/ diff --git a/include/lvgl/themes/mono/lv_theme_mono.h b/include/lvgl/themes/mono/lv_theme_mono.h new file mode 100644 index 0000000000..794411b499 --- /dev/null +++ b/include/lvgl/themes/mono/lv_theme_mono.h @@ -0,0 +1,68 @@ +/** + * @file lv_theme_mono.h + * + */ + +#ifndef LV_THEME_MONO_H +#define LV_THEME_MONO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_theme.h" + +#if LV_USE_THEME_MONO + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the theme + * @param disp pointer to display + * @param dark_bg + * @param font pointer to a font to use. + * @return a pointer to reference this theme later + */ +lv_theme_t * lv_theme_mono_init(lv_display_t * disp, bool dark_bg, const lv_font_t * font); + +/** +* Check if the theme is initialized +* @return true if default theme is initialized, false otherwise +*/ +bool lv_theme_mono_is_inited(void); + +/** + * Get mono theme + * @return a pointer to mono theme, or NULL if this is not initialized + */ +lv_theme_t * lv_theme_mono_get(void); + +/** + * Deinitialize the mono theme + */ +void lv_theme_mono_deinit(void); + +/********************** + * MACROS + **********************/ + +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /* LV_THEME_MONO_H */ diff --git a/include/lvgl/themes/simple/lv_theme_simple.h b/include/lvgl/themes/simple/lv_theme_simple.h new file mode 100644 index 0000000000..4b02a0e60c --- /dev/null +++ b/include/lvgl/themes/simple/lv_theme_simple.h @@ -0,0 +1,67 @@ +/** + * @file lv_theme_simple.h + * + */ + +#ifndef LV_THEME_SIMPLE_H +#define LV_THEME_SIMPLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_theme.h" +#include "../../display/lv_display.h" + +#if LV_USE_THEME_SIMPLE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the theme + * @param disp pointer to display + * @return a pointer to reference this theme later + */ +lv_theme_t * lv_theme_simple_init(lv_display_t * disp); + +/** +* Check if the theme is initialized +* @return true if default theme is initialized, false otherwise +*/ +bool lv_theme_simple_is_inited(void); + +/** + * Get simple theme + * @return a pointer to simple theme, or NULL if this is not initialized + */ +lv_theme_t * lv_theme_simple_get(void); + +/** + * Deinitialize the simple theme + */ +void lv_theme_simple_deinit(void); + +/********************** + * MACROS + **********************/ + +#endif + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_THEME_SIMPLE_H*/ diff --git a/include/lvgl/tick/lv_tick.h b/include/lvgl/tick/lv_tick.h new file mode 100644 index 0000000000..1eabd13d9c --- /dev/null +++ b/include/lvgl/tick/lv_tick.h @@ -0,0 +1,100 @@ +/** + * @file lv_tick.h + * Provide access to the system tick with 1 millisecond resolution + */ + +#ifndef LV_TICK_H +#define LV_TICK_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#include "../lv_types.h" + +/********************* + * DEFINES + *********************/ +#ifndef LV_ATTRIBUTE_TICK_INC +#define LV_ATTRIBUTE_TICK_INC +#endif + +/********************** + * TYPEDEFS + **********************/ +typedef uint32_t (*lv_tick_get_cb_t)(void); + +typedef void (*lv_delay_cb_t)(uint32_t ms); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * You have to call this function periodically. + * It is typically safe to call from an interrupt handler or a different thread. + * @param tick_period the call period of this function in milliseconds + */ +LV_ATTRIBUTE_TICK_INC void lv_tick_inc(uint32_t tick_period); + +/** + * Get the elapsed milliseconds since start up + * @return the elapsed milliseconds + */ +uint32_t lv_tick_get(void); + +/** + * Get the elapsed milliseconds since a previous time stamp + * @param prev_tick a previous time stamp (return value of lv_tick_get() ) + * @return the elapsed milliseconds since 'prev_tick' + */ +uint32_t lv_tick_elaps(uint32_t prev_tick); + +/** + * Get the elapsed milliseconds between two time stamps + * @param tick a time stamp + * @param prev_tick a time stamp before `tick` + * @return the elapsed milliseconds between `prev_tick` and `tick` + */ +uint32_t lv_tick_diff(uint32_t tick, uint32_t prev_tick); + +/** + * Delay for the given milliseconds. + * By default it's a blocking delay, but with `lv_delay_set_cb()` + * a custom delay function can be set too + * @param ms the number of milliseconds to delay + */ +void lv_delay_ms(uint32_t ms); + +/** + * Set a callback for a blocking delay + * @param cb pointer to a callback + */ +void lv_delay_set_cb(lv_delay_cb_t cb); + +/** + * Set the custom callback for 'lv_tick_get' + * @param cb call this callback on 'lv_tick_get' + */ +void lv_tick_set_cb(lv_tick_get_cb_t cb); + +/** + * Get the custom callback for 'lv_tick_get' + * @return call this callback on 'lv_tick_get' + */ +lv_tick_get_cb_t lv_tick_get_cb(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TICK_H*/ diff --git a/include/lvgl/widgets/lv_3dtexture.h b/include/lvgl/widgets/lv_3dtexture.h new file mode 100644 index 0000000000..95a540e021 --- /dev/null +++ b/include/lvgl/widgets/lv_3dtexture.h @@ -0,0 +1,86 @@ +/** + * @file lv_3dtexture.h + * + */ + +#ifndef LV_3DTEXTURE_H +#define LV_3DTEXTURE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" +#if LV_USE_3DTEXTURE + +#include "../core/lv_obj.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_3dtexture_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a 3dtexture object + * @param parent pointer to an object, it will be the parent of the new 3dtexture + * @return pointer to the created 3dtexture + */ +lv_obj_t * lv_3dtexture_create(lv_obj_t * parent); + +/** + * Set the source texture of the widget. + * The object size should be manually set to match. + * @param obj the 3dtexture widget + * @param id the texture handle from the 3D graphics backend. + * I.e., an `unsigned int` texture for OpenGL. + */ +void lv_3dtexture_set_src(lv_obj_t * obj, lv_3dtexture_id_t id); + +/** + * Set the flipping behavior of the widget. + * @param obj the 3dtexture widget + * @param h_flip true to flip horizontally. + * @param v_flip true to flip vertically. + */ +void lv_3dtexture_set_flip(lv_obj_t * obj, bool h_flip, bool v_flip); + +/*====================== + * Add/remove functions + *=====================*/ + +/*===================== + * Setter functions + *====================*/ + +/*===================== + * Getter functions + *====================*/ + +/*===================== + * Other functions + *====================*/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_3DTEXTURE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_3DTEXTURE_H*/ diff --git a/include/lvgl/widgets/lv_animimage.h b/include/lvgl/widgets/lv_animimage.h new file mode 100644 index 0000000000..0e874aea11 --- /dev/null +++ b/include/lvgl/widgets/lv_animimage.h @@ -0,0 +1,181 @@ +/** + * @file lv_animimage.h + * + */ + +/** + * Modified by NXP in 2025 + */ + +#ifndef LV_ANIMIMAGE_H +#define LV_ANIMIMAGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_image.h" +#include "../lv_types.h" + +#if LV_USE_ANIMIMG + + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_animimage_id_t { + LV_PROPERTY_ID2(ANIMIMAGE, SRC, LV_PROPERTY_TYPE_POINTER, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(ANIMIMAGE, DURATION, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(ANIMIMAGE, REPEAT_COUNT, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(ANIMIMAGE, SRC_COUNT, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_ANIMIMAGE_END, +}; +#endif + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_animimg_class; + +/** Image parts */ +typedef enum { + LV_ANIM_IMAGE_PART_MAIN, +} lv_animimg_part_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an animation image objects + * @param parent pointer to an object, it will be the parent of the new button + * @return pointer to the created animation image object + */ +lv_obj_t * lv_animimg_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the image animation images source. + * @param obj pointer to an animation image object + * @param dsc pointer to a series images + * @param num images' number + */ +void lv_animimg_set_src(lv_obj_t * obj, const void * dsc[], size_t num); + +/** + * Set the images source for flip playback of animation image. + * @param obj pointer to an animation image object + * @param dsc pointer to a series images + * @param num images' number + */ +void lv_animimg_set_src_reverse(lv_obj_t * obj, const void * dsc[], size_t num); + +/** + * Startup the image animation. + * @param obj pointer to an animation image object + */ +void lv_animimg_start(lv_obj_t * obj); + +/** + * Delete the image animation. + * @param obj pointer to an animation image object + */ +bool lv_animimg_delete(lv_obj_t * obj); + +/** + * Set the image animation duration time. unit:ms + * @param obj pointer to an animation image object + * @param duration the duration in milliseconds + */ +void lv_animimg_set_duration(lv_obj_t * obj, uint32_t duration); + +/** + * Set the image animation repeatedly play times. + * @param obj pointer to an animation image object + * @param count the number of times to repeat the animation + */ +void lv_animimg_set_repeat_count(lv_obj_t * obj, uint32_t count); + +/** + * Make the image animation to play back to when the forward direction is ready. + * @param obj pointer to an animation image object + * @param duration the duration of the playback image animation in milliseconds. 0: disable playback + */ +void lv_animimg_set_reverse_duration(lv_obj_t * obj, uint32_t duration); + +/** + * Make the image animation to play back to when the forward direction is ready. + * @param obj pointer to an animation image object + * @param duration delay in milliseconds before starting the playback image animation. + */ +void lv_animimg_set_reverse_delay(lv_obj_t * obj, uint32_t duration); + +/** + * Set a function call when the animation image really starts (considering `delay`) + * @param obj pointer to an animation image object + * @param start_cb a function call when the animation is start + */ +void lv_animimg_set_start_cb(lv_obj_t * obj, lv_anim_start_cb_t start_cb); + +/** + * Set a function call when the animation is completed + * @param obj pointer to an animation image object + * @param completed_cb a function call when the animation is completed + */ +void lv_animimg_set_completed_cb(lv_obj_t * obj, lv_anim_completed_cb_t completed_cb); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the image animation images source. + * @param obj pointer to an animation image object + * @return a pointer that will point to a series images + */ +const void ** lv_animimg_get_src(lv_obj_t * obj); + +/** + * Get the image animation images source. + * @param obj pointer to an animation image object + * @return the number of source images + */ +uint8_t lv_animimg_get_src_count(lv_obj_t * obj); + +/** + * Get the image animation duration time. unit:ms + * @param obj pointer to an animation image object + * @return the animation duration time + */ +uint32_t lv_animimg_get_duration(lv_obj_t * obj); + +/** + * Get the image animation repeat play times. + * @param obj pointer to an animation image object + * @return the repeat count + */ +uint32_t lv_animimg_get_repeat_count(lv_obj_t * obj); + +/** + * Get the image animation underlying animation. + * @param obj pointer to an animation image object + * @return the animation reference + */ +lv_anim_t * lv_animimg_get_anim(lv_obj_t * obj); + +#endif /*LV_USE_ANIMIMG*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_ANIMIMAGE_H*/ diff --git a/include/lvgl/widgets/lv_arc.h b/include/lvgl/widgets/lv_arc.h new file mode 100644 index 0000000000..720f994826 --- /dev/null +++ b/include/lvgl/widgets/lv_arc.h @@ -0,0 +1,301 @@ +/** + * @file lv_arc.h + * + */ + +#ifndef LV_ARC_H +#define LV_ARC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_ARC != 0 + +#include "../core/lv_obj.h" +#include "../core/lv_observer.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * In which direction the indicator should grow. + */ +typedef enum { + LV_ARC_MODE_NORMAL, /**< Clock-wise */ + LV_ARC_MODE_SYMMETRICAL, /**< Left/right from the midpoint */ + LV_ARC_MODE_REVERSE /**< Counterclock-wise */ +} lv_arc_mode_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_arc_id_t { + LV_PROPERTY_ID(ARC, START_ANGLE, LV_PROPERTY_TYPE_PRECISE, 0), + LV_PROPERTY_ID(ARC, END_ANGLE, LV_PROPERTY_TYPE_PRECISE, 1), + LV_PROPERTY_ID(ARC, BG_START_ANGLE, LV_PROPERTY_TYPE_PRECISE, 2), + LV_PROPERTY_ID(ARC, BG_END_ANGLE, LV_PROPERTY_TYPE_PRECISE, 3), + LV_PROPERTY_ID(ARC, ROTATION, LV_PROPERTY_TYPE_INT, 4), + LV_PROPERTY_ID(ARC, MODE, LV_PROPERTY_TYPE_INT, 5), + LV_PROPERTY_ID(ARC, VALUE, LV_PROPERTY_TYPE_INT, 6), + LV_PROPERTY_ID(ARC, MIN_VALUE, LV_PROPERTY_TYPE_INT, 7), + LV_PROPERTY_ID(ARC, MAX_VALUE, LV_PROPERTY_TYPE_INT, 8), + LV_PROPERTY_ID(ARC, CHANGE_RATE, LV_PROPERTY_TYPE_INT, 9), + LV_PROPERTY_ID(ARC, KNOB_OFFSET, LV_PROPERTY_TYPE_INT, 10), + LV_PROPERTY_ARC_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an arc object + * @param parent pointer to an object, it will be the parent of the new arc + * @return pointer to the created arc + */ +lv_obj_t * lv_arc_create(lv_obj_t * parent); + +/*====================== + * Add/remove functions + *=====================*/ + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the start angle of an arc. 0 deg: right, 90 bottom, etc. + * @param obj pointer to an arc object + * @param start the start angle. (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +void lv_arc_set_start_angle(lv_obj_t * obj, lv_value_precise_t start); + +/** + * Set the end angle of an arc. 0 deg: right, 90 bottom, etc. + * @param obj pointer to an arc object + * @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +void lv_arc_set_end_angle(lv_obj_t * obj, lv_value_precise_t end); + +/** + * Set the start and end angles + * @param obj pointer to an arc object + * @param start the start angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) + * @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +void lv_arc_set_angles(lv_obj_t * obj, lv_value_precise_t start, lv_value_precise_t end); + +/** + * Set the start angle of an arc background. 0 deg: right, 90 bottom, etc. + * @param obj pointer to an arc object + * @param start the start angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +void lv_arc_set_bg_start_angle(lv_obj_t * obj, lv_value_precise_t start); + +/** + * Set the start angle of an arc background. 0 deg: right, 90 bottom etc. + * @param obj pointer to an arc object + * @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +void lv_arc_set_bg_end_angle(lv_obj_t * obj, lv_value_precise_t end); + +/** + * Set the start and end angles of the arc background + * @param obj pointer to an arc object + * @param start the start angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) + * @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +void lv_arc_set_bg_angles(lv_obj_t * obj, lv_value_precise_t start, lv_value_precise_t end); + +/** + * Set the rotation for the whole arc + * @param obj pointer to an arc object + * @param rotation rotation angle + */ +void lv_arc_set_rotation(lv_obj_t * obj, int32_t rotation); + +/** + * Set in which direction the indicator should grow. + * @param obj pointer to arc object + * @param type arc's mode + */ +void lv_arc_set_mode(lv_obj_t * obj, lv_arc_mode_t type); + +/** + * Set a new value on the arc + * @param obj pointer to an arc object + * @param value new value + */ +void lv_arc_set_value(lv_obj_t * obj, int32_t value); + +/** + * Set minimum and the maximum values of an arc + * @param obj pointer to the arc object + * @param min minimum value + * @param max maximum value + */ +void lv_arc_set_range(lv_obj_t * obj, int32_t min, int32_t max); + +/** + * Set the minimum values of an arc + * @param obj pointer to the arc object + * @param min minimum value + */ +void lv_arc_set_min_value(lv_obj_t * obj, int32_t min); + +/** + * Set the maximum values of an arc + * @param obj pointer to the arc object + * @param max maximum value + */ +void lv_arc_set_max_value(lv_obj_t * obj, int32_t max); + +/** + * Set a change rate to limit the speed how fast the arc should reach the pressed point. + * @param obj pointer to an arc object + * @param rate the change rate + */ +void lv_arc_set_change_rate(lv_obj_t * obj, uint32_t rate); + +/** + * Set an offset angle for the knob + * @param obj pointer to an arc object + * @param offset knob offset from main arc in degrees + */ +void lv_arc_set_knob_offset(lv_obj_t * obj, int32_t offset); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the start angle of an arc. + * @param obj pointer to an arc object + * @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +lv_value_precise_t lv_arc_get_angle_start(lv_obj_t * obj); + +/** + * Get the end angle of an arc. + * @param obj pointer to an arc object + * @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +lv_value_precise_t lv_arc_get_angle_end(lv_obj_t * obj); + +/** + * Get the start angle of an arc background. + * @param obj pointer to an arc object + * @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +lv_value_precise_t lv_arc_get_bg_angle_start(lv_obj_t * obj); + +/** + * Get the end angle of an arc background. + * @param obj pointer to an arc object + * @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +lv_value_precise_t lv_arc_get_bg_angle_end(lv_obj_t * obj); + +/** + * Get the value of an arc + * @param obj pointer to an arc object + * @return the value of the arc + */ +int32_t lv_arc_get_value(const lv_obj_t * obj); + +/** + * Get the minimum value of an arc + * @param obj pointer to an arc object + * @return the minimum value of the arc + */ +int32_t lv_arc_get_min_value(const lv_obj_t * obj); + +/** + * Get the maximum value of an arc + * @param obj pointer to an arc object + * @return the maximum value of the arc + */ +int32_t lv_arc_get_max_value(const lv_obj_t * obj); + +/** + * Get whether the arc is type or not. + * @param obj pointer to an arc object + * @return arc's mode + */ +lv_arc_mode_t lv_arc_get_mode(const lv_obj_t * obj); + +/** + * Get the rotation for the whole arc + * @param obj pointer to an arc object + * @return arc's current rotation + */ +int32_t lv_arc_get_rotation(const lv_obj_t * obj); + +/** + * Get the current knob angle offset + * @param obj pointer to an arc object + * @return arc's current knob offset + */ +int32_t lv_arc_get_knob_offset(const lv_obj_t * obj); + +/** + * Get the change rate of an arc + * @param obj pointer to an arc object + * @return the change rate + */ +uint32_t lv_arc_get_change_rate(lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +#if LV_USE_OBSERVER +/** + * Bind an integer subject to an Arc's value. + * @param obj pointer to Arc + * @param subject pointer to Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_arc_bind_value(lv_obj_t * obj, lv_subject_t * subject); +#endif + + +/** + * Align an object to the current position of the arc (knob) + * @param obj pointer to an arc object + * @param obj_to_align pointer to an object to align + * @param r_offset consider the radius larger with this value (< 0: for smaller radius) + */ +void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, int32_t r_offset); + +/** + * Rotate an object to the current position of the arc (knob) + * @param obj pointer to an arc object + * @param obj_to_rotate pointer to an object to rotate + * @param r_offset consider the radius larger with this value (< 0: for smaller radius) + */ +void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, int32_t r_offset); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_ARC*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ARC_H*/ diff --git a/include/lvgl/widgets/lv_arclabel.h b/include/lvgl/widgets/lv_arclabel.h new file mode 100644 index 0000000000..078893e5d5 --- /dev/null +++ b/include/lvgl/widgets/lv_arclabel.h @@ -0,0 +1,301 @@ +/** + * @file lv_arclabel.h + * + */ + +#ifndef LV_ARCLABEL_H +#define LV_ARCLABEL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_ARCLABEL != 0 + +/********************* + * DEFINES + *********************/ + +#define LV_ARCLABEL_DOT_NUM 3 +#if LV_WIDGETS_HAS_DEFAULT_VALUE +#define LV_ARCLABEL_DEFAULT_TEXT "Arced Text" +#else +#define LV_ARCLABEL_DEFAULT_TEXT "" +#endif + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_ARCLABEL_DIR_CLOCKWISE = 0, + LV_ARCLABEL_DIR_COUNTER_CLOCKWISE = 1 +} lv_arclabel_dir_t; + +typedef enum { + LV_ARCLABEL_TEXT_ALIGN_DEFAULT = 0, + LV_ARCLABEL_TEXT_ALIGN_LEADING = 1, + LV_ARCLABEL_TEXT_ALIGN_CENTER = 2, + LV_ARCLABEL_TEXT_ALIGN_TRAILING = 3, +} lv_arclabel_text_align_t; + +typedef enum { + LV_ARCLABEL_OVERFLOW_VISIBLE, /**< Show full text, may overflow object area */ + LV_ARCLABEL_OVERFLOW_ELLIPSIS, /**< Show ellipsis (...) when text overflows */ + LV_ARCLABEL_OVERFLOW_CLIP /**< Clip text at arc boundary */ +} lv_arclabel_overflow_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arclabel_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an arc label object + * @param parent pointer to an object, it will be the parent of the new arc label + * @return pointer to the created arc label + */ +lv_obj_t * lv_arclabel_create(lv_obj_t * parent); + +/*====================== + * Add/remove functions + *=====================*/ + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the text of the arc label. + * + * This function sets the text displayed by an arc label object. + * + * @param obj Pointer to the arc label object. + * @param text Pointer to a null-terminated string containing the new text for the label. + */ +void lv_arclabel_set_text(lv_obj_t * obj, const char * text); + +/** + * Set the formatted text of an arc label object. + * + * This function sets the text of an arc label object with support for + * variable arguments formatting, similar to `printf`. + * + * @param obj The arc label object to set the text for. + * @param fmt A format string that specifies how subsequent arguments are converted to text. + * @param ... Arguments following the format string that are used to replace format specifiers in the format string. + */ +void lv_arclabel_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); + +/** + * Sets a new static text for the arc label or refreshes it with the current text. + * The 'text' must remain valid in memory; the arc label does not manage its lifecycle. + * + * @param obj Pointer to the arc label object. + * @param text Pointer to the new text. If NULL, the label is refreshed with its current text. + */ +void lv_arclabel_set_text_static(lv_obj_t * obj, const char * text); + +/** + * Set the start angle of an arc. 0 deg: right, 90 bottom, etc. + * @param obj pointer to an arc label object + * @param start the start angle. (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +void lv_arclabel_set_angle_start(lv_obj_t * obj, lv_value_precise_t start); + +/** + * Set the end angle of an arc. 0 deg: right, 90 bottom, etc. + * @param obj pointer to an arc label object + * @param size the angle size (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +void lv_arclabel_set_angle_size(lv_obj_t * obj, lv_value_precise_t size); + +/** + * Set the rotation for the whole arc + * @param obj pointer to an arc label object + * @param offset rotation angle + */ +void lv_arclabel_set_offset(lv_obj_t * obj, int32_t offset); + +/** + * Set the type of arc. + * @param obj pointer to and arc label object + * @param dir arc label's direction + */ +void lv_arclabel_set_dir(lv_obj_t * obj, lv_arclabel_dir_t dir); + +/** + * Enable the recoloring by in-line commands + * @param obj pointer to an arc label object + * @param en true: enable recoloring, false: disable + * Example: "This is a #ff0000 red# word" + */ +void lv_arclabel_set_recolor(lv_obj_t * obj, bool en); + +/** + * Set the radius for an arc label object. + * + * @param obj pointer to the arc label object. + * @param radius The radius value to set for the label's curvature, in pixels. + */ +void lv_arclabel_set_radius(lv_obj_t * obj, uint32_t radius); + +/** + * Set the center offset x for an arc label object. + * @param obj pointer to an arc label object + * @param x the x offset + */ +void lv_arclabel_set_center_offset_x(lv_obj_t * obj, uint32_t x); + +/** + * Set the center offset y for an arc label object. + * @param obj pointer to an arc label object + * @param y the y offset + */ +void lv_arclabel_set_center_offset_y(lv_obj_t * obj, uint32_t y); + +/** + * Set the text vertical alignment for an arc label object. + * @param obj pointer to an arc label object + * @param align the vertical alignment + */ +void lv_arclabel_set_text_vertical_align(lv_obj_t * obj, lv_arclabel_text_align_t align); + +/** + * Set the text horizontal alignment for an arc label object. + * @param obj pointer to an arc label object + * @param align the horizontal alignment + */ +void lv_arclabel_set_text_horizontal_align(lv_obj_t * obj, lv_arclabel_text_align_t align); + +/** + * Set the overflow behavior for an arc label object. + * @param obj pointer to an arc label object + * @param overflow the overflow mode (visible, ellipsis, clip) + */ +void lv_arclabel_set_overflow(lv_obj_t * obj, lv_arclabel_overflow_t overflow); + +/** + * Set the end overlap behavior for an arc label object. + * This controls how text is handled when it would overlap at the end of a 360-degree arc. + * @param obj pointer to an arc label object + * @param overlap set the arc label's end overlap behavior + */ +void lv_arclabel_set_end_overlap(lv_obj_t * obj, bool overlap); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the start angle of an arc label. + * @param obj pointer to an arc label object + * @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +lv_value_precise_t lv_arclabel_get_angle_start(lv_obj_t * obj); + +/** + * Get the angle size of an arc label. + * @param obj pointer to an arc label object + * @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +lv_value_precise_t lv_arclabel_get_angle_size(lv_obj_t * obj); + +/** + * Get whether the arc label is type or not. + * @param obj pointer to an arc label object + * @return arc label's direction + */ +lv_arclabel_dir_t lv_arclabel_get_dir(const lv_obj_t * obj); + +/** + * Enable the recoloring by in-line commands + * + * @see lv_arclabel_set_recolor + * + * @param obj pointer to a label object + * @return true: enable recoloring, false: disable + */ +bool lv_arclabel_get_recolor(lv_obj_t * obj); + +/** + * Get the text of the arc label. + * @param obj pointer to an arc label object + * @return the radius of the arc label + */ +uint32_t lv_arclabel_get_radius(lv_obj_t * obj); + +/** + * Get the center offset x for an arc label object. + * @param obj pointer to an arc label object + * @return the x offset + */ +uint32_t lv_arclabel_get_center_offset_x(lv_obj_t * obj); + +/** + * Get the center offset y for an arc label object. + * @param obj pointer to an arc label object + * @return the y offset + */ +uint32_t lv_arclabel_get_center_offset_y(lv_obj_t * obj); + +/** + * Get the text vertical alignment for an arc label object. + * @param obj pointer to an arc label object + * @return the vertical alignment + */ +lv_arclabel_text_align_t lv_arclabel_get_text_vertical_align(lv_obj_t * obj); + +/** + * Get the text horizontal alignment for an arc label object. + * @param obj pointer to an arc label object + * @return the horizontal alignment + */ +lv_arclabel_text_align_t lv_arclabel_get_text_horizontal_align(lv_obj_t * obj); + +/** + * Get the overflow behavior for an arc label object. + * @param obj pointer to an arc label object + * @return the overflow mode + */ +lv_arclabel_overflow_t lv_arclabel_get_overflow(lv_obj_t * obj); + +/** + * Get the end overlap behavior for an arc label object. + * @param obj pointer to an arc label object + * @return the end overlap mode + */ +bool lv_arclabel_get_end_overlap(lv_obj_t * obj); + +/** + * Get the text angle for an arc label object. + * @note The text angle is calculated at runtime. You can get the updated value + * after the arclabel's size has been updated. + * Returns the real rendered text angle in degrees except in + * `LV_ARCLABEL_OVERFLOW_VISIBLE` mode. + * @param obj pointer to an arc label object + * @return the text angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) + */ +lv_value_precise_t lv_arclabel_get_text_angle(lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_ARCLABEL*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ARCLABEL_H*/ diff --git a/include/lvgl/widgets/lv_bar.h b/include/lvgl/widgets/lv_bar.h new file mode 100644 index 0000000000..3e348b55a2 --- /dev/null +++ b/include/lvgl/widgets/lv_bar.h @@ -0,0 +1,198 @@ +/** + * @file lv_bar.h + * + */ + +#ifndef LV_BAR_H +#define LV_BAR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_BAR != 0 + +#include "../core/lv_obj.h" +#include "lv_label.h" +#include "../core/lv_observer.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_BAR_MODE_NORMAL, + LV_BAR_MODE_SYMMETRICAL, + LV_BAR_MODE_RANGE +} lv_bar_mode_t; + +typedef enum { + LV_BAR_ORIENTATION_AUTO, + LV_BAR_ORIENTATION_HORIZONTAL, + LV_BAR_ORIENTATION_VERTICAL +} lv_bar_orientation_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_bar_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_bar_id_t { + LV_PROPERTY_ID(BAR, VALUE, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(BAR, START_VALUE, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(BAR, MIN_VALUE, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(BAR, MAX_VALUE, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_ID(BAR, MODE, LV_PROPERTY_TYPE_INT, 4), + LV_PROPERTY_ID(BAR, ORIENTATION, LV_PROPERTY_TYPE_INT, 5), + LV_PROPERTY_BAR_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a bar object + * @param parent pointer to an object, it will be the parent of the new bar + * @return pointer to the created bar + */ +lv_obj_t * lv_bar_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set a new value on the bar + * @param obj pointer to a bar object + * @param value new value + * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately + */ +void lv_bar_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); + +/** + * Set a new start value on the bar + * @param obj pointer to a bar object + * @param start_value new start value + * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately + */ +void lv_bar_set_start_value(lv_obj_t * obj, int32_t start_value, lv_anim_enable_t anim); + +/** + * Set minimum and the maximum values of a bar + * @param obj pointer to the bar object + * @param min minimum value + * @param max maximum value + * @note If min is greater than max, the drawing direction becomes to the opposite direction. + */ +void lv_bar_set_range(lv_obj_t * obj, int32_t min, int32_t max); + +/** + * Set minimum value of a bar + * @param obj pointer to the bar object + * @param min minimum value + */ +void lv_bar_set_min_value(lv_obj_t * obj, int32_t min); + +/** + * Set maximum value of a bar + * @param obj pointer to the bar object + * @param max maximum value + */ +void lv_bar_set_max_value(lv_obj_t * obj, int32_t max); + +/** + * Set the type of bar. + * @param obj pointer to bar object + * @param mode bar type from `lv_bar_mode_t` + */ +void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode); + +/** + * Set the orientation of bar. + * @param obj pointer to bar object + * @param orientation bar orientation from `lv_bar_orientation_t` + */ +void lv_bar_set_orientation(lv_obj_t * obj, lv_bar_orientation_t orientation); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the value of a bar + * @param obj pointer to a bar object + * @return the value of the bar + */ +int32_t lv_bar_get_value(const lv_obj_t * obj); + +/** + * Get the start value of a bar + * @param obj pointer to a bar object + * @return the start value of the bar + */ +int32_t lv_bar_get_start_value(const lv_obj_t * obj); + +/** + * Get the minimum value of a bar + * @param obj pointer to a bar object + * @return the minimum value of the bar + */ +int32_t lv_bar_get_min_value(const lv_obj_t * obj); + +/** + * Get the maximum value of a bar + * @param obj pointer to a bar object + * @return the maximum value of the bar + */ +int32_t lv_bar_get_max_value(const lv_obj_t * obj); + +/** + * Get the type of bar. + * @param obj pointer to bar object + * @return bar type from `lv_bar_mode_t` + */ +lv_bar_mode_t lv_bar_get_mode(lv_obj_t * obj); + +/** + * Get the orientation of bar. + * @param obj pointer to bar object + * @return bar orientation from `lv_bar_orientation_t` + */ +lv_bar_orientation_t lv_bar_get_orientation(lv_obj_t * obj); + +/** + * Give the bar is in symmetrical mode or not + * @param obj pointer to bar object + * @return true: in symmetrical mode false : not in +*/ +bool lv_bar_is_symmetrical(lv_obj_t * obj); + +#if LV_USE_OBSERVER +/** + * Bind an integer or float Subject to a Bar's value. + * @param obj pointer to Bar + * @param subject pointer to Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_bar_bind_value(lv_obj_t * obj, lv_subject_t * subject); +#endif + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_BAR*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BAR_H*/ diff --git a/include/lvgl/widgets/lv_barcode.h b/include/lvgl/widgets/lv_barcode.h new file mode 100644 index 0000000000..57c932f3f4 --- /dev/null +++ b/include/lvgl/widgets/lv_barcode.h @@ -0,0 +1,143 @@ +/** + * @file lv_barcode.h + * + */ + +#ifndef LV_BARCODE_H +#define LV_BARCODE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../lv_types.h" +#include "../draw/lv_color.h" +#include "lv_canvas.h" + +#if LV_USE_BARCODE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + /** + * Code 128 with GS1 encoding. Strips `[FCN1]` and spaces. + */ + LV_BARCODE_ENCODING_CODE128_GS1, + /** + * Code 128 with raw encoding. + */ + LV_BARCODE_ENCODING_CODE128_RAW, +} lv_barcode_encoding_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_barcode_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an empty barcode (an `lv_canvas`) object. + * @param parent point to an object where to create the barcode + * @return pointer to the created barcode object + */ +lv_obj_t * lv_barcode_create(lv_obj_t * parent); + +/** + * Set the dark color of a barcode object + * @param obj pointer to barcode object + * @param color dark color of the barcode + */ +void lv_barcode_set_dark_color(lv_obj_t * obj, lv_color_t color); + +/** + * Set the light color of a barcode object + * @param obj pointer to barcode object + * @param color light color of the barcode + */ +void lv_barcode_set_light_color(lv_obj_t * obj, lv_color_t color); + +/** + * Set the scale of a barcode object + * @param obj pointer to barcode object + * @param scale scale factor + */ +void lv_barcode_set_scale(lv_obj_t * obj, uint16_t scale); + +/** + * Set the direction of a barcode object + * @param obj pointer to barcode object + * @param direction draw direction (`LV_DIR_HOR` or `LB_DIR_VER`) + */ +void lv_barcode_set_direction(lv_obj_t * obj, lv_dir_t direction); + +/** + * Set the tiled mode of a barcode object + * @param obj pointer to barcode object + * @param tiled true: tiled mode, false: normal mode (default) + */ +void lv_barcode_set_tiled(lv_obj_t * obj, bool tiled); + +/** + * Set the encoding of a barcode object + * @param obj pointer to barcode object + * @param encoding encoding (default is `LV_BARCODE_CODE128_GS1`) + */ +void lv_barcode_set_encoding(lv_obj_t * obj, lv_barcode_encoding_t encoding); + +/** + * Set the data of a barcode object + * @param obj pointer to barcode object + * @param data data to display + * @return LV_RESULT_OK: if no error; LV_RESULT_INVALID: on error + */ +lv_result_t lv_barcode_update(lv_obj_t * obj, const char * data); + +/** + * Get the dark color of a barcode object + * @param obj pointer to barcode object + * @return dark color of the barcode + */ +lv_color_t lv_barcode_get_dark_color(lv_obj_t * obj); + +/** + * Get the light color of a barcode object + * @param obj pointer to barcode object + * @return light color of the barcode + */ +lv_color_t lv_barcode_get_light_color(lv_obj_t * obj); + +/** + * Get the scale of a barcode object + * @param obj pointer to barcode object + * @return scale factor + */ +uint16_t lv_barcode_get_scale(lv_obj_t * obj); + +/** + * Get the encoding of a barcode object + * @param obj pointer to barcode object + * @return encoding + */ +lv_barcode_encoding_t lv_barcode_get_encoding(const lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_BARCODE*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_BARCODE_H*/ diff --git a/include/lvgl/widgets/lv_button.h b/include/lvgl/widgets/lv_button.h new file mode 100644 index 0000000000..d287d9b194 --- /dev/null +++ b/include/lvgl/widgets/lv_button.h @@ -0,0 +1,48 @@ +/** + * @file lv_button.h + * + */ + +#ifndef LV_BUTTON_H +#define LV_BUTTON_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_BUTTON != 0 +#include "../core/lv_obj.h" + +/********************* + * DEFINES + *********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_button_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a button object + * @param parent pointer to an object, it will be the parent of the new button + * @return pointer to the created button + */ +lv_obj_t * lv_button_create(lv_obj_t * parent); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_BUTTON*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BUTTON_H*/ diff --git a/include/lvgl/widgets/lv_buttonmatrix.h b/include/lvgl/widgets/lv_buttonmatrix.h new file mode 100644 index 0000000000..7d78e0d67a --- /dev/null +++ b/include/lvgl/widgets/lv_buttonmatrix.h @@ -0,0 +1,227 @@ +/** + * @file lv_buttonmatrix.h + * + */ + +#ifndef LV_BUTTONMATRIX_H +#define LV_BUTTONMATRIX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_BUTTONMATRIX != 0 + +#include "../core/lv_obj.h" +#include "../core/lv_obj_property.h" + +/********************* + * DEFINES + *********************/ +#define LV_BUTTONMATRIX_BUTTON_NONE 0xFFFF +LV_EXPORT_CONST_INT(LV_BUTTONMATRIX_BUTTON_NONE); + +/********************** + * TYPEDEFS + **********************/ + +/** Type to store button control flags (disabled, hidden etc.) + * The least-significant 4 bits are used to store button-width proportions in range [1..15]. */ +typedef enum { + LV_BUTTONMATRIX_CTRL_NONE = 0x0000, /**< No extra control, use the default settings*/ + LV_BUTTONMATRIX_CTRL_WIDTH_1 = 0x0001, /**< Set the width to 1 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_2 = 0x0002, /**< Set the width to 2 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_3 = 0x0003, /**< Set the width to 3 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_4 = 0x0004, /**< Set the width to 4 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_5 = 0x0005, /**< Set the width to 5 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_6 = 0x0006, /**< Set the width to 6 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_7 = 0x0007, /**< Set the width to 7 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_8 = 0x0008, /**< Set the width to 8 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_9 = 0x0009, /**< Set the width to 9 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_10 = 0x000A, /**< Set the width to 10 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_11 = 0x000B, /**< Set the width to 11 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_12 = 0x000C, /**< Set the width to 12 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_13 = 0x000D, /**< Set the width to 13 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_14 = 0x000E, /**< Set the width to 14 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_WIDTH_15 = 0x000F, /**< Set the width to 15 relative to the other buttons in the same row */ + LV_BUTTONMATRIX_CTRL_HIDDEN = 0x0010, /**< Hides button; it continues to hold its space in layout. */ + LV_BUTTONMATRIX_CTRL_NO_REPEAT = 0x0020, /**< Do not emit LV_EVENT_LONG_PRESSED_REPEAT events while button is long-pressed. */ + LV_BUTTONMATRIX_CTRL_DISABLED = 0x0040, /**< Disables button like LV_STATE_DISABLED on normal Widgets. */ + LV_BUTTONMATRIX_CTRL_CHECKABLE = 0x0080, /**< Enable toggling of LV_STATE_CHECKED when clicked. */ + LV_BUTTONMATRIX_CTRL_CHECKED = 0x0100, /**< Make the button checked. It will use the :cpp:enumerator:`LV_STATE_CHECHKED` styles. */ + LV_BUTTONMATRIX_CTRL_CLICK_TRIG = 0x0200, /**< 1: Enables sending LV_EVENT_VALUE_CHANGE on CLICK, 0: sends LV_EVENT_VALUE_CHANGE on PRESS. */ + LV_BUTTONMATRIX_CTRL_POPOVER = 0x0400, /**< Show button text in a pop-over while being pressed. */ + LV_BUTTONMATRIX_CTRL_RECOLOR = 0x0800, /**< Enable text recoloring with `#color` */ + LV_BUTTONMATRIX_CTRL_RESERVED_1 = 0x1000, /**< Reserved for later use */ + LV_BUTTONMATRIX_CTRL_RESERVED_2 = 0x2000, /**< Reserved for later use */ + LV_BUTTONMATRIX_CTRL_CUSTOM_1 = 0x4000, /**< Custom free-to-use flag */ + LV_BUTTONMATRIX_CTRL_CUSTOM_2 = 0x8000, /**< Custom free-to-use flag */ +} lv_buttonmatrix_ctrl_t; + +typedef bool (*lv_buttonmatrix_button_draw_cb_t)(lv_obj_t * btnm, uint32_t btn_id, const lv_area_t * draw_area, + const lv_area_t * clip_area); + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_buttonmatrix_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_buttonmatrix_id_t { + LV_PROPERTY_ID(BUTTONMATRIX, SELECTED_BUTTON, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(BUTTONMATRIX, ONE_CHECKED, LV_PROPERTY_TYPE_BOOL, 1), + LV_PROPERTY_BUTTONMATRIX_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a button matrix object + * @param parent pointer to an object, it will be the parent of the new button matrix + * @return pointer to the created button matrix + */ +lv_obj_t * lv_buttonmatrix_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set a new map. Buttons will be created/deleted according to the map. The + * button matrix keeps a reference to the map and so the string array must not + * be deallocated during the life of the matrix. + * @param obj pointer to a button matrix object + * @param map pointer a string array. The last string has to be: "". Use "\n" to make a line break. + */ +void lv_buttonmatrix_set_map(lv_obj_t * obj, const char * const map[]); + +/** + * Set the button control map (hidden, disabled etc.) for a button matrix. + * The control map array will be copied and so may be deallocated after this + * function returns. + * @param obj pointer to a button matrix object + * @param ctrl_map pointer to an array of `lv_button_ctrl_t` control bytes. The + * length of the array and position of the elements must match + * the number and order of the individual buttons (i.e. excludes + * newline entries). + * An element of the map should look like e.g.: + * `ctrl_map[0] = width | LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_TGL_ENABLE` + */ +void lv_buttonmatrix_set_ctrl_map(lv_obj_t * obj, const lv_buttonmatrix_ctrl_t ctrl_map[]); + +/** + * Set the selected buttons + * @param obj pointer to button matrix object + * @param btn_id 0 based index of the button to modify. (Not counting new lines) + */ +void lv_buttonmatrix_set_selected_button(lv_obj_t * obj, uint32_t btn_id); + +/** + * Set the attributes of a button of the button matrix + * @param obj pointer to button matrix object + * @param btn_id 0 based index of the button to modify. (Not counting new lines) + * @param ctrl OR-ed attributes. E.g. `LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CHECKABLE` + */ +void lv_buttonmatrix_set_button_ctrl(lv_obj_t * obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl); + +/** + * Clear the attributes of a button of the button matrix + * @param obj pointer to button matrix object + * @param btn_id 0 based index of the button to modify. (Not counting new lines) + * @param ctrl OR-ed attributes. E.g. `LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CHECKABLE` + */ +void lv_buttonmatrix_clear_button_ctrl(lv_obj_t * obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl); + +/** + * Set attributes of all buttons of a button matrix + * @param obj pointer to a button matrix object + * @param ctrl attribute(s) to set from `lv_buttonmatrix_ctrl_t`. Values can be ORed. + */ +void lv_buttonmatrix_set_button_ctrl_all(lv_obj_t * obj, lv_buttonmatrix_ctrl_t ctrl); + +/** + * Clear the attributes of all buttons of a button matrix + * @param obj pointer to a button matrix object + * @param ctrl attribute(s) to set from `lv_buttonmatrix_ctrl_t`. Values can be ORed. + */ +void lv_buttonmatrix_clear_button_ctrl_all(lv_obj_t * obj, lv_buttonmatrix_ctrl_t ctrl); + +/** + * Set a single button's relative width. + * This method will cause the matrix be regenerated and is a relatively + * expensive operation. It is recommended that initial width be specified using + * `lv_buttonmatrix_set_ctrl_map` and this method only be used for dynamic changes. + * @param obj pointer to button matrix object + * @param btn_id 0 based index of the button to modify. + * @param width relative width compared to the buttons in the same row. [1..15] + */ +void lv_buttonmatrix_set_button_width(lv_obj_t * obj, uint32_t btn_id, uint32_t width); + +/** + * Make the button matrix like a selector widget (only one button may be checked at a time). + * `LV_BUTTONMATRIX_CTRL_CHECKABLE` must be enabled on the buttons to be selected using + * `lv_buttonmatrix_set_ctrl()` or `lv_buttonmatrix_set_button_ctrl_all()`. + * @param obj pointer to a button matrix object + * @param en whether "one check" mode is enabled + */ +void lv_buttonmatrix_set_one_checked(lv_obj_t * obj, bool en); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the current map of a button matrix + * @param obj pointer to a button matrix object + * @return the current map + */ +const char * const * lv_buttonmatrix_get_map(const lv_obj_t * obj); + +/** + * Get the index of the lastly "activated" button by the user (pressed, released, focused etc) + * Useful in the `event_cb` to get the text of the button, check if hidden etc. + * @param obj pointer to button matrix object + * @return index of the last released button (LV_BUTTONMATRIX_BUTTON_NONE: if unset) + */ +uint32_t lv_buttonmatrix_get_selected_button(const lv_obj_t * obj); + +/** + * Get the button's text + * @param obj pointer to button matrix object + * @param btn_id the index a button not counting new line characters. + * @return text of btn_index` button + */ +const char * lv_buttonmatrix_get_button_text(const lv_obj_t * obj, uint32_t btn_id); + +/** + * Get the whether a control value is enabled or disabled for button of a button matrix + * @param obj pointer to a button matrix object + * @param btn_id the index of a button not counting new line characters. + * @param ctrl control values to check (ORed value can be used) + * @return true: the control attribute is enabled false: disabled + */ +bool lv_buttonmatrix_has_button_ctrl(lv_obj_t * obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl); + +/** + * Tell whether "one check" mode is enabled or not. + * @param obj Button matrix object + * @return true: "one check" mode is enabled; false: disabled + */ +bool lv_buttonmatrix_get_one_checked(const lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_BUTTONMATRIX*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BUTTONMATRIX_H*/ diff --git a/include/lvgl/widgets/lv_calendar.h b/include/lvgl/widgets/lv_calendar.h new file mode 100644 index 0000000000..d047e25fe7 --- /dev/null +++ b/include/lvgl/widgets/lv_calendar.h @@ -0,0 +1,195 @@ +/** + * @file lv_calendar.h + * + */ + +#ifndef LV_CALENDAR_H +#define LV_CALENDAR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_buttonmatrix.h" + +#if LV_USE_CALENDAR + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Represents a date on the calendar object (platform-agnostic). + */ +typedef struct { + uint16_t year; + uint8_t month; /**< 1..12 */ + uint8_t day; /**< 1..31 */ +} lv_calendar_date_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a calendar widget + * @param parent pointer to an object, it will be the parent of the new calendar + * @return pointer the created calendar + */ +lv_obj_t * lv_calendar_create(lv_obj_t * parent); + +/*====================== + * Add/remove functions + *=====================*/ + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the today's year, month and day at once + * @param obj pointer to a calendar object + * @param year today's year + * @param month today's month [1..12] + * @param day today's day [1..31] + */ +void lv_calendar_set_today_date(lv_obj_t * obj, uint32_t year, uint32_t month, uint32_t day); + +/** + * Set the today's year + * @param obj pointer to a calendar object + * @param year today's year + */ +void lv_calendar_set_today_year(lv_obj_t * obj, uint32_t year); + +/** + * Set the today's year + * @param obj pointer to a calendar object + * @param month today's month [1..12] + */ +void lv_calendar_set_today_month(lv_obj_t * obj, uint32_t month); + +/** + * Set the today's year + * @param obj pointer to a calendar object + * @param day today's day [1..31] + */ +void lv_calendar_set_today_day(lv_obj_t * obj, uint32_t day); + +/** + * Set the currently shown year and month at once + * @param obj pointer to a calendar object + * @param year shown year + * @param month shown month [1..12] + */ +void lv_calendar_set_month_shown(lv_obj_t * obj, uint32_t year, uint32_t month); + +/** + * Set the currently shown year + * @param obj pointer to a calendar object + * @param year shown year + */ +void lv_calendar_set_shown_year(lv_obj_t * obj, uint32_t year); + +/** + * Set the currently shown month + * @param obj pointer to a calendar object + * @param month shown month [1..12] + */ +void lv_calendar_set_shown_month(lv_obj_t * obj, uint32_t month); + +/** + * Set the highlighted dates + * @param obj pointer to a calendar object + * @param highlighted pointer to an `lv_calendar_date_t` array containing the dates. + * Only the pointer will be saved so this variable can't be local which will be destroyed later. + * @param date_num number of dates in the array + */ +void lv_calendar_set_highlighted_dates(lv_obj_t * obj, lv_calendar_date_t highlighted[], size_t date_num); + +/** + * Set the name of the days + * @param obj pointer to a calendar object + * @param day_names pointer to an array with the names. + * E.g. `const char * days[7] = {"Sun", "Mon", ...}` + * Only the pointer will be saved so this variable can't be local which will be destroyed later. + */ +void lv_calendar_set_day_names(lv_obj_t * obj, const char ** day_names); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the button matrix object of the calendar. + * It shows the dates and day names. + * @param obj pointer to a calendar object + * @return pointer to a the button matrix + */ +lv_obj_t * lv_calendar_get_btnmatrix(const lv_obj_t * obj); + +/** + * Get the today's date + * @param calendar pointer to a calendar object + * @return return pointer to an `lv_calendar_date_t` variable containing the date of today. + */ +const lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * calendar); + +/** + * Get the currently showed + * @param calendar pointer to a calendar object + * @return pointer to an `lv_calendar_date_t` variable containing the date is being shown. + */ +const lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar); + +/** + * Get the highlighted dates + * @param calendar pointer to a calendar object + * @return pointer to an `lv_calendar_date_t` array containing the dates. + */ +lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar); + +/** + * Get the number of the highlighted dates + * @param calendar pointer to a calendar object + * @return number of highlighted days + */ +size_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar); + +/** + * Get the currently pressed day + * @param calendar pointer to a calendar object + * @param date store the pressed date here + * @return LV_RESULT_OK: there is a valid pressed date + * LV_RESULT_INVALID: there is no pressed data + */ +lv_result_t lv_calendar_get_pressed_date(const lv_obj_t * calendar, lv_calendar_date_t * date); + +/*===================== + * Other functions + *====================*/ + +/********************** + * MACROS + **********************/ + +#include "lv_calendar_header_arrow.h" +#include "lv_calendar_header_dropdown.h" +#include "lv_calendar_chinese.h" + +#endif /*LV_USE_CALENDAR*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CALENDAR_H*/ diff --git a/include/lvgl/widgets/lv_calendar_chinese.h b/include/lvgl/widgets/lv_calendar_chinese.h new file mode 100644 index 0000000000..45501173ad --- /dev/null +++ b/include/lvgl/widgets/lv_calendar_chinese.h @@ -0,0 +1,67 @@ +/** + * @file lv_calendar_chinese.h + * + */ + +#ifndef LV_CALENDAR_CHINESE_H +#define LV_CALENDAR_CHINESE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_calendar.h" +#if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_calendar_date_t today; + bool leep_month; +} lv_calendar_chinese_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Enable the chinese calendar. + * @param obj pointer to a calendar object. + * @param en true: enable chinese calendar; false: disable + */ +void lv_calendar_set_chinese_mode(lv_obj_t * obj, bool en); + +/** + * Get the name of the day + * @param gregorian to obtain the gregorian time for the name + * @return return the name of the day + */ +const char * lv_calendar_get_day_name(lv_calendar_date_t * gregorian); + +/** + * Get the chinese time of the gregorian time (reference: https://www.cnblogs.com/liyang31tg/p/4123171.html) + * @param gregorian_time need to convert to chinese time in gregorian time + * @param chinese_time the chinese time convert from gregorian time + */ +void lv_calendar_gregorian_to_chinese(lv_calendar_date_t * gregorian_time, lv_calendar_chinese_t * chinese_time); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_CALENDAR_CHINESE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CALENDAR_CHINESE_H*/ diff --git a/include/lvgl/widgets/lv_calendar_header_arrow.h b/include/lvgl/widgets/lv_calendar_header_arrow.h new file mode 100644 index 0000000000..774e5566cb --- /dev/null +++ b/include/lvgl/widgets/lv_calendar_header_arrow.h @@ -0,0 +1,49 @@ +/** + * @file lv_calendar_header_arrow.h + * + */ + +#ifndef LV_CALENDAR_HEADER_ARROW_H +#define LV_CALENDAR_HEADER_ARROW_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" +#if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_ARROW + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_header_arrow_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a calendar header with drop-drowns to select the year and month + * @param parent pointer to a calendar object. + * @return the created header + */ +lv_obj_t * lv_calendar_add_header_arrow(lv_obj_t * parent); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_CALENDAR_HEADER_ARROW*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CALENDAR_HEADER_ARROW_H*/ diff --git a/include/lvgl/widgets/lv_calendar_header_dropdown.h b/include/lvgl/widgets/lv_calendar_header_dropdown.h new file mode 100644 index 0000000000..e51cbe1fed --- /dev/null +++ b/include/lvgl/widgets/lv_calendar_header_dropdown.h @@ -0,0 +1,62 @@ +/** + * @file lv_calendar_header_dropdown.h + * + */ + +#ifndef LV_CALENDAR_HEADER_DROPDOWN_H +#define LV_CALENDAR_HEADER_DROPDOWN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" +#if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_DROPDOWN + +#if LV_USE_DROPDOWN == 0 +#error "LV_USE_DROPDOWN needs to be enabled" +#endif + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_header_dropdown_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a calendar header with drop-drowns to select the year and month + * @param parent pointer to a calendar object. + * @return the created header + */ +lv_obj_t * lv_calendar_add_header_dropdown(lv_obj_t * parent); + +/** + * Sets a custom calendar year list + * @param parent pointer to a calendar object + * @param years_list pointer to an const char array with the years list, see lv_dropdown set_options for more information. + * E.g. `const char * years = "2023\n2022\n2021\n2020\n2019" + * Only the pointer will be saved so this variable can't be local which will be destroyed later. + */ +void lv_calendar_header_dropdown_set_year_list(lv_obj_t * parent, const char * years_list); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_CALENDAR_HEADER_ARROW*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CALENDAR_HEADER_DROPDOWN_H*/ diff --git a/include/lvgl/widgets/lv_canvas.h b/include/lvgl/widgets/lv_canvas.h new file mode 100644 index 0000000000..755e7b0bf7 --- /dev/null +++ b/include/lvgl/widgets/lv_canvas.h @@ -0,0 +1,190 @@ +/** + * @file lv_canvas.h + * + */ + +#ifndef LV_CANVAS_H +#define LV_CANVAS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_CANVAS + +#include "lv_image.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_canvas_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a canvas object + * @param parent pointer to an object, it will be the parent of the new canvas + * @return pointer to the created canvas + */ +lv_obj_t * lv_canvas_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set a buffer for the canvas. + * + * Use lv_canvas_set_draw_buf() instead if you need to set a buffer with alignment requirement. + * + * @param obj pointer to a canvas object + * @param buf buffer where content of canvas will be. + * The required size is (lv_image_color_format_get_px_size(cf) * w) / 8 * h) + * It can be allocated with `lv_malloc()` or + * it can be statically allocated array (e.g. static lv_color_t buf[100*50]) or + * it can be an address in RAM or external SRAM + * @param w width of canvas + * @param h height of canvas + * @param cf color format. `LV_COLOR_FORMAT...` + */ +void lv_canvas_set_buffer(lv_obj_t * obj, void * buf, int32_t w, int32_t h, lv_color_format_t cf); + +/** + * Set a draw buffer for the canvas. A draw buffer either can be allocated by `lv_draw_buf_create()` + * or defined statically by `LV_DRAW_BUF_DEFINE_STATIC`. When buffer start address and stride has alignment + * requirement, it's recommended to use `lv_draw_buf_create`. + * @param obj pointer to a canvas object + * @param draw_buf pointer to a draw buffer + */ +void lv_canvas_set_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf); + +/** + * Set a pixel's color and opacity + * @param obj pointer to a canvas + * @param x X coordinate of the pixel + * @param y Y coordinate of the pixel + * @param color the color + * @param opa the opacity + * @note The following color formats are supported + * LV_COLOR_FORMAT_I1/2/4/8, LV_COLOR_FORMAT_A8, + * LV_COLOR_FORMAT_RGB565, LV_COLOR_FORMAT_RGB888, + * LV_COLOR_FORMAT_XRGB8888, LV_COLOR_FORMAT_ARGB8888 + * @note this function invalidates the canvas object every time, + * for best performance, if you're changing a lot of pixels in a loop, + * call `lv_display_enable_invalidation` before the loop starts + * so the invalidation isn't done on every call + */ +void lv_canvas_set_px(lv_obj_t * obj, int32_t x, int32_t y, lv_color_t color, lv_opa_t opa); + +/** + * Set the palette color of a canvas for index format. Valid only for `LV_COLOR_FORMAT_I1/2/4/8` + * @param obj pointer to canvas object + * @param index the palette color to set: + * - for `LV_COLOR_FORMAT_I1`: 0..1 + * - for `LV_COLOR_FORMAT_I2`: 0..3 + * - for `LV_COLOR_FORMAT_I4`: 0..15 + * - for `LV_COLOR_FORMAT_I8`: 0..255 + * @param color the color to set + */ +void lv_canvas_set_palette(lv_obj_t * obj, uint8_t index, lv_color32_t color); + +/*===================== + * Getter functions + *====================*/ + +lv_draw_buf_t * lv_canvas_get_draw_buf(lv_obj_t * obj); + +/** + * Get a pixel's color and opacity + * @param obj pointer to a canvas + * @param x X coordinate of the pixel + * @param y Y coordinate of the pixel + * @return ARGB8888 color of the pixel + */ +lv_color32_t lv_canvas_get_px(lv_obj_t * obj, int32_t x, int32_t y); + +/** + * Get the image of the canvas as a pointer to an `lv_image_dsc_t` variable. + * @param canvas pointer to a canvas object + * @return pointer to the image descriptor. + */ +lv_image_dsc_t * lv_canvas_get_image(lv_obj_t * canvas); + +/** + * Return the pointer for the buffer. + * It's recommended to use this function instead of the buffer form the + * return value of lv_canvas_get_image() as is can be aligned + * @param canvas pointer to a canvas object + * @return pointer to the buffer + */ +const void * lv_canvas_get_buf(lv_obj_t * canvas); + +/*===================== + * Other functions + *====================*/ + +/** + * Copy a buffer to the canvas + * @param obj pointer to a canvas object + * @param canvas_area the area of the canvas to copy the new data to + * @param src_buf pointer to a buffer holding the source data + * @param src_area the area of the source buffer to copy from. If NULL, copy the whole buffer. + * @note canvas_area and src_area should be the same size. If canvas_area and the size of src_buf are the same, + * src_area can be left NULL. + */ +void lv_canvas_copy_buf(lv_obj_t * obj, const lv_area_t * canvas_area, lv_draw_buf_t * src_buf, + const lv_area_t * src_area); + +/** + * Fill the canvas with color + * @param obj pointer to a canvas + * @param color the background color + * @param opa the desired opacity + */ +void lv_canvas_fill_bg(lv_obj_t * obj, lv_color_t color, lv_opa_t opa); + +/** + * Initialize a layer to use LVGL's generic draw functions (lv_draw_rect/label/...) on the canvas. + * Needs to be usd in pair with `lv_canvas_finish_layer`. + * @param canvas pointer to a canvas + * @param layer pointer to a layer variable to initialize + */ +void lv_canvas_init_layer(lv_obj_t * canvas, lv_layer_t * layer); + +/** + * Wait until all the drawings are finished on layer. + * Needs to be usd in pair with `lv_canvas_init_layer`. + * @param canvas pointer to a canvas + * @param layer pointer to a layer to finalize + */ +void lv_canvas_finish_layer(lv_obj_t * canvas, lv_layer_t * layer); + +/********************** + * MACROS + **********************/ + +#define LV_CANVAS_BUF_SIZE(w, h, bpp, stride) (((((w * bpp + 7) >> 3) + stride - 1) & ~(stride - 1)) * h + LV_DRAW_BUF_ALIGN) + +/** + * Just a wrapper to `LV_CANVAS_BUF_SIZE` for bindings. + */ +uint32_t lv_canvas_buf_size(int32_t w, int32_t h, uint8_t bpp, uint8_t stride); + +#endif /*LV_USE_CANVAS*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CANVAS_H*/ diff --git a/include/lvgl/widgets/lv_chart.h b/include/lvgl/widgets/lv_chart.h new file mode 100644 index 0000000000..8ee3a99b27 --- /dev/null +++ b/include/lvgl/widgets/lv_chart.h @@ -0,0 +1,466 @@ +/** + * @file lv_chart.h + * + */ + +#ifndef LV_CHART_H +#define LV_CHART_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../core/lv_obj.h" + +#if LV_USE_CHART != 0 + +/********************* + * DEFINES + *********************/ + +/**Default value of points. Can be used to not draw a point*/ +#define LV_CHART_POINT_NONE (INT32_MAX) +LV_EXPORT_CONST_INT(LV_CHART_POINT_NONE); + +/********************** + * TYPEDEFS + **********************/ + +/** + * Chart types + */ +typedef enum { + LV_CHART_TYPE_NONE, /**< Don't draw the series*/ + LV_CHART_TYPE_LINE, /**< Connect the points with lines*/ + LV_CHART_TYPE_CURVE, /**< Connect the points with curves*/ + LV_CHART_TYPE_BAR, /**< Draw bars for each series*/ + LV_CHART_TYPE_STACKED, /**< Draw a single stacked bar for each data point. Supports only positive values*/ + LV_CHART_TYPE_SCATTER, /**< Draw points and lines in 2D (x,y coordinates)*/ +} lv_chart_type_t; + +/** + * Chart update mode for `lv_chart_set_next` + */ +typedef enum { + LV_CHART_UPDATE_MODE_SHIFT, /**< Shift old data to the left and add the new one the right*/ + LV_CHART_UPDATE_MODE_CIRCULAR, /**< Add the new data in a circular way*/ +} lv_chart_update_mode_t; + +/** + * Enumeration of the axis' + */ +typedef enum { + LV_CHART_AXIS_PRIMARY_Y = 0x00, + LV_CHART_AXIS_SECONDARY_Y = 0x01, + LV_CHART_AXIS_PRIMARY_X = 0x02, + LV_CHART_AXIS_SECONDARY_X = 0x04, + LV_CHART_AXIS_LAST +} lv_chart_axis_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_chart_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_chart_id_t { + LV_PROPERTY_ID(CHART, TYPE, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(CHART, POINT_COUNT, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(CHART, UPDATE_MODE, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(CHART, HOR_DIV_LINE_COUNT, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_ID(CHART, VER_DIV_LINE_COUNT, LV_PROPERTY_TYPE_INT, 4), + LV_PROPERTY_CHART_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a chart object + * @param parent pointer to an object, it will be the parent of the new chart + * @return pointer to the created chart + */ +lv_obj_t * lv_chart_create(lv_obj_t * parent); + +/** + * Set a new type for a chart + * @param obj pointer to a chart object + * @param type new type of the chart (from 'lv_chart_type_t' enum) + */ +void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type); +/** + * Set the number of points on a data line on a chart + * @param obj pointer to a chart object + * @param cnt new number of points on the data lines + */ +void lv_chart_set_point_count(lv_obj_t * obj, uint32_t cnt); + +/** + * Set the minimal and maximal y values on an axis + * @param obj pointer to a chart object + * @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y` + * @param min minimum value of the y axis + * @param max maximum value of the y axis + */ +void lv_chart_set_axis_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min, int32_t max); + +/** + * Set the minimal values on an axis + * @param obj pointer to a chart object + * @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y` + * @param min minimal value of the y axis + */ +void lv_chart_set_axis_min_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min); + +/** + * Set the maximal y values on an axis + * @param obj pointer to a chart object + * @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y` + * @param max maximum value of the y axis + */ +void lv_chart_set_axis_max_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t max); + + +/** + * Set update mode of the chart object. Affects + * @param obj pointer to a chart object + * @param update_mode the update mode + */ +void lv_chart_set_update_mode(lv_obj_t * obj, lv_chart_update_mode_t update_mode); + +/** + * Set the number of horizontal and vertical division lines + * @param obj pointer to a chart object + * @param hdiv number of horizontal division lines + * @param vdiv number of vertical division lines + */ +void lv_chart_set_div_line_count(lv_obj_t * obj, uint32_t hdiv, uint32_t vdiv); + +/** + * Set the number of horizontal division lines + * @param obj pointer to a chart object + * @param cnt number of horizontal division lines + */ +void lv_chart_set_hor_div_line_count(lv_obj_t * obj, uint32_t cnt); + +/** + * Set the number of vertical division lines + * @param obj pointer to a chart object + * @param cnt number of vertical division lines + */ +void lv_chart_set_ver_div_line_count(lv_obj_t * obj, uint32_t cnt); + +/** + * Get the type of a chart + * @param obj pointer to chart object + * @return type of the chart (from 'lv_chart_t' enum) + */ +lv_chart_type_t lv_chart_get_type(const lv_obj_t * obj); + +/** + * Get the data point number per data line on chart + * @param obj pointer to chart object + * @return point number on each data line + */ +uint32_t lv_chart_get_point_count(const lv_obj_t * obj); + +/** + * Get the update mode of a chart + * @param obj pointer to a chart object + * @return the update mode + */ +lv_chart_update_mode_t lv_chart_get_update_mode(const lv_obj_t * obj); + +/** + * Get the number of horizontal division lines + * @param obj pointer to a chart object + * @return the number of horizontal division lines + */ +uint32_t lv_chart_get_hor_div_line_count(const lv_obj_t * obj); + +/** + * Get the number of vertical division lines + * @param obj pointer to a chart object + * @return the number of vertical division lines + */ +uint32_t lv_chart_get_ver_div_line_count(const lv_obj_t * obj); + +/** + * Get the current index of the x-axis start point in the data array + * @param obj pointer to a chart object + * @param ser pointer to a data series on 'chart' + * @return the index of the current x start point in the data array + */ +uint32_t lv_chart_get_x_start_point(const lv_obj_t * obj, lv_chart_series_t * ser); + +/** + * Get the position of a point to the chart. + * @param obj pointer to a chart object + * @param ser pointer to series + * @param id the index. + * @param p_out store the result position here + */ +void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, lv_point_t * p_out); + +/** + * Refresh a chart if its data line has changed + * @param obj pointer to chart object + */ +void lv_chart_refresh(lv_obj_t * obj); + +/*====================== + * Series + *=====================*/ + +/** + * Allocate and add a data series to the chart + * @param obj pointer to a chart object + * @param color color of the data series + * @param axis the y axis to which the series should be attached (::LV_CHART_AXIS_PRIMARY_Y or ::LV_CHART_AXIS_SECONDARY_Y) + * @return pointer to the allocated data series or NULL on failure + */ +lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_chart_axis_t axis); + +/** + * Deallocate and remove a data series from a chart + * @param obj pointer to a chart object + * @param series pointer to a data series on 'chart' + */ +void lv_chart_remove_series(lv_obj_t * obj, lv_chart_series_t * series); + +/** + * Hide/Unhide a single series of a chart. + * @param chart pointer to a chart object. + * @param series pointer to a series object + * @param hide true: hide the series + */ +void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide); + +/** + * Change the color of a series + * @param chart pointer to a chart object. + * @param series pointer to a series object + * @param color the new color of the series + */ +void lv_chart_set_series_color(lv_obj_t * chart, lv_chart_series_t * series, lv_color_t color); + +/** + * Get the color of a series + * @param chart pointer to a chart object. + * @param series pointer to a series object + * @return the color of the series + */ +lv_color_t lv_chart_get_series_color(lv_obj_t * chart, const lv_chart_series_t * series); + +/** + * Set the index of the x-axis start point in the data array. + * This point will be considers the first (left) point and the other points will be drawn after it. + * @param obj pointer to a chart object + * @param ser pointer to a data series on 'chart' + * @param id the index of the x point in the data array + */ +void lv_chart_set_x_start_point(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id); + +/** + * Get the next series. + * @param chart pointer to a chart + * @param ser the previous series or NULL to get the first + * @return the next series or NULL if there is no more. + */ +lv_chart_series_t * lv_chart_get_series_next(const lv_obj_t * chart, const lv_chart_series_t * ser); + +/*===================== + * Cursor + *====================*/ + +/** + * Add a cursor with a given color + * @param obj pointer to chart object + * @param color color of the cursor + * @param dir direction of the cursor. `LV_DIR_RIGHT/LEFT/TOP/DOWN/HOR/VER/ALL`. OR-ed values are possible + * @return pointer to the created cursor + */ +lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * obj, lv_color_t color, lv_dir_t dir); + +/** + * Remove a cursor + * @param obj pointer to chart object + * @param cursor pointer to the cursor + */ +void lv_chart_remove_cursor(lv_obj_t * obj, lv_chart_cursor_t * cursor); + +/** + * Set the coordinate of the cursor with respect to the paddings + * @param chart pointer to a chart object + * @param cursor pointer to the cursor + * @param pos the new coordinate of cursor relative to the chart + */ +void lv_chart_set_cursor_pos(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * pos); + +/** + * Set the X coordinate of the cursor with respect to the paddings + * @param chart pointer to a chart object + * @param cursor pointer to the cursor + * @param x the new X coordinate of cursor relative to the chart + */ +void lv_chart_set_cursor_pos_x(lv_obj_t * chart, lv_chart_cursor_t * cursor, int32_t x); + +/** + * Set the coordinate of the cursor with respect to the paddings + * @param chart pointer to a chart object + * @param cursor pointer to the cursor + * @param y the new Y coordinate of cursor relative to the chart + */ +void lv_chart_set_cursor_pos_y(lv_obj_t * chart, lv_chart_cursor_t * cursor, int32_t y); + +/** + * Stick the cursor to a point + * @param chart pointer to a chart object + * @param cursor pointer to the cursor + * @param ser pointer to a series + * @param point_id the point's index or `LV_CHART_POINT_NONE` to not assign to any points. + */ +void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_chart_series_t * ser, + uint32_t point_id); + +/** + * Get the coordinate of the cursor with respect to the paddings + * @param chart pointer to a chart object + * @param cursor pointer to cursor + * @return coordinate of the cursor as lv_point_t + */ +lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor); + +/*===================== + * Set/Get value(s) + *====================*/ + +/** + * Initialize all data points of a series with a value + * @param obj pointer to chart object + * @param ser pointer to a data series on 'chart' + * @param value the new value for all points. `LV_CHART_POINT_NONE` can be used to hide the points. + */ +void lv_chart_set_all_values(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value); + +/** + * Set the next point's Y value according to the update mode policy. + * @param obj pointer to chart object + * @param ser pointer to a data series on 'chart' + * @param value the new value of the next data + */ +void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value); + +/** + * Set the next point's X and Y value according to the update mode policy. + * @param obj pointer to chart object + * @param ser pointer to a data series on 'chart' + * @param x_value the new X value of the next data + * @param y_value the new Y value of the next data + */ +void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, int32_t x_value, int32_t y_value); + +/** + * Same as `lv_chart_set_next_value` but set the values from an array + * @param obj pointer to chart object + * @param ser pointer to a data series on 'chart' + * @param values the new values to set + * @param values_cnt number of items in `values` + */ +void lv_chart_set_series_values(lv_obj_t * obj, lv_chart_series_t * ser, const int32_t values[], size_t values_cnt); + +/** + * Same as `lv_chart_set_next_value2` but set the values from an array + * @param obj pointer to chart object + * @param ser pointer to a data series on 'chart' + * @param x_values the new values to set on the X axis + * @param y_values the new values to set o nthe Y axis + * @param values_cnt number of items in `x_values` and `y_values` + */ +void lv_chart_set_series_values2(lv_obj_t * obj, lv_chart_series_t * ser, const int32_t x_values[], + const int32_t y_values[], size_t values_cnt); + +/** + * Set an individual point's y value of a chart's series directly based on its index + * @param obj pointer to a chart object + * @param ser pointer to a data series on 'chart' + * @param id the index of the x point in the array + * @param value value to assign to array point + */ +void lv_chart_set_series_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t value); + +/** + * Set an individual point's x and y value of a chart's series directly based on its index + * Can be used only with `LV_CHART_TYPE_SCATTER`. + * @param obj pointer to chart object + * @param ser pointer to a data series on 'chart' + * @param id the index of the x point in the array + * @param x_value the new X value of the next data + * @param y_value the new Y value of the next data + */ +void lv_chart_set_series_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t x_value, + int32_t y_value); + +/** + * Set an external array for the y data points to use for the chart + * NOTE: It is the users responsibility to make sure the `point_cnt` matches the external array size. + * @param obj pointer to a chart object + * @param ser pointer to a data series on 'chart' + * @param array external array of points for chart + */ +void lv_chart_set_series_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]); + +/** + * Set an external array for the x data points to use for the chart + * NOTE: It is the users responsibility to make sure the `point_cnt` matches the external array size. + * @param obj pointer to a chart object + * @param ser pointer to a data series on 'chart' + * @param array external array of points for chart + */ +void lv_chart_set_series_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]); + +/** + * Get the array of y values of a series + * @param obj pointer to a chart object + * @param ser pointer to a data series on 'chart' + * @return the array of values with 'point_count' elements + */ +int32_t * lv_chart_get_series_y_array(const lv_obj_t * obj, lv_chart_series_t * ser); + +/** + * Get the array of x values of a series + * @param obj pointer to a chart object + * @param ser pointer to a data series on 'chart' + * @return the array of values with 'point_count' elements + */ +int32_t * lv_chart_get_series_x_array(const lv_obj_t * obj, lv_chart_series_t * ser); + +/** + * Get the index of the currently pressed point. It's the same for every series. + * @param obj pointer to a chart object + * @return the index of the point [0 .. point count] or LV_CHART_POINT_ID_NONE if no point is being pressed + */ +uint32_t lv_chart_get_pressed_point(const lv_obj_t * obj); + +/** + * Get the overall offset from the chart's side to the center of the first point. + * In case of a bar chart it will be the center of the first column group + * @param obj pointer to a chart object + * @return the offset of the center + */ +int32_t lv_chart_get_first_point_center_offset(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_CHART*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CHART_H*/ diff --git a/include/lvgl/widgets/lv_checkbox.h b/include/lvgl/widgets/lv_checkbox.h new file mode 100644 index 0000000000..c46b7360cc --- /dev/null +++ b/include/lvgl/widgets/lv_checkbox.h @@ -0,0 +1,86 @@ +/** + * @file lv_checkbox.h + * + */ + +#ifndef LV_CHECKBOX_H +#define LV_CHECKBOX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../core/lv_obj.h" + +#if LV_USE_CHECKBOX != 0 + +/********************* + * DEFINES + *********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_checkbox_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_checkbox_id_t { + LV_PROPERTY_ID(CHECKBOX, TEXT, LV_PROPERTY_TYPE_TEXT, 0), + LV_PROPERTY_CHECKBOX_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a check box object + * @param parent pointer to an object, it will be the parent of the new button + * @return pointer to the created check box + */ +lv_obj_t * lv_checkbox_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the text of a check box. `txt` will be copied and may be deallocated + * after this function returns. + * @param obj pointer to a check box + * @param txt the text of the check box. NULL to refresh with the current text. + */ +void lv_checkbox_set_text(lv_obj_t * obj, const char * txt); + +/** + * Set the text of a check box. `txt` must not be deallocated during the life + * of this checkbox. + * @param obj pointer to a check box + * @param txt the text of the check box. + */ +void lv_checkbox_set_text_static(lv_obj_t * obj, const char * txt); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the text of a check box + * @param obj pointer to check box object + * @return pointer to the text of the check box + */ +const char * lv_checkbox_get_text(const lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_CHECKBOX*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CHECKBOX_H*/ diff --git a/include/lvgl/widgets/lv_dropdown.h b/include/lvgl/widgets/lv_dropdown.h new file mode 100644 index 0000000000..6638729d6f --- /dev/null +++ b/include/lvgl/widgets/lv_dropdown.h @@ -0,0 +1,266 @@ +/** + * @file lv_dropdown.h + * + */ + +#ifndef LV_DROPDOWN_H +#define LV_DROPDOWN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_DROPDOWN != 0 + +/*Testing of dependencies*/ + +#if LV_USE_LABEL == 0 +#error "lv_dropdown: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" +#endif + +#include "lv_label.h" + +/********************* + * DEFINES + *********************/ +#define LV_DROPDOWN_POS_LAST 0xFFFF +LV_EXPORT_CONST_INT(LV_DROPDOWN_POS_LAST); + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_dropdown_id_t { + LV_PROPERTY_ID(DROPDOWN, TEXT, LV_PROPERTY_TYPE_TEXT, 0), + LV_PROPERTY_ID(DROPDOWN, OPTIONS, LV_PROPERTY_TYPE_TEXT, 1), + LV_PROPERTY_ID(DROPDOWN, OPTION_COUNT, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(DROPDOWN, SELECTED, LV_PROPERTY_TYPE_INT, 3), + // LV_PROPERTY_ID(DROPDOWN, SELECTED_STR, LV_PROPERTY_TYPE_TEXT, 4), + LV_PROPERTY_ID(DROPDOWN, DIR, LV_PROPERTY_TYPE_INT, 5), + LV_PROPERTY_ID(DROPDOWN, SYMBOL, LV_PROPERTY_TYPE_IMGSRC, 6), + LV_PROPERTY_ID(DROPDOWN, SELECTED_HIGHLIGHT, LV_PROPERTY_TYPE_INT, 7), + LV_PROPERTY_ID(DROPDOWN, LIST, LV_PROPERTY_TYPE_OBJ, 8), + LV_PROPERTY_ID(DROPDOWN, IS_OPEN, LV_PROPERTY_TYPE_BOOL, 9), + LV_PROPERTY_DROPDOWN_END, +}; +#endif + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_dropdown_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_dropdownlist_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a drop-down list object + * @param parent pointer to an object, it will be the parent of the new drop-down list + * @return pointer to the created drop-down list + */ +lv_obj_t * lv_dropdown_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set text of the drop-down list's button. + * If set to `NULL` the selected option's text will be displayed on the button. + * If set to a specific text then that text will be shown regardless of the selected option. + * @param obj pointer to a drop-down list object + * @param text the text as a string (Copy is saved) + */ +void lv_dropdown_set_text(lv_obj_t * obj, const char * text); + +/** + * Set text of the drop-down list's button. + * If set to `NULL` the selected option's text will be displayed on the button. + * If set to a specific text then that text will be shown regardless of the selected option. + * @param obj pointer to a drop-down list object + * @param text the text as a string (Only its pointer is saved) + */ +void lv_dropdown_set_text_static(lv_obj_t * obj, const char * text); + +/** + * Set the options in a drop-down list from a string. + * The options will be copied and saved in the object so the `options` can be destroyed after calling this function + * @param obj pointer to drop-down list object + * @param options a string with '\n' separated options. E.g. "One\nTwo\nThree" + */ +void lv_dropdown_set_options(lv_obj_t * obj, const char * options); + +/** + * Set the options in a drop-down list from a static string (global, static or dynamically allocated). + * Only the pointer of the option string will be saved. + * @param obj pointer to drop-down list object + * @param options a static string with '\n' separated options. E.g. "One\nTwo\nThree" + */ +void lv_dropdown_set_options_static(lv_obj_t * obj, const char * options); + +/** + * Add an options to a drop-down list from a string. Only works for non-static options. + * @param obj pointer to drop-down list object + * @param option a string without '\n'. E.g. "Four" + * @param pos the insert position, indexed from 0, LV_DROPDOWN_POS_LAST = end of string + */ +void lv_dropdown_add_option(lv_obj_t * obj, const char * option, uint32_t pos); + +/** + * Clear all options in a drop-down list. Works with both static and dynamic options. + * @param obj pointer to drop-down list object + */ +void lv_dropdown_clear_options(lv_obj_t * obj); + +/** + * Set the selected option + * @param obj pointer to drop-down list object + * @param sel_opt id of the selected option (0 ... number of option - 1); + */ +void lv_dropdown_set_selected(lv_obj_t * obj, uint32_t sel_opt); + +/** + * Set the direction of the a drop-down list + * @param obj pointer to a drop-down list object + * @param dir LV_DIR_LEFT/RIGHT/TOP/BOTTOM + */ +void lv_dropdown_set_dir(lv_obj_t * obj, lv_dir_t dir); + +/** + * Set an arrow or other symbol to display when on drop-down list's button. Typically a down caret or arrow. + * @param obj pointer to drop-down list object + * @param symbol a text like `LV_SYMBOL_DOWN`, an image (pointer or path) or NULL to not draw symbol icon + * @note angle and zoom transformation can be applied if the symbol is an image. + * E.g. when drop down is checked (opened) rotate the symbol by 180 degree + */ +void lv_dropdown_set_symbol(lv_obj_t * obj, const void * symbol); + +/** + * Set whether the selected option in the list should be highlighted or not + * @param obj pointer to drop-down list object + * @param en true: highlight enabled; false: disabled + */ +void lv_dropdown_set_selected_highlight(lv_obj_t * obj, bool en); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the list of a drop-down to allow styling or other modifications + * @param obj pointer to a drop-down list object + * @return pointer to the list of the drop-down + */ +lv_obj_t * lv_dropdown_get_list(lv_obj_t * obj); + +/** + * Get text of the drop-down list's button. + * @param obj pointer to a drop-down list object + * @return the text as string, `NULL` if no text + */ +const char * lv_dropdown_get_text(lv_obj_t * obj); + +/** + * Get the options of a drop-down list + * @param obj pointer to drop-down list object + * @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3") + */ +const char * lv_dropdown_get_options(const lv_obj_t * obj); + +/** + * Get the index of the selected option + * @param obj pointer to drop-down list object + * @return index of the selected option (0 ... number of option - 1); + */ +uint32_t lv_dropdown_get_selected(const lv_obj_t * obj); + +/** + * Get the total number of options + * @param obj pointer to drop-down list object + * @return the total number of options in the list + */ +uint32_t lv_dropdown_get_option_count(const lv_obj_t * obj); + +/** + * Get the current selected option as a string + * @param obj pointer to drop-down object + * @param buf pointer to an array to store the string + * @param buf_size size of `buf` in bytes. 0: to ignore it. + */ +void lv_dropdown_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size); + +/** + * Get the index of an option. + * @param obj pointer to drop-down object + * @param option an option as string + * @return index of `option` in the list of all options. -1 if not found. + */ +int32_t lv_dropdown_get_option_index(lv_obj_t * obj, const char * option); + +/** + * Get the symbol on the drop-down list. Typically a down caret or arrow. + * @param obj pointer to drop-down list object + * @return the symbol or NULL if not enabled + */ +const char * lv_dropdown_get_symbol(lv_obj_t * obj); + +/** + * Get whether the selected option in the list should be highlighted or not + * @param obj pointer to drop-down list object + * @return true: highlight enabled; false: disabled + */ +bool lv_dropdown_get_selected_highlight(lv_obj_t * obj); + +/** + * Get the direction of the drop-down list + * @param obj pointer to a drop-down list object + * @return LV_DIR_LEF/RIGHT/TOP/BOTTOM + */ +lv_dir_t lv_dropdown_get_dir(const lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +/** + * Open the drop.down list + * @param dropdown_obj pointer to drop-down list object + */ +void lv_dropdown_open(lv_obj_t * dropdown_obj); + +/** + * Close (Collapse) the drop-down list + * @param obj pointer to drop-down list object + */ +void lv_dropdown_close(lv_obj_t * obj); + +/** + * Tells whether the list is opened or not + * @param obj pointer to a drop-down list object + * @return true if the list os opened + */ +bool lv_dropdown_is_open(lv_obj_t * obj); + + +#if LV_USE_OBSERVER +/** + * Bind an integer Subject to a Dropdown's value. + * @param obj pointer to Dropdown + * @param subject pointer to Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_dropdown_bind_value(lv_obj_t * obj, lv_subject_t * subject); +#endif + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_DROPDOWN*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DROPDOWN_H*/ diff --git a/include/lvgl/widgets/lv_gif.h b/include/lvgl/widgets/lv_gif.h new file mode 100644 index 0000000000..95a44e767a --- /dev/null +++ b/include/lvgl/widgets/lv_gif.h @@ -0,0 +1,138 @@ +/** + * @file lv_gif.h + * + */ + +#ifndef LV_GIF_H +#define LV_GIF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" + +#if LV_USE_GIF + +#include "../draw/lv_color.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_gif_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a gif object + * @param parent pointer to an object, it will be the parent of the new gif. + * @return pointer to the gif obj + */ +lv_obj_t * lv_gif_create(lv_obj_t * parent); + +/** + * Set the color format of the internally allocated framebuffer that the gif + * will be decoded to. The default is LV_COLOR_FORMAT_ARGB8888. + * Call this before `lv_gif_set_src` to avoid reallocating the framebuffer. + * @param obj pointer to a gif object + * @param color_format the color format of the gif framebuffer + */ +void lv_gif_set_color_format(lv_obj_t * obj, lv_color_format_t color_format); + +/** + * Set the gif data to display on the object + * @param obj pointer to a gif object + * @param src 1) pointer to an ::lv_image_dsc_t descriptor (which contains gif raw data) or + * 2) path to a gif file (e.g. "S:/dir/anim.gif") + */ +void lv_gif_set_src(lv_obj_t * obj, const void * src); + +/** + * Restart a gif animation. + * @param obj pointer to a gif obj + */ +void lv_gif_restart(lv_obj_t * obj); + +/** + * Pause a gif animation. + * @param obj pointer to a gif obj + */ +void lv_gif_pause(lv_obj_t * obj); + +/** + * Resume a gif animation. + * @param obj pointer to a gif obj + */ +void lv_gif_resume(lv_obj_t * obj); + +/** + * Checks if the GIF was loaded correctly. + * @param obj pointer to a gif obj + */ +bool lv_gif_is_loaded(lv_obj_t * obj); + +/** + * Get the loop count for the GIF. + * @param obj pointer to a gif obj + */ +int32_t lv_gif_get_loop_count(lv_obj_t * obj); + +/** + * Set the loop count for the GIF. + * @param obj pointer to a gif obj + * @param count the loop count to set + */ +void lv_gif_set_loop_count(lv_obj_t * obj, int32_t count); + +/** + * Set whether to decode invisible object. + * @param obj pointer to a gif object + * @param auto_pause true: auto pause when invisible, false: don't auto pause + */ +void lv_gif_set_auto_pause_invisible(lv_obj_t * obj, bool auto_pause); + +/** + * Get gif width & height + * @param src pointer to a gif file + * @param w pointer to store width + * @param h pointer to store height + * @return true: success; false: failed + */ +bool lv_gif_get_size(const char * src, uint16_t * w, uint16_t * h); + +/** + * Get frame count of the GIF. + * @param obj pointer to a gif object + * @return frame count of the GIF + */ +int32_t lv_gif_get_frame_count(lv_obj_t * obj); + +/** + * Get the current frame index of the GIF. + * @param obj pointer to a gif object + * @return current frame index of the GIF + */ +int32_t lv_gif_get_current_frame_index(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_GIF*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_GIF_H*/ diff --git a/include/lvgl/widgets/lv_gltf.h b/include/lvgl/widgets/lv_gltf.h new file mode 100644 index 0000000000..fca3fa9111 --- /dev/null +++ b/include/lvgl/widgets/lv_gltf.h @@ -0,0 +1,429 @@ +/** + * @file lv_gltf.h + * + */ + +#ifndef LV_GLTF_H +#define LV_GLTF_H + +/********************* + * INCLUDES + *********************/ + +#include "../config/lv_conf_internal.h" + +#if LV_USE_GLTF + +#include "../3d/lv_gltf_model.h" +#include "../3d/lv_3dmath.h" +#include "../lv_types.h" +#include "../core/lv_area.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_GLTF_AA_MODE_OFF = 0, /** Anti aliasing off*/ + LV_GLTF_AA_MODE_ON = 1, /** Anti aliasing on*/ + LV_GLTF_AA_MODE_DYNAMIC = 2, /** Anti aliasing on only when frame has no movement*/ +} lv_gltf_aa_mode_t; + +typedef enum { + LV_GLTF_BG_MODE_SOLID = 0, /** Solid background. Use `lv_obj_set_style_bg_color` to set the background color*/ + LV_GLTF_BG_MODE_ENVIRONMENT = 1, /** Environment background*/ +} lv_gltf_bg_mode_t; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a glTF object + * @param parent pointer to the parent object + * @return pointer to the created glTF object + */ +lv_obj_t * lv_gltf_create(lv_obj_t * parent); + +/** + * Assign an environment to a glTF object for IBL rendering + * @param obj pointer to a glTF viewer object + * @param environment pointer to the environment to use + * @note The environment can be shared across multiple glTF objects + * @note If no environment is set before attempting to load a file, + * a default one will be created for you + */ +void lv_gltf_set_environment(lv_obj_t * obj, lv_gltf_environment_t * environment); + +/** + * Load a glTF model from a file into the viewer + * @param obj pointer to a glTF viewer object + * @param path file path to the glTF model to load + * @return pointer to the loaded glTF model, or NULL on failure + */ +lv_gltf_model_t * lv_gltf_load_model_from_file(lv_obj_t * obj, const char * path); + +/** + * Load a glTF model from a byte array into the viewer + * @param obj pointer to a glTF viewer object + * @param bytes glTF raw data + * @param len glTF raw data length in bytes + * @return pointer to the loaded glTF model, or NULL on failure + */ +lv_gltf_model_t * lv_gltf_load_model_from_bytes(lv_obj_t * obj, const uint8_t * bytes, size_t len); + +/** + * Add a glTF model to the viewer. + * + * Contrary to `lv_gltf_load_model_from_file` and `lv_gltf_load_model_from_bytes`, the model + * is owned by the caller of this function meaning that it's the caller's responsibility + * to delete the model when it is no longer needed, that is, the model must outlive the viewer's lifetime. + * + * @param obj pointer to a glTF viewer object + * @param model glTF model to add to the viewer + * @return LV_RESULT_OK if the model was added to the viewer or LV_RESULT_INVALID on failure + */ +lv_result_t lv_gltf_add_model(lv_obj_t * obj, lv_gltf_model_t * model); + +/** + * Get the number of models loaded in the glTF viewer + * @param obj pointer to a glTF viewer object + * @return the total number of models in the viewer + */ +size_t lv_gltf_get_model_count(lv_obj_t * obj); + +/** + * Get a specific model by its index + * @param obj pointer to a glTF viewer object + * @param id index of the model to retrieve (0-based) + * @return pointer to the model at the specified index, or NULL if index is invalid + */ +lv_gltf_model_t * lv_gltf_get_model_by_index(const lv_obj_t * obj, size_t id); + +/** + * Get the primary model from the glTF viewer + * The primary model is the first model added to the viewer and can be used + * for camera selection and other primary operations + * @param obj pointer to a glTF viewer object + * @return pointer to the primary model, or NULL if no models are loaded + */ +lv_gltf_model_t * lv_gltf_get_primary_model(const lv_obj_t * obj); + +/** + * Set the yaw (horizontal rotation) of the camera + * @param obj pointer to a glTF viewer object + * @param yaw yaw angle in degrees + */ +void lv_gltf_set_yaw(lv_obj_t * obj, float yaw); + +/** + * Get the yaw (horizontal rotation) of the camera + * @param obj pointer to a glTF viewer object + * @return yaw angle in degrees + */ +float lv_gltf_get_yaw(const lv_obj_t * obj); + +/** + * Set the pitch (vertical rotation) of the camera + * @param obj pointer to a glTF viewer object + * @param pitch pitch angle in degrees + */ +void lv_gltf_set_pitch(lv_obj_t * obj, float pitch); + +/** + * Get the pitch (vertical rotation) of the camera + * @param obj pointer to a glTF viewer object + * @return pitch angle in degrees + */ +float lv_gltf_get_pitch(const lv_obj_t * obj); + +/** + * Set the camera distance from the focal point + * @param obj pointer to a glTF viewer object + * @param value distance value + */ +void lv_gltf_set_distance(lv_obj_t * obj, float value); + +/** + * Get the camera distance scale factor from the focal point + * @param obj pointer to a glTF viewer object + * @return distance scaling factor value + */ +float lv_gltf_get_distance(const lv_obj_t * obj); + +/** + * Get the camera distance from the focal point in world units + * @param obj pointer to a GLTF viewer object + * @return world unit distance value + */ +float lv_gltf_get_world_distance(const lv_obj_t * obj); + +/********************** + * Viewport Functions + **********************/ + +/** + * Set the field of view + * @param obj pointer to a glTF viewer object + * @param value vertical FOV in degrees. If zero, the view will be orthographic (non-perspective) + */ +void lv_gltf_set_fov(lv_obj_t * obj, float value); + +/** + * Get the field of view + * @param obj pointer to a glTF viewer object + * @return vertical FOV in degrees + */ +float lv_gltf_get_fov(const lv_obj_t * obj); + +/********************** + * Focal Point Functions + **********************/ + +/** + * Set the X coordinate of the camera focal point + * @param obj pointer to a glTF viewer object + * @param value X coordinate + */ +void lv_gltf_set_focal_x(lv_obj_t * obj, float value); + +/** + * Get the X coordinate of the camera focal point + * @param obj pointer to a glTF viewer object + * @return X coordinate + */ +float lv_gltf_get_focal_x(const lv_obj_t * obj); + +/** + * Set the Y coordinate of the camera focal point + * @param obj pointer to a glTF viewer object + * @param value Y coordinate + */ +void lv_gltf_set_focal_y(lv_obj_t * obj, float value); + +/** + * Get the Y coordinate of the camera focal point + * @param obj pointer to a glTF viewer object + * @return Y coordinate + */ +float lv_gltf_get_focal_y(const lv_obj_t * obj); + +/** + * Set the Z coordinate of the camera focal point + * @param obj pointer to a glTF viewer object + * @param value Z coordinate + */ +void lv_gltf_set_focal_z(lv_obj_t * obj, float value); + +/** + * Get the Z coordinate of the camera focal point + * @param obj pointer to a glTF viewer object + * @return Z coordinate + */ +float lv_gltf_get_focal_z(const lv_obj_t * obj); + +/** + * Set the focal coordinates to the center point of the model object + * @param obj pointer to a glTF viewer object + * @param model a model attached to this viewer or NULL for the first model + */ +void lv_gltf_recenter(lv_obj_t * obj, lv_gltf_model_t * model); + +/********************** + * Scene Control Functions + **********************/ + +/** + * Set the active camera index + * The camera is selected from the first glTF model added to the viewer + * + * @param obj pointer to a glTF viewer object + * @param value camera index (0 for default camera, 1+ for scene camera index) + * @note Values higher than the scene's camera count will be clamped to the maximum available camera index + */ +void lv_gltf_set_camera(lv_obj_t * obj, uint32_t value); + +/** + * Get the active camera index + * @param obj pointer to a glTF viewer object + * @return active camera index + */ +uint32_t lv_gltf_get_camera(const lv_obj_t * obj); + +/** + * Get the number of cameras in the first glTF model added to the viewer + * This count represents the valid range for the camera index parameter + * used with lv_gltf_set_camera() + * + * To get the camera count of other models, call + * lv_gltf_model_get_camera_count(model) directly with the specific model + * + * @param obj pointer to a glTF viewer object + * @return number of available cameras + */ +uint32_t lv_gltf_get_camera_count(const lv_obj_t * obj); + +/** + * DEPRECATED. See `lv_gltf_model_set_animation_speed` + * + * Set the animation speed ratio + * + * The actual ratio is the value parameter / LV_GLTF_ANIM_SPEED_NORMAL + * Values greater than LV_GLTF_ANIM_SPEED_NORMAL will speed-up the animation + * Values less than LV_GLTF_ANIM_SPEED_NORMAL will slow down the animation + * + * @param obj pointer to a glTF viewer object + * @param value speed-up ratio of the animation + */ +void lv_gltf_set_animation_speed(lv_obj_t * obj, uint32_t value); + +/** + * DEPRECATED. See `lv_gltf_model_get_animation_speed` + * + * Get the animation speed ratio + * + * The actual ratio is the return value / LV_GLTF_ANIM_SPEED_NORMAL + * + * @param obj pointer to a glTF viewer object + */ +uint32_t lv_gltf_get_animation_speed(const lv_obj_t * obj); + +/********************** + * Visual Settings Functions + **********************/ + +/** + * Set the background mode + * @param obj pointer to a glTF viewer object + * @param value background mode + */ +void lv_gltf_set_background_mode(lv_obj_t * obj, lv_gltf_bg_mode_t value); + +/** + * Get the background mode + * @param obj pointer to a glTF viewer object + * @return background mode + */ +lv_gltf_bg_mode_t lv_gltf_get_background_mode(const lv_obj_t * obj); + +/** + * Set the background blur amount + * @param obj pointer to a glTF viewer object + * @param value blur amount between 0 and 100 + */ +void lv_gltf_set_background_blur(lv_obj_t * obj, uint32_t value); + +/** + * Get the background blur amount + * @param obj pointer to a glTF viewer object + * @return blur amount between 0 and 100 + */ +uint32_t lv_gltf_get_background_blur(const lv_obj_t * obj); + +/** + * Set the environmental brightness/power + * @param obj pointer to a glTF viewer object + * @param value brightness multiplier + */ +void lv_gltf_set_env_brightness(lv_obj_t * obj, uint32_t value); + +/** + * Get the environmental brightness/power + * @param obj pointer to a glTF viewer object + * @return brightness multiplier + */ +uint32_t lv_gltf_get_env_brightness(const lv_obj_t * obj); + +/** + * Set the image exposure level + * @param obj pointer to a glTF viewer object + * @param value exposure level (1.0 is default) + */ +void lv_gltf_set_image_exposure(lv_obj_t * obj, float value); + +/** + * Get the image exposure level + * @param obj pointer to a glTF viewer object + * @return exposure level + */ +float lv_gltf_get_image_exposure(const lv_obj_t * obj); + +/********************** + * Rendering Functions + **********************/ + +/** + * Set the anti-aliasing mode + * @param obj pointer to a glTF viewer object + * @param value anti-aliasing mode + */ +void lv_gltf_set_antialiasing_mode(lv_obj_t * obj, lv_gltf_aa_mode_t value); + +/** + * Get the anti-aliasing mode + * @param obj pointer to a glTF viewer object + * @return anti-aliasing mode + */ +lv_gltf_aa_mode_t lv_gltf_get_antialiasing_mode(const lv_obj_t * obj); + +/*********************** + * Raycasting Functions + ***********************/ + +/** + * Get the point that a given ray intersects with a specified plane at, if any + * @param ray the intersection test ray + * @param screen_y the plane to test ray intersection with + * @param collision_point output lv_3dpoint_t holder, values are only valid if true is the return value + * @return LV_RESULT_OK if intersection, LV_RESULT_INVALID if no intersection + */ +lv_result_t lv_intersect_ray_with_plane(const lv_3dray_t * ray, const lv_3dplane_t * plane, + lv_3dpoint_t * collision_point); + +/** + * Get a plane that faces the current view camera, centered some units in front of it + * @param obj pointer to a GLTF viewer object + * @param distance distance in front of the camera to set the plane, in world units. see lv_gltf_get_world_distance to get the auto-distance + * @return camera facing plane + */ +lv_3dplane_t lv_gltf_get_current_view_plane(lv_obj_t * obj, float distance); + +/** + * Calculates a ray originating from the camera and passing through the specified mouse position on the screen. + * @param obj pointer to a GLTF viewer object + * @param screen_pos screen coordinate, in pixels + * @return mouse point ray + */ +lv_3dray_t lv_gltf_get_ray_from_2d_coordinate(lv_obj_t * obj, const lv_point_t * screen_pos); + + +/** + * Get the screen position of a 3d point + * @param obj pointer to a GLTF viewer object + * @param world_pos world position to convert + * @param lv_point_t the resulting point, in pixels. only valid if return value is true + * @return LV_RESULT_OK if conversion valid, LV_RESULT_INVALID if no valid conversion + */ +lv_result_t lv_gltf_world_to_screen(lv_obj_t * obj, const lv_3dpoint_t world_pos, lv_point_t * screen_pos); + + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} +#endif + +#endif /*LV_USE_GLTF*/ + +#endif /*LV_GLTF_H*/ diff --git a/include/lvgl/widgets/lv_gstreamer.h b/include/lvgl/widgets/lv_gstreamer.h new file mode 100644 index 0000000000..a53465e24a --- /dev/null +++ b/include/lvgl/widgets/lv_gstreamer.h @@ -0,0 +1,202 @@ +/** + * @file lv_gstreamer.h + * + */ + +#ifndef LV_GSTREAMER_H +#define LV_GSTREAMER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_GSTREAMER +#include "../core/lv_obj.h" + + +/********************* + * DEFINES + *********************/ + + +/* Using the `URI` "factory", we can specify various URI schemes as media sources including + * - local files (file://) + * - web streams (http://, https://) + * - RTSP streams (rtsp://) + * - UDP streams (udp://) + * and many others. + * GStreamer's uridecodebin automatically selects the appropriate + * source element and decoder based on the URI scheme and media format. */ +#define LV_GSTREAMER_FACTORY_URI_DECODE "uridecodebin" +#define LV_GSTREAMER_PROPERTY_URI_DECODE "uri" + +#define LV_GSTREAMER_FACTORY_FILE "filesrc" +#define LV_GSTREAMER_PROPERTY_FILE "location" + +#define LV_GSTREAMER_FACTORY_HTTP "souphttpsrc" +#define LV_GSTREAMER_PROPERTY_HTTP "location" + +#define LV_GSTREAMER_FACTORY_HTTPS "souphttpsrc" +#define LV_GSTREAMER_PROPERTY_HTTPS "location" + +#define LV_GSTREAMER_FACTORY_V4L2_CAMERA "v4l2src" +#define LV_GSTREAMER_PROPERTY_V4L2_CAMERA "device" + +#define LV_GSTREAMER_FACTORY_ALSA_AUDIO "alsasrc" +#define LV_GSTREAMER_PROPERTY_ALSA_AUDIO "device" + +#define LV_GSTREAMER_FACTORY_PULSE_AUDIO "pulsesrc" +#define LV_GSTREAMER_PROPERTY_PULSE_AUDIO "device" + +#define LV_GSTREAMER_FACTORY_TEST_AUDIO "audiotestsrc" +#define LV_GSTREAMER_PROPERTY_TEST_AUDIO NULL + +#define LV_GSTREAMER_FACTORY_TEST_VIDEO "videotestsrc" +#define LV_GSTREAMER_PROPERTY_TEST_VIDEO NULL + +#define LV_GSTREAMER_FACTORY_APP "appsrc" +#define LV_GSTREAMER_PROPERTY_APP NULL + +#define LV_GSTREAMER_FACTORY_WEBRTCSRC "webrtcsrc" +#define LV_GSTREAMER_PROPERTY_WEBRTCSRC "signaller::uri" + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_GSTREAMER_STATE_NULL, + LV_GSTREAMER_STATE_READY, + LV_GSTREAMER_STATE_PAUSED, + LV_GSTREAMER_STATE_PLAYING +} lv_gstreamer_state_t; + +typedef enum { + LV_GSTREAMER_STREAM_STATE_START, + LV_GSTREAMER_STREAM_STATE_PLAY, + LV_GSTREAMER_STREAM_STATE_PAUSE, + LV_GSTREAMER_STREAM_STATE_STOP, + LV_GSTREAMER_STREAM_STATE_END +} lv_gstreamer_stream_state_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a gstreamer object + * @param parent pointer to an object, it will be the parent of the new gstreamer + * @return pointer to the created gstreamer + */ +lv_obj_t * lv_gstreamer_create(lv_obj_t * parent); + +/** + * Add a source to this gstreamer object + * @param gstreamer pointer to a gstreamer object + * @param factory_name the factory name for the source of this gstreamer object. + * for common factory names, check `LV_GSTREAMER_FACTORY_XXX` defines + * @param property the property name for the gstreamer source object + * for common properties, see `LV_GSTREAMER_PROPERTY_XXX` defines + * Passing NULL will create the source object but not set its source + * @param source the property value for the gstreamer source object + * Passing NULL will create the source object but not set its source + * @return LV_RESULT_OK if the source was correctly set else LV_RESULT_INVALID + */ +lv_result_t lv_gstreamer_set_src(lv_obj_t * gstreamer, const char * factory_name, const char * property, + const char * source); + +/** + * Play this gstreamer + * @param gstreamer pointer to a gstreamer object + */ +void lv_gstreamer_play(lv_obj_t * gstreamer); + +/** + * Pause this gstreamer + * @param gstreamer pointer to a gstreamer object + */ +void lv_gstreamer_pause(lv_obj_t * gstreamer); + +/** + * Stop this gstreamer + * @param gstreamer pointer to a gstreamer object + */ +void lv_gstreamer_stop(lv_obj_t * gstreamer); + +/** + * Seek a position in this gstreamer + * @param gstreamer pointer to a gstreamer object + * @param position position to seek to + */ +void lv_gstreamer_set_position(lv_obj_t * gstreamer, uint32_t position); + +/** + * Get the duration of this gstreamer + * @param gstreamer pointer to a gstreamer object + * @return the duration (in ms) of the gstreamer object + */ +uint32_t lv_gstreamer_get_duration(lv_obj_t * gstreamer); + +/** + * Get the position of this gstreamer + * @param gstreamer pointer to a gstreamer object + * @return the position (in ms) of the gstreamer object + */ +uint32_t lv_gstreamer_get_position(lv_obj_t * gstreamer); + +/** + * Get the state of this gstreamer + * @param gstreamer pointer to a gstreamer object + */ +lv_gstreamer_state_t lv_gstreamer_get_state(lv_obj_t * gstreamer); + +/** + * Set the volume of this gstreamer + * @param gstreamer pointer to a gstreamer object + * @param volume the value to set in the range [0..100]. Higher values are clamped + */ +void lv_gstreamer_set_volume(lv_obj_t * gstreamer, uint8_t volume); + +/** + * Get the volume of this gstreamer + * @param gstreamer pointer to a gstreamer object + * @return the volume for this gstreamer + */ +uint8_t lv_gstreamer_get_volume(lv_obj_t * gstreamer); + +/** + * Set the speed rate of this gstreamer + * @param gstreamer pointer to a gstreamer object + * @param rate the rate factor. Example values: + * - 256: 1x + * - <256: slow down + * - >256: speed up + * - 128: 0.5x + * - 512: 2x + */ +void lv_gstreamer_set_rate(lv_obj_t * gstreamer, uint32_t rate); + +/** + * Retrieve the stream state from a STATE_CHANGED event callback + * @param e pointer to the event + * @return the stream state or -1 if `e` is invalid (i.e. NULL or does not match expected event) + */ +lv_gstreamer_stream_state_t lv_gstreamer_get_stream_state(lv_event_t * e); + + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_GSTREAMER*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_GSTREAMER_H*/ diff --git a/include/lvgl/widgets/lv_image.h b/include/lvgl/widgets/lv_image.h new file mode 100644 index 0000000000..57c3a95ca9 --- /dev/null +++ b/include/lvgl/widgets/lv_image.h @@ -0,0 +1,366 @@ +/** + * @file lv_image.h + * + */ + +#ifndef LV_IMAGE_H +#define LV_IMAGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_IMAGE != 0 + +/*Testing of dependencies*/ +#if LV_USE_LABEL == 0 +#error "lv_img: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" +#endif + +#include "../core/lv_obj.h" +#include "../fs/lv_fs.h" +#include "../draw/lv_draw.h" +#include "../core/lv_observer.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_image_class; + +/** + * Image size mode, when image size and object size is different + */ +typedef enum { + LV_IMAGE_ALIGN_DEFAULT = 0, + LV_IMAGE_ALIGN_TOP_LEFT, + LV_IMAGE_ALIGN_TOP_MID, + LV_IMAGE_ALIGN_TOP_RIGHT, + LV_IMAGE_ALIGN_BOTTOM_LEFT, + LV_IMAGE_ALIGN_BOTTOM_MID, + LV_IMAGE_ALIGN_BOTTOM_RIGHT, + LV_IMAGE_ALIGN_LEFT_MID, + LV_IMAGE_ALIGN_RIGHT_MID, + LV_IMAGE_ALIGN_CENTER, + _LV_IMAGE_ALIGN_AUTO_TRANSFORM, /**< Marks the start of modes that transform the image*/ + LV_IMAGE_ALIGN_STRETCH, /**< Set X and Y scale to fill the Widget's area. */ + LV_IMAGE_ALIGN_TILE, /**< Tile image to fill Widget's area. Offset is applied to shift the tiling. */ + LV_IMAGE_ALIGN_CONTAIN, /**< The image keeps its aspect ratio, but is resized to the maximum size that fits within the Widget's area. */ + LV_IMAGE_ALIGN_COVER, /**< The image keeps its aspect ratio and fills the Widget's area. */ +} lv_image_align_t; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_image_id_t { + LV_PROPERTY_ID(IMAGE, SRC, LV_PROPERTY_TYPE_IMGSRC, 0), + LV_PROPERTY_ID(IMAGE, OFFSET_X, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(IMAGE, OFFSET_Y, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(IMAGE, ROTATION, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_ID(IMAGE, PIVOT, LV_PROPERTY_TYPE_POINT, 4), + LV_PROPERTY_ID(IMAGE, SCALE, LV_PROPERTY_TYPE_INT, 5), + LV_PROPERTY_ID(IMAGE, SCALE_X, LV_PROPERTY_TYPE_INT, 6), + LV_PROPERTY_ID(IMAGE, SCALE_Y, LV_PROPERTY_TYPE_INT, 7), + LV_PROPERTY_ID(IMAGE, BLEND_MODE, LV_PROPERTY_TYPE_INT, 8), + LV_PROPERTY_ID(IMAGE, ANTIALIAS, LV_PROPERTY_TYPE_INT, 9), + LV_PROPERTY_ID(IMAGE, INNER_ALIGN, LV_PROPERTY_TYPE_INT, 10), + LV_PROPERTY_IMAGE_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an image object + * @param parent pointer to an object, it will be the parent of the new image + * @return pointer to the created image + */ +lv_obj_t * lv_image_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the image data to display on the object + * @param obj pointer to an image object + * @param src 1) pointer to an ::lv_image_dsc_t descriptor (converted by LVGL's image converter) (e.g. &my_img) or + * 2) path to an image file (e.g. "S:/dir/img.bin")or + * 3) a SYMBOL (e.g. LV_SYMBOL_OK) + */ +void lv_image_set_src(lv_obj_t * obj, const void * src); + +/** + * Set an offset for the source of an image so the image will be displayed from the new origin. + * @param obj pointer to an image + * @param x the new offset along x axis. + */ +void lv_image_set_offset_x(lv_obj_t * obj, int32_t x); + +/** + * Set an offset for the source of an image. + * so the image will be displayed from the new origin. + * @param obj pointer to an image + * @param y the new offset along y axis. + */ +void lv_image_set_offset_y(lv_obj_t * obj, int32_t y); + +/** + * Set the rotation angle of the image. + * The image will be rotated around the set pivot set by `lv_image_set_pivot()` + * Note that indexed and alpha only images can't be transformed. + * @param obj pointer to an image object + * @param angle rotation in degree with 0.1 degree resolution (0..3600: clock wise) + * @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT` + * rotation will be set to 0 automatically. + * + */ +void lv_image_set_rotation(lv_obj_t * obj, int32_t angle); + +/** + * Set the rotation center of the image. + * The image will be rotated around this point. + * x, y can be set with value of LV_PCT, lv_image_get_pivot will return the true pixel coordinate of pivot in this case. + * @param obj pointer to an image object + * @param x rotation center x of the image + * @param y rotation center y of the image + */ +void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y); + +/** + * Set the rotation horizontal center of the image. + * @param obj pointer to an image object + * @param x rotation center x of the image, or lv_pct() + */ +void lv_image_set_pivot_x(lv_obj_t * obj, int32_t x); + +/** + * Set the rotation vertical center of the image. + * @param obj pointer to an image object + * @param y rotation center y of the image, or lv_pct() + */ +void lv_image_set_pivot_y(lv_obj_t * obj, int32_t y); + +/** + * Set the zoom factor of the image. + * Note that indexed and alpha only images can't be transformed. + * @param obj pointer to an image object + * @param zoom the zoom factor. Example values: + * - 256 or LV_SCALE_NONE: no zoom + * - <256: scale down + * - >256: scale up + * - 128: half size + * - 512: double size + */ +void lv_image_set_scale(lv_obj_t * obj, uint32_t zoom); + +/** + * Set the horizontal zoom factor of the image. + * Note that indexed and alpha only images can't be transformed. + * @param obj pointer to an image object + * @param zoom the zoom factor. Example values: + * - 256 or LV_SCALE_NONE: no zoom + * - <256: scale down + * - >256: scale up + * - 128: half size + * - 512: double size + */ +void lv_image_set_scale_x(lv_obj_t * obj, uint32_t zoom); + +/** + * Set the vertical zoom factor of the image. + * Note that indexed and alpha only images can't be transformed. + * @param obj pointer to an image object + * @param zoom the zoom factor. Example values: + * - 256 or LV_SCALE_NONE: no zoom + * - <256: scale down + * - >256: scale up + * - 128: half size + * - 512: double size + */ +void lv_image_set_scale_y(lv_obj_t * obj, uint32_t zoom); + +/** + * Set the blend mode of an image. + * @param obj pointer to an image object + * @param blend_mode the new blend mode + */ +void lv_image_set_blend_mode(lv_obj_t * obj, lv_blend_mode_t blend_mode); + +/** + * Enable/disable anti-aliasing for the transformations (rotate, zoom) or not. + * The quality is better with anti-aliasing looks better but slower. + * @param obj pointer to an image object + * @param antialias true: anti-aliased; false: not anti-aliased + */ +void lv_image_set_antialias(lv_obj_t * obj, bool antialias); + +/** + * Set the image object size mode. + * @param obj pointer to an image object + * @param align the new align mode. + * @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT` + * rotation, scale and pivot will be overwritten and controlled internally. + */ +void lv_image_set_inner_align(lv_obj_t * obj, lv_image_align_t align); + +/** + * Set an A8 bitmap mask for the image. + * @param obj pointer to an image object + * @param src an lv_image_dsc_t bitmap mask source. + */ +void lv_image_set_bitmap_map_src(lv_obj_t * obj, const lv_image_dsc_t * src); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the source of the image + * @param obj pointer to an image object + * @return the image source (symbol, file name or ::lv-img_dsc_t for C arrays) + */ +const void * lv_image_get_src(lv_obj_t * obj); + +/** + * Get the offset's x attribute of the image object. + * @param obj pointer to an image + * @return offset X value. + */ +int32_t lv_image_get_offset_x(lv_obj_t * obj); + +/** + * Get the offset's y attribute of the image object. + * @param obj pointer to an image + * @return offset Y value. + */ +int32_t lv_image_get_offset_y(lv_obj_t * obj); + +/** + * Get the rotation of the image. + * @param obj pointer to an image object + * @return rotation in 0.1 degrees (0..3600) + * @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT` + * rotation will be set to 0 automatically. + */ +int32_t lv_image_get_rotation(lv_obj_t * obj); + +/** + * Get the pivot (rotation center) of the image. + * If pivot is set with LV_PCT, convert it to px before return. + * @param obj pointer to an image object + * @param pivot store the rotation center here + */ +void lv_image_get_pivot(lv_obj_t * obj, lv_point_t * pivot); + +/** + * Get the zoom factor of the image. + * @param obj pointer to an image object + * @return zoom factor (256: no zoom) + */ +int32_t lv_image_get_scale(lv_obj_t * obj); + +/** + * Get the horizontal zoom factor of the image. + * @param obj pointer to an image object + * @return zoom factor (256: no zoom) + */ +int32_t lv_image_get_scale_x(lv_obj_t * obj); + +/** + * Get the vertical zoom factor of the image. + * @param obj pointer to an image object + * @return zoom factor (256: no zoom) + */ +int32_t lv_image_get_scale_y(lv_obj_t * obj); + +/** + * Get the width of an image before any transformations. + * @param obj Pointer to an image object. + * @return The width of the image. + */ +int32_t lv_image_get_src_width(lv_obj_t * obj); + +/** + * Get the height of an image before any transformations. + * @param obj Pointer to an image object. + * @return The height of the image. + */ +int32_t lv_image_get_src_height(lv_obj_t * obj); + +/** + * Get the transformed width of an image object. + * @param obj Pointer to an image object. + * @return The transformed width of the image. + */ +int32_t lv_image_get_transformed_width(lv_obj_t * obj); + +/** + * Get the transformed height of an image object. + * @param obj Pointer to an image object. + * @return The transformed height of the image. + */ +int32_t lv_image_get_transformed_height(lv_obj_t * obj); + +/** + * Get the current blend mode of the image + * @param obj pointer to an image object + * @return the current blend mode + */ +lv_blend_mode_t lv_image_get_blend_mode(lv_obj_t * obj); + +/** + * Get whether the transformations (rotate, zoom) are anti-aliased or not + * @param obj pointer to an image object + * @return true: anti-aliased; false: not anti-aliased + */ +bool lv_image_get_antialias(lv_obj_t * obj); + +/** + * Get the size mode of the image + * @param obj pointer to an image object + * @return element of `lv_image_align_t` + */ +lv_image_align_t lv_image_get_inner_align(lv_obj_t * obj); + +/** + * Get the bitmap mask source. + * @param obj pointer to an image object + * @return an lv_image_dsc_t bitmap mask source. + */ +const lv_image_dsc_t * lv_image_get_bitmap_map_src(lv_obj_t * obj); + + +#if LV_USE_OBSERVER +/** + * Bind a pointer Subject to an Image's source. + * @param obj pointer to Image + * @param subject pointer to Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_image_bind_src(lv_obj_t * obj, lv_subject_t * subject); +#endif + +/********************** + * MACROS + **********************/ + +/** Use this macro to declare an image in a C file*/ +#define LV_IMAGE_DECLARE(var_name) extern const lv_image_dsc_t var_name + +#endif /*LV_USE_IMAGE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_IMAGE_H*/ diff --git a/include/lvgl/widgets/lv_imagebutton.h b/include/lvgl/widgets/lv_imagebutton.h new file mode 100644 index 0000000000..a8221057e9 --- /dev/null +++ b/include/lvgl/widgets/lv_imagebutton.h @@ -0,0 +1,148 @@ +/** + * @file lv_imagebutton.h + * + */ + +#ifndef LV_IMAGEBUTTON_H +#define LV_IMAGEBUTTON_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +#if LV_USE_IMAGEBUTTON != 0 + +/********************* + * DEFINES + *********************/ +typedef enum { + LV_IMAGEBUTTON_STATE_RELEASED, + LV_IMAGEBUTTON_STATE_PRESSED, + LV_IMAGEBUTTON_STATE_DISABLED, + LV_IMAGEBUTTON_STATE_CHECKED_RELEASED, + LV_IMAGEBUTTON_STATE_CHECKED_PRESSED, + LV_IMAGEBUTTON_STATE_CHECKED_DISABLED, + LV_IMAGEBUTTON_STATE_NUM, +} lv_imagebutton_state_t; + +/********************** + * TYPEDEFS + **********************/ +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_imagebutton_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an image button object + * @param parent pointer to an object, it will be the parent of the new image button + * @return pointer to the created image button + */ +lv_obj_t * lv_imagebutton_create(lv_obj_t * parent); + +/*====================== + * Add/remove functions + *=====================*/ + +/*===================== + * Setter functions + *====================*/ + +/** + * Set images for a state of the image button + * @param obj pointer to an image button object + * @param state for which state set the new image + * @param src_left pointer to an image source for the left side of the button (a C array or path to + * a file) + * @param src_mid pointer to an image source for the middle of the button (ideally 1px wide) (a C + * array or path to a file) + * @param src_right pointer to an image source for the right side of the button (a C array or path + * to a file) + */ +void lv_imagebutton_set_src(lv_obj_t * obj, lv_imagebutton_state_t state, const void * src_left, + const void * src_mid, + const void * src_right); + +/** + * Set the left image for a state of the image button + * @param obj pointer to an image button object + * @param state for which state set the new image + * @param src_left pointer to an image source for the left side of the button + * (a C array or path to a file) + */ +void lv_imagebutton_set_src_left(lv_obj_t * obj, lv_imagebutton_state_t state, const void * src_left); + +/** + * Set the right image for a state of the image button + * @param obj pointer to an image button object + * @param state for which state set the new image + * @param src_right pointer to an image source for the right side of the button + * (a C array or path to a file) + */ +void lv_imagebutton_set_src_right(lv_obj_t * obj, lv_imagebutton_state_t state, const void * src_right); + +/** + * Set the middle image for a state of the image button + * @param obj pointer to an image button object + * @param state for which state set the new image + * @param src_mid pointer to an image source for the middle of the button + * (a C array or path to a file) + */ +void lv_imagebutton_set_src_mid(lv_obj_t * obj, lv_imagebutton_state_t state, const void * src_mid); + +/** + * Use this function instead of `lv_obj_add/remove_state` to set a state manually + * @param obj pointer to an image button object + * @param state the new state + */ +void lv_imagebutton_set_state(lv_obj_t * obj, lv_imagebutton_state_t state); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the left image in a given state + * @param obj pointer to an image button object + * @param state the state where to get the image (from `lv_button_state_t`) ` + * @return pointer to the left image source (a C array or path to a file) + */ +const void * lv_imagebutton_get_src_left(lv_obj_t * obj, lv_imagebutton_state_t state); + +/** + * Get the middle image in a given state + * @param obj pointer to an image button object + * @param state the state where to get the image (from `lv_button_state_t`) ` + * @return pointer to the middle image source (a C array or path to a file) + */ +const void * lv_imagebutton_get_src_middle(lv_obj_t * obj, lv_imagebutton_state_t state); + +/** + * Get the right image in a given state + * @param obj pointer to an image button object + * @param state the state where to get the image (from `lv_button_state_t`) ` + * @return pointer to the left image source (a C array or path to a file) + */ +const void * lv_imagebutton_get_src_right(lv_obj_t * obj, lv_imagebutton_state_t state); + +/*===================== + * Other functions + *====================*/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_IMAGEBUTTON*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_IMAGEBUTTON_H*/ diff --git a/include/lvgl/widgets/lv_ime_pinyin.h b/include/lvgl/widgets/lv_ime_pinyin.h new file mode 100644 index 0000000000..a8a6bc7f14 --- /dev/null +++ b/include/lvgl/widgets/lv_ime_pinyin.h @@ -0,0 +1,121 @@ +/** + * @file lv_ime_pinyin.h + * + */ +#ifndef LV_IME_PINYIN_H +#define LV_IME_PINYIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../core/lv_obj.h" + +#if LV_USE_IME_PINYIN != 0 + +/********************* + * DEFINES + *********************/ +#define LV_IME_PINYIN_K9_MAX_INPUT 7 + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_IME_PINYIN_MODE_K26, + LV_IME_PINYIN_MODE_K9, + LV_IME_PINYIN_MODE_K9_NUMBER, +} lv_ime_pinyin_mode_t; + +/*Data of pinyin_dict*/ +typedef struct { + const char * const py; + const char * const py_mb; +} lv_pinyin_dict_t; + +/*Data of 9-key input(k9) mode*/ +typedef struct { + char py_str[7]; +} ime_pinyin_k9_py_str_t; + +/*********************** + * GLOBAL VARIABLES + ***********************/ + +extern const lv_obj_class_t lv_ime_pinyin_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ +lv_obj_t * lv_ime_pinyin_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the keyboard of Pinyin input method. + * @param obj pointer to a Pinyin input method object + * @param kb pointer to a Pinyin input method keyboard + */ +void lv_ime_pinyin_set_keyboard(lv_obj_t * obj, lv_obj_t * kb); + +/** + * Set the dictionary of Pinyin input method. + * @param obj pointer to a Pinyin input method object + * @param dict pointer to a Pinyin input method dictionary + */ +void lv_ime_pinyin_set_dict(lv_obj_t * obj, lv_pinyin_dict_t * dict); + +/** + * Set mode, 26-key input(k26) or 9-key input(k9). + * @param obj pointer to a Pinyin input method object + * @param mode the mode from 'lv_ime_pinyin_mode_t' + */ +void lv_ime_pinyin_set_mode(lv_obj_t * obj, lv_ime_pinyin_mode_t mode); + +/*===================== + * Getter functions + *====================*/ + +/** + * Set the dictionary of Pinyin input method. + * @param obj pointer to a Pinyin IME object + * @return pointer to the Pinyin IME keyboard + */ +lv_obj_t * lv_ime_pinyin_get_kb(lv_obj_t * obj); + +/** + * Set the dictionary of Pinyin input method. + * @param obj pointer to a Pinyin input method object + * @return pointer to the Pinyin input method candidate panel + */ +lv_obj_t * lv_ime_pinyin_get_cand_panel(lv_obj_t * obj); + +/** + * Set the dictionary of Pinyin input method. + * @param obj pointer to a Pinyin input method object + * @return pointer to the Pinyin input method dictionary + */ +const lv_pinyin_dict_t * lv_ime_pinyin_get_dict(lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_IME_PINYIN*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_IME_PINYIN_H*/ diff --git a/include/lvgl/widgets/lv_keyboard.h b/include/lvgl/widgets/lv_keyboard.h new file mode 100644 index 0000000000..5346eccd9f --- /dev/null +++ b/include/lvgl/widgets/lv_keyboard.h @@ -0,0 +1,175 @@ +/** + * @file lv_keyboard.h + * + */ + +#ifndef LV_KEYBOARD_H +#define LV_KEYBOARD_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_buttonmatrix.h" + +#if LV_USE_KEYBOARD + +/********************* + * DEFINES + *********************/ +#define LV_KEYBOARD_CTRL_BUTTON_FLAGS (LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CLICK_TRIG | LV_BUTTONMATRIX_CTRL_CHECKED) + +/********************** + * TYPEDEFS + **********************/ + +/** Current keyboard mode.*/ +typedef enum { + LV_KEYBOARD_MODE_TEXT_LOWER, + LV_KEYBOARD_MODE_TEXT_UPPER, + LV_KEYBOARD_MODE_SPECIAL, + LV_KEYBOARD_MODE_NUMBER, + LV_KEYBOARD_MODE_USER_1, + LV_KEYBOARD_MODE_USER_2, + LV_KEYBOARD_MODE_USER_3, + LV_KEYBOARD_MODE_USER_4, +#if LV_USE_ARABIC_PERSIAN_CHARS == 1 + LV_KEYBOARD_MODE_TEXT_ARABIC +#endif +} lv_keyboard_mode_t; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_keyboard_id_t { + LV_PROPERTY_ID(KEYBOARD, TEXTAREA, LV_PROPERTY_TYPE_OBJ, 0), + LV_PROPERTY_ID(KEYBOARD, MODE, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(KEYBOARD, POPOVERS, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(KEYBOARD, SELECTED_BUTTON, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_KEYBOARD_END, +}; +#endif + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_keyboard_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a Keyboard object + * @param parent pointer to an object, it will be the parent of the new keyboard + * @return pointer to the created keyboard object + */ +lv_obj_t * lv_keyboard_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Assign a text area to the keyboard. Pressed characters will be inserted there. + * @param kb pointer to a keyboard object + * @param ta pointer to a text area object to write into + */ +void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta); + +/** + * Set a new mode (e.g., text, number, special characters). + * @param kb pointer to a keyboard object + * @param mode the desired mode (see 'lv_keyboard_mode_t') + */ +void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode); + +/** + * Enable or disable popovers showing button titles on press. + * @param kb pointer to a keyboard object + * @param en true to enable popovers; false to disable + */ +void lv_keyboard_set_popovers(lv_obj_t * kb, bool en); + +/** + * Set a custom button map for the keyboard. + * @param kb pointer to a keyboard object + * @param mode the mode to assign the new map to (see 'lv_keyboard_mode_t') + * @param map pointer to a string array describing the button map + * see 'lv_buttonmatrix_set_map()' for more details + * @param ctrl_map pointer to the control map. See 'lv_buttonmatrix_set_ctrl_map()' + + */ +void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * const map[], + const lv_buttonmatrix_ctrl_t ctrl_map[]); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the text area currently assigned to the keyboard. + * @param kb pointer to a keyboard object + * @return pointer to the assigned text area object + */ +lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb); + +/** + * Get the current mode of the keyboard. + * @param kb pointer to a keyboard object + * @return the current mode (see 'lv_keyboard_mode_t') + */ +lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb); + +/** + * Check whether popovers are enabled on the keyboard. + * @param obj pointer to a keyboard object + * @return true if popovers are enabled; false otherwise + */ +bool lv_keyboard_get_popovers(const lv_obj_t * obj); + +/** + * Get the current button map of the keyboard. + * @param kb pointer to a keyboard object + * @return pointer to the map array + */ +const char * const * lv_keyboard_get_map_array(const lv_obj_t * kb); + +/** + * Get the index of the last selected button (pressed, released, focused, etc.). + * Useful in the `event_cb` to retrieve button text or properties. + * @param obj pointer to a keyboard object + * @return index of the last interacted button + * returns LV_BUTTONMATRIX_BUTTON_NONE if not set + */ +uint32_t lv_keyboard_get_selected_button(const lv_obj_t * obj); + +/** + * Get the text of a button by index. + * @param obj pointer to a keyboard object + * @param btn_id index of the button (excluding newline characters) + * @return pointer to the text of the button + */ +const char * lv_keyboard_get_button_text(const lv_obj_t * obj, uint32_t btn_id); + +/*===================== + * Other functions + *====================*/ + +/** + * Default keyboard event callback to handle button presses. + * Adds characters to the text area and switches map if needed. + * If a custom `event_cb` is used, this function can be called within it. + * @param e the triggering event + */ +void lv_keyboard_def_event_cb(lv_event_t * e); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_KEYBOARD*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_KEYBOARD_H*/ diff --git a/include/lvgl/widgets/lv_label.h b/include/lvgl/widgets/lv_label.h new file mode 100644 index 0000000000..33035ec132 --- /dev/null +++ b/include/lvgl/widgets/lv_label.h @@ -0,0 +1,289 @@ +/** + * @file lv_label.h + * + */ + +#ifndef LV_LABEL_H +#define LV_LABEL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_LABEL != 0 + +#include "../lv_types.h" +#include "../core/lv_obj.h" +#include "../font/lv_font.h" +#include "../font/lv_symbol_def.h" +#include "../font/lv_text.h" +#include "../draw/lv_draw.h" +#include "../core/lv_observer.h" + +/********************* + * DEFINES + *********************/ +#define LV_LABEL_DOT_NUM 3 +#define LV_LABEL_POS_LAST 0xFFFF +#define LV_LABEL_TEXT_SELECTION_OFF LV_DRAW_LABEL_NO_TXT_SEL +#if LV_WIDGETS_HAS_DEFAULT_VALUE +#define LV_LABEL_DEFAULT_TEXT "Text" +#else +#define LV_LABEL_DEFAULT_TEXT "" +#endif + +LV_EXPORT_CONST_INT(LV_LABEL_DOT_NUM); +LV_EXPORT_CONST_INT(LV_LABEL_POS_LAST); +LV_EXPORT_CONST_INT(LV_LABEL_TEXT_SELECTION_OFF); + +/********************** + * TYPEDEFS + **********************/ + +/** Long mode behaviors. Used in 'lv_label_ext_t'*/ +typedef enum { + LV_LABEL_LONG_MODE_WRAP, /**< Keep the object width, wrap lines longer than object width and expand the object height*/ + LV_LABEL_LONG_MODE_DOTS, /**< Keep the size and write dots at the end if the text is too long*/ + LV_LABEL_LONG_MODE_SCROLL, /**< Keep the size and roll the text back and forth*/ + LV_LABEL_LONG_MODE_SCROLL_CIRCULAR, /**< Keep the size and roll the text circularly*/ + LV_LABEL_LONG_MODE_CLIP, /**< Keep the size and clip the text out of it*/ +} lv_label_long_mode_t; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_label_id_t { + LV_PROPERTY_ID(LABEL, TEXT, LV_PROPERTY_TYPE_TEXT, 0), + LV_PROPERTY_ID(LABEL, LONG_MODE, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(LABEL, TEXT_SELECTION_START, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(LABEL, TEXT_SELECTION_END, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_LABEL_END, +}; +#endif + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_label_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a label object + * @param parent pointer to an object, it will be the parent of the new label. + * @return pointer to the created button + */ +lv_obj_t * lv_label_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set a new text for a label. Memory will be allocated to store the text by the label. + * @param obj pointer to a label object + * @param text '\0' terminated character string. NULL to refresh with the current text. + * @note If `LV_USE_ARABIC_PERSIAN_CHARS` is enabled the text will be modified to have the correct Arabic + * characters in it. + */ +void lv_label_set_text(lv_obj_t * obj, const char * text); + +/** + * Set a new formatted text for a label. Memory will be allocated to store the text by the label. + * @param obj pointer to a label object + * @param fmt `printf`-like format string + * Example: + * @code + * lv_label_set_text_fmt(label1, "%d user", user_num); + * @endcode + * @note If `LV_USE_ARABIC_PERSIAN_CHARS` is enabled the text will be modified to have the correct Arabic characters in it. + */ +void lv_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); + +/** + * Set a new formatted text for a label. Memory will be allocated to store the text by the label. + * @param obj pointer to a label object + * @param fmt `printf`-like format string + * @param args variadic arguments list + * + * Example: + * @code + * va_list args; + * va_start(args, fmt); + * lv_label_set_text_vfmt(label1, fmt, args); + * va_end(args); + * @endcode + * @note It ignores `LV_USE_ARABIC_PERSIAN_CHARS` + */ +void lv_label_set_text_vfmt(lv_obj_t * obj, const char * fmt, va_list args); + +/** + * Set a static text. It will not be saved by the label so the 'text' variable + * has to be 'alive' while the label exists. + * @param obj pointer to a label object + * @param text pointer to a text. NULL to refresh with the current text. + * @note It ignores `LV_USE_ARABIC_PERSIAN_CHARS` + */ +void lv_label_set_text_static(lv_obj_t * obj, const char * text); + +/** + * Set the behavior of the label with text longer than the object size + * @param obj pointer to a label object + * @param long_mode the new mode from 'lv_label_long_mode' enum. + * In LV_LONG_WRAP/DOT/SCROLL/SCROLL_CIRC the size of the label should be set AFTER this function + */ +void lv_label_set_long_mode(lv_obj_t * obj, lv_label_long_mode_t long_mode); + +/** + * Set where text selection should start + * @param obj pointer to a label object + * @param index character index from where selection should start. `LV_LABEL_TEXT_SELECTION_OFF` for no selection + */ +void lv_label_set_text_selection_start(lv_obj_t * obj, uint32_t index); + +/** + * Set where text selection should end + * @param obj pointer to a label object + * @param index character index where selection should end. `LV_LABEL_TEXT_SELECTION_OFF` for no selection + */ +void lv_label_set_text_selection_end(lv_obj_t * obj, uint32_t index); + +/** + * Enable the recoloring by in-line commands + * @param obj pointer to a label object + * @param en true: enable recoloring, false: disable + * Example: "This is a #ff0000 red# word" + */ +void lv_label_set_recolor(lv_obj_t * obj, bool en); + +#if LV_USE_TRANSLATION + +/** + * Assign a translation tag for this label. Memory will be allocated to store the tag by the label. + * The label text will automatically update when the language is changed via `lv_translation_set_language`. + * @param obj pointer to a label object + * @param tag '\0' terminated character string. + */ +void lv_label_set_translation_tag(lv_obj_t * obj, const char * tag); + +#endif /*LV_USE_TRANSLATION*/ + + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the text of a label + * @param obj pointer to a label object + * @return the text of the label + */ +char * lv_label_get_text(const lv_obj_t * obj); + +/** + * Get the long mode of a label + * @param obj pointer to a label object + * @return the current long mode + */ +lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * obj); + +/** + * Get the relative x and y coordinates of a letter + * @param obj pointer to a label object + * @param char_id index of the character [0 ... text length - 1]. + * Expressed in character index, not byte index (different in UTF-8) + * @param pos store the result here (E.g. index = 0 gives 0;0 coordinates if the text if aligned to the left) + */ +void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t * pos); + +/** + * Get the index of letter on a relative point of a label. + * @param obj pointer to label object + * @param pos_in pointer to point with coordinates on a the label + * @param bidi whether to use bidi processed + * @return The index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter if aligned to the left) + * Expressed in character index and not byte index (different in UTF-8) + */ +uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in, bool bidi); + +/** + * Check if a character is drawn under a point. + * @param obj pointer to a label object + * @param pos Point to check for character under + * @return whether a character is drawn under the point + */ +bool lv_label_is_char_under_pos(const lv_obj_t * obj, lv_point_t * pos); + +/** + * @brief Get the selection start index. + * @param obj pointer to a label object. + * @return selection start index. `LV_LABEL_TEXT_SELECTION_OFF` if nothing is selected. + */ +uint32_t lv_label_get_text_selection_start(const lv_obj_t * obj); + +/** + * @brief Get the selection end index. + * @param obj pointer to a label object. + * @return selection end index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected. + */ +uint32_t lv_label_get_text_selection_end(const lv_obj_t * obj); + +/** + * @brief Get the recoloring attribute + * @param obj pointer to a label object. + * @return true: recoloring is enabled, false: recoloring is disabled + */ +bool lv_label_get_recolor(const lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +#if LV_USE_OBSERVER +/** + * Bind an integer, string, or pointer Subject to a Label. + * @param obj pointer to Label + * @param subject pointer to Subject + * @param fmt optional printf-like format string with 1 format specifier (e.g. "%d °C") + * or NULL to bind to the value directly. + * @return pointer to newly-created Observer + * @note If `fmt == NULL` strings and pointers (`\0` terminated string) will be shown + * as text as they are, integers as %d, floats as %0.1f + */ +lv_observer_t * lv_label_bind_text(lv_obj_t * obj, lv_subject_t * subject, const char * fmt); +#endif + + +/** + * Insert a text to a label. The label text cannot be static. + * @param obj pointer to a label object + * @param pos character index to insert. Expressed in character index and not byte index. + * 0: before first char. LV_LABEL_POS_LAST: after last char. + * @param txt pointer to the text to insert + */ +void lv_label_ins_text(lv_obj_t * obj, uint32_t pos, const char * txt); + +/** + * Delete characters from a label. The label text cannot be static. + * @param obj pointer to a label object + * @param pos character index from where to cut. Expressed in character index and not byte index. + * 0: start in front of the first character + * @param cnt number of characters to cut + */ +void lv_label_cut_text(lv_obj_t * obj, uint32_t pos, uint32_t cnt); + + + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_LABEL*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LABEL_H*/ diff --git a/include/lvgl/widgets/lv_led.h b/include/lvgl/widgets/lv_led.h new file mode 100644 index 0000000000..8b33efdde2 --- /dev/null +++ b/include/lvgl/widgets/lv_led.h @@ -0,0 +1,114 @@ +/** + * @file lv_led.h + * + */ + +#ifndef LV_LED_H +#define LV_LED_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +#if LV_USE_LED + +/********************* + * DEFINES + *********************/ +/** Brightness when the LED if OFF */ +#ifndef LV_LED_BRIGHT_MIN +# define LV_LED_BRIGHT_MIN 80 +#endif + +/** Brightness when the LED if ON */ +#ifndef LV_LED_BRIGHT_MAX +# define LV_LED_BRIGHT_MAX 255 +#endif + +/********************** + * TYPEDEFS + **********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_led_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_led_id_t { + LV_PROPERTY_ID(LED, COLOR, LV_PROPERTY_TYPE_COLOR, 0), + LV_PROPERTY_ID(LED, BRIGHTNESS, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_LED_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a led object + * @param parent pointer to an object, it will be the parent of the new led + * @return pointer to the created led + */ +lv_obj_t * lv_led_create(lv_obj_t * parent); + +/** + * Set the color of the LED + * @param led pointer to a LED object + * @param color the color of the LED + */ +void lv_led_set_color(lv_obj_t * led, lv_color_t color); + +/** + * Set the brightness of a LED object + * @param led pointer to a LED object + * @param bright LV_LED_BRIGHT_MIN (max. dark) ... LV_LED_BRIGHT_MAX (max. light) + */ +void lv_led_set_brightness(lv_obj_t * led, uint8_t bright); + +/** + * Light on a LED + * @param led pointer to a LED object + */ +void lv_led_on(lv_obj_t * led); + +/** + * Light off a LED + * @param led pointer to a LED object + */ +void lv_led_off(lv_obj_t * led); + +/** + * Toggle the state of a LED + * @param led pointer to a LED object + */ +void lv_led_toggle(lv_obj_t * led); + +/** + * Get the brightness of a LED object + * @param obj pointer to LED object + * @return bright 0 (max. dark) ... 255 (max. light) + */ +uint8_t lv_led_get_brightness(const lv_obj_t * obj); + +/** + * Get the color of a LED object + * @param obj pointer to LED object + * @return color color of the LED + */ +lv_color_t lv_led_get_color(const lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_LED*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LED_H*/ diff --git a/include/lvgl/widgets/lv_line.h b/include/lvgl/widgets/lv_line.h new file mode 100644 index 0000000000..20f8b05c98 --- /dev/null +++ b/include/lvgl/widgets/lv_line.h @@ -0,0 +1,125 @@ +/** + * @file lv_line.h + * + */ + +#ifndef LV_LINE_H +#define LV_LINE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" +#if LV_USE_LINE != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_line_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_line_id_t { + LV_PROPERTY_ID(LINE, Y_INVERT, LV_PROPERTY_TYPE_BOOL, 0), + LV_PROPERTY_LINE_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a line object + * @param parent pointer to an object, it will be the parent of the new line + * @return pointer to the created line + */ +lv_obj_t * lv_line_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set an array of points. The line object will connect these points. + * @param obj pointer to a line object + * @param points an array of points. Only the address is saved, so the array needs to be alive while the line exists + * @param point_num number of points in 'point_a' + */ +void lv_line_set_points(lv_obj_t * obj, const lv_point_precise_t points[], uint32_t point_num); + +/** + * 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`. + * @param obj pointer to a line object + * @param points a non-const array of points. Only the address is saved, so the array needs to be alive while the line exists. + * @param point_num number of points in 'point_a' + */ +void lv_line_set_points_mutable(lv_obj_t * obj, lv_point_precise_t points[], uint32_t point_num); + +/** + * 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. + * @param obj pointer to a line object + * @param en true: enable the y inversion, false:disable the y inversion + */ +void lv_line_set_y_invert(lv_obj_t * obj, bool en); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the pointer to the array of points. + * @param obj pointer to a line object + * @return const pointer to the array of points + */ +const lv_point_precise_t * lv_line_get_points(lv_obj_t * obj); + +/** + * Get the number of points in the array of points. + * @param obj pointer to a line object + * @return number of points in array of points + */ +uint32_t lv_line_get_point_count(lv_obj_t * obj); + +/** + * Check the mutability of the stored point array pointer. + * @param obj pointer to a line object + * @return true: the point array pointer is mutable, false: constant + */ +bool lv_line_is_point_array_mutable(lv_obj_t * obj); + +/** + * Get a pointer to the mutable array of points or NULL if it is not mutable + * @param obj pointer to a line object + * @return pointer to the array of points. NULL if not mutable. + */ +lv_point_precise_t * lv_line_get_points_mutable(lv_obj_t * obj); + +/** + * Get the y inversion attribute + * @param obj pointer to a line object + * @return true: y inversion is enabled, false: disabled + */ +bool lv_line_get_y_invert(const lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_LINE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LINE_H*/ diff --git a/include/lvgl/widgets/lv_list.h b/include/lvgl/widgets/lv_list.h new file mode 100644 index 0000000000..d577f223f1 --- /dev/null +++ b/include/lvgl/widgets/lv_list.h @@ -0,0 +1,118 @@ +/** + * @file lv_list.h + * + */ + +#ifndef LV_LIST_H +#define LV_LIST_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +#if LV_USE_LIST + +#if LV_USE_FLEX == 0 +#error "lv_list: lv_flex is required. Enable it in lv_conf.h (LV_USE_FLEX 1)" +#endif + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_text_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_button_class; +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a list object + * @param parent pointer to an object, it will be the parent of the new list + * @return pointer to the created list + */ +lv_obj_t * lv_list_create(lv_obj_t * parent); + +/** + * Add text to a list + * @param list pointer to a list, it will be the parent of the new label + * @param txt text of the new label + * @return pointer to the created label + */ +lv_obj_t * lv_list_add_text(lv_obj_t * list, const char * txt); + +/** + * Add button to a list + * @param list pointer to a list, it will be the parent of the new button + * @param icon icon for the button, when NULL it will have no icon + * @param txt text of the new button, when NULL no text will be added + * @return pointer to the created button + */ +lv_obj_t * lv_list_add_button(lv_obj_t * list, const void * icon, const char * txt); + +/** + * Get text of a given list button + * @param list pointer to a list + * @param btn pointer to the button + * @return text of btn, if btn doesn't have text "" will be returned + */ +const char * lv_list_get_button_text(lv_obj_t * list, lv_obj_t * btn); + +/** + * Set text of a given list button + * @param list pointer to a list + * @param btn pointer to the button + * @param txt pointer to the text + */ +void lv_list_set_button_text(lv_obj_t * list, lv_obj_t * btn, const char * txt); + +#if LV_USE_TRANSLATION + +/** + * Add translation tag text to a list + * @param list pointer to a list, it will be the parent of the new label + * @param tag translation tag of the new label + * @return pointer to the created label + */ +lv_obj_t * lv_list_add_translation_tag(lv_obj_t * list, const char * tag); + +/** + * Add translation tag button to a list + * @param list pointer to a list, it will be the parent of the new button + * @param icon icon for the button, when NULL it will have no icon + * @param tag translation tag of the new button, when NULL no translation tag will be added + * @return pointer to the created button + */ +lv_obj_t * lv_list_add_button_translation_tag(lv_obj_t * list, const void * icon, const char * tag); + +/** + * Set translation tag text of a given list button + * @param list pointer to a list + * @param btn pointer to the button + * @param tag pointer to the translation tag + */ +void lv_list_set_button_translation_tag(lv_obj_t * list, lv_obj_t * btn, const char * tag); + +#endif + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_LIST*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LIST_H*/ diff --git a/include/lvgl/widgets/lv_lottie.h b/include/lvgl/widgets/lv_lottie.h new file mode 100644 index 0000000000..4f5d265f82 --- /dev/null +++ b/include/lvgl/widgets/lv_lottie.h @@ -0,0 +1,93 @@ +/** + * @file lv_lottie.h + * + */ + +#ifndef LV_LOTTIE_H +#define LV_LOTTIE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_types.h" +#if LV_USE_LOTTIE + +#include "../draw/lv_draw_buf.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a lottie animation + * @param parent pointer to the parent widget + * @return pointer to the created Lottie animation widget + */ +lv_obj_t * lv_lottie_create(lv_obj_t * parent); + +/** + * Set a buffer for the animation. It also defines the size of the animation + * @param obj pointer to a lottie widget + * @param w width of the animation and buffer + * @param h height of the animation and buffer + * @param buf a static buffer with `width x height x 4` byte size + */ +void lv_lottie_set_buffer(lv_obj_t * obj, int32_t w, int32_t h, void * buf); + +/** + * Set a draw buffer for the animation. It also defines the size of the animation + * @param obj pointer to a lottie widget + * @param draw_buf an initialized draw buffer with ARGB8888 color format + */ +void lv_lottie_set_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf); + +/** + * Set the source for the animation as an array + * @param obj pointer to a lottie widget + * @param src the lottie animation converted to an nul terminated array + * @param src_size size of the source array in bytes + */ +void lv_lottie_set_src_data(lv_obj_t * obj, const void * src, size_t src_size); + +/** + * Set the source for the animation as a path. + * Lottie doesn't use LVGL's File System API. + * @param obj pointer to a lottie widget + * @param src path to a json file, e.g. "path/to/file.json" + */ +void lv_lottie_set_src_file(lv_obj_t * obj, const char * src); + +/** + * Get the LVGL animation which controls the lottie animation + * @param obj pointer to a lottie widget + * @return the LVGL animation + */ +lv_anim_t * lv_lottie_get_anim(lv_obj_t * obj); + +/********************** + * GLOBAL VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_LOTTIE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LOTTIE_H*/ diff --git a/include/lvgl/widgets/lv_menu.h b/include/lvgl/widgets/lv_menu.h new file mode 100644 index 0000000000..cf5d48d8d6 --- /dev/null +++ b/include/lvgl/widgets/lv_menu.h @@ -0,0 +1,241 @@ +/** + * @file lv_menu.h + * + */ + +#ifndef LV_MENU_H +#define LV_MENU_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" +#include "../core/lv_obj_property.h" + +#if LV_USE_MENU + +#if LV_USE_FLEX == 0 +#error "lv_menu: lv_flex is required. Enable it in lv_conf.h (LV_USE_FLEX 1)" +#endif + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_MENU_HEADER_TOP_FIXED, /**< Header is positioned at the top */ + LV_MENU_HEADER_TOP_UNFIXED, /**< Header is positioned at the top and can be scrolled out of view*/ + LV_MENU_HEADER_BOTTOM_FIXED /**< Header is positioned at the bottom */ +} lv_menu_mode_header_t; + +typedef enum { + LV_MENU_ROOT_BACK_BUTTON_DISABLED, + LV_MENU_ROOT_BACK_BUTTON_ENABLED +} lv_menu_mode_root_back_button_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_page_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_cont_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_section_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_separator_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_sidebar_cont_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_main_cont_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_sidebar_header_cont_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_main_header_cont_class; + +#if LV_USE_OBJ_PROPERTY +enum __lv_property_menu_id_t { + LV_PROPERTY_ID(MENU, MODE_HEADER, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(MENU, MODE_ROOT_BACK_BUTTON, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_MENU_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a menu object + * @param parent pointer to an object, it will be the parent of the new menu + * @return pointer to the created menu + */ +lv_obj_t * lv_menu_create(lv_obj_t * parent); + +/** + * Create a menu page object. + * + * This call inserts the new page under menu->storage as its parent, which is itself a + * child of the menu, so the resulting object hierarchy is: menu => storage => new_page + * where `storage` is a Base Widget. + * @param menu pointer to menu object. + * @param title pointer to text for title in header (NULL to not display title) + * @return pointer to the created menu page + */ +lv_obj_t * lv_menu_page_create(lv_obj_t * menu, char const * const title); + +/** + * Create a menu cont object + * @param parent pointer to a menu page or menu section object, it will be the parent of the new menu cont object + * @return pointer to the created menu cont + */ +lv_obj_t * lv_menu_cont_create(lv_obj_t * parent); + +/** + * Create a menu section object + * @param parent pointer to a menu page object, it will be the parent of the new menu section object + * @return pointer to the created menu section + */ +lv_obj_t * lv_menu_section_create(lv_obj_t * parent); + +/** + * Create a menu separator object + * @param parent pointer to a menu page object, it will be the parent of the new menu separator object + * @return pointer to the created menu separator + */ +lv_obj_t * lv_menu_separator_create(lv_obj_t * parent); +/*===================== + * Setter functions + *====================*/ +/** + * Set menu page to display in main + * @param obj pointer to the menu + * @param page pointer to the menu page to set (NULL to clear main and clear menu history) + */ +void lv_menu_set_page(lv_obj_t * obj, lv_obj_t * page); + +/** + * Set menu page title + * @param page pointer to the menu page + * @param title pointer to text for title in header (NULL to not display title) + */ +void lv_menu_set_page_title(lv_obj_t * page, char const * const title); + +/** + * Set menu page title with a static text. It will not be saved by the label so the 'text' variable + * has to be 'alive' while the page exists. + * @param page pointer to the menu page + * @param title pointer to text for title in header (NULL to not display title) + */ +void lv_menu_set_page_title_static(lv_obj_t * page, char const * const title); + +/** + * Set menu page to display in sidebar + * @param obj pointer to the menu + * @param page pointer to the menu page to set (NULL to clear sidebar) + */ +void lv_menu_set_sidebar_page(lv_obj_t * obj, lv_obj_t * page); + +/** + * Set the how the header should behave and its position + * @param obj pointer to a menu + * @param mode LV_MENU_HEADER_TOP_FIXED/TOP_UNFIXED/BOTTOM_FIXED + */ +void lv_menu_set_mode_header(lv_obj_t * obj, lv_menu_mode_header_t mode); + +/** + * Set whether back button should appear at root + * @param obj pointer to a menu + * @param mode LV_MENU_ROOT_BACK_BUTTON_DISABLED/ENABLED + */ +void lv_menu_set_mode_root_back_button(lv_obj_t * obj, lv_menu_mode_root_back_button_t mode); + +/** + * Add menu to the menu item + * @param menu pointer to the menu + * @param obj pointer to the obj + * @param page pointer to the page to load when obj is clicked + */ +void lv_menu_set_load_page_event(lv_obj_t * menu, lv_obj_t * obj, lv_obj_t * page); + +/*===================== + * Getter functions + *====================*/ +/** +* Get a pointer to menu page that is currently displayed in main +* @param obj pointer to the menu +* @return pointer to current page +*/ +lv_obj_t * lv_menu_get_cur_main_page(lv_obj_t * obj); + +/** +* Get a pointer to menu page that is currently displayed in sidebar +* @param obj pointer to the menu +* @return pointer to current page +*/ +lv_obj_t * lv_menu_get_cur_sidebar_page(lv_obj_t * obj); + +/** +* Get a pointer to main header obj +* @param obj pointer to the menu +* @return pointer to main header obj +*/ +lv_obj_t * lv_menu_get_main_header(lv_obj_t * obj); + +/** +* Get a pointer to main header back btn obj +* @param obj pointer to the menu +* @return pointer to main header back btn obj +*/ +lv_obj_t * lv_menu_get_main_header_back_button(lv_obj_t * obj); + +/** +* Get a pointer to sidebar header obj +* @param obj pointer to the menu +* @return pointer to sidebar header obj +*/ +lv_obj_t * lv_menu_get_sidebar_header(lv_obj_t * obj); + +/** +* Get a pointer to sidebar header obj +* @param obj pointer to the menu +* @return pointer to sidebar header back btn obj +*/ +lv_obj_t * lv_menu_get_sidebar_header_back_button(lv_obj_t * obj); + +/** + * Check if an obj is a root back btn + * @param menu pointer to the menu + * @param obj pointer to the back button + * @return true if it is a root back btn + */ +bool lv_menu_back_button_is_root(lv_obj_t * menu, lv_obj_t * obj); + +/** + * Get the header mode of the menu + * @param obj pointer to a menu + * @return LV_MENU_HEADER_TOP_FIXED/TOP_UNFIXED/BOTTOM_FIXED + */ +lv_menu_mode_header_t lv_menu_get_mode_header(lv_obj_t * obj); + +/** + * Get the root back button mode of the menu + * @param obj pointer to a menu + * @return LV_MENU_ROOT_BACK_BUTTON_DISABLED/ENABLED + */ +lv_menu_mode_root_back_button_t lv_menu_get_mode_root_back_button(lv_obj_t * obj); + +/** + * Clear menu history + * @param obj pointer to the menu + */ +void lv_menu_clear_history(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_MENU*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_MENU_H*/ diff --git a/include/lvgl/widgets/lv_msgbox.h b/include/lvgl/widgets/lv_msgbox.h new file mode 100644 index 0000000000..4b2dbe1885 --- /dev/null +++ b/include/lvgl/widgets/lv_msgbox.h @@ -0,0 +1,140 @@ +/** + * @file lv_msgbox.h + * + */ + +#ifndef LV_MSGBOX_H +#define LV_MSGBOX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +#if LV_USE_MSGBOX + +/********************* + * DEFINES + *********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_header_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_content_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_footer_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_header_button_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_footer_button_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_backdrop_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an empty message box + * @param parent the parent or NULL to create a modal msgbox + * @return the created message box + */ +lv_obj_t * lv_msgbox_create(lv_obj_t * parent); + +/** + * Add title to the message box. It also creates a header for the title. + * @param obj pointer to a message box + * @param title the text of the tile + * @return the created title label + */ +lv_obj_t * lv_msgbox_add_title(lv_obj_t * obj, const char * title); + +/** + * Add a button to the header of to the message box. It also creates a header. + * @param obj pointer to a message box + * @param icon the icon of the button + * @return the created button + */ +lv_obj_t * lv_msgbox_add_header_button(lv_obj_t * obj, const void * icon); + +/** + * Add a text to the content area of message box. Multiple texts will be created below each other. + * @param obj pointer to a message box + * @param text text to add + * @return the created label + */ +lv_obj_t * lv_msgbox_add_text(lv_obj_t * obj, const char * text); + +/** + * Add a formatted text to the content area of message box. Multiple texts will be created below each other. + * @param obj pointer to a message box + * @param fmt `printf`-like format string + * @return the created label + */ +lv_obj_t * lv_msgbox_add_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); + +/** + * Add a button to the footer of to the message box. It also creates a footer. + * @param obj pointer to a message box + * @param text the text of the button + * @return the created button + */ +lv_obj_t * lv_msgbox_add_footer_button(lv_obj_t * obj, const char * text); + +/** + * Add a close button to the message box. It also creates a header. + * @param obj pointer to a message box + * @return the created close button + */ +lv_obj_t * lv_msgbox_add_close_button(lv_obj_t * obj); + +/** + * Get the header widget + * @param obj pointer to a message box + * @return the header, or NULL if not exists + */ +lv_obj_t * lv_msgbox_get_header(lv_obj_t * obj); + +/** + * Get the footer widget + * @param obj pointer to a message box + * @return the footer, or NULL if not exists + */ +lv_obj_t * lv_msgbox_get_footer(lv_obj_t * obj); + +/** + * Get the content widget + * @param obj pointer to a message box + * @return the content + */ +lv_obj_t * lv_msgbox_get_content(lv_obj_t * obj); + +/** + * Get the title label + * @param obj pointer to a message box + * @return the title, or NULL if it does not exist + */ +lv_obj_t * lv_msgbox_get_title(lv_obj_t * obj); + +/** + * Close a message box + * @param mbox pointer to a message box + */ +void lv_msgbox_close(lv_obj_t * mbox); + +/** + * Close a message box in the next call of the message box + * @param mbox pointer to a message box + */ +void lv_msgbox_close_async(lv_obj_t * mbox); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_MSGBOX*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_MSGBOX_H*/ diff --git a/include/lvgl/widgets/lv_qrcode.h b/include/lvgl/widgets/lv_qrcode.h new file mode 100644 index 0000000000..d703a21bb7 --- /dev/null +++ b/include/lvgl/widgets/lv_qrcode.h @@ -0,0 +1,101 @@ +/** + * @file lv_qrcode.h + * + */ + +#ifndef LV_QRCODE_H +#define LV_QRCODE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_QRCODE + +#include "../draw/lv_color.h" +#include "../lv_types.h" +#include "lv_canvas.h" +#include LV_STDBOOL_INCLUDE +#include LV_STDINT_INCLUDE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_qrcode_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an empty QR code (an `lv_canvas`) object. + * @param parent point to an object where to create the QR code + * @return pointer to the created QR code object + */ +lv_obj_t * lv_qrcode_create(lv_obj_t * parent); + +/** + * Set QR code size. + * @param obj pointer to a QR code object + * @param size width and height of the QR code + */ +void lv_qrcode_set_size(lv_obj_t * obj, int32_t size); + +/** + * Set QR code dark color. + * @param obj pointer to a QR code object + * @param color dark color of the QR code + */ +void lv_qrcode_set_dark_color(lv_obj_t * obj, lv_color_t color); + +/** + * Set QR code light color. + * @param obj pointer to a QR code object + * @param color light color of the QR code + */ +void lv_qrcode_set_light_color(lv_obj_t * obj, lv_color_t color); + +/** + * Set the data of a QR code object + * @param obj pointer to a QR code object + * @param data data to display + * @param data_len length of data in bytes + * @return LV_RESULT_OK: if no error; LV_RESULT_INVALID: on error + */ +lv_result_t lv_qrcode_update(lv_obj_t * obj, const void * data, uint32_t data_len); + +/** + * Helper function to set the data of a QR code object + * @param obj pointer to a QR code object + * @param data data to display as a string + */ +void lv_qrcode_set_data(lv_obj_t * obj, const char * data); + +/** + * Enable or disable quiet zone. + * Quiet zone is the area around the QR code where no data is encoded. + * @param obj pointer to a QR code object + * @param enable true: enable quiet zone; false: disable quiet zone + */ +void lv_qrcode_set_quiet_zone(lv_obj_t * obj, bool enable); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_QRCODE*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_QRCODE_H*/ diff --git a/include/lvgl/widgets/lv_rlottie.h b/include/lvgl/widgets/lv_rlottie.h new file mode 100644 index 0000000000..1d3c3e4fe1 --- /dev/null +++ b/include/lvgl/widgets/lv_rlottie.h @@ -0,0 +1,58 @@ +/** + * @file lv_rlottie.h + * + */ + +#ifndef LV_RLOTTIE_H +#define LV_RLOTTIE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#if LV_USE_RLOTTIE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_RLOTTIE_CTRL_FORWARD = 0, + LV_RLOTTIE_CTRL_BACKWARD = 1, + LV_RLOTTIE_CTRL_PAUSE = 2, + LV_RLOTTIE_CTRL_PLAY = 0, /* Yes, play = 0 is the default mode */ + LV_RLOTTIE_CTRL_LOOP = 8, +} lv_rlottie_ctrl_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_rlottie_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent, int32_t width, int32_t height, const char * path); + +lv_obj_t * lv_rlottie_create_from_raw(lv_obj_t * parent, int32_t width, int32_t height, + const char * rlottie_desc); + +void lv_rlottie_set_play_mode(lv_obj_t * rlottie, const lv_rlottie_ctrl_t ctrl); +void lv_rlottie_set_current_frame(lv_obj_t * rlottie, const size_t goto_frame); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_RLOTTIE*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_RLOTTIE_H*/ diff --git a/include/lvgl/widgets/lv_roller.h b/include/lvgl/widgets/lv_roller.h new file mode 100644 index 0000000000..fce9bf2dc4 --- /dev/null +++ b/include/lvgl/widgets/lv_roller.h @@ -0,0 +1,162 @@ +/** + * @file lv_roller.h + * + */ + +#ifndef LV_ROLLER_H +#define LV_ROLLER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +#if LV_USE_ROLLER != 0 + +/*Testing of dependencies*/ +#if LV_USE_LABEL == 0 +#error "lv_roller: lv_label is required. Enable it in lv_conf.h (LV_USE_ROLLER 1)" +#endif + +#include "lv_label.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** Roller mode. */ +typedef enum { + LV_ROLLER_MODE_NORMAL, /**< Normal mode (roller ends at the end of the options). */ + LV_ROLLER_MODE_INFINITE, /**< Infinite mode (roller can be scrolled forever). */ +} lv_roller_mode_t; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_roller_id_t { + LV_PROPERTY_ID2(ROLLER, OPTIONS, LV_PROPERTY_TYPE_TEXT, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID2(ROLLER, SELECTED, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(ROLLER, VISIBLE_ROW_COUNT, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ROLLER_END, +}; +#endif + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_roller_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a roller object + * @param parent pointer to an object, it will be the parent of the new roller. + * @return pointer to the created roller + */ +lv_obj_t * lv_roller_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the options on a roller + * @param obj pointer to roller object + * @param options a string with '\n' separated options. E.g. "One\nTwo\nThree" + * @param mode `LV_ROLLER_MODE_NORMAL` or `LV_ROLLER_MODE_INFINITE` + */ +void lv_roller_set_options(lv_obj_t * obj, const char * options, lv_roller_mode_t mode); + +/** + * Set the selected option + * @param obj pointer to a roller object + * @param sel_opt index of the selected option (0 ... number of option - 1); + * @param anim LV_ANIM_ON: set with animation; LV_ANIM_OFF set immediately + */ +void lv_roller_set_selected(lv_obj_t * obj, uint32_t sel_opt, lv_anim_enable_t anim); + +/** + * Sets the given string as the selection on the roller. Does not alter the current selection on failure. + * @param obj pointer to roller object + * @param sel_opt pointer to the string you want to set as an option + * @param anim LV_ANIM_ON: set with animation; LV_ANIM_OFF set immediately + * @return `true` if set successfully and `false` if the given string does not exist as an option in the roller + */ +bool lv_roller_set_selected_str(lv_obj_t * obj, const char * sel_opt, lv_anim_enable_t anim); + +/** + * Set the height to show the given number of rows (options) + * @param obj pointer to a roller object + * @param row_cnt number of desired visible rows + */ +void lv_roller_set_visible_row_count(lv_obj_t * obj, uint32_t row_cnt); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the index of the selected option + * @param obj pointer to a roller object + * @return index of the selected option (0 ... number of option - 1); + */ +uint32_t lv_roller_get_selected(const lv_obj_t * obj); + +/** + * Get the current selected option as a string. + * @param obj pointer to roller object + * @param buf pointer to an array to store the string + * @param buf_size size of `buf` in bytes. 0: to ignore it. + */ +void lv_roller_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size); + +/** + * Get the options of a roller + * @param obj pointer to roller object + * @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3") + */ +const char * lv_roller_get_options(const lv_obj_t * obj); + +/** + * Get the total number of options + * @param obj pointer to a roller object + * @return the total number of options + */ +uint32_t lv_roller_get_option_count(const lv_obj_t * obj); + +/** + * Get an option as a string. + * @param obj pointer to roller object + * @param option index of chosen option + * @param buf pointer to an array to store the string + * @param buf_size size of `buf` in bytes. 0: to ignore it. + * @return LV_RESULT_OK if option found + */ +lv_result_t lv_roller_get_option_str(const lv_obj_t * obj, uint32_t option, char * buf, uint32_t buf_size); + +#if LV_USE_OBSERVER +/** + * Bind an integer Subject to a Roller's value. + * @param obj pointer to Roller + * @param subject pointer to Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_roller_bind_value(lv_obj_t * obj, lv_subject_t * subject); +#endif + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_ROLLER*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ROLLER_H*/ diff --git a/include/lvgl/widgets/lv_scale.h b/include/lvgl/widgets/lv_scale.h new file mode 100644 index 0000000000..01629d7ebf --- /dev/null +++ b/include/lvgl/widgets/lv_scale.h @@ -0,0 +1,418 @@ +/** + * @file lv_scale.h + * + */ + +#ifndef LV_SCALE_H +#define LV_SCALE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_SCALE != 0 + +#include "../core/lv_obj.h" +#include "lv_line.h" +#include "lv_image.h" +#include "../core/lv_observer.h" + +/********************* + * DEFINES + *********************/ + +/**Default value of total minor ticks. */ +#define LV_SCALE_TOTAL_TICK_COUNT_DEFAULT (11U) +LV_EXPORT_CONST_INT(LV_SCALE_TOTAL_TICK_COUNT_DEFAULT); + +/**Default value of major tick every nth ticks. */ +#define LV_SCALE_MAJOR_TICK_EVERY_DEFAULT (5U) +LV_EXPORT_CONST_INT(LV_SCALE_MAJOR_TICK_EVERY_DEFAULT); + +/**Default value of scale label enabled. */ +#define LV_SCALE_LABEL_ENABLED_DEFAULT (1U) +LV_EXPORT_CONST_INT(LV_SCALE_LABEL_ENABLED_DEFAULT); + +/********************** + * TYPEDEFS + **********************/ + +/** + * Scale mode + */ +typedef enum { + LV_SCALE_MODE_HORIZONTAL_TOP = 0x00U, + LV_SCALE_MODE_HORIZONTAL_BOTTOM = 0x01U, + LV_SCALE_MODE_VERTICAL_LEFT = 0x02U, + LV_SCALE_MODE_VERTICAL_RIGHT = 0x04U, + LV_SCALE_MODE_ROUND_INNER = 0x08U, + LV_SCALE_MODE_ROUND_OUTER = 0x10U, + LV_SCALE_MODE_LAST +} lv_scale_mode_t; + +#define LV_SCALE_LABEL_ROTATE_MATCH_TICKS 0x100000 +LV_EXPORT_CONST_INT(LV_SCALE_LABEL_ROTATE_MATCH_TICKS); + +#define LV_SCALE_LABEL_ROTATE_KEEP_UPRIGHT 0x80000 +LV_EXPORT_CONST_INT(LV_SCALE_LABEL_ROTATE_KEEP_UPRIGHT); + +#define LV_SCALE_ROTATION_ANGLE_MASK 0x7FFFF +LV_EXPORT_CONST_INT(LV_SCALE_ROTATION_ANGLE_MASK); + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_scale_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_scale_id_t { + LV_PROPERTY_ID(SCALE, MODE, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(SCALE, TOTAL_TICK_COUNT, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(SCALE, MAJOR_TICK_EVERY, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(SCALE, LABEL_SHOW, LV_PROPERTY_TYPE_BOOL, 3), + LV_PROPERTY_ID(SCALE, ANGLE_RANGE, LV_PROPERTY_TYPE_INT, 4), + LV_PROPERTY_ID(SCALE, ROTATION, LV_PROPERTY_TYPE_INT, 5), + LV_PROPERTY_ID(SCALE, RANGE_MIN_VALUE, LV_PROPERTY_TYPE_INT, 6), + LV_PROPERTY_ID(SCALE, RANGE_MAX_VALUE, LV_PROPERTY_TYPE_INT, 7), + LV_PROPERTY_SCALE_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an scale object + * @param parent pointer to an object, it will be the parent of the new scale + * @return pointer to created Scale Widget + */ +lv_obj_t * lv_scale_create(lv_obj_t * parent); + +/*====================== + * Add/remove functions + *=====================*/ + +/*===================== + * Setter functions + *====================*/ + +/** + * Set scale mode. See lv_scale_mode_t. + * @param obj pointer to Scale Widget + * @param mode the new scale mode + */ +void lv_scale_set_mode(lv_obj_t * obj, lv_scale_mode_t mode); + +/** + * Set scale total tick count (including minor and major ticks). + * @param obj pointer to Scale Widget + * @param total_tick_count New total tick count + */ +void lv_scale_set_total_tick_count(lv_obj_t * obj, uint32_t total_tick_count); + +/** + * Sets how often major ticks are drawn. + * @param obj pointer to Scale Widget + * @param major_tick_every the new count for major tick drawing + */ +void lv_scale_set_major_tick_every(lv_obj_t * obj, uint32_t major_tick_every); + +/** + * Sets label visibility. + * @param obj pointer to Scale Widget + * @param show_label true/false to enable tick label + */ +void lv_scale_set_label_show(lv_obj_t * obj, bool show_label); + +/** + * Set minimum and maximum values on Scale. + * @param obj pointer to Scale Widget + * @param min minimum value of Scale + * @param max maximum value of Scale + */ +void lv_scale_set_range(lv_obj_t * obj, int32_t min, int32_t max); + +/** + * Set minimum values on Scale. + * @param obj pointer to Scale Widget + * @param min minimum value of Scale + */ +void lv_scale_set_min_value(lv_obj_t * obj, int32_t min); + +/** + * Set maximum values on Scale. + * @param obj pointer to Scale Widget + * @param min minimum value of Scale + */ +void lv_scale_set_max_value(lv_obj_t * obj, int32_t max); + +/** + * Set angle between the low end and the high end of the Scale. + * (Applies only to round Scales.) + * @param obj pointer to Scale Widget + * @param max_angle angle in degrees from Scale minimum where top end of Scale will be drawn + */ +void lv_scale_set_angle_range(lv_obj_t * obj, uint32_t angle_range); + +/** + * Set angular offset from the 3-o'clock position of the low end of the Scale. + * (Applies only to round Scales.) + * @param obj pointer to Scale Widget + * @param rotation clockwise angular offset (in degrees) from the 3-o'clock position + * of the low end of the scale; negative and >360 values are first normalized + * to range [0..360]. + * Examples: + * - 0 = 3 o'clock (right side) + * - 30 = 4 o'clock + * - 60 = 5 o'clock + * - 90 = 6 o'clock + * - 135 = midway between 7 and 8 o'clock (default) + * - 180 = 9 o'clock + * - 270 = 12 o'clock + * - 300 = 1 o'clock + * - 330 = 2 o'clock + * - -30 = 2 o'clock + * - 390 = 4 o'clock + */ +void lv_scale_set_rotation(lv_obj_t * obj, int32_t rotation); + +/** + * Point line needle to specified value. + * @param obj pointer to Scale Widget + * @param needle_line needle_line of the Scale. The line points will be allocated and + * managed by the Scale unless the line point array was previously set + * using `lv_line_set_points_mutable`. + * @param needle_length length of the needle + * - needle_length>0: needle_length=needle_length; + * - needle_length<0: needle_length=radius-|needle_length|; + * @param value Scale value needle will point to + */ +void lv_scale_set_line_needle_value(lv_obj_t * obj, lv_obj_t * needle_line, int32_t needle_length, + int32_t value); + +/** + * Point image needle to specified value; + image must point to the right. E.g. -O------> + * @param obj pointer to Scale Widget + * @param needle_img pointer to needle's Image + * @param value Scale value needle will point to + */ +void lv_scale_set_image_needle_value(lv_obj_t * obj, lv_obj_t * needle_img, int32_t value); + +/** + * Set custom text source for major ticks labels. + * @param obj pointer to Scale Widget + * @param txt_src pointer to an array of strings which will be display at major ticks; + * last element must be a NULL pointer. + */ +void lv_scale_set_text_src(lv_obj_t * obj, const char * txt_src[]); + +/** + * Draw Scale after all its children are drawn. + * @param obj pointer to Scale Widget + * @param en true: enable post draw + */ +void lv_scale_set_post_draw(lv_obj_t * obj, bool en); + +/** + * Draw Scale ticks on top of all other parts. + * @param obj pointer to Scale Widget + * @param en true: enable draw ticks on top of all parts + */ +void lv_scale_set_draw_ticks_on_top(lv_obj_t * obj, bool en); + +/** + * Add a Section to specified Scale. Section will not be drawn until + * a valid range is set for it using `lv_scale_set_section_range()`. + * @param obj pointer to Scale Widget + * @return pointer to new Section + */ +lv_scale_section_t * lv_scale_add_section(lv_obj_t * obj); + +/** + * DEPRECATED, use lv_scale_set_section_range instead. + * Set range for specified Scale Section + * @param section pointer to Section + * @param range_min Section new minimum value + * @param range_max Section new maximum value + */ +void lv_scale_section_set_range(lv_scale_section_t * section, int32_t min, int32_t max); + +/** + * Set the range of a scale section + * @param scale pointer to scale + * @param section pointer to section + * @param range_min the section's new minimum value + * @param range_max the section's new maximum value + */ +void lv_scale_set_section_range(lv_obj_t * scale, lv_scale_section_t * section, int32_t min, int32_t max); + +/** + * Set the minimum value of a scale section + * @param scale pointer to scale + * @param section pointer to section + * @param min the section's new minimum value + */ +void lv_scale_set_section_min_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t min); + +/** + * Set the maximum value of a scale section + * @param scale pointer to scale + * @param section pointer to section + * @param max the section's new maximum value + */ +void lv_scale_set_section_max_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t max); + +/** + * DEPRECATED, use lv_scale_set_section_style_main/indicator/items instead. + * Set style for specified part of Section. + * @param section pointer to Section + * @param part the part of the Scale the style will apply to, e.g. LV_PART_INDICATOR + * @param section_part_style pointer to style to apply + */ +void lv_scale_section_set_style(lv_scale_section_t * section, lv_part_t part, lv_style_t * section_part_style); + +/** + * Set the style of the line on a section. + * @param scale pointer to scale + * @param section pointer to section + * @param style point to a style + */ +void lv_scale_set_section_style_main(lv_obj_t * scale, lv_scale_section_t * section, const lv_style_t * style); + +/** + * Set the style of the major ticks and label on a section. + * @param scale pointer to scale + * @param section pointer to section + * @param style point to a style + */ +void lv_scale_set_section_style_indicator(lv_obj_t * scale, lv_scale_section_t * section, const lv_style_t * style); + +/** + * Set the style of the minor ticks on a section. + * @param scale pointer to scale + * @param section pointer to section + * @param style point to a style + */ +void lv_scale_set_section_style_items(lv_obj_t * scale, lv_scale_section_t * section, const lv_style_t * style); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get scale mode. See lv_scale_mode_t + * @param obj pointer to Scale Widget + * @return Scale mode + */ +lv_scale_mode_t lv_scale_get_mode(lv_obj_t * obj); + +/** + * Get scale total tick count (including minor and major ticks) + * @param obj pointer to Scale Widget + * @return Scale total tick count + */ +int32_t lv_scale_get_total_tick_count(lv_obj_t * obj); + +/** + * Get how often the major tick will be drawn + * @param obj pointer to Scale Widget + * @return Scale major tick every count + */ +int32_t lv_scale_get_major_tick_every(lv_obj_t * obj); + +/** + * Get angular location of low end of Scale. + * @param obj pointer to Scale Widget + * @return Scale low end angular location + */ +int32_t lv_scale_get_rotation(lv_obj_t * obj); + +/** + * Gets label visibility + * @param obj pointer to Scale Widget + * @return true if tick label is enabled, false otherwise + */ +bool lv_scale_get_label_show(lv_obj_t * obj); + +/** + * Get Scale's range in degrees + * @param obj pointer to Scale Widget + * @return Scale's angle_range + */ +uint32_t lv_scale_get_angle_range(lv_obj_t * obj); + +/** + * Get minimum value for Scale + * @param obj pointer to Scale Widget + * @return Scale's minimum value + */ +int32_t lv_scale_get_range_min_value(lv_obj_t * obj); + +/** + * Get maximum value for Scale + * @param obj pointer to Scale Widget + * @return Scale's maximum value + */ +int32_t lv_scale_get_range_max_value(lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +#if LV_USE_OBSERVER + +/** + * Bind an integer subject to a scales section minimum value + * @param obj pointer to a Scale + * @param section pointer to a Scale section + * @param subject pointer to a Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_scale_bind_section_min_value(lv_obj_t * obj, lv_scale_section_t * section, lv_subject_t * subject); + +/** + * Bind an integer subject to a scales section maximum value + * @param obj pointer to an Scale + * @param section pointer to a Scale section + * @param subject pointer to a Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_scale_bind_section_max_value(lv_obj_t * obj, lv_scale_section_t * section, lv_subject_t * subject); + +/** + * Bind an integer subject to a scale's line needle value + * @param obj pointer to a Scale + * @param needle_line pointer to a line needle + * @param needle_length length of the needle + * @param subject pointer to a Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_scale_bind_line_needle_value(lv_obj_t * obj, lv_obj_t * needle_line, int32_t needle_length, + lv_subject_t * subject); + +/** + * Bind an integer subject to a scale's image needle value + * @param obj pointer to a Scale + * @param needle_img pointer to an image needle + * @param subject pointer to a Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_scale_bind_image_needle_value(lv_obj_t * obj, lv_obj_t * needle_img, lv_subject_t * subject); + +#endif + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_SCALE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SCALE_H*/ diff --git a/include/lvgl/widgets/lv_slider.h b/include/lvgl/widgets/lv_slider.h new file mode 100644 index 0000000000..c45a9ae759 --- /dev/null +++ b/include/lvgl/widgets/lv_slider.h @@ -0,0 +1,202 @@ +/** + * @file lv_slider.h + * + */ + +#ifndef LV_SLIDER_H +#define LV_SLIDER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_bar.h" + +#if LV_USE_SLIDER + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_SLIDER_MODE_NORMAL = LV_BAR_MODE_NORMAL, + LV_SLIDER_MODE_SYMMETRICAL = LV_BAR_MODE_SYMMETRICAL, + LV_SLIDER_MODE_RANGE = LV_BAR_MODE_RANGE +} lv_slider_mode_t; + +typedef enum { + LV_SLIDER_ORIENTATION_AUTO = LV_BAR_ORIENTATION_AUTO, + LV_SLIDER_ORIENTATION_HORIZONTAL = LV_BAR_ORIENTATION_HORIZONTAL, + LV_SLIDER_ORIENTATION_VERTICAL = LV_BAR_ORIENTATION_VERTICAL +} lv_slider_orientation_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_slider_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_slider_id_t { + LV_PROPERTY_ID2(SLIDER, VALUE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_BOOL, 0), + LV_PROPERTY_ID2(SLIDER, LEFT_VALUE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_BOOL, 1), + LV_PROPERTY_ID2(SLIDER, RANGE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(SLIDER, MIN_VALUE, LV_PROPERTY_TYPE_INT, 4), + LV_PROPERTY_ID(SLIDER, MAX_VALUE, LV_PROPERTY_TYPE_INT, 5), + LV_PROPERTY_ID(SLIDER, MODE, LV_PROPERTY_TYPE_INT, 6), + LV_PROPERTY_ID(SLIDER, IS_DRAGGED, LV_PROPERTY_TYPE_BOOL, 7), + LV_PROPERTY_ID(SLIDER, IS_SYMMETRICAL, LV_PROPERTY_TYPE_BOOL, 8), + LV_PROPERTY_SLIDER_END, +}; +#endif +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a slider object + * @param parent pointer to an object, it will be the parent of the new slider. + * @return pointer to the created slider + */ +lv_obj_t * lv_slider_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set a new value on the slider + * @param obj pointer to a slider object + * @param value the new value + * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately + */ +void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); + +/** + * Set a new value for the left knob of a slider + * @param obj pointer to a slider object + * @param value new value + * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately + */ +void lv_slider_set_start_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); + +/** + * Set the minimum and the maximum values of a bar + * @param obj pointer to the slider object + * @param min minimum value + * @param max maximum value + */ +void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max); + +/** + * Set the minimum values of a bar + * @param obj pointer to the slider object + * @param min minimum value + */ +void lv_slider_set_min_value(lv_obj_t * obj, int32_t min); + +/** + * Set the maximum values of a bar + * @param obj pointer to the slider object + * @param max maximum value + */ +void lv_slider_set_max_value(lv_obj_t * obj, int32_t max); + +/** + * Set the mode of slider. + * @param obj pointer to a slider object + * @param mode the mode of the slider. See `lv_slider_mode_t` + */ +void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode); + +/** + * Set the orientation of slider. + * @param obj pointer to a slider object + * @param orientation slider orientation from `lv_slider_orientation_t` + */ +void lv_slider_set_orientation(lv_obj_t * obj, lv_slider_orientation_t orientation); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the value of the main knob of a slider + * @param obj pointer to a slider object + * @return the value of the main knob of the slider + */ +int32_t lv_slider_get_value(const lv_obj_t * obj); + +/** + * Get the value of the left knob of a slider + * @param obj pointer to a slider object + * @return the value of the left knob of the slider + */ +int32_t lv_slider_get_left_value(const lv_obj_t * obj); + +/** + * Get the minimum value of a slider + * @param obj pointer to a slider object + * @return the minimum value of the slider + */ +int32_t lv_slider_get_min_value(const lv_obj_t * obj); + +/** + * Get the maximum value of a slider + * @param obj pointer to a slider object + * @return the maximum value of the slider + */ +int32_t lv_slider_get_max_value(const lv_obj_t * obj); + +/** + * Give the slider is being dragged or not + * @param obj pointer to a slider object + * @return true: drag in progress false: not dragged + */ +bool lv_slider_is_dragged(const lv_obj_t * obj); + +/** + * Get the mode of the slider. + * @param slider pointer to a slider object + * @return see `lv_slider_mode_t` + */ +lv_slider_mode_t lv_slider_get_mode(lv_obj_t * slider); + +/** + * Get the orientation of slider. + * @param obj pointer to a slider object + * @return slider orientation from `lv_slider_orientation_t` + */ +lv_slider_orientation_t lv_slider_get_orientation(lv_obj_t * slider); + +/** + * Give the slider is in symmetrical mode or not + * @param obj pointer to slider object + * @return true: in symmetrical mode false : not in +*/ +bool lv_slider_is_symmetrical(lv_obj_t * obj); + + +#if LV_USE_OBSERVER +/** + * Bind an integer or float Subject to a Slider's value. + * @param obj pointer to Slider + * @param subject pointer to Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_slider_bind_value(lv_obj_t * obj, lv_subject_t * subject); +#endif + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_SLIDER*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SLIDER_H*/ diff --git a/include/lvgl/widgets/lv_span.h b/include/lvgl/widgets/lv_span.h new file mode 100644 index 0000000000..5bc5b0cfe4 --- /dev/null +++ b/include/lvgl/widgets/lv_span.h @@ -0,0 +1,377 @@ +/** + * @file lv_span.h + * + */ + +#ifndef LV_SPAN_H +#define LV_SPAN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../core/lv_obj.h" +#include "../core/lv_observer.h" +#include "../core/lv_obj_property.h" + +#if LV_USE_SPAN != 0 + +/********************* + * DEFINES + *********************/ +#ifndef LV_SPAN_SNIPPET_STACK_SIZE +#define LV_SPAN_SNIPPET_STACK_SIZE 64 +#endif + +/********************** + * TYPEDEFS + **********************/ +typedef enum { + LV_SPAN_OVERFLOW_CLIP, + LV_SPAN_OVERFLOW_ELLIPSIS, + LV_SPAN_OVERFLOW_LAST, /**< Fence member*/ +} lv_span_overflow_t; + +typedef enum { + LV_SPAN_MODE_FIXED, /**< fixed the obj size */ + LV_SPAN_MODE_EXPAND, /**< Expand the object size to the text size */ + LV_SPAN_MODE_BREAK, /**< Keep width, break the too long lines and expand height */ + LV_SPAN_MODE_LAST /**< Fence member */ +} lv_span_mode_t; + +/** Coords of a span */ +typedef struct _lv_span_coords_t { + lv_area_t heading; + lv_area_t middle; + lv_area_t trailing; +} lv_span_coords_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spangroup_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_span_id_t { + LV_PROPERTY_ID(SPAN, ALIGN, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(SPAN, OVERFLOW, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_ID(SPAN, INDENT, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(SPAN, MODE, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_ID(SPAN, MAX_LINES, LV_PROPERTY_TYPE_INT, 4), + LV_PROPERTY_SPAN_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +void lv_span_stack_init(void); +void lv_span_stack_deinit(void); + +/** + * Create a spangroup object + * @param parent pointer to an object, it will be the parent of the new spangroup + * @return pointer to the created spangroup + */ +lv_obj_t * lv_spangroup_create(lv_obj_t * parent); + +/** + * Create a span string descriptor and add to spangroup. + * @param obj pointer to a spangroup object. + * @return pointer to the created span. + */ +lv_span_t * lv_spangroup_add_span(lv_obj_t * obj); + +/** + * Remove the span from the spangroup and free memory. + * @param obj pointer to a spangroup object. + * @param span pointer to a span. + * @note Note that before calling `lv_spangroup_delete_span` + * `lv_observer_remove` needs to be called manually as LVGL can't remove the + * binding automatically. + */ +void lv_spangroup_delete_span(lv_obj_t * obj, lv_span_t * span); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set a new text for a span. Memory will be allocated to store the text by the span. + * As the spangroup is not passed a redraw (invalidation) can't be triggered automatically. + * Therefore `lv_spangroup_refresh(spangroup)` needs to be called manually, + * @param span pointer to a span. + * @param text pointer to a text. + */ +void lv_span_set_text(lv_span_t * span, const char * text); + + +/** + * Set a new text for a span using a printf-like formatting string. + * Memory will be allocated to store the text by the span. + * As the spangroup is not passed a redraw (invalidation) can't be triggered automatically. + * Therefore `lv_spangroup_refresh(spangroup)` needs to be called manually, + * @param span pointer to a span. + * @param fmt `printf`-like format string + */ +void lv_span_set_text_fmt(lv_span_t * span, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); + +/** + * Set a static text. It will not be saved by the span so the 'text' variable + * has to be 'alive' while the span exist. + * As the spangroup is not passed a redraw (invalidation) can't be triggered automatically. + * Therefore `lv_spangroup_refresh(spangroup)` needs to be called manually, + * + * @param span pointer to a span. + * @param text pointer to a text. + */ +void lv_span_set_text_static(lv_span_t * span, const char * text); + +/** + * Set a new text for a span. Memory will be allocated to store the text by the span. + * @param obj pointer to a spangroup widget. + * @param span pointer to a span. + * @param text pointer to a text. + */ +void lv_spangroup_set_span_text(lv_obj_t * obj, lv_span_t * span, const char * text); + +/** + * Set a new text for a span. Memory will be allocated to store the text by the span. + * @param obj pointer to a spangroup widget. + * @param span pointer to a span. + * @param text pointer to a text. + */ +void lv_spangroup_set_span_text_static(lv_obj_t * obj, lv_span_t * span, const char * text); + +/** + * Set a new text for a span using a printf-like formatting string. + * Memory will be allocated to store the text by the span. + * @param obj pointer to a spangroup widget. + * @param span pointer to a span. + * @param fmt `printf`-like format string + */ +void lv_spangroup_set_span_text_fmt(lv_obj_t * obj, lv_span_t * span, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(3, 4); + +/** + * Set a static text. It will not be saved by the span so the 'text' variable + * has to be 'alive' while the span exist. + * @param span pointer to a span. + * @param text pointer to a text. + */ +void lv_span_set_text_static(lv_span_t * span, const char * text); + +/** + * Copy all style properties of style to the bbuilt-in static style of the span. + * @param obj pointer_to a spangroup + * @param span pointer to a span. + * @param style pointer to a style to copy into the span's built-in style + */ +void lv_spangroup_set_span_style(lv_obj_t * obj, lv_span_t * span, const lv_style_t * style); + +/** + * DEPRECATED. Use the text_align style property instead + * Set the align of the spangroup. + * @param obj pointer to a spangroup object. + * @param align see lv_text_align_t for details. + */ +void lv_spangroup_set_align(lv_obj_t * obj, lv_text_align_t align); + +/** + * Set the overflow of the spangroup. + * @param obj pointer to a spangroup object. + * @param overflow see lv_span_overflow_t for details. + */ +void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow); + +/** + * Set the indent of the spangroup. + * @param obj pointer to a spangroup object. + * @param indent the first line indentation + */ +void lv_spangroup_set_indent(lv_obj_t * obj, int32_t indent); + +/** + * DEPRECATED, set the width to LV_SIZE_CONTENT or fixed value to control expanding/wrapping" + * Set the mode of the spangroup. + * @param obj pointer to a spangroup object. + * @param mode see lv_span_mode_t for details. + */ +void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode); + +/** + * Set maximum lines of the spangroup. + * @param obj pointer to a spangroup object. + * @param lines max lines that can be displayed in LV_SPAN_MODE_BREAK mode. < 0 means no limit. + */ +void lv_spangroup_set_max_lines(lv_obj_t * obj, int32_t lines); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get a pointer to the style of a span's built-in style. + * Any lv_style_set_... functions can be applied on the returned style. + * @param span pointer to the span + * @return pointer to the style. (valid as long as the span is valid) + */ +lv_style_t * lv_span_get_style(lv_span_t * span); + +/** + * Get a pointer to the text of a span + * @param span pointer to the span + * @return pointer to the text +*/ +const char * lv_span_get_text(lv_span_t * span); + +/** + * Get a spangroup child by its index. + * + * @param obj The spangroup object + * @param id the index of the child. + * 0: the oldest (firstly created) child + * 1: the second oldest + * child count-1: the youngest + * -1: the youngest + * -2: the second youngest + * @return The child span at index `id`, or NULL if the ID does not exist + */ +lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id); + +/** + * Get number of spans + * @param obj the spangroup object to get the child count of. + * @return the span count of the spangroup. + */ +uint32_t lv_spangroup_get_span_count(const lv_obj_t * obj); + +/** + * Get the align of the spangroup. + * @param obj pointer to a spangroup object. + * @return the align value. + */ +lv_text_align_t lv_spangroup_get_align(lv_obj_t * obj); + +/** + * Get the overflow of the spangroup. + * @param obj pointer to a spangroup object. + * @return the overflow value. + */ +lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t * obj); + +/** + * Get the indent of the spangroup. + * @param obj pointer to a spangroup object. + * @return the indent value. + */ +int32_t lv_spangroup_get_indent(lv_obj_t * obj); + +/** + * Get the mode of the spangroup. + * @param obj pointer to a spangroup object. + */ +lv_span_mode_t lv_spangroup_get_mode(lv_obj_t * obj); + +/** + * Get maximum lines of the spangroup. + * @param obj pointer to a spangroup object. + * @return the max lines value. + */ +int32_t lv_spangroup_get_max_lines(lv_obj_t * obj); + +/** + * Get max line height of all span in the spangroup. + * @param obj pointer to a spangroup object. + */ +int32_t lv_spangroup_get_max_line_height(lv_obj_t * obj); + +/** + * Get the text content width when all span of spangroup on a line. + * @param obj pointer to a spangroup object. + * @param max_width if text content width >= max_width, return max_width + * to reduce computation, if max_width == 0, returns the text content width. + * @return text content width or max_width. + */ +uint32_t lv_spangroup_get_expand_width(lv_obj_t * obj, uint32_t max_width); + +/** + * Get the text content height with width fixed. + * @param obj pointer to a spangroup object. + * @param width the width of the span group. + + */ +int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width); + +/** + * Get the span's coords in the spangroup. + * @note Before calling this function, please make sure that the layout of span group has been updated. + * Like calling lv_obj_update_layout() like function. + * + * +--------+ + * |Heading +--->------------------+ + * | Pos | | Heading | + * +--------+---+------------------+ + * | | + * | | + * | | + * | Middle +--------+| + * | |Trailing|| + * | +-| Pos || + * | | +--------+| + * +-------------------v-----------+ + * | Trailing | + * +-------------------+ + * @param obj pointer to a spangroup object. + * @param span pointer to a span. + * @return the span's coords in the spangroup. + */ +lv_span_coords_t lv_spangroup_get_span_coords(lv_obj_t * obj, const lv_span_t * span); + +/** + * Get the span object by point. + * @param obj pointer to a spangroup object. + * @param point pointer to point containing absolute coordinates + * @return pointer to the span under the point or `NULL` if not found. + */ +lv_span_t * lv_spangroup_get_span_by_point(lv_obj_t * obj, const lv_point_t * point); + +/*===================== + * Other functions + *====================*/ + +/** + * Update the mode of the spangroup. + * @param obj pointer to a spangroup object. + */ +void lv_spangroup_refresh(lv_obj_t * obj); + +#if LV_USE_OBSERVER + +/** + * Bind an integer, string, or pointer Subject to a Spangroup's Span. + * @param obj pointer to Spangroup + * @param span pointer to Span + * @param subject pointer to Subject + * @param fmt optional printf-like format string with 1 format specifier (e.g. "%d °C") + * or NULL to bind to the value directly. + * @return pointer to newly-created Observer + * @note If `fmt == NULL` strings and pointers (`\0` terminated string) will be shown + * as text as they are, integers as %d, floats as %0.1f + */ +lv_observer_t * lv_spangroup_bind_span_text(lv_obj_t * obj, lv_span_t * span, lv_subject_t * subject, const char * fmt); + +#endif + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_SPAN*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_SPAN_H*/ diff --git a/include/lvgl/widgets/lv_spinbox.h b/include/lvgl/widgets/lv_spinbox.h new file mode 100644 index 0000000000..7760cf3c12 --- /dev/null +++ b/include/lvgl/widgets/lv_spinbox.h @@ -0,0 +1,248 @@ +/** + * @file lv_spinbox.h + * + */ + +#ifndef LV_SPINBOX_H +#define LV_SPINBOX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_textarea.h" + +#if LV_USE_SPINBOX + +/********************* + * DEFINES + *********************/ +#define LV_SPINBOX_MAX_DIGIT_COUNT 10 + +/********************** + * TYPEDEFS + **********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spinbox_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_spinbox_id_t { + LV_PROPERTY_ID(SPINBOX, VALUE, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(SPINBOX, ROLLOVER, LV_PROPERTY_TYPE_BOOL, 1), + LV_PROPERTY_ID(SPINBOX, DIGIT_COUNT, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(SPINBOX, DEC_POINT_POS, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_ID(SPINBOX, STEP, LV_PROPERTY_TYPE_INT, 4), + LV_PROPERTY_ID(SPINBOX, MIN_VALUE, LV_PROPERTY_TYPE_INT, 5), + LV_PROPERTY_ID(SPINBOX, MAX_VALUE, LV_PROPERTY_TYPE_INT, 6), + LV_PROPERTY_ID(SPINBOX, DIGIT_STEP_DIRECTION, LV_PROPERTY_TYPE_INT, 7), + LV_PROPERTY_SPINBOX_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a spinbox object + * @param parent pointer to an object, it will be the parent of the new spinbox + * @return pointer to the created spinbox + */ +lv_obj_t * lv_spinbox_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set spinbox value + * @param obj pointer to spinbox + * @param v value to be set + */ +void lv_spinbox_set_value(lv_obj_t * obj, int32_t v); + +/** + * Set spinbox rollover function + * @param obj pointer to spinbox + * @param rollover true or false to enable or disable (default) + */ +void lv_spinbox_set_rollover(lv_obj_t * obj, bool rollover); + +/** + * Set spinbox digit format (digit count and decimal format) + * @param obj pointer to spinbox + * @param digit_count number of digit excluding the decimal separator and the sign + * @param sep_pos number of digit before the decimal point. If 0, decimal point is not + * shown + */ +void lv_spinbox_set_digit_format(lv_obj_t * obj, uint32_t digit_count, uint32_t sep_pos); + +/** + * Set the number of digits + * @param obj pointer to spinbox + * @param digit_count number of digits + */ +void lv_spinbox_set_digit_count(lv_obj_t * obj, uint32_t digit_count); + +/** + * Set the position of the decimal point + * @param obj pointer to spinbox + * @param dec_point_pos 0: there is no separator, 2: two integer digits + */ +void lv_spinbox_set_dec_point_pos(lv_obj_t * obj, uint32_t dec_point_pos); + +/** + * Set spinbox step + * @param obj pointer to spinbox + * @param step steps on increment/decrement. Can be 1, 10, 100, 1000, etc the digit that will change. + */ +void lv_spinbox_set_step(lv_obj_t * obj, uint32_t step); + +/** + * Set spinbox value range + * @param obj pointer to spinbox + * @param min_value minimum value, inclusive + * @param max_value maximum value, inclusive + */ +void lv_spinbox_set_range(lv_obj_t * obj, int32_t min_value, int32_t max_value); + +/** + * Set the minimum value + * @param obj pointer to spinbox + * @param min_value the minimum value + */ +void lv_spinbox_set_min_value(lv_obj_t * obj, int32_t min_value); + +/** + * Set the maximum value + * @param obj pointer to spinbox + * @param max_value the maximum value + */ +void lv_spinbox_set_max_value(lv_obj_t * obj, int32_t max_value); + +/** + * Set cursor position to a specific digit for edition + * @param obj pointer to spinbox + * @param pos selected position in spinbox + */ +void lv_spinbox_set_cursor_pos(lv_obj_t * obj, uint32_t pos); + +/** + * Set direction of digit step when clicking an encoder button while in editing mode + * @param obj pointer to spinbox + * @param direction the direction (LV_DIR_RIGHT or LV_DIR_LEFT) + */ +void lv_spinbox_set_digit_step_direction(lv_obj_t * obj, lv_dir_t direction); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get spinbox rollover function status + * @param obj pointer to spinbox + */ +bool lv_spinbox_get_rollover(lv_obj_t * obj); + +/** + * Get the spinbox numeral value (user has to convert to float according to its digit format) + * @param obj pointer to spinbox + * @return value integer value of the spinbox + */ +int32_t lv_spinbox_get_value(lv_obj_t * obj); + +/** + * Get the spinbox step value (user has to convert to float according to its digit format) + * @param obj pointer to spinbox + * @return value integer step value of the spinbox + */ +int32_t lv_spinbox_get_step(lv_obj_t * obj); + +/** + * Get the spinbox digit count + * @param obj pointer to spinbox + * @return number of digits + */ +uint32_t lv_spinbox_get_digit_count(lv_obj_t * obj); + +/** + * Get the decimal point position + * @param obj pointer to spinbox + * @return decimal point position + */ +uint32_t lv_spinbox_get_dec_point_pos(lv_obj_t * obj); + +/** + * Get the spinbox minimum value + * @param obj pointer to spinbox + * @return minimum value + */ +int32_t lv_spinbox_get_min_value(lv_obj_t * obj); + +/** + * Get the spinbox maximum value + * @param obj pointer to spinbox + * @return maximum value + */ +int32_t lv_spinbox_get_max_value(lv_obj_t * obj); + +/** + * Get the digit step direction + * @param obj pointer to spinbox + * @return direction (LV_DIR_RIGHT or LV_DIR_LEFT) + */ +lv_dir_t lv_spinbox_get_digit_step_direction(lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +/** + * Select next lower digit for edition by dividing the step by 10 + * @param obj pointer to spinbox + */ +void lv_spinbox_step_next(lv_obj_t * obj); + +/** + * Select next higher digit for edition by multiplying the step by 10 + * @param obj pointer to spinbox + */ +void lv_spinbox_step_prev(lv_obj_t * obj); + +/** + * Increment spinbox value by one step + * @param obj pointer to spinbox + */ +void lv_spinbox_increment(lv_obj_t * obj); + +/** + * Decrement spinbox value by one step + * @param obj pointer to spinbox + */ +void lv_spinbox_decrement(lv_obj_t * obj); + + + +#if LV_USE_OBSERVER +/** + * Bind an integer subject to a Spinbox's value. + * @param obj pointer to Spinbox + * @param subject pointer to Subject + * @return pointer to newly-created Observer + */ +lv_observer_t * lv_spinbox_bind_value(lv_obj_t * obj, lv_subject_t * subject); +#endif + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_SPINBOX*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif +#endif /*LV_SPINBOX_H*/ diff --git a/include/lvgl/widgets/lv_spinner.h b/include/lvgl/widgets/lv_spinner.h new file mode 100644 index 0000000000..cb4a1e263d --- /dev/null +++ b/include/lvgl/widgets/lv_spinner.h @@ -0,0 +1,99 @@ +/** + * @file lv_spinner.h + * + */ + +#ifndef LV_SPINNER_H +#define LV_SPINNER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_SPINNER + +#include "../lv_types.h" +#include "../core/lv_obj_property.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spinner_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_spinner_id_t { + LV_PROPERTY_ID(SPINNER, ANIM_DURATION, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(SPINNER, ARC_SWEEP, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_SPINNER_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a spinner widget + * @param parent pointer to an object, it will be the parent of the new spinner. + * @return the created spinner + */ +lv_obj_t * lv_spinner_create(lv_obj_t * parent); + +/** + * Set the animation time and arc length of the spinner + * The animation is suited for angle values between 180 and 360. + * @param obj pointer to a spinner + * @param t the animation time in milliseconds + * @param angle the angle of the arc in degrees + */ +void lv_spinner_set_anim_params(lv_obj_t * obj, uint32_t t, uint32_t angle); + +/** + * Set the animation time of the spinner + * @param obj pointer to a spinner + * @param t the animation time in milliseconds + */ +void lv_spinner_set_anim_duration(lv_obj_t * obj, uint32_t t); + +/** + * Set the animation arc length of the spinner. + * The animation is suited to values between 180 and 360. + * @param obj pointer to a spinner + * @param angle the angle of the arc in degrees + */ +void lv_spinner_set_arc_sweep(lv_obj_t * obj, uint32_t angle); + +/** + * Get the animation duration of the spinner + * @param obj pointer to a spinner + * @return the animation time in milliseconds + */ +uint32_t lv_spinner_get_anim_duration(lv_obj_t * obj); + +/** + * Get the animation arc length of the spinner + * @param obj pointer to a spinner + * @return the angle of the arc in degrees + */ +uint32_t lv_spinner_get_arc_sweep(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_SPINNER*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SPINNER_H*/ diff --git a/include/lvgl/widgets/lv_switch.h b/include/lvgl/widgets/lv_switch.h new file mode 100644 index 0000000000..b5d9181505 --- /dev/null +++ b/include/lvgl/widgets/lv_switch.h @@ -0,0 +1,91 @@ +/** + * @file lv_switch.h + * + */ + +#ifndef LV_SWITCH_H +#define LV_SWITCH_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" + +#if LV_USE_SWITCH != 0 + +#include "../core/lv_obj.h" + +/********************* + * DEFINES + *********************/ + +/** Switch knob extra area correction factor */ +#define LV_SWITCH_KNOB_EXT_AREA_CORRECTION 2 + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_switch_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_switch_id_t { + LV_PROPERTY_ID(SWITCH, ORIENTATION, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_SWITCH_END, +}; +#endif + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_SWITCH_ORIENTATION_AUTO, + LV_SWITCH_ORIENTATION_HORIZONTAL, + LV_SWITCH_ORIENTATION_VERTICAL +} lv_switch_orientation_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a switch object + * @param parent pointer to an object, it will be the parent of the new switch + * @return pointer to the created switch + */ +lv_obj_t * lv_switch_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the orientation of switch. + * @param obj pointer to switch object + * @param orientation switch orientation from `lv_switch_orientation_t` + */ +void lv_switch_set_orientation(lv_obj_t * obj, lv_switch_orientation_t orientation); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the orientation of switch. + * @param obj pointer to switch object + * @return switch orientation from ::lv_switch_orientation_t + */ +lv_switch_orientation_t lv_switch_get_orientation(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_SWITCH*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SWITCH_H*/ diff --git a/include/lvgl/widgets/lv_table.h b/include/lvgl/widgets/lv_table.h new file mode 100644 index 0000000000..a2bfc3e28a --- /dev/null +++ b/include/lvgl/widgets/lv_table.h @@ -0,0 +1,224 @@ +/** + * @file lv_table.h + * + */ + +#ifndef LV_TABLE_H +#define LV_TABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_label.h" +#include "../core/lv_obj_property.h" + +#if LV_USE_TABLE != 0 + +/*Testing of dependencies*/ +#if LV_USE_LABEL == 0 +#error "lv_table: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" +#endif + +/********************* + * DEFINES + *********************/ +#define LV_TABLE_CELL_NONE 0XFFFF +LV_EXPORT_CONST_INT(LV_TABLE_CELL_NONE); + +/********************** + * TYPEDEFS + **********************/ + +typedef enum { + LV_TABLE_CELL_CTRL_NONE = 0 << 0, + LV_TABLE_CELL_CTRL_MERGE_RIGHT = 1 << 0, + LV_TABLE_CELL_CTRL_TEXT_CROP = 1 << 1, + LV_TABLE_CELL_CTRL_CUSTOM_1 = 1 << 4, + LV_TABLE_CELL_CTRL_CUSTOM_2 = 1 << 5, + LV_TABLE_CELL_CTRL_CUSTOM_3 = 1 << 6, + LV_TABLE_CELL_CTRL_CUSTOM_4 = 1 << 7, +} lv_table_cell_ctrl_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_table_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_table_id_t { + LV_PROPERTY_ID(TABLE, ROW_COUNT, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(TABLE, COLUMN_COUNT, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_TABLE_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a table object + * @param parent pointer to an object, it will be the parent of the new table + * @return pointer to the created table + */ +lv_obj_t * lv_table_create(lv_obj_t * parent); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the value of a cell. + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + * @param txt text to display in the cell. It will be copied and saved so this variable is not required after this function call. + * @note New roes/columns are added automatically if required + */ +void lv_table_set_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col, const char * txt); + +/** + * Set the value of a cell. Memory will be allocated to store the text by the table. + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + * @param fmt `printf`-like format + * @note New roes/columns are added automatically if required + */ +void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint32_t row, uint32_t col, const char * fmt, + ...) LV_FORMAT_ATTRIBUTE(4, 5); + +/** + * Set the number of rows + * @param obj table pointer to a Table object + * @param row_cnt number of rows + */ +void lv_table_set_row_count(lv_obj_t * obj, uint32_t row_cnt); + +/** + * Set the number of columns + * @param obj table pointer to a Table object + * @param col_cnt number of columns. + */ +void lv_table_set_column_count(lv_obj_t * obj, uint32_t col_cnt); + +/** + * Set the width of a column + * @param obj table pointer to a Table object + * @param col_id id of the column [0 .. LV_TABLE_COL_MAX -1] + * @param w width of the column + */ +void lv_table_set_column_width(lv_obj_t * obj, uint32_t col_id, int32_t w); + +/** + * Add control bits to the cell. + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + * @param ctrl OR-ed values from ::lv_table_cell_ctrl_t + */ +void lv_table_set_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl); + +/** + * Clear control bits of the cell. + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + * @param ctrl OR-ed values from ::lv_table_cell_ctrl_t + */ +void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl); + +/** + * Add custom user data to the cell. + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + * @param user_data pointer to the new user_data. + * Should be allocated by `lv_malloc`, + * and it will be freed automatically when the table is deleted or + * when the cell is dropped due to lower row or column count. + */ +void lv_table_set_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col, void * user_data); + +/** + * Set the selected cell + * @param obj pointer to a table object + * @param row id of the cell row to select + * @param col id of the cell column to select + */ +void lv_table_set_selected_cell(lv_obj_t * obj, uint16_t row, uint16_t col); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the value of a cell. + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + * @return text in the cell + */ +const char * lv_table_get_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col); + +/** + * Get the number of rows. + * @param obj table pointer to a Table object + * @return number of rows. + */ +uint32_t lv_table_get_row_count(lv_obj_t * obj); + +/** + * Get the number of columns. + * @param obj table pointer to a Table object + * @return number of columns. + */ +uint32_t lv_table_get_column_count(lv_obj_t * obj); + +/** + * Get the width of a column + * @param obj table pointer to a Table object + * @param col id of the column [0 .. LV_TABLE_COL_MAX -1] + * @return width of the column + */ +int32_t lv_table_get_column_width(lv_obj_t * obj, uint32_t col); + +/** + * Get whether a cell has the control bits + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + * @param ctrl OR-ed values from ::lv_table_cell_ctrl_t + * @return true: all control bits are set; false: not all control bits are set + */ +bool lv_table_has_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl); + +/** + * Get the selected cell (pressed and or focused) + * @param obj pointer to a table object + * @param row pointer to variable to store the selected row (LV_TABLE_CELL_NONE: if no cell selected) + * @param col pointer to variable to store the selected column (LV_TABLE_CELL_NONE: if no cell selected) + */ +void lv_table_get_selected_cell(lv_obj_t * obj, uint32_t * row, uint32_t * col); + +/** + * Get custom user data to the cell. + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + */ +void * lv_table_get_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TABLE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TABLE_H*/ diff --git a/include/lvgl/widgets/lv_tabview.h b/include/lvgl/widgets/lv_tabview.h new file mode 100644 index 0000000000..5742a8736f --- /dev/null +++ b/include/lvgl/widgets/lv_tabview.h @@ -0,0 +1,152 @@ +/** + * @file lv_tabview.h + * + */ + +#ifndef LV_TABVIEW_H +#define LV_TABVIEW_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../core/lv_obj.h" +#include "../core/lv_obj_property.h" + +#if LV_USE_TABVIEW + +/********************* + * DEFINES + *********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tabview_class; + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_tabview_id_t { + LV_PROPERTY_ID(TABVIEW, TAB_ACTIVE, LV_PROPERTY_TYPE_INT, 0), + LV_PROPERTY_ID(TABVIEW, TAB_BAR_POSITION, LV_PROPERTY_TYPE_INT, 1), + LV_PROPERTY_TABVIEW_END, +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a tabview widget + * @param parent pointer to a parent widget + * @return the created tabview + */ +lv_obj_t * lv_tabview_create(lv_obj_t * parent); + +/** + * Add a tab to the tabview + * @param obj pointer to a tabview widget + * @param name the name of the tab, it will be displayed on the tab bar + * @return the widget where the content of the tab can be created + */ +lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name); + +/** + * Change the name of the tab + * @param obj pointer to a tabview widget + * @param idx the index of the tab to rename + * @param new_name the new name as a string + */ +void lv_tabview_set_tab_text(lv_obj_t * obj, uint32_t idx, const char * new_name); + +#if LV_USE_TRANSLATION + +/** + * Add a tab with a translation tag to the tabview. + * @param obj pointer to a tabview widget + * @param tag translation key used for the tab label; will be displayed on the tab bar + * @return the widget where the content of the tab can be created + */ +lv_obj_t * lv_tabview_set_tab_translation_tag(lv_obj_t * obj, const char * tag); + +#endif + +/** + * Show a tab + * @param obj pointer to a tabview widget + * @param idx the index of the tab to show + * @param anim_en LV_ANIM_ON/OFF + */ +void lv_tabview_set_active(lv_obj_t * obj, uint32_t idx, lv_anim_enable_t anim_en); + +/** + * Set the position of the tab bar + * @param obj pointer to a tabview widget + * @param dir LV_DIR_TOP/BOTTOM/LEFT/RIGHT + */ +void lv_tabview_set_tab_bar_position(lv_obj_t * obj, lv_dir_t dir); + +/** + * Set the width or height of the tab bar + * @param obj pointer to tabview widget + * @param size size of the tab bar in pixels or percentage. + * will be used as width or height based on the position of the tab bar) + */ +void lv_tabview_set_tab_bar_size(lv_obj_t * obj, int32_t size); + +/** + * Get the number of tabs + * @param obj pointer to a tabview widget + * @return the number of tabs + */ +uint32_t lv_tabview_get_tab_count(lv_obj_t * obj); + +/** + * Get the current tab's index + * @param obj pointer to a tabview widget + * @return the zero based index of the current tab + */ +uint32_t lv_tabview_get_tab_active(lv_obj_t * obj); + +/** + * Get a given tab button by index + * @param obj pointer to a tabview widget + * @param idx zero based index of the tab button to get. + * < 0 means start counting tab button from the back (-1 is the last tab button) + * @return pointer to the tab button, or NULL if the index was out of range + */ +lv_obj_t * lv_tabview_get_tab_button(lv_obj_t * obj, int32_t idx); + +/** + * Get the widget where the container of each tab is created + * @param obj pointer to a tabview widget + * @return the main container widget + */ +lv_obj_t * lv_tabview_get_content(lv_obj_t * obj); + +/** + * Get the tab bar where the buttons are created + * @param obj pointer to a tabview widget + * @return the tab bar + */ +lv_obj_t * lv_tabview_get_tab_bar(lv_obj_t * obj); + +/** + * Get the position of the tab bar + * @param obj pointer to a tabview widget + * @return LV_DIR_TOP/BOTTOM/LEFT/RIGHT + */ +lv_dir_t lv_tabview_get_tab_bar_position(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TABVIEW*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TABVIEW_H*/ diff --git a/include/lvgl/widgets/lv_textarea.h b/include/lvgl/widgets/lv_textarea.h new file mode 100644 index 0000000000..e7703f5269 --- /dev/null +++ b/include/lvgl/widgets/lv_textarea.h @@ -0,0 +1,357 @@ +/** + * @file lv_textarea.h + * + */ + +#ifndef LV_TEXTAREA_H +#define LV_TEXTAREA_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_label.h" + +#if LV_USE_TEXTAREA != 0 + +/*Testing of dependencies*/ +#if LV_USE_LABEL == 0 +#error "lv_textarea: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" +#endif + +/********************* + * DEFINES + *********************/ +#define LV_TEXTAREA_CURSOR_LAST (0x7FFF) /*Put the cursor after the last character*/ +LV_EXPORT_CONST_INT(LV_TEXTAREA_CURSOR_LAST); + +#define LV_PART_TEXTAREA_PLACEHOLDER LV_PART_CUSTOM_FIRST +LV_EXPORT_CONST_INT(LV_PART_TEXTAREA_PLACEHOLDER); + +/********************** + * TYPEDEFS + **********************/ + +#if LV_USE_OBJ_PROPERTY +enum _lv_property_textarea_id_t { + LV_PROPERTY_ID(TEXTAREA, TEXT, LV_PROPERTY_TYPE_TEXT, 0), + LV_PROPERTY_ID(TEXTAREA, PLACEHOLDER_TEXT, LV_PROPERTY_TYPE_TEXT, 1), + LV_PROPERTY_ID(TEXTAREA, CURSOR_POS, LV_PROPERTY_TYPE_INT, 2), + LV_PROPERTY_ID(TEXTAREA, CURSOR_CLICK_POS, LV_PROPERTY_TYPE_INT, 3), + LV_PROPERTY_ID(TEXTAREA, PASSWORD_MODE, LV_PROPERTY_TYPE_INT, 4), + LV_PROPERTY_ID(TEXTAREA, PASSWORD_BULLET, LV_PROPERTY_TYPE_TEXT, 5), + LV_PROPERTY_ID(TEXTAREA, ONE_LINE, LV_PROPERTY_TYPE_BOOL, 6), + LV_PROPERTY_ID(TEXTAREA, ACCEPTED_CHARS, LV_PROPERTY_TYPE_TEXT, 7), + LV_PROPERTY_ID(TEXTAREA, MAX_LENGTH, LV_PROPERTY_TYPE_INT, 8), + LV_PROPERTY_ID(TEXTAREA, TEXT_SELECTION, LV_PROPERTY_TYPE_BOOL, 9), + LV_PROPERTY_ID(TEXTAREA, PASSWORD_SHOW_TIME, LV_PROPERTY_TYPE_INT, 10), + LV_PROPERTY_ID(TEXTAREA, LABEL, LV_PROPERTY_TYPE_OBJ, 11), + LV_PROPERTY_ID(TEXTAREA, TEXT_IS_SELECTED, LV_PROPERTY_TYPE_INT, 12), + LV_PROPERTY_ID(TEXTAREA, CURRENT_CHAR, LV_PROPERTY_TYPE_INT, 13), + LV_PROPERTY_TEXTAREA_END, +}; +#endif + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_textarea_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a text area object + * @param parent pointer to an object, it will be the parent of the new text area + * @return pointer to the created text area + */ +lv_obj_t * lv_textarea_create(lv_obj_t * parent); + +/*====================== + * Add/remove functions + *=====================*/ + +/** + * Insert a character to the current cursor position. + * To add a wide char, e.g. 'Á' use `lv_text_encoded_conv_wc('Á')` + * @param obj pointer to a text area object + * @param c a character (e.g. 'a') + */ +void lv_textarea_add_char(lv_obj_t * obj, uint32_t c); + +/** + * Insert a text to the current cursor position + * @param obj pointer to a text area object + * @param txt a '\0' terminated string to insert + */ +void lv_textarea_add_text(lv_obj_t * obj, const char * txt); + +/** + * Delete a the left character from the current cursor position + * @param obj pointer to a text area object + */ +void lv_textarea_delete_char(lv_obj_t * obj); + +/** + * Delete the right character from the current cursor position + * @param obj pointer to a text area object + */ +void lv_textarea_delete_char_forward(lv_obj_t * obj); + +/*===================== + * Setter functions + *====================*/ + +/** + * Set the text of a text area + * @param obj pointer to a text area object + * @param txt pointer to the text + */ +void lv_textarea_set_text(lv_obj_t * obj, const char * txt); + +/** + * Set the placeholder text of a text area + * @param obj pointer to a text area object + * @param txt pointer to the text + */ +void lv_textarea_set_placeholder_text(lv_obj_t * obj, const char * txt); + +/** + * Set the cursor position + * @param obj pointer to a text area object + * @param pos the new cursor position in character index + * < 0 : index from the end of the text + * LV_TEXTAREA_CURSOR_LAST: go after the last character + */ +void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos); + +/** + * Enable/Disable the positioning of the cursor by clicking the text on the text area. + * @param obj pointer to a text area object + * @param en true: enable click positions; false: disable + */ +void lv_textarea_set_cursor_click_pos(lv_obj_t * obj, bool en); + +/** + * Enable/Disable password mode + * @param obj pointer to a text area object + * @param en true: enable, false: disable + */ +void lv_textarea_set_password_mode(lv_obj_t * obj, bool en); + +/** + * Set the replacement characters to show in password mode + * @param obj pointer to a text area object + * @param bullet pointer to the replacement text + */ +void lv_textarea_set_password_bullet(lv_obj_t * obj, const char * bullet); + +/** + * Configure the text area to one line or back to normal + * @param obj pointer to a text area object + * @param en true: one line, false: normal + */ +void lv_textarea_set_one_line(lv_obj_t * obj, bool en); + +/** + * Set a list of characters. Only these characters will be accepted by the text area + * @param obj pointer to a text area object + * @param list list of characters. A copy is saved. Example: "+-.,0123456789" + */ +void lv_textarea_set_accepted_chars(lv_obj_t * obj, const char * list); + +/** + * Set a list of characters. Only these characters will be accepted by the text area + * @param obj pointer to a text area object + * @param list list of characters. Only the pointer is saved. Example: "+-.,0123456789" + */ +void lv_textarea_set_accepted_chars_static(lv_obj_t * obj, const char * list); + +/** + * Set max length of a Text Area. + * @param obj pointer to a text area object + * @param num the maximal number of characters can be added (`lv_textarea_set_text` ignores it) + */ +void lv_textarea_set_max_length(lv_obj_t * obj, uint32_t num); + +/** + * In `LV_EVENT_INSERT` the text which planned to be inserted can be replaced by another text. + * It can be used to add automatic formatting to the text area. + * @param obj pointer to a text area object + * @param txt pointer to a new string to insert. If `""` no text will be added. + * The variable must be live after the `event_cb` exists. (Should be `global` or `static`) + */ +void lv_textarea_set_insert_replace(lv_obj_t * obj, const char * txt); + +/** + * Enable/disable selection mode. + * @param obj pointer to a text area object + * @param en true or false to enable/disable selection mode + */ +void lv_textarea_set_text_selection(lv_obj_t * obj, bool en); + +/** + * Set how long show the password before changing it to '*' + * @param obj pointer to a text area object + * @param time show time in milliseconds. 0: hide immediately. + */ +void lv_textarea_set_password_show_time(lv_obj_t * obj, uint32_t time); + +/** + * @deprecated Use the normal text_align style property instead + * Set the label's alignment. + * It sets where the label is aligned (in one line mode it can be smaller than the text area) + * and how the lines of the area align in case of multiline text area + * @param obj pointer to a text area object + * @param align the align mode from ::lv_text_align_t + */ +void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align); + +/*===================== + * Getter functions + *====================*/ + +/** + * Get the text of a text area. In password mode it gives the real text (not '*'s). + * @param obj pointer to a text area object + * @return pointer to the text + */ +const char * lv_textarea_get_text(const lv_obj_t * obj); + +/** + * Get the placeholder text of a text area + * @param obj pointer to a text area object + * @return pointer to the text + */ +const char * lv_textarea_get_placeholder_text(lv_obj_t * obj); + +/** + * Get the label of a text area + * @param obj pointer to a text area object + * @return pointer to the label object + */ +lv_obj_t * lv_textarea_get_label(const lv_obj_t * obj); + +/** + * Get the current cursor position in character index + * @param obj pointer to a text area object + * @return the cursor position + */ +uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * obj); + +/** + * Get whether the cursor click positioning is enabled or not. + * @param obj pointer to a text area object + * @return true: enable click positions; false: disable + */ +bool lv_textarea_get_cursor_click_pos(lv_obj_t * obj); + +/** + * Get the password mode attribute + * @param obj pointer to a text area object + * @return true: password mode is enabled, false: disabled + */ +bool lv_textarea_get_password_mode(const lv_obj_t * obj); + +/** + * Get the replacement characters to show in password mode + * @param obj pointer to a text area object + * @return pointer to the replacement text + */ +const char * lv_textarea_get_password_bullet(lv_obj_t * obj); + +/** + * Get the one line configuration attribute + * @param obj pointer to a text area object + * @return true: one line configuration is enabled, false: disabled + */ +bool lv_textarea_get_one_line(const lv_obj_t * obj); + +/** + * Get a list of accepted characters. + * @param obj pointer to a text area object + * @return list of accented characters. + */ +const char * lv_textarea_get_accepted_chars(lv_obj_t * obj); + +/** + * Get max length of a Text Area. + * @param obj pointer to a text area object + * @return the maximal number of characters to be add + */ +uint32_t lv_textarea_get_max_length(lv_obj_t * obj); + +/** + * Find whether text is selected or not. + * @param obj pointer to a text area object + * @return whether text is selected or not + */ +bool lv_textarea_text_is_selected(const lv_obj_t * obj); + +/** + * Find whether selection mode is enabled. + * @param obj pointer to a text area object + * @return true: selection mode is enabled, false: disabled + */ +bool lv_textarea_get_text_selection(lv_obj_t * obj); + +/** + * Set how long show the password before changing it to '*' + * @param obj pointer to a text area object + * @return show time in milliseconds. 0: hide immediately. + */ +uint32_t lv_textarea_get_password_show_time(lv_obj_t * obj); + +/** + * Get a the character from the current cursor position + * @param obj pointer to a text area object + * @return a the character or 0 + */ +uint32_t lv_textarea_get_current_char(lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +/** + * Clear the selection on the text area. + * @param obj pointer to a text area object + */ +void lv_textarea_clear_selection(lv_obj_t * obj); + +/** + * Move the cursor one character right + * @param obj pointer to a text area object + */ +void lv_textarea_cursor_right(lv_obj_t * obj); + +/** + * Move the cursor one character left + * @param obj pointer to a text area object + */ +void lv_textarea_cursor_left(lv_obj_t * obj); + +/** + * Move the cursor one line down + * @param obj pointer to a text area object + */ +void lv_textarea_cursor_down(lv_obj_t * obj); + +/** + * Move the cursor one line up + * @param obj pointer to a text area object + */ +void lv_textarea_cursor_up(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TEXTAREA_H*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEXTAREA_H*/ diff --git a/include/lvgl/widgets/lv_tileview.h b/include/lvgl/widgets/lv_tileview.h new file mode 100644 index 0000000000..d68aa628cc --- /dev/null +++ b/include/lvgl/widgets/lv_tileview.h @@ -0,0 +1,86 @@ +/** + * @file lv_tileview.h + * + */ + +#ifndef LV_TILEVIEW_H +#define LV_TILEVIEW_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../core/lv_obj.h" + +#if LV_USE_TILEVIEW + +/********************* + * DEFINES + *********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_class; +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_tile_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a tileview object + * @param parent pointer to an object, it will be the parent of the new tileview + * @return pointer to the created tileview + */ +lv_obj_t * lv_tileview_create(lv_obj_t * parent); + +/** + * Add a tile to the tileview + * @param tv pointer to the tileview object + * @param col_id column id of the tile + * @param row_id row id of the tile + * @param dir direction to move to the next tile + * @return pointer to the added tile object + */ +lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, lv_dir_t dir); + +/** + * Set the active tile in the tileview. + * @param parent pointer to the tileview object + * @param tile_obj pointer to the tile object to be set as active + * @param anim_en animation enable flag (LV_ANIM_ON or LV_ANIM_OFF) + */ +void lv_tileview_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_en); + +/** + * Set the active tile by index in the tileview + * @param tv pointer to the tileview object + * @param col_id column id of the tile to be set as active + * @param row_id row id of the tile to be set as active + * @param anim_en animation enable flag (LV_ANIM_ON or LV_ANIM_OFF) + */ +void lv_tileview_set_tile_by_index(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en); + +/** + * Get the currently active tile in the tileview + * @param obj pointer to the tileview object + * @return pointer to the currently active tile object + */ +lv_obj_t * lv_tileview_get_tile_active(lv_obj_t * obj); + +/*===================== + * Other functions + *====================*/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TILEVIEW*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TILEVIEW_H*/ diff --git a/include/lvgl/widgets/lv_win.h b/include/lvgl/widgets/lv_win.h new file mode 100644 index 0000000000..ac440f4d9f --- /dev/null +++ b/include/lvgl/widgets/lv_win.h @@ -0,0 +1,74 @@ +/** + * @file lv_win.h + * + */ + +#ifndef LV_WIN_H +#define LV_WIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../config/lv_conf_internal.h" +#include "../core/lv_obj.h" +#if LV_USE_WIN +/********************* + * DEFINES + *********************/ + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_win_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a window widget + * @param parent pointer to a parent widget + * @return the created window + */ +lv_obj_t * lv_win_create(lv_obj_t * parent); + +/** + * Add a title to the window + * @param obj pointer to a window widget + * @param txt the text of the title + * @return the widget where the content of the title can be created + */ +lv_obj_t * lv_win_add_title(lv_obj_t * win, const char * txt); + +/** + * Add a button to the window + * @param obj pointer to a window widget + * @param icon an icon to be displayed on the button + * @param btn_w width of the button + * @return the widget where the content of the button can be created + */ +lv_obj_t * lv_win_add_button(lv_obj_t * win, const void * icon, int32_t btn_w); + +/** + * Get the header of the window + * @param win pointer to a window widget + * @return the header of the window + */ +lv_obj_t * lv_win_get_header(lv_obj_t * win); + +/** + * Get the content of the window + * @param win pointer to a window widget + * @return the content of the window + */ +lv_obj_t * lv_win_get_content(lv_obj_t * win); +/********************** + * MACROS + **********************/ +#endif /*LV_USE_WIN*/ +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_WIN_H*/ diff --git a/lv_version.h b/lv_version.h index f22718ae5b..329c89e829 100644 --- a/lv_version.h +++ b/lv_version.h @@ -1,14 +1,2 @@ -/** - * @file lv_version.h - * The current version of LVGL - */ - -#ifndef LV_VERSION_H -#define LV_VERSION_H - -#define LVGL_VERSION_MAJOR 9 -#define LVGL_VERSION_MINOR 6 -#define LVGL_VERSION_PATCH 0 -#define LVGL_VERSION_INFO "dev" - -#endif /* LV_VERSION_H */ +#warning This file is deprecated, you can include `lv_version.h` from ` set[str]: """Scan LVGL headers to find all typedef enum and int-like alias type names.""" result = set() - for h in LVGL_SRC.rglob("*.h"): + headers = list(LVGL_SRC.rglob("*.h")) + list(LVGL_INC.rglob("*.h")) + for h in headers: text = h.read_text(errors="ignore") # typedef enum { ... } lv_xxx_t; for m in re.finditer( diff --git a/scripts/lv_conf_internal_gen.py b/scripts/lv_conf_internal_gen.py index f48a8df718..88a9e4be94 100755 --- a/scripts/lv_conf_internal_gen.py +++ b/scripts/lv_conf_internal_gen.py @@ -10,7 +10,7 @@ import re SCRIPT_DIR = os.path.dirname(__file__) LV_CONF_TEMPLATE = os.path.join(SCRIPT_DIR, "..", "lv_conf_template.h") -LV_CONF_INTERNAL = os.path.join(SCRIPT_DIR, "..", "src", "lv_conf_internal.h") +LV_CONF_INTERNAL = os.path.join(SCRIPT_DIR, "..", "include", "lvgl", "config", "lv_conf_internal.h") if sys.version_info < (3,6,0): print("Python >=3.6 is required", file=sys.stderr) diff --git a/scripts/properties.py b/scripts/properties.py index 6087ffdc56..20b71a24d1 100755 --- a/scripts/properties.py +++ b/scripts/properties.py @@ -115,9 +115,10 @@ def read_widget_properties(directory): return properties_by_widget -def write_widget_properties(output, properties_by_widget): +def write_widget_properties(root_folder, properties_by_widget): # Open header file for update. - with open(f'{output}/lv_obj_property_names.h', "w") as header: + pub_header = os.path.join(root_folder, 'include', 'lvgl', 'core', 'lv_obj_property_names.h') + with open(pub_header, "w") as header: header.write(f''' /** * @file lv_obj_property_names.h @@ -126,7 +127,7 @@ def write_widget_properties(output, properties_by_widget): #ifndef LV_OBJ_PROPERTY_NAMES_H #define LV_OBJ_PROPERTY_NAMES_H -#include "../../misc/lv_types.h" +#include "../lv_types.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME @@ -135,18 +136,15 @@ def write_widget_properties(output, properties_by_widget): for widget in sorted(properties_by_widget.keys()): properties = properties_by_widget[widget] file_name = f'lv_{widget}_properties.c' - output_file = f'{output}/{file_name}' + output_file = os.path.join(root_folder, 'src', 'widgets', 'property', file_name) count = len(properties) - if widget == 'style': - include = "lv_style_properties.h" - guard = None - elif widget == "obj": - include = "../../core/lv_obj.h" - guard = None - else: - include = f'../{widget}/lv_{widget}.h' + if widget != 'style' and widget != 'obj': guard = f"#if LV_USE_{widget.upper()}" + else: + guard = None + + include = "../../lv_public_api.h" with open(output_file, 'w') as f: f.write(f''' @@ -185,12 +183,12 @@ const lv_property_name_t lv_{widget}_property_names[{count}] = {{ header.write('#endif\n') -def write_style_header(output, properties_by_widget): +def write_style_header(root_folder, properties_by_widget): properties = properties_by_widget['style'] - output_file = f'{output}/lv_style_properties.h' + header = os.path.join(root_folder, 'include', 'lvgl', 'core', 'lv_style_properties.h') - with open(output_file, 'w') as f: + with open(header, 'w') as f: f.write(f''' /** * GENERATED FILE, DO NOT EDIT IT! @@ -199,7 +197,7 @@ def write_style_header(output, properties_by_widget): #ifndef LV_STYLE_PROPERTIES_H #define LV_STYLE_PROPERTIES_H -#include "../../core/lv_obj_property.h" +#include "../config/lv_conf_internal.h" #if LV_USE_OBJ_PROPERTY @@ -220,11 +218,11 @@ enum _lv_property_style_id_t {{ f.write('#endif\n') -def main(directory, output): +def main(directory): """Generate property names""" property = read_widget_properties(directory) - write_widget_properties(output, property) - write_style_header(output, property) + write_widget_properties(directory, property) + write_style_header(directory, property) if __name__ == "__main__": @@ -232,18 +230,15 @@ if __name__ == "__main__": description='Search files and filter lines.') parser.add_argument('-d', '--directory', help='Directory to lvgl root path') - parser.add_argument( - '-o', '--output', help='Folders to write generated properties for all widgets.') args = parser.parse_args() # default directory is the lvgl root path of where this script sits if args.directory is None: args.directory = os.path.join(os.path.dirname(__file__), "../") - if args.output is None: - args.output = os.path.join(args.directory, "src/widgets/property/") - + property_folder = os.path.join(args.directory, 'src', 'widgets', 'property') + # create output directory if it doesn't exist - os.makedirs(args.output, exist_ok=True) + os.makedirs(property_folder, exist_ok=True) - main(args.directory, args.output) + main(args.directory) diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index 78d8f4642f..342fd731a6 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 """ Generate these 5 files: -- lvgl/src/core/lv_obj_style_gen.h +- lvgl/include/lvgl/core/lv_obj_style_gen.h +- lvgl/include/lvgl/core/lv_style_gen.h - lvgl/src/core/lv_obj_style_gen.c - lvgl/src/misc/lv_style_gen.c -- lvgl/src/misc/lv_style_gen.h - lvgl/docs/src/common-widget-features/styles/style-properties.rst This script effectively "factors out" what would be duplicate code and @@ -939,7 +939,7 @@ def guard_close(): # ------------------------------------------------------------------------- base_dir = os.path.abspath(os.path.dirname(__file__)) orig_stdout = sys.stdout -sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.h', 'w') +sys.stdout = open(base_dir + '/../include/lvgl/core/lv_obj_style_gen.h', 'w') print(HEADING) print('#ifndef LV_OBJ_STYLE_GEN_H') @@ -950,10 +950,10 @@ print('''\ extern "C" { #endif ''') -print('#include "../misc/lv_area.h"') -print('#include "../misc/lv_style.h"') -print('#include "../core/lv_obj_style.h"') -print('#include "../misc/lv_types.h"') +print('#include "lv_area.h"') +print('#include "lv_style.h"') +print('#include "lv_obj_style.h"') +print('#include "../lv_types.h"') print() guard = "" @@ -984,7 +984,7 @@ print('#endif /* LV_OBJ_STYLE_GEN_H */') sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.c', 'w') print(HEADING) -print('#include "lv_obj.h"') +print('#include "../lv_public_api.h"') print() for prop in props: @@ -998,7 +998,7 @@ guard_close() sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.c', 'w') print(HEADING) -print('#include "lv_style.h"') +print('#include "../lv_public_api.h"') print() for prop in props: @@ -1009,7 +1009,7 @@ guard_close() # ------------------------------------------------------------------------- # lv_style_gen.h # ------------------------------------------------------------------------- -sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.h', 'w') +sys.stdout = open(base_dir + '/../include/lvgl/core/lv_style_gen.h', 'w') print(HEADING) print('#ifndef LV_STYLE_GEN_H') diff --git a/src/core/lv_global.h b/src/core/lv_global.h index 769528a2bd..a552ca8fac 100644 --- a/src/core/lv_global.h +++ b/src/core/lv_global.h @@ -13,33 +13,18 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "../lv_public_api.h" -#include "../misc/lv_types.h" -#include "../draw/lv_draw.h" #if LV_USE_DRAW_SW #include "../draw/sw/lv_draw_sw.h" #endif -#include "../misc/lv_anim.h" -#include "../misc/lv_area.h" -#include "../misc/lv_color_op.h" -#include "../misc/lv_ll.h" -#include "../misc/lv_log.h" -#include "../misc/lv_style.h" -#include "../misc/lv_timer.h" #include "../osal/lv_os_private.h" -#include "../debugging/sysmon/lv_sysmon.h" #include "../stdlib/builtin/lv_tlsf.h" #if LV_USE_FONT_COMPRESSED #include "../font/fmt_txt/lv_font_fmt_txt_private.h" #endif -#include "../tick/lv_tick.h" -#include "../layouts/lv_layout.h" - -#include "../misc/lv_types.h" - #include "../misc/lv_timer_private.h" #include "../misc/lv_anim_private.h" #include "../tick/lv_tick_private.h" diff --git a/src/core/lv_group.c b/src/core/lv_group.c index 37fe493638..15bdcfafbc 100644 --- a/src/core/lv_group.c +++ b/src/core/lv_group.c @@ -9,8 +9,6 @@ #include "lv_group_private.h" #include "../core/lv_obj_private.h" #include "../core/lv_global.h" -#include "../indev/lv_indev.h" -#include "../misc/lv_types.h" /********************* * DEFINES diff --git a/src/core/lv_group.h b/src/core/lv_group.h index 0fe1a2f3f4..bfcfe30c22 100644 --- a/src/core/lv_group.h +++ b/src/core/lv_group.h @@ -1,278 +1,2 @@ -/** - * @file lv_group.h - * - */ - -#ifndef LV_GROUP_H -#define LV_GROUP_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -#include "../misc/lv_types.h" -#include "../misc/lv_ll.h" - -/********************* - * DEFINES - *********************/ -/** Predefined keys to control which Widget has focus via lv_group_send(group, c) */ -typedef enum { - LV_KEY_UP = 17, /*0x11*/ - LV_KEY_DOWN = 18, /*0x12*/ - LV_KEY_RIGHT = 19, /*0x13*/ - LV_KEY_LEFT = 20, /*0x14*/ - LV_KEY_ESC = 27, /*0x1B*/ - LV_KEY_DEL = 127, /*0x7F*/ - LV_KEY_BACKSPACE = 8, /*0x08*/ - LV_KEY_ENTER = 10, /*0x0A, '\n'*/ - LV_KEY_NEXT = 9, /*0x09, '\t'*/ - LV_KEY_PREV = 11, /*0x0B, '*/ - LV_KEY_HOME = 2, /*0x02, STX*/ - LV_KEY_END = 3, /*0x03, ETX*/ -} lv_key_t; - -/********************** - * TYPEDEFS - **********************/ - -typedef void (*lv_group_focus_cb_t)(lv_group_t *); -typedef void (*lv_group_edge_cb_t)(lv_group_t *, bool); - -typedef enum { - LV_GROUP_REFOCUS_POLICY_NEXT = 0, - LV_GROUP_REFOCUS_POLICY_PREV = 1 -} lv_group_refocus_policy_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create new Widget group. - * @return pointer to the new Widget group - */ -lv_group_t * lv_group_create(void); - -/** - * Delete group object. - * @param group pointer to a group - */ -void lv_group_delete(lv_group_t * group); - -/** - * Set default group. New Widgets will be added to this group if it's enabled in - * their class with `add_to_def_group = true`. - * @param group pointer to a group (can be `NULL`) - */ -void lv_group_set_default(lv_group_t * group); - -/** - * Get default group. - * @return pointer to the default group - */ -lv_group_t * lv_group_get_default(void); - -/** - * Add an Widget to group. - * @param group pointer to a group - * @param obj pointer to a Widget to add - */ -void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj); - -/** - * Swap 2 Widgets in group. Widgets must be in the same group. - * @param obj1 pointer to a Widget - * @param obj2 pointer to another Widget - */ -void lv_group_swap_obj(lv_obj_t * obj1, lv_obj_t * obj2); - -/** - * Remove a Widget from its group. - * @param obj pointer to Widget to remove - */ -void lv_group_remove_obj(lv_obj_t * obj); - -/** - * Remove all Widgets from a group. - * @param group pointer to a group - */ -void lv_group_remove_all_objs(lv_group_t * group); - -/** - * Focus on a Widget (defocus the current). - * @param obj pointer to Widget to focus on - */ -void lv_group_focus_obj(lv_obj_t * obj); - -/** - * Focus on next Widget in a group (defocus the current). - * @param group pointer to a group - */ -void lv_group_focus_next(lv_group_t * group); - -/** - * Focus on previous Widget in a group (defocus the current). - * @param group pointer to a group - */ -void lv_group_focus_prev(lv_group_t * group); - -/** - * Do not allow changing focus from current Widget. - * @param group pointer to a group - * @param en true: freeze, false: release freezing (normal mode) - */ -void lv_group_focus_freeze(lv_group_t * group, bool en); - -/** - * Send a control character to Widget that has focus in a group. - * @param group pointer to a group - * @param c a character (use LV_KEY_.. to navigate) - * @return result of Widget with focus in group. - */ -lv_result_t lv_group_send_data(lv_group_t * group, uint32_t c); - -/** - * Set a function for a group which will be called when a new Widget has focus. - * @param group pointer to a group - * @param focus_cb the call back function or NULL if unused - */ -void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb); - -/** - * Set a function for a group which will be called when a focus edge is reached - * @param group pointer to a group - * @param edge_cb the call back function or NULL if unused - */ -void lv_group_set_edge_cb(lv_group_t * group, lv_group_edge_cb_t edge_cb); - -/** - * Set whether the next or previous Widget in a group gets focus when Widget that has - * focus is deleted. - * @param group pointer to a group - * @param policy new refocus policy enum - */ -void lv_group_set_refocus_policy(lv_group_t * group, lv_group_refocus_policy_t policy); - -/** - * Manually set the current mode (edit or navigate). - * @param group pointer to group - * @param edit true: edit mode; false: navigate mode - */ -void lv_group_set_editing(lv_group_t * group, bool edit); - -/** - * Set whether moving focus to next/previous Widget will allow wrapping from - * first->last or last->first Widget. - * @param group pointer to group - * @param en true: wrapping enabled; false: wrapping disabled - */ -void lv_group_set_wrap(lv_group_t * group, bool en); - -/** - * Get Widget that has focus, or NULL if there isn't one. - * @param group pointer to a group - * @return pointer to Widget with focus - */ -lv_obj_t * lv_group_get_focused(const lv_group_t * group); - -/** - * Get focus callback function of a group. - * @param group pointer to a group - * @return the call back function or NULL if not set - */ -lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group); - -/** - * Get edge callback function of a group. - * @param group pointer to a group - * @return the call back function or NULL if not set - */ -lv_group_edge_cb_t lv_group_get_edge_cb(const lv_group_t * group); - -/** - * Get current mode (edit or navigate). - * @param group pointer to group - * @return true: edit mode; false: navigate mode - */ -bool lv_group_get_editing(const lv_group_t * group); - -/** - * Get whether moving focus to next/previous Widget will allow wrapping from - * first->last or last->first Widget. - * @param group pointer to group - */ -bool lv_group_get_wrap(lv_group_t * group); - -/** - * Get number of Widgets in group. - * @param group pointer to a group - * @return number of Widgets in the group - */ -uint32_t lv_group_get_obj_count(lv_group_t * group); - -/** - * Get nth Widget within group. - * @param group pointer to a group - * @param index index of Widget within the group - * @return pointer to Widget - */ -lv_obj_t * lv_group_get_obj_by_index(lv_group_t * group, uint32_t index); - -/** - * Get the number of groups. - * @return number of groups - */ -uint32_t lv_group_get_count(void); - -/** - * Get a group by its index. - * @param index index of the group - * @return pointer to the group - */ -lv_group_t * lv_group_by_index(uint32_t index); - -#if LV_USE_EXT_DATA -/** - * @brief Attaches external user data and destructor callback to a group - * - * Associates custom user data with an LVGL group and specifies a destructor function - * that will be automatically invoked when the group is deleted to properly clean up - * the associated resources. - * - * @param group Pointer to a group - * @param data User-defined data pointer to associate with a group - * @param free_cb Callback function for cleaning up ext_data when group is deleted. - * Receives ext_data as parameter. NULL means no cleanup required. - */ -void lv_group_set_external_data(lv_group_t * group, void * data, void (* free_cb)(void * data)); -#endif - -/** - * Set user data to the group - * @param group pointer to a group - * @param user_data pointer to user data - */ -void lv_group_set_user_data(lv_group_t * group, void * user_data); - -/** - * Get a pointer to the user data of the group - * @param indev pointer to a group - * @return pointer to the user data or NULL if group is NULL - */ -void * lv_group_get_user_data(const lv_group_t * group); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_GROUP_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_group_private.h b/src/core/lv_group_private.h index 77ed90e34e..8eeedb2ea3 100644 --- a/src/core/lv_group_private.h +++ b/src/core/lv_group_private.h @@ -13,8 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../misc/lv_ext_data.h" -#include "lv_group.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 368454173a..091037ad73 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -12,20 +12,8 @@ #include "lv_obj_style_private.h" #include "lv_obj_event_private.h" #include "lv_obj_class_private.h" -#include "../indev/lv_indev.h" #include "../indev/lv_indev_private.h" -#include "lv_refr.h" -#include "lv_group.h" -#include "../display/lv_display.h" #include "../display/lv_display_private.h" -#include "../themes/lv_theme.h" -#include "../misc/lv_assert.h" -#include "../misc/lv_math.h" -#include "../misc/lv_log.h" -#include "../misc/lv_types.h" -#include "../misc/lv_anim_timeline.h" -#include "../tick/lv_tick.h" -#include "../stdlib/lv_string.h" #include "lv_obj_draw_private.h" /********************* diff --git a/src/core/lv_obj.h b/src/core/lv_obj.h index 00c80630c0..f6af3ee234 100644 --- a/src/core/lv_obj.h +++ b/src/core/lv_obj.h @@ -1,495 +1,2 @@ -/** - * @file lv_obj.h - * - */ - -#ifndef LV_OBJ_H -#define LV_OBJ_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -#include "../misc/lv_types.h" -#include "../misc/lv_style.h" -#include "../misc/lv_area.h" -#include "../misc/lv_color.h" -#include "../misc/lv_assert.h" - -#include "lv_obj_tree.h" -#include "lv_obj_pos.h" -#include "lv_obj_scroll.h" -#include "lv_obj_style.h" -#include "lv_obj_draw.h" -#include "lv_obj_class.h" -#include "lv_obj_event.h" -#include "lv_obj_property.h" -#include "lv_group.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -/** - * On/Off features controlling the object's behavior. - * OR-ed values are possible - * - * Note: update obj flags corresponding properties below - * whenever add/remove flags or change bit definition of flags. - */ -typedef enum { - LV_OBJ_FLAG_HIDDEN = (1u << 0), /**< Make the object hidden. (Like it wasn't there at all)*/ - LV_OBJ_FLAG_CLICKABLE = (1u << 1), /**< Make the object clickable by the input devices*/ - LV_OBJ_FLAG_CLICK_FOCUSABLE = (1u << 2), /**< Add focused state to the object when clicked*/ - LV_OBJ_FLAG_CHECKABLE = (1u << 3), /**< Toggle checked state when the object is clicked*/ - LV_OBJ_FLAG_SCROLLABLE = (1u << 4), /**< Make the object scrollable*/ - LV_OBJ_FLAG_SCROLL_ELASTIC = (1u << 5), /**< Allow scrolling inside but with slower speed*/ - LV_OBJ_FLAG_SCROLL_MOMENTUM = (1u << 6), /**< Make the object scroll further when "thrown"*/ - LV_OBJ_FLAG_SCROLL_ONE = (1u << 7), /**< Allow scrolling only one snappable children*/ - LV_OBJ_FLAG_SCROLL_CHAIN_HOR = (1u << 8), /**< Allow propagating the horizontal scroll to a parent*/ - LV_OBJ_FLAG_SCROLL_CHAIN_VER = (1u << 9), /**< Allow propagating the vertical scroll to a parent*/ - LV_OBJ_FLAG_SCROLL_CHAIN = (LV_OBJ_FLAG_SCROLL_CHAIN_HOR | LV_OBJ_FLAG_SCROLL_CHAIN_VER), - LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1u << 10), /**< Automatically scroll object to make it visible when focused*/ - LV_OBJ_FLAG_SCROLL_WITH_ARROW = (1u << 11), /**< Allow scrolling the focused object with arrow keys*/ - LV_OBJ_FLAG_SNAPPABLE = (1u << 12), /**< If scroll snap is enabled on the parent it can snap to this object*/ - LV_OBJ_FLAG_PRESS_LOCK = (1u << 13), /**< Keep the object pressed even if the press slid from the object*/ - LV_OBJ_FLAG_EVENT_BUBBLE = (1u << 14), /**< Propagate the events to the parent too*/ - LV_OBJ_FLAG_GESTURE_BUBBLE = (1u << 15), /**< Propagate the gestures to the parent*/ - LV_OBJ_FLAG_ADV_HITTEST = (1u << 16), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/ - LV_OBJ_FLAG_IGNORE_LAYOUT = (1u << 17), /**< Make the object not positioned by the layouts*/ - LV_OBJ_FLAG_FLOATING = (1u << 18), /**< Do not scroll the object when the parent scrolls and ignore layout*/ - LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS = (1u << 19), /**< Send `LV_EVENT_DRAW_TASK_ADDED` events*/ - LV_OBJ_FLAG_OVERFLOW_VISIBLE = (1u << 20),/**< Do not clip the children to the parent's ext draw size*/ - LV_OBJ_FLAG_EVENT_TRICKLE = (1u << 21), /**< Propagate the events to the children too*/ - LV_OBJ_FLAG_STATE_TRICKLE = (1u << 22), /**< Propagate the states to the children too*/ - - LV_OBJ_FLAG_LAYOUT_1 = (1u << 23), /**< Custom flag, free to use by layouts*/ - LV_OBJ_FLAG_LAYOUT_2 = (1u << 24), /**< Custom flag, free to use by layouts*/ -#if LV_USE_FLEX - LV_OBJ_FLAG_FLEX_IN_NEW_TRACK = LV_OBJ_FLAG_LAYOUT_1, /**< Start a new flex track on this item*/ -#endif - - LV_OBJ_FLAG_WIDGET_1 = (1u << 25), /**< Custom flag, free to use by widget*/ - LV_OBJ_FLAG_WIDGET_2 = (1u << 26), /**< Custom flag, free to use by widget*/ - LV_OBJ_FLAG_USER_1 = (1u << 27), /**< Custom flag, free to use by user*/ - LV_OBJ_FLAG_USER_2 = (1u << 28), /**< Custom flag, free to use by user*/ - LV_OBJ_FLAG_USER_3 = (1u << 29), /**< Custom flag, free to use by user*/ - LV_OBJ_FLAG_USER_4 = (1u << 30), /**< Custom flag, free to use by user*/ -} lv_obj_flag_t; - -#if LV_USE_OBJ_PROPERTY -enum _lv_signed_prop_id_t { - /*OBJ flag properties */ - LV_PROPERTY_ID(OBJ, FLAG_START, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(OBJ, FLAG_HIDDEN, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(OBJ, FLAG_CLICKABLE, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(OBJ, FLAG_CLICK_FOCUSABLE, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(OBJ, FLAG_CHECKABLE, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_ID(OBJ, FLAG_SCROLLABLE, LV_PROPERTY_TYPE_INT, 4), - LV_PROPERTY_ID(OBJ, FLAG_SCROLL_ELASTIC, LV_PROPERTY_TYPE_INT, 5), - LV_PROPERTY_ID(OBJ, FLAG_SCROLL_MOMENTUM, LV_PROPERTY_TYPE_INT, 6), - LV_PROPERTY_ID(OBJ, FLAG_SCROLL_ONE, LV_PROPERTY_TYPE_INT, 7), - LV_PROPERTY_ID(OBJ, FLAG_SCROLL_CHAIN_HOR, LV_PROPERTY_TYPE_INT, 8), - LV_PROPERTY_ID(OBJ, FLAG_SCROLL_CHAIN_VER, LV_PROPERTY_TYPE_INT, 9), - LV_PROPERTY_ID(OBJ, FLAG_SCROLL_ON_FOCUS, LV_PROPERTY_TYPE_INT, 10), - LV_PROPERTY_ID(OBJ, FLAG_SCROLL_WITH_ARROW, LV_PROPERTY_TYPE_INT, 11), - LV_PROPERTY_ID(OBJ, FLAG_SNAPPABLE, LV_PROPERTY_TYPE_INT, 12), - LV_PROPERTY_ID(OBJ, FLAG_PRESS_LOCK, LV_PROPERTY_TYPE_INT, 13), - LV_PROPERTY_ID(OBJ, FLAG_EVENT_BUBBLE, LV_PROPERTY_TYPE_INT, 14), - LV_PROPERTY_ID(OBJ, FLAG_GESTURE_BUBBLE, LV_PROPERTY_TYPE_INT, 15), - LV_PROPERTY_ID(OBJ, FLAG_ADV_HITTEST, LV_PROPERTY_TYPE_INT, 16), - LV_PROPERTY_ID(OBJ, FLAG_IGNORE_LAYOUT, LV_PROPERTY_TYPE_INT, 17), - LV_PROPERTY_ID(OBJ, FLAG_FLOATING, LV_PROPERTY_TYPE_INT, 18), - LV_PROPERTY_ID(OBJ, FLAG_SEND_DRAW_TASK_EVENTS, LV_PROPERTY_TYPE_INT, 19), - LV_PROPERTY_ID(OBJ, FLAG_OVERFLOW_VISIBLE, LV_PROPERTY_TYPE_INT, 20), - LV_PROPERTY_ID(OBJ, FLAG_EVENT_TRICKLE, LV_PROPERTY_TYPE_INT, 21), - LV_PROPERTY_ID(OBJ, FLAG_STATE_TRICKLE, LV_PROPERTY_TYPE_INT, 22), - LV_PROPERTY_ID(OBJ, FLAG_LAYOUT_1, LV_PROPERTY_TYPE_INT, 23), - LV_PROPERTY_ID(OBJ, FLAG_LAYOUT_2, LV_PROPERTY_TYPE_INT, 24), - LV_PROPERTY_ID(OBJ, FLAG_FLEX_IN_NEW_TRACK, LV_PROPERTY_TYPE_INT, 23), /*Mapped to FLAG_LAYOUT_1*/ - LV_PROPERTY_ID(OBJ, FLAG_WIDGET_1, LV_PROPERTY_TYPE_INT, 25), - LV_PROPERTY_ID(OBJ, FLAG_WIDGET_2, LV_PROPERTY_TYPE_INT, 26), - LV_PROPERTY_ID(OBJ, FLAG_USER_1, LV_PROPERTY_TYPE_INT, 27), - LV_PROPERTY_ID(OBJ, FLAG_USER_2, LV_PROPERTY_TYPE_INT, 28), - LV_PROPERTY_ID(OBJ, FLAG_USER_3, LV_PROPERTY_TYPE_INT, 29), - LV_PROPERTY_ID(OBJ, FLAG_USER_4, LV_PROPERTY_TYPE_INT, 30), - LV_PROPERTY_ID(OBJ, FLAG_END, LV_PROPERTY_TYPE_INT, 30), - - LV_PROPERTY_ID(OBJ, STATE_START, LV_PROPERTY_TYPE_INT, 31), - LV_PROPERTY_ID(OBJ, STATE_ALT, LV_PROPERTY_TYPE_INT, 31), - /*1 reserved*/ - LV_PROPERTY_ID(OBJ, STATE_CHECKED, LV_PROPERTY_TYPE_INT, 33), - LV_PROPERTY_ID(OBJ, STATE_FOCUSED, LV_PROPERTY_TYPE_INT, 34), - LV_PROPERTY_ID(OBJ, STATE_FOCUS_KEY, LV_PROPERTY_TYPE_INT, 35), - LV_PROPERTY_ID(OBJ, STATE_EDITED, LV_PROPERTY_TYPE_INT, 36), - LV_PROPERTY_ID(OBJ, STATE_HOVERED, LV_PROPERTY_TYPE_INT, 37), - LV_PROPERTY_ID(OBJ, STATE_PRESSED, LV_PROPERTY_TYPE_INT, 38), - LV_PROPERTY_ID(OBJ, STATE_SCROLLED, LV_PROPERTY_TYPE_INT, 39), - LV_PROPERTY_ID(OBJ, STATE_DISABLED, LV_PROPERTY_TYPE_INT, 40), - /*2 reserved*/ - LV_PROPERTY_ID(OBJ, STATE_USER_1, LV_PROPERTY_TYPE_INT, 43), - LV_PROPERTY_ID(OBJ, STATE_USER_2, LV_PROPERTY_TYPE_INT, 44), - LV_PROPERTY_ID(OBJ, STATE_USER_3, LV_PROPERTY_TYPE_INT, 45), - LV_PROPERTY_ID(OBJ, STATE_USER_4, LV_PROPERTY_TYPE_INT, 46), - LV_PROPERTY_ID(OBJ, STATE_ANY, LV_PROPERTY_TYPE_INT, 47), - LV_PROPERTY_ID(OBJ, STATE_END, LV_PROPERTY_TYPE_INT, 47), - - /*OBJ normal properties*/ - LV_PROPERTY_ID(OBJ, PARENT, LV_PROPERTY_TYPE_OBJ, 48), - LV_PROPERTY_ID(OBJ, X, LV_PROPERTY_TYPE_INT, 49), - LV_PROPERTY_ID(OBJ, Y, LV_PROPERTY_TYPE_INT, 50), - LV_PROPERTY_ID(OBJ, W, LV_PROPERTY_TYPE_INT, 51), - LV_PROPERTY_ID(OBJ, H, LV_PROPERTY_TYPE_INT, 52), - LV_PROPERTY_ID(OBJ, CONTENT_WIDTH, LV_PROPERTY_TYPE_INT, 53), - LV_PROPERTY_ID(OBJ, CONTENT_HEIGHT, LV_PROPERTY_TYPE_INT, 54), - LV_PROPERTY_ID(OBJ, LAYOUT, LV_PROPERTY_TYPE_INT, 55), - LV_PROPERTY_ID(OBJ, ALIGN, LV_PROPERTY_TYPE_INT, 56), - LV_PROPERTY_ID(OBJ, SCROLLBAR_MODE, LV_PROPERTY_TYPE_INT, 57), - LV_PROPERTY_ID(OBJ, SCROLL_DIR, LV_PROPERTY_TYPE_INT, 58), - LV_PROPERTY_ID(OBJ, SCROLL_SNAP_X, LV_PROPERTY_TYPE_INT, 59), - LV_PROPERTY_ID(OBJ, SCROLL_SNAP_Y, LV_PROPERTY_TYPE_INT, 60), - LV_PROPERTY_ID(OBJ, SCROLL_X, LV_PROPERTY_TYPE_INT, 61), - LV_PROPERTY_ID(OBJ, SCROLL_Y, LV_PROPERTY_TYPE_INT, 62), - LV_PROPERTY_ID(OBJ, SCROLL_TOP, LV_PROPERTY_TYPE_INT, 63), - LV_PROPERTY_ID(OBJ, SCROLL_BOTTOM, LV_PROPERTY_TYPE_INT, 64), - LV_PROPERTY_ID(OBJ, SCROLL_LEFT, LV_PROPERTY_TYPE_INT, 65), - LV_PROPERTY_ID(OBJ, SCROLL_RIGHT, LV_PROPERTY_TYPE_INT, 66), - LV_PROPERTY_ID(OBJ, SCROLL_END, LV_PROPERTY_TYPE_POINT, 67), - LV_PROPERTY_ID(OBJ, EXT_DRAW_SIZE, LV_PROPERTY_TYPE_INT, 68), - LV_PROPERTY_ID(OBJ, EVENT_COUNT, LV_PROPERTY_TYPE_INT, 69), - LV_PROPERTY_ID(OBJ, SCREEN, LV_PROPERTY_TYPE_OBJ, 70), - LV_PROPERTY_ID(OBJ, DISPLAY, LV_PROPERTY_TYPE_POINTER, 71), - LV_PROPERTY_ID(OBJ, CHILD_COUNT, LV_PROPERTY_TYPE_INT, 72), - LV_PROPERTY_ID(OBJ, INDEX, LV_PROPERTY_TYPE_INT, 73), - - LV_PROPERTY_OBJ_END, -}; -#endif - -/** - * Make the base object's class publicly available. - */ -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_obj_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a base object (a rectangle) - * @param parent pointer to a parent object. If NULL then a screen will be created. - * @return pointer to the new object - */ -lv_obj_t * lv_obj_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set one or more flags - * @param obj pointer to an object - * @param f OR-ed values from `lv_obj_flag_t` to set. - */ -void lv_obj_add_flag(lv_obj_t * obj, lv_obj_flag_t f); - -/** - * Remove one or more flags - * @param obj pointer to an object - * @param f OR-ed values from `lv_obj_flag_t` to clear. - */ -void lv_obj_remove_flag(lv_obj_t * obj, lv_obj_flag_t f); - -/** - * Set add or remove one or more flags. - * @param obj pointer to an object - * @param f OR-ed values from `lv_obj_flag_t` to update. - * @param v true: add the flags; false: remove the flags - */ -void lv_obj_set_flag(lv_obj_t * obj, lv_obj_flag_t f, bool v); - -/** - * Add one or more states to the object. The other state bits will remain unchanged. - * If specified in the styles, transition animation will be started from the previous state to the current. - * @param obj pointer to an object - * @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED` - */ -void lv_obj_add_state(lv_obj_t * obj, lv_state_t state); - -/** - * Remove one or more states to the object. The other state bits will remain unchanged. - * If specified in the styles, transition animation will be started from the previous state to the current. - * @param obj pointer to an object - * @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED` - */ -void lv_obj_remove_state(lv_obj_t * obj, lv_state_t state); - -/** - * Add or remove one or more states to the object. The other state bits will remain unchanged. - * @param obj pointer to an object - * @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED` - * @param v true: add the states; false: remove the states - */ -void lv_obj_set_state(lv_obj_t * obj, lv_state_t state, bool v); - -/** - * Set the user_data field of the object - * @param obj pointer to an object - * @param user_data pointer to the new user_data. - */ -void lv_obj_set_user_data(lv_obj_t * obj, void * user_data); - - -/** Allow only one RADIO_BUTTON sibling to be checked - * @param obj pointer to a widget - * @param en enable or disable radio button behavior - */ -void lv_obj_set_radio_button(lv_obj_t * obj, bool en); - -/*======================= - * Getter functions - *======================*/ - -/** - * Check if a given flag or all the given flags are set on an object. - * @param obj pointer to an object - * @param f the flag(s) to check (OR-ed values can be used) - * @return true: all flags are set; false: not all flags are set - */ -bool lv_obj_has_flag(const lv_obj_t * obj, lv_obj_flag_t f); - -/** - * Check if a given flag or any of the flags are set on an object. - * @param obj pointer to an object - * @param f the flag(s) to check (OR-ed values can be used) - * @return true: at least one flag is set; false: none of the flags are set - */ -bool lv_obj_has_flag_any(const lv_obj_t * obj, lv_obj_flag_t f); - -/** - * Get the state of an object - * @param obj pointer to an object - * @return the state (OR-ed values from `lv_state_t`) - */ -lv_state_t lv_obj_get_state(const lv_obj_t * obj); - -/** - * Check if the object is in a given state or not. - * @param obj pointer to an object - * @param state a state or combination of states to check - * @return true: `obj` is in `state`; false: `obj` is not in `state` - */ -bool lv_obj_has_state(const lv_obj_t * obj, lv_state_t state); - -/** Get whether the object is a radio button - * @param obj pointer to a widget - * @return true if radio button behavior is enabled - */ -bool lv_obj_is_radio_button(const lv_obj_t * obj); - -/** - * Get the group of the object - * @param obj pointer to an object - * @return the pointer to group of the object - */ -lv_group_t * lv_obj_get_group(const lv_obj_t * obj); - -/** - * Get the user_data field of the object - * @param obj pointer to an object - * @return the pointer to the user_data of the object - */ -void * lv_obj_get_user_data(lv_obj_t * obj); - -/*======================= - * Other functions - *======================*/ - -/** - * Check the type of obj. - * @param obj pointer to an object - * @param class_p a class to check (e.g. `lv_slider_class`) - * @return true: `class_p` is the `obj` class. - */ -bool lv_obj_check_type(const lv_obj_t * obj, const lv_obj_class_t * class_p); - -/** - * Check if any object has a given class (type). - * It checks the ancestor classes too. - * @param obj pointer to an object - * @param class_p a class to check (e.g. `lv_slider_class`) - * @return true: `obj` has the given class - */ -bool lv_obj_has_class(const lv_obj_t * obj, const lv_obj_class_t * class_p); - -/** - * Get the class (type) of the object - * @param obj pointer to an object - * @return the class (type) of the object - */ -const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj); - -/** - * Check if any object is still "alive". - * @param obj pointer to an object - * @return true: valid - */ -bool lv_obj_is_valid(const lv_obj_t * obj); - -/** - * Utility to set an object reference to NULL when it gets deleted. - * The reference should be in a location that will not become invalid - * during the object's lifetime, i.e. static or allocated. - * @param obj_ptr a pointer to a pointer to an object - */ -void lv_obj_null_on_delete(lv_obj_t ** obj_ptr); - -/** - * Add an event handler to a widget that will load a screen on a trigger. - * @param obj pointer to widget which should load the screen - * @param trigger an event code, e.g. `LV_EVENT_CLICKED` - * @param screen the screen to load (must be a valid widget) - * @param anim_type element of `lv_screen_load_anim_t` the screen load animation - * @param duration duration of the animation in milliseconds - * @param delay delay before the screen load in milliseconds - */ -void lv_obj_add_screen_load_event(lv_obj_t * obj, lv_event_code_t trigger, lv_obj_t * screen, - lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay); - -/** - * Add an event handler to a widget that will create a screen on a trigger. - * The created screen will be deleted when it's unloaded - * @param obj pointer to widget which should load the screen - * @param trigger an event code, e.g. `LV_EVENT_CLICKED` - * @param screen_create_cb a callback to create the screen, e.g. `lv_obj_t * myscreen_create(void)` - * @param anim_type element of `lv_screen_load_anim_t` the screen load animation - * @param duration duration of the animation in milliseconds - * @param delay delay before the screen load in milliseconds - */ -void lv_obj_add_screen_create_event(lv_obj_t * obj, lv_event_code_t trigger, lv_screen_create_cb_t screen_create_cb, - lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay); - - -/** - * Play a timeline animation on a trigger - * @param obj pointer to widget which should trigger playing the animation - * @param trigger an event code, e.g. `LV_EVENT_CLICKED` - * @param at pointer to an animation timeline - * @param delay wait time before starting the animation - * @param reverse true: play in reverse - */ -void lv_obj_add_play_timeline_event(lv_obj_t * obj, lv_event_code_t trigger, lv_anim_timeline_t * at, uint32_t delay, - bool reverse); - -#if LV_USE_OBJ_ID -/** - * Set an id for an object. - * @param obj pointer to an object - * @param id the id of the object - */ -void lv_obj_set_id(lv_obj_t * obj, void * id); - -/** - * Get the id of an object. - * @param obj pointer to an object - * @return the id of the object - */ -void * lv_obj_get_id(const lv_obj_t * obj); - -/** - * DEPRECATED IDs are used only to print the widget trees. - * To find a widget use `lv_obj_find_by_name` - * - * Get the child object by its id. - * It will check children and grandchildren recursively. - * Function `lv_obj_id_compare` is used to matched obj id with given id. - * - * @param obj pointer to an object - * @param id the id of the child object - * @return pointer to the child object or NULL if not found - */ -lv_obj_t * lv_obj_find_by_id(const lv_obj_t * obj, const void * id); - -/** - * Assign id to object if not previously assigned. - * This function gets called automatically when LV_OBJ_ID_AUTO_ASSIGN is enabled. - * - * Set `LV_USE_OBJ_ID_BUILTIN` to use the builtin method to generate object ID. - * Otherwise, these functions including `lv_obj_[set|assign|free|stringify]_id` and - * `lv_obj_id_compare`should be implemented externally. - * - * @param class_p the class this obj belongs to. Note obj->class_p is the class currently being constructed. - * @param obj pointer to an object - */ -void lv_obj_assign_id(const lv_obj_class_t * class_p, lv_obj_t * obj); - -/** - * Free resources allocated by `lv_obj_assign_id` or `lv_obj_set_id`. - * This function is also called automatically when object is deleted. - * @param obj pointer to an object - */ -void lv_obj_free_id(lv_obj_t * obj); - -/** - * Compare two obj id, return 0 if they are equal. - * - * Set `LV_USE_OBJ_ID_BUILTIN` to use the builtin method for compare. - * Otherwise, it must be implemented externally. - * - * @param id1: the first id - * @param id2: the second id - * @return 0 if they are equal, non-zero otherwise. - */ -int lv_obj_id_compare(const void * id1, const void * id2); - -/** - * Format an object's id into a string. - * @param obj pointer to an object - * @param buf buffer to write the string into - * @param len length of the buffer - */ -const char * lv_obj_stringify_id(lv_obj_t * obj, char * buf, uint32_t len); - -#if LV_USE_OBJ_ID_BUILTIN -/** - * Free resources used by builtin ID generator. - */ -void lv_objid_builtin_destroy(void); -#endif - -#endif /*LV_USE_OBJ_ID*/ - -/********************** - * MACROS - **********************/ - -#if LV_USE_ASSERT_OBJ -# define LV_ASSERT_OBJ(obj_p, obj_class) \ - do { \ - LV_ASSERT_MSG(obj_p != NULL, "The object is NULL"); \ - LV_ASSERT_MSG(lv_obj_has_class(obj_p, obj_class) == true, "Incompatible object type."); \ - LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?"); \ - } while(0) -# else -# define LV_ASSERT_OBJ(obj_p, obj_class) LV_ASSERT_NULL(obj_p) -#endif - -#if LV_USE_LOG && LV_LOG_TRACE_OBJ_CREATE -# define LV_TRACE_OBJ_CREATE(...) LV_LOG_TRACE(__VA_ARGS__) -#else -# define LV_TRACE_OBJ_CREATE(...) -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBJ_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_obj_class.c b/src/core/lv_obj_class.c index b9168c04df..49209c3a17 100644 --- a/src/core/lv_obj_class.c +++ b/src/core/lv_obj_class.c @@ -8,10 +8,7 @@ *********************/ #include "lv_obj_class_private.h" #include "lv_obj_private.h" -#include "../themes/lv_theme.h" -#include "../display/lv_display.h" #include "../display/lv_display_private.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/core/lv_obj_class.h b/src/core/lv_obj_class.h index 1c3a7b3761..42648840fa 100644 --- a/src/core/lv_obj_class.h +++ b/src/core/lv_obj_class.h @@ -1,89 +1,2 @@ -/** - * @file lv_obj_class.h - * - */ - -#ifndef LV_OBJ_CLASS_H -#define LV_OBJ_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_types.h" -#include "../misc/lv_area.h" -#include "lv_obj_property.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_OBJ_CLASS_EDITABLE_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/ - LV_OBJ_CLASS_EDITABLE_TRUE, - LV_OBJ_CLASS_EDITABLE_FALSE, -} lv_obj_class_editable_t; - -typedef enum { - LV_OBJ_CLASS_GROUP_DEF_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/ - LV_OBJ_CLASS_GROUP_DEF_TRUE, - LV_OBJ_CLASS_GROUP_DEF_FALSE, -} lv_obj_class_group_def_t; - -typedef enum { - LV_OBJ_CLASS_THEME_INHERITABLE_FALSE, /**< Do not inherit theme from base class. */ - LV_OBJ_CLASS_THEME_INHERITABLE_TRUE, -} lv_obj_class_theme_inheritable_t; - -typedef void (*lv_obj_class_event_cb_t)(lv_obj_class_t * class_p, lv_event_t * e); -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an object form a class descriptor - * @param class_p pointer to a class - * @param parent pointer to an object where the new object should be created - * @return pointer to the created object - */ -lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * parent); - -void lv_obj_class_init_obj(lv_obj_t * obj); - -bool lv_obj_is_editable(lv_obj_t * obj); - -bool lv_obj_is_group_def(lv_obj_t * obj); - -#if LV_USE_EXT_DATA -/** - * @brief Associates an array of external data pointers with an LVGL object - * - * Associates custom user data with an LVGL object and specifies a destructor function - * that will be automatically invoked when the object is deleted to properly clean up - * the associated resources. - * - * @param obj Target LVGL object - * @param data User-defined data pointer to associate with a object - * @param free_cb Cleanup function called for each non-NULL data pointer during - * object deletion. Receives single data pointer as parameter. - * NULL means no automatic cleanup. - */ -void lv_obj_set_external_data(lv_obj_t * obj, void * data, void (* free_cb)(void * data)); -#endif - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBJ_CLASS_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_obj_class_private.h b/src/core/lv_obj_class_private.h index de2b1738e4..72e0762e63 100644 --- a/src/core/lv_obj_class_private.h +++ b/src/core/lv_obj_class_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_obj_class.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/core/lv_obj_draw.c b/src/core/lv_obj_draw.c index 53bdd0ffea..b40b585bba 100644 --- a/src/core/lv_obj_draw.c +++ b/src/core/lv_obj_draw.c @@ -8,10 +8,6 @@ *********************/ #include "lv_obj_draw_private.h" #include "lv_obj_private.h" -#include "lv_obj_style.h" -#include "../display/lv_display.h" -#include "../indev/lv_indev.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/core/lv_obj_draw.h b/src/core/lv_obj_draw.h index 1f6c287af8..405b5f6d39 100644 --- a/src/core/lv_obj_draw.h +++ b/src/core/lv_obj_draw.h @@ -1,142 +1,2 @@ -/** - * @file lv_obj_draw.h - * - */ - -#ifndef LV_OBJ_DRAW_H -#define LV_OBJ_DRAW_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_types.h" -#include "../draw/lv_draw_rect.h" -#include "../draw/lv_draw_label.h" -#include "../draw/lv_draw_image.h" -#include "../draw/lv_draw_line.h" -#include "../draw/lv_draw_arc.h" -#include "../draw/lv_draw_triangle.h" -#include "../draw/lv_draw_blur.h" -#include "lv_obj_style.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** Store the type of layer required to render a widget.*/ -typedef enum { - /**No layer is needed. */ - LV_LAYER_TYPE_NONE, - - /**Simple layer means that the layer can be rendered in chunks. - * For example with opa_layered = 140 it's possible to render only 10 lines - * from the layer. When it's ready go to the next 10 lines. - * It avoids large memory allocations for the layer buffer. - * The buffer size for a chunk can be set by `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` in lv_conf.h.*/ - LV_LAYER_TYPE_SIMPLE, - - /**The widget is transformed and cannot be rendered in chunks. - * It's because - due to the transformations - pixel outside of - * a given area will also contribute to the final image. - * In this case there is no limitation on the buffer size. - * LVGL will allocate as large buffer as needed to render the transformed area.*/ - LV_LAYER_TYPE_TRANSFORM, -} lv_layer_type_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a rectangle draw descriptor from an object's styles in its current state - * @param obj pointer to an object - * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc - * @param draw_dsc the descriptor to initialize. - * If an `..._opa` field is set to `LV_OPA_TRANSP` the related properties won't be initialized. - * Should be initialized with `lv_draw_rect_dsc_init(draw_dsc)`. - * @note Only the relevant fields will be set. - * E.g. if `border width == 0` the other border properties won't be evaluated. - */ -void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc); - -/** - * Initialize a label draw descriptor from an object's styles in its current state - * @param obj pointer to an object - * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc - * @param draw_dsc the descriptor to initialize. - * If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized. - * Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`. - */ -void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc); - -/** - * Initialize an image draw descriptor from an object's styles in its current state - * @param obj pointer to an object - * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc - * @param draw_dsc the descriptor to initialize. - * Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`. - */ -void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc); - -/** - * Initialize a line draw descriptor from an object's styles in its current state - * @param obj pointer to an object - * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc - * @param draw_dsc the descriptor to initialize. - * Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`. - */ -void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc); - -/** - * Initialize an arc draw descriptor from an object's styles in its current state - * @param obj pointer to an object - * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc - * @param draw_dsc the descriptor to initialize. - * Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`. - */ -void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc); - - -/** - * Initialize a blur draw descriptor from an object's styles in its current state. - * draw_dsc->radius will only be calculated if it's 0 initially. Radius can be set before calling this function - * to avoid getting it twice. - * @param obj pointer to an object - * @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc - * @param draw_dsc the descriptor to initialize. - * Should be initialized with `lv_draw_blur_dsc_init(draw_dsc)`. - */ -void lv_obj_init_draw_blur_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_blur_dsc_t * draw_dsc); - -/** - * Get the required extra size (around the object's part) to draw shadow, outline, value etc. - * @param obj pointer to an object - * @param part part of the object - * @return the extra size required around the object - */ -int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part); - -/** - * Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size. - * The result will be saved in `obj`. - * @param obj pointer to an object - */ -void lv_obj_refresh_ext_draw_size(lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBJ_DRAW_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_obj_draw_private.h b/src/core/lv_obj_draw_private.h index 36c8bff966..3646b3ecd8 100644 --- a/src/core/lv_obj_draw_private.h +++ b/src/core/lv_obj_draw_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_obj_draw.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/core/lv_obj_event.c b/src/core/lv_obj_event.c index 32dd8a1f0d..a9edaf4921 100644 --- a/src/core/lv_obj_event.c +++ b/src/core/lv_obj_event.c @@ -10,7 +10,6 @@ #include "lv_obj_event_private.h" #include "lv_obj_class_private.h" #include "lv_obj_private.h" -#include "../indev/lv_indev.h" #include "../indev/lv_indev_private.h" /********************* diff --git a/src/core/lv_obj_event.h b/src/core/lv_obj_event.h index 878acf70d8..69a644a343 100644 --- a/src/core/lv_obj_event.h +++ b/src/core/lv_obj_event.h @@ -1,213 +1,2 @@ -/** - * @file lv_obj_event.h - * - */ - -#ifndef LV_OBJ_EVENT_H -#define LV_OBJ_EVENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_types.h" -#include "../misc/lv_event.h" -#include "../indev/lv_indev.h" -#include "lv_obj_style.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** Cover check results.*/ -typedef enum { - LV_COVER_RES_COVER = 0, - LV_COVER_RES_NOT_COVER = 1, - LV_COVER_RES_MASKED = 2, -} lv_cover_res_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Send an event to the object - * @param obj pointer to an object - * @param event_code the type of the event from `lv_event_t` - * @param param arbitrary data depending on the widget type and the event. (Usually `NULL`) - * @return LV_RESULT_OK: `obj` was not deleted in the event; LV_RESULT_INVALID: `obj` was deleted in the event_code - */ -lv_result_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * param); - -/** - * Used by the widgets internally to call the ancestor widget types's event handler - * @param class_p pointer to the class of the widget (NOT the ancestor class) - * @param e pointer to the event descriptor - * @return LV_RESULT_OK: the target object was not deleted in the event; LV_RESULT_INVALID: it was deleted in the event_code - */ -lv_result_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e); - -/** - * Get the current target of the event. It's the object which event handler being called. - * If the event is not bubbled it's the same as "original" target. - * @param e pointer to the event descriptor - * @return the target of the event_code - */ -lv_obj_t * lv_event_get_current_target_obj(lv_event_t * e); - -/** - * Get the object originally targeted by the event. It's the same even if the event is bubbled. - * @param e pointer to the event descriptor - * @return pointer to the original target of the event_code - */ -lv_obj_t * lv_event_get_target_obj(lv_event_t * e); - -/** - * Add an event handler function for an object. - * Used by the user to react on event which happens with the object. - * An object can have multiple event handler. They will be called in the same order as they were added. - * @param obj pointer to an object - * @param filter an event code (e.g. `LV_EVENT_CLICKED`) on which the event should be called. `LV_EVENT_ALL` can be used to receive all the events. - * @param event_cb the new event function - * @param user_data custom data will be available in `event_cb` - * @return handler to the event. It can be used in `lv_obj_remove_event_dsc`. - */ -lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); - -uint32_t lv_obj_get_event_count(lv_obj_t * obj); - -lv_event_dsc_t * lv_obj_get_event_dsc(lv_obj_t * obj, uint32_t index); - -bool lv_obj_remove_event(lv_obj_t * obj, uint32_t index); - -bool lv_obj_remove_event_dsc(lv_obj_t * obj, lv_event_dsc_t * dsc); - -/** - * Remove an event_cb from an object - * @param obj pointer to a obj - * @param event_cb the event_cb of the event to remove - * @return the count of the event removed - */ -uint32_t lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb); - -/** - * Remove an event_cb with user_data - * @param obj pointer to a obj - * @param event_cb the event_cb of the event to remove - * @param user_data user_data - * @return the count of the event removed - */ -uint32_t lv_obj_remove_event_cb_with_user_data(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data); - -/** - * Get the input device passed as parameter to indev related events. - * @param e pointer to an event - * @return the indev that triggered the event or NULL if called on a not indev related event - */ -lv_indev_t * lv_event_get_indev(lv_event_t * e); - -/** - * Get the draw context which should be the first parameter of the draw functions. - * Namely: `LV_EVENT_DRAW_MAIN/POST`, `LV_EVENT_DRAW_MAIN/POST_BEGIN`, `LV_EVENT_DRAW_MAIN/POST_END` - * @param e pointer to an event - * @return pointer to a draw context or NULL if called on an unrelated event - */ -lv_layer_t * lv_event_get_layer(lv_event_t * e); - -/** - * Get the old area of the object before its size was changed. Can be used in `LV_EVENT_SIZE_CHANGED` - * @param e pointer to an event - * @return the old absolute area of the object or NULL if called on an unrelated event - */ -const lv_area_t * lv_event_get_old_size(lv_event_t * e); - -/** - * Get the key passed as parameter to an event. Can be used in `LV_EVENT_KEY` - * @param e pointer to an event - * @return the triggering key or NULL if called on an unrelated event - */ -uint32_t lv_event_get_key(lv_event_t * e); - -/** - * Get the signed rotary encoder diff. passed as parameter to an event. Can be used in `LV_EVENT_ROTARY` - * @param e pointer to an event - * @return the triggering key or NULL if called on an unrelated event - */ -int32_t lv_event_get_rotary_diff(lv_event_t * e); - -/** - * Get the animation descriptor of a scrolling. Can be used in `LV_EVENT_SCROLL_BEGIN` - * @param e pointer to an event - * @return the animation that will scroll the object. (can be modified as required) - */ -lv_anim_t * lv_event_get_scroll_anim(lv_event_t * e); - -/** - * Set the new extra draw size. Can be used in `LV_EVENT_REFR_EXT_DRAW_SIZE` - * @param e pointer to an event - * @param size The new extra draw size - */ -void lv_event_set_ext_draw_size(lv_event_t * e, int32_t size); - -/** - * Get a pointer to an `lv_point_t` variable in which the self size should be saved (width in `point->x` and height `point->y`). - * Can be used in `LV_EVENT_GET_SELF_SIZE` - * @param e pointer to an event - * @return pointer to `lv_point_t` or NULL if called on an unrelated event - */ -lv_point_t * lv_event_get_self_size_info(lv_event_t * e); - -/** - * Get a pointer to an `lv_hit_test_info_t` variable in which the hit test result should be saved. Can be used in `LV_EVENT_HIT_TEST` - * @param e pointer to an event - * @return pointer to `lv_hit_test_info_t` or NULL if called on an unrelated event - */ -lv_hit_test_info_t * lv_event_get_hit_test_info(lv_event_t * e); - -/** - * Get a pointer to an area which should be examined whether the object fully covers it or not. - * Can be used in `LV_EVENT_HIT_TEST` - * @param e pointer to an event - * @return an area with absolute coordinates to check - */ -const lv_area_t * lv_event_get_cover_area(lv_event_t * e); - -/** - * Set the result of cover checking. Can be used in `LV_EVENT_COVER_CHECK` - * @param e pointer to an event - * @param res an element of ::lv_cover_check_info_t - */ -void lv_event_set_cover_res(lv_event_t * e, lv_cover_res_t res); - -/** - * Get the draw task which was just added. - * Can be used in `LV_EVENT_DRAW_TASK_ADDED event` - * @param e pointer to an event - * @return the added draw task - */ -lv_draw_task_t * lv_event_get_draw_task(lv_event_t * e); - -/** - * Get the previous state before the state change. - * Can be used in `LV_EVENT_STATE_CHANGED` event - * @param e pointer to an event - * @return the previous state - */ -lv_state_t lv_event_get_prev_state(lv_event_t * e); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBJ_EVENT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_obj_event_private.h b/src/core/lv_obj_event_private.h index 2199717c46..56af52a670 100644 --- a/src/core/lv_obj_event_private.h +++ b/src/core/lv_obj_event_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_obj_event.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/core/lv_obj_id_builtin.c b/src/core/lv_obj_id_builtin.c index 8af381520a..7732262d47 100644 --- a/src/core/lv_obj_id_builtin.c +++ b/src/core/lv_obj_id_builtin.c @@ -10,7 +10,6 @@ #include "lv_obj_private.h" #include "lv_global.h" #include "../osal/lv_os_private.h" -#include "../stdlib/lv_sprintf.h" /********************* * DEFINES diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index cbfdfc61b4..e2168719af 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -12,7 +12,6 @@ #include "lv_obj_draw_private.h" #include "lv_obj_style_private.h" #include "lv_obj_private.h" -#include "../display/lv_display.h" #include "../display/lv_display_private.h" #include "lv_refr_private.h" #include "../core/lv_global.h" diff --git a/src/core/lv_obj_pos.h b/src/core/lv_obj_pos.h index 9b9f3fe92e..4c37833423 100644 --- a/src/core/lv_obj_pos.h +++ b/src/core/lv_obj_pos.h @@ -1,583 +1,2 @@ -/** - * @file lv_obj_pos.h - * - */ - -#ifndef LV_OBJ_POS_H -#define LV_OBJ_POS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_area.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - /** No flags */ - LV_OBJ_POINT_TRANSFORM_FLAG_NONE = 0x00, - - /** Consider the transformation properties of the parents too */ - LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE = 0x01, - - /** Execute the inverse of the transformation (-angle and 1/zoom) */ - LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE = 0x02, - - /** Both inverse and recursive*/ - LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE_RECURSIVE = 0x03, -} lv_obj_point_transform_flag_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Set the position of an object relative to the set alignment. - * @param obj pointer to an object - * @param x new x coordinate - * @param y new y coordinate - * @note With default alignment it's the distance from the top left corner - * @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent - * @note The position is interpreted on the content area of the parent - * @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)` - */ -void lv_obj_set_pos(lv_obj_t * obj, int32_t x, int32_t y); - -/** - * Set the x coordinate of an object - * @param obj pointer to an object - * @param x new x coordinate - * @note With default alignment it's the distance from the top left corner - * @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent - * @note The position is interpreted on the content area of the parent - * @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)` - */ -void lv_obj_set_x(lv_obj_t * obj, int32_t x); - -/** - * Set the y coordinate of an object - * @param obj pointer to an object - * @param y new y coordinate - * @note With default alignment it's the distance from the top left corner - * @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent - * @note The position is interpreted on the content area of the parent - * @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)` - */ -void lv_obj_set_y(lv_obj_t * obj, int32_t y); - -/** - * Set the size of an object. - * @param obj pointer to an object - * @param w the new width - * @param h the new height - * @note possible values are: - * pixel simple set the size accordingly - * LV_SIZE_CONTENT set the size to involve all children in the given direction - * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). - * x should be in [0..1000]% range - */ -void lv_obj_set_size(lv_obj_t * obj, int32_t w, int32_t h); - -/** - * Recalculate the size of the object - * @param obj pointer to an object - * @return true: the size has been changed - */ -bool lv_obj_refr_size(lv_obj_t * obj); - -/** - * Set the width of an object - * @param obj pointer to an object - * @param w the new width - * @note possible values are: - * pixel simple set the size accordingly - * LV_SIZE_CONTENT set the size to involve all children in the given direction - * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). - * x should be in [0..1000]% range - */ -void lv_obj_set_width(lv_obj_t * obj, int32_t w); - -/** - * Set the height of an object - * @param obj pointer to an object - * @param h the new height - * @note possible values are: - * pixel simple set the size accordingly - * LV_SIZE_CONTENT set the size to involve all children in the given direction - * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). - * x should be in [0..1000]% range - */ -void lv_obj_set_height(lv_obj_t * obj, int32_t h); - -/** - * Set the width reduced by the left and right padding and the border width. - * @param obj pointer to an object - * @param w the width without paddings in pixels - */ -void lv_obj_set_content_width(lv_obj_t * obj, int32_t w); - -/** - * Set the height reduced by the top and bottom padding and the border width. - * @param obj pointer to an object - * @param h the height without paddings in pixels - */ -void lv_obj_set_content_height(lv_obj_t * obj, int32_t h); - -/** - * Set a layout for an object - * @param obj pointer to an object - * @param layout pointer to a layout descriptor to set - */ -void lv_obj_set_layout(lv_obj_t * obj, uint32_t layout); - -/** - * Test whether the and object is positioned by a layout or not - * @param obj pointer to an object to test - * @return true: positioned by a layout; false: not positioned by a layout - */ -bool lv_obj_is_layout_positioned(const lv_obj_t * obj); - -/** - * Mark the object for layout update. - * @param obj pointer to an object whose children need to be updated - */ -void lv_obj_mark_layout_as_dirty(lv_obj_t * obj); - -/** - * Update the layout of an object. - * @param obj pointer to an object whose position and size needs to be updated - */ -void lv_obj_update_layout(const lv_obj_t * obj); - -/** - * Change the alignment of an object. - * @param obj pointer to an object to align - * @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used. - */ -void lv_obj_set_align(lv_obj_t * obj, lv_align_t align); - -/** - * Change the alignment of an object and set new coordinates. - * Equivalent to: - * lv_obj_set_align(obj, align); - * lv_obj_set_pos(obj, x_ofs, y_ofs); - * @param obj pointer to an object to align - * @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used. - * @param x_ofs x coordinate offset after alignment - * @param y_ofs y coordinate offset after alignment - */ -void lv_obj_align(lv_obj_t * obj, lv_align_t align, int32_t x_ofs, int32_t y_ofs); - -/** - * Align an object to another object. - * @param obj pointer to an object to align - * @param base pointer to another object (if NULL `obj`s parent is used). 'obj' will be aligned to it. - * @param align type of alignment (see 'lv_align_t' enum) - * @param x_ofs x coordinate offset after alignment - * @param y_ofs y coordinate offset after alignment - * @note if the position or size of `base` changes `obj` needs to be aligned manually again - */ -void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, int32_t x_ofs, - int32_t y_ofs); - -/** - * Align an object to the center on its parent. - * @param obj pointer to an object to align - * @note if the parent size changes `obj` needs to be aligned manually again - */ -void lv_obj_center(lv_obj_t * obj); - -/** - * Set the transform matrix of an object - * @param obj pointer to an object - * @param matrix pointer to a matrix to set - * @note `LV_DRAW_TRANSFORM_USE_MATRIX` needs to be enabled. - */ -void lv_obj_set_transform(lv_obj_t * obj, const lv_matrix_t * matrix); - -/** - * Reset the transform matrix of an object to identity matrix - * @param obj pointer to an object - * @note `LV_DRAW_TRANSFORM_USE_MATRIX` needs to be enabled. - */ -void lv_obj_reset_transform(lv_obj_t * obj); - -/** - * Copy the coordinates of an object to an area - * @param obj pointer to an object - * @param coords pointer to an area to store the coordinates - */ -void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * coords); - -/** - * Get the x coordinate of object. - * @param obj pointer to an object - * @return distance of `obj` from the left side of its parent plus the parent's left padding - * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation - * call `lv_obj_update_layout(obj)`. - * @note Zero return value means the object is on the left padding of the parent, and not on the left edge. - * @note Scrolling of the parent doesn't change the returned value. - * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. - */ -int32_t lv_obj_get_x(const lv_obj_t * obj); - -/** - * Get the x2 coordinate of object. - * @param obj pointer to an object - * @return distance of `obj` from the right side of its parent plus the parent's right padding - * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation - * call `lv_obj_update_layout(obj)`. - * @note Zero return value means the object is on the right padding of the parent, and not on the right edge. - * @note Scrolling of the parent doesn't change the returned value. - * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. - */ -int32_t lv_obj_get_x2(const lv_obj_t * obj); - -/** - * Get the y coordinate of object. - * @param obj pointer to an object - * @return distance of `obj` from the top side of its parent plus the parent's top padding - * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation - * call `lv_obj_update_layout(obj)`. - * @note Zero return value means the object is on the top padding of the parent, and not on the top edge. - * @note Scrolling of the parent doesn't change the returned value. - * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. - */ -int32_t lv_obj_get_y(const lv_obj_t * obj); - -/** - * Get the y2 coordinate of object. - * @param obj pointer to an object - * @return distance of `obj` from the bottom side of its parent plus the parent's bottom padding - * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation - * call `lv_obj_update_layout(obj)`. - * @note Zero return value means the object is on the bottom padding of the parent, and not on the bottom edge. - * @note Scrolling of the parent doesn't change the returned value. - * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. - */ -int32_t lv_obj_get_y2(const lv_obj_t * obj); - -/** - * Get the actually set x coordinate of object, i.e. the offset from the set alignment - * @param obj pointer to an object - * @return the set x coordinate - */ -int32_t lv_obj_get_x_aligned(const lv_obj_t * obj); - -/** - * Get the actually set y coordinate of object, i.e. the offset from the set alignment - * @param obj pointer to an object - * @return the set y coordinate - */ -int32_t lv_obj_get_y_aligned(const lv_obj_t * obj); - -/** - * Get the width of an object - * @param obj pointer to an object - * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation - * call `lv_obj_update_layout(obj)`. - * @return the width in pixels - */ -int32_t lv_obj_get_width(const lv_obj_t * obj); - -/** - * Get the height of an object - * @param obj pointer to an object - * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation - * call `lv_obj_update_layout(obj)`. - * @return the height in pixels - */ -int32_t lv_obj_get_height(const lv_obj_t * obj); - -/** - * Get the width reduced by the left and right padding and the border width. - * @param obj pointer to an object - * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation - * call `lv_obj_update_layout(obj)`. - * @return the width which still fits into its parent without causing overflow (making the parent scrollable) - */ -int32_t lv_obj_get_content_width(const lv_obj_t * obj); - -/** - * Get the height reduced by the top and bottom padding and the border width. - * @param obj pointer to an object - * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation - * call `lv_obj_update_layout(obj)`. - * @return the height which still fits into the parent without causing overflow (making the parent scrollable) - */ -int32_t lv_obj_get_content_height(const lv_obj_t * obj); - -/** - * Get the area reduced by the paddings and the border width. - * @param obj pointer to an object - * @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation - * call `lv_obj_update_layout(obj)`. - * @param area the area which still fits into the parent without causing overflow (making the parent scrollable) - */ -void lv_obj_get_content_coords(const lv_obj_t * obj, lv_area_t * area); - -/** - * Get the width occupied by the "parts" of the widget. E.g. the width of all columns of a table. - * @param obj pointer to an object - * @return the width of the virtually drawn content - * @note This size independent from the real size of the widget. - * It just tells how large the internal ("virtual") content is. - */ -int32_t lv_obj_get_self_width(const lv_obj_t * obj); - -/** - * Get the height occupied by the "parts" of the widget. E.g. the height of all rows of a table. - * @param obj pointer to an object - * @return the width of the virtually drawn content - * @note This size independent from the real size of the widget. - * It just tells how large the internal ("virtual") content is. - */ -int32_t lv_obj_get_self_height(const lv_obj_t * obj); - -/** - * Get the style width actually used by the object after clamping the width within the min max range. - * @param obj pointer to an object - * @return the min/max/normal width set by `lv_obj_set_style__width()` - * @note This is not the calculated size, so if the size was set as `LV_SIZE_CONTENT` or `LV_PCT()` - * then that value will be returned. - */ -int32_t lv_obj_get_style_clamped_width(lv_obj_t * obj); - -/** - * Get the style height actually used by the object after clamping the height within the min max range. - * @param obj pointer to an object - * @return the min/max/normal height set by `lv_obj_set_style__height()` - * @note This is not the calculated size, so if the size was set as `LV_SIZE_CONTENT` or `LV_PCT()` - * then that value will be returned. - */ -int32_t lv_obj_get_style_clamped_height(lv_obj_t * obj); - -/** - * Determine if any of the object's width style properties are set to `LV_SIZE_CONTENT`. - * @param obj Pointer to a valid object. - * @return `true` At least one of the following width style properties is `LV_SIZE_CONTENT`: `LV_STYLE_WIDTH`, `LV_STYLE_MIN_WIDTH`, `LV_STYLE_MAX_WIDTH`. - * @return `false` No width style properties are `LV_SIZE_CONTENT`. - */ -bool lv_obj_is_style_any_width_content(lv_obj_t * obj); - -/** - * Determine if any of the object's height style properties are set to `LV_SIZE_CONTENT`. - * @param obj Pointer to a valid object. - * @return `true` At least one of the following height style properties is `LV_SIZE_CONTENT`: `LV_STYLE_HEIGHT`, `LV_STYLE_MIN_HEIGHT`, `LV_STYLE_MAX_HEIGHT`. - * @return `false` No height style properties are `LV_SIZE_CONTENT`. - */ -bool lv_obj_is_style_any_height_content(lv_obj_t * obj); - -/** - * @brief Determine if the object's resolved width was limited by its minimum width constraint. - * - * This function reports whether, in the most recent layout / size calculation, the object's - * final (used) width had to be raised to satisfy a minimum width requirement. - * - * @param obj Pointer to a valid object. - * @return true The computed width == the effective minimum width (i.e. it was clamped). - * @return false The width is larger than the minimum (not min‑clamped). - */ -bool lv_obj_is_width_min(lv_obj_t * obj); - -/** - * @brief Determine if the object's resolved height was limited by its minimum height constraint. - * - * This function reports whether, in the most recent layout / size calculation, the object's - * final (used) height had to be raised to satisfy a minimum height requirement. - * - * @param obj Pointer to a valid object. - * @return true The computed height == the effective minimum height (i.e. it was clamped). - * @return false The height is larger than the minimum (not min‑clamped). - */ -bool lv_obj_is_height_min(lv_obj_t * obj); - -/** - * @brief Determine if the object's resolved width was limited by its maximum width constraint. - * - * This function reports whether, in the most recent layout / size calculation, the object's - * final (used) width had to be raised to satisfy a maximum width requirement. - * - * @param obj Pointer to a valid object. - * @return true The computed width == the effective maximum width (i.e. it was clamped). - * @return false The width is smaller than the maximum (not min‑clamped). - */ -bool lv_obj_is_width_max(lv_obj_t * obj); - -/** - * @brief Determine if the object's resolved height was limited by its maximum height constraint. - * - * This function reports whether, in the most recent layout / size calculation, the object's - * final (used) height had to be raised to satisfy a maximum height requirement. - * - * @param obj Pointer to a valid object. - * @return true The computed height == the effective maximum height (i.e. it was clamped). - * @return false The height is smaller than the maximum (not min‑clamped). - */ -bool lv_obj_is_height_max(lv_obj_t * obj); - -/** - * Handle if the size of the internal ("virtual") content of an object has changed. - * @param obj pointer to an object - * @return false: nothing happened; true: refresh happened - */ -bool lv_obj_refresh_self_size(lv_obj_t * obj); - -void lv_obj_refr_pos(lv_obj_t * obj); - -void lv_obj_move_to(lv_obj_t * obj, int32_t x, int32_t y); - -void lv_obj_move_children_by(lv_obj_t * obj, int32_t x_diff, int32_t y_diff, bool ignore_floating); - -/** - * Get the transform matrix of an object - * @param obj pointer to an object - * @return pointer to the transform matrix or NULL if not set - */ -const lv_matrix_t * lv_obj_get_transform(const lv_obj_t * obj); - -/** - * Transform a point using the angle and zoom style properties of an object - * @param obj pointer to an object whose style properties should be used - * @param p a point to transform, the result will be written back here too - * @param flags OR-ed valued of :cpp:enum:`lv_obj_point_transform_flag_t` - */ -void lv_obj_transform_point(const lv_obj_t * obj, lv_point_t * p, lv_obj_point_transform_flag_t flags); - -/** - * Transform an array of points using the angle and zoom style properties of an object - * @param obj pointer to an object whose style properties should be used - * @param points the array of points to transform, the result will be written back here too - * @param count number of points in the array - * @param flags OR-ed valued of :cpp:enum:`lv_obj_point_transform_flag_t` - */ -void lv_obj_transform_point_array(const lv_obj_t * obj, lv_point_t points[], size_t count, - lv_obj_point_transform_flag_t flags); - -/** - * Transform an area using the angle and zoom style properties of an object - * @param obj pointer to an object whose style properties should be used - * @param area an area to transform, the result will be written back here too - * @param flags OR-ed valued of :cpp:enum:`lv_obj_point_transform_flag_t` - */ -void lv_obj_get_transformed_area(const lv_obj_t * obj, lv_area_t * area, lv_obj_point_transform_flag_t flags); - -/** - * Mark an area of an object as invalid. - * The area will be truncated to the object's area and marked for redraw. - * @param obj pointer to an object - * @param area the area to redraw - * @return LV_RESULT_OK: the area is invalidated; LV_RESULT_INVALID: the area wasn't invalidated. - * (maybe it was off-screen or fully clipped) - */ -lv_result_t lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area); - -/** - * Mark the object as invalid to redrawn its area - * @param obj pointer to an object - * @return LV_RESULT_OK: the area is invalidated; LV_RESULT_INVALID: the area wasn't invalidated. - * (maybe it was off-screen or fully clipped) - */ -lv_result_t lv_obj_invalidate(const lv_obj_t * obj); - -/** - * Tell whether an area of an object is visible (even partially) now or not - * @param obj pointer to an object - * @param area the are to check. The visible part of the area will be written back here. - * @return true visible; false not visible (hidden, out of parent, on other screen, etc) - */ -bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area); - -/** - * Tell whether an object is visible (even partially) now or not - * @param obj pointer to an object - * @return true: visible; false not visible (hidden, out of parent, on other screen, etc) - */ -bool lv_obj_is_visible(const lv_obj_t * obj); - -/** - * Set the size of an extended clickable area - * @param obj pointer to an object - * @param size extended clickable area in all 4 directions [px] - */ -void lv_obj_set_ext_click_area(lv_obj_t * obj, int32_t size); - -/** - * Get the an area where to object can be clicked. - * It's the object's normal area plus the extended click area. - * @param obj pointer to an object - * @param area store the result area here - */ -void lv_obj_get_click_area(const lv_obj_t * obj, lv_area_t * area); - -/** - * Hit-test an object given a particular point in screen space. - * @param obj object to hit-test - * @param point screen-space point (absolute coordinate) - * @return true: if the object is considered under the point - */ -bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point); - -/** - * Clamp a width between min and max width. If the min/max width is in percentage value use the ref_width - * @param width width to clamp - * @param min_width the minimal width - * @param max_width the maximal width - * @param ref_width the reference width used when min/max width is in percentage - * @return the clamped width - */ -int32_t lv_clamp_width(int32_t width, int32_t min_width, int32_t max_width, int32_t ref_width); - -/** - * Clamp a height between min and max height. If the min/max height is in percentage value use the ref_height - * @param height height to clamp - * @param min_height the minimal height - * @param max_height the maximal height - * @param ref_height the reference height used when min/max height is in percentage - * @return the clamped height - */ -int32_t lv_clamp_height(int32_t height, int32_t min_height, int32_t max_height, int32_t ref_height); - -/** - * @brief Calculates the width in pixels of an LVGL object based on its style and parent for a given width `prop`. - * @param obj Pointer to the LVGL object whose width is being calculated. - * @param prop Which style width to calculate for. Valid values are: LV_STYLE_WIDTH, LV_STYLE_MIN_WIDTH, or - * LV_STYLE_MAX_WIDTH. - * @return The computed width for the object: - * @note If the style width is a fixed value, that value is returned. - * @note If the style width is `LV_SIZE_CONTENT`, the content width is calculated and returned. - * @note If the style width is a `LV_PCT()`, the percentage is applied to the parent's width. - */ -int32_t lv_obj_calc_dynamic_width(lv_obj_t * obj, lv_style_prop_t prop); - -/** - * @brief Calculates the height in pixels of an LVGL object based on its style and parent for a given height `prop`. - * @param obj Pointer to the LVGL object whose height is being calculated. - * @param prop Which style height to calculate for. Valid values are: LV_STYLE_HEIGHT, LV_STYLE_MIN_HEIGHT, or - * LV_STYLE_MAX_HEIGHT. - * @return The computed height for the object: - * @note If the style height is a fixed value, that value is returned. - * @note If the style height is `LV_SIZE_CONTENT`, the content height is calculated and returned. - * @note If the style height is a `LV_PCT()`, the percentage is applied to the parent's height. - */ -int32_t lv_obj_calc_dynamic_height(lv_obj_t * obj, lv_style_prop_t prop); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBJ_POS_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_obj_private.h b/src/core/lv_obj_private.h index e9ddbdbabf..588c6e6e7c 100644 --- a/src/core/lv_obj_private.h +++ b/src/core/lv_obj_private.h @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../misc/lv_ext_data.h" -#include "lv_obj.h" + +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/core/lv_obj_property.c b/src/core/lv_obj_property.c index 95b60f2b9b..c4785ac976 100644 --- a/src/core/lv_obj_property.c +++ b/src/core/lv_obj_property.c @@ -7,10 +7,7 @@ * INCLUDES *********************/ #include "lv_obj_private.h" -#include "../core/lv_obj.h" -#include "../stdlib/lv_string.h" #include "../misc/lv_utils.h" -#include "lv_obj_property.h" #include "lv_obj_class_private.h" #if LV_USE_OBJ_PROPERTY diff --git a/src/core/lv_obj_property.h b/src/core/lv_obj_property.h index c5ae9ffeb6..1434873ef3 100644 --- a/src/core/lv_obj_property.h +++ b/src/core/lv_obj_property.h @@ -1,283 +1,2 @@ -/** - * @file lv_obj_property.h - * - */ - -#ifndef LV_OBJ_PROPERTY_H -#define LV_OBJ_PROPERTY_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_types.h" -#include "../misc/lv_style.h" -#include "lv_obj_style.h" - -#if LV_USE_OBJ_PROPERTY - -/********************* - * DEFINES - *********************/ - -/*All possible property value types*/ -#define LV_PROPERTY_TYPE_INVALID 0 /*Use default 0 as invalid to detect program outliers*/ -#define LV_PROPERTY_TYPE_INT 1 /*int32_t type*/ -#define LV_PROPERTY_TYPE_PRECISE 2 /*lv_value_precise_t, int32_t or float depending on LV_USE_FLOAT*/ -#define LV_PROPERTY_TYPE_COLOR 3 /*ARGB8888 type*/ -#define LV_PROPERTY_TYPE_POINT 4 /*lv_point_t */ -#define LV_PROPERTY_TYPE_POINTER 5 /*void * pointer*/ -#define LV_PROPERTY_TYPE_IMGSRC 6 /*Special pointer for image*/ -#define LV_PROPERTY_TYPE_TEXT 7 /*Special pointer of char* */ -#define LV_PROPERTY_TYPE_OBJ 8 /*Special pointer of lv_obj_t* */ -#define LV_PROPERTY_TYPE_DISPLAY 9 /*Special pointer of lv_display_t* */ -#define LV_PROPERTY_TYPE_FONT 10 /*Special pointer of lv_font_t* */ -#define LV_PROPERTY_TYPE_BOOL 11 /*int32_t type*/ - -#define LV_PROPERTY_TYPE_SHIFT 28 -#define LV_PROPERTY_TYPE2_SHIFT 24 - -/* Example: - * LV_PROPERTY_ID(OBJ, FLAG_CLICKABLE, LV_PROPERTY_TYPE_INT, 1), - * produces - * LV_PROPERTY_OBJ_FLAG_CLICKABLE = (LV_PROPERTY_OBJ_START + (1)) | ((LV_PROPERTY_TYPE_INT) << LV_PROPERTY_TYPE_SHIFT) - */ -#define LV_PROPERTY_ID(clz, name, type, index) LV_PROPERTY_## clz ##_##name = (LV_PROPERTY_## clz ##_START + ((int)index)) | ((type) << LV_PROPERTY_TYPE_SHIFT) - -/* Example: - * LV_PROPERTY_ID2(SLIDER, VALUE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_BOOL, 0) - * produces - * LV_PROPERTY_SLIDER_VALUE = (LV_PROPERTY_SLIDER_START + (0)) | ((LV_PROPERTY_TYPE_INT) << LV_PROPERTY_TYPE_SHIFT) | ((LV_PROPERTY_TYPE_BOOL) << LV_PROPERTY_TYPE2_SHIFT) - */ -#define LV_PROPERTY_ID2(clz, name, type, type2, index) LV_PROPERTY_ID(clz, name, type, index) | ((type2) << LV_PROPERTY_TYPE2_SHIFT) - -#define LV_PROPERTY_ID_TYPE(id) ((id) >> LV_PROPERTY_TYPE_SHIFT) -#define LV_PROPERTY_ID_TYPE2(id) ((id) >> LV_PROPERTY_TYPE_SHIFT) -#define LV_PROPERTY_ID_INDEX(id) ((id) & 0xfffffff) - -/*Set properties from an array of lv_property_t*/ -#define LV_OBJ_SET_PROPERTY_ARRAY(obj, array) lv_obj_set_properties(obj, array, LV_ARRAYLEN(array)) - -/* Helper to implement class definition of property and property names */ -/* *INDENT-OFF* */ -#if LV_USE_OBJ_PROPERTY_NAME -#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase) \ - .prop_index_start = LV_PROPERTY_##uppercase##_START, \ - .prop_index_end = LV_PROPERTY_##uppercase##_END, \ - .properties = lv_##widget##_properties, \ - .properties_count = LV_ARRAYLEN(lv_##widget##_properties), \ - .property_names = lv_##widget##_property_names, \ - .names_count = LV_ARRAYLEN(lv_##widget##_property_names) -#else -#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase) \ - .prop_index_start = LV_PROPERTY_##uppercase##_START, \ - .prop_index_end = LV_PROPERTY_##uppercase##_END, \ - .properties = lv_##widget##_properties, \ - .properties_count = LV_ARRAYLEN(lv_##widget##_properties) -#endif -/* *INDENT-ON* */ - - -/********************** - * TYPEDEFS - **********************/ - -/** - * Group of predefined widget ID start value. - */ -enum _lv_prop_id_range_boundary_t { - LV_PROPERTY_ID_INVALID = 0, - - /*ID 0x01 to 0xff are style ID, check lv_style_prop_t*/ - LV_PROPERTY_STYLE_START = 0x00, - - LV_PROPERTY_ID_START = 0x0100, /*ID smaller than 0xff is style ID*/ - /*Define the property ID for every widget here. */ - LV_PROPERTY_OBJ_START = 0x0100, /* lv_obj.c */ - LV_PROPERTY_IMAGE_START = 0x0200, /* lv_image.c */ - LV_PROPERTY_LABEL_START = 0x0300, /* lv_label.c */ - LV_PROPERTY_KEYBOARD_START = 0x0400, /* lv_keyboard.c */ - LV_PROPERTY_TEXTAREA_START = 0x0500, /* lv_textarea.c */ - LV_PROPERTY_ROLLER_START = 0x0600, /* lv_roller.c */ - LV_PROPERTY_DROPDOWN_START = 0x0700, /* lv_dropdown.c */ - LV_PROPERTY_SLIDER_START = 0x0800, /* lv_slider.c */ - LV_PROPERTY_ANIMIMAGE_START = 0x0900, /* lv_animimage.c */ - LV_PROPERTY_ARC_START = 0x0a00, /* lv_arc.c */ - LV_PROPERTY_BAR_START = 0x0b00, /* lv_bar.c */ - LV_PROPERTY_SWITCH_START = 0x0c00, /* lv_switch.c */ - LV_PROPERTY_CHECKBOX_START = 0x0d00, /* lv_checkbox.c */ - LV_PROPERTY_LED_START = 0x0e00, /* lv_led.c */ - LV_PROPERTY_LINE_START = 0x0f00, /* lv_line.c */ - LV_PROPERTY_SCALE_START = 0x1000, /* lv_scale.c */ - LV_PROPERTY_SPINBOX_START = 0x1100, /* lv_spinbox.c */ - LV_PROPERTY_SPINNER_START = 0x1200, /* lv_spinner.c */ - LV_PROPERTY_TABLE_START = 0x1300, /* lv_table.c */ - LV_PROPERTY_TABVIEW_START = 0x1400, /* lv_tabview.c */ - LV_PROPERTY_BUTTONMATRIX_START = 0x1500, /* lv_buttonmatrix.c */ - LV_PROPERTY_SPAN_START = 0x1600, /* lv_span.c */ - LV_PROPERTY_MENU_START = 0x1700, /* lv_menu.c */ - LV_PROPERTY_CHART_START = 0x1800, /* lv_chart.c */ - - /*Special ID, use it to extend ID and make sure it's unique and compile time determinant*/ - LV_PROPERTY_ID_BUILTIN_LAST = 0xffff, /*ID of 0x10000 ~ 0xfffffff is reserved for user*/ - - LV_PROPERTY_ID_ANY = 0x7ffffffe, /*Special ID used by lvgl to intercept all setter/getter call.*/ -}; - -struct _lv_property_name_t { - const char * name; - lv_prop_id_t id; -}; - -typedef struct { - lv_prop_id_t id; - union { - int32_t num; /**< Signed integer number (enums or "normal" numbers)*/ - uint32_t num_u; /**< Unsigned integer number (opacity, Booleans) */ - bool enable; /**< Booleans */ - const void * ptr; /**< Constant pointers (font, cone text, etc.) */ - lv_color_t color; /**< Colors */ - lv_value_precise_t precise; /**< float or int for precise value */ - lv_point_t point; /**< Point, contains two int32_t */ - - struct { - /** - * Note that place struct member `style` at first place is intended. - * `style` shares same memory with `num`, `ptr`, `color`. - * So we set the style value directly without using `prop.style.num`. - * - * E.g. - * - * static const lv_property_t obj_pos_x = { - * .id = LV_PROPERTY_STYLE_X, - * .num = 123, - * .selector = LV_STATE_PRESSED, - * } - * - * instead of: - * static const lv_property_t obj_pos_x = { - * .id = LV_PROPERTY_STYLE_X, - * .style.num = 123, // note this line. - * .selector = LV_STATE_PRESSED, - * } - */ - lv_style_value_t style; /**< Make sure it's the first element in struct. */ - uint32_t selector; /**< Style selector, lv_part_t | lv_state_t */ - }; - - /** - * For some properties like slider range, it contains two simple (4-byte) values - * so we can use `arg1.num` and `arg2.num` to set the argument. - */ - struct { - union { - int32_t num; - uint32_t num_u; - bool enable; - const void * ptr; - lv_color_t color; - lv_value_precise_t precise; - } arg1, arg2; - }; - }; -} lv_property_t; - -typedef struct { - lv_prop_id_t id; - - void * setter; /**< Callback used to set property. */ - void * getter; /**< Callback used to get property. */ -} lv_property_ops_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/*===================== - * Setter functions - *====================*/ - -/** - * Set Widget property. - * @param obj pointer to Widget - * @param value property value to set - * @return return LV_RESULT_OK if call succeeded - */ -lv_result_t lv_obj_set_property(lv_obj_t * obj, const lv_property_t * value); - -/** - * Set multiple Widget properties. Helper `LV_OBJ_SET_PROPERTY_ARRAY` can be used for constant property array. - * @param obj pointer to Widget - * @param value property value array to set - * @param count number of array elements - * @return return LV_RESULT_OK if call succeeded - */ -lv_result_t lv_obj_set_properties(lv_obj_t * obj, const lv_property_t * value, uint32_t count); - -/*===================== - * Getter functions - *====================*/ - -/** - * Read property value from Widget. - * If id is a style property, computes the style of PART_MAIN. - * @param obj pointer to Widget - * @param id ID of property to read - * @return return property value read. The returned property ID is set to `LV_PROPERTY_ID_INVALID` if read failed. - */ -lv_property_t lv_obj_get_property(lv_obj_t * obj, lv_prop_id_t id); - -/** - * Read style property value from Widget - * @param obj pointer to Widget - * @param id ID of style property - * @param part part for which the style property should be computed - * @return return property value read. The returned property ID is set to `LV_PROPERTY_ID_INVALID` if read failed. - */ -lv_property_t lv_obj_get_style_property(lv_obj_t * obj, lv_prop_id_t id, lv_part_t part); - -/** - * Get property ID by recursively searching for name in Widget's class hierarchy, and - * if still not found, then search style properties. - * Requires to enabling `LV_USE_OBJ_PROPERTY_NAME`. - * @param obj pointer to Widget whose class and base-class hierarchy are to be searched. - * @param name property name - * @return property ID found or `LV_PROPERTY_ID_INVALID` if not found. - */ -lv_prop_id_t lv_obj_property_get_id(const lv_obj_t * obj, const char * name); - -/** - * Get property ID by doing a non-recursive search for name directly in Widget class properties. - * Requires enabling `LV_USE_OBJ_PROPERTY_NAME`. - * @param clz pointer to Widget class that has specified property. - * @param name property name - * @return property ID found or `LV_PROPERTY_ID_INVALID` if not found. - */ -lv_prop_id_t lv_obj_class_property_get_id(const lv_obj_class_t * clz, const char * name); - -/** - * Get style property ID by name. Requires enabling `LV_USE_OBJ_PROPERTY_NAME`. - * @param name property name - * @return property ID found or `LV_PROPERTY_ID_INVALID` if not found. - */ -lv_prop_id_t lv_style_property_get_id(const char * name); - -/********************** - * MACROS - **********************/ - -#include "../widgets/property/lv_obj_property_names.h" -#include "../widgets/property/lv_style_properties.h" - -#else -#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase) -#endif /*LV_USE_OBJ_PROPERTY*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBJ_PROPERTY_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_obj_scroll.c b/src/core/lv_obj_scroll.c index e05e734a9e..7b5e28cc8c 100644 --- a/src/core/lv_obj_scroll.c +++ b/src/core/lv_obj_scroll.c @@ -9,10 +9,7 @@ #include "lv_obj_scroll_private.h" #include "../misc/lv_anim_private.h" #include "lv_obj_private.h" -#include "../indev/lv_indev.h" #include "../indev/lv_indev_scroll.h" -#include "../display/lv_display.h" -#include "../misc/lv_area.h" /********************* * DEFINES diff --git a/src/core/lv_obj_scroll.h b/src/core/lv_obj_scroll.h index ee6221d8ac..6b5e71005d 100644 --- a/src/core/lv_obj_scroll.h +++ b/src/core/lv_obj_scroll.h @@ -1,301 +1,2 @@ -/** - * @file lv_obj_scroll.h - * - */ - -#ifndef LV_OBJ_SCROLL_H -#define LV_OBJ_SCROLL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_area.h" -#include "../misc/lv_anim.h" -#include "../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/*Can't include lv_obj.h because it includes this header file*/ - -/** Scrollbar modes: shows when should the scrollbars be visible*/ -typedef enum { - LV_SCROLLBAR_MODE_OFF, /**< Never show scrollbars*/ - LV_SCROLLBAR_MODE_ON, /**< Always show scrollbars*/ - LV_SCROLLBAR_MODE_ACTIVE, /**< Show scroll bars when Widget is being scrolled*/ - LV_SCROLLBAR_MODE_AUTO, /**< Show scroll bars when the content is large enough to be scrolled*/ -} lv_scrollbar_mode_t; - -/** Scroll span align options. Tells where to align the snappable children when scroll stops.*/ -typedef enum { - LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is*/ - LV_SCROLL_SNAP_START, /**< Align to the left/top*/ - LV_SCROLL_SNAP_END, /**< Align to the right/bottom*/ - LV_SCROLL_SNAP_CENTER /**< Align to the center*/ -} lv_scroll_snap_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/*===================== - * Setter functions - *====================*/ - -/** - * Set how the scrollbars should behave. - * @param obj pointer to Widget - * @param mode LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE - */ -void lv_obj_set_scrollbar_mode(lv_obj_t * obj, lv_scrollbar_mode_t mode); - -/** - * Set direction Widget can be scrolled - * @param obj pointer to Widget - * @param dir one or more bit-wise OR-ed values of `lv_dir_t` enumeration - */ -void lv_obj_set_scroll_dir(lv_obj_t * obj, lv_dir_t dir); - -/** - * Set where to snap the children when scrolling ends horizontally - * @param obj pointer to Widget - * @param align value from `lv_scroll_snap_t` enumeration - */ -void lv_obj_set_scroll_snap_x(lv_obj_t * obj, lv_scroll_snap_t align); - -/** - * Set where to snap the children when scrolling ends vertically - * @param obj pointer to Widget - * @param align value from `lv_scroll_snap_t` enumeration - */ -void lv_obj_set_scroll_snap_y(lv_obj_t * obj, lv_scroll_snap_t align); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the current scroll mode (when to hide the scrollbars) - * @param obj pointer to Widget - * @return the current scroll mode from `lv_scrollbar_mode_t` - */ -lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const lv_obj_t * obj); - -/** - * Get directions Widget can be scrolled (set with `lv_obj_set_scroll_dir()`) - * @param obj pointer to Widget - * @return current scroll direction bit(s) - */ -lv_dir_t lv_obj_get_scroll_dir(const lv_obj_t * obj); - -/** - * Get where to snap child Widgets when horizontal scrolling ends. - * @param obj pointer to Widget - * @return current snap value from `lv_scroll_snap_t` - */ -lv_scroll_snap_t lv_obj_get_scroll_snap_x(const lv_obj_t * obj); - -/** - * Get where to snap child Widgets when vertical scrolling ends. - * @param obj pointer to Widget - * @return current snap value from `lv_scroll_snap_t` - */ -lv_scroll_snap_t lv_obj_get_scroll_snap_y(const lv_obj_t * obj); - -/** - * Get current X scroll position. Identical to `lv_obj_get_scroll_left()`. - * @param obj pointer to scrollable container Widget - * @return current scroll position from left edge - * - If Widget is not scrolled return 0. - * - If scrolled return > 0. - * - If scrolled inside (elastic scroll) return < 0. - */ -int32_t lv_obj_get_scroll_x(const lv_obj_t * obj); - -/** - * Get current Y scroll position. Identical to `lv_obj_get_scroll_top()`. - * @param obj pointer to scrollable container Widget - * @return current scroll position from top edge - * - If Widget is not scrolled return 0. - * - If scrolled return > 0. - * - If scrolled inside (elastic scroll) return < 0. - */ -int32_t lv_obj_get_scroll_y(const lv_obj_t * obj); - -/** - * Number of pixels a scrollable container Widget can be scrolled down - * before its top edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag - * is set in Widget, this value can go negative while Widget is being - * dragged below its normal top-edge boundary. - * @param obj pointer to scrollable container Widget - * @return pixels Widget can be scrolled down before its top edge appears - */ -int32_t lv_obj_get_scroll_top(const lv_obj_t * obj); - -/** - * Number of pixels a scrollable container Widget can be scrolled up - * before its bottom edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag - * is set in Widget, this value can go negative while Widget is being - * dragged above its normal bottom-edge boundary. - * @param obj pointer to scrollable container Widget - * @return pixels Widget can be scrolled up before its bottom edge appears - */ -int32_t lv_obj_get_scroll_bottom(const lv_obj_t * obj); - -/** - * Number of pixels a scrollable container Widget can be scrolled right - * before its left edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag - * is set in Widget, this value can go negative while Widget is being - * dragged farther right than its normal left-edge boundary. - * @param obj pointer to scrollable container Widget - * @return pixels Widget can be scrolled right before its left edge appears - */ -int32_t lv_obj_get_scroll_left(const lv_obj_t * obj); - -/** - * Number of pixels a scrollable container Widget can be scrolled left - * before its right edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag - * is set in Widget, this value can go negative while Widget is being - * dragged farther left than its normal right-edge boundary. - * @param obj pointer to scrollable container Widget - * @return pixels Widget can be scrolled left before its right edge appears - */ -int32_t lv_obj_get_scroll_right(const lv_obj_t * obj); - -/** - * Get the X and Y coordinates where the scrolling will end for Widget if a scrolling animation is in progress. - * If no scrolling animation, give the current `x` or `y` scroll position. - * @param obj pointer to scrollable Widget - * @param end pointer to `lv_point_t` object in which to store result - */ -void lv_obj_get_scroll_end(lv_obj_t * obj, lv_point_t * end); - -/*===================== - * Other functions - *====================*/ - -/** - * Scroll by given amount of pixels. - * @param obj pointer to scrollable Widget to scroll - * @param dx pixels to scroll horizontally - * @param dy pixels to scroll vertically - * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately - * @note > 0 value means scroll right/bottom (show the more content on the right/bottom) - * @note e.g. dy = -20 means scroll down 20 px - */ -void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en); - -/** - * Scroll by given amount of pixels. - * `dx` and `dy` will be limited internally to allow scrolling only on the content area. - * @param obj pointer to scrollable Widget to scroll - * @param dx pixels to scroll horizontally - * @param dy pixels to scroll vertically - * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately - * @note e.g. dy = -20 means scroll down 20 px - */ -void lv_obj_scroll_by_bounded(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en); - -/** - * Scroll to given coordinate on Widget. - * `x` and `y` will be limited internally to allow scrolling only on the content area. - * @param obj pointer to scrollable Widget to scroll - * @param x pixels to scroll horizontally - * @param y pixels to scroll vertically - * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately - */ -void lv_obj_scroll_to(lv_obj_t * obj, int32_t x, int32_t y, lv_anim_enable_t anim_en); - -/** - * Scroll to X coordinate on Widget. - * `x` will be limited internally to allow scrolling only on the content area. - * @param obj pointer to scrollable Widget to scroll - * @param x pixels to scroll horizontally - * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately - */ -void lv_obj_scroll_to_x(lv_obj_t * obj, int32_t x, lv_anim_enable_t anim_en); - -/** - * Scroll to Y coordinate on Widget. - * `y` will be limited internally to allow scrolling only on the content area. - * @param obj pointer to scrollable Widget to scroll - * @param y pixels to scroll vertically - * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately - */ -void lv_obj_scroll_to_y(lv_obj_t * obj, int32_t y, lv_anim_enable_t anim_en); - -/** - * Scroll `obj`'s parent Widget until `obj` becomes visible. - * @param obj pointer to Widget to scroll into view - * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately - */ -void lv_obj_scroll_to_view(lv_obj_t * obj, lv_anim_enable_t anim_en); - -/** - * Scroll `obj`'s parent Widgets recursively until `obj` becomes visible. - * Widget will be scrolled into view even it has nested scrollable parents. - * @param obj pointer to Widget to scroll into view - * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately - */ -void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en); - -/** - * Tell whether Widget is being scrolled or not at this moment - * @param obj pointer to Widget - * @return true: `obj` is being scrolled - */ -bool lv_obj_is_scrolling(const lv_obj_t * obj); - -/** - * Stop scrolling the current object - * - * @param obj The object being scrolled - */ -void lv_obj_stop_scroll_anim(const lv_obj_t * obj); - -/** - * Check children of `obj` and scroll `obj` to fulfill scroll_snap settings. - * @param obj Widget whose children need to be checked and snapped - * @param anim_en LV_ANIM_ON/OFF - */ -void lv_obj_update_snap(lv_obj_t * obj, lv_anim_enable_t anim_en); - -/** - * Get the area of the scrollbars - * @param obj pointer to Widget - * @param hor pointer to store the area of the horizontal scrollbar - * @param ver pointer to store the area of the vertical scrollbar - */ -void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor, lv_area_t * ver); - -/** - * Invalidate the area of the scrollbars - * @param obj pointer to Widget - */ -void lv_obj_scrollbar_invalidate(lv_obj_t * obj); - -/** - * Checks if the content is scrolled "in" and adjusts it to a normal position. - * @param obj pointer to Widget - * @param anim_en LV_ANIM_ON/OFF - */ -void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBJ_SCROLL_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_obj_scroll_private.h b/src/core/lv_obj_scroll_private.h index 9ae6332d4f..f1d355dedb 100644 --- a/src/core/lv_obj_scroll_private.h +++ b/src/core/lv_obj_scroll_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_obj_scroll.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index eec8f45de4..5f58572007 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -10,10 +10,7 @@ #include "../misc/lv_anim_private.h" #include "lv_obj_style_private.h" #include "lv_obj_class_private.h" -#include "../display/lv_display.h" #include "../display/lv_display_private.h" -#include "../misc/lv_color.h" -#include "../stdlib/lv_string.h" #include "../core/lv_global.h" #include "lv_observer_private.h" diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index 5f1f53517c..6c9fcfbefa 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -1,443 +1,2 @@ -/** - * @file lv_obj_style.h - * - */ - -#ifndef LV_OBJ_STYLE_H -#define LV_OBJ_STYLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_bidi.h" -#include "../misc/lv_style.h" -#include "../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * Possible states of a widget. - * OR-ed values are possible - */ -typedef enum { - LV_STATE_DEFAULT = 0, - LV_STATE_ALT = 1 << 0, - /*1 reserved*/ - LV_STATE_CHECKED = 1 << 2, - LV_STATE_FOCUSED = 1 << 3, - LV_STATE_FOCUS_KEY = 1 << 4, - LV_STATE_EDITED = 1 << 5, - LV_STATE_HOVERED = 1 << 6, - LV_STATE_PRESSED = 1 << 7, - LV_STATE_SCROLLED = 1 << 8, - LV_STATE_DISABLED = 1 << 9, - /*2 reserved*/ - LV_STATE_USER_1 = 1 << 12, - LV_STATE_USER_2 = 1 << 13, - LV_STATE_USER_3 = 1 << 14, - LV_STATE_USER_4 = 1 << 15, - - LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states*/ -} lv_state_t; - -/** - * The possible parts of widgets. - * The parts can be considered as the internal building block of the widgets. - * E.g. slider = background + indicator + knob - * Not all parts are used by every widget - */ - -typedef enum { - LV_PART_MAIN = 0x000000, /**< A background like rectangle*/ - LV_PART_SCROLLBAR = 0x010000, /**< The scrollbar(s)*/ - LV_PART_INDICATOR = 0x020000, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox*/ - LV_PART_KNOB = 0x030000, /**< Like handle to grab to adjust the value*/ - LV_PART_SELECTED = 0x040000, /**< Indicate the currently selected option or section*/ - LV_PART_ITEMS = 0x050000, /**< Used if the widget has multiple similar elements (e.g. table cells)*/ - LV_PART_CURSOR = 0x060000, /**< Mark a specific place e.g. for text area's cursor or on a chart*/ - - LV_PART_CUSTOM_FIRST = 0x080000, /**< Extension point for custom widgets*/ - - LV_PART_ANY = 0x0F0000, /**< Special value can be used in some functions to target all parts*/ -} lv_part_t; - -typedef enum { - LV_STYLE_STATE_CMP_SAME, /**< The style properties in the 2 states are identical */ - LV_STYLE_STATE_CMP_DIFF_REDRAW, /**< The differences can be shown with a simple redraw */ - LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /**< The differences can be shown with a simple redraw */ - LV_STYLE_STATE_CMP_DIFF_LAYOUT, /**< The differences can be shown with a simple redraw */ -} lv_style_state_cmp_t; - -/** - * A joint type for `lv_part_t` and `lv_state_t`. Example values - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRSSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -typedef uint32_t lv_style_selector_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Add a style to an object. - * @param obj pointer to an object - * @param style pointer to a style to add - * @param selector OR-ed value of parts and state to which the style should be added - * - * Examples: - * @code - * lv_obj_add_style(btn, &style_btn, 0); //Default button style - * - * lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED); //Overwrite only some colors to red when pressed - * @endcode - */ -void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector); - -/** - * Replaces a style of an object, preserving the order of the style stack (local styles and transitions are ignored). - * @param obj pointer to an object - * @param old_style pointer to a style to replace. - * @param new_style pointer to a style to replace the old style with. - * @param selector OR-ed values of states and a part to replace only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used - * - * Examples: - * @code - * lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_ANY | LV_STATE_ANY); //Replace a specific style - * - * lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_MAIN | LV_STATE_PRESSED); //Replace a specific style assigned to the main part when it is pressed - * @endcode - */ -bool lv_obj_replace_style(lv_obj_t * obj, const lv_style_t * old_style, const lv_style_t * new_style, - lv_style_selector_t selector); - -/** - * Remove a style from an object. - * @param obj pointer to an object - * @param style pointer to a style to remove. Can be NULL to check only the selector - * @param selector OR-ed values of states and a part to remove only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used - * - * Examples: - * @code - * lv_obj_remove_style(obj, &style, LV_PART_ANY | LV_STATE_ANY); //Remove a specific style - * - * lv_obj_remove_style(obj, NULL, LV_PART_MAIN | LV_STATE_ANY); //Remove all styles from the main part - * - * lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); //Remove all styles - * @endcode - */ -void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector); - - -/** - * Remove all styles added by a theme from a widget - * @param selector OR-ed values of states and a part to remove only styles with matching selectors. - * LV_STATE_ANY and LV_PART_ANY can be used - * @param obj pointer to a widget - */ -void lv_obj_remove_theme(lv_obj_t * obj, lv_style_selector_t selector); - -/** - * Remove all styles from an object - * @param obj pointer to an object - */ -void lv_obj_remove_style_all(lv_obj_t * obj); - -/** - * Notify all object if a style is modified - * @param style pointer to a style. Only the objects with this style will be notified - * (NULL to notify all objects) - */ -void lv_obj_report_style_change(lv_style_t * style); - -/** - * Notify an object and its children about its style is modified. - * @param obj pointer to an object - * @param part the part whose style was changed. E.g. `LV_PART_ANY`, `LV_PART_MAIN` - * @param prop `LV_STYLE_PROP_ANY` or an `LV_STYLE_...` property. - * It is used to optimize what needs to be refreshed. - * `LV_STYLE_PROP_INV` to perform only a style cache update - */ -void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop); - -/** - * Temporary disable a style for a selector. It will look like is the style wasn't added - * @param obj pointer to an object - * @param style pointer to a style - * @param selector the selector of a style (e.g. LV_STATE_PRESSED | LV_PART_KNOB) - * @param dis true: disable the style, false: enable the style - */ -void lv_obj_style_set_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector, bool dis); - -/** - * Get if a given style is disabled on an object. - * @param obj pointer to an object - * @param style pointer to a style - * @param selector the selector of a style (e.g. LV_STATE_PRESSED | LV_PART_KNOB) - * @return true: disable the style, false: enable the style - */ -bool lv_obj_style_get_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector); - -/** - * Enable or disable automatic style refreshing when a new style is added/removed to/from an object - * or any other style change happens. - * @param en true: enable refreshing; false: disable refreshing - */ -void lv_obj_enable_style_refresh(bool en); - -/** - * Get the value of a style property. The current state of the object will be considered. - * Inherited properties will be inherited. - * If a property is not set a default value will be returned. - * @param obj pointer to an object - * @param part a part from which the property should be get - * @param prop the property to get - * @return the value of the property. - * Should be read from the correct field of the `lv_style_value_t` according to the type of the property. - */ -lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop); - -/** - * Check if an object has a specified style property for a given style selector. - * @param obj pointer to an object - * @param selector the style selector to be checked, defining the scope of the style to be examined. - * @param prop the property to be checked. - * @return true if the object has the specified selector and property, false otherwise. - */ -bool lv_obj_has_style_prop(const lv_obj_t * obj, lv_style_selector_t selector, lv_style_prop_t prop); - -/** - * Set local style property on an object's part and state. - * @param obj pointer to an object - * @param prop the property - * @param value value of the property. The correct element should be set according to the type of the property - * @param selector OR-ed value of parts and state for which the style should be set - */ -void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value, - lv_style_selector_t selector); - -lv_style_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value, - lv_style_selector_t selector); - -/** - * Remove a local style property from a part of an object with a given state. - * @param obj pointer to an object - * @param prop a style property to remove. - * @param selector OR-ed value of parts and state for which the style should be removed - * @return true the property was found and removed; false: the property was not found - */ -bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector); - -/** - * Used internally for color filtering - */ -lv_style_value_t lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v); - -/** - * Fade in an an object and all its children. - * @param obj the object to fade in - * @param time time of fade - * @param delay delay to start the animation - */ -void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay); - -/** - * Fade out an an object and all its children. - * @param obj the object to fade out - * @param time time of fade - * @param delay delay to start the animation - */ -void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay); - -static inline lv_state_t lv_obj_style_get_selector_state(lv_style_selector_t selector) -{ - return (lv_state_t)(selector & 0xFFFF); -} - -static inline lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selector) -{ - return (lv_part_t)(selector & 0xFF0000); -} - -#include "lv_obj_style_gen.h" - -static inline void lv_obj_set_style_pad_all(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) -{ - lv_obj_set_style_pad_left(obj, value, selector); - lv_obj_set_style_pad_right(obj, value, selector); - lv_obj_set_style_pad_top(obj, value, selector); - lv_obj_set_style_pad_bottom(obj, value, selector); -} - -static inline void lv_obj_set_style_pad_hor(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) -{ - lv_obj_set_style_pad_left(obj, value, selector); - lv_obj_set_style_pad_right(obj, value, selector); -} - -static inline void lv_obj_set_style_pad_ver(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) -{ - lv_obj_set_style_pad_top(obj, value, selector); - lv_obj_set_style_pad_bottom(obj, value, selector); -} - -static inline void lv_obj_set_style_margin_all(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) -{ - lv_obj_set_style_margin_left(obj, value, selector); - lv_obj_set_style_margin_right(obj, value, selector); - lv_obj_set_style_margin_top(obj, value, selector); - lv_obj_set_style_margin_bottom(obj, value, selector); -} - -static inline void lv_obj_set_style_margin_hor(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) -{ - lv_obj_set_style_margin_left(obj, value, selector); - lv_obj_set_style_margin_right(obj, value, selector); -} - -static inline void lv_obj_set_style_margin_ver(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) -{ - lv_obj_set_style_margin_top(obj, value, selector); - lv_obj_set_style_margin_bottom(obj, value, selector); -} - -static inline void lv_obj_set_style_pad_gap(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) -{ - lv_obj_set_style_pad_row(obj, value, selector); - lv_obj_set_style_pad_column(obj, value, selector); -} - -static inline void lv_obj_set_style_size(lv_obj_t * obj, int32_t width, int32_t height, - lv_style_selector_t selector) -{ - lv_obj_set_style_width(obj, width, selector); - lv_obj_set_style_height(obj, height, selector); -} - -static inline void lv_obj_set_style_transform_scale(lv_obj_t * obj, int32_t value, - lv_style_selector_t selector) -{ - lv_obj_set_style_transform_scale_x(obj, value, selector); - lv_obj_set_style_transform_scale_y(obj, value, selector); -} - -static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, lv_part_t part) -{ - int32_t padding = lv_obj_get_style_pad_left(obj, part); - int32_t border_width = lv_obj_get_style_border_width(obj, part); - lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); - return (border_side & LV_BORDER_SIDE_LEFT) ? padding + border_width : padding; -} - -static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, lv_part_t part) -{ - int32_t padding = lv_obj_get_style_pad_right(obj, part); - int32_t border_width = lv_obj_get_style_border_width(obj, part); - lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); - return (border_side & LV_BORDER_SIDE_RIGHT) ? padding + border_width : padding; -} - -static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, lv_part_t part) -{ - int32_t padding = lv_obj_get_style_pad_top(obj, part); - int32_t border_width = lv_obj_get_style_border_width(obj, part); - lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); - return (border_side & LV_BORDER_SIDE_TOP) ? padding + border_width : padding; -} - -static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, lv_part_t part) -{ - int32_t padding = lv_obj_get_style_pad_bottom(obj, part); - int32_t border_width = lv_obj_get_style_border_width(obj, part); - lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); - return (border_side & LV_BORDER_SIDE_BOTTOM) ? padding + border_width : padding; -} - -lv_text_align_t lv_obj_calculate_style_text_align(const lv_obj_t * obj, lv_part_t part, const char * txt); - -static inline int32_t lv_obj_get_style_transform_scale_x_safe(const lv_obj_t * obj, lv_part_t part) -{ - int32_t scale = lv_obj_get_style_transform_scale_x(obj, part); - return scale > 0 ? scale : 1; -} - -static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * obj, lv_part_t part) -{ - int32_t scale = lv_obj_get_style_transform_scale_y(obj, part); - return scale > 0 ? scale : 1; -} - -/** - * Get the `opa` style property from all parents and multiply and `>> 8` them. - * @param obj the object whose opacity should be get - * @param part the part whose opacity should be get. Non-MAIN parts will consider the `opa` of the MAIN part too - * @return the final opacity considering the parents' opacity too - */ -lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part); - - -/** - * Apply recolor effect to the input color based on the object's style properties. - * @param obj the target object containing recolor style properties - * @param part the part to retrieve recolor styles. - * @param color the original color to be modified - * @return the blended color after applying recolor and opacity - */ -lv_color32_t lv_obj_style_apply_recolor(const lv_obj_t * obj, lv_part_t part, lv_color32_t color); - -/** - * Get the `recolor` style property from all parents and blend them recursively. - * @param obj the object whose recolor value should be retrieved - * @param part the target part to check. Non-MAIN parts will also consider - * the `recolor` value from the MAIN part during calculation - * @return the final blended recolor value combining all parent's recolor values - */ -lv_color32_t lv_obj_get_style_recolor_recursive(const lv_obj_t * obj, lv_part_t part); - -#if LV_USE_OBSERVER -/** - * Disable a style if a subject's value is not equal to a reference value - * @param obj pointer to Widget - * @param style pointer to a style - * @param selector pointer to a selector - * @param subject pointer to Subject - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector, - lv_subject_t * subject, int32_t ref_value); - -/** - * Connect a subject's value to a style property of a widget. - * @param obj pointer to a Widget - * @param prop a style property - * @param selector a selector for which the property should be added, e.g. `LV_PART_KNOB | LV_STATE_PRESSED` - * @param subject pointer a Subject to which value the property should be bound - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector, - lv_subject_t * subject); - -#endif - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBJ_STYLE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_obj_style_gen.c b/src/core/lv_obj_style_gen.c index 62bd759ffc..4cba84ada9 100644 --- a/src/core/lv_obj_style_gen.c +++ b/src/core/lv_obj_style_gen.c @@ -8,7 +8,7 @@ */ -#include "lv_obj.h" +#include "../lv_public_api.h" void lv_obj_set_style_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector) diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index e17b634f1d..4c056dc6d5 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -1,3610 +1,2 @@ -/* - * @file - * - ********************************************************************** - * DO NOT EDIT - * This file is automatically generated by "style_api_gen.py" - ********************************************************************** - */ - - -#ifndef LV_OBJ_STYLE_GEN_H -#define LV_OBJ_STYLE_GEN_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "../misc/lv_area.h" -#include "../misc/lv_style.h" -#include "../core/lv_obj_style.h" -#include "../misc/lv_types.h" - -/** - * Gets width of Widget. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. - * Percentage values are relative to the width of the parent's content area. - * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_WIDTH); - return (int32_t)v.num; -} - -/** - * Gets a minimal width. Pixel and percentage values can be used. Percentage values - * are relative to the width of the parent's content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_min_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_WIDTH); - return (int32_t)v.num; -} - -/** - * Gets a maximal width. Pixel and percentage values can be used. Percentage values - * are relative to the width of the parent's content area. - * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_max_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_WIDTH); - return (int32_t)v.num; -} - -/** - * Gets height of Widget. Pixel, percentage and `LV_SIZE_CONTENT` can be used. - * Percentage values are relative to the height of the parent's content area. - * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_height(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_HEIGHT); - return (int32_t)v.num; -} - -/** - * Gets a minimal height. Pixel and percentage values can be used. Percentage values - * are relative to the height of the parent's content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_min_height(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_HEIGHT); - return (int32_t)v.num; -} - -/** - * Gets a maximal height. Pixel and percentage values can be used. Percentage values - * are relative to the height of the parent's content area. - * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_max_height(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_HEIGHT); - return (int32_t)v.num; -} - -/** - * Its meaning depends on the type of Widget. For example in case of lv_scale it means - * the length of the ticks. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_length(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LENGTH); - return (int32_t)v.num; -} - -/** - * Get X coordinate of Widget considering the ``align`` setting. Pixel and percentage - * values can be used. Percentage values are relative to the width of the parent's - * content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_x(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_X); - return (int32_t)v.num; -} - -/** - * Get Y coordinate of Widget considering the ``align`` setting. Pixel and percentage - * values can be used. Percentage values are relative to the height of the parent's - * content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_y(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_Y); - return (int32_t)v.num; -} - -/** - * Get the alignment which tells from which point of the parent the X and Y - * coordinates should be interpreted. Possible values are: `LV_ALIGN_DEFAULT`, - * `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, - * `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means - * `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base - * direction. - * Default: `LV_ALIGN_DEFAULT`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_align_t lv_obj_get_style_align(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ALIGN); - return (lv_align_t)v.num; -} - -/** - * Make Widget wider on both sides with this value. Pixel and percentage (with - * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's width. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_transform_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH); - return (int32_t)v.num; -} - -/** - * Make Widget higher on both sides with this value. Pixel and percentage (with - * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's height. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_transform_height(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT); - return (int32_t)v.num; -} - -/** - * Move Widget with this value in X direction. Applied after layouts, aligns and other - * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage - * values are relative to Widget's width. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_translate_x(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_X); - return (int32_t)v.num; -} - -/** - * Move Widget with this value in Y direction. Applied after layouts, aligns and other - * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage - * values are relative to Widget's height. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_translate_y(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_Y); - return (int32_t)v.num; -} - -/** - * Move object around the centre of the parent object (e.g. around the circumference - * of a scale). - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_translate_radial(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_RADIAL); - return (int32_t)v.num; -} - -/** - * Zoom Widget horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 - * half size, 512 double size, and so on. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_transform_scale_x(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_X); - return (int32_t)v.num; -} - -/** - * Zoom Widget vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 - * half size, 512 double size, and so on. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_transform_scale_y(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_Y); - return (int32_t)v.num; -} - -/** - * Rotate Widget. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_transform_rotation(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ROTATION); - return (int32_t)v.num; -} - -/** - * Get pivot point's X coordinate for transformations. Relative to Widget's top left corner. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_transform_pivot_x(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_X); - return (int32_t)v.num; -} - -/** - * Get pivot point's Y coordinate for transformations. Relative to Widget's top left corner. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_transform_pivot_y(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_Y); - return (int32_t)v.num; -} - -/** - * Skew Widget horizontally. The value is interpreted in 0.1 degree units. E.g. 450 - * means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_transform_skew_x(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_X); - return (int32_t)v.num; -} - -/** - * Skew Widget vertically. The value is interpreted in 0.1 degree units. E.g. 450 - * means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_transform_skew_y(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_Y); - return (int32_t)v.num; -} - -/** - * Gets the padding on the top. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_pad_top(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP); - return (int32_t)v.num; -} - -/** - * Gets the padding on the bottom. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_pad_bottom(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_BOTTOM); - return (int32_t)v.num; -} - -/** - * Gets the padding on the left. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_pad_left(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_LEFT); - return (int32_t)v.num; -} - -/** - * Gets the padding on the right. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_pad_right(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RIGHT); - return (int32_t)v.num; -} - -/** - * Gets the padding between the rows. Used by the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_pad_row(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_ROW); - return (int32_t)v.num; -} - -/** - * Gets the padding between the columns. Used by the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_pad_column(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_COLUMN); - return (int32_t)v.num; -} - -/** - * Pad text labels away from the scale ticks/remainder of the ``LV_PART_``. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_pad_radial(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RADIAL); - return (int32_t)v.num; -} - -/** - * Gets margin on the top. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_margin_top(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_TOP); - return (int32_t)v.num; -} - -/** - * Gets margin on the bottom. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_margin_bottom(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_BOTTOM); - return (int32_t)v.num; -} - -/** - * Gets margin on the left. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_margin_left(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_LEFT); - return (int32_t)v.num; -} - -/** - * Gets margin on the right. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_margin_right(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_RIGHT); - return (int32_t)v.num; -} - -/** - * Get background color of Widget. - * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_bg_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR); - return v.color; -} - -/** - * Get background color of Widget. - * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_bg_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR)); - return v.color; -} - -/** - * Get opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_bg_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR); - return v.color; -} - -/** - * Get gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_BG_GRAD_COLOR)); - return v.color; -} - -/** - * Get direction of the gradient of the background. Possible values are - * `LV_GRAD_DIR_NONE/HOR/VER`. - * Default: `LV_GRAD_DIR_NONE`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_DIR); - return (lv_grad_dir_t)v.num; -} - -/** - * Get point from which background color should start for gradients. 0 means to - * top/left side, 255 the bottom/right side, 128 the center, and so on. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_bg_main_stop(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_STOP); - return (int32_t)v.num; -} - -/** - * Get point from which background's gradient color should start. 0 means to top/left - * side, 255 the bottom/right side, 128 the center, and so on. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_bg_grad_stop(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_STOP); - return (int32_t)v.num; -} - -/** - * Get opacity of the first gradient color. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_bg_main_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get opacity of the second gradient color. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_bg_grad_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get gradient definition. The pointed instance must exist while Widget is alive. - * NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and - * `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors - * as well. If it's set other gradient related properties will be ignored. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD); - return (const lv_grad_dsc_t *)v.ptr; -} - -/** - * Get a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or - * an `LV_SYMBOL_...`. - * Default: `NULL`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const void * lv_obj_get_style_bg_image_src(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_SRC); - return (const void *)v.ptr; -} - -/** - * Get opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means - * fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other - * values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_bg_image_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get a color to mix to the background image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR); - return v.color; -} - -/** - * Get a color to mix to the background image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_BG_IMAGE_RECOLOR)); - return v.color; -} - -/** - * Get intensity of background image recoloring. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full - * recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted - * proportionally. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_bg_image_recolor_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR_OPA); - return (lv_opa_t)v.num; -} - -/** - * If enabled the background image will be tiled. Possible values are `true` or `false`. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline bool lv_obj_get_style_bg_image_tiled(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_TILED); - return (bool)v.num; -} - -/** - * Get color of the border. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR); - return v.color; -} - -/** - * Get color of the border. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_BORDER_COLOR)); - return v.color; -} - -/** - * Get opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_border_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get width of the border. Only pixel values can be used. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_border_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_WIDTH); - return (int32_t)v.num; -} - -/** - * Get only which side(s) the border should be drawn. Possible values are - * `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as - * well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`. - * Default: `LV_BORDER_SIDE_FULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_border_side_t lv_obj_get_style_border_side(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_SIDE); - return (lv_border_side_t)v.num; -} - -/** - * Gets whether the border should be drawn before or after the children are drawn. - * `true`: after children, `false`: before children. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline bool lv_obj_get_style_border_post(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_POST); - return (bool)v.num; -} - -/** - * Get width of outline in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_outline_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_WIDTH); - return (int32_t)v.num; -} - -/** - * Get color of outline. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR); - return v.color; -} - -/** - * Get color of outline. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_OUTLINE_COLOR)); - return v.color; -} - -/** - * Get opacity of outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_outline_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get padding of outline, i.e. the gap between Widget and the outline. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_outline_pad(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_PAD); - return (int32_t)v.num; -} - -/** - * Get width of the shadow in pixels. The value should be >= 0. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_shadow_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_WIDTH); - return (int32_t)v.num; -} - -/** - * Get an offset on the shadow in pixels in X direction. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_shadow_offset_x(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_X); - return (int32_t)v.num; -} - -/** - * Get an offset on the shadow in pixels in Y direction. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_shadow_offset_y(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_Y); - return (int32_t)v.num; -} - -/** - * Make shadow calculation to use a larger or smaller rectangle as base. The value can - * be in pixels to make the area larger/smaller. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_shadow_spread(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_SPREAD); - return (int32_t)v.num; -} - -/** - * Get color of shadow. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR); - return v.color; -} - -/** - * Get color of shadow. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_SHADOW_COLOR)); - return v.color; -} - -/** - * Get opacity of shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_shadow_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_image_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get color to mix with the image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR); - return v.color; -} - -/** - * Get color to mix with the image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_IMAGE_RECOLOR)); - return v.color; -} - -/** - * Get intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get image colorkey definition. The lv_image_colorkey_t contains two color values: - * `high_color` and `low_color`. the color of pixels ranging from `low_color` to - * `high_color` will be transparent. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const lv_image_colorkey_t * lv_obj_get_style_image_colorkey(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_COLORKEY); - return (const lv_image_colorkey_t *)v.ptr; -} - -/** - * Get width of lines in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_line_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_WIDTH); - return (int32_t)v.num; -} - -/** - * Get width of dashes in pixels. Note that dash works only on horizontal and vertical lines. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_line_dash_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_WIDTH); - return (int32_t)v.num; -} - -/** - * Get gap between dashes in pixels. Note that dash works only on horizontal and - * vertical lines. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_line_dash_gap(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_GAP); - return (int32_t)v.num; -} - -/** - * Make end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline bool lv_obj_get_style_line_rounded(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_ROUNDED); - return (bool)v.num; -} - -/** - * Get color of lines. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_line_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR); - return v.color; -} - -/** - * Get color of lines. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_line_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR)); - return v.color; -} - -/** - * Get opacity of lines. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_line_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get width (thickness) of arcs in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_arc_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_WIDTH); - return (int32_t)v.num; -} - -/** - * Make end points of arcs rounded. `true`: rounded, `false`: perpendicular line ending. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline bool lv_obj_get_style_arc_rounded(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_ROUNDED); - return (bool)v.num; -} - -/** - * Get color of arc. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_arc_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR); - return v.color; -} - -/** - * Get color of arc. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_arc_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR)); - return v.color; -} - -/** - * Get opacity of arcs. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_arc_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get an image from which arc will be masked out. It's useful to display complex - * effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const void * lv_obj_get_style_arc_image_src(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_IMAGE_SRC); - return (const void *)v.ptr; -} - -/** - * Gets color of text. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_text_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR); - return v.color; -} - -/** - * Gets color of text. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_text_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR)); - return v.color; -} - -/** - * Get opacity of text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_text_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get font of text (a pointer `lv_font_t *`). - * Default: `LV_FONT_DEFAULT`, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const lv_font_t * lv_obj_get_style_text_font(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_FONT); - return (const lv_font_t *)v.ptr; -} - -/** - * Get letter space in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_text_letter_space(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE); - return (int32_t)v.num; -} - -/** - * Get line space in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_text_line_space(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE); - return (int32_t)v.num; -} - -/** - * Get decoration for the text. Possible values are - * `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well. - * Default: `LV_TEXT_DECOR_NONE`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_text_decor_t lv_obj_get_style_text_decor(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_DECOR); - return (lv_text_decor_t)v.num; -} - -/** - * Get how to align the lines of the text. Note that it doesn't align the Widget - * itself, only the lines inside the Widget. Possible values are - * `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base - * direction and uses left or right alignment accordingly. - * Default: `LV_TEXT_ALIGN_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_text_align_t lv_obj_get_style_text_align(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_ALIGN); - return (lv_text_align_t)v.num; -} - -/** - * Gets the color of letter outline stroke. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_text_outline_stroke_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OUTLINE_STROKE_COLOR); - return v.color; -} - -/** - * Gets the color of letter outline stroke. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_text_outline_stroke_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_TEXT_OUTLINE_STROKE_COLOR)); - return v.color; -} - -/** - * Get the letter outline stroke width in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_text_outline_stroke_width(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OUTLINE_STROKE_WIDTH); - return (int32_t)v.num; -} - -/** - * Get the opacity of the letter outline stroke. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means - * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_text_outline_stroke_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OUTLINE_STROKE_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get the text leading trim mode. Removes empty space above and/or below text based - * on font metrics (cap-height, x-height, baseline). Similar to CSS `text-box-trim`. - * Possible values are `LV_TEXT_LEADING_TRIM_NONE/CAPITAL_BASELINE/LOWER_BASELINE/CAPITAL/LOWER`. - * Default: `LV_TEXT_LEADING_TRIM_NONE`, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_text_leading_trim_t lv_obj_get_style_text_leading_trim(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LEADING_TRIM); - return (lv_text_leading_trim_t)v.num; -} - -/** - * Gets the intensity of blurring. Applied on each lv_part separately before the - * children are rendered. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_blur_radius(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLUR_RADIUS); - return (int32_t)v.num; -} - -/** - * If `true` the background of the widget will be blurred. The part should have < 100% - * opacity to make it visible. If `false` the given part will be blurred when it's - * rendered but before drawing the children. - * Default: `false`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline bool lv_obj_get_style_blur_backdrop(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLUR_BACKDROP); - return (bool)v.num; -} - -/** - * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over - * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower - * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. - * Default: `LV_BLUR_QUALITY_AUTO`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_blur_quality_t lv_obj_get_style_blur_quality(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLUR_QUALITY); - return (lv_blur_quality_t)v.num; -} - -/** - * Gets the intensity of blurring. Applied on each lv_part separately before the - * children are rendered. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_drop_shadow_radius(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_RADIUS); - return (int32_t)v.num; -} - -/** - * Get an offset on the shadow in pixels in X direction. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_drop_shadow_offset_x(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_OFFSET_X); - return (int32_t)v.num; -} - -/** - * Get an offset on the shadow in pixels in Y direction. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_drop_shadow_offset_y(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_OFFSET_Y); - return (int32_t)v.num; -} - -/** - * Get the color of the shadow. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_drop_shadow_color(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_COLOR); - return v.color; -} - -/** - * Get the color of the shadow. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_drop_shadow_color_filtered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_DROP_SHADOW_COLOR)); - return v.color; -} - -/** - * Get the opacity of the shadow. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_drop_shadow_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_OPA); - return (lv_opa_t)v.num; -} - -/** - * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over - * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower - * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. - * Default: `LV_BLUR_QUALITY_PRECISION`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_blur_quality_t lv_obj_get_style_drop_shadow_quality(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_DROP_SHADOW_QUALITY); - return (lv_blur_quality_t)v.num; -} - -/** - * Get radius on every corner. The value is interpreted in pixels (>= 0) or - * `LV_RADIUS_CIRCLE` for max radius. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_radius(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS); - return (int32_t)v.num; -} - -/** - * Move start point of object (e.g. scale tick) radially. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_radial_offset(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIAL_OFFSET); - return (int32_t)v.num; -} - -/** - * Enable clipping of content that overflows rounded corners of parent Widget. Can be - * `true` or `false`. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline bool lv_obj_get_style_clip_corner(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CLIP_CORNER); - return (bool)v.num; -} - -/** - * Scale down all opacity values of the Widget by this factor. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means - * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA); - return (lv_opa_t)v.num; -} - -/** - * First draw Widget on the layer, then scale down layer opacity factor. Value 0, - * `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or - * `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc - * means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_opa_layered(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA_LAYERED); - return (lv_opa_t)v.num; -} - -/** - * Mix a color with all colors of the Widget. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC); - return (const lv_color_filter_dsc_t *)v.ptr; -} - -/** - * The intensity of mixing of color filter. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_color_filter_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_OPA); - return (lv_opa_t)v.num; -} - -/** - * Get a color to mix to the obj. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_color_t lv_obj_get_style_recolor(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RECOLOR); - return v.color; -} - -/** - * Gets the intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means - * fully transparent. A value of 255, `LV_OPA_100` or `LV_OPA_COVER` means fully - * opaque. Intermediate values like LV_OPA_10, LV_OPA_20, etc result in - * semi-transparency. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_opa_t lv_obj_get_style_recolor_opa(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RECOLOR_OPA); - return (lv_opa_t)v.num; -} - -/** - * Animation template for Widget's animation. Should be a pointer to `lv_anim_t`. The - * animation parameters are widget specific, e.g. animation time could be the E.g. - * blink time of the cursor on the Text Area or scroll time of a roller. See Widgets' - * documentation to learn more. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const lv_anim_t * lv_obj_get_style_anim(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM); - return (const lv_anim_t *)v.ptr; -} - -/** - * Animation duration in milliseconds. Its meaning is widget specific. E.g. blink time - * of the cursor on the Text Area or scroll time of a roller. See Widgets' - * documentation to learn more. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline uint32_t lv_obj_get_style_anim_duration(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_DURATION); - return (uint32_t)v.num; -} - -/** - * An initialized ``lv_style_transition_dsc_t`` to describe a transition. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION); - return (const lv_style_transition_dsc_t *)v.ptr; -} - -/** - * Describes how to blend the colors to the background. Possible values are - * `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY/DIFFERENCE`. - * Default: `LV_BLEND_MODE_NORMAL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLEND_MODE); - return (lv_blend_mode_t)v.num; -} - -/** - * Get layout of Widget. Children will be repositioned and resized according to - * policies set for the layout. For possible values see documentation of the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline uint16_t lv_obj_get_style_layout(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LAYOUT); - return (uint16_t)v.num; -} - -/** - * Get base direction of Widget. Possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`. - * Default: `LV_BASE_DIR_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BASE_DIR); - return (lv_base_dir_t)v.num; -} - -/** - * If set, a layer will be created for the widget and the layer will be masked with - * this A8 bitmap mask. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const void * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BITMAP_MASK_SRC); - return (const void *)v.ptr; -} - -/** - * Adjust sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the - * rotary to half, 512: speeds up to double, 256: no change. - * Default: `256`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline uint32_t lv_obj_get_style_rotary_sensitivity(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ROTARY_SENSITIVITY); - return (uint32_t)v.num; -} - -#if LV_USE_FLEX -/** - * Defines in which direction the flex layout should arrange the children. - * Default: `LV_FLEX_FLOW_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_FLOW); - return (lv_flex_flow_t)v.num; -} - -/** - * Defines how to align the children in the direction of flex flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_MAIN_PLACE); - return (lv_flex_align_t)v.num; -} - -/** - * Defines how to align the children perpendicular to the direction of flex flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_CROSS_PLACE); - return (lv_flex_align_t)v.num; -} - -/** - * Defines how to align the tracks of the flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_TRACK_PLACE); - return (lv_flex_align_t)v.num; -} - -/** - * Defines how much space to take proportionally from the free space of the Widget's track. - * Default: `0`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_GROW); - return (uint8_t)v.num; -} - -#endif /* LV_USE_FLEX */ - -#if LV_USE_GRID -/** - * An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. - * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY); - return (const int32_t *)v.ptr; -} - -/** - * Defines how to distribute the columns. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_ALIGN); - return (lv_grid_align_t)v.num; -} - -/** - * An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. - * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline const int32_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_DSC_ARRAY); - return (const int32_t *)v.ptr; -} - -/** - * Defines how to distribute the rows. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_ALIGN); - return (lv_grid_align_t)v.num; -} - -/** - * Get column in which Widget should be placed. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_POS); - return (int32_t)v.num; -} - -/** - * Get how to align Widget horizontally. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_X_ALIGN); - return (lv_grid_align_t)v.num; -} - -/** - * Get how many columns Widget should span. Needs to be >= 1. - * Default: 1, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_SPAN); - return (int32_t)v.num; -} - -/** - * Get row in which Widget should be placed. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS); - return (int32_t)v.num; -} - -/** - * Get how to align Widget vertically. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_Y_ALIGN); - return (lv_grid_align_t)v.num; -} - -/** - * Get how many rows Widget should span. Needs to be >= 1. - * Default: 1, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param part One of the `LV_PART_...` enum values - */ -static inline int32_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, lv_part_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_SPAN); - return (int32_t)v.num; -} - -#endif /* LV_USE_GRID */ - -/** - * Sets width of Widget. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. - * Percentage values are relative to the width of the parent's content area. - * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets a minimal width. Pixel and percentage values can be used. Percentage values - * are relative to the width of the parent's content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_min_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets a maximal width. Pixel and percentage values can be used. Percentage values - * are relative to the width of the parent's content area. - * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_max_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets height of Widget. Pixel, percentage and `LV_SIZE_CONTENT` can be used. - * Percentage values are relative to the height of the parent's content area. - * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_height(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets a minimal height. Pixel and percentage values can be used. Percentage values - * are relative to the height of the parent's content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_min_height(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets a maximal height. Pixel and percentage values can be used. Percentage values - * are relative to the height of the parent's content area. - * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_max_height(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Its meaning depends on the type of Widget. For example in case of lv_scale it means - * the length of the ticks. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_length(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set X coordinate of Widget considering the ``align`` setting. Pixel and percentage - * values can be used. Percentage values are relative to the width of the parent's - * content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set Y coordinate of Widget considering the ``align`` setting. Pixel and percentage - * values can be used. Percentage values are relative to the height of the parent's - * content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set the alignment which tells from which point of the parent the X and Y - * coordinates should be interpreted. Possible values are: `LV_ALIGN_DEFAULT`, - * `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, - * `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means - * `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base - * direction. - * Default: `LV_ALIGN_DEFAULT`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_align(lv_obj_t * obj, lv_align_t value, lv_style_selector_t selector); - -/** - * Make Widget wider on both sides with this value. Pixel and percentage (with - * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's width. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transform_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Make Widget higher on both sides with this value. Pixel and percentage (with - * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's height. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transform_height(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Move Widget with this value in X direction. Applied after layouts, aligns and other - * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage - * values are relative to Widget's width. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_translate_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Move Widget with this value in Y direction. Applied after layouts, aligns and other - * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage - * values are relative to Widget's height. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_translate_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Move object around the centre of the parent object (e.g. around the circumference - * of a scale). - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_translate_radial(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Zoom Widget horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 - * half size, 512 double size, and so on. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transform_scale_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Zoom Widget vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 - * half size, 512 double size, and so on. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transform_scale_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Rotate Widget. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transform_rotation(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set pivot point's X coordinate for transformations. Relative to Widget's top left corner. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transform_pivot_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set pivot point's Y coordinate for transformations. Relative to Widget's top left corner. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transform_pivot_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Skew Widget horizontally. The value is interpreted in 0.1 degree units. E.g. 450 - * means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transform_skew_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Skew Widget vertically. The value is interpreted in 0.1 degree units. E.g. 450 - * means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transform_skew_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets the padding on the top. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_pad_top(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets the padding on the bottom. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_pad_bottom(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets the padding on the left. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_pad_left(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets the padding on the right. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_pad_right(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets the padding between the rows. Used by the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_pad_row(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets the padding between the columns. Used by the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_pad_column(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Pad text labels away from the scale ticks/remainder of the ``LV_PART_``. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_pad_radial(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets margin on the top. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_margin_top(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets margin on the bottom. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_margin_bottom(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets margin on the left. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_margin_left(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Sets margin on the right. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_margin_right(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set background color of Widget. - * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_grad_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set direction of the gradient of the background. Possible values are - * `LV_GRAD_DIR_NONE/HOR/VER`. - * Default: `LV_GRAD_DIR_NONE`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_grad_dir(lv_obj_t * obj, lv_grad_dir_t value, lv_style_selector_t selector); - -/** - * Set point from which background color should start for gradients. 0 means to - * top/left side, 255 the bottom/right side, 128 the center, and so on. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_main_stop(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set point from which background's gradient color should start. 0 means to top/left - * side, 255 the bottom/right side, 128 the center, and so on. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_grad_stop(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set opacity of the first gradient color. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_main_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set opacity of the second gradient color. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_grad_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set gradient definition. The pointed instance must exist while Widget is alive. - * NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and - * `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors - * as well. If it's set other gradient related properties will be ignored. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to gradient descriptor - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_grad(lv_obj_t * obj, const lv_grad_dsc_t * value, lv_style_selector_t selector); - -/** - * Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or - * an `LV_SYMBOL_...`. - * Default: `NULL`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Pointer to image source - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_image_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector); - -/** - * Set opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means - * fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other - * values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_image_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set a color to mix to the background image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_image_recolor(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set intensity of background image recoloring. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full - * recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted - * proportionally. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_image_recolor_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * If enabled the background image will be tiled. Possible values are `true` or `false`. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bg_image_tiled(lv_obj_t * obj, bool value, lv_style_selector_t selector); - -/** - * Set color of the border. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_border_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_border_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set width of the border. Only pixel values can be used. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_border_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set only which side(s) the border should be drawn. Possible values are - * `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as - * well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`. - * Default: `LV_BORDER_SIDE_FULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_border_side(lv_obj_t * obj, lv_border_side_t value, lv_style_selector_t selector); - -/** - * Sets whether the border should be drawn before or after the children are drawn. - * `true`: after children, `false`: before children. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_border_post(lv_obj_t * obj, bool value, lv_style_selector_t selector); - -/** - * Set width of outline in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_outline_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set color of outline. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_outline_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set opacity of outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_outline_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set padding of outline, i.e. the gap between Widget and the outline. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_outline_pad(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set width of the shadow in pixels. The value should be >= 0. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_shadow_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set an offset on the shadow in pixels in X direction. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_shadow_offset_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set an offset on the shadow in pixels in Y direction. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_shadow_offset_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Make shadow calculation to use a larger or smaller rectangle as base. The value can - * be in pixels to make the area larger/smaller. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_shadow_spread(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set color of shadow. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_shadow_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set opacity of shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_shadow_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_image_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set color to mix with the image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_image_recolor(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_image_recolor_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set image colorkey definition. The lv_image_colorkey_t contains two color values: - * `high_color` and `low_color`. the color of pixels ranging from `low_color` to - * `high_color` will be transparent. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to image color key - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_image_colorkey(lv_obj_t * obj, const lv_image_colorkey_t * value, lv_style_selector_t selector); - -/** - * Set width of lines in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_line_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set width of dashes in pixels. Note that dash works only on horizontal and vertical lines. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_line_dash_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set gap between dashes in pixels. Note that dash works only on horizontal and - * vertical lines. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_line_dash_gap(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Make end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_line_rounded(lv_obj_t * obj, bool value, lv_style_selector_t selector); - -/** - * Set color of lines. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_line_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set opacity of lines. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_line_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set width (thickness) of arcs in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_arc_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Make end points of arcs rounded. `true`: rounded, `false`: perpendicular line ending. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_arc_rounded(lv_obj_t * obj, bool value, lv_style_selector_t selector); - -/** - * Set color of arc. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_arc_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set opacity of arcs. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_arc_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set an image from which arc will be masked out. It's useful to display complex - * effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to image source - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_arc_image_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector); - -/** - * Sets color of text. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set opacity of text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set font of text (a pointer `lv_font_t *`). - * Default: `LV_FONT_DEFAULT`, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to font - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_font(lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector); - -/** - * Set letter space in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_letter_space(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set line space in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_line_space(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set decoration for the text. Possible values are - * `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well. - * Default: `LV_TEXT_DECOR_NONE`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_decor(lv_obj_t * obj, lv_text_decor_t value, lv_style_selector_t selector); - -/** - * Set how to align the lines of the text. Note that it doesn't align the Widget - * itself, only the lines inside the Widget. Possible values are - * `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base - * direction and uses left or right alignment accordingly. - * Default: `LV_TEXT_ALIGN_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_align(lv_obj_t * obj, lv_text_align_t value, lv_style_selector_t selector); - -/** - * Sets the color of letter outline stroke. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_outline_stroke_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set the letter outline stroke width in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_outline_stroke_width(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set the opacity of the letter outline stroke. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means - * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_outline_stroke_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set the text leading trim mode. Removes empty space above and/or below text based - * on font metrics (cap-height, x-height, baseline). Similar to CSS `text-box-trim`. - * Possible values are `LV_TEXT_LEADING_TRIM_NONE/CAPITAL_BASELINE/LOWER_BASELINE/CAPITAL/LOWER`. - * Default: `LV_TEXT_LEADING_TRIM_NONE`, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_text_leading_trim(lv_obj_t * obj, lv_text_leading_trim_t value, lv_style_selector_t selector); - -/** - * Sets the intensity of blurring. Applied on each lv_part separately before the - * children are rendered. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_blur_radius(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * If `true` the background of the widget will be blurred. The part should have < 100% - * opacity to make it visible. If `false` the given part will be blurred when it's - * rendered but before drawing the children. - * Default: `false`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_blur_backdrop(lv_obj_t * obj, bool value, lv_style_selector_t selector); - -/** - * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over - * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower - * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. - * Default: `LV_BLUR_QUALITY_AUTO`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_blur_quality(lv_obj_t * obj, lv_blur_quality_t value, lv_style_selector_t selector); - -/** - * Sets the intensity of blurring. Applied on each lv_part separately before the - * children are rendered. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_drop_shadow_radius(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set an offset on the shadow in pixels in X direction. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_drop_shadow_offset_x(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set an offset on the shadow in pixels in Y direction. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_drop_shadow_offset_y(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set the color of the shadow. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_drop_shadow_color(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Set the opacity of the shadow. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_drop_shadow_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over - * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower - * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. - * Default: `LV_BLUR_QUALITY_PRECISION`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_drop_shadow_quality(lv_obj_t * obj, lv_blur_quality_t value, lv_style_selector_t selector); - -/** - * Set radius on every corner. The value is interpreted in pixels (>= 0) or - * `LV_RADIUS_CIRCLE` for max radius. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_radius(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Move start point of object (e.g. scale tick) radially. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_radial_offset(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Enable clipping of content that overflows rounded corners of parent Widget. Can be - * `true` or `false`. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_clip_corner(lv_obj_t * obj, bool value, lv_style_selector_t selector); - -/** - * Scale down all opacity values of the Widget by this factor. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means - * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * First draw Widget on the layer, then scale down layer opacity factor. Value 0, - * `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or - * `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc - * means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_opa_layered(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Mix a color with all colors of the Widget. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to color-filter descriptor - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value, - lv_style_selector_t selector); - -/** - * The intensity of mixing of color filter. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_color_filter_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Set a color to mix to the obj. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Color to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_recolor(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); - -/** - * Sets the intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means - * fully transparent. A value of 255, `LV_OPA_100` or `LV_OPA_COVER` means fully - * opaque. Intermediate values like LV_OPA_10, LV_OPA_20, etc result in - * semi-transparency. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_recolor_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); - -/** - * Animation template for Widget's animation. Should be a pointer to `lv_anim_t`. The - * animation parameters are widget specific, e.g. animation time could be the E.g. - * blink time of the cursor on the Text Area or scroll time of a roller. See Widgets' - * documentation to learn more. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to animation descriptor - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_anim(lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector); - -/** - * Animation duration in milliseconds. Its meaning is widget specific. E.g. blink time - * of the cursor on the Text Area or scroll time of a roller. See Widgets' - * documentation to learn more. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_anim_duration(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector); - -/** - * An initialized ``lv_style_transition_dsc_t`` to describe a transition. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to transition descriptor - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_transition(lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector); - -/** - * Describes how to blend the colors to the background. Possible values are - * `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY/DIFFERENCE`. - * Default: `LV_BLEND_MODE_NORMAL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_blend_mode(lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector); - -/** - * Set layout of Widget. Children will be repositioned and resized according to - * policies set for the layout. For possible values see documentation of the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_layout(lv_obj_t * obj, uint16_t value, lv_style_selector_t selector); - -/** - * Set base direction of Widget. Possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`. - * Default: `LV_BASE_DIR_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_base_dir(lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector); - -/** - * If set, a layer will be created for the widget and the layer will be masked with - * this A8 bitmap mask. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to A8 bitmap mask - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector); - -/** - * Adjust sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the - * rotary to half, 512: speeds up to double, 256: no change. - * Default: `256`, inherited: Yes, layout: No, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_rotary_sensitivity(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector); - -#if LV_USE_FLEX -/** - * Defines in which direction the flex layout should arrange the children. - * Default: `LV_FLEX_FLOW_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector); - -/** - * Defines how to align the children in the direction of flex flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); - -/** - * Defines how to align the children perpendicular to the direction of flex flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); - -/** - * Defines how to align the tracks of the flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); - -/** - * Defines how much space to take proportionally from the free space of the Widget's track. - * Default: `0`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_flex_grow(lv_obj_t * obj, uint8_t value, lv_style_selector_t selector); - -#endif /* LV_USE_FLEX */ - -#if LV_USE_GRID -/** - * An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. - * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to grid-column descriptor array - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector); - -/** - * Defines how to distribute the columns. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_column_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); - -/** - * An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. - * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Pointer to grid-row descriptor array - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector); - -/** - * Defines how to distribute the rows. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_row_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); - -/** - * Set column in which Widget should be placed. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_cell_column_pos(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set how to align Widget horizontally. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_cell_x_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); - -/** - * Set how many columns Widget should span. Needs to be >= 1. - * Default: 1, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set row in which Widget should be placed. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_cell_row_pos(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -/** - * Set how to align Widget vertically. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_cell_y_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); - -/** - * Set how many rows Widget should span. Needs to be >= 1. - * Default: 1, inherited: No, layout: Yes, ext. draw: No. - * @param obj Pointer to Widget - * @param value Value to submit - * @param selector A joint type for `lv_part_t` and `lv_state_t`. Example values: - * - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT` - * - `LV_STATE_PRESSED` - * - `LV_PART_KNOB` - * - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED` - */ -void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, int32_t value, lv_style_selector_t selector); - -#endif /* LV_USE_GRID */ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_OBJ_STYLE_GEN_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_obj_style_private.h b/src/core/lv_obj_style_private.h index 59eeb72873..6b944d515a 100644 --- a/src/core/lv_obj_style_private.h +++ b/src/core/lv_obj_style_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_obj_style.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/core/lv_obj_tree.c b/src/core/lv_obj_tree.c index a35dec99d7..9016b29c4e 100644 --- a/src/core/lv_obj_tree.c +++ b/src/core/lv_obj_tree.c @@ -8,12 +8,9 @@ *********************/ #include "lv_obj_private.h" #include "lv_obj_class_private.h" -#include "../indev/lv_indev.h" #include "../indev/lv_indev_private.h" -#include "../display/lv_display.h" #include "../display/lv_display_private.h" #include "../misc/lv_anim_private.h" -#include "../misc/lv_async.h" #include "../core/lv_global.h" /********************* diff --git a/src/core/lv_obj_tree.h b/src/core/lv_obj_tree.h index 9850b5ad10..b394586eaa 100644 --- a/src/core/lv_obj_tree.h +++ b/src/core/lv_obj_tree.h @@ -1,321 +1,2 @@ -/** - * @file lv_obj_tree.h - * - */ - -#ifndef LV_OBJ_TREE_H -#define LV_OBJ_TREE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_types.h" -#include "../misc/lv_anim.h" -#include "../display/lv_display.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_OBJ_TREE_WALK_NEXT, - LV_OBJ_TREE_WALK_SKIP_CHILDREN, - LV_OBJ_TREE_WALK_END, -} lv_obj_tree_walk_res_t; - -typedef lv_obj_tree_walk_res_t (*lv_obj_tree_walk_cb_t)(lv_obj_t *, void *); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Delete an object and all of its children. - * Also remove the objects from their group and remove all animations (if any). - * Send `LV_EVENT_DELETE` to deleted objects. - * @param obj pointer to an object - */ -void lv_obj_delete(lv_obj_t * obj); - -/** - * Delete all children of an object. - * Also remove the objects from their group and remove all animations (if any). - * Send `LV_EVENT_DELETE` to deleted objects. - * @param obj pointer to an object - */ -void lv_obj_clean(lv_obj_t * obj); - -/** - * Delete an object after some delay - * @param obj pointer to an object - * @param delay_ms time to wait before delete in milliseconds - */ -void lv_obj_delete_delayed(lv_obj_t * obj, uint32_t delay_ms); - -/** - * A function to be easily used in animation ready callback to delete an object when the animation is ready - * @param a pointer to the animation - */ -void lv_obj_delete_anim_completed_cb(lv_anim_t * a); - -/** - * Helper function for asynchronously deleting objects. - * Useful for cases where you can't delete an object directly in an `LV_EVENT_DELETE` handler (i.e. parent). - * @param obj object to delete - * @see lv_async_call - */ -void lv_obj_delete_async(lv_obj_t * obj); - -/** - * Move the parent of an object. The relative coordinates will be kept. - * - * @param obj pointer to an object whose parent needs to be changed - * @param parent pointer to the new parent - */ -void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent); - -/** - * Swap the positions of two objects. - * When used in listboxes, it can be used to sort the listbox items. - * @param obj1 pointer to the first object - * @param obj2 pointer to the second object - */ -void lv_obj_swap(lv_obj_t * obj1, lv_obj_t * obj2); - -/** - * moves the object to the given index in its parent. - * When used in listboxes, it can be used to sort the listbox items. - * @param obj pointer to the object to be moved. - * @param index new index in parent. -1 to count from the back - * @note to move to the background: lv_obj_move_to_index(obj, 0) - * @note to move forward (up): lv_obj_move_to_index(obj, lv_obj_get_index(obj) - 1) - */ -void lv_obj_move_to_index(lv_obj_t * obj, int32_t index); - -/** - * Get the screen of an object - * @param obj pointer to an object - * @return pointer to the object's screen - */ -lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj); - -/** - * Get the display of the object - * @param obj pointer to an object - * @return pointer to the object's display - */ -lv_display_t * lv_obj_get_display(const lv_obj_t * obj); - -/** - * Get the parent of an object - * @param obj pointer to an object - * @return the parent of the object. (NULL if `obj` was a screen) - */ -lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj); - -/** - * Get the child of an object by the child's index. - * @param obj pointer to an object whose child should be get - * @param idx the index of the child. - * 0: the oldest (firstly created) child - * 1: the second oldest - * child count-1: the youngest - * -1: the youngest - * -2: the second youngest - * @return pointer to the child or NULL if the index was invalid - */ -lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, int32_t idx); - -/** - * Get the child of an object by the child's index. Consider the children only with a given type. - * @param obj pointer to an object whose child should be get - * @param idx the index of the child. - * 0: the oldest (firstly created) child - * 1: the second oldest - * child count-1: the youngest - * -1: the youngest - * -2: the second youngest - * @param class_p the type of the children to check - * @return pointer to the child or NULL if the index was invalid - */ -lv_obj_t * lv_obj_get_child_by_type(const lv_obj_t * obj, int32_t idx, - const lv_obj_class_t * class_p); - -/** - * Return a sibling of an object - * @param obj pointer to an object whose sibling should be get - * @param idx 0: `obj` itself - * -1: the first older sibling - * -2: the next older sibling - * 1: the first younger sibling - * 2: the next younger sibling - * etc - * @return pointer to the requested sibling or NULL if there is no such sibling - */ -lv_obj_t * lv_obj_get_sibling(const lv_obj_t * obj, int32_t idx); - -/** - * Return a sibling of an object. Consider the siblings only with a given type. - * @param obj pointer to an object whose sibling should be get - * @param idx 0: `obj` itself - * -1: the first older sibling - * -2: the next older sibling - * 1: the first younger sibling - * 2: the next younger sibling - * etc - * @param class_p the type of the children to check - * @return pointer to the requested sibling or NULL if there is no such sibling - */ -lv_obj_t * lv_obj_get_sibling_by_type(const lv_obj_t * obj, int32_t idx, - const lv_obj_class_t * class_p); - -/** - * Get the number of children - * @param obj pointer to an object - * @return the number of children - */ -uint32_t lv_obj_get_child_count(const lv_obj_t * obj); - -/** - * Get the number of children having a given type. - * @param obj pointer to an object - * @param class_p the type of the children to check - * @return the number of children - */ - -uint32_t lv_obj_get_child_count_by_type(const lv_obj_t * obj, const lv_obj_class_t * class_p); - -#if LV_USE_OBJ_NAME - -/** - * Set a name for a widget. The name will be allocated and freed when the - * widget is deleted or a new name is set. - * @param obj pointer to an object - * @param name the name to set. If set to `NULL` the default "_#" - * name will be used. - * @note If the name ends with a `#`, older siblings with the same name - * will be counted, and the `#` will be replaced by the index of the - * given widget. For example, creating multiple widgets with the name - * "mybtn_#" will result in resolved names like "mybtn_0", "mybtn_1", - * "mybtn_2", etc. The name is resolved when `lv_obj_get_name_resolved` - * is called, so the result reflects the currently existing widgets at - * that time. - */ -void lv_obj_set_name(lv_obj_t * obj, const char * name); - -/** - * Set a name for a widget. Only a pointer will be saved. - * @param obj pointer to an object - * @param name the name to set. If set to `NULL` the default "_#" - * name will be used. - * @note If the name ends with a `#`, older siblings with the same name - * will be counted, and the `#` will be replaced by the index of the - * given widget. For example, creating multiple widgets with the name - * "mybtn_#" will result in resolved names like "mybtn_0", "mybtn_1", - * "mybtn_2", etc. The name is resolved when `lv_obj_get_name_resolved` - * is called, so the result reflects the currently existing widgets at - * that time. - */ -void lv_obj_set_name_static(lv_obj_t * obj, const char * name); - -/** - * Get the set name as it was set. - * @param obj pointer to an object - * @return get the set name or NULL if it wasn't set yet - */ -const char * lv_obj_get_name(const lv_obj_t * obj); - -/** - * Get the set name or craft a name automatically. - * @param obj pointer to an object - * @param buf buffer to store the name - * @param buf_size the size of the buffer in bytes - * @note If the name ends with a `#`, older siblings with the same name - * will be counted, and the `#` will be replaced by the index of the - * given widget. For example, creating multiple widgets with the name - * "mybtn_#" will result in resolved names like "mybtn_0", "mybtn_1", - * "mybtn_2", etc. The name is resolved when `lv_obj_get_name_resolved` - * is called, so the result reflects the currently existing widgets at - * that time. - */ -void lv_obj_get_name_resolved(const lv_obj_t * obj, char buf[], size_t buf_size); - -/** - * Find a child with a given name on a parent. This child doesn't have to be the - * direct child of the parent. First direct children of the parent will be checked, - * and the direct children of the first child, etc. (Breadth-first search). - * - * If the name of a widget was not set a name like "lv_button_1" will - * be created for it using `lv_obj_get_name_resolved`. - * - * @param parent the widget where the search should start - * @return the found widget or NULL if not found. - */ -lv_obj_t * lv_obj_find_by_name(const lv_obj_t * parent, const char * name); - -/** - * Get an object by name. The name can be a path too, for example - * "main_container/lv_button_1/label". - * In this case the first part of the name-path should be the direct child of the parent, - * the second part, should the direct child of first one, etc. - * - * If the name of a widget was not set a name like "lv_button_1" will - * be created for it using `lv_obj_get_name_resolved`. - * - * @param parent the widget where the search should start - * @return the found widget or NULL if not found. - */ -lv_obj_t * lv_obj_get_child_by_name(const lv_obj_t * parent, const char * name_path); - -#endif /*LV_USE_OBJ_NAME*/ - -/** - * Get the index of a child. - * @param obj pointer to an object - * @return the child index of the object. - * E.g. 0: the oldest (firstly created child). - * (-1 if child could not be found or no parent exists) - */ -int32_t lv_obj_get_index(const lv_obj_t * obj); - -/** - * Get the index of a child. Consider the children only with a given type. - * @param obj pointer to an object - * @param class_p the type of the children to check - * @return the child index of the object. - * E.g. 0: the oldest (firstly created child with the given class). - * (-1 if child could not be found or no parent exists) - */ -int32_t lv_obj_get_index_by_type(const lv_obj_t * obj, const lv_obj_class_t * class_p); - -/** - * Iterate through all children of any object. - * @param start_obj start integrating from this object - * @param cb call this callback on the objects - * @param user_data pointer to any user related data (will be passed to `cb`) - */ -void lv_obj_tree_walk(lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void * user_data); - -/** - * Iterate through all children of any object and print their ID. - * @param start_obj start integrating from this object - */ -void lv_obj_dump_tree(lv_obj_t * start_obj); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBJ_TREE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_observer.c b/src/core/lv_observer.c index 67567b18f6..5c13ef17c7 100644 --- a/src/core/lv_observer.c +++ b/src/core/lv_observer.c @@ -10,7 +10,7 @@ #include "lv_observer_private.h" #if LV_USE_OBSERVER -#include "../lvgl.h" +#include "../lv_public_api.h" #include "../core/lv_obj_private.h" #include "../misc/lv_event_private.h" diff --git a/src/core/lv_observer.h b/src/core/lv_observer.h index 943bf01ba3..68c5cc88e4 100644 --- a/src/core/lv_observer.h +++ b/src/core/lv_observer.h @@ -1,622 +1,2 @@ -/** - * @file lv_observer.h - * - */ - -#ifndef LV_OBSERVER_H -#define LV_OBSERVER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../misc/lv_ext_data.h" -#include "lv_obj.h" - -#if LV_USE_OBSERVER - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * Values for lv_subject_t's `type` field - */ -typedef enum { - LV_SUBJECT_TYPE_INVALID = 0, /**< indicates Subject not initialized yet */ - LV_SUBJECT_TYPE_NONE = 1, /**< a null value like None or NILt */ - LV_SUBJECT_TYPE_INT = 2, /**< an int32_t */ - LV_SUBJECT_TYPE_FLOAT = 3, /**< a float, requires `LV_USE_FLOAT 1` */ - LV_SUBJECT_TYPE_POINTER = 4, /**< a void pointer */ - LV_SUBJECT_TYPE_COLOR = 5, /**< an lv_color_t */ - LV_SUBJECT_TYPE_GROUP = 6, /**< an array of Subjects */ - LV_SUBJECT_TYPE_STRING = 7, /**< a char pointer */ -} lv_subject_type_t; - -/** - * A common type to handle all the various observable types in the same way - */ -typedef union { - int32_t num; /**< Integer number (opacity, enums, booleans or "normal" numbers) */ - const void * pointer; /**< Constant pointer (string buffer, format string, font, cone text, etc.) */ - lv_color_t color; /**< Color */ -#if LV_USE_FLOAT - float float_v; /**< Floating point value*/ -#endif -} lv_subject_value_t; - -/** - * The Subject (an observable value) - */ -struct _lv_subject_t { -#if LV_USE_EXT_DATA - lv_ext_data_t ext_data; -#endif - lv_ll_t subs_ll; /**< Subscribers */ - lv_subject_value_t value; /**< Current value */ - lv_subject_value_t prev_value; /**< Previous value */ - lv_subject_value_t min_value; /**< Minimum value for min. int or float*/ - lv_subject_value_t max_value; /**< Maximum value for max. int or float*/ - void * user_data; /**< Additional parameter, can be used freely by user */ - uint32_t type : 4; /**< One of the LV_SUBJECT_TYPE_... values */ - uint32_t size : 24; /**< String buffer size or group length */ - uint32_t notify_restart_query : 1; /**< If an Observer was deleted during notification, - * start notifying from the beginning. */ -}; - -/** - * Callback called to notify Observer that Subject's value has changed - * @param observer pointer to Observer - * @param subject pointer to Subject being observed - */ -typedef void (*lv_observer_cb_t)(lv_observer_t * observer, lv_subject_t * subject); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -#if LV_USE_EXT_DATA -/** - * @brief Attaches external user data to an integer Subject with lifecycle management - * - * Associates arbitrary user-defined data with an LVGL observer and registers a destructor - * callback that will be automatically invoked when the observer is deleted. This enables: - * - Safe resource cleanup through the destructor mechanism - * - Contextual data storage for observer callbacks - * - Proper memory management for observer-related resources - * - * @param subject pointer to Subject - * @param data User-defined data pointer to associate - * @param free_cb Cleanup function called when: - * - Observer is explicitly deleted - * - Observed object is deleted - * - New data replaces current association - * NULL indicates no cleanup required - */ -void lv_subject_set_external_data(lv_subject_t * subject, void * data, void (* free_cb)(void * data)); -#endif - -/** - * Initialize an integer-type Subject. - * @param subject pointer to Subject - * @param value initial value - */ -void lv_subject_init_int(lv_subject_t * subject, int32_t value); - -/** - * Set value of an integer Subject and notify Observers. - * @param subject pointer to Subject - * @param value new value - */ -void lv_subject_set_int(lv_subject_t * subject, int32_t value); - -/** - * Get current value of an integer Subject. - * @param subject pointer to Subject - * @return current value - */ -int32_t lv_subject_get_int(lv_subject_t * subject); - -/** - * Get previous value of an integer Subject. - * @param subject pointer to Subject - * @return current value - */ -int32_t lv_subject_get_previous_int(lv_subject_t * subject); - - -/** - * Set a minimum value for an integer subject - * @param subject pointer to Subject - * @param min_value the minimum value - */ -void lv_subject_set_min_value_int(lv_subject_t * subject, int32_t min_value); - -/** - * Set a maximum value for an integer subject - * @param subject pointer to Subject - * @param max_value the maximum value - */ -void lv_subject_set_max_value_int(lv_subject_t * subject, int32_t max_value); - -#if LV_USE_FLOAT - -/** - * Initialize an float-type Subject. - * @param subject pointer to Subject - * @param value initial value - */ -void lv_subject_init_float(lv_subject_t * subject, float value); - -/** - * Set value of an float Subject and notify Observers. - * @param subject pointer to Subject - * @param value new value - */ -void lv_subject_set_float(lv_subject_t * subject, float value); - -/** - * Get current value of an float Subject. - * @param subject pointer to Subject - * @return current value - */ -float lv_subject_get_float(lv_subject_t * subject); - -/** - * Get previous value of an float Subject. - * @param subject pointer to Subject - * @return current value - */ -float lv_subject_get_previous_float(lv_subject_t * subject); - -/** - * Set a minimum value for a float subject - * @param subject pointer to Subject - * @param min_value the minimum value - */ -void lv_subject_set_min_value_float(lv_subject_t * subject, float min_value); - -/** - * Set a maximum value for a float subject - * @param subject pointer to Subject - * @param max_value the maximum value - */ -void lv_subject_set_max_value_float(lv_subject_t * subject, float max_value); - -#endif /*LV_USE_FLOAT*/ - -/** - * Initialize a string-type Subject. - * @param subject pointer to Subject - * @param buf pointer to buffer to store string - * @param prev_buf pointer to buffer to store previous string; can be NULL if not used - * @param size size of buffer(s) - * @param value initial value of string, e.g. "hello" - * @note A string Subject stores its own copy of the string, not just the pointer. - */ -void lv_subject_init_string(lv_subject_t * subject, char * buf, char * prev_buf, size_t size, const char * value); - -/** - * Copy a string to a Subject and notify Observers if it changed. - * @param subject pointer to Subject - * @param buf new string - */ -void lv_subject_copy_string(lv_subject_t * subject, const char * buf); - -/** - * Format a new string, updating Subject, and notify Observers if it changed. - * @param subject pointer to Subject - * @param format format string - */ -void lv_subject_snprintf(lv_subject_t * subject, const char * format, ...) LV_FORMAT_ATTRIBUTE(2, 3); - -/** - * Get current value of a string Subject. - * @param subject pointer to Subject - * @return pointer to buffer containing current value - */ -const char * lv_subject_get_string(lv_subject_t * subject); - -/** - * Get previous value of a string Subject. - * @param subject pointer to Subject - * @return pointer to buffer containing previous value - * @note NULL will be returned if NULL was passed in `lv_subject_init_string()` - * as `prev_buf`. - */ -const char * lv_subject_get_previous_string(lv_subject_t * subject); - -/** - * Initialize a pointer-type Subject. - * @param subject pointer to Subject - * @param value initial value - */ -void lv_subject_init_pointer(lv_subject_t * subject, void * value); - -/** - * Set value of a pointer Subject and notify Observers (regardless of whether it changed). - * @param subject pointer to Subject - * @param ptr new value - */ -void lv_subject_set_pointer(lv_subject_t * subject, void * ptr); - -/** - * Get current value of a pointer Subject. - * @param subject pointer to Subject - * @return current value - */ -const void * lv_subject_get_pointer(lv_subject_t * subject); - -/** - * Get previous value of a pointer Subject. - * @param subject pointer to Subject - * @return previous value - */ -const void * lv_subject_get_previous_pointer(lv_subject_t * subject); - -/** - * Initialize a color-type Subject. - * @param subject pointer to Subject - * @param color initial value - */ -void lv_subject_init_color(lv_subject_t * subject, lv_color_t color); - -/** - * Set value of a color Subject and notify Observers if it changed. - * @param subject pointer to Subject - * @param color new value - */ -void lv_subject_set_color(lv_subject_t * subject, lv_color_t color); - -/** - * Get current value of a color Subject. - * @param subject pointer to Subject - * @return current value - */ -lv_color_t lv_subject_get_color(lv_subject_t * subject); - -/** - * Get previous value of a color Subject. - * @param subject pointer to Subject - * @return previous value - */ -lv_color_t lv_subject_get_previous_color(lv_subject_t * subject); - -/** - * Initialize a Group-type Subject. - * @param group_subject pointer to Group-type Subject - * @param list list of other Subject addresses; when any of these have values - updated, Observers of `group_subject` will be notified. - * @param list_len number of elements in `list[]` - */ -void lv_subject_init_group(lv_subject_t * group_subject, lv_subject_t * list[], uint32_t list_len); - -/** - * Remove all Observers from a Subject and free allocated memory, and delete - * any associated Widget-Binding events. This leaves `subject` "disconnected" from - * all Observers and all associated Widget events established through Widget Binding. - * @param subject pointer to Subject - * @note This can safely be called regardless of whether any Observers - * added with `lv_subject_add_observer_obj()` or bound to a Widget Property - * with one of the `..._bind_...()` functions. - */ -void lv_subject_deinit(lv_subject_t * subject); - -/** - * Get an element from Subject Group's list. - * @param subject pointer to Group-type Subject - * @param index index of element to get - * @return pointer to indexed Subject from list, or NULL if index is out of bounds - */ -lv_subject_t * lv_subject_get_group_element(lv_subject_t * subject, int32_t index); - -/** - * Add Observer to Subject. When Subject's value changes `observer_cb` will be called. - * @param subject pointer to Subject - * @param observer_cb notification callback - * @param user_data optional user data - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_subject_add_observer(lv_subject_t * subject, lv_observer_cb_t observer_cb, void * user_data); - -/** - * Add Observer to Subject for a Widget. - * When the Widget is deleted, Observer will be unsubscribed from Subject automatically. - * @param subject pointer to Subject - * @param observer_cb notification callback - * @param obj pointer to Widget - * @param user_data optional user data - * @return pointer to newly-created Observer - * @note Do not call `lv_observer_remove()` on Observers created this way. - * Only clean up such Observers by either: - * - deleting the Widget, or - * - calling `lv_subject_deinit()` to gracefully de-couple and - * remove all Observers. - */ -lv_observer_t * lv_subject_add_observer_obj(lv_subject_t * subject, lv_observer_cb_t observer_cb, lv_obj_t * obj, - void * user_data); - -/** - * Add an Observer to a Subject and also save a target pointer. - * @param subject pointer to Subject - * @param observer_cb notification callback - * @param target any pointer (NULL is okay) - * @param user_data optional user data - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_subject_add_observer_with_target(lv_subject_t * subject, lv_observer_cb_t observer_cb, - void * target, void * user_data); - -/** - * Remove Observer from its Subject. - * @param observer pointer to Observer - */ -void lv_observer_remove(lv_observer_t * observer); - -/** - * Remove Observers associated with Widget `obj` from specified `subject` or all Subjects. - * @param obj pointer to Widget whose Observers should be removed - * @param subject Subject to remove Widget from, or NULL to remove from all Subjects - * @note This function can be used e.g. when a Widget's Subject(s) needs to - * be replaced by other Subject(s) - */ -void lv_obj_remove_from_subject(lv_obj_t * obj, lv_subject_t * subject); - -/** - * Get target of an Observer. - * @param observer pointer to Observer - * @return pointer to saved target - */ -void * lv_observer_get_target(lv_observer_t * observer); - -/** - * Get target Widget of Observer. - * This is the same as `lv_observer_get_target()`, except it returns `target` - * as an `lv_obj_t *`. - * @param observer pointer to Observer - * @return pointer to saved Widget target - */ -lv_obj_t * lv_observer_get_target_obj(lv_observer_t * observer); - -/** - * Get Observer's user data. - * @param observer pointer to Observer - * @return void pointer to saved user data -*/ -void * lv_observer_get_user_data(const lv_observer_t * observer); - -/** - * Notify all Observers of Subject. - * @param subject pointer to Subject - */ -void lv_subject_notify(lv_subject_t * subject); - -/** - * Add an event handler to increment (or decrement) the value of a subject on a trigger. - * @param obj pointer to a widget - * @param subject pointer to a subject to change - * @param trigger the trigger on which the subject should be changed - * @param step value to add on trigger - * if the minimum value is reached, the maximum value will be set on rollover. - */ -lv_subject_increment_dsc_t * lv_obj_add_subject_increment_event(lv_obj_t * obj, lv_subject_t * subject, - lv_event_code_t trigger, int32_t step); - -/** - * Set the minimum subject value to set by the event - * @param obj pointer to the Widget to which the event is attached - * @param dsc pointer to the descriptor returned by `lv_obj_add_subject_increment_event()` - * @param min_value the minimum value to set - */ -void lv_obj_set_subject_increment_event_min_value(lv_obj_t * obj, lv_subject_increment_dsc_t * dsc, int32_t min_value); - -/** - * Set the maximum subject value to set by the event - * @param obj pointer to the Widget to which the event is attached - * @param dsc pointer to the descriptor returned by `lv_obj_add_subject_increment_event()` - * @param max_value the maximum value to set - */ -void lv_obj_set_subject_increment_event_max_value(lv_obj_t * obj, lv_subject_increment_dsc_t * dsc, int32_t max_value); - -/** - * Set what to do when the min/max value is crossed. - * @param obj pointer to the Widget to which the event is attached - * @param dsc pointer to the descriptor returned by `lv_obj_add_subject_increment_event()` - * @param rollover false: stop at the min/max value; true: jump to the other end - * @note the subject also can have min/max values and always the smaller range will be considered - */ -void lv_obj_set_subject_increment_event_rollover(lv_obj_t * obj, lv_subject_increment_dsc_t * dsc, bool rollover); - -/** -* Toggle the value of an integer subject on an event. If it was != 0 it will be 0. -* If it was 0, it will be 1. -* @param obj pointer to a widget -* @param subject pointer to a subject to toggle -* @param trigger the trigger on which the subject should be changed -*/ -void lv_obj_add_subject_toggle_event(lv_obj_t * obj, lv_subject_t * subject, lv_event_code_t trigger); - -/** - * Set the value of an integer subject. - * @param obj pointer to a widget - * @param subject pointer to a subject to change - * @param trigger the trigger on which the subject should be changed - * @param value the value to set - */ -void lv_obj_add_subject_set_int_event(lv_obj_t * obj, lv_subject_t * subject, lv_event_code_t trigger, int32_t value); - - -#if LV_USE_FLOAT -/** - * Set the value of a float subject. - * @param obj pointer to a widget - * @param subject pointer to a subject to change - * @param trigger the trigger on which the subject should be changed - * @param value the value to set - */ -void lv_obj_add_subject_set_float_event(lv_obj_t * obj, lv_subject_t * subject, lv_event_code_t trigger, float value); -#endif - -/** - * Set the value of a string subject. - * @param obj pointer to a widget - * @param subject pointer to a subject to change - * @param trigger the trigger on which the subject should be changed - * @param value the value to set - */ -void lv_obj_add_subject_set_string_event(lv_obj_t * obj, lv_subject_t * subject, lv_event_code_t trigger, - const char * value); - -/** - * Set Widget's flag(s) if an integer Subject's value is equal to a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_flag_if_eq(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); - -/** - * Set Widget's flag(s) if an integer Subject's value is not equal to a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_flag_if_not_eq(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, - int32_t ref_value); - -/** - * Set Widget's flag(s) if an integer Subject's value is greater than a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_flag_if_gt(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); - -/** - * Set Widget's flag(s) if an integer Subject's value is greater than or equal to a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_flag_if_ge(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); - -/** - * Set Widget's flag(s) if an integer Subject's value is less than a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_flag_if_lt(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); - -/** - * Set Widget's flag(s) if an integer Subject's value is less than or equal to a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param flag flag(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_OBJ_FLAG_HIDDEN`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_flag_if_le(lv_obj_t * obj, lv_subject_t * subject, lv_obj_flag_t flag, int32_t ref_value); - - -/** - * Set Widget's state(s) if an integer Subject's value is equal to a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_state_if_eq(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); - -/** - * Set a Widget's state(s) if an integer Subject's value is not equal to a reference value, clear flag otherwise - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_state_if_not_eq(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, - int32_t ref_value); - -/** - * Set Widget's state(s) if an integer Subject's value is greater than a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_state_if_gt(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); - -/** - * Set Widget's state(s) if an integer Subject's value is greater than or equal to a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_state_if_ge(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); - -/** - * Set Widget's state(s) if an integer Subject's value is less than a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_state_if_lt(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); - -/** - * Set Widget's state(s) if an integer Subject's value is less than or equal to a reference value, clear flag otherwise. - * @param obj pointer to Widget - * @param subject pointer to Subject - * @param state state(s) (can be bit-wise OR-ed) to set or clear (e.g. `LV_STATE_CHECKED`) - * @param ref_value reference value to compare Subject's value with - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_obj_bind_state_if_le(lv_obj_t * obj, lv_subject_t * subject, lv_state_t state, int32_t ref_value); - -/** - * Set an integer Subject to 1 when a Widget is checked and set it 0 when unchecked, and - * clear Widget's checked state when Subject's value changes to 0 and set it when non-zero. - * @param obj pointer to Widget - * @param subject pointer to a Subject - * @return pointer to newly-created Observer - * @note Ensure Widget's `LV_OBJ_FLAG_CHECKABLE` flag is set. - */ -lv_observer_t * lv_obj_bind_checked(lv_obj_t * obj, lv_subject_t * subject); - - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_OBSERVER*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OBSERVER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_observer_private.h b/src/core/lv_observer_private.h index 6f6cd89f2b..d1181b4a7e 100644 --- a/src/core/lv_observer_private.h +++ b/src/core/lv_observer_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_observer.h" +#include "../lv_public_api.h" #if LV_USE_OBSERVER diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index 6876edbe7e..12789e3fcb 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -10,19 +10,12 @@ #include "lv_obj_draw_private.h" #include "../misc/lv_area_private.h" #include "../draw/sw/lv_draw_sw_mask_private.h" -#include "../draw/lv_draw_mask.h" #include "lv_obj_private.h" #include "lv_obj_event_private.h" -#include "../display/lv_display.h" #include "../display/lv_display_private.h" -#include "../tick/lv_tick.h" #include "../misc/lv_timer_private.h" -#include "../misc/lv_math.h" -#include "../misc/lv_profiler.h" -#include "../misc/lv_types.h" #include "../draw/lv_draw_private.h" #include "../draw/opengles/lv_draw_opengles.h" -#include "../stdlib/lv_string.h" #include "lv_global.h" /********************* diff --git a/src/core/lv_refr.h b/src/core/lv_refr.h index 1756e32f0f..efa2a00565 100644 --- a/src/core/lv_refr.h +++ b/src/core/lv_refr.h @@ -1,74 +1,2 @@ -/** - * @file lv_refr.h - * - */ - -#ifndef LV_REFR_H -#define LV_REFR_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_obj.h" -#include "../display/lv_display.h" -#include "../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * STATIC PROTOTYPES - **********************/ - -/********************** - * STATIC VARIABLES - **********************/ - -/********************** - * MACROS - **********************/ - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -/** - * Redraw the invalidated areas now. - * Normally the redrawing is periodically executed in `lv_timer_handler` but a long blocking process - * can prevent the call of `lv_timer_handler`. In this case if the GUI is updated in the process - * (e.g. progress bar) this function can be called when the screen should be updated. - * @param disp pointer to display to refresh. NULL to refresh all displays. - */ -void lv_refr_now(lv_display_t * disp); - -/** - * Redrawn on object and all its children using the passed draw context - * @param layer pointer to a layer where to draw. - * @param obj the start object from the redraw should start - */ -void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj); - -/** - * Called periodically to handle the refreshing - * @param timer pointer to the timer itself, or `NULL` - */ -void lv_display_refr_timer(lv_timer_t * timer); - -/********************** - * STATIC FUNCTIONS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_REFR_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/core/lv_refr_private.h b/src/core/lv_refr_private.h index 79c2ede962..2e26aaf3cb 100644 --- a/src/core/lv_refr_private.h +++ b/src/core/lv_refr_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_refr.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/debugging/monkey/lv_monkey.c b/src/debugging/monkey/lv_monkey.c index 824eba15cf..b11ad6f27a 100644 --- a/src/debugging/monkey/lv_monkey.c +++ b/src/debugging/monkey/lv_monkey.c @@ -8,12 +8,7 @@ *********************/ #include "lv_monkey_private.h" -#if LV_USE_MONKEY != 0 - -#include "../../misc/lv_math.h" -#include "../../misc/lv_assert.h" -#include "../../stdlib/lv_mem.h" -#include "../../display/lv_display.h" +#if LV_USE_MONKEY /********************* * DEFINES diff --git a/src/debugging/monkey/lv_monkey.h b/src/debugging/monkey/lv_monkey.h index 12886f943e..fd6b44f9a6 100644 --- a/src/debugging/monkey/lv_monkey.h +++ b/src/debugging/monkey/lv_monkey.h @@ -1,119 +1,2 @@ -/** - * @file lv_monkey.h - * - */ -#ifndef LV_MONKEY_H -#define LV_MONKEY_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../indev/lv_indev.h" - -#if LV_USE_MONKEY != 0 - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct _lv_monkey_t lv_monkey_t; - -typedef struct { - int32_t min; - int32_t max; -} lv_range_t; - -typedef struct { - uint32_t min; - uint32_t max; -} lv_urange_t; - -struct _lv_monkey_config_t { - /** Input device type */ - lv_indev_type_t type; - - /** Monkey execution period */ - lv_urange_t period_range; - - /** The range of input value */ - lv_range_t input_range; -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a monkey config with default values - * @param config pointer to 'lv_monkey_config_t' variable to initialize - */ -void lv_monkey_config_init(lv_monkey_config_t * config); - -/** - * Create monkey for test - * @param config pointer to 'lv_monkey_config_t' variable - * @return pointer to the created monkey - */ -lv_monkey_t * lv_monkey_create(const lv_monkey_config_t * config); - -/** - * Get monkey input device - * @param monkey pointer to a monkey - * @return pointer to the input device - */ -lv_indev_t * lv_monkey_get_indev(lv_monkey_t * monkey); - -/** - * Enable monkey - * @param monkey pointer to a monkey - * @param en set to true to enable - */ -void lv_monkey_set_enable(lv_monkey_t * monkey, bool en); - -/** - * Get whether monkey is enabled - * @param monkey pointer to a monkey - * @return return true if monkey enabled - */ -bool lv_monkey_get_enable(lv_monkey_t * monkey); - -/** - * Set the user_data field of the monkey - * @param monkey pointer to a monkey - * @param user_data pointer to the new user_data. - */ -void lv_monkey_set_user_data(lv_monkey_t * monkey, void * user_data); - -/** - * Get the user_data field of the monkey - * @param monkey pointer to a monkey - * @return the pointer to the user_data of the monkey - */ -void * lv_monkey_get_user_data(lv_monkey_t * monkey); - -/** - * Delete monkey - * @param monkey pointer to monkey - */ -void lv_monkey_delete(lv_monkey_t * monkey); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_MONKEY*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_MONKEY_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/debugging/monkey/lv_monkey_private.h b/src/debugging/monkey/lv_monkey_private.h index a08ea07319..3a0ec53106 100644 --- a/src/debugging/monkey/lv_monkey_private.h +++ b/src/debugging/monkey/lv_monkey_private.h @@ -14,9 +14,9 @@ extern "C" { * INCLUDES *********************/ -#include "lv_monkey.h" +#include "../../lv_public_api.h" -#if LV_USE_MONKEY != 0 +#if LV_USE_MONKEY /********************* * DEFINES diff --git a/src/debugging/sysmon/lv_sysmon.c b/src/debugging/sysmon/lv_sysmon.c index f0665b243e..f438d55d3c 100644 --- a/src/debugging/sysmon/lv_sysmon.c +++ b/src/debugging/sysmon/lv_sysmon.c @@ -13,9 +13,6 @@ #if LV_USE_SYSMON #include "../../core/lv_global.h" -#include "../../misc/lv_async.h" -#include "../../stdlib/lv_string.h" -#include "../../widgets/label/lv_label.h" #include "../../display/lv_display_private.h" /********************* diff --git a/src/debugging/sysmon/lv_sysmon.h b/src/debugging/sysmon/lv_sysmon.h index 7893677b05..730d16c60a 100644 --- a/src/debugging/sysmon/lv_sysmon.h +++ b/src/debugging/sysmon/lv_sysmon.h @@ -1,113 +1,2 @@ -/** - * @file lv_sysmon.h - * - */ - -#ifndef LV_SYSMON_H -#define LV_SYSMON_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../misc/lv_timer.h" -#include "../../core/lv_observer.h" - -#if LV_USE_SYSMON - -#if LV_USE_LABEL == 0 -#error "lv_sysmon: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) " -#endif - -#if LV_USE_OBSERVER == 0 -#error "lv_observer: lv_observer is required. Enable it in lv_conf.h (LV_USE_OBSERVER 1) " -#endif - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a new system monitor label - * @param disp create the sys. mon. on this display's system layer - * @return the create label - */ -lv_obj_t * lv_sysmon_create(lv_display_t * disp); - -#if LV_USE_PERF_MONITOR - -/** - * Show system performance monitor: CPU usage and FPS count - * @param disp target display, NULL: use the default displays - */ -void lv_sysmon_show_performance(lv_display_t * disp); - -/** - * Hide system performance monitor - * @param disp target display, NULL: use the default - */ -void lv_sysmon_hide_performance(lv_display_t * disp); - -/** - * Dump the FPS data recorded between the last and current dump call. - * @param disp target display, NULL: use the default - */ -void lv_sysmon_performance_dump(lv_display_t * disp); - -/** - * Resume the system performance monitor. - * @param disp target display, NULL: use the default - */ -void lv_sysmon_performance_resume(lv_display_t * disp); - -/** - * Pause the system performance monitor. - * - * @param disp target display, NULL: use the default - * @note When the sysmon is stopped you can use `lv_sysmon_dump_performance` to - * get performance information. See `lv_sysmon_dump_performance` for more information. - */ -void lv_sysmon_performance_pause(lv_display_t * disp); - - -#endif /*LV_USE_PERF_MONITOR*/ - -#if LV_USE_MEM_MONITOR - -/** - * Show system memory monitor: used memory and the memory fragmentation - * @param disp target display, NULL: use the default displays - */ -void lv_sysmon_show_memory(lv_display_t * disp); - -/** - * Hide system memory monitor - * @param disp target display, NULL: use the default displays - */ -void lv_sysmon_hide_memory(lv_display_t * disp); - -#endif /*LV_USE_MEM_MONITOR*/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SYSMON*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_SYSMON_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/debugging/sysmon/lv_sysmon_private.h b/src/debugging/sysmon/lv_sysmon_private.h index 36e0571315..fdc33fa311 100644 --- a/src/debugging/sysmon/lv_sysmon_private.h +++ b/src/debugging/sysmon/lv_sysmon_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_sysmon.h" +#include "../../lv_public_api.h" #if LV_USE_SYSMON diff --git a/src/debugging/test/lv_test.h b/src/debugging/test/lv_test.h index ac61c9fa46..11616540f9 100644 --- a/src/debugging/test/lv_test.h +++ b/src/debugging/test/lv_test.h @@ -1,47 +1,2 @@ -/** - * @file lv_test.h - * - */ - -#ifndef LV_TEST_H -#define LV_TEST_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_TEST - -/********************* - * DEFINES - *********************/ -#include "lv_test_indev.h" -#include "lv_test_display.h" -#include "lv_test_fs.h" -#include "lv_test_helpers.h" -#include "lv_test_screenshot_compare.h" -#include "lv_test_indev_gesture.h" - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE TEST*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TEST_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/debugging/test/lv_test_display.c b/src/debugging/test/lv_test_display.c index b6c00708f6..caced33e59 100644 --- a/src/debugging/test/lv_test_display.c +++ b/src/debugging/test/lv_test_display.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_test_display.h" +#include "../../lv_public_api.h" #if LV_USE_TEST #include "../../core/lv_global.h" diff --git a/src/debugging/test/lv_test_display.h b/src/debugging/test/lv_test_display.h index ea39da2dae..cac82310a9 100644 --- a/src/debugging/test/lv_test_display.h +++ b/src/debugging/test/lv_test_display.h @@ -1,55 +1,2 @@ -/** - * @file lv_test_display.h - * - */ - -#ifndef LV_TEST_DISPLAY_H -#define LV_TEST_DISPLAY_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_TEST - -#include "../../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/*** - * Create a dummy display for for the tests - * @param hor_res the maximal horizontal resolution - * @param ver_res the maximal vertical resolution - * @return the created display - * - * @note The resolution can be changed to any smaller values later - * using `lv_display_set_resolution` - * The color format can be freely changed later using `lv_display_set_color_format` - */ -lv_display_t * lv_test_display_create(int32_t hor_res, int32_t ver_res); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TEST*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TEST_DISPLAY_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/debugging/test/lv_test_fs.c b/src/debugging/test/lv_test_fs.c index 36f5b1226a..dc38506eca 100644 --- a/src/debugging/test/lv_test_fs.c +++ b/src/debugging/test/lv_test_fs.c @@ -7,14 +7,10 @@ * INCLUDES *********************/ -#include "lv_test_fs.h" +#include "../../lv_public_api.h" #if LV_USE_TEST -#include "../../misc/lv_assert.h" -#include "../../misc/lv_fs.h" -#include "../../stdlib/lv_mem.h" - /********************* * DEFINES *********************/ diff --git a/src/debugging/test/lv_test_fs.h b/src/debugging/test/lv_test_fs.h index 792fd7925b..f940ed826d 100644 --- a/src/debugging/test/lv_test_fs.h +++ b/src/debugging/test/lv_test_fs.h @@ -1,69 +1,2 @@ -/** - * @file lv_test_fs.h - * - */ - -#ifndef LV_TEST_FS_H -#define LV_TEST_FS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" -#if LV_USE_TEST - -#include "../../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the test file system driver - */ -void lv_test_fs_init(void); - -/** - * Set whether the test file system is ready - * @param ready true: ready, false: not ready - */ -void lv_test_fs_set_ready(bool ready); - -/** - * Set whether the open callback of the test file system is cleared - * @param is_clear true: clear, false: not clear - */ -void lv_test_fs_clear_open_cb(bool is_clear); - -/** - * Set whether the close callback of the test file system is cleared - * @param is_clear true: clear, false: not clear - */ -void lv_test_fs_clear_close_cb(bool is_clear); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TEST*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TEST_FS_H*/ - - +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/debugging/test/lv_test_helpers.c b/src/debugging/test/lv_test_helpers.c index 45bba20ee0..2411cc04e3 100644 --- a/src/debugging/test/lv_test_helpers.c +++ b/src/debugging/test/lv_test_helpers.c @@ -7,10 +7,9 @@ * INCLUDES *********************/ -#include "lv_test_helpers.h" +#include "../../lv_public_api.h" #if LV_USE_TEST -#include "../../lvgl.h" /********************* * DEFINES diff --git a/src/debugging/test/lv_test_helpers.h b/src/debugging/test/lv_test_helpers.h index 0c9048b8d5..f306605f16 100644 --- a/src/debugging/test/lv_test_helpers.h +++ b/src/debugging/test/lv_test_helpers.h @@ -1,80 +1,2 @@ -/** - * @file lv_test_helpers.h - * - */ - -#ifndef LV_TEST_HELPERS_H -#define LV_TEST_HELPERS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" -#if LV_USE_TEST - -#include "../../misc/lv_types.h" -#include "../../stdlib/lv_mem.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Emulate a delay. It's not real delay, but it tricks LVGL to think that the - * required time has been elapsed. - * `lv_timer_handler` is called after each millisecond, meaning all the events - * will be fired inside this function. - * At the end the animations and display will be also updated. - * @param ms the number of milliseconds to pass - */ -void lv_test_wait(uint32_t ms); - -/** - * Emulates some time passing. - * Update the animations and the display only once at the end. - * @param ms the number of milliseconds to pass - */ -void lv_test_fast_forward(uint32_t ms); - -#if LV_USE_STDLIB_MALLOC != LV_STDLIB_BUILTIN -/* Skip checking heap as we don't have the info available */ -#define LV_HEAP_CHECK(x) do {} while(0) -/* Pick a non-zero value */ -#define lv_test_get_free_mem() (65536) -#else -#define LV_HEAP_CHECK(x) x - -static inline size_t lv_test_get_free_mem(void) -{ - lv_mem_monitor_t m1; - lv_mem_monitor(&m1); - return m1.free_size; -} -#endif /* LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN */ - -/********************** - * MACROS - **********************/ - -#define LV_TEST_WIDTH_TO_STRIDE(w, px_size) ((((w) * (px_size) + (LV_DRAW_BUF_STRIDE_ALIGN - 1)) / LV_DRAW_BUF_STRIDE_ALIGN) * LV_DRAW_BUF_STRIDE_ALIGN) - -#endif /*LV_USE_TEST*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TEST_HELPERS_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/debugging/test/lv_test_indev.c b/src/debugging/test/lv_test_indev.c index 742e27d38d..c14d0670bc 100644 --- a/src/debugging/test/lv_test_indev.c +++ b/src/debugging/test/lv_test_indev.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_test.h" +#include "../../lv_public_api.h" #if LV_USE_TEST #include "../../core/lv_global.h" diff --git a/src/debugging/test/lv_test_indev.h b/src/debugging/test/lv_test_indev.h index 63c44ab462..c5640e2e30 100644 --- a/src/debugging/test/lv_test_indev.h +++ b/src/debugging/test/lv_test_indev.h @@ -1,171 +1,2 @@ -/** - * @file lv_test_indev.h - * - */ - -#ifndef LV_TEST_INDEV_H -#define LV_TEST_INDEV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_TEST - -#include "../../misc/lv_types.h" -#include "../../indev/lv_indev.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a mouse (pointer), keypad, and encoder indevs. - * They can be controlled via function calls during the test - */ -void lv_test_indev_create_all(void); - -/** - * Delete all test input devices - */ -void lv_test_indev_delete_all(void); - -/** - * Get one of the indev created in `lv_test_indev_create_all` - * @param type type of the indev to get - * @return the indev - */ -lv_indev_t * lv_test_indev_get_indev(lv_indev_type_t type); - -/** - * Move the mouse to the given coordinates. - * This function doesn't wait, but just changes the state and returns immediately. - * @param x the target absolute X coordinate - * @param y the target absolute Y coordinate - */ -void lv_test_mouse_move_to(int32_t x, int32_t y); - -/** - * Move the mouse to the center of a widget - * This function doesn't wait, but just changes the state and returns immediately. - * @param obj pointer to an widget - */ -void lv_test_mouse_move_to_obj(lv_obj_t * obj); - -/** - * Move the mouse cursor. Keep the pressed or released state - * This function doesn't wait, but just changes the state and returns immediately. - * @param x the difference in X to move - * @param y the difference in Y to move - */ -void lv_test_mouse_move_by(int32_t x, int32_t y); - -/** - * Make the mouse button pressed. - * This function doesn't wait, but just changes the state and returns immediately. - */ -void lv_test_mouse_press(void); - -/** - * Make the mouse button released. - * This function doesn't wait, but just changes the state and returns immediately. - */ -void lv_test_mouse_release(void); - -/** - * Emulate a click on a given point. - * First set the released state, wait a little, press, wait, and release again. - * The wait time is 50ms. - * Internally `lv_timer_handler` is called, meaning all the events will be fired inside this function. - * @param x the target absolute X coordinate - * @param y the target absolute Y coordinate - */ -void lv_test_mouse_click_at(int32_t x, int32_t y); - -/** - * Emulate a key press. - * This function doesn't wait, but just changes the state and returns immediately. - * @param k the key to press - */ -void lv_test_key_press(uint32_t k); - -/** - * Release the previously press key. - * This function doesn't wait, but just changes the state and returns immediately. - * @param k the key to press - */ -void lv_test_key_release(void); - -/** - * Emulate a key hit. - * First set the released state, wait a little, press, wait, and release again. - * The wait time is 50ms. - * Internally `lv_timer_handler` is called, meaning all the events will be fired inside this function. - * @param k the key to hit - */ -void lv_test_key_hit(uint32_t k); - - -/** - * Emulate encoder rotation, use positive parameter to rotate to the right - * and negative to rotate to the left. - * This function doesn't wait, but just changes the state and returns immediately. - * @param d number of encoder ticks to emulate - */ -void lv_test_encoder_add_diff(int32_t d); - -/** - * Emulate an encoder turn a wait 50ms. Use positive parameter to rotate to the right - * and negative to rotate to the left. - * Internally `lv_timer_handler` is called, meaning all the events will be fired inside this function. - * @param d number of encoder ticks to emulate - */ -void lv_test_encoder_turn(int32_t d); - -/** - * Emulate an encoder press. - * This function doesn't wait, but just changes the state and returns immediately. - */ -void lv_test_encoder_press(void); - -/** - * Emulate an encoder release. - * This function doesn't wait, but just changes the state and returns immediately. - */ -void lv_test_encoder_release(void); - -/** - * Emulate am encoder click. - * First set the released state, wait a little, press, wait, and release again. - * The wait time is 50ms. - * Internally `lv_timer_handler` is called, meaning all the events will be fired inside this function. - */ -void lv_test_encoder_click(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TEST*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TEST_INDEV_H*/ - - - - +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/debugging/test/lv_test_indev_gesture.c b/src/debugging/test/lv_test_indev_gesture.c index 64455d61df..a21afac1b2 100644 --- a/src/debugging/test/lv_test_indev_gesture.c +++ b/src/debugging/test/lv_test_indev_gesture.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_test.h" +#include "../../lv_public_api.h" #if LV_USE_TEST && LV_USE_GESTURE_RECOGNITION #include "../../core/lv_global.h" diff --git a/src/debugging/test/lv_test_indev_gesture.h b/src/debugging/test/lv_test_indev_gesture.h index 23aef9a1a9..db81bcd515 100644 --- a/src/debugging/test/lv_test_indev_gesture.h +++ b/src/debugging/test/lv_test_indev_gesture.h @@ -1,93 +1,2 @@ -/** - * @file lv_test_indev_gesture.h - * - */ - -#ifndef LV_TEST_INDEV_GESTURE_H -#define LV_TEST_INDEV_GESTURE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_TEST && LV_USE_GESTURE_RECOGNITION - -#include "../../misc/lv_types.h" -#include "../../indev/lv_indev.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a touch (pointer) indevs. - * They can be controlled via function calls during the test - */ -void lv_test_indev_gesture_create(void); - -/** - * Delete the touch (pointer) indevs. - */ -void lv_test_indev_gesture_delete(void); - -/** - * Get one of the indev created in `lv_test_indev_gesture_create` - * @param type type of the indev to get - * @return the indev - */ -lv_indev_t * lv_test_indev_get_gesture_indev(lv_indev_type_t type); - -/** - * Set two touch points data for pinch gesture - * @param point_0 First touch point coordinates - * @param point_1 Second touch point coordinates - */ -void lv_test_gesture_set_pinch_data(lv_point_t point_0, lv_point_t point_1); - -/** - * Trigger press state of pinch gesture (both touch points pressed) - */ -void lv_test_gesture_pinch_press(void); - -/** - * Trigger release state of pinch gesture (both touch points released) - */ -void lv_test_gesture_pinch_release(void); - -/** - * Simulate a complete pinch gesture operation - * @param point_begin_0 Starting coordinates of first touch point - * @param point_begin_1 Starting coordinates of second touch point - * @param point_end_0 Ending coordinates of first touch point - * @param point_end_1 Ending coordinates of second touch point - */ -void lv_test_gesture_pinch(lv_point_t point_begin_0, lv_point_t point_begin_1, - lv_point_t point_end_0, lv_point_t point_end_1); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TEST && LV_USE_GESTURE_RECOGNITION*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TEST_INDEV_GESTURE_H*/ - - - - +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/debugging/test/lv_test_private.h b/src/debugging/test/lv_test_private.h index b19f5b6744..76ace05014 100644 --- a/src/debugging/test/lv_test_private.h +++ b/src/debugging/test/lv_test_private.h @@ -13,11 +13,9 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_TEST +#include "../../lv_public_api.h" -#include "../../misc/lv_types.h" -#include "../../indev/lv_indev_gesture.h" +#if LV_USE_TEST /********************* * DEFINES diff --git a/src/debugging/test/lv_test_screenshot_compare.c b/src/debugging/test/lv_test_screenshot_compare.c index 0863d3b6bc..e8014f401f 100644 --- a/src/debugging/test/lv_test_screenshot_compare.c +++ b/src/debugging/test/lv_test_screenshot_compare.c @@ -11,14 +11,14 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" + #if LV_USE_TEST && defined(LV_USE_TEST_SCREENSHOT_COMPARE) && LV_USE_TEST_SCREENSHOT_COMPARE #if LV_USE_LODEPNG == 0 #error "lodepng is required for screenshot compare. Enable it in lv_conf.h (LV_USE_LODEPNG 1)" #endif -#include "../../lvgl.h" #include #include #include diff --git a/src/debugging/test/lv_test_screenshot_compare.h b/src/debugging/test/lv_test_screenshot_compare.h index 5d150be97f..c5e2c43452 100644 --- a/src/debugging/test/lv_test_screenshot_compare.h +++ b/src/debugging/test/lv_test_screenshot_compare.h @@ -1,87 +1,2 @@ -/** - * @file lv_test_screenshot_compare.h - * - */ - -#ifndef LV_TEST_SCREENSHOT_COMPARE_H -#define LV_TEST_SCREENSHOT_COMPARE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_TEST && defined(LV_USE_TEST_SCREENSHOT_COMPARE) && LV_USE_TEST_SCREENSHOT_COMPARE - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * Return value of `lv_test_screenshot_compare` - */ -typedef enum { - /** - * The screenshot is different than the reference image - */ - LV_TEST_SCREENSHOT_RESULT_FAILED, - - /** - * The screenshot is the same as the reference image. - * It is also returned if `LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE` is enabled - * and the reference image was missing. - */ - LV_TEST_SCREENSHOT_RESULT_PASSED, - - /** - * If `LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE` is not enabled - * and the reference image is missing. - */ - LV_TEST_SCREENSHOT_RESULT_NO_REFERENCE_IMAGE, - -} lv_test_screenshot_result_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Invalidate and redraw the current screen and compare its content with a reference PNG image - * - If the reference image is not found it will be created automatically from the rendered screen. - * - If the compare fails an `_err.png` file will be created with the rendered content next to the reference image. - * - * It requires lodepng. - * - * @param fn_ref path to the reference image. Will be appended to REF_IMGS_PATH if set. - * @return An element of `lv_test_screenshot_result_t` - * @note This function assumes that the default display is the test display that was created by - * `lv_test_display_create()` - */ -lv_test_screenshot_result_t lv_test_screenshot_compare(const char * fn_ref); - - -/** - * Works the same way as `lv_test_screenshot_compare` but it doesn't invalidate and redraw the screen - * but uses its current content. (lv_refr_now(NULL) might be called earlier) - * @param fn_ref reference image path - */ -lv_test_screenshot_result_t lv_test_screenshot_compare_core(const char * fn_ref); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TEST_SCREENSHOT_COMPARE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TEST_SCREENSHOT_COMPARE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/debugging/vg_lite_tvg/vg_lite_matrix.c b/src/debugging/vg_lite_tvg/vg_lite_matrix.c index 42f8ce38bc..4ad80682fb 100644 --- a/src/debugging/vg_lite_tvg/vg_lite_matrix.c +++ b/src/debugging/vg_lite_tvg/vg_lite_matrix.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE && LV_USE_VG_LITE_THORVG diff --git a/src/debugging/vg_lite_tvg/vg_lite_tvg.cpp b/src/debugging/vg_lite_tvg/vg_lite_tvg.cpp index e2e4016adf..cb5e89684f 100644 --- a/src/debugging/vg_lite_tvg/vg_lite_tvg.cpp +++ b/src/debugging/vg_lite_tvg/vg_lite_tvg.cpp @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE && LV_USE_VG_LITE_THORVG #include "vg_lite.h" diff --git a/src/display/lv_display.c b/src/display/lv_display.c index 06db3b5a94..35b9aa5842 100644 --- a/src/display/lv_display.c +++ b/src/display/lv_display.c @@ -6,22 +6,14 @@ /********************* * INCLUDES *********************/ + #include "../display/lv_display_private.h" #include "../misc/lv_event_private.h" #include "../misc/lv_anim_private.h" #include "../draw/lv_draw_private.h" #include "../core/lv_obj_private.h" -#include "lv_display.h" -#include "../misc/lv_math.h" #include "../core/lv_refr_private.h" -#include "../stdlib/lv_string.h" -#include "../themes/lv_theme.h" #include "../core/lv_global.h" -#include "../debugging/sysmon/lv_sysmon.h" - -#if LV_USE_DRAW_SW - #include "../draw/sw/lv_draw_sw.h" -#endif /********************* * DEFINES diff --git a/src/display/lv_display.h b/src/display/lv_display.h index 08a5e7a62e..acf81c539b 100644 --- a/src/display/lv_display.h +++ b/src/display/lv_display.h @@ -1,803 +1,2 @@ -/** - * @file lv_display.h - * - */ - -#ifndef LV_DISPLAY_H -#define LV_DISPLAY_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_types.h" -#include "../misc/lv_timer.h" -#include "../misc/lv_event.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" - -/********************* - * DEFINES - *********************/ - -#ifndef LV_ATTRIBUTE_FLUSH_READY -#define LV_ATTRIBUTE_FLUSH_READY -#endif - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_DISPLAY_ROTATION_0 = 0, - LV_DISPLAY_ROTATION_90, - LV_DISPLAY_ROTATION_180, - LV_DISPLAY_ROTATION_270 -} lv_display_rotation_t; - -typedef enum { - /** - * Use the buffer(s) to render the screen is smaller parts. - * This way the buffers can be smaller then the display to save RAM. At least 1/10 screen size buffer(s) are recommended. - */ - LV_DISPLAY_RENDER_MODE_PARTIAL, - - /** - * The buffer(s) has to be screen sized and LVGL will render into the correct location of the buffer. - * This way the buffer always contain the whole image. Only the changed ares will be updated. - * With 2 buffers the buffers' content are kept in sync automatically and in flush_cb only address change is required. - */ - LV_DISPLAY_RENDER_MODE_DIRECT, - - /** - * Always redraw the whole screen even if only one pixel has been changed. - * With 2 buffers in flush_cb only an address change is required. - */ - LV_DISPLAY_RENDER_MODE_FULL, -} lv_display_render_mode_t; - -typedef enum { - LV_SCREEN_LOAD_ANIM_NONE, - LV_SCREEN_LOAD_ANIM_OVER_LEFT, - LV_SCREEN_LOAD_ANIM_OVER_RIGHT, - LV_SCREEN_LOAD_ANIM_OVER_TOP, - LV_SCREEN_LOAD_ANIM_OVER_BOTTOM, - LV_SCREEN_LOAD_ANIM_MOVE_LEFT, - LV_SCREEN_LOAD_ANIM_MOVE_RIGHT, - LV_SCREEN_LOAD_ANIM_MOVE_TOP, - LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM, - LV_SCREEN_LOAD_ANIM_FADE_IN, - LV_SCREEN_LOAD_ANIM_FADE_ON = LV_SCREEN_LOAD_ANIM_FADE_IN, /*For backward compatibility*/ - LV_SCREEN_LOAD_ANIM_FADE_OUT, - LV_SCREEN_LOAD_ANIM_OUT_LEFT, - LV_SCREEN_LOAD_ANIM_OUT_RIGHT, - LV_SCREEN_LOAD_ANIM_OUT_TOP, - LV_SCREEN_LOAD_ANIM_OUT_BOTTOM, -} lv_screen_load_anim_t; - -typedef void (*lv_display_flush_cb_t)(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map); -typedef void (*lv_display_flush_wait_cb_t)(lv_display_t * disp); -typedef void (*lv_display_sync_cb_t)(lv_display_t * disp, const lv_area_t * area); -typedef void (*lv_display_sync_wait_cb_t)(lv_display_t * disp); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a new display with the given resolution - * @param hor_res horizontal resolution in pixels - * @param ver_res vertical resolution in pixels - * @return pointer to a display object or `NULL` on error - */ -lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res); - -/** - * Remove a display - * @param disp pointer to display - */ -void lv_display_delete(lv_display_t * disp); - -/** - * Set a default display. The new screens will be created on it by default. - * @param disp pointer to a display - */ -void lv_display_set_default(lv_display_t * disp); - -/** - * Get the default display - * @return pointer to the default display - */ -lv_display_t * lv_display_get_default(void); - -/** - * Get the next display. - * @param disp pointer to the current display. NULL to initialize. - * @return the next display or NULL if no more. Gives the first display when the parameter is NULL. - */ -lv_display_t * lv_display_get_next(lv_display_t * disp); - -/*--------------------- - * RESOLUTION - *--------------------*/ - -/** - * Sets the resolution of a display. `LV_EVENT_RESOLUTION_CHANGED` event will be sent. - * Here the native resolution of the device should be set. If the display will be rotated later with - * `lv_display_set_rotation` LVGL will swap the hor. and ver. resolution automatically. - * @param disp pointer to a display - * @param hor_res the new horizontal resolution - * @param ver_res the new vertical resolution - */ -void lv_display_set_resolution(lv_display_t * disp, int32_t hor_res, int32_t ver_res); - -/** - * It's not mandatory to use the whole display for LVGL, however in some cases physical resolution is important. - * For example the touchpad still sees whole resolution and the values needs to be converted - * to the active LVGL display area. - * @param disp pointer to a display - * @param hor_res the new physical horizontal resolution, or -1 to assume it's the same as the normal hor. res. - * @param ver_res the new physical vertical resolution, or -1 to assume it's the same as the normal hor. res. - */ -void lv_display_set_physical_resolution(lv_display_t * disp, int32_t hor_res, int32_t ver_res); - -/** - * If physical resolution is not the same as the normal resolution - * the offset of the active display area can be set here. - * @param disp pointer to a display - * @param x X offset - * @param y Y offset - */ -void lv_display_set_offset(lv_display_t * disp, int32_t x, int32_t y); - -/** - * Set the rotation of this display. LVGL will swap the horizontal and vertical resolutions internally. - * @param disp pointer to a display (NULL to use the default display) - * @param rotation `LV_DISPLAY_ROTATION_0/90/180/270` - */ -void lv_display_set_rotation(lv_display_t * disp, lv_display_rotation_t rotation); - -/** - * Use matrix rotation for the display. This function is depended on `LV_DRAW_TRANSFORM_USE_MATRIX` - * @param disp pointer to a display (NULL to use the default display) - * @param enable true: enable matrix rotation, false: disable - */ -void lv_display_set_matrix_rotation(lv_display_t * disp, bool enable); - -/** - * Set the DPI (dot per inch) of the display. - * dpi = sqrt(hor_res^2 + ver_res^2) / diagonal" - * @param disp pointer to a display - * @param dpi the new DPI - */ -void lv_display_set_dpi(lv_display_t * disp, int32_t dpi); - -/** - * Get the horizontal resolution of a display. - * @param disp pointer to a display (NULL to use the default display) - * @return the horizontal resolution of the display. - */ -int32_t lv_display_get_horizontal_resolution(const lv_display_t * disp); - -/** - * Get the vertical resolution of a display - * @param disp pointer to a display (NULL to use the default display) - * @return the vertical resolution of the display - */ -int32_t lv_display_get_vertical_resolution(const lv_display_t * disp); - -/** - * Get the original horizontal resolution of a display without considering rotation - * @param disp pointer to a display (NULL to use the default display) - * @return the horizontal resolution of the display. - */ -int32_t lv_display_get_original_horizontal_resolution(const lv_display_t * disp); - -/** - * Get the original vertical resolution of a display without considering rotation - * @param disp pointer to a display (NULL to use the default display) - * @return the vertical resolution of the display - */ -int32_t lv_display_get_original_vertical_resolution(const lv_display_t * disp); - -/** - * Get the physical horizontal resolution of a display - * @param disp pointer to a display (NULL to use the default display) - * @return the physical horizontal resolution of the display - */ -int32_t lv_display_get_physical_horizontal_resolution(const lv_display_t * disp); - -/** - * Get the physical vertical resolution of a display - * @param disp pointer to a display (NULL to use the default display) - * @return the physical vertical resolution of the display - */ -int32_t lv_display_get_physical_vertical_resolution(const lv_display_t * disp); - -/** - * Get the horizontal offset from the full / physical display - * @param disp pointer to a display (NULL to use the default display) - * @return the horizontal offset from the physical display - */ -int32_t lv_display_get_offset_x(const lv_display_t * disp); - -/** - * Get the vertical offset from the full / physical display - * @param disp pointer to a display (NULL to use the default display) - * @return the horizontal offset from the physical display - */ -int32_t lv_display_get_offset_y(const lv_display_t * disp); - -/** - * Get the current rotation of this display. - * @param disp pointer to a display (NULL to use the default display) - * @return the current rotation - */ -lv_display_rotation_t lv_display_get_rotation(lv_display_t * disp); - -/** - * Get if matrix rotation is enabled for a display or not - * @param disp pointer to a display (NULL to use the default display) - * @return true: matrix rotation is enabled; false: disabled - */ -bool lv_display_get_matrix_rotation(lv_display_t * disp); - -/** - * Get the DPI of the display - * @param disp pointer to a display (NULL to use the default display) - * @return dpi of the display - */ -int32_t lv_display_get_dpi(const lv_display_t * disp); - -/*--------------------- - * BUFFERING - *--------------------*/ - -/** - * Set the buffers for a display, similarly to `lv_display_set_draw_buffers`, but accept the raw buffer pointers. - * For DIRECT/FULL rending modes, the buffer size must be at least - * `hor_res * ver_res * lv_color_format_get_size(lv_display_get_color_format(disp))` - * @param disp pointer to a display - * @param buf1 first buffer - * @param buf2 second buffer (can be `NULL`) - * @param buf_size buffer size in byte - * @param render_mode LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL - */ -void lv_display_set_buffers(lv_display_t * disp, void * buf1, void * buf2, uint32_t buf_size, - lv_display_render_mode_t render_mode); - -/** - * Set the frame buffers for a display, similarly to `lv_display_set_buffers`, but allow - * for a custom stride as required by a display controller. - * This allows the frame buffers to have a stride alignment different from the rest of - * the buffers` - * @param disp pointer to a display - * @param buf1 first buffer - * @param buf2 second buffer (can be `NULL`) - * @param buf_size buffer size in byte - * @param stride buffer stride in bytes - * @param render_mode LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL - */ -void lv_display_set_buffers_with_stride(lv_display_t * disp, void * buf1, void * buf2, uint32_t buf_size, - uint32_t stride, lv_display_render_mode_t render_mode); - -/** - * Set the buffers for a display, accept a draw buffer pointer. - * Normally use `lv_display_set_buffers` is enough for most cases. - * Use this function when an existing lv_draw_buf_t is available. - * @param disp pointer to a display - * @param buf1 first buffer - * @param buf2 second buffer (can be `NULL`) - */ -void lv_display_set_draw_buffers(lv_display_t * disp, lv_draw_buf_t * buf1, lv_draw_buf_t * buf2); - -/** - * Set the third draw buffer for a display. - * @param disp pointer to a display - * @param buf3 third buffer - */ -void lv_display_set_3rd_draw_buffer(lv_display_t * disp, lv_draw_buf_t * buf3); - -/** - * Set display render mode - * @param disp pointer to a display - * @param render_mode LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL - */ -void lv_display_set_render_mode(lv_display_t * disp, lv_display_render_mode_t render_mode); - -/** - * Set the flush callback which will be called to copy the rendered image to the display. - * @param disp pointer to a display - * @param flush_cb the flush callback (`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display) - */ -void lv_display_set_flush_cb(lv_display_t * disp, lv_display_flush_cb_t flush_cb); - -/** - * Set a callback to be used while LVGL is waiting flushing to be finished. - * It can do any complex logic to wait, including semaphores, mutexes, polling flags, etc. - * If not set the `disp->flushing` flag is used which can be cleared with `lv_display_flush_ready()` - * @param disp pointer to a display - * @param wait_cb a callback to call while LVGL is waiting for flush ready. - * If NULL `lv_display_flush_ready()` can be used to signal that flushing is ready. - */ -void lv_display_set_flush_wait_cb(lv_display_t * disp, lv_display_flush_wait_cb_t wait_cb); - -/** - * Set the sync callback which will be called to synchronize invalidated areas between frame buffers pre-render. - * @param disp pointer to a display - * @param sync_cb the sync callback (pointer to `area` needing to be synchronized) - */ -void lv_display_set_sync_cb(lv_display_t * disp, lv_display_sync_cb_t sync_cb); - -/** - * Set a callback to be used while LVGL is waiting sync to be finished. - * It can do any complex logic to wait, including semaphores, mutexes, polling flags, etc. - * If not set the `disp->syncing` flag is used which can be cleared with `lv_display_sync_ready()` - * @param disp pointer to a display - * @param wait_cb a callback to call while LVGL is waiting for sync ready. - * If NULL `lv_display_sync_ready()` can be used to signal that syncing is ready. - */ -void lv_display_set_sync_wait_cb(lv_display_t * disp, lv_display_sync_wait_cb_t wait_cb); - -/** - * Set the color format of the display. - * @param disp pointer to a display - * @param color_format Possible values are - * - LV_COLOR_FORMAT_RGB565 - * - LV_COLOR_FORMAT_RGB888 - * - LV_COLOR_FORMAT_XRGB888 - * - LV_COLOR_FORMAT_ARGB888 - *@note To change the endianness of the rendered image in case of RGB565 format - * (i.e. swap the 2 bytes) call `lv_draw_sw_rgb565_swap` in the flush_cb - */ -void lv_display_set_color_format(lv_display_t * disp, lv_color_format_t color_format); - -/** - * Get the color format of the display - * @param disp pointer to a display - * @return the color format - */ -lv_color_format_t lv_display_get_color_format(lv_display_t * disp); - -/** - * Set the number of tiles for parallel rendering. - * @param disp pointer to a display - * @param tile_cnt number of tiles (1 =< tile_cnt < 256) - */ -void lv_display_set_tile_cnt(lv_display_t * disp, uint32_t tile_cnt); - -/** - * Get the number of tiles used for parallel rendering - * @param disp pointer to a display - * @return number of tiles - */ -uint32_t lv_display_get_tile_cnt(lv_display_t * disp); - -/** - * Disabling anti-aliasing is not supported since v9. This function will be removed. - * Enable anti-aliasing for the render engine - * @param disp pointer to a display - * @param en true/false - */ -void lv_display_set_antialiasing(lv_display_t * disp, bool en); - -/** - * Get if anti-aliasing is enabled for a display or not - * @param disp pointer to a display (NULL to use the default display) - * @return true/false - */ -bool lv_display_get_antialiasing(lv_display_t * disp); - -/** - * Call from the display driver when the flushing is finished - * @param disp pointer to display whose `flush_cb` was called - */ -LV_ATTRIBUTE_FLUSH_READY void lv_display_flush_ready(lv_display_t * disp); - -/** - * Tell if it's the last area of the refreshing process. - * Can be called from `flush_cb` to execute some special display refreshing if needed when all areas are flushed. - * @param disp pointer to display - * @return true: it's the last area to flush; - * false: there are other areas too which will be refreshed soon - */ -LV_ATTRIBUTE_FLUSH_READY bool lv_display_flush_is_last(lv_display_t * disp); - -/** - * Call from the display driver when the syncing is finished - * @param disp pointer to display whose `sync_cb` was called - */ -LV_ATTRIBUTE_SYNC_READY void lv_display_sync_ready(lv_display_t * disp); - -/** - * Tell if it's the last area of the syncing process. - * Can be called from `sync_cb` to execute some special display refreshing if needed when all areas are synced. - * @param disp pointer to display - * @return true: it's the last area to sync; - * false: there are other areas too which will be synced soon - */ -LV_ATTRIBUTE_SYNC_READY bool lv_display_sync_is_last(lv_display_t * disp); - -/** - * Get display is double buffered. - * @param disp pointer to a display (NULL to use the default display) - * @return return true if display is double buffered - */ -bool lv_display_is_double_buffered(lv_display_t * disp); - -/** - * Get display render mode - * @param disp pointer to a display - * @return display's render mode (LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL) - */ -lv_display_render_mode_t lv_display_get_render_mode(lv_display_t * disp); - -/*--------------------- - * SCREENS - *--------------------*/ - -/** - * Return a pointer to the active screen on a display - * @param disp pointer to display which active screen should be get. - * (NULL to use the default screen) - * @return pointer to the active screen object (loaded by 'lv_screen_load()') - */ -lv_obj_t * lv_display_get_screen_active(lv_display_t * disp); - -/** - * Return with a pointer to the previous screen. Only used during screen transitions. - * @param disp pointer to display which previous screen should be get. - * (NULL to use the default screen) - * @return pointer to the previous screen object or NULL if not used now - */ -lv_obj_t * lv_display_get_screen_prev(lv_display_t * disp); - -/** - * Return the screen that is currently being loaded by the display - * @param disp pointer to a display object (NULL to use the default screen) - * @return pointer to the screen being loaded or NULL if no screen is currently being loaded - */ -lv_obj_t * lv_display_get_screen_loading(lv_display_t * disp); - -/** - * Return the top layer. The top layer is the same on all screens and it is above the normal screen layer. - * @param disp pointer to display which top layer should be get. (NULL to use the default screen) - * @return pointer to the top layer object - */ -lv_obj_t * lv_display_get_layer_top(lv_display_t * disp); - -/** - * Return the sys. layer. The system layer is the same on all screen and it is above the normal screen and the top layer. - * @param disp pointer to display which sys. layer should be retrieved. (NULL to use the default screen) - * @return pointer to the sys layer object - */ -lv_obj_t * lv_display_get_layer_sys(lv_display_t * disp); - -/** - * Return the bottom layer. The bottom layer is the same on all screen and it is under the normal screen layer. - * It's visible only if the screen is transparent. - * @param disp pointer to display (NULL to use the default screen) - * @return pointer to the bottom layer object - */ -lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp); - - -#if LV_USE_OBJ_NAME - -/** - * Get screen by its name on a display. The name should be set by - * `lv_obj_set_name()` or `lv_obj_set_name_static()`. - * @param disp pointer to a display or NULL to use default display - * @param screen_name name of the screen to get - * @return pointer to the screen, or NULL if not found. - */ -lv_obj_t * lv_display_get_screen_by_name(const lv_display_t * disp, const char * screen_name); - -#endif /*LV_USE_OBJ_NAME*/ - -/** - * Load a screen on the default display - * @param scr pointer to a screen - */ -void lv_screen_load(struct _lv_obj_t * scr); - -/** - * Switch screen with animation - * @param scr pointer to the new screen to load - * @param anim_type type of the animation from `lv_screen_load_anim_t`, e.g. `LV_SCREEN_LOAD_ANIM_MOVE_LEFT` - * @param time time of the animation - * @param delay delay before the transition - * @param auto_del true: automatically delete the old screen - */ -void lv_screen_load_anim(lv_obj_t * scr, lv_screen_load_anim_t anim_type, uint32_t time, uint32_t delay, - bool auto_del); - -/** - * Get the active screen of the default display - * @return pointer to the active screen - */ -lv_obj_t * lv_screen_active(void); - -/** - * Get the top layer of the default display - * @return pointer to the top layer - */ -lv_obj_t * lv_layer_top(void); - -/** - * Get the system layer of the default display - * @return pointer to the sys layer - */ -lv_obj_t * lv_layer_sys(void); - -/** - * Get the bottom layer of the default display - * @return pointer to the bottom layer - */ -lv_obj_t * lv_layer_bottom(void); - -/*--------------------- - * OTHERS - *--------------------*/ - -/** - * Add an event handler to the display - * @param disp pointer to a display - * @param event_cb an event callback - * @param filter event code to react or `LV_EVENT_ALL` - * @param user_data optional user_data - * @return the event descriptor or NULL if the event couldn't be created - */ -lv_event_dsc_t * lv_display_add_event_cb(lv_display_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, - void * user_data); - -/** - * Get the number of event attached to a display - * @param disp pointer to a display - * @return number of events - */ -uint32_t lv_display_get_event_count(lv_display_t * disp); - -/** - * Get an event descriptor for an event - * @param disp pointer to a display - * @param index the index of the event - * @return the event descriptor - */ -lv_event_dsc_t * lv_display_get_event_dsc(lv_display_t * disp, uint32_t index); - -/** - * Remove an event - * @param disp pointer to a display - * @param index the index of the event to remove - * @return true: and event was removed; false: no event was removed - */ -bool lv_display_remove_event(lv_display_t * disp, uint32_t index); - -/** - * Remove an event_cb with user_data - * @param disp pointer to a display - * @param event_cb the event_cb of the event to remove - * @param user_data user_data - * @return the count of the event removed - */ -uint32_t lv_display_remove_event_cb_with_user_data(lv_display_t * disp, lv_event_cb_t event_cb, void * user_data); - -/** - * Send an event to a display - * @param disp pointer to a display - * @param code an event code. LV_EVENT_... - * @param param optional param - * @return LV_RESULT_OK: disp wasn't deleted in the event. - */ -lv_result_t lv_display_send_event(lv_display_t * disp, lv_event_code_t code, void * param); - -/** - * Get the area to be invalidated. Can be used in `LV_EVENT_INVALIDATE_AREA` - * @param e pointer to an event - * @return the area to invalidated (can be modified as required) - */ -lv_area_t * lv_event_get_invalidated_area(lv_event_t * e); - -/** - * Set the theme of a display. If there are no user created widgets yet the screens' theme will be updated - * @param disp pointer to a display - * @param th pointer to a theme - */ -void lv_display_set_theme(lv_display_t * disp, lv_theme_t * th); - -/** - * Get the theme of a display - * @param disp pointer to a display - * @return the display's theme (can be NULL) - */ -lv_theme_t * lv_display_get_theme(lv_display_t * disp); - -/** - * Get elapsed time since last user activity on a display (e.g. click) - * @param disp pointer to a display (NULL to get the overall smallest inactivity) - * @return elapsed ticks (milliseconds) since the last activity - */ -uint32_t lv_display_get_inactive_time(const lv_display_t * disp); - -/** - * Manually trigger an activity on a display - * @param disp pointer to a display (NULL to use the default display) - */ -void lv_display_trigger_activity(lv_display_t * disp); - -/** - * Temporarily enable and disable the invalidation of the display. - * @param disp pointer to a display (NULL to use the default display) - * @param en true: enable invalidation; false: invalidation - */ -void lv_display_enable_invalidation(lv_display_t * disp, bool en); - -/** - * Get display invalidation is enabled. - * @param disp pointer to a display (NULL to use the default display) - * @return return true if invalidation is enabled - */ -bool lv_display_is_invalidation_enabled(lv_display_t * disp); - -/** - * Get a pointer to the screen refresher timer to - * modify its parameters with `lv_timer_...` functions. - * @param disp pointer to a display - * @return pointer to the display refresher timer. (NULL on error) - */ -lv_timer_t * lv_display_get_refr_timer(lv_display_t * disp); - -/** - * Delete screen refresher timer - * @param disp pointer to a display - */ -void lv_display_delete_refr_timer(lv_display_t * disp); - -/** - * Register vsync event of a display. `LV_EVENT_VSYNC` event will be sent periodically. - * Please don't use it in display event listeners, as it may cause memory leaks and illegal access issues. - * - * @param disp pointer to a display - * @param event_cb an event callback - * @param user_data optional user_data - */ -bool lv_display_register_vsync_event(lv_display_t * disp, lv_event_cb_t event_cb, void * user_data); - -/** - * Unregister vsync event of a display. `LV_EVENT_VSYNC` event won't be sent periodically. - * Please don't use it in display event listeners, as it may cause memory leaks and illegal access issues. - * @param disp pointer to a display - * @param event_cb an event callback - * @param user_data optional user_data - */ -bool lv_display_unregister_vsync_event(lv_display_t * disp, lv_event_cb_t event_cb, void * user_data); - -/** - * Send an vsync event to a display - * @param disp pointer to a display - * @param param optional param - * @return LV_RESULT_OK: disp wasn't deleted in the event. - */ -lv_result_t lv_display_send_vsync_event(lv_display_t * disp, void * param); - -void lv_display_set_user_data(lv_display_t * disp, void * user_data); -void lv_display_set_driver_data(lv_display_t * disp, void * driver_data); -void * lv_display_get_user_data(lv_display_t * disp); -void * lv_display_get_driver_data(lv_display_t * disp); -lv_draw_buf_t * lv_display_get_buf_active(lv_display_t * disp); - -/** - * Rotate an area in-place according to the display's rotation - * @param disp pointer to a display - * @param area pointer to an area to rotate - */ -void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area); - -/** - * Rotate a point in-place according to the display's rotation - * @param disp pointer to a display - * @param point pointer to a point to rotate - */ -void lv_display_rotate_point(lv_display_t * disp, lv_point_t * point); - -/** - * Get the size of the draw buffers - * @param disp pointer to a display - * @return the size of the draw buffer in bytes for valid display, 0 otherwise - */ -uint32_t lv_display_get_draw_buf_size(lv_display_t * disp); - -/** - * Get the size of the invalidated draw buffer. Can be used in the flush callback - * to get the number of bytes used in the current render buffer. - * @param disp pointer to a display - * @param width the width of the invalidated area - * @param height the height of the invalidated area - * @return the size of the invalidated draw buffer in bytes, not accounting for - * any preceding palette information for a valid display, 0 otherwise - */ -uint32_t lv_display_get_invalidated_draw_buf_size(lv_display_t * disp, uint32_t width, uint32_t height); - -/********************** - * MACROS - **********************/ - -/*------------------------------------------------ - * To improve backward compatibility - * Recommended only if you have one display - *------------------------------------------------*/ - -#ifndef LV_HOR_RES -/** - * The horizontal resolution of the currently active display. - */ -#define LV_HOR_RES lv_display_get_horizontal_resolution(lv_display_get_default()) -#endif - -#ifndef LV_VER_RES -/** - * The vertical resolution of the currently active display. - */ -#define LV_VER_RES lv_display_get_vertical_resolution(lv_display_get_default()) -#endif - -/** - * See `lv_dpx()` and `lv_display_dpx()`. - * Same as Android's DIP. (Different name is chosen to avoid mistype between LV_DPI and LV_DIP) - * - * - 40 dip is 40 px on a 160 DPI screen (distance = 1/4 inch). - * - 40 dip is 80 px on a 320 DPI screen (distance still = 1/4 inch). - * - * @sa https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp - */ -#define LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/ -#define LV_DPX(n) LV_DPX_CALC(lv_display_get_dpi(NULL), n) - -/** - * For default display, computes the number of pixels (a distance or size) as if the - * display had 160 DPI. This allows you to specify 1/160-th fractions of an inch to - * get real distance on the display that will be consistent regardless of its current - * DPI. It ensures `lv_dpx(100)`, for example, will have the same physical size - * regardless to the DPI of the display. - * @param n number of 1/160-th-inch units to compute with - * @return number of pixels to use to make that distance - */ -int32_t lv_dpx(int32_t n); - -/** - * For specified display, computes the number of pixels (a distance or size) as if the - * display had 160 DPI. This allows you to specify 1/160-th fractions of an inch to - * get real distance on the display that will be consistent regardless of its current - * DPI. It ensures `lv_dpx(100)`, for example, will have the same physical size - * regardless to the DPI of the display. - * @param disp pointer to display whose dpi should be considered - * @param n number of 1/160-th-inch units to compute with - * @return number of pixels to use to make that distance - */ -int32_t lv_display_dpx(const lv_display_t * disp, int32_t n); - -#if LV_USE_EXT_DATA -/** - * @brief Attaches external user data and destructor callback to a display - * - * Associates custom user data with an LVGL display and specifies a destructor function - * that will be automatically invoked when the display is deleted to properly clean up - * the associated resources. - * - * @param disp Pointer to a display - * @param data User-defined data pointer to associate with the display - * @param free_cb Callback function for cleaning up data when display is deleted. - * Receives data as parameter. NULL means no cleanup required. - */ -void lv_display_set_external_data(lv_display_t * disp, void * data, void (* free_cb)(void * data)); -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DISPLAY_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/display/lv_display_private.h b/src/display/lv_display_private.h index b498f34682..3cde7927ab 100644 --- a/src/display/lv_display_private.h +++ b/src/display/lv_display_private.h @@ -13,11 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../misc/lv_ext_data.h" -#include "../misc/lv_types.h" -#include "../core/lv_obj.h" -#include "../draw/lv_draw.h" -#include "lv_display.h" +#include "../lv_public_api.h" #if LV_USE_SYSMON #include "../debugging/sysmon/lv_sysmon_private.h" diff --git a/src/draw/convert/helium/lv_draw_buf_convert_helium.c b/src/draw/convert/helium/lv_draw_buf_convert_helium.c index ff5b8cd686..3f58b97d6c 100644 --- a/src/draw/convert/helium/lv_draw_buf_convert_helium.c +++ b/src/draw/convert/helium/lv_draw_buf_convert_helium.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM #include "lv_draw_buf_convert_helium.h" diff --git a/src/draw/convert/helium/lv_draw_buf_convert_helium.h b/src/draw/convert/helium/lv_draw_buf_convert_helium.h index 3fb670d6c2..7670f90432 100644 --- a/src/draw/convert/helium/lv_draw_buf_convert_helium.h +++ b/src/draw/convert/helium/lv_draw_buf_convert_helium.h @@ -10,8 +10,7 @@ extern "C" { #endif -#include "../../../misc/lv_color.h" -#include "../../lv_draw_buf.h" +#include "../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM diff --git a/src/draw/convert/lv_draw_buf_convert.c b/src/draw/convert/lv_draw_buf_convert.c index 7a112aba24..b6ed5ce901 100644 --- a/src/draw/convert/lv_draw_buf_convert.c +++ b/src/draw/convert/lv_draw_buf_convert.c @@ -6,8 +6,9 @@ /********************* * INCLUDES *********************/ + +#include "../../lv_public_api.h" #include "lv_draw_buf_convert.h" -#include "../../misc/lv_profiler.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_draw_buf_convert_neon.h" diff --git a/src/draw/convert/lv_draw_buf_convert.h b/src/draw/convert/lv_draw_buf_convert.h index 7f3b9c1d5b..d4029f39da 100644 --- a/src/draw/convert/lv_draw_buf_convert.h +++ b/src/draw/convert/lv_draw_buf_convert.h @@ -10,8 +10,7 @@ extern "C" { #endif -#include "../../misc/lv_color.h" -#include "../lv_draw_buf.h" +#include "../../lv_public_api.h" /********************* * DEFINES diff --git a/src/draw/convert/neon/lv_draw_buf_convert_neon.c b/src/draw/convert/neon/lv_draw_buf_convert_neon.c index 991f55fb29..3cf13b6133 100644 --- a/src/draw/convert/neon/lv_draw_buf_convert_neon.c +++ b/src/draw/convert/neon/lv_draw_buf_convert_neon.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON diff --git a/src/draw/convert/neon/lv_draw_buf_convert_neon.h b/src/draw/convert/neon/lv_draw_buf_convert_neon.h index d97f61e3fa..384ebe465b 100644 --- a/src/draw/convert/neon/lv_draw_buf_convert_neon.h +++ b/src/draw/convert/neon/lv_draw_buf_convert_neon.h @@ -10,8 +10,7 @@ extern "C" { #endif -#include "../../../misc/lv_color.h" -#include "../../lv_draw_buf.h" +#include "../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON diff --git a/src/draw/dma2d/lv_draw_dma2d.h b/src/draw/dma2d/lv_draw_dma2d.h index af175f1fcb..07d42de6f7 100644 --- a/src/draw/dma2d/lv_draw_dma2d.h +++ b/src/draw/dma2d/lv_draw_dma2d.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_DMA2D /********************* diff --git a/src/draw/dma2d/lv_draw_dma2d_private.h b/src/draw/dma2d/lv_draw_dma2d_private.h index 1ba8d97d58..699dee7650 100644 --- a/src/draw/dma2d/lv_draw_dma2d_private.h +++ b/src/draw/dma2d/lv_draw_dma2d_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_draw_dma2d.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_DMA2D #include "../lv_draw_private.h" diff --git a/src/draw/espressif/ppa/lv_draw_ppa.h b/src/draw/espressif/ppa/lv_draw_ppa.h index 542b0fed9e..6bae1fa59e 100644 --- a/src/draw/espressif/ppa/lv_draw_ppa.h +++ b/src/draw/espressif/ppa/lv_draw_ppa.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_PPA diff --git a/src/draw/espressif/ppa/lv_draw_ppa_private.h b/src/draw/espressif/ppa/lv_draw_ppa_private.h index b2336c4495..d2b75da52a 100644 --- a/src/draw/espressif/ppa/lv_draw_ppa_private.h +++ b/src/draw/espressif/ppa/lv_draw_ppa_private.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_PPA #if LV_PPA_NONBLOCKING_OPS @@ -24,12 +24,6 @@ extern "C" { #define LV_PPA_NONBLOCKING_OPS 0 #endif -#include LV_STDDEF_INCLUDE -#include LV_STDBOOL_INCLUDE -#include LV_STDINT_INCLUDE - -#include "../../../misc/lv_color.h" -#include "../../../misc/lv_log.h" #include "../../lv_draw_private.h" #include "../../../display/lv_display_private.h" #include "../../../misc/lv_area_private.h" diff --git a/src/draw/eve/lv_draw_eve.c b/src/draw/eve/lv_draw_eve.c index fdb281c973..4f4276e05e 100644 --- a/src/draw/eve/lv_draw_eve.c +++ b/src/draw/eve/lv_draw_eve.c @@ -13,12 +13,10 @@ * INCLUDES *********************/ -#include "lv_draw_eve_private.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_EVE -#include "../../core/lv_refr.h" #include "../../display/lv_display_private.h" -#include "../../stdlib/lv_string.h" #include "lv_draw_eve_ram_g.h" #include "lv_draw_eve.h" #include "lv_eve.h" diff --git a/src/draw/eve/lv_draw_eve.h b/src/draw/eve/lv_draw_eve.h index 003638ad4f..6198c08e25 100644 --- a/src/draw/eve/lv_draw_eve.h +++ b/src/draw/eve/lv_draw_eve.h @@ -21,11 +21,9 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_EVE -#include "lv_draw_eve_target.h" - /********************* * DEFINES *********************/ diff --git a/src/draw/eve/lv_draw_eve_arc.c b/src/draw/eve/lv_draw_eve_arc.c index 2a19128c98..9c355458e9 100644 --- a/src/draw/eve/lv_draw_eve_arc.c +++ b/src/draw/eve/lv_draw_eve_arc.c @@ -15,7 +15,6 @@ #include "lv_draw_eve_private.h" #if LV_USE_DRAW_EVE -#include "../lv_draw_arc.h" #include "lv_eve.h" /********************* diff --git a/src/draw/eve/lv_draw_eve_letter.c b/src/draw/eve/lv_draw_eve_letter.c index b7786e1409..a6e7e6f30d 100644 --- a/src/draw/eve/lv_draw_eve_letter.c +++ b/src/draw/eve/lv_draw_eve_letter.c @@ -16,7 +16,6 @@ #include "../lv_draw_private.h" #include "../lv_draw_label_private.h" -#include "../lv_draw_rect.h" #include "lv_eve.h" /********************* diff --git a/src/draw/eve/lv_draw_eve_private.h b/src/draw/eve/lv_draw_eve_private.h index 1309c2e856..12586437c8 100644 --- a/src/draw/eve/lv_draw_eve_private.h +++ b/src/draw/eve/lv_draw_eve_private.h @@ -19,19 +19,12 @@ extern "C" { * INCLUDES *********************/ -#include "lv_draw_eve.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_EVE -#include "lv_draw_eve_target.h" #include "lv_draw_eve_ram_g.h" #include "../lv_draw_private.h" -#include "../../misc/lv_types.h" #include "../../core/lv_global.h" -#include "../lv_draw_triangle.h" -#include "../lv_draw_line.h" -#include "../lv_draw_label.h" -#include "../../font/fmt_txt/lv_font_fmt_txt.h" -#include "../lv_draw_arc.h" #if LV_DRAW_EVE_WRITE_BUFFER_SIZE != 0 && LV_DRAW_EVE_WRITE_BUFFER_SIZE < 4 #warning LV_DRAW_EVE_WRITE_BUFFER_SIZE cannot be less than 4. Using 0 (buffering disabled). diff --git a/src/draw/eve/lv_draw_eve_target.h b/src/draw/eve/lv_draw_eve_target.h index 90e938bb37..669b5245ba 100644 --- a/src/draw/eve/lv_draw_eve_target.h +++ b/src/draw/eve/lv_draw_eve_target.h @@ -1,79 +1,2 @@ -/** - * @file lv_draw_eve_target.h - * - */ - -#ifndef LV_DRAW_EVE_TARGET_H -#define LV_DRAW_EVE_TARGET_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" -#if LV_USE_DRAW_EVE - -#include "../../misc/lv_types.h" -#include LV_STDBOOL_INCLUDE -#include LV_STDINT_INCLUDE - -typedef struct { - uint16_t hor_res; /**< active display width */ - uint16_t ver_res; /**< active display height */ - uint16_t hcycle; /**< total number of clocks per line, incl front/back porch */ - uint16_t hoffset; /**< start of active line */ - uint16_t hsync0; /**< start of horizontal sync pulse */ - uint16_t hsync1; /**< end of horizontal sync pulse */ - uint16_t vcycle; /**< total number of lines per screen, including pre/post */ - uint16_t voffset; /**< start of active screen */ - uint16_t vsync0; /**< start of vertical sync pulse */ - uint16_t vsync1; /**< end of vertical sync pulse */ - uint8_t swizzle; /**< FT8xx output to LCD - pin order */ - uint8_t pclkpol; /**< LCD data is clocked in on this PCLK edge */ - uint8_t cspread; /**< helps with noise, when set to 1 fewer signals are changed simultaneously, reset-default: 1 */ - uint8_t pclk; /**< 60MHz / pclk = pclk frequency */ - bool has_crystal; /**< has an external clock crystal */ - bool has_gt911; /**< has a touch controller */ - uint8_t backlight_pwm; /**< backlight PWM duty cycle 0 = off, 128 = max */ - uint16_t backlight_freq; /**< backlight PWM frequency. try 4000 if unsure */ -} lv_draw_eve_parameters_t; - -typedef enum { - LV_DRAW_EVE_OPERATION_POWERDOWN_SET, /**< set the "PD_N" pin low */ - LV_DRAW_EVE_OPERATION_POWERDOWN_CLEAR, /**< set the "PD_N" pin high */ - LV_DRAW_EVE_OPERATION_CS_ASSERT, /**< set the "CS_N" pin low */ - LV_DRAW_EVE_OPERATION_CS_DEASSERT, /**< set the "CS_N" pin high */ - LV_DRAW_EVE_OPERATION_SPI_SEND, /**< send `length` bytes of `data` over SPI */ - LV_DRAW_EVE_OPERATION_SPI_RECEIVE /**< receive `length` bytes into `data` from SPI */ -} lv_draw_eve_operation_t; - -typedef void (*lv_draw_eve_operation_cb_t)(lv_display_t * disp, lv_draw_eve_operation_t operation, void * data, - uint32_t length); - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_DRAW_EVE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_EVE_TARGET_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/core/lvgl/lvgl.h" diff --git a/src/draw/eve/lv_draw_eve_triangle.c b/src/draw/eve/lv_draw_eve_triangle.c index b48411f59e..b3c2bb3da7 100644 --- a/src/draw/eve/lv_draw_eve_triangle.c +++ b/src/draw/eve/lv_draw_eve_triangle.c @@ -12,14 +12,12 @@ /********************* * INCLUDES *********************/ + #include "lv_draw_eve_private.h" + #if LV_USE_DRAW_EVE -#include "../../misc/lv_math.h" -#include "../../stdlib/lv_mem.h" #include "../../misc/lv_area_private.h" -#include "../../misc/lv_color.h" -#include "../../stdlib/lv_string.h" #include "lv_eve.h" /********************* diff --git a/src/draw/eve/lv_eve.h b/src/draw/eve/lv_eve.h index b48bd11519..52481b66b9 100644 --- a/src/draw/eve/lv_eve.h +++ b/src/draw/eve/lv_eve.h @@ -24,8 +24,6 @@ extern "C" { #if LV_USE_DRAW_EVE -#include "../../misc/lv_types.h" -#include "../../misc/lv_color.h" #include "../../libs/FT800-FT813/EVE.h" /********************* diff --git a/src/draw/lv_draw.c b/src/draw/lv_draw.c index dc4ce22199..f479f68f27 100644 --- a/src/draw/lv_draw.c +++ b/src/draw/lv_draw.c @@ -10,18 +10,14 @@ /********************* * INCLUDES *********************/ +#include "../lv_public_api.h" #include "../misc/lv_area_private.h" -#include "../misc/lv_assert.h" #include "../misc/lv_event_private.h" #include "lv_draw_private.h" -#include "lv_draw_mask.h" #include "lv_draw_vector_private.h" -#include "lv_draw_3d.h" -#include "sw/lv_draw_sw.h" #include "../display/lv_display_private.h" #include "../core/lv_global.h" #include "../core/lv_refr_private.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/lv_draw.h b/src/draw/lv_draw.h index 2f14f0dca5..7db2db3512 100644 --- a/src/draw/lv_draw.h +++ b/src/draw/lv_draw.h @@ -1,394 +1,2 @@ -/** - * @file lv_draw.h - * - */ - -/** - * Modified by NXP in 2024 - */ - -#ifndef LV_DRAW_H -#define LV_DRAW_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -#include "../misc/lv_types.h" -#include "../misc/lv_style.h" -#include "../misc/lv_text.h" -#include "../misc/lv_profiler.h" -#include "../misc/lv_matrix.h" -#include "../misc/lv_event.h" -#include "lv_image_decoder.h" -#include "lv_draw_buf.h" - -/********************* - * DEFINES - *********************/ -#define LV_DRAW_UNIT_NONE 0 -#define LV_DRAW_UNIT_IDLE -1 /**< The draw unit is idle, new dispatching might be requested to try again */ - -#if LV_DRAW_TRANSFORM_USE_MATRIX -#if !LV_USE_MATRIX -#error "LV_DRAW_TRANSFORM_USE_MATRIX requires LV_USE_MATRIX = 1" -#endif -#endif - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_DRAW_TASK_TYPE_NONE = 0, - LV_DRAW_TASK_TYPE_FILL, - LV_DRAW_TASK_TYPE_BORDER, - LV_DRAW_TASK_TYPE_BOX_SHADOW, - LV_DRAW_TASK_TYPE_LETTER, - LV_DRAW_TASK_TYPE_LABEL, - LV_DRAW_TASK_TYPE_IMAGE, - LV_DRAW_TASK_TYPE_LAYER, - LV_DRAW_TASK_TYPE_LINE, - LV_DRAW_TASK_TYPE_ARC, - LV_DRAW_TASK_TYPE_TRIANGLE, - LV_DRAW_TASK_TYPE_MASK_RECTANGLE, - LV_DRAW_TASK_TYPE_MASK_BITMAP, - LV_DRAW_TASK_TYPE_BLUR, -#if LV_USE_VECTOR_GRAPHIC - LV_DRAW_TASK_TYPE_VECTOR, -#endif -#if LV_USE_3DTEXTURE - LV_DRAW_TASK_TYPE_3D, -#endif -} lv_draw_task_type_t; - -typedef enum { - /** Waiting for an other task to be finished. - * For example in case of `LV_DRAW_TASK_TYPE_LAYER` (used to blend a layer) - * is blocked until all the draw tasks of the layer is rendered. */ - LV_DRAW_TASK_STATE_BLOCKED, - - /** The draw task is added to the layers list and waits to be rendered. */ - LV_DRAW_TASK_STATE_WAITING, - - /** The draw task is added to the command queue of the draw unit. - * As the queued task are executed in order it's possible to queue multiple draw task - * (for the same draw unit) even if they are depending on each other. - * Therefore `lv_draw_get_available_task` and `lv_draw_get_next_available_task` can return - * draw task for the same draw unit even if a dependent draw task is not finished ready yet.*/ - LV_DRAW_TASK_STATE_QUEUED, - - /** The draw task is being rendered. This draw task needs to be finished before - * `lv_draw_get_available_task` and `lv_draw_get_next_available_task` would - * return any depending draw tasks.*/ - LV_DRAW_TASK_STATE_IN_PROGRESS, - - /** The draw task is rendered. It will be removed from the draw task list of the layer - * and freed automatically. */ - LV_DRAW_TASK_STATE_FINISHED, -} lv_draw_task_state_t; - -struct _lv_layer_t { - /** Target draw buffer of the layer */ - lv_draw_buf_t * draw_buf; - - /** Linked list of draw tasks */ - lv_draw_task_t * draw_task_head; - - /** Parent layer */ - lv_layer_t * parent; - - /** Next layer */ - lv_layer_t * next; - - /** User data */ - void * user_data; - - /** The absolute coordinates of the buffer */ - lv_area_t buf_area; - - /** The physical clipping area relative to the display */ - lv_area_t phy_clip_area; - - /** - * NEVER USE IT DRAW UNITS. USED INTERNALLY DURING DRAW TASK CREATION. - * The current clip area with absolute coordinates, always the same or smaller than `buf_area` - * Can be set before new draw tasks are added to indicate the clip area of the draw tasks. - * Therefore `lv_draw_add_task()` always saves it in the new draw task to know the clip area when the draw task was added. - * During drawing the draw units also sees the saved clip_area and should use it during drawing. - * During drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks. - */ - lv_area_t _clip_area; - -#if LV_DRAW_TRANSFORM_USE_MATRIX - /** Transform matrix to be applied when rendering the layer */ - lv_matrix_t matrix; -#endif - - /** Partial y offset */ - int32_t partial_y_offset; - - /** Recolor of the layer */ - lv_color32_t recolor; - - /** The color format of the layer. LV_COLOR_FORMAT_... */ - lv_color_format_t color_format; - - /** Flag indicating all tasks are added */ - bool all_tasks_added; - - /** Opacity of the layer */ - lv_opa_t opa; -}; - -typedef struct { - /**The widget for which draw descriptor was created */ - lv_obj_t * obj; - - /**The widget part for which draw descriptor was created */ - uint32_t part; - - /**A widget type specific ID (e.g. table row index). See the docs of the given widget.*/ - uint32_t id1; - - /**A widget type specific ID (e.g. table column index). See the docs of the given widget.*/ - uint32_t id2; - - /**The target layer */ - lv_layer_t * layer; - - /*Drop shadow is part of every draw dsc as anything can have drop shadow*/ - - /**Drop shadow offset in X*/ - int16_t drop_shadow_ofs_x; - - /**Drop shadow offset in Y*/ - int16_t drop_shadow_ofs_y; - - /**Drop shadow color*/ - lv_color_t drop_shadow_color; - - /**Drop shadow opacity*/ - lv_opa_t drop_shadow_opa; - - /**Drop shadow blur radius*/ - int32_t drop_shadow_blur_radius: 20; - - /**Drop shadow blur quality*/ - lv_blur_quality_t drop_shadow_quality : 3; - - /**Size of the specific draw descriptor into which this base descriptor is embedded*/ - size_t dsc_size; - - /**Any custom user data*/ - void * user_data; -} lv_draw_dsc_base_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Used internally to initialize the drawing module - */ -void lv_draw_init(void); - -/** - * Deinitialize the drawing module - */ -void lv_draw_deinit(void); - -/** - * Allocate a new draw unit with the given size and appends it to the list of draw units - * @param size the size to allocate. E.g. `sizeof(my_draw_unit_t)`, - * where the first element of `my_draw_unit_t` is `lv_draw_unit_t`. - */ -void * lv_draw_create_unit(size_t size); - -/** - * Add an empty draw task to the draw task list of a layer. - * @param layer pointer to a layer - * @param coords the coordinates of the draw task - * @return the created draw task which needs to be - * further configured e.g. by added a draw descriptor - */ -lv_draw_task_t * lv_draw_add_task(lv_layer_t * layer, const lv_area_t * coords, lv_draw_task_type_t type); - -/** - * Needs to be called when a draw task is created and configured. - * It will send an event about the new draw task to the widget - * and assign it to a draw unit. - * @param layer pointer to a layer - * @param t pointer to a draw task - */ -void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t); - -/** - * Try dispatching draw tasks to draw units - */ -void lv_draw_dispatch(void); - -/** - * Used internally to try dispatching draw tasks of a specific layer - * @param disp pointer to a display on which the dispatching was requested - * @param layer pointer to a layer - * @return at least one draw task is being rendered (maybe it was taken earlier) - */ -bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer); - -/** - * Wait for a new dispatch request. - * It's blocking if `LV_USE_OS == 0` else it yields - */ -void lv_draw_dispatch_wait_for_request(void); - -/** - * Wait for draw finish in case of asynchronous task execution. - * If `LV_USE_OS == 0` it just return. - */ -void lv_draw_wait_for_finish(void); - -/** - * When a draw unit finished a draw task it needs to request dispatching - * to let LVGL assign a new draw task to it - */ -void lv_draw_dispatch_request(void); - -/** - * Get the total number of draw units. - */ -uint32_t lv_draw_get_unit_count(void); - -/** - * If there is only one draw unit check the first draw task if it's available. - * If there are multiple draw units call `lv_draw_get_next_available_task` to find a task. - * @param layer the draw layer to search in - * @param t_prev continue searching from this task - * @param draw_unit_id check the task where `preferred_draw_unit_id` equals this value or `LV_DRAW_UNIT_NONE` - * @return an available draw task or NULL if there is not any - */ -lv_draw_task_t * lv_draw_get_available_task(lv_layer_t * layer, lv_draw_task_t * t_prev, uint8_t draw_unit_id); - -/** - * Find and available draw task - * @param layer the draw layer to search in - * @param t_prev continue searching from this task - * @param draw_unit_id check the task where `preferred_draw_unit_id` equals this value or `LV_DRAW_UNIT_NONE` - * @return an available draw task or NULL if there is not any - */ -lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_task_t * t_prev, uint8_t draw_unit_id); - -/** - * Tell how many draw task are waiting to be drawn on the area of `t_check`. - * It can be used to determine if a GPU shall combine many draw tasks into one or not. - * If a lot of tasks are waiting for the current ones it makes sense to draw them one-by-one - * to not block the dependent tasks' rendering - * @param t_check the task whose dependent tasks shall be counted - * @return number of tasks depending on `t_check` - */ -uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check); - - -/** - * Send an event to the draw units - * @param name the name of the draw unit to send the event to - * @param code the event code - * @param param the event parameter - */ -void lv_draw_unit_send_event(const char * name, lv_event_code_t code, void * param); - -/** - * Initialize a layer - * @param layer pointer to a layer to initialize - */ -void lv_layer_init(lv_layer_t * layer); - -/** - * Reset the layer to a drawable state - * @param layer pointer to a layer to reset - */ -void lv_layer_reset(lv_layer_t * layer); - -/** - * Create (allocate) a new layer on a parent layer - * @param parent_layer the parent layer to which the layer will be merged when it's rendered - * @param color_format the color format of the layer - * @param area the areas of the layer (absolute coordinates) - * @return the new target_layer or NULL on error - */ -lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t color_format, const lv_area_t * area); - -/** - * Initialize a layer which is allocated by the user - * @param layer pointer the layer to initialize (its lifetime needs to be managed by the user) - * @param parent_layer the parent layer to which the layer will be merged when it's rendered - * @param color_format the color format of the layer - * @param area the areas of the layer (absolute coordinates) - * @return the new target_layer or NULL on error - */ -void lv_draw_layer_init(lv_layer_t * layer, lv_layer_t * parent_layer, lv_color_format_t color_format, - const lv_area_t * area); - -/** - * Try to allocate a buffer for the layer. - * @param layer pointer to a layer - * @return pointer to the allocated aligned buffer or NULL on failure - */ -void * lv_draw_layer_alloc_buf(lv_layer_t * layer); - -/** - * Got to a pixel at X and Y coordinate on a layer - * @param layer pointer to a layer - * @param x the target X coordinate - * @param y the target X coordinate - * @return `buf` offset to point to the given X and Y coordinate - */ -void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y); - -/** - * Get the type of a draw task - * @param t the draw task to get the type of - * @return the draw task type -*/ -lv_draw_task_type_t lv_draw_task_get_type(const lv_draw_task_t * t); - -/** - * Get the draw descriptor of a draw task - * @param t the draw task to get the draw descriptor of - * @return a void pointer to the draw descriptor -*/ -void * lv_draw_task_get_draw_dsc(const lv_draw_task_t * t); - -/** - * Get the draw area of a draw task - * @param t the draw task to get the draw area of - * @param area the destination where the draw area will be stored -*/ -void lv_draw_task_get_area(const lv_draw_task_t * t, lv_area_t * area); - - - -lv_layer_t * lv_draw_layer_create_drop_shadow(lv_layer_t * parent_layer, const lv_draw_dsc_base_t * base, - const lv_area_t * area); - -void lv_draw_layer_finish_drop_shadow(lv_layer_t * drop_shadow_layer, const lv_draw_dsc_base_t * base); - - -/********************** - * GLOBAL VARIABLES - **********************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_3d.c b/src/draw/lv_draw_3d.c index d0c15283ad..be023cf199 100644 --- a/src/draw/lv_draw_3d.c +++ b/src/draw/lv_draw_3d.c @@ -7,11 +7,10 @@ * INCLUDES *********************/ -#include "lv_draw_3d.h" -#if LV_USE_3DTEXTURE - #include "lv_draw_private.h" +#if LV_USE_3DTEXTURE + /********************* * DEFINES *********************/ diff --git a/src/draw/lv_draw_3d.h b/src/draw/lv_draw_3d.h index 61bfb36229..117e5eede6 100644 --- a/src/draw/lv_draw_3d.h +++ b/src/draw/lv_draw_3d.h @@ -1,72 +1,2 @@ -/** - * @file lv_draw_3d.h - * - */ - -#ifndef LV_DRAW_3D_H -#define LV_DRAW_3D_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../lv_conf_internal.h" -#if LV_USE_3DTEXTURE - -#include "lv_draw.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_draw_dsc_base_t base; - lv_3dtexture_id_t tex_id; - bool h_flip; - bool v_flip; - lv_opa_t opa; -} lv_draw_3d_dsc_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a 3D draw descriptor - * @param dsc pointer to a draw descriptor - */ -void lv_draw_3d_dsc_init(lv_draw_3d_dsc_t * dsc); - -/** - * Try to get a 3D draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_3D - */ -lv_draw_3d_dsc_t * lv_draw_task_get_3d_dsc(lv_draw_task_t * task); - -/** - * Create a 3D draw task - * @param layer pointer to a layer - * @param dsc pointer to an initialized `lv_draw_3d_dsc_t` variable - */ -void lv_draw_3d(lv_layer_t * layer, const lv_draw_3d_dsc_t * dsc, const lv_area_t * coords); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_3DTEXTURE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_3D_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_arc.c b/src/draw/lv_draw_arc.c index f8ac15f582..b073e59315 100644 --- a/src/draw/lv_draw_arc.c +++ b/src/draw/lv_draw_arc.c @@ -6,11 +6,8 @@ /********************* * INCLUDES *********************/ + #include "lv_draw_private.h" -#include "../core/lv_obj.h" -#include "lv_draw_arc.h" -#include "../core/lv_obj_event.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_arc.h b/src/draw/lv_draw_arc.h index 3518031b23..23fdf865be 100644 --- a/src/draw/lv_draw_arc.h +++ b/src/draw/lv_draw_arc.h @@ -1,110 +1,2 @@ -/** - * @file lv_draw_arc.h - * - */ - -#ifndef LV_DRAW_ARC_H -#define LV_DRAW_ARC_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_draw.h" -#include "../lv_conf_internal.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" -#include "../misc/lv_style.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_draw_dsc_base_t base; - - /**The color of the arc*/ - lv_color_t color; - - /**The width (thickness) of the arc */ - int32_t width; - - /**The start angle in 1 degree units (if `LV_USE_FLOAT` is enabled a float number can be also used) - * 0° is the 3 o'clock position, 90° is the 6 o'clock, etc. */ - lv_value_precise_t start_angle; - - /**The end angle, similarly to start_angle. */ - lv_value_precise_t end_angle; - - /**The center point of the arc. */ - lv_point_t center; - - /**An image source to be used instead of `color`. `NULL` if unused*/ - const void * img_src; - - /**The outer radius of the arc*/ - uint16_t radius; - - /**Opacity of the arc in 0...255 range. - * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ - lv_opa_t opa; - - /**1: Make the arc ends rounded*/ - uint8_t rounded : 1; -} lv_draw_arc_dsc_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize an arc draw descriptor. - * @param dsc pointer to a draw descriptor - */ -void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc); - -/** - * Try to get an arc draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_ARC - */ -lv_draw_arc_dsc_t * lv_draw_task_get_arc_dsc(lv_draw_task_t * task); - -/** - * Create an arc draw task. - * @param layer pointer to a layer - * @param dsc pointer to an initialized draw descriptor variable - */ -void lv_draw_arc(lv_layer_t * layer, const lv_draw_arc_dsc_t * dsc); - -/** - * Get an area the should be invalidated when the arcs angle changed between start_angle and end_ange - * @param x the x coordinate of the center of the arc - * @param y the y coordinate of the center of the arc - * @param radius the radius of the arc - * @param start_angle the start angle of the arc (0 deg on the bottom, 90 deg on the right) - * @param end_angle the end angle of the arc - * @param w width of the arc - * @param rounded true: the arc is rounded - * @param area store the area to invalidate here - */ -void lv_draw_arc_get_area(int32_t x, int32_t y, uint16_t radius, lv_value_precise_t start_angle, - lv_value_precise_t end_angle, - int32_t w, bool rounded, lv_area_t * area); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_ARC_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_blur.c b/src/draw/lv_draw_blur.c index c09d59d375..0b398da4cf 100644 --- a/src/draw/lv_draw_blur.c +++ b/src/draw/lv_draw_blur.c @@ -6,10 +6,8 @@ /********************* * INCLUDES *********************/ + #include "lv_draw_private.h" -#include "lv_draw_blur.h" -#include "../misc/lv_types.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_blur.h b/src/draw/lv_draw_blur.h index acbb556502..6ddeccc4a1 100644 --- a/src/draw/lv_draw_blur.h +++ b/src/draw/lv_draw_blur.h @@ -1,82 +1,2 @@ -/** - * @file lv_draw_blur.h - * - */ - -#ifndef LV_DRAW_BLUR_H -#define LV_DRAW_BLUR_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" -#include "../misc/lv_style.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_draw_dsc_base_t base; - - /** - * The intensity of blur. - */ - int32_t blur_radius; - - /** - * The corner radius of the blurred area - */ - int32_t corner_radius; - - /** - * Sets whether to prefer speed or precision - */ - lv_blur_quality_t quality; - -} lv_draw_blur_dsc_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a blur draw descriptor - * @param dsc pointer to a draw descriptor - */ -void lv_draw_blur_dsc_init(lv_draw_blur_dsc_t * dsc); - -/** - * Try to get a blur draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_BLUR - */ -lv_draw_blur_dsc_t * lv_draw_task_get_blur_dsc(lv_draw_task_t * task); - -/** - * Create a blur draw task - * @param layer pointer to a layer - * @param dsc pointer to an initialized `lv_draw_blur_dsc_t` variable - * @param coords coordinates of the character - */ -void lv_draw_blur(lv_layer_t * layer, const lv_draw_blur_dsc_t * dsc, const lv_area_t * coords); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_BLUR_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_buf.c b/src/draw/lv_draw_buf.c index bedebf3edf..ecdc04fbc8 100644 --- a/src/draw/lv_draw_buf.c +++ b/src/draw/lv_draw_buf.c @@ -7,10 +7,7 @@ * INCLUDES *********************/ #include "lv_draw_buf_private.h" -#include "../misc/lv_types.h" -#include "../stdlib/lv_string.h" #include "../core/lv_global.h" -#include "../misc/lv_math.h" #include "../misc/lv_area_private.h" #include "convert/lv_draw_buf_convert.h" diff --git a/src/draw/lv_draw_buf.h b/src/draw/lv_draw_buf.h index addad22ea8..789ef926c9 100644 --- a/src/draw/lv_draw_buf.h +++ b/src/draw/lv_draw_buf.h @@ -1,389 +1,2 @@ -/** - * @file lv_draw_buf.h - * - */ - -#ifndef LV_DRAW_BUF_H -#define LV_DRAW_BUF_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_types.h" -#include "../misc/lv_area.h" -#include "../misc/lv_color.h" -#include "../stdlib/lv_string.h" -#include "lv_image_dsc.h" - -/********************* - * DEFINES - *********************/ - -/** Use this value to let LVGL calculate stride automatically */ -#define LV_STRIDE_AUTO 0 -LV_EXPORT_CONST_INT(LV_STRIDE_AUTO); - -/** - * Stride alignment for draw buffers. - * It may vary between different color formats and hardware. - * Refine it to suit your needs. - */ - -#define LV_DRAW_BUF_STRIDE(w, cf) \ - LV_ROUND_UP(((w) * LV_COLOR_FORMAT_GET_BPP(cf) + 7) / 8, LV_DRAW_BUF_STRIDE_ALIGN) - -/** Allocate a slightly larger buffer, so we can adjust the start address to meet alignment */ -#define LV_DRAW_BUF_SIZE(w, h, cf) \ - (LV_DRAW_BUF_STRIDE(w, cf) * (h) + LV_DRAW_BUF_ALIGN + \ - LV_COLOR_INDEXED_PALETTE_SIZE(cf) * sizeof(lv_color32_t)) - -/** - * Define a static draw buffer with the given width, height, and color format. - * Stride alignment is set to LV_DRAW_BUF_STRIDE_ALIGN. - * - * For platform that needs special buffer alignment, call LV_DRAW_BUF_INIT_STATIC. - */ -#define LV_DRAW_BUF_DEFINE_STATIC(name, _w, _h, _cf) \ - static LV_ATTRIBUTE_MEM_ALIGN uint8_t buf_##name[LV_DRAW_BUF_SIZE(_w, _h, _cf)]; \ - static lv_draw_buf_t name = { \ - .header = { \ - .magic = LV_IMAGE_HEADER_MAGIC, \ - .cf = (_cf), \ - .flags = LV_IMAGE_FLAGS_MODIFIABLE, \ - .w = (_w), \ - .h = (_h), \ - .stride = LV_DRAW_BUF_STRIDE(_w, _cf), \ - .reserved_2 = 0, \ - }, \ - .data_size = sizeof(buf_##name), \ - .data = buf_##name, \ - .unaligned_data = buf_##name, \ - } - -#define LV_DRAW_BUF_INIT_STATIC(name) \ - do { \ - lv_image_header_t * header = &name.header; \ - lv_draw_buf_init(&name, header->w, header->h, (lv_color_format_t)header->cf, header->stride, buf_##name, sizeof(buf_##name)); \ - lv_draw_buf_set_flag(&name, LV_IMAGE_FLAGS_MODIFIABLE); \ - } while(0) - -/********************** - * TYPEDEFS - **********************/ - -typedef void * (*lv_draw_buf_malloc_cb_t)(size_t size, lv_color_format_t color_format); - -typedef void (*lv_draw_buf_free_cb_t)(void * draw_buf); - -typedef void (*lv_draw_buf_copy_cb_t)(lv_draw_buf_t * dest, const lv_area_t * dest_area, - const lv_draw_buf_t * src, const lv_area_t * src_area); - -typedef void * (*lv_draw_buf_align_cb_t)(void * buf, lv_color_format_t color_format); - -typedef void (*lv_draw_buf_cache_operation_cb_t)(const lv_draw_buf_t * draw_buf, const lv_area_t * area); - -typedef uint32_t (*lv_draw_buf_width_to_stride_cb_t)(uint32_t w, lv_color_format_t color_format); - -struct _lv_draw_buf_t { - lv_image_header_t header; - uint32_t data_size; /**< Total buf size in bytes */ - uint8_t * data; - void * unaligned_data; /**< Unaligned address of `data`, used internally by lvgl */ - const lv_draw_buf_handlers_t * handlers; /**< draw buffer alloc/free ops. */ -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the draw buffer with the default handlers. - * - * @param handlers the draw buffer handlers to set - */ -void lv_draw_buf_init_with_default_handlers(lv_draw_buf_handlers_t * handlers); - -/** - * Initialize the draw buffer with given handlers. - * - * @param handlers the draw buffer handlers to set - * @param buf_malloc_cb the callback to allocate memory for the buffer - * @param buf_free_cb the callback to free memory of the buffer - * @param buf_copy_cb the callback to copy a draw buffer to an other - * @param align_pointer_cb the callback to align the buffer - * @param invalidate_cache_cb the callback to invalidate the cache of the buffer - * @param flush_cache_cb the callback to flush buffer - * @param width_to_stride_cb the callback to calculate the stride based on the width and color format - */ -void lv_draw_buf_handlers_init(lv_draw_buf_handlers_t * handlers, - lv_draw_buf_malloc_cb_t buf_malloc_cb, - lv_draw_buf_free_cb_t buf_free_cb, - lv_draw_buf_copy_cb_t buf_copy_cb, - lv_draw_buf_align_cb_t align_pointer_cb, - lv_draw_buf_cache_operation_cb_t invalidate_cache_cb, - lv_draw_buf_cache_operation_cb_t flush_cache_cb, - lv_draw_buf_width_to_stride_cb_t width_to_stride_cb); - -/** - * Get the struct which holds the callbacks for draw buf management. - * Custom callback can be set on the returned value - * @return pointer to the struct of handlers - */ -lv_draw_buf_handlers_t * lv_draw_buf_get_handlers(void); -lv_draw_buf_handlers_t * lv_draw_buf_get_font_handlers(void); -lv_draw_buf_handlers_t * lv_draw_buf_get_image_handlers(void); - - -/** - * Align the address of a buffer. The buffer needs to be large enough for the real data after alignment - * @param buf the data to align - * @param color_format the color format of the buffer - * @return the aligned buffer - */ -void * lv_draw_buf_align(void * buf, lv_color_format_t color_format); - -/** - * Align the address of a buffer with custom draw buffer handlers. - * The buffer needs to be large enough for the real data after alignment - * @param handlers the draw buffer handlers - * @param buf the data to align - * @param color_format the color format of the buffer - * @return the aligned buffer - */ -void * lv_draw_buf_align_ex(const lv_draw_buf_handlers_t * handlers, void * buf, lv_color_format_t color_format); - -/** - * Invalidate the cache of the buffer - * @param draw_buf the draw buffer needs to be invalidated - * @param area the area to invalidate in the buffer, - * use NULL to invalidate the whole draw buffer address range - */ -void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area); - -/** - * Flush the cache of the buffer - * @param draw_buf the draw buffer needs to be flushed - * @param area the area to flush in the buffer, - * use NULL to flush the whole draw buffer address range - */ -void lv_draw_buf_flush_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area); - -/** - * Calculate the stride in bytes based on a width and color format - * @param w the width in pixels - * @param color_format the color format - * @return the stride in bytes - */ -uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format); - -/** - * Calculate the stride in bytes based on a width and color format - * @param handlers the draw buffer handlers - * @param w the width in pixels - * @param color_format the color format - * @return the stride in bytes - */ -uint32_t lv_draw_buf_width_to_stride_ex(const lv_draw_buf_handlers_t * handlers, uint32_t w, - lv_color_format_t color_format); - -/** - * Clear an area on the buffer - * @param draw_buf pointer to draw buffer - * @param a the area to clear, or NULL to clear the whole buffer - */ -void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a); - - -/** - * Note: Eventually, lv_draw_buf_malloc/free will be kept as private. - * For now, we use `create` to distinguish with malloc. - * - * Create an draw buf by allocating struct for `lv_draw_buf_t` and allocating a buffer for it - * that meets specified requirements. - * - * @param w the buffer width in pixels - * @param h the buffer height in pixels - * @param cf the color format for image - * @param stride the stride in bytes for image. Use 0 for automatic calculation based on - * w, cf, and global stride alignment configuration. - */ -lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride); - -/** - * Note: Eventually, lv_draw_buf_malloc/free will be kept as private. - * For now, we use `create` to distinguish with malloc. - * - * Create an draw buf by allocating struct for `lv_draw_buf_t` and allocating a buffer for it - * that meets specified requirements. - * - * @param handlers the draw buffer handlers - * @param w the buffer width in pixels - * @param h the buffer height in pixels - * @param cf the color format for image - * @param stride the stride in bytes for image. Use 0 for automatic calculation based on - * w, cf, and global stride alignment configuration. - */ -lv_draw_buf_t * lv_draw_buf_create_ex(const lv_draw_buf_handlers_t * handlers, uint32_t w, uint32_t h, - lv_color_format_t cf, uint32_t stride); - -/** - * Duplicate a draw buf with same image size, stride and color format. Copy the image data too. - * @param draw_buf the draw buf to duplicate - * @return the duplicated draw buf on success, NULL if failed - */ -lv_draw_buf_t * lv_draw_buf_dup(const lv_draw_buf_t * draw_buf); - -/** - * Duplicate a draw buf with same image size, stride and color format. Copy the image data too. - * @param handlers the draw buffer handlers - * @param draw_buf the draw buf to duplicate - * @return the duplicated draw buf on success, NULL if failed - */ -lv_draw_buf_t * lv_draw_buf_dup_ex(const lv_draw_buf_handlers_t * handlers, const lv_draw_buf_t * draw_buf); - -/** - * Initialize a draw buf with the given buffer and parameters. Clear draw buffer flag to zero. - * @param draw_buf the draw buf to initialize - * @param w the buffer width in pixels - * @param h the buffer height in pixels - * @param cf the color format - * @param stride the stride in bytes. Use 0 for automatic calculation - * @param data the buffer used for drawing. Unaligned `data` will be aligned internally - * @param data_size the size of the buffer in bytes - * @return return LV_RESULT_OK on success, LV_RESULT_INVALID otherwise - */ -lv_result_t lv_draw_buf_init(lv_draw_buf_t * draw_buf, uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride, - void * data, uint32_t data_size); - -/** - * Keep using the existing memory, reshape the draw buffer to the given width and height. - * Return NULL if data_size is smaller than the required size. - * @param draw_buf pointer to a draw buffer - * @param cf the new color format, use 0 or LV_COLOR_FORMAT_UNKNOWN to keep using the original color format. - * @param w the new width in pixels - * @param h the new height in pixels - * @param stride the stride in bytes for image. Use 0 for automatic calculation. - */ -lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t cf, uint32_t w, uint32_t h, - uint32_t stride); - -/** - * Destroy a draw buf by freeing the actual buffer if it's marked as LV_IMAGE_FLAGS_ALLOCATED in header. - * Then free the lv_draw_buf_t struct. - * - * @param draw_buf the draw buffer to destroy - */ -void lv_draw_buf_destroy(lv_draw_buf_t * draw_buf); - -/** - * Copy an area from a buffer to another - * @param dest pointer to the destination draw buffer - * @param dest_area the area to copy from the destination buffer, if NULL, use the whole buffer - * @param src pointer to the source draw buffer - * @param src_area the area to copy from the destination buffer, if NULL, use the whole buffer - * @note `dest_area` and `src_area` should have the same width and height - * @note The default copy function required `dest` and `src` to have the same color format. - * Overwriting dest->handlers->buf_copy_cb can resolve this limitation. - */ -void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area, - const lv_draw_buf_t * src, const lv_area_t * src_area); - -/** - * Return pointer to the buffer at the given coordinates - */ -void * lv_draw_buf_goto_xy(const lv_draw_buf_t * buf, uint32_t x, uint32_t y); - -/** - * Adjust the stride of a draw buf in place. - * @param src pointer to a draw buffer - * @param stride the new stride in bytes for image. Use LV_STRIDE_AUTO for automatic calculation. - * @return LV_RESULT_OK: success or LV_RESULT_INVALID: failed - */ -lv_result_t lv_draw_buf_adjust_stride(lv_draw_buf_t * src, uint32_t stride); - -/** - * Premultiply draw buffer color with alpha channel. - * If it's already premultiplied, return directly. - * Only color formats with alpha channel will be processed. - * - * @return LV_RESULT_OK: premultiply success - */ -lv_result_t lv_draw_buf_premultiply(lv_draw_buf_t * draw_buf); - - -/** - * Check if a draw buffer has a given flag. - * @param draw_buf pointer to a draw buffer - * @param flag the flag to check - * @return true: the flag is set, false: the flag is not set - */ -static inline bool lv_draw_buf_has_flag(const lv_draw_buf_t * draw_buf, lv_image_flags_t flag) -{ - return draw_buf->header.flags & flag; -} - -/** - * Set a flag to a draw buffer. - * @param draw_buf pointer to a draw buffer - * @param flag the flag to set - */ -static inline void lv_draw_buf_set_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) -{ - draw_buf->header.flags |= flag; -} - -/** - * Clear a flag from a draw buffer. - * @param draw_buf pointer to a draw buffer - * @param flag the flag to clear - */ -static inline void lv_draw_buf_clear_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) -{ - draw_buf->header.flags &= ~flag; -} - -/** - * As of now, draw buf share same definition as `lv_image_dsc_t`. - * And is interchangeable with `lv_image_dsc_t`. - */ - -lv_result_t lv_draw_buf_from_image(lv_draw_buf_t * buf, const lv_image_dsc_t * img); - -void lv_draw_buf_to_image(const lv_draw_buf_t * buf, lv_image_dsc_t * img); - -/** - * Set the palette color of an indexed image. Valid only for `LV_COLOR_FORMAT_I1/2/4/8` - * @param draw_buf pointer to an image descriptor - * @param index the palette color to set: - * - for `LV_COLOR_FORMAT_I1`: 0..1 - * - for `LV_COLOR_FORMAT_I2`: 0..3 - * - for `LV_COLOR_FORMAT_I4`: 0..15 - * - for `LV_COLOR_FORMAT_I8`: 0..255 - * @param color the color to set in lv_color32_t format - */ -void lv_draw_buf_set_palette(lv_draw_buf_t * draw_buf, uint8_t index, lv_color32_t color); - -/** - * @deprecated Use lv_draw_buf_set_palette instead. - */ -void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c); - -/** - * @deprecated Use lv_draw_buffer_create/destroy instead. - * Free the data pointer and dsc struct of an image. - */ -void lv_image_buf_free(lv_image_dsc_t * dsc); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_BUF_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_buf_private.h b/src/draw/lv_draw_buf_private.h index 9245cab1d5..c19386f7b0 100644 --- a/src/draw/lv_draw_buf_private.h +++ b/src/draw/lv_draw_buf_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_draw_buf.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_image.c b/src/draw/lv_draw_image.c index e5f33d4ac3..dc21558692 100644 --- a/src/draw/lv_draw_image.c +++ b/src/draw/lv_draw_image.c @@ -6,17 +6,12 @@ /********************* * INCLUDES *********************/ + #include "lv_draw_image_private.h" #include "../misc/lv_area_private.h" #include "lv_image_decoder_private.h" #include "lv_draw_private.h" -#include "../display/lv_display.h" -#include "../misc/lv_log.h" -#include "../misc/lv_math.h" -#include "../core/lv_refr.h" #include "../core/lv_obj_private.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_image.h b/src/draw/lv_draw_image.h index 1f58f7e384..80f1e54d98 100644 --- a/src/draw/lv_draw_image.h +++ b/src/draw/lv_draw_image.h @@ -1,167 +1,2 @@ -/** - * @file lv_draw_image.h - * - */ - -#ifndef LV_DRAW_IMAGE_H -#define LV_DRAW_IMAGE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_draw.h" -#include "lv_image_decoder.h" -#include "lv_draw_buf.h" -#include "../misc/lv_style.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * MACROS - **********************/ - -struct _lv_draw_image_dsc_t { - lv_draw_dsc_base_t base; - - /**The image source: pointer to `lv_image_dsc_t` or a path to a file*/ - const void * src; - - /**The header of the image. Initialized internally in `lv_draw_image` */ - lv_image_header_t header; - - /**Clip the corner of the image with this radius. Use `LV_RADIUS_CIRCLE` for max. radius */ - int32_t clip_radius; - - /**The rotation of the image in 0.1 degree unit. E.g. 234 means 23.4° */ - int32_t rotation; - - /**Horizontal scale (zoom) of the image. - * 256 (LV_SCALE_NONE): means no zoom, 512 double size, 128 half size.*/ - int32_t scale_x; - - /**Same as `scale_y` but vertically*/ - int32_t scale_y; - - /**Parallelogram like transformation of the image horizontally in 0.1 degree unit. E.g. 456 means 45.6°.*/ - int32_t skew_x; - - /**Same as `skew_x` but vertically*/ - int32_t skew_y; - - /**The pivot point of transformation (scale and rotation). - * 0;0 is the top left corner of the image. Can be outside of the image too.*/ - lv_point_t pivot; - - /**Mix this color to the images. In case of `LV_COLOR_FORMAT_A8` it will be the color of the visible pixels*/ - lv_color_t recolor; - - /**The intensity of recoloring. 0 means, no recolor, 255 means full cover (transparent pixels remain transparent)*/ - lv_opa_t recolor_opa; - - /**Opacity in 0...255 range. - * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ - lv_opa_t opa; - - /**Describes how to blend the pixels of the image to the background. - * See `lv_blend_mode_t` for more details. - */ - lv_blend_mode_t blend_mode : 4; - - /**1: perform the transformation with anti-aliasing */ - uint16_t antialias : 1; - - /**If the image is smaller than the `image_area` field of `lv_draw_image_dsc_t` - * tile the image (repeat is both horizontally and vertically) to fill the - * `image_area` area*/ - uint16_t tile : 1; - - const lv_image_colorkey_t * colorkey; - - /**Used internally to store some information about the palette or the color of A8 images*/ - lv_draw_image_sup_t * sup; - - /** Used to indicate the entire original, non-clipped area where the image is to be drawn. - * This is important for: - * 1. Layer rendering, where it might happen that only a smaller area of the layer is rendered and e.g. - * `clip_radius` needs to know what the original image was. - * 2. Tiled images, where the target draw area is larger than the image to be tiled. - */ - lv_area_t image_area; - - /**Pointer to an A8 or L8 image descriptor to mask the image with. - * The mask is always center aligned. */ - const lv_image_dsc_t * bitmap_mask_src; -}; - -/** - * PErform the actual rendering of a decoded image - * @param t pointer to a draw task - * @param draw_dsc the draw descriptor of the image - * @param decoder_dsc pointer to the decoded image's descriptor - * @param sup supplementary data - * @param img_coords the absolute coordinates of the image - * @param clipped_img_area the absolute clip coordinates - */ -typedef void (*lv_draw_image_core_cb)(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_dsc, - const lv_image_decoder_dsc_t * decoder_dsc, lv_draw_image_sup_t * sup, - const lv_area_t * img_coords, const lv_area_t * clipped_img_area); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize an image draw descriptor. - * @param dsc pointer to a draw descriptor - */ -void lv_draw_image_dsc_init(lv_draw_image_dsc_t * dsc); - -/** - * Try to get an image draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_IMAGE - */ -lv_draw_image_dsc_t * lv_draw_task_get_image_dsc(lv_draw_task_t * task); - -/** - * Create an image draw task - * @param layer pointer to a layer - * @param dsc pointer to an initialized draw descriptor - * @param coords the coordinates of the image - * @note `coords` can be small than the real image area - * (if only a part of the image is rendered) - * or can be larger (in case of tiled images). . - */ -void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords); - -/** - * Create a draw task to blend a layer to another layer - * @param layer pointer to a layer - * @param dsc pointer to an initialized draw descriptor. `src` must be set to the layer to blend - * @param coords the coordinates of the layer. - * @note `coords` can be small than the total widget area from which the layer is created - * (if only a part of the widget was rendered to a layer) - */ -void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords); - -/** - * Get the type of an image source - * @param src pointer to an image source: - * - pointer to an 'lv_image_t' variable (image stored internally and compiled into the code) - * - a path to a file (e.g. "S:/folder/image.bin") - * - or a symbol (e.g. LV_SYMBOL_CLOSE) - * @return type of the image source LV_IMAGE_SRC_VARIABLE/FILE/SYMBOL/UNKNOWN - */ -lv_image_src_t lv_image_src_get_type(const void * src); - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_IMAGE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_image_private.h b/src/draw/lv_draw_image_private.h index 694c5c1ab6..bbd6f167ea 100644 --- a/src/draw/lv_draw_image_private.h +++ b/src/draw/lv_draw_image_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_draw_image.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_label.c b/src/draw/lv_draw_label.c index 5276eb7ee8..e91a0d68f6 100644 --- a/src/draw/lv_draw_label.c +++ b/src/draw/lv_draw_label.c @@ -6,19 +6,13 @@ /********************* * INCLUDES *********************/ + #include "lv_draw_label_private.h" #include "lv_draw_private.h" #include "../misc/lv_area_private.h" #include "lv_draw_vector_private.h" -#include "lv_draw_rect_private.h" -#include "../core/lv_obj.h" -#include "../misc/lv_math.h" -#include "../core/lv_obj_event.h" #include "../misc/lv_bidi_private.h" #include "../misc/lv_text_private.h" -#include "../misc/lv_assert.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" #include "../core/lv_global.h" /********************* diff --git a/src/draw/lv_draw_label.h b/src/draw/lv_draw_label.h index 7d5f4786c9..ddd78ae371 100644 --- a/src/draw/lv_draw_label.h +++ b/src/draw/lv_draw_label.h @@ -1,252 +1,2 @@ -/** - * @file lv_draw_label.h - * - */ - -#ifndef LV_DRAW_LABEL_H -#define LV_DRAW_LABEL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_draw.h" -#include "lv_draw_rect.h" -#include "../misc/lv_bidi.h" -#include "../misc/lv_text.h" -#include "../misc/lv_color.h" -#include "../misc/lv_style.h" - -/********************* - * DEFINES - *********************/ -#define LV_DRAW_LABEL_NO_TXT_SEL (0xFFFF) - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_draw_dsc_base_t base; - - /**The text to draw*/ - const char * text; - - /**The size of the text*/ - lv_point_t text_size; - - /**The font to use. Fallback fonts are also handled.*/ - const lv_font_t * font; - - /**Color of the text*/ - lv_color_t color; - - /**Extra space between the lines*/ - int32_t line_space; - - /**Extra space between the characters*/ - int32_t letter_space; - - /**Offset the text with this value horizontally*/ - int32_t ofs_x; - - /**Offset the text with this value vertically*/ - int32_t ofs_y; - - /**Rotation of the letters in 0.1 degree unit*/ - int32_t rotation; - - /**The first characters index for selection (not byte index). `LV_DRAW_LABEL_NO_TXT_SEL` for no selection*/ - uint32_t sel_start; - - /**The last characters's index for selection (not byte index). `LV_DRAW_LABEL_NO_TXT_SEL` for no selection*/ - uint32_t sel_end; - - /**Color of the selected characters*/ - lv_color_t sel_color; - - /**Background color of the selected characters*/ - lv_color_t sel_bg_color; - - /**The number of characters to render. 0: means render until reaching the `\0` termination.*/ - uint32_t text_length; - - /**The alignment of the text `LV_TEXT_ALIGN_LEFT/RIGHT/CENTER`*/ - lv_text_align_t align; - - /**The base direction. Used when type setting Right-to-left (e.g. Arabic) texts*/ - lv_base_dir_t bidi_dir; - - /**Opacity of the text in 0...255 range. - * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ - lv_opa_t opa; - - /**Letter outline stroke opacity */ - lv_opa_t outline_stroke_opa; - - /**Text decoration, e.g. underline*/ - lv_text_decor_t decor : 3; - - /**Some flags to control type setting*/ - lv_text_flag_t flag : 5; - - /**1: malloc a buffer and copy `text` there. - * 0: `text` will be valid during rendering.*/ - uint8_t text_local : 1; - - /**Indicate that the text is constant and its pointer can be safely saved e.g. in a cache.*/ - uint8_t text_static : 1; - - /**1: already executed lv_bidi_process_paragraph. - * 0: has not been executed lv_bidi_process_paragraph.*/ - uint8_t has_bided : 1; - - /**Pointer to an externally stored struct where some data can be cached to speed up rendering*/ - lv_draw_label_hint_t * hint; - - /* Properties of the letter outlines */ - lv_color_t outline_stroke_color; - int32_t outline_stroke_width; - -} lv_draw_label_dsc_t; - -typedef struct { - lv_draw_dsc_base_t base; - - uint32_t unicode; - const lv_font_t * font; - lv_color_t color; - - int32_t rotation; - int32_t scale_x; - int32_t scale_y; - int32_t skew_x; - int32_t skew_y; - lv_point_t pivot; - - lv_opa_t opa; - lv_text_decor_t decor : 3; - lv_blend_mode_t blend_mode : 4; - - /* Properties of the letter outlines */ - lv_opa_t outline_stroke_opa; - int32_t outline_stroke_width; - lv_color_t outline_stroke_color; - -} lv_draw_letter_dsc_t; - -/** - * Passed as a parameter to `lv_draw_label_iterate_characters` to - * draw the characters one by one - * @param t pointer to a draw task - * @param dsc pointer to `lv_draw_glyph_dsc_t` to describe the character to draw - * if NULL don't draw character - * @param fill_dsc pointer to a fill descriptor to draw a background for the character or - * underline or strike through - * if NULL do not fill anything - * @param fill_area the area to fill - * if NULL do not fill anything - */ -typedef void(*lv_draw_glyph_cb_t)(lv_draw_task_t * t, lv_draw_glyph_dsc_t * dsc, lv_draw_fill_dsc_t * fill_dsc, - const lv_area_t * fill_area); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_letter_dsc_init(lv_draw_letter_dsc_t * dsc); - -/** - * Initialize a label draw descriptor - * @param dsc pointer to a draw descriptor - */ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc); - -/** - * Try to get a label draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_LABEL - */ -lv_draw_label_dsc_t * lv_draw_task_get_label_dsc(lv_draw_task_t * task); - -/** - * Initialize a glyph draw descriptor. - * Used internally. - * @param dsc pointer to a draw descriptor - */ -void lv_draw_glyph_dsc_init(lv_draw_glyph_dsc_t * dsc); - -/** - * Create a draw task to render a text - * @param layer pointer to a layer - * @param dsc pointer to draw descriptor - * @param coords coordinates of the character - */ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_label(lv_layer_t * layer, const lv_draw_label_dsc_t * dsc, - const lv_area_t * coords); - -/** - * Create a draw task to render a single character - * @param layer pointer to a layer - * @param dsc pointer to draw descriptor - * @param point position of the label - * @param unicode_letter the letter to draw - */ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_character(lv_layer_t * layer, lv_draw_label_dsc_t * dsc, - const lv_point_t * point, uint32_t unicode_letter); - -/** - * Draw a single letter - * @param layer pointer to a layer - * @param dsc pointer to draw descriptor - * @param point position of the label - */ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_letter(lv_layer_t * layer, lv_draw_letter_dsc_t * dsc, - const lv_point_t * point); - -/** - * Should be used during rendering the characters to get the position and other - * parameters of the characters - * @param t pointer to a draw task - * @param dsc pointer to draw descriptor - * @param coords coordinates of the label - * @param cb a callback to call to draw each glyphs one by one - */ -void lv_draw_label_iterate_characters(lv_draw_task_t * t, const lv_draw_label_dsc_t * dsc, - const lv_area_t * coords, lv_draw_glyph_cb_t cb); - -/** - * @brief Draw a single letter using the provided draw unit, glyph descriptor, position, font, and callback. - * - * This function is responsible for rendering a single character from a text string, - * applying the necessary styling described by the glyph descriptor (`dsc`). It handles - * the retrieval of the glyph's description, checks its visibility within the clipping area, - * and invokes the callback (`cb`) to render the glyph at the specified position (`pos`) - * using the given font (`font`). - * - * @param t Pointer to the drawing task. - * @param dsc Pointer to the descriptor containing styling for the glyph to be drawn. - * @param pos Pointer to the point coordinates where the letter should be drawn. - * @param font Pointer to the font containing the glyph. - * @param letter The Unicode code point of the letter to be drawn. - * @param cb Callback function to execute the actual rendering of the glyph. - */ -void lv_draw_unit_draw_letter(lv_draw_task_t * t, lv_draw_glyph_dsc_t * dsc, const lv_point_t * pos, - const lv_font_t * font, uint32_t letter, lv_draw_glyph_cb_t cb); - -/*********************** - * GLOBAL VARIABLES - ***********************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_LABEL_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_label_private.h b/src/draw/lv_draw_label_private.h index 0ec17817a6..33196a5fe1 100644 --- a/src/draw/lv_draw_label_private.h +++ b/src/draw/lv_draw_label_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_draw_label.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_line.c b/src/draw/lv_draw_line.c index ed11728d2d..a2f95fbd7d 100644 --- a/src/draw/lv_draw_line.c +++ b/src/draw/lv_draw_line.c @@ -6,11 +6,8 @@ /********************* * INCLUDES *********************/ + #include "lv_draw_private.h" -#include "../core/lv_refr.h" -#include "../misc/lv_math.h" -#include "../misc/lv_types.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_line.h b/src/draw/lv_draw_line.h index fe70bad462..fdd54ed527 100644 --- a/src/draw/lv_draw_line.h +++ b/src/draw/lv_draw_line.h @@ -1,123 +1,2 @@ -/** - * @file lv_draw_line.h - * - */ - -#ifndef LV_DRAW_LINE_H -#define LV_DRAW_LINE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" -#include "../misc/lv_style.h" - -/********************* - * DEFINES - *********************/ -#if LV_USE_FLOAT -#include -#define LV_DRAW_LINE_POINT_NONE FLT_MAX -#else -#define LV_DRAW_LINE_POINT_NONE INT32_MAX -#endif - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_draw_dsc_base_t base; - - /**The first point of the line. If `LV_USE_FLOAT` is enabled float number can be also used. - *Ignored if `points` are set*/ - lv_point_precise_t p1; - - /**The second point of the line. If `LV_USE_FLOAT` is enabled float number can be also used - * Ignored if `points` are set*/ - lv_point_precise_t p2; - - /**Array of points to draw. If `LV_USE_FLOAT` is enabled, float numbers can also be used.*/ - lv_point_precise_t * points; - - /** - * Number of points in the `points` - */ - int32_t point_cnt; - - /**The color of the line*/ - lv_color_t color; - - /**The width (thickness) of the line*/ - int32_t width; - - /** The length of a dash (0: don't dash)*/ - int32_t dash_width; - - /** The length of the gaps between dashes (0: don't dash)*/ - int32_t dash_gap; - - /**Opacity of the line in 0...255 range. - * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ - lv_opa_t opa; - - /**Make the line start rounded*/ - uint8_t round_start : 1; - - /**Make the line end rounded*/ - uint8_t round_end : 1; - - /**1: Do not bother with line ending (if it's not visible for any reason) */ - uint8_t raw_end : 1; -} lv_draw_line_dsc_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a line draw descriptor - * @param dsc pointer to a draw descriptor - */ -void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc); - -/** - * Try to get a line draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_LINE - */ -lv_draw_line_dsc_t * lv_draw_task_get_line_dsc(lv_draw_task_t * task); - -/** - * Create a line draw task - * @param layer pointer to a layer - * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable - */ -void lv_draw_line(lv_layer_t * layer, const lv_draw_line_dsc_t * dsc); - -/** - * A helper function to call a callback which draws a line between two points. - * This way it doesn't matter if ``p1, p2`` or ``points`` were used as it calls the - * ``callback`` as needed. - * @param t draw task - * @param dsc pointer to a draw descriptor - * @param draw_line_cb a callback that draws a line between ``dsc->p1`` and ``dsc->p2`` - */ -void lv_draw_line_iterate(lv_draw_task_t * t, lv_draw_line_dsc_t * dsc, - void (*draw_line_cb)(lv_draw_task_t * t, const lv_draw_line_dsc_t * dsc)); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_LINE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_mask.c b/src/draw/lv_draw_mask.c index 42d8a73b93..0779412865 100644 --- a/src/draw/lv_draw_mask.c +++ b/src/draw/lv_draw_mask.c @@ -6,12 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_draw_mask.h" + #include "lv_draw_private.h" -#include "../core/lv_refr.h" -#include "../misc/lv_math.h" -#include "../misc/lv_types.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_mask.h b/src/draw/lv_draw_mask.h index ae0b349842..bd86a0e744 100644 --- a/src/draw/lv_draw_mask.h +++ b/src/draw/lv_draw_mask.h @@ -1,75 +1,2 @@ -/** - * @file lv_draw_mask.h - * - */ - -#ifndef LV_DRAW_MASK_H -#define LV_DRAW_MASK_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_draw.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" -#include "../misc/lv_style.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -struct _lv_draw_mask_rect_dsc_t { - lv_draw_dsc_base_t base; - - /**The area to mask.*/ - lv_area_t area; - - /**The radius of masking*/ - int32_t radius; - - /**0: clear the content out of the `area`. - * 1: don't touch the area out of `area`*/ - uint32_t keep_outside : 1; -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a rectangle mask draw descriptor. - * @param dsc pointer to a draw descriptor - */ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_rect_dsc_init(lv_draw_mask_rect_dsc_t * dsc); - -/** - * Try to get a rectangle mask draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_MASK_RECTANGLE - */ -lv_draw_mask_rect_dsc_t * lv_draw_task_get_mask_rect_dsc(lv_draw_task_t * task); - -/** - * Create a draw task to mask a rectangle from the buffer - * @param layer pointer to a layer - * @param dsc pointer to a draw descriptor - */ -void lv_draw_mask_rect(lv_layer_t * layer, const lv_draw_mask_rect_dsc_t * dsc); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_MASK_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_private.h b/src/draw/lv_draw_private.h index 682f8b4781..46057bd8a9 100644 --- a/src/draw/lv_draw_private.h +++ b/src/draw/lv_draw_private.h @@ -18,9 +18,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_draw.h" +#include "../lv_public_api.h" #include "../osal/lv_os_private.h" #include "../misc/cache/lv_cache.h" +#include "../misc/cache/lv_cache_entry.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_rect.c b/src/draw/lv_draw_rect.c index a466a676d8..12ff0b2d39 100644 --- a/src/draw/lv_draw_rect.c +++ b/src/draw/lv_draw_rect.c @@ -6,13 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_draw_rect_private.h" + #include "lv_draw_private.h" -#include "../core/lv_obj.h" -#include "../misc/lv_assert.h" #include "../misc/lv_text_private.h" -#include "../core/lv_obj_event.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_rect.h b/src/draw/lv_draw_rect.h index 9c870d1b88..84bebe8071 100644 --- a/src/draw/lv_draw_rect.h +++ b/src/draw/lv_draw_rect.h @@ -1,239 +1,2 @@ -/** - * @file lv_draw_rect.h - * - */ - -#ifndef LV_DRAW_RECT_H -#define LV_DRAW_RECT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_draw.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" -#include "../misc/lv_style.h" - -/********************* - * DEFINES - *********************/ -#define LV_RADIUS_CIRCLE 0x7FFF /**< A very big radius to always draw as circle*/ -LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE); - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_draw_dsc_base_t base; - - int32_t radius; - - /*Background img*/ - const void * bg_image_src; - const void * bg_image_symbol_font; - lv_color_t bg_image_recolor; - lv_opa_t bg_image_opa; - lv_opa_t bg_image_recolor_opa; - uint8_t bg_image_tiled; - /*Background*/ - lv_opa_t bg_opa; - /*Border*/ - lv_opa_t border_opa; - /*Outline */ - lv_opa_t outline_opa; - /*Shadow*/ - lv_opa_t shadow_opa; - - /*Background*/ - lv_color_t bg_color; /**< First element of a gradient is a color, so it maps well here*/ - lv_grad_dsc_t bg_grad; - - const lv_image_colorkey_t * bg_image_colorkey; - - /*Border*/ - lv_color_t border_color; - int32_t border_width; - lv_border_side_t border_side : 5; - uint8_t border_post : 1; /*The border will be drawn later*/ - - /*Outline*/ - lv_color_t outline_color; - int32_t outline_width; - int32_t outline_pad; - - /*Shadow*/ - lv_color_t shadow_color; - int32_t shadow_width; - int32_t shadow_offset_x; - int32_t shadow_offset_y; - int32_t shadow_spread; -} lv_draw_rect_dsc_t; - -typedef struct { - lv_draw_dsc_base_t base; - - /**Radius, LV_RADIUS_CIRCLE for max. radius */ - int32_t radius; - - /**Opacity in 0...255 range. - * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ - lv_opa_t opa; - - /**The color of the rectangle. - * If the gradient is set (grad.dir!=LV_GRAD_DIR_NONE) it's ignored. */ - lv_color_t color; - - /**Describe a gradient. If `grad.dir` is not `LV_GRAD_DIR_NONE` `color` will be ignored*/ - lv_grad_dsc_t grad; -} lv_draw_fill_dsc_t; - -typedef struct { - lv_draw_dsc_base_t base; - - /**Radius, LV_RADIUS_CIRCLE for max. radius */ - int32_t radius; - - /**The color of the border. */ - lv_color_t color; - - - /**The width of the border in pixels */ - int32_t width; - - /**Opacity in 0...255 range. - * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ - lv_opa_t opa; - - /**LV_BORDER_SIDE_NONE/LEFT/RIGHT/TOP/BOTTOM/FULL. - * LV_BORDER_SIDE_INTERNAL is an information for upper layers - * and shouldn't be used here. */ - lv_border_side_t side : 5; - -} lv_draw_border_dsc_t; - -typedef struct { - lv_draw_dsc_base_t base; - - /**Radius, LV_RADIUS_CIRCLE for max. radius */ - int32_t radius; - - /**Color of shadow */ - lv_color_t color; - - /**Width of the shadow. (radius of the blur)*/ - int32_t width; - - /**Make the rectangle larger with this value in all directions. Can be negative too. */ - int32_t spread; - - /**Offset the rectangle horizontally.*/ - int32_t ofs_x; - - /**Offset the rectangle vertically.*/ - int32_t ofs_y; - - /**Opacity in 0...255 range. - * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ - lv_opa_t opa; - - /**Set `bg_cover` to 1 if the background will cover the shadow. - * It's a hint to the renderer about it might skip some masking.*/ - uint8_t bg_cover : 1; -} lv_draw_box_shadow_dsc_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a rectangle draw descriptor. - * @param dsc pointer to a draw descriptor - */ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc); - -/** - * Initialize a fill draw descriptor. - * @param dsc pointer to a draw descriptor - */ -void lv_draw_fill_dsc_init(lv_draw_fill_dsc_t * dsc); - -/** - * Try to get a fill draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_FILL - */ -lv_draw_fill_dsc_t * lv_draw_task_get_fill_dsc(lv_draw_task_t * task); - -/** - * Fill an area - * @param layer pointer to a layer - * @param dsc pointer to an initialized draw descriptor variable - * @param coords the coordinates of the rectangle - */ -void lv_draw_fill(lv_layer_t * layer, const lv_draw_fill_dsc_t * dsc, const lv_area_t * coords); - -/** - * Initialize a border draw descriptor. - * @param dsc pointer to a draw descriptor - */ -void lv_draw_border_dsc_init(lv_draw_border_dsc_t * dsc); - -/** - * Try to get a border draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_BORDER - */ -lv_draw_border_dsc_t * lv_draw_task_get_border_dsc(lv_draw_task_t * task); - -/** - * Draw a border - * @param layer pointer to a layer - * @param dsc pointer to an initialized draw descriptor variable - * @param coords the coordinates of the rectangle - */ -void lv_draw_border(lv_layer_t * layer, const lv_draw_border_dsc_t * dsc, const lv_area_t * coords); - -/** - * Initialize a box shadow draw descriptor. - * @param dsc pointer to a draw descriptor - */ -void lv_draw_box_shadow_dsc_init(lv_draw_box_shadow_dsc_t * dsc); - -/** - * Try to get a box shadow draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_BOX_SHADOW - */ -lv_draw_box_shadow_dsc_t * lv_draw_task_get_box_shadow_dsc(lv_draw_task_t * task); - -/** - * Draw a box shadow - * @param layer pointer to a layer - * @param dsc pointer to an initialized draw descriptor variable - * @param coords the coordinates of the rectangle - */ -void lv_draw_box_shadow(lv_layer_t * layer, const lv_draw_box_shadow_dsc_t * dsc, const lv_area_t * coords); - -/** - * The rectangle is a wrapper for fill, border, bg. image and box shadow. - * Internally fill, border, image and box shadow draw tasks will be created. - * @param layer pointer to a layer - * @param dsc pointer to an initialized draw descriptor variable - * @param coords the coordinates of the rectangle - */ -void lv_draw_rect(lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_RECT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_triangle.c b/src/draw/lv_draw_triangle.c index add272fa78..9fc8704a38 100644 --- a/src/draw/lv_draw_triangle.c +++ b/src/draw/lv_draw_triangle.c @@ -7,12 +7,7 @@ * INCLUDES *********************/ -#include "lv_draw_triangle_private.h" #include "lv_draw_private.h" -#include "../core/lv_obj.h" -#include "../misc/lv_math.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/lv_draw_triangle.h b/src/draw/lv_draw_triangle.h index db53d4795e..973b6ec935 100644 --- a/src/draw/lv_draw_triangle.h +++ b/src/draw/lv_draw_triangle.h @@ -1,75 +1,2 @@ -/** - * @file lv_draw_triangle.h - * - */ - -#ifndef LV_DRAW_TRIANGLE_H -#define LV_DRAW_TRIANGLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_draw_rect.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef struct { - lv_draw_dsc_base_t base; - - /**Points of the triangle. If `LV_USE_FLOAT` is enabled floats can be used here*/ - lv_point_precise_t p[3]; - - /**Color of the triangle*/ - lv_color_t color; - - /**Opacity of the arc in 0...255 range. - * LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well*/ - lv_opa_t opa; - - /**Describe a gradient. If `grad.dir` is not `LV_GRAD_DIR_NONE` `color` will be ignored*/ - lv_grad_dsc_t grad; - -} lv_draw_triangle_dsc_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a triangle draw descriptor - * @param draw_dsc pointer to a draw descriptor - */ -void lv_draw_triangle_dsc_init(lv_draw_triangle_dsc_t * draw_dsc); - -/** - * Try to get a triangle draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_TRIANGLE - */ -lv_draw_triangle_dsc_t * lv_draw_task_get_triangle_dsc(lv_draw_task_t * task); - -/** - * Create a triangle draw task - * @param layer pointer to a layer - * @param draw_dsc pointer to an initialized `lv_draw_triangle_dsc_t` object - */ -void lv_draw_triangle(lv_layer_t * layer, const lv_draw_triangle_dsc_t * draw_dsc); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_TRIANGLE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_vector.c b/src/draw/lv_draw_vector.c index dfcd13a1a4..e1a5ccb3ae 100644 --- a/src/draw/lv_draw_vector.c +++ b/src/draw/lv_draw_vector.c @@ -16,9 +16,6 @@ #error "LV_USE_VECTOR_GRAPHIC requires (LV_USE_DRAW_SW and LV_USE_THORVG) or LV_USE_DRAW_VG_LITE or (LV_USE_NEMA_GFX and LV_USE_NEMA_VG) or LV_USE_DRAW_NANOVG" #endif -#include "../misc/lv_ll.h" -#include "../misc/lv_types.h" -#include "../stdlib/lv_string.h" #include #include diff --git a/src/draw/lv_draw_vector.h b/src/draw/lv_draw_vector.h index 1d5c12f434..e43843ac19 100644 --- a/src/draw/lv_draw_vector.h +++ b/src/draw/lv_draw_vector.h @@ -1,572 +1,2 @@ -/** - * @file lv_draw_vector.h - * - */ - -#ifndef LV_DRAW_VECTOR_H -#define LV_DRAW_VECTOR_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_array.h" -#include "../misc/lv_matrix.h" -#include "lv_draw_image.h" - -#if LV_USE_VECTOR_GRAPHIC - -#if !LV_USE_MATRIX -#error "lv_draw_vector needs LV_USE_MATRIX = 1" -#endif - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_VECTOR_FILL_NONZERO = 0, - LV_VECTOR_FILL_EVENODD, -} lv_vector_fill_t; - -typedef enum { - LV_VECTOR_STROKE_CAP_BUTT = 0, - LV_VECTOR_STROKE_CAP_SQUARE, - LV_VECTOR_STROKE_CAP_ROUND, -} lv_vector_stroke_cap_t; - -typedef enum { - LV_VECTOR_STROKE_JOIN_MITER = 0, - LV_VECTOR_STROKE_JOIN_BEVEL, - LV_VECTOR_STROKE_JOIN_ROUND, -} lv_vector_stroke_join_t; - -typedef enum { - LV_VECTOR_PATH_QUALITY_MEDIUM = 0, /* default*/ - LV_VECTOR_PATH_QUALITY_HIGH, - LV_VECTOR_PATH_QUALITY_LOW, -} lv_vector_path_quality_t; - -typedef enum { - LV_VECTOR_BLEND_SRC_OVER = 0, - LV_VECTOR_BLEND_SRC_IN, - LV_VECTOR_BLEND_DST_OVER, - LV_VECTOR_BLEND_DST_IN, - LV_VECTOR_BLEND_SCREEN, - LV_VECTOR_BLEND_MULTIPLY, - LV_VECTOR_BLEND_NONE, - LV_VECTOR_BLEND_ADDITIVE, - LV_VECTOR_BLEND_SUBTRACTIVE, -} lv_vector_blend_t; - -typedef enum { - LV_VECTOR_PATH_OP_MOVE_TO = 0, - LV_VECTOR_PATH_OP_LINE_TO, - LV_VECTOR_PATH_OP_QUAD_TO, - LV_VECTOR_PATH_OP_CUBIC_TO, - LV_VECTOR_PATH_OP_CLOSE, -} lv_vector_path_op_t; - -typedef enum { - LV_VECTOR_DRAW_STYLE_SOLID = 0, - LV_VECTOR_DRAW_STYLE_PATTERN, - LV_VECTOR_DRAW_STYLE_GRADIENT, -} lv_vector_draw_style_t; - -typedef enum { - LV_VECTOR_GRADIENT_SPREAD_PAD = 0, - LV_VECTOR_GRADIENT_SPREAD_REPEAT, - LV_VECTOR_GRADIENT_SPREAD_REFLECT, -} lv_vector_gradient_spread_t; - -typedef enum { - LV_VECTOR_GRADIENT_STYLE_LINEAR = 0, - LV_VECTOR_GRADIENT_STYLE_RADIAL, -} lv_vector_gradient_style_t; - -typedef enum { - LV_VECTOR_FILL_UNITS_OBJECT_BOUNDING_BOX = 0, /** Relative coordinates relative to the object bounding box. */ - LV_VECTOR_FILL_UNITS_USER_SPACE_ON_USE, /** Absolute coordinates relative to the layer's coordinate system */ -} lv_vector_fill_units_t; - -struct _lv_fpoint_t { - float x; - float y; -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Transform the coordinates of a point using given matrix - * @param matrix pointer to a matrix - * @param point pointer to a point - */ -void lv_matrix_transform_point(const lv_matrix_t * matrix, lv_fpoint_t * point); - -/** - * Transform all the coordinates of a path using given matrix - * @param matrix pointer to a matrix - * @param path pointer to a path - */ -void lv_matrix_transform_path(const lv_matrix_t * matrix, lv_vector_path_t * path); - -/** - * Create a vector graphic path object - * @param quality the quality hint of path - * @return pointer to the created path object - */ -lv_vector_path_t * lv_vector_path_create(lv_vector_path_quality_t quality); - -/** - * Copy a path data to another - * @param target_path pointer to a path - * @param path pointer to source path - */ -void lv_vector_path_copy(lv_vector_path_t * target_path, const lv_vector_path_t * path); - -/** - * Clear path data - * @param path pointer to a path - */ -void lv_vector_path_clear(lv_vector_path_t * path); - -/** - * Delete the graphic path object - * @param path pointer to a path - */ -void lv_vector_path_delete(lv_vector_path_t * path); - -/** - * Begin a new sub path and set a point to path - * @param path pointer to a path - * @param p pointer to a `lv_fpoint_t` variable - */ -void lv_vector_path_move_to(lv_vector_path_t * path, const lv_fpoint_t * p); - -/** - * Add a line to the path from last point to the point - * @param path pointer to a path - * @param p pointer to a `lv_fpoint_t` variable - */ -void lv_vector_path_line_to(lv_vector_path_t * path, const lv_fpoint_t * p); - -/** - * Add a quadratic bezier line to the path from last point to the point - * @param path pointer to a path - * @param p1 pointer to a `lv_fpoint_t` variable for control point - * @param p2 pointer to a `lv_fpoint_t` variable for end point - */ -void lv_vector_path_quad_to(lv_vector_path_t * path, const lv_fpoint_t * p1, const lv_fpoint_t * p2); - -/** - * Add a cubic bezier line to the path from last point to the point - * @param path pointer to a path - * @param p1 pointer to a `lv_fpoint_t` variable for first control point - * @param p2 pointer to a `lv_fpoint_t` variable for second control point - * @param p3 pointer to a `lv_fpoint_t` variable for end point - */ -void lv_vector_path_cubic_to(lv_vector_path_t * path, const lv_fpoint_t * p1, const lv_fpoint_t * p2, - const lv_fpoint_t * p3); - -/** - * Add ellipse arc to the path from last point to the point - * @param path pointer to a path - * @param radius_x the x radius for ellipse arc - * @param radius_y the y radius for ellipse arc - * @param rotate_angle the rotate angle for arc - * @param large_arc true for large arc, otherwise small - * @param clockwise true for clockwise, otherwise anticlockwise - * @param p pointer to a `lv_fpoint_t` variable for end point - */ -void lv_vector_path_arc_to(lv_vector_path_t * path, float radius_x, float radius_y, float rotate_angle, - bool large_arc, - bool clockwise, const lv_fpoint_t * p); - -/** - * Close the sub path - * @param path pointer to a path - */ -void lv_vector_path_close(lv_vector_path_t * path); - -/** - * Get the bounding box of a path - * @param path pointer to a path - * @param area pointer to a `lv_area_t` variable for bounding box - */ -void lv_vector_path_get_bounding(const lv_vector_path_t * path, lv_area_t * area); - -/** - * Add a rectangle to the path by x/y/w/h. rx/ry are corner radii - * @param path pointer to a path - * @param x the x coordinate of the top-left corner of the rectangle - * @param y the y coordinate of the top-left corner of the rectangle - * @param w the width of the rectangle - * @param h the height of the rectangle - * @param rx the horizontal radius for rounded rectangle - * @param ry the vertical radius for rounded rectangle - */ -void lv_vector_path_append_rectangle(lv_vector_path_t * path, float x, float y, float w, float h, float rx, float ry); - -/** - * Add a rectangle to the path (legacy api, recommend use lv_vector_path_append_rectangle instead) - * @param path pointer to a path - * @param rect pointer to a `lv_area_t` variable - * @param rx the horizontal radius for rounded rectangle - * @param ry the vertical radius for rounded rectangle - */ -static inline void lv_vector_path_append_rect(lv_vector_path_t * path, const lv_area_t * rect, float rx, float ry) -{ - LV_ASSERT_NULL(path); - LV_ASSERT_NULL(rect); - - lv_vector_path_append_rectangle(path, rect->x1, rect->y1, (float)lv_area_get_width(rect), - (float)lv_area_get_height(rect), rx, ry); -} - -/** - * Add a circle to the path - * @param path pointer to a path - * @param c pointer to a `lv_fpoint_t` variable for center of the circle - * @param rx the horizontal radius for circle - * @param ry the vertical radius for circle - */ -void lv_vector_path_append_circle(lv_vector_path_t * path, const lv_fpoint_t * c, float rx, float ry); - -/** - * Add a arc to the path - * @param path pointer to a path - * @param c pointer to a `lv_fpoint_t` variable for center of the circle - * @param radius the radius for arc - * @param start_angle the start angle for arc - * @param sweep the sweep angle for arc, could be negative - * @param pie true: draw a pie, false: draw a arc - */ -void lv_vector_path_append_arc(lv_vector_path_t * path, const lv_fpoint_t * c, float radius, float start_angle, - float sweep, bool pie); - -/** - * Add an sub path to the path - * @param path pointer to a path - * @param subpath pointer to another path which will be added - */ -void lv_vector_path_append_path(lv_vector_path_t * path, const lv_vector_path_t * subpath); - -/** - * Create a vector graphic descriptor - * @param layer pointer to a layer - * @return pointer to the created descriptor - */ -lv_draw_vector_dsc_t * lv_draw_vector_dsc_create(lv_layer_t * layer); - -/** - * Delete the vector graphic descriptor - * @param dsc pointer to a vector graphic descriptor - */ -void lv_draw_vector_dsc_delete(lv_draw_vector_dsc_t * dsc); - -/** - * Set a matrix to current transformation matrix. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix. - * @param dsc pointer to a vector graphic descriptor - * @param matrix pointer to a matrix - */ -void lv_draw_vector_dsc_set_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix); - -/** - * Set blend mode for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this blend mode. - * @param dsc pointer to a vector graphic descriptor - * @param blend the blend mode to be set in `lv_vector_blend_t` - */ -void lv_draw_vector_dsc_set_blend_mode(lv_draw_vector_dsc_t * dsc, lv_vector_blend_t blend); - -/** - * Set the fill color for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color. - * @param dsc pointer to a vector graphic descriptor - * @param color the color to be set in lv_color32_t format - */ -void lv_draw_vector_dsc_set_fill_color32(lv_draw_vector_dsc_t * dsc, lv_color32_t color); - -/** - * Set fill color for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color. - * @param dsc pointer to a vector graphic descriptor - * @param color the color to be set in lv_color_t format - */ -void lv_draw_vector_dsc_set_fill_color(lv_draw_vector_dsc_t * dsc, lv_color_t color); - -/** - * Set fill opacity for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this opacity. - * @param dsc pointer to a vector graphic descriptor - * @param opa the opacity to be set in lv_opa_t format - */ -void lv_draw_vector_dsc_set_fill_opa(lv_draw_vector_dsc_t * dsc, lv_opa_t opa); - -/** - * Set fill rule for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this fill rule. - * @param dsc pointer to a vector graphic descriptor - * @param rule the fill rule to be set in lv_vector_fill_t format - */ -void lv_draw_vector_dsc_set_fill_rule(lv_draw_vector_dsc_t * dsc, lv_vector_fill_t rule); - -/** - * Set the fill units for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this fill units. - * @param dsc pointer to a vector graphic descriptor - * @param units the units to be set in lv_vector_fill_units_t format - * @note The units can be either relative to the object bounding box or absolute in user space. - * This API specifically affects the drawing position of the fill image and does not impact other elements. - */ -void lv_draw_vector_dsc_set_fill_units(lv_draw_vector_dsc_t * dsc, const lv_vector_fill_units_t units); - -/** - * Set fill image for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this fill image. - * @param dsc pointer to a vector graphic descriptor - * @param img_dsc pointer to a `lv_draw_image_dsc_t` variable - */ -void lv_draw_vector_dsc_set_fill_image(lv_draw_vector_dsc_t * dsc, const lv_draw_image_dsc_t * img_dsc); - -/** - * Set fill linear gradient for descriptor - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient. - * @param dsc pointer to a vector graphic descriptor - * @param x1 the x for start point - * @param y1 the y for start point - * @param x2 the x for end point - * @param y2 the y for end point - */ -void lv_draw_vector_dsc_set_fill_linear_gradient(lv_draw_vector_dsc_t * dsc, float x1, float y1, float x2, float y2); - -/** - * Set fill radial gradient radius for descriptor - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient. - * @param dsc pointer to a vector graphic descriptor - * @param cx the x for center of the circle - * @param cy the y for center of the circle - * @param radius the radius for circle - */ -void lv_draw_vector_dsc_set_fill_radial_gradient(lv_draw_vector_dsc_t * dsc, float cx, float cy, float radius); - -/** - * Set fill radial gradient spread for descriptor - * @param dsc pointer to a vector graphic descriptor - * @param spread the gradient spread to be set in lv_vector_gradient_spread_t format - */ -void lv_draw_vector_dsc_set_fill_gradient_spread(lv_draw_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread); - -/** - * Set fill gradient color stops for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient color stops. - * @param dsc pointer to a vector graphic descriptor - * @param stops an array of `lv_grad_stop_t` variables - * @param count the number of stops in the array, range: 0..LV_GRADIENT_MAX_STOPS - */ -void lv_draw_vector_dsc_set_fill_gradient_color_stops(lv_draw_vector_dsc_t * dsc, const lv_grad_stop_t * stops, - uint16_t count); - -/** - * Set a matrix to current fill transformation matrix - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix. - * @param dsc pointer to a vector graphic descriptor - * @param matrix pointer to a matrix - */ -void lv_draw_vector_dsc_set_fill_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix); - -/** - * Set stroke color for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color. - * @param dsc pointer to a vector graphic descriptor - * @param color the color to be set in lv_color32_t format - */ -void lv_draw_vector_dsc_set_stroke_color32(lv_draw_vector_dsc_t * dsc, lv_color32_t color); - -/** - * Set stroke color for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color. - * @param dsc pointer to a vector graphic descriptor - * @param color the color to be set in lv_color_t format - */ -void lv_draw_vector_dsc_set_stroke_color(lv_draw_vector_dsc_t * dsc, lv_color_t color); - -/** - * Set stroke opacity for descriptor - * @param dsc pointer to a vector graphic descriptor - * @param opa the opacity to be set in lv_opa_t format - */ -void lv_draw_vector_dsc_set_stroke_opa(lv_draw_vector_dsc_t * dsc, lv_opa_t opa); - -/** - * Set stroke line width for descriptor. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this stroke width. - * @param dsc pointer to a vector graphic descriptor - * @param width the stroke line width - */ -void lv_draw_vector_dsc_set_stroke_width(lv_draw_vector_dsc_t * dsc, float width); - -/** - * Set stroke line dash pattern for descriptor - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this dash. - * @param dsc pointer to a vector graphic descriptor - * @param dash_pattern an array of values that specify the segments of dash line - * @param dash_count the length of dash pattern array - */ -void lv_draw_vector_dsc_set_stroke_dash(lv_draw_vector_dsc_t * dsc, float * dash_pattern, uint16_t dash_count); - -/** - * Set stroke line cap style for descriptor - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this line cap. - * @param dsc pointer to a vector graphic descriptor - * @param cap the line cap to be set in lv_vector_stroke_cap_t format - */ -void lv_draw_vector_dsc_set_stroke_cap(lv_draw_vector_dsc_t * dsc, lv_vector_stroke_cap_t cap); - -/** - * Set stroke line join style for descriptor - * @param dsc pointer to a vector graphic descriptor - * @param join the line join to be set in lv_vector_stroke_join_t format - */ -void lv_draw_vector_dsc_set_stroke_join(lv_draw_vector_dsc_t * dsc, lv_vector_stroke_join_t join); - -/** - * Set stroke miter limit for descriptor - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this miter limit. - * @param dsc pointer to a vector graphic descriptor - * @param miter_limit the stroke miter_limit - */ -void lv_draw_vector_dsc_set_stroke_miter_limit(lv_draw_vector_dsc_t * dsc, uint16_t miter_limit); - -/** - * Set stroke linear gradient for descriptor - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient. - * @param dsc pointer to a vector graphic descriptor - * @param x1 the x for start point - * @param y1 the y for start point - * @param x2 the x for end point - * @param y2 the y for end point - */ -void lv_draw_vector_dsc_set_stroke_linear_gradient(lv_draw_vector_dsc_t * dsc, float x1, float y1, float x2, float y2); -/** - * Set stroke radial gradient for descriptor - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient. - * @param dsc pointer to a vector graphic descriptor - * @param cx the x for center of the circle - * @param cy the y for center of the circle - * @param radius the radius for circle - */ -void lv_draw_vector_dsc_set_stroke_radial_gradient(lv_draw_vector_dsc_t * dsc, float cx, float cy, float radius); - -/** - * Set stroke color stops for descriptor - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this gradient spread. - * @param dsc pointer to a vector graphic descriptor - * @param spread the gradient spread to be set in lv_vector_gradient_spread_t format - */ -void lv_draw_vector_dsc_set_stroke_gradient_spread(lv_draw_vector_dsc_t * dsc, lv_vector_gradient_spread_t spread); - -/** - * Set stroke color stops for descriptor - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this color stops. - * @param dsc pointer to a vector graphic descriptor - * @param stops an array of `lv_grad_stop_t` variables - * @param count the number of stops in the array - */ -void lv_draw_vector_dsc_set_stroke_gradient_color_stops(lv_draw_vector_dsc_t * dsc, const lv_grad_stop_t * stops, - uint16_t count); - -/** - * Set a matrix to current stroke transformation matrix. - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix. - * @param dsc pointer to a vector graphic descriptor - * @param matrix pointer to a matrix - */ -void lv_draw_vector_dsc_set_stroke_transform(lv_draw_vector_dsc_t * dsc, const lv_matrix_t * matrix); - -/** - * Set current transformation matrix to identity matrix - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this matrix. - * @param dsc pointer to a vector graphic descriptor - */ -void lv_draw_vector_dsc_identity(lv_draw_vector_dsc_t * dsc); - -/** - * Change the scale factor of current transformation matrix - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this scale. - * @param dsc pointer to a vector graphic descriptor - * @param scale_x the scale factor for the X direction - * @param scale_y the scale factor for the Y direction - */ -void lv_draw_vector_dsc_scale(lv_draw_vector_dsc_t * dsc, float scale_x, float scale_y); - -/** - * Rotate current transformation matrix with origin - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this rotation. - * @param dsc pointer to a vector graphic descriptor - * @param degree angle to rotate - */ -void lv_draw_vector_dsc_rotate(lv_draw_vector_dsc_t * dsc, float degree); - -/** - * Translate current transformation matrix to new position - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this rotation. - * @param dsc pointer to a vector graphic descriptor - * @param tx the amount of translate in x direction - * @param ty the amount of translate in y direction - */ -void lv_draw_vector_dsc_translate(lv_draw_vector_dsc_t * dsc, float tx, float ty); - -/** - * Change the skew factor of current transformation matrix - * The new path shapes added by `lv_draw_vector_dsc_add_path` will use this skew. - * @param dsc pointer to a vector graphic descriptor - * @param skew_x the skew factor for x direction - * @param skew_y the skew factor for y direction - */ -void lv_draw_vector_dsc_skew(lv_draw_vector_dsc_t * dsc, float skew_x, float skew_y); - -/** - * Add a graphic path to the draw list. - * It will use colors, opacity, matrix and other parameters set - * by `lv_draw_vector_dsc_set_fill_color()` and similar functions. - * @param dsc pointer to a vector graphic descriptor - * @param path pointer to a path - */ -void lv_draw_vector_dsc_add_path(lv_draw_vector_dsc_t * dsc, const lv_vector_path_t * path); - -/** - * Clear a rectangle area use current fill color - * @param dsc pointer to a vector graphic descriptor - * @param rect the area to clear in the buffer - */ -void lv_draw_vector_dsc_clear_area(lv_draw_vector_dsc_t * dsc, const lv_area_t * rect); - -/** - * Draw all the vector graphic paths - * @param dsc pointer to a vector graphic descriptor - */ -void lv_draw_vector(lv_draw_vector_dsc_t * dsc); - -/** - * Try to get a vector draw descriptor from a draw task. - * @param task draw task - * @return the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_VECTOR - */ -lv_draw_vector_dsc_t * lv_draw_task_get_vector_dsc(lv_draw_task_t * task); - -/* Traverser for task list */ -typedef void (*vector_draw_task_cb)(void * ctx, const lv_vector_path_t * path, const lv_vector_path_ctx_t * dsc); - -#endif /* LV_USE_VECTOR_GRAPHIC */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_DRAW_VECTOR_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_draw_vector_private.h b/src/draw/lv_draw_vector_private.h index 10639cabb2..2245e2129d 100644 --- a/src/draw/lv_draw_vector_private.h +++ b/src/draw/lv_draw_vector_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_draw_vector.h" +#include "lv_draw_private.h" #if LV_USE_VECTOR_GRAPHIC diff --git a/src/draw/lv_image_decoder.c b/src/draw/lv_image_decoder.c index 6e10f39009..7c62232393 100644 --- a/src/draw/lv_image_decoder.c +++ b/src/draw/lv_image_decoder.c @@ -6,13 +6,13 @@ /********************* * INCLUDES *********************/ + #include "lv_image_decoder_private.h" -#include "../misc/lv_assert.h" -#include "../draw/lv_draw_image.h" -#include "../misc/lv_ll.h" -#include "../misc/lv_profiler.h" -#include "../stdlib/lv_string.h" #include "../core/lv_global.h" +#include "../misc/cache/lv_cache.h" +#include "../misc/cache/instance/lv_image_cache.h" +#include "../misc/cache/instance/lv_image_header_cache.h" +#include "../misc/cache/lv_cache_entry.h" /********************* * DEFINES diff --git a/src/draw/lv_image_decoder.h b/src/draw/lv_image_decoder.h index 3b8089aff7..4cfbbf42b8 100644 --- a/src/draw/lv_image_decoder.h +++ b/src/draw/lv_image_decoder.h @@ -1,203 +1,2 @@ -/** - * @file lv_image_decoder.h - * - */ - -#ifndef LV_IMAGE_DECODER_H -#define LV_IMAGE_DECODER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -#include "lv_draw_buf.h" -#include "../misc/lv_fs.h" -#include "../misc/lv_types.h" -#include "../misc/lv_area.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * Source of image.*/ -typedef enum { - LV_IMAGE_SRC_VARIABLE, /** Binary/C variable*/ - LV_IMAGE_SRC_FILE, /** File in filesystem*/ - LV_IMAGE_SRC_SYMBOL, /** Symbol (@ref lv_symbol_def.h)*/ - LV_IMAGE_SRC_UNKNOWN, /** Unknown source*/ -} lv_image_src_t; - -/** - * Get info from an image and store in the `header` - * @param decoder pointer to decoder object - * @param dsc pointer to decoder descriptor - * @param header store the info here - * @return LV_RESULT_OK: info written correctly; LV_RESULT_INVALID: failed - */ -typedef lv_result_t (*lv_image_decoder_info_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc, - lv_image_header_t * header); - -/** - * Open an image for decoding. Prepare it as it is required to read it later - * @param decoder pointer to the decoder the function associated with - * @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it. - */ -typedef lv_result_t (*lv_image_decoder_open_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); - -/** - * Decode `full_area` pixels incrementally by calling in a loop. Set `decoded_area` values to `LV_COORD_MIN` on first call. - * Required only if the "open" function can't return with the whole decoded pixel array. - * @param decoder pointer to the decoder the function associated with - * @param dsc pointer to decoder descriptor - * @param full_area input parameter. the full area to decode after enough subsequent calls - * @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call and to reset decoding. - * the decoded area is stored here after each call. - * @return LV_RESULT_OK: ok; LV_RESULT_INVALID: failed or there is nothing left to decode - */ -typedef lv_result_t (*lv_image_decoder_get_area_cb_t)(lv_image_decoder_t * decoder, - lv_image_decoder_dsc_t * dsc, - const lv_area_t * full_area, lv_area_t * decoded_area); - -/** - * Close the pending decoding. Free resources etc. - * @param decoder pointer to the decoder the function associated with - * @param dsc pointer to decoder descriptor - */ -typedef void (*lv_image_decoder_close_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); - -/** - * Custom drawing functions for special image formats. - * @param layer pointer to a layer - * @param dsc pointer to decoder descriptor - * @param coords the coordinates of the image - * @param draw_dsc the draw image descriptor - * @param clip_area the clip area of the image - */ -typedef void (*lv_image_decoder_custom_draw_t)(lv_layer_t * layer, const lv_image_decoder_dsc_t * dsc, - const lv_area_t * coords, const lv_draw_image_dsc_t * draw_dsc, const lv_area_t * clip_area); -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Get information about an image. - * Try the created image decoder one by one. Once one is able to get info that info will be used. - * @param src the image source. Can be - * 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register()`) - * 2) Variable: Pointer to an `lv_image_dsc_t` variable - * 3) Symbol: E.g. `LV_SYMBOL_OK` - * @param header the image info will be stored here - * @return LV_RESULT_OK: success; LV_RESULT_INVALID: wasn't able to get info about the image - */ -lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header); - -/** - * Open an image. - * Try the created image decoders one by one. Once one is able to open the image that decoder is saved in `dsc` - * @param dsc describes a decoding session. Simply a pointer to an `lv_image_decoder_dsc_t` variable. - * @param src the image source. Can be - * 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register())`) - * 2) Variable: Pointer to an `lv_image_dsc_t` variable - * 3) Symbol: E.g. `LV_SYMBOL_OK` - * @param args args about how the image should be opened. - * @return LV_RESULT_OK: opened the image. `dsc->decoded` and `dsc->header` are set. - * LV_RESULT_INVALID: none of the registered image decoders were able to open the image. - */ -lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, const lv_image_decoder_args_t * args); - -/** - * Decode `full_area` pixels incrementally by calling in a loop. Set `decoded_area` to `LV_COORD_MIN` on first call. - * @param dsc image decoder descriptor - * @param full_area input parameter. the full area to decode after enough subsequent calls - * @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call and to reset decoding. - * the decoded area is stored here after each call. - * @return LV_RESULT_OK: success; LV_RESULT_INVALID: an error occurred or there is nothing left to decode - */ -lv_result_t lv_image_decoder_get_area(lv_image_decoder_dsc_t * dsc, const lv_area_t * full_area, - lv_area_t * decoded_area); - -/** - * Close a decoding session - * @param dsc pointer to `lv_image_decoder_dsc_t` used in `lv_image_decoder_open` - */ -void lv_image_decoder_close(lv_image_decoder_dsc_t * dsc); - -/** - * Create a new image decoder - * @return pointer to the new image decoder - */ -lv_image_decoder_t * lv_image_decoder_create(void); - -/** - * Delete an image decoder - * @param decoder pointer to an image decoder - */ -void lv_image_decoder_delete(lv_image_decoder_t * decoder); - -/** - * Get the next image decoder in the linked list of image decoders - * @param decoder pointer to an image decoder or NULL to get the first one - * @return the next image decoder or NULL if no more image decoder exists - */ -lv_image_decoder_t * lv_image_decoder_get_next(lv_image_decoder_t * decoder); - -/** - * Set a callback to get information about the image - * @param decoder pointer to an image decoder - * @param info_cb a function to collect info about an image (fill an `lv_image_header_t` struct) - */ -void lv_image_decoder_set_info_cb(lv_image_decoder_t * decoder, lv_image_decoder_info_f_t info_cb); - -/** - * Set a callback to open an image - * @param decoder pointer to an image decoder - * @param open_cb a function to open an image - */ -void lv_image_decoder_set_open_cb(lv_image_decoder_t * decoder, lv_image_decoder_open_f_t open_cb); - -/** - * Set a callback to a decoded line of an image - * @param decoder pointer to an image decoder - * @param read_line_cb a function to read a line of an image - */ -void lv_image_decoder_set_get_area_cb(lv_image_decoder_t * decoder, lv_image_decoder_get_area_cb_t read_line_cb); - -/** - * Set a callback to close a decoding session. E.g. close files and free other resources. - * @param decoder pointer to an image decoder - * @param close_cb a function to close a decoding session - */ -void lv_image_decoder_set_close_cb(lv_image_decoder_t * decoder, lv_image_decoder_close_f_t close_cb); - -lv_cache_entry_t * lv_image_decoder_add_to_cache(lv_image_decoder_t * decoder, - lv_image_cache_data_t * search_key, - const lv_draw_buf_t * decoded, void * user_data); - -/** - * Check the decoded image, make any modification if decoder `args` requires. - * @note A new draw buf will be allocated if provided `decoded` is not modifiable or stride mismatch etc. - * @param dsc pointer to a decoder descriptor - * @param decoded pointer to a decoded image to post process to meet dsc->args requirement. - * @return post processed draw buffer, when it differs with `decoded`, it's newly allocated. - */ -lv_draw_buf_t * lv_image_decoder_post_process(lv_image_decoder_dsc_t * dsc, lv_draw_buf_t * decoded); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_IMAGE_DECODER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/lv_image_decoder_private.h b/src/draw/lv_image_decoder_private.h index c7369d0aa6..f36318a043 100644 --- a/src/draw/lv_image_decoder_private.h +++ b/src/draw/lv_image_decoder_private.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "lv_image_decoder.h" + #include "../misc/cache/lv_cache.h" /********************* @@ -133,6 +133,10 @@ void lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_coun */ void lv_image_decoder_deinit(void); +lv_cache_entry_t * lv_image_decoder_add_to_cache(lv_image_decoder_t * decoder, + lv_image_cache_data_t * search_key, + const lv_draw_buf_t * decoded, void * user_data); + /********************** * MACROS **********************/ diff --git a/src/draw/lv_image_dsc.h b/src/draw/lv_image_dsc.h index 6a6f7aff94..efdd0a868f 100644 --- a/src/draw/lv_image_dsc.h +++ b/src/draw/lv_image_dsc.h @@ -1,152 +1,2 @@ -/** - * @file lv_image_dsc.h - * - */ - -#ifndef LV_IMAGE_DSC_H -#define LV_IMAGE_DSC_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -/********************* - * DEFINES - *********************/ - -/** Magic number for lvgl image, 9 means lvgl version 9 - * It must be neither a valid ASCII character nor larger than 0x80. See `lv_image_src_get_type`. - */ -#define LV_IMAGE_HEADER_MAGIC (0x19) -LV_EXPORT_CONST_INT(LV_IMAGE_HEADER_MAGIC); - -/** - * Flags reserved for user, lvgl won't use these bits. - */ -#define LV_IMAGE_FLAGS_USER_MASK (0xFF00) - -/********************** - * TYPEDEFS - **********************/ - -typedef enum _lvimage_flags_t { - /** - * For RGB map of the image data, mark if it's pre-multiplied with alpha. - * For indexed image, this bit indicated palette data is pre-multiplied with alpha. - */ - LV_IMAGE_FLAGS_PREMULTIPLIED = 0x0001, - /** - * The image data is compressed, so decoder needs to decode image firstly. - * If this flag is set, the whole image will be decompressed upon decode, and - * `get_area_cb` won't be necessary. - */ - LV_IMAGE_FLAGS_COMPRESSED = 0x0008, - - /*Below flags are applicable only for draw buffer header.*/ - - /** - * The image is allocated from heap, thus should be freed after use. - */ - LV_IMAGE_FLAGS_ALLOCATED = 0x0010, - - /** - * If the image data is malloced and can be processed in place. - * In image decoder post processing, this flag means we modify it in-place. - */ - LV_IMAGE_FLAGS_MODIFIABLE = 0x0020, - - /** - * The image has custom drawing methods. - */ - LV_IMAGE_FLAGS_CUSTOM_DRAW = 0x0040, - - /** - * Flags reserved for user, lvgl won't use these bits. - */ - LV_IMAGE_FLAGS_USER1 = 0x0100, - LV_IMAGE_FLAGS_USER2 = 0x0200, - LV_IMAGE_FLAGS_USER3 = 0x0400, - LV_IMAGE_FLAGS_USER4 = 0x0800, - LV_IMAGE_FLAGS_USER5 = 0x1000, - LV_IMAGE_FLAGS_USER6 = 0x2000, - LV_IMAGE_FLAGS_USER7 = 0x4000, - LV_IMAGE_FLAGS_USER8 = 0x8000, -} lv_image_flags_t; - -typedef enum { - LV_IMAGE_COMPRESS_NONE = 0, - LV_IMAGE_COMPRESS_RLE, /**< LVGL custom RLE compression */ - LV_IMAGE_COMPRESS_LZ4, -} lv_image_compress_t; - -#if LV_BIG_ENDIAN_SYSTEM -typedef struct { - uint32_t reserved_2: 16; /**< Reserved to be used later*/ - uint32_t stride: 16; /**< Number of bytes in a row*/ - uint32_t h: 16; - uint32_t w: 16; - uint32_t flags: 16; /**< Image flags, see `lv_image_flags_t`*/ - uint32_t cf : 8; /**< Color format: See `lv_color_format_t`*/ - uint32_t magic: 8; /**< Magic number. Must be LV_IMAGE_HEADER_MAGIC*/ -} lv_image_header_t; -#else -typedef struct { - uint32_t magic: 8; /**< Magic number. Must be LV_IMAGE_HEADER_MAGIC*/ - uint32_t cf : 8; /**< Color format: See `lv_color_format_t`*/ - uint32_t flags: 16; /**< Image flags, see `lv_image_flags_t`*/ - - uint32_t w: 16; - uint32_t h: 16; - uint32_t stride: 16; /**< Number of bytes in a row*/ - uint32_t reserved_2: 16; /**< Reserved to be used later*/ -} lv_image_header_t; -#endif - -typedef struct { - void * buf; - uint32_t stride; /**< Number of bytes in a row*/ -} lv_yuv_plane_t; - -typedef union { - lv_yuv_plane_t yuv; /**< packed format*/ - struct { - lv_yuv_plane_t y; - lv_yuv_plane_t u; - lv_yuv_plane_t v; - } planar; /**< planar format with 3 plane*/ - struct { - lv_yuv_plane_t y; - lv_yuv_plane_t uv; - } semi_planar; /**< planar format with 2 plane*/ -} lv_yuv_buf_t; - -/** - * Struct to describe a constant image resource. - * It's similar to lv_draw_buf_t, but the data is constant. - */ -typedef struct { - lv_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; /**< A reserved field to make it has same size as lv_draw_buf_t*/ - const void * reserved_2; /**< A reserved field to make it has same size as lv_draw_buf_t*/ -} lv_image_dsc_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_IMAGE_DSC_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/nanovg/lv_draw_nanovg.c b/src/draw/nanovg/lv_draw_nanovg.c index 13470ea655..b2c7bf13b6 100644 --- a/src/draw/nanovg/lv_draw_nanovg.c +++ b/src/draw/nanovg/lv_draw_nanovg.c @@ -11,7 +11,6 @@ #if LV_USE_DRAW_NANOVG -#include "../../display/lv_display.h" #include "../../core/lv_refr_private.h" #include "lv_draw_nanovg_private.h" #include "lv_nanovg_utils.h" diff --git a/src/draw/nanovg/lv_draw_nanovg.h b/src/draw/nanovg/lv_draw_nanovg.h index 7b1205a398..b954b5f91b 100644 --- a/src/draw/nanovg/lv_draw_nanovg.h +++ b/src/draw/nanovg/lv_draw_nanovg.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_NANOVG diff --git a/src/draw/nanovg/lv_draw_nanovg_3d.c b/src/draw/nanovg/lv_draw_nanovg_3d.c index 96be7345a2..7b0f446edc 100644 --- a/src/draw/nanovg/lv_draw_nanovg_3d.c +++ b/src/draw/nanovg/lv_draw_nanovg_3d.c @@ -11,8 +11,6 @@ #if LV_USE_DRAW_NANOVG && LV_USE_3DTEXTURE -#include "../../draw/lv_draw_3d.h" -#include "../../drivers/opengles/lv_opengles_driver.h" #include "../../drivers/opengles/lv_opengles_private.h" #include "lv_nanovg_utils.h" #include "lv_nanovg_fbo_cache.h" diff --git a/src/draw/nanovg/lv_draw_nanovg_label.c b/src/draw/nanovg/lv_draw_nanovg_label.c index c61560a9b6..de1e8dc5ec 100644 --- a/src/draw/nanovg/lv_draw_nanovg_label.c +++ b/src/draw/nanovg/lv_draw_nanovg_label.c @@ -17,7 +17,6 @@ #include "../lv_draw_image_private.h" #include "../../misc/cache/lv_cache_entry_private.h" #include "../../misc/lv_pending.h" -#include "../../libs/freetype/lv_freetype.h" #include "../../font/lv_font_private.h" /********************* diff --git a/src/draw/nanovg/lv_draw_nanovg_mask_rect.c b/src/draw/nanovg/lv_draw_nanovg_mask_rect.c index 97a20495da..cf3d854df6 100644 --- a/src/draw/nanovg/lv_draw_nanovg_mask_rect.c +++ b/src/draw/nanovg/lv_draw_nanovg_mask_rect.c @@ -11,7 +11,6 @@ #if LV_USE_DRAW_NANOVG -#include "../../draw/lv_draw_mask.h" #include "lv_nanovg_utils.h" /********************* diff --git a/src/draw/nanovg/lv_draw_nanovg_private.h b/src/draw/nanovg/lv_draw_nanovg_private.h index 29e17332a1..59f34b1ec4 100644 --- a/src/draw/nanovg/lv_draw_nanovg_private.h +++ b/src/draw/nanovg/lv_draw_nanovg_private.h @@ -14,19 +14,11 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_NANOVG -#include "../lv_draw.h" + #include "../lv_draw_private.h" -#include "../../draw/lv_draw_vector.h" -#include "../../draw/lv_draw_arc.h" -#include "../../draw/lv_draw_rect.h" -#include "../../draw/lv_draw_3d.h" -#include "../../draw/lv_draw_image.h" -#include "../../draw/lv_draw_label.h" -#include "../../draw/lv_draw_line.h" -#include "../../draw/lv_draw_triangle.h" #include "../../misc/lv_area_private.h" #if !LV_USE_NANOVG diff --git a/src/draw/nanovg/lv_nanovg_fbo_cache.c b/src/draw/nanovg/lv_nanovg_fbo_cache.c index 732e4e07ce..62398a17e2 100644 --- a/src/draw/nanovg/lv_nanovg_fbo_cache.c +++ b/src/draw/nanovg/lv_nanovg_fbo_cache.c @@ -14,6 +14,8 @@ #include "lv_draw_nanovg_private.h" #include "lv_nanovg_utils.h" #include "../../libs/nanovg/nanovg_gl_utils.h" +#include "../../misc/cache/class/lv_cache_lru_ll.h" +#include "../../misc/cache/lv_cache_entry.h" /********************* * DEFINES diff --git a/src/draw/nanovg/lv_nanovg_fbo_cache.h b/src/draw/nanovg/lv_nanovg_fbo_cache.h index df89a1aa0c..fddbef5701 100644 --- a/src/draw/nanovg/lv_nanovg_fbo_cache.h +++ b/src/draw/nanovg/lv_nanovg_fbo_cache.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_NANOVG diff --git a/src/draw/nanovg/lv_nanovg_image_cache.c b/src/draw/nanovg/lv_nanovg_image_cache.c index b8e5718b17..aefa45ca23 100644 --- a/src/draw/nanovg/lv_nanovg_image_cache.c +++ b/src/draw/nanovg/lv_nanovg_image_cache.c @@ -15,7 +15,8 @@ #include "lv_nanovg_utils.h" #include "../lv_image_decoder_private.h" #include "../../misc/lv_pending.h" -#include "../../misc/lv_iter.h" +#include "../../misc/cache/lv_cache_entry.h" +#include "../../misc/cache/class/lv_cache_lru_rb.h" /********************* * DEFINES diff --git a/src/draw/nanovg/lv_nanovg_image_cache.h b/src/draw/nanovg/lv_nanovg_image_cache.h index aa7a0fd026..d682aec2c6 100644 --- a/src/draw/nanovg/lv_nanovg_image_cache.h +++ b/src/draw/nanovg/lv_nanovg_image_cache.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_NANOVG diff --git a/src/draw/nanovg/lv_nanovg_math.h b/src/draw/nanovg/lv_nanovg_math.h index 44d6f02b9f..8634c95f2d 100644 --- a/src/draw/nanovg/lv_nanovg_math.h +++ b/src/draw/nanovg/lv_nanovg_math.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_NANOVG diff --git a/src/draw/nanovg/lv_nanovg_utils.h b/src/draw/nanovg/lv_nanovg_utils.h index d1cb305aca..8c1f6d8852 100644 --- a/src/draw/nanovg/lv_nanovg_utils.h +++ b/src/draw/nanovg/lv_nanovg_utils.h @@ -14,13 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_NANOVG -#include "../../misc/lv_assert.h" -#include "../../misc/lv_matrix.h" -#include "../../misc/lv_color.h" #include "../../libs/nanovg/nanovg.h" /********************* diff --git a/src/draw/nema_gfx/lv_draw_nema_gfx.c b/src/draw/nema_gfx/lv_draw_nema_gfx.c index f00e566325..449b2db1ff 100644 --- a/src/draw/nema_gfx/lv_draw_nema_gfx.c +++ b/src/draw/nema_gfx/lv_draw_nema_gfx.c @@ -32,13 +32,10 @@ /********************* * INCLUDES *********************/ -#include "../../core/lv_refr.h" - -#if LV_USE_NEMA_GFX #include "lv_draw_nema_gfx.h" -#include "../../font/lv_font.h" -#include "../../font/fmt_txt/lv_font_fmt_txt.h" + +#if LV_USE_NEMA_GFX /********************* * DEFINES diff --git a/src/draw/nema_gfx/lv_draw_nema_gfx.h b/src/draw/nema_gfx/lv_draw_nema_gfx.h index 23334ee5eb..324dd15c07 100644 --- a/src/draw/nema_gfx/lv_draw_nema_gfx.h +++ b/src/draw/nema_gfx/lv_draw_nema_gfx.h @@ -39,7 +39,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_NEMA_GFX @@ -50,13 +50,7 @@ extern "C" { #include "../lv_draw_image_private.h" #include "../lv_image_decoder_private.h" #include "../lv_draw_label_private.h" -#include "../lv_draw_mask.h" -#include "../lv_draw_rect_private.h" -#include "../lv_draw_triangle_private.h" #include "../lv_draw_vector_private.h" -#include "../lv_draw_line.h" -#include "../lv_draw_arc.h" - #include "../../misc/lv_area_private.h" /********************** diff --git a/src/draw/nema_gfx/lv_draw_nema_gfx_stm32_hal.c b/src/draw/nema_gfx/lv_draw_nema_gfx_stm32_hal.c index 9fc1552716..b09213ef31 100644 --- a/src/draw/nema_gfx/lv_draw_nema_gfx_stm32_hal.c +++ b/src/draw/nema_gfx/lv_draw_nema_gfx_stm32_hal.c @@ -9,16 +9,13 @@ * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_NEMA_GFX #if LV_USE_NEMA_HAL == LV_NEMA_HAL_STM32 #include "lv_draw_nema_gfx_utils.h" -#include "../../misc/lv_types.h" -#include "../../misc/lv_assert.h" -#include "../../stdlib/lv_string.h" #include "../../osal/lv_os_private.h" #include diff --git a/src/draw/nema_gfx/lv_draw_nema_gfx_utils.h b/src/draw/nema_gfx/lv_draw_nema_gfx_utils.h index bf8e6d2185..7804f159e5 100644 --- a/src/draw/nema_gfx/lv_draw_nema_gfx_utils.h +++ b/src/draw/nema_gfx/lv_draw_nema_gfx_utils.h @@ -39,7 +39,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_NEMA_GFX #include "../sw/lv_draw_sw.h" diff --git a/src/draw/nema_gfx/lv_nema_gfx_path.c b/src/draw/nema_gfx/lv_nema_gfx_path.c index 55a774b240..4f169be438 100644 --- a/src/draw/nema_gfx/lv_nema_gfx_path.c +++ b/src/draw/nema_gfx/lv_nema_gfx_path.c @@ -32,7 +32,7 @@ /********************* * INCLUDES *********************/ -#include "../../core/lv_refr.h" +#include "../../lv_public_api.h" #if LV_USE_NEMA_GFX #if LV_USE_NEMA_VG diff --git a/src/draw/nxp/g2d/lv_draw_g2d.h b/src/draw/nxp/g2d/lv_draw_g2d.h index a009334e24..905305f7c7 100644 --- a/src/draw/nxp/g2d/lv_draw_g2d.h +++ b/src/draw/nxp/g2d/lv_draw_g2d.h @@ -20,7 +20,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_G2D #if LV_USE_DRAW_G2D diff --git a/src/draw/nxp/g2d/lv_g2d_buf_map.h b/src/draw/nxp/g2d/lv_g2d_buf_map.h index 75f2f6a71c..0b75d0feec 100644 --- a/src/draw/nxp/g2d/lv_g2d_buf_map.h +++ b/src/draw/nxp/g2d/lv_g2d_buf_map.h @@ -21,12 +21,11 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_G2D #if LV_USE_DRAW_G2D -#include "../../../misc/lv_array.h" #include /********************* diff --git a/src/draw/nxp/g2d/lv_g2d_utils.h b/src/draw/nxp/g2d/lv_g2d_utils.h index d384088ea1..7fe9f02084 100644 --- a/src/draw/nxp/g2d/lv_g2d_utils.h +++ b/src/draw/nxp/g2d/lv_g2d_utils.h @@ -19,7 +19,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_G2D #if LV_USE_DRAW_G2D diff --git a/src/draw/nxp/pxp/lv_draw_pxp.c b/src/draw/nxp/pxp/lv_draw_pxp.c index 5ab12ce7a3..a72f7db925 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp.c +++ b/src/draw/nxp/pxp/lv_draw_pxp.c @@ -19,10 +19,7 @@ #if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP #include "lv_pxp_cfg.h" #include "lv_pxp_utils.h" - -#if LV_USE_PARALLEL_DRAW_DEBUG - #include "../../../core/lv_global.h" -#endif +#include "../../../core/lv_global.h" /********************* * DEFINES diff --git a/src/draw/nxp/pxp/lv_draw_pxp.h b/src/draw/nxp/pxp/lv_draw_pxp.h index a6833b585f..f0f0fdc480 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp.h +++ b/src/draw/nxp/pxp/lv_draw_pxp.h @@ -20,7 +20,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_PXP #if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP diff --git a/src/draw/nxp/pxp/lv_draw_pxp_layer.c b/src/draw/nxp/pxp/lv_draw_pxp_layer.c index 2a153d6fee..42e543a6c5 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp_layer.c +++ b/src/draw/nxp/pxp/lv_draw_pxp_layer.c @@ -18,10 +18,7 @@ #if LV_USE_PXP #if LV_USE_DRAW_PXP -#include "../../../stdlib/lv_string.h" -#if LV_USE_PARALLEL_DRAW_DEBUG - #include "../../../core/lv_global.h" -#endif +#include "../../../core/lv_global.h" /********************* * DEFINES diff --git a/src/draw/nxp/pxp/lv_pxp_cfg.h b/src/draw/nxp/pxp/lv_pxp_cfg.h index 34dccbb2f8..bee08acc1c 100644 --- a/src/draw/nxp/pxp/lv_pxp_cfg.h +++ b/src/draw/nxp/pxp/lv_pxp_cfg.h @@ -20,7 +20,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_PXP #if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP @@ -31,8 +31,6 @@ extern "C" { #error "If PXP is enabled the draw buffers should be aligned to 32-byte boundary, please set LV_DRAW_BUF_ALIGN to a multiple of 32 in lv_conf.h" #endif -#include "../../../misc/lv_log.h" - /********************* * DEFINES *********************/ diff --git a/src/draw/nxp/pxp/lv_pxp_osa.c b/src/draw/nxp/pxp/lv_pxp_osa.c index 861369dc32..27abb2431d 100644 --- a/src/draw/nxp/pxp/lv_pxp_osa.c +++ b/src/draw/nxp/pxp/lv_pxp_osa.c @@ -18,7 +18,6 @@ #if LV_USE_PXP #if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP #include "lv_pxp_utils.h" -#include "../../../misc/lv_log.h" #include "../../../osal/lv_os_private.h" #include "fsl_pxp.h" diff --git a/src/draw/nxp/pxp/lv_pxp_osa.h b/src/draw/nxp/pxp/lv_pxp_osa.h index 5e3d6669d3..1434d70994 100644 --- a/src/draw/nxp/pxp/lv_pxp_osa.h +++ b/src/draw/nxp/pxp/lv_pxp_osa.h @@ -20,7 +20,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_PXP #if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP diff --git a/src/draw/nxp/pxp/lv_pxp_utils.h b/src/draw/nxp/pxp/lv_pxp_utils.h index c9ba7bafd0..51c95d2f31 100644 --- a/src/draw/nxp/pxp/lv_pxp_utils.h +++ b/src/draw/nxp/pxp/lv_pxp_utils.h @@ -19,12 +19,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_PXP #if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP #include "fsl_pxp.h" -#include "../../../misc/lv_color.h" /********************* * DEFINES diff --git a/src/draw/opengles/lv_draw_opengles.c b/src/draw/opengles/lv_draw_opengles.c index d669762219..6b2a671d5a 100644 --- a/src/draw/opengles/lv_draw_opengles.c +++ b/src/draw/opengles/lv_draw_opengles.c @@ -17,20 +17,9 @@ #include "../lv_draw_private.h" #include "../../misc/cache/lv_cache_entry_private.h" #include "../../drivers/opengles/lv_opengles_debug.h" -#include "../../drivers/opengles/lv_opengles_texture.h" -#include "../../drivers/opengles/lv_opengles_driver.h" #include "../../drivers/opengles/lv_opengles_private.h" -#include "../../draw/lv_draw_label.h" -#include "../../draw/lv_draw_rect.h" -#include "../../draw/lv_draw_arc.h" -#include "../../draw/lv_draw_image.h" -#include "../../draw/lv_draw_triangle.h" -#include "../../draw/lv_draw_line.h" -#include "../../draw/lv_draw_3d.h" -#include "../../core/lv_obj.h" #include "../../core/lv_refr_private.h" #include "../../display/lv_display_private.h" -#include "../../stdlib/lv_string.h" #include "../../misc/lv_area_private.h" /********************* diff --git a/src/draw/opengles/lv_draw_opengles.h b/src/draw/opengles/lv_draw_opengles.h index 3c72a99670..465c638282 100644 --- a/src/draw/opengles/lv_draw_opengles.h +++ b/src/draw/opengles/lv_draw_opengles.h @@ -14,11 +14,9 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_OPENGLES -#include "../lv_draw.h" -#include "../../misc/lv_area.h" /********************* * DEFINES diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d.h b/src/draw/renesas/dave2d/lv_draw_dave2d.h index 53b613d448..b71283701e 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d.h +++ b/src/draw/renesas/dave2d/lv_draw_dave2d.h @@ -13,9 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_DRAW_DAVE2D -#include "../../lv_draw.h" #include "../../lv_draw_private.h" #include "bsp_api.h" #include "dave_driver.h" @@ -49,14 +48,6 @@ extern "C" { #endif #include "lv_draw_dave2d_utils.h" -#include "../../lv_draw_rect.h" -#include "../../lv_draw_line.h" -#include "../../lv_draw_arc.h" -#include "../../lv_draw_label.h" -#include "../../lv_draw_image.h" -#include "../../lv_draw_triangle.h" -#include "../../lv_draw_buf.h" - /********************* diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_utils.h b/src/draw/renesas/dave2d/lv_draw_dave2d_utils.h index 90a6fe4e96..4fec06dd0e 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_utils.h +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_utils.h @@ -10,6 +10,9 @@ extern "C" { #endif +#include "lv_draw_dave2d.h" +#if LV_USE_DRAW_DAVE2D + /********************* * INCLUDES *********************/ @@ -38,6 +41,7 @@ bool lv_draw_dave2d_is_dest_cf_supported(lv_color_format_t cf); * MACROS **********************/ +#endif /*LV_USE_DRAW_DAVE2D*/ #ifdef __cplusplus } /*extern "C"*/ #endif diff --git a/src/draw/sdl/lv_draw_sdl.c b/src/draw/sdl/lv_draw_sdl.c index c4f7469c61..70262de0f6 100644 --- a/src/draw/sdl/lv_draw_sdl.c +++ b/src/draw/sdl/lv_draw_sdl.c @@ -12,8 +12,6 @@ #include "lv_draw_sdl.h" #include "../../core/lv_refr_private.h" #include "../../display/lv_display_private.h" -#include "../../stdlib/lv_string.h" -#include "../../drivers/sdl/lv_sdl_window.h" #include "../../misc/cache/lv_cache_entry_private.h" #include "../../misc/lv_area_private.h" diff --git a/src/draw/sdl/lv_draw_sdl.h b/src/draw/sdl/lv_draw_sdl.h index 90ff8de3a0..a6881b8d2b 100644 --- a/src/draw/sdl/lv_draw_sdl.h +++ b/src/draw/sdl/lv_draw_sdl.h @@ -13,20 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_draw.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_SDL -#include "../../misc/lv_area.h" -#include "../../misc/lv_color.h" -#include "../../display/lv_display.h" #include "../../osal/lv_os_private.h" -#include "../../draw/lv_draw_label.h" -#include "../../draw/lv_draw_rect.h" -#include "../../draw/lv_draw_arc.h" -#include "../../draw/lv_draw_image.h" -#include "../../draw/lv_draw_triangle.h" -#include "../../draw/lv_draw_line.h" /********************* * DEFINES diff --git a/src/draw/snapshot/lv_snapshot.c b/src/draw/snapshot/lv_snapshot.c index 9a285c3a41..fd77780671 100644 --- a/src/draw/snapshot/lv_snapshot.c +++ b/src/draw/snapshot/lv_snapshot.c @@ -6,16 +6,15 @@ /********************* * INCLUDES *********************/ -#include "../../draw/lv_draw_private.h" -#include "../../core/lv_obj_draw_private.h" -#include "lv_snapshot.h" + +#include "../../lv_public_api.h" #if LV_USE_SNAPSHOT +#include "../../draw/lv_draw_private.h" +#include "../../core/lv_obj_draw_private.h" #include -#include "../../display/lv_display.h" #include "../../core/lv_refr_private.h" #include "../../display/lv_display_private.h" -#include "../../stdlib/lv_string.h" #include "../../core/lv_obj_private.h" /********************* diff --git a/src/draw/snapshot/lv_snapshot.h b/src/draw/snapshot/lv_snapshot.h index 90de106cd7..3a3d4ae60b 100644 --- a/src/draw/snapshot/lv_snapshot.h +++ b/src/draw/snapshot/lv_snapshot.h @@ -1,101 +1,2 @@ -/** - * @file lv_snapshot.h - * - */ - -#ifndef LV_SNAPSHOT_H -#define LV_SNAPSHOT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" - -#if LV_USE_SNAPSHOT - -#include -#include - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Take snapshot for object with its children, create the draw buffer as needed. - * @param obj the object to generate snapshot. - * @param cf color format for generated image. - * @return a pointer to an draw buffer containing snapshot image, or NULL if failed. - */ -lv_draw_buf_t * lv_snapshot_take(lv_obj_t * obj, lv_color_format_t cf); - -/** - * Create a draw buffer to store the snapshot image for object. - * @param obj the object to generate snapshot. - * @param cf color format for generated image. - * @return a pointer to an draw buffer ready for taking snapshot, or NULL if failed. - */ -lv_draw_buf_t * lv_snapshot_create_draw_buf(lv_obj_t * obj, lv_color_format_t cf); - -/** - * Reshape the draw buffer to prepare for taking snapshot for obj. - * This is usually used to check if the existing draw buffer is enough for - * obj snapshot. If return LV_RESULT_INVALID, you should create a new one. - * @param draw_buf the draw buffer to reshape. - * @param obj the object to generate snapshot. - */ -lv_result_t lv_snapshot_reshape_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf); - -/** - * Take snapshot for object with its children, save image info to provided buffer. - * @param obj the object to generate snapshot. - * @param cf color format for new snapshot image. - * It could differ with cf of `draw_buf` as long as the new cf will fit in. - * @param draw_buf the draw buffer to store the image result. It's reshaped automatically. - * @return LV_RESULT_OK on success, LV_RESULT_INVALID on error. - */ -lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * obj, lv_color_format_t cf, lv_draw_buf_t * draw_buf); - -/** - * @deprecated Use `lv_draw_buf_destroy` instead. - * - * Free the snapshot image returned by @ref lv_snapshot_take - * @param dsc the image descriptor generated by lv_snapshot_take. - */ -void lv_snapshot_free(lv_image_dsc_t * dsc); - -/** - * Take snapshot for object with its children, save image info to provided buffer. - * @param obj the object to generate snapshot. - * @param cf color format for generated image. - * @param dsc image descriptor to store the image result. - * @param buf the buffer to store image data. It must meet align requirement. - * @param buf_size provided buffer size in bytes. - * @return LV_RESULT_OK on success, LV_RESULT_INVALID on error. - * @deprecated Use lv_snapshot_take_to_draw_buf instead. - */ -lv_result_t lv_snapshot_take_to_buf(lv_obj_t * obj, lv_color_format_t cf, lv_image_dsc_t * dsc, - void * buf, - uint32_t buf_size); - -/********************** - * MACROS - **********************/ -#endif /*LV_USE_SNAPSHOT*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/draw/sw/arm2d/lv_draw_sw_arm2d.h b/src/draw/sw/arm2d/lv_draw_sw_arm2d.h index 3fa42677da..c7cf83ddbb 100644 --- a/src/draw/sw/arm2d/lv_draw_sw_arm2d.h +++ b/src/draw/sw/arm2d/lv_draw_sw_arm2d.h @@ -16,7 +16,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #include "../../../misc/lv_area_private.h" #include "../../../draw/lv_draw_private.h" #include "../../../draw/lv_draw_image_private.h" diff --git a/src/draw/sw/arm2d/lv_draw_sw_helium.h b/src/draw/sw/arm2d/lv_draw_sw_helium.h index c35a06eb6c..f6d8ad4981 100644 --- a/src/draw/sw/arm2d/lv_draw_sw_helium.h +++ b/src/draw/sw/arm2d/lv_draw_sw_helium.h @@ -16,7 +16,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" /* detect whether helium is available based on arm compilers' standard */ #if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE diff --git a/src/draw/sw/blend/arm2d/lv_blend_arm2d.h b/src/draw/sw/blend/arm2d/lv_blend_arm2d.h index 0eb29b853f..35d3f8176d 100644 --- a/src/draw/sw/blend/arm2d/lv_blend_arm2d.h +++ b/src/draw/sw/blend/arm2d/lv_blend_arm2d.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #if LV_USE_DRAW_ARM2D_SYNC diff --git a/src/draw/sw/blend/helium/lv_blend_helium.S b/src/draw/sw/blend/helium/lv_blend_helium.S index 5d884a86af..7723c60d41 100644 --- a/src/draw/sw/blend/helium/lv_blend_helium.S +++ b/src/draw/sw/blend/helium/lv_blend_helium.S @@ -9,7 +9,7 @@ #define __ASSEMBLY__ #endif -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM && LV_USE_NATIVE_HELIUM_ASM diff --git a/src/draw/sw/blend/helium/lv_blend_helium.h b/src/draw/sw/blend/helium/lv_blend_helium.h index ed45b2bc27..20486b8b50 100644 --- a/src/draw/sw/blend/helium/lv_blend_helium.h +++ b/src/draw/sw/blend/helium/lv_blend_helium.h @@ -19,7 +19,7 @@ extern "C" { #include "lv_conf_cmsis.h" #endif -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" /* detect whether helium is available based on arm compilers' standard */ #if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE diff --git a/src/draw/sw/blend/lv_draw_sw_blend.c b/src/draw/sw/blend/lv_draw_sw_blend.c index 54a7294acb..528141f262 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend.c +++ b/src/draw/sw/blend/lv_draw_sw_blend.c @@ -9,7 +9,6 @@ #include "../../../misc/lv_area_private.h" #include "lv_draw_sw_blend_private.h" #include "../../lv_draw_private.h" -#include "../lv_draw_sw.h" #if LV_DRAW_SW_SUPPORT_A8 #include "lv_draw_sw_blend_to_a8.h" #endif diff --git a/src/draw/sw/blend/lv_draw_sw_blend.h b/src/draw/sw/blend/lv_draw_sw_blend.h index 83970fbdad..cf7d6b9356 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend.h +++ b/src/draw/sw/blend/lv_draw_sw_blend.h @@ -13,12 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_draw_sw_mask.h" -#if LV_USE_DRAW_SW -#include "../../../misc/lv_color.h" -#include "../../../misc/lv_area.h" -#include "../../../misc/lv_style.h" +#include "../../../lv_public_api.h" + +#if LV_USE_DRAW_SW /********************* * DEFINES diff --git a/src/draw/sw/blend/lv_draw_sw_blend_private.h b/src/draw/sw/blend/lv_draw_sw_blend_private.h index 731f9ad004..b92cd4cfe4 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_private.h +++ b/src/draw/sw/blend/lv_draw_sw_blend_private.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include "lv_draw_sw_blend.h" - +#include "../lv_draw_sw_mask.h" #if LV_USE_DRAW_SW /********************* diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_a8.c b/src/draw/sw/blend/lv_draw_sw_blend_to_a8.c index 736fd9ecd1..0808cb0f46 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_a8.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_a8.c @@ -12,11 +12,6 @@ #if LV_DRAW_SW_SUPPORT_A8 #include "lv_draw_sw_blend_private.h" -#include "../../../misc/lv_math.h" -#include "../../../display/lv_display.h" -#include "../../../core/lv_refr.h" -#include "../../../misc/lv_color.h" -#include "../../../stdlib/lv_string.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c index 749be4cea8..3a2260d9aa 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c @@ -12,11 +12,6 @@ #if LV_DRAW_SW_SUPPORT_AL88 #include "lv_draw_sw_blend_private.h" -#include "../../../misc/lv_math.h" -#include "../../../display/lv_display.h" -#include "../../../core/lv_refr.h" -#include "../../../misc/lv_color.h" -#include "../../../stdlib/lv_string.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c index 5932f56f6b..0e45b1f308 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c @@ -12,11 +12,6 @@ #if LV_DRAW_SW_SUPPORT_ARGB8888 #include "lv_draw_sw_blend_private.h" -#include "../../../misc/lv_math.h" -#include "../../../display/lv_display.h" -#include "../../../core/lv_refr.h" -#include "../../../misc/lv_color.h" -#include "../../../stdlib/lv_string.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888_premultiplied.c b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888_premultiplied.c index a74863a0fe..5b10804c89 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888_premultiplied.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888_premultiplied.c @@ -12,10 +12,6 @@ #if LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED #include "lv_draw_sw_blend_private.h" -#include "../../../misc/lv_math.h" -#include "../../../display/lv_display.h" -#include "../../../core/lv_refr.h" -#include "../../../misc/lv_color.h" /********************* * DEFINES diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c b/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c index 7fe446cab3..cc561a6b80 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c @@ -10,11 +10,6 @@ #if LV_USE_DRAW_SW #include "lv_draw_sw_blend_private.h" -#include "../../../misc/lv_math.h" -#include "../../../display/lv_display.h" -#include "../../../core/lv_refr.h" -#include "../../../misc/lv_color.h" -#include "../../../stdlib/lv_string.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c index 99b438debf..ffda6d5938 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c @@ -12,11 +12,6 @@ #if LV_DRAW_SW_SUPPORT_L8 #include "lv_draw_sw_blend_private.h" -#include "../../../misc/lv_math.h" -#include "../../../display/lv_display.h" -#include "../../../core/lv_refr.h" -#include "../../../misc/lv_color.h" -#include "../../../stdlib/lv_string.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c index d2e902dc2e..cae184251a 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c @@ -12,11 +12,6 @@ #if LV_DRAW_SW_SUPPORT_RGB565 #include "lv_draw_sw_blend_private.h" -#include "../../../misc/lv_math.h" -#include "../../../display/lv_display.h" -#include "../../../core/lv_refr.h" -#include "../../../misc/lv_color.h" -#include "../../../stdlib/lv_string.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565_swapped.c b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565_swapped.c index 40e7cc2e7f..1926f06840 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565_swapped.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565_swapped.c @@ -12,11 +12,6 @@ #if LV_DRAW_SW_SUPPORT_RGB565_SWAPPED #include "lv_draw_sw_blend_private.h" -#include "../../../misc/lv_math.h" -#include "../../../display/lv_display.h" -#include "../../../core/lv_refr.h" -#include "../../../misc/lv_color.h" -#include "../../../stdlib/lv_string.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c index c92ce07df2..ec764c1c71 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c @@ -12,11 +12,6 @@ #if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888 #include "lv_draw_sw_blend_private.h" -#include "../../../misc/lv_math.h" -#include "../../../display/lv_display.h" -#include "../../../core/lv_refr.h" -#include "../../../misc/lv_color.h" -#include "../../../stdlib/lv_string.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" diff --git a/src/draw/sw/blend/neon/lv_blend_neon.h b/src/draw/sw/blend/neon/lv_blend_neon.h index 66e1e217ac..3b67d34ad9 100644 --- a/src/draw/sw/blend/neon/lv_blend_neon.h +++ b/src/draw/sw/blend/neon/lv_blend_neon.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON diff --git a/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb565.c b/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb565.c index 2b933e687b..c14719f985 100644 --- a/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb565.c +++ b/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb565.c @@ -9,8 +9,6 @@ #include "lv_draw_sw_blend_neon_to_rgb565.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON -#include "../../../../misc/lv_color.h" -#include "../../../../misc/lv_types.h" #include "../lv_draw_sw_blend_private.h" #include diff --git a/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb565.h b/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb565.h index 27fcf4b99b..00973c9d71 100644 --- a/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb565.h +++ b/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb565.h @@ -14,11 +14,9 @@ extern "C" { * INCLUDES *********************/ -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON -#include "../../../../misc/lv_types.h" - /********************* * DEFINES *********************/ diff --git a/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb888.c b/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb888.c index 9c20c522a6..fc5aa9f825 100644 --- a/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb888.c +++ b/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb888.c @@ -7,12 +7,10 @@ * INCLUDES *********************/ #include "lv_draw_sw_blend_neon_to_rgb888.h" -#include #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON -#include "../../../../misc/lv_color.h" -#include "../../../../misc/lv_types.h" #include "../lv_draw_sw_blend_private.h" +#include #include /********************* diff --git a/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb888.h b/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb888.h index 6002465480..b9b08bdf19 100644 --- a/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb888.h +++ b/src/draw/sw/blend/neon/lv_draw_sw_blend_neon_to_rgb888.h @@ -14,11 +14,9 @@ extern "C" { * INCLUDES *********************/ -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON -#include "../../../../misc/lv_types.h" - /********************* * DEFINES *********************/ diff --git a/src/draw/sw/blend/riscv_v/lv_blend_riscv_v_private.h b/src/draw/sw/blend/riscv_v/lv_blend_riscv_v_private.h index 357d4d4373..f9b7b86b7c 100644 --- a/src/draw/sw/blend/riscv_v/lv_blend_riscv_v_private.h +++ b/src/draw/sw/blend/riscv_v/lv_blend_riscv_v_private.h @@ -20,7 +20,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_RISCV_V /* Try to use real RVV, fall back to emulation if not available */ diff --git a/src/draw/sw/blend/riscv_v/lv_blend_riscv_vector_emulation.h b/src/draw/sw/blend/riscv_v/lv_blend_riscv_vector_emulation.h index 3ed621f1ef..7e50bed0a2 100644 --- a/src/draw/sw/blend/riscv_v/lv_blend_riscv_vector_emulation.h +++ b/src/draw/sw/blend/riscv_v/lv_blend_riscv_vector_emulation.h @@ -25,7 +25,7 @@ #ifdef __cplusplus extern "C" { #endif -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_RISCV_V #include diff --git a/src/draw/sw/blend/riscv_v/lv_draw_sw_blend_riscv_v_to_rgb888.c b/src/draw/sw/blend/riscv_v/lv_draw_sw_blend_riscv_v_to_rgb888.c index 37e3b4e0ad..e24f8e058e 100644 --- a/src/draw/sw/blend/riscv_v/lv_draw_sw_blend_riscv_v_to_rgb888.c +++ b/src/draw/sw/blend/riscv_v/lv_draw_sw_blend_riscv_v_to_rgb888.c @@ -15,8 +15,6 @@ #include "lv_draw_sw_blend_riscv_v_to_rgb888.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_RISCV_V -#include "../../../../misc/lv_color.h" -#include "../../../../misc/lv_types.h" #include "../lv_draw_sw_blend_private.h" #include "lv_blend_riscv_v_private.h" @@ -1640,4 +1638,4 @@ lv_result_t lv_draw_sw_blend_riscv_v_argb8888_premultiplied_to_rgb888(lv_draw_sw return LV_RESULT_OK; } -#endif /* LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_RISCV_V */ \ No newline at end of file +#endif /* LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_RISCV_V */ diff --git a/src/draw/sw/blend/riscv_v/lv_draw_sw_blend_riscv_v_to_rgb888.h b/src/draw/sw/blend/riscv_v/lv_draw_sw_blend_riscv_v_to_rgb888.h index ae887bf140..43679ac7aa 100644 --- a/src/draw/sw/blend/riscv_v/lv_draw_sw_blend_riscv_v_to_rgb888.h +++ b/src/draw/sw/blend/riscv_v/lv_draw_sw_blend_riscv_v_to_rgb888.h @@ -13,10 +13,9 @@ extern "C" { * INCLUDES *********************/ -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_RISCV_V -#include "../../../../misc/lv_types.h" /********************* * DEFINES *********************/ diff --git a/src/draw/sw/lv_draw_sw.c b/src/draw/sw/lv_draw_sw.c index efca2bdc73..80dbc334e3 100644 --- a/src/draw/sw/lv_draw_sw.c +++ b/src/draw/sw/lv_draw_sw.c @@ -10,9 +10,7 @@ #include "../lv_draw_private.h" #if LV_USE_DRAW_SW -#include "../../core/lv_refr.h" #include "../../display/lv_display_private.h" -#include "../../stdlib/lv_string.h" #include "../../core/lv_global.h" #include "../../misc/lv_area_private.h" diff --git a/src/draw/sw/lv_draw_sw.h b/src/draw/sw/lv_draw_sw.h index c874fd2ce5..554b704049 100644 --- a/src/draw/sw/lv_draw_sw.h +++ b/src/draw/sw/lv_draw_sw.h @@ -13,22 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_draw.h" +#include "../lv_draw_private.h" + #if LV_USE_DRAW_SW -#include "../../misc/lv_area.h" -#include "../../misc/lv_color.h" -#include "../../display/lv_display.h" - -#include "../lv_draw_vector.h" -#include "../lv_draw_triangle.h" -#include "../lv_draw_label.h" -#include "../lv_draw_image.h" -#include "../lv_draw_line.h" -#include "../lv_draw_mask.h" -#include "../lv_draw_arc.h" -#include "../lv_draw_blur.h" -#include "lv_draw_sw_utils.h" #include "blend/lv_draw_sw_blend.h" /********************* diff --git a/src/draw/sw/lv_draw_sw_arc.c b/src/draw/sw/lv_draw_sw_arc.c index 982200c461..2a0705508f 100644 --- a/src/draw/sw/lv_draw_sw_arc.c +++ b/src/draw/sw/lv_draw_sw_arc.c @@ -6,19 +6,17 @@ /********************* * INCLUDES *********************/ +#include "../lv_draw_private.h" + +#if LV_USE_DRAW_SW +#if LV_DRAW_SW_COMPLEX + #include "../../misc/lv_area_private.h" #include "lv_draw_sw_mask_private.h" #include "blend/lv_draw_sw_blend_private.h" #include "../lv_image_decoder_private.h" #include "lv_draw_sw.h" -#if LV_USE_DRAW_SW -#if LV_DRAW_SW_COMPLEX -#include "../../misc/lv_math.h" -#include "../../misc/lv_log.h" -#include "../../stdlib/lv_mem.h" -#include "../../stdlib/lv_string.h" -#include "../lv_draw_private.h" static void add_circle(const lv_opa_t * circle_mask, const lv_area_t * blend_area, const lv_area_t * circle_area, lv_opa_t * mask_buf, int32_t width); diff --git a/src/draw/sw/lv_draw_sw_blur.c b/src/draw/sw/lv_draw_sw_blur.c index 2bb2b0a521..ab23476cbe 100644 --- a/src/draw/sw/lv_draw_sw_blur.c +++ b/src/draw/sw/lv_draw_sw_blur.c @@ -13,10 +13,7 @@ #if LV_USE_DRAW_SW -#include "../../misc/lv_math.h" -#include "../../misc/lv_types.h" #include "../../core/lv_refr_private.h" -#include "../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/sw/lv_draw_sw_border.c b/src/draw/sw/lv_draw_sw_border.c index f27f0c3483..94146ed1a1 100644 --- a/src/draw/sw/lv_draw_sw_border.c +++ b/src/draw/sw/lv_draw_sw_border.c @@ -14,12 +14,7 @@ #if LV_USE_DRAW_SW #include "blend/lv_draw_sw_blend_private.h" -#include "../../misc/lv_math.h" #include "../../misc/lv_text_ap.h" -#include "../../core/lv_refr.h" -#include "../../misc/lv_assert.h" -#include "../../stdlib/lv_string.h" -#include "../lv_draw_mask.h" /********************* * DEFINES diff --git a/src/draw/sw/lv_draw_sw_box_shadow.c b/src/draw/sw/lv_draw_sw_box_shadow.c index ee693f5b6b..213c702801 100644 --- a/src/draw/sw/lv_draw_sw_box_shadow.c +++ b/src/draw/sw/lv_draw_sw_box_shadow.c @@ -16,11 +16,6 @@ #include "blend/lv_draw_sw_blend_private.h" #include "../../core/lv_global.h" -#include "../../misc/lv_math.h" -#include "../../core/lv_refr.h" -#include "../../misc/lv_assert.h" -#include "../../stdlib/lv_string.h" -#include "../lv_draw_mask.h" /********************* * DEFINES diff --git a/src/draw/sw/lv_draw_sw_fill.c b/src/draw/sw/lv_draw_sw_fill.c index 930457f670..f249aa5584 100644 --- a/src/draw/sw/lv_draw_sw_fill.c +++ b/src/draw/sw/lv_draw_sw_fill.c @@ -14,12 +14,7 @@ #include "blend/lv_draw_sw_blend_private.h" #include "lv_draw_sw_grad.h" -#include "../../misc/lv_math.h" #include "../../misc/lv_text_ap.h" -#include "../../core/lv_refr.h" -#include "../../misc/lv_assert.h" -#include "../../stdlib/lv_string.h" -#include "../lv_draw_mask.h" /********************* * DEFINES diff --git a/src/draw/sw/lv_draw_sw_grad.c b/src/draw/sw/lv_draw_sw_grad.c index 090f55d5c8..f87dd5b7e2 100644 --- a/src/draw/sw/lv_draw_sw_grad.c +++ b/src/draw/sw/lv_draw_sw_grad.c @@ -9,9 +9,7 @@ #include "lv_draw_sw_grad.h" #if LV_USE_DRAW_SW -#include "../../misc/lv_types.h" #include "../../osal/lv_os_private.h" -#include "../../misc/lv_math.h" /********************* * DEFINES diff --git a/src/draw/sw/lv_draw_sw_grad.h b/src/draw/sw/lv_draw_sw_grad.h index 3033119a09..386ac35c0e 100644 --- a/src/draw/sw/lv_draw_sw_grad.h +++ b/src/draw/sw/lv_draw_sw_grad.h @@ -13,8 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_color.h" -#include "../../misc/lv_style.h" +#include "lv_draw_sw.h" #if LV_USE_DRAW_SW diff --git a/src/draw/sw/lv_draw_sw_img.c b/src/draw/sw/lv_draw_sw_img.c index 047e85cd28..5954f23a4e 100644 --- a/src/draw/sw/lv_draw_sw_img.c +++ b/src/draw/sw/lv_draw_sw_img.c @@ -14,14 +14,8 @@ #include "lv_draw_sw.h" #if LV_USE_DRAW_SW -#include "../../display/lv_display.h" #include "../../display/lv_display_private.h" -#include "../../misc/lv_log.h" #include "../../core/lv_refr_private.h" -#include "../../stdlib/lv_mem.h" -#include "../../misc/lv_math.h" -#include "../../misc/lv_color.h" -#include "../../stdlib/lv_string.h" #include "../../core/lv_global.h" #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM diff --git a/src/draw/sw/lv_draw_sw_letter.c b/src/draw/sw/lv_draw_sw_letter.c index be7f92ae3a..7b8b253f63 100644 --- a/src/draw/sw/lv_draw_sw_letter.c +++ b/src/draw/sw/lv_draw_sw_letter.c @@ -20,14 +20,7 @@ #if LV_USE_DRAW_SW -#include "../../display/lv_display.h" -#include "../../misc/lv_math.h" -#include "../../misc/lv_assert.h" -#include "../../misc/lv_area.h" -#include "../../misc/lv_style.h" -#include "../../font/lv_font.h" #include "../../core/lv_refr_private.h" -#include "../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/sw/lv_draw_sw_line.c b/src/draw/sw/lv_draw_sw_line.c index bc01bab0e2..51002ae29e 100644 --- a/src/draw/sw/lv_draw_sw_line.c +++ b/src/draw/sw/lv_draw_sw_line.c @@ -14,10 +14,7 @@ #if LV_USE_DRAW_SW -#include "../../misc/lv_math.h" -#include "../../misc/lv_types.h" #include "../../core/lv_refr_private.h" -#include "../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/sw/lv_draw_sw_mask.c b/src/draw/sw/lv_draw_sw_mask.c index 68f368c296..98deb9e1a5 100644 --- a/src/draw/sw/lv_draw_sw_mask.c +++ b/src/draw/sw/lv_draw_sw_mask.c @@ -7,16 +7,10 @@ * INCLUDES *********************/ #include "lv_draw_sw_mask_private.h" -#include "../lv_draw_mask.h" -#include "../lv_draw.h" #if LV_DRAW_SW_COMPLEX #include "../../core/lv_global.h" -#include "../../misc/lv_math.h" -#include "../../misc/lv_log.h" -#include "../../misc/lv_assert.h" #include "../../osal/lv_os_private.h" -#include "../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/draw/sw/lv_draw_sw_mask.h b/src/draw/sw/lv_draw_sw_mask.h index a70ce26354..5307fae852 100644 --- a/src/draw/sw/lv_draw_sw_mask.h +++ b/src/draw/sw/lv_draw_sw_mask.h @@ -13,10 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_area.h" -#include "../../misc/lv_color.h" -#include "../../misc/lv_math.h" -#include "../../misc/lv_types.h" +#include "lv_draw_sw.h" /********************* * DEFINES diff --git a/src/draw/sw/lv_draw_sw_mask_rect.c b/src/draw/sw/lv_draw_sw_mask_rect.c index 7abb8a3ed2..4d10d4fbb1 100644 --- a/src/draw/sw/lv_draw_sw_mask_rect.c +++ b/src/draw/sw/lv_draw_sw_mask_rect.c @@ -7,15 +7,10 @@ * INCLUDES *********************/ #include "../../misc/lv_area_private.h" -#include "../lv_draw_mask.h" #include "../lv_draw_private.h" #if LV_USE_DRAW_SW #if LV_DRAW_SW_COMPLEX -#include "../../misc/lv_math.h" -#include "../../misc/lv_log.h" -#include "../../stdlib/lv_mem.h" -#include "../../stdlib/lv_string.h" #include "lv_draw_sw.h" #include "lv_draw_sw_mask_private.h" diff --git a/src/draw/sw/lv_draw_sw_transform.c b/src/draw/sw/lv_draw_sw_transform.c index 674e54d822..7a61e8fa46 100644 --- a/src/draw/sw/lv_draw_sw_transform.c +++ b/src/draw/sw/lv_draw_sw_transform.c @@ -9,12 +9,6 @@ #include "lv_draw_sw.h" #if LV_USE_DRAW_SW -#include "../../misc/lv_assert.h" -#include "../../misc/lv_area.h" -#include "../../core/lv_refr.h" -#include "../../misc/lv_color.h" -#include "../../stdlib/lv_string.h" - /********************* * DEFINES *********************/ diff --git a/src/draw/sw/lv_draw_sw_triangle.c b/src/draw/sw/lv_draw_sw_triangle.c index ec91c80a57..84ac4460d8 100644 --- a/src/draw/sw/lv_draw_sw_triangle.c +++ b/src/draw/sw/lv_draw_sw_triangle.c @@ -12,12 +12,7 @@ #include "lv_draw_sw.h" #if LV_USE_DRAW_SW -#include "../../misc/lv_math.h" -#include "../../stdlib/lv_mem.h" #include "../../misc/lv_area_private.h" -#include "../../misc/lv_color.h" -#include "../../stdlib/lv_string.h" -#include "../lv_draw_triangle_private.h" #include "lv_draw_sw_grad.h" /********************* diff --git a/src/draw/sw/lv_draw_sw_utils.c b/src/draw/sw/lv_draw_sw_utils.c index 0f2635a653..e6cffd6564 100644 --- a/src/draw/sw/lv_draw_sw_utils.c +++ b/src/draw/sw/lv_draw_sw_utils.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_draw_sw_utils.h" +#include "lv_draw_sw.h" #if LV_USE_DRAW_SW /********************* diff --git a/src/draw/sw/lv_draw_sw_utils.h b/src/draw/sw/lv_draw_sw_utils.h index cf47892237..ed9faba16f 100644 --- a/src/draw/sw/lv_draw_sw_utils.h +++ b/src/draw/sw/lv_draw_sw_utils.h @@ -1,111 +1,2 @@ -/** - * @file lv_draw_sw_utils.h - * - */ - -#ifndef LV_DRAW_SW_UTILS_H -#define LV_DRAW_SW_UTILS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_DRAW_SW - -#include "../../misc/lv_area.h" -#include "../../misc/lv_color.h" -#include "../../display/lv_display.h" - - -/********************* - * DEFINES - *********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Converts an I1 buffer to ARGB8888 format. - * @param buf_i1 pointer to buffer with I1 formatted render - * @param buf_argb8888 pointer to buffer for ARGB8888 render - * @param width width in pixels of the area. - * must be a multiple of 8. - * @param height height in pixels of the area - * @param buf_i1_stride stride of i1 buffer in bytes - * @param buf_argb8888_stride stride of argb8888 buffer in bytes - * @param index0_color color of the 0 bits of i1 buf - * @param index1_color color of the 1 bits of i1 buf - */ -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); - -/** - * 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. - * @param buf pointer to buffer - * @param buf_size_px number of pixels in the buffer - */ -void lv_draw_sw_rgb565_swap(void * buf, uint32_t buf_size_px); - -/** - * 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. - * @param buf pointer to the buffer to be inverted - * @param buf_size size of the buffer in bytes - */ -void lv_draw_sw_i1_invert(void * buf, uint32_t buf_size); - - -/** - * 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. - * @param buf pointer to the buffer to be converted - * @param buf_size size of the buffer in bytes - * @param width width of the buffer - * @param height height of the buffer - * @param out_buf pointer to the output buffer - * @param out_buf_size size of the output buffer in bytes - * @param bit_order_lsb bit order of the resulting vtiled buffer - */ -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); - -/** - * Rotate a buffer into another buffer - * @param src the source buffer - * @param dest the destination buffer - * @param src_width source width in pixels - * @param src_height source height in pixels - * @param src_stride source stride in bytes (number of bytes in a row) - * @param dest_stride destination stride in bytes (number of bytes in a row) - * @param rotation LV_DISPLAY_ROTATION_0/90/180/270 - * @param color_format LV_COLOR_FORMAT_RGB565/RGB888/XRGB8888/ARGB8888 - */ -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); - -/*********************** - * GLOBAL VARIABLES - ***********************/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_DRAW_SW*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_SW_UTILS_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/draw/sw/lv_draw_sw_vector.c b/src/draw/sw/lv_draw_sw_vector.c index 114d1cd2fe..e083031d18 100644 --- a/src/draw/sw/lv_draw_sw_vector.c +++ b/src/draw/sw/lv_draw_sw_vector.c @@ -17,7 +17,6 @@ #else #include "../../libs/thorvg/thorvg_capi.h" #endif -#include "../../stdlib/lv_string.h" #include "blend/lv_draw_sw_blend_private.h" #include "blend/lv_draw_sw_blend_to_rgb565.h" #include "blend/lv_draw_sw_blend_to_rgb888.h" diff --git a/src/draw/vg_lite/lv_draw_vg_lite.h b/src/draw/vg_lite/lv_draw_vg_lite.h index 135f003d2e..59f0bf4349 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite.h +++ b/src/draw/vg_lite/lv_draw_vg_lite.h @@ -13,18 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE -#include "../../draw/lv_draw_vector.h" -#include "../../draw/lv_draw_arc.h" -#include "../../draw/lv_draw_rect.h" -#include "../../draw/lv_draw_image.h" -#include "../../draw/lv_draw_label.h" -#include "../../draw/lv_draw_line.h" -#include "../../draw/lv_draw_triangle.h" - /********************* * DEFINES *********************/ diff --git a/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c b/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c index cd3d755cac..a371794270 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c @@ -15,7 +15,6 @@ #include "lv_draw_vg_lite_type.h" #include "lv_vg_lite_path.h" #include "../../misc/lv_area_private.h" -#include "../lv_draw_mask.h" /********************* * DEFINES diff --git a/src/draw/vg_lite/lv_draw_vg_lite_type.h b/src/draw/vg_lite/lv_draw_vg_lite_type.h index bb3ef9663a..0c0e0803cb 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_type.h +++ b/src/draw/vg_lite/lv_draw_vg_lite_type.h @@ -14,12 +14,11 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE #include "../lv_draw_private.h" -#include "../../misc/lv_array.h" #if LV_USE_VG_LITE_THORVG #include "../../debugging/vg_lite_tvg/vg_lite.h" diff --git a/src/draw/vg_lite/lv_vg_lite_bitmap_font_cache.h b/src/draw/vg_lite/lv_vg_lite_bitmap_font_cache.h index dac0c3c870..18e51a75b4 100644 --- a/src/draw/vg_lite/lv_vg_lite_bitmap_font_cache.h +++ b/src/draw/vg_lite/lv_vg_lite_bitmap_font_cache.h @@ -14,12 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE -#include "../../font/lv_font.h" - /********************* * DEFINES *********************/ diff --git a/src/draw/vg_lite/lv_vg_lite_decoder.c b/src/draw/vg_lite/lv_vg_lite_decoder.c index 125a703276..533c3adf0f 100644 --- a/src/draw/vg_lite/lv_vg_lite_decoder.c +++ b/src/draw/vg_lite/lv_vg_lite_decoder.c @@ -14,7 +14,6 @@ #include "lv_vg_lite_utils.h" #include "../../core/lv_global.h" #include "../lv_image_decoder_private.h" -#include "../../libs/bin_decoder/lv_bin_decoder.h" /********************* * DEFINES diff --git a/src/draw/vg_lite/lv_vg_lite_decoder.h b/src/draw/vg_lite/lv_vg_lite_decoder.h index 36ba2152df..3d068d6ebd 100644 --- a/src/draw/vg_lite/lv_vg_lite_decoder.h +++ b/src/draw/vg_lite/lv_vg_lite_decoder.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE diff --git a/src/draw/vg_lite/lv_vg_lite_grad.h b/src/draw/vg_lite/lv_vg_lite_grad.h index c82b9ee92a..c55fa48759 100644 --- a/src/draw/vg_lite/lv_vg_lite_grad.h +++ b/src/draw/vg_lite/lv_vg_lite_grad.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE && LV_USE_VECTOR_GRAPHIC diff --git a/src/draw/vg_lite/lv_vg_lite_math.h b/src/draw/vg_lite/lv_vg_lite_math.h index e2afc7937f..cfd1beb358 100644 --- a/src/draw/vg_lite/lv_vg_lite_math.h +++ b/src/draw/vg_lite/lv_vg_lite_math.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE diff --git a/src/draw/vg_lite/lv_vg_lite_pending.c b/src/draw/vg_lite/lv_vg_lite_pending.c index 8bf5a3f5d6..141701a218 100644 --- a/src/draw/vg_lite/lv_vg_lite_pending.c +++ b/src/draw/vg_lite/lv_vg_lite_pending.c @@ -11,9 +11,6 @@ #if LV_USE_DRAW_VG_LITE -#include "../../misc/lv_assert.h" -#include "../../misc/lv_array.h" - /********************* * DEFINES *********************/ diff --git a/src/draw/vg_lite/lv_vg_lite_pending.h b/src/draw/vg_lite/lv_vg_lite_pending.h index feb74c11ce..618d7b55f4 100644 --- a/src/draw/vg_lite/lv_vg_lite_pending.h +++ b/src/draw/vg_lite/lv_vg_lite_pending.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE diff --git a/src/draw/vg_lite/lv_vg_lite_stroke.h b/src/draw/vg_lite/lv_vg_lite_stroke.h index 81c7e510dd..56e207157b 100644 --- a/src/draw/vg_lite/lv_vg_lite_stroke.h +++ b/src/draw/vg_lite/lv_vg_lite_stroke.h @@ -18,6 +18,8 @@ extern "C" { #if LV_USE_DRAW_VG_LITE && LV_USE_VECTOR_GRAPHIC +#include "../../misc/cache/lv_cache_entry.h" + /********************* * DEFINES *********************/ diff --git a/src/draw/vg_lite/lv_vg_lite_utils.c b/src/draw/vg_lite/lv_vg_lite_utils.c index ab7f556e67..dd7b1e7ff4 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.c +++ b/src/draw/vg_lite/lv_vg_lite_utils.c @@ -17,8 +17,6 @@ #include "lv_vg_lite_pending.h" #include "lv_vg_lite_grad.h" #include "../../misc/lv_area_private.h" -#include "../../display/lv_display.h" -#include "../../draw/lv_draw_image.h" #include "../lv_image_decoder_private.h" #include diff --git a/src/draw/vg_lite/lv_vg_lite_utils.h b/src/draw/vg_lite/lv_vg_lite_utils.h index f51877b9f6..1c44ae8f84 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.h +++ b/src/draw/vg_lite/lv_vg_lite_utils.h @@ -14,15 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_VG_LITE -#include "../../misc/lv_profiler.h" -#include "../../misc/lv_area.h" -#include "../../misc/lv_style.h" -#include "../../misc/lv_matrix.h" - #if LV_USE_VG_LITE_THORVG #include "../../debugging/vg_lite_tvg/vg_lite.h" #else diff --git a/src/drivers/display/drm/lv_linux_drm.c b/src/drivers/display/drm/lv_linux_drm.c index 2a6ca6ed0b..ca1b0aa0bf 100644 --- a/src/drivers/display/drm/lv_linux_drm.c +++ b/src/drivers/display/drm/lv_linux_drm.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_linux_drm.h" +#include "../../../lv_public_api.h" #if LV_USE_LINUX_DRM && !LV_LINUX_DRM_USE_EGL #include @@ -22,9 +22,6 @@ #include #include -#include "../../../stdlib/lv_sprintf.h" -#include "../../../draw/lv_draw_buf.h" - #if LV_USE_LINUX_DRM_GBM_BUFFERS #include #include diff --git a/src/drivers/display/drm/lv_linux_drm.h b/src/drivers/display/drm/lv_linux_drm.h index fee15c9773..926bdf1297 100644 --- a/src/drivers/display/drm/lv_linux_drm.h +++ b/src/drivers/display/drm/lv_linux_drm.h @@ -1,131 +1,2 @@ -/** - * @file lv_linux_drm.h - * - */ - -#ifndef LV_LINUX_DRM_H -#define LV_LINUX_DRM_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../display/lv_display.h" - -#if LV_USE_LINUX_DRM -#include - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef drmModeModeInfo lv_linux_drm_mode_t; - -/** - * Callback function type for selecting a DRM display mode - * @param disp pointer to the display object - * @param modes array of available DRM modes - * @param mode_count number of modes in the array - * @return index of the selected mode from the modes array - */ -typedef size_t (*lv_linux_drm_select_mode_cb_t)(lv_display_t * disp, - const lv_linux_drm_mode_t * modes, - size_t mode_count); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Create a new Linux DRM display - * - * Creates and initializes a new LVGL display using the Linux DRM (Direct Rendering Manager) - * subsystem for hardware-accelerated graphics output. - * - * @return Pointer to the created display object, or NULL on failure - */ -lv_display_t * lv_linux_drm_create(void); - -/** - * @brief Configure the DRM device file and connector for a display - * - * Sets the DRM device file path and connector ID to use for the specified display. - * The DRM device file is typically located at /dev/dri/cardN where N is the card number. - * The connector ID specifies which physical output (HDMI, VGA, etc.) to use. - * - * @param disp Pointer to the display object created with lv_linux_drm_create() - * @param file Path to the DRM device file (e.g., "/dev/dri/card0") - * @param connector_id ID of the DRM connector to use, or -1 to auto-select the first available - * @return LV_RESULT_OK if the initialization succeeded or LV_RESULT_INVALID if it failed - */ -lv_result_t lv_linux_drm_set_file(lv_display_t * disp, const char * file, int64_t connector_id); - -/** - * @brief Automatically find a suitable DRM device path - * - * Scans the system for available DRM devices and returns the path to a suitable - * device file that can be used with lv_linux_drm_set_file(). - * - * @return Dynamically allocated string containing the device path (must be freed with lv_free()), - * or NULL if no suitable device is found - */ -char * lv_linux_drm_find_device_path(void); - -/** - * Set a callback function for custom DRM mode selection to override the default mode selection behavior - * - * The default mode selection behavior is selecting the native mode - * - * @param disp pointer to the display object - * @param callback function to be called when a display mode needs to be selected, - * or NULL to use the default mode selection behavior - */ -void lv_linux_drm_set_mode_cb(lv_display_t * disp, lv_linux_drm_select_mode_cb_t callback); - -/** - * Get the horizontal resolution of a DRM mode - * @param mode pointer to the DRM mode object - * @return horizontal resolution in pixels, or 0 if mode is invalid - */ -int32_t lv_linux_drm_mode_get_horizontal_resolution(const lv_linux_drm_mode_t * mode); - -/** - * Get the vertical resolution of a DRM mode - * @param mode pointer to the DRM mode object - * @return vertical resolution in pixels, or 0 if mode is invalid - */ -int32_t lv_linux_drm_mode_get_vertical_resolution(const lv_linux_drm_mode_t * mode); - -/** - * Get the refresh rate of a DRM mode - * @param mode pointer to the DRM mode object - * @return refresh rate in Hz, or 0 if mode is invalid - */ -int32_t lv_linux_drm_mode_get_refresh_rate(const lv_linux_drm_mode_t * mode); - -/** - * Check if a DRM mode is the preferred mode for the display - * @param mode pointer to the DRM mode object - * @return true if this is the preferred/native mode, false otherwise - */ -bool lv_linux_drm_mode_is_preferred(const lv_linux_drm_mode_t * mode); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_LINUX_DRM */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_LINUX_DRM_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/drm/lv_linux_drm_common.c b/src/drivers/display/drm/lv_linux_drm_common.c index 0fecb501ab..24e2c4b2ce 100644 --- a/src/drivers/display/drm/lv_linux_drm_common.c +++ b/src/drivers/display/drm/lv_linux_drm_common.c @@ -7,16 +7,13 @@ * INCLUDES *********************/ -#include "lv_linux_drm.h" +#include "../../../lv_public_api.h" #if LV_USE_LINUX_DRM #include #include -#include "lv_linux_drm.h" -#include "../../../stdlib/lv_sprintf.h" - /********************* * DEFINES *********************/ diff --git a/src/drivers/display/drm/lv_linux_drm_egl.c b/src/drivers/display/drm/lv_linux_drm_egl.c index 64253412f6..3c1ae10343 100644 --- a/src/drivers/display/drm/lv_linux_drm_egl.c +++ b/src/drivers/display/drm/lv_linux_drm_egl.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_linux_drm.h" +#include "../../../lv_public_api.h" #if LV_USE_LINUX_DRM && LV_LINUX_DRM_USE_EGL @@ -21,16 +21,9 @@ #include #include #include "lv_linux_drm_egl_private.h" -#include "../../../draw/lv_draw_buf.h" #include "../../opengles/lv_opengles_debug.h" - -#include "../../opengles/lv_opengles_driver.h" -#include "../../opengles/lv_opengles_texture.h" #include "../../opengles/lv_opengles_private.h" -#include "../../../stdlib/lv_string.h" -#include "../../../display/lv_display.h" - /********************** * TYPEDEFS **********************/ diff --git a/src/drivers/display/drm/lv_linux_drm_egl_private.h b/src/drivers/display/drm/lv_linux_drm_egl_private.h index f94572f41a..04668a1a84 100644 --- a/src/drivers/display/drm/lv_linux_drm_egl_private.h +++ b/src/drivers/display/drm/lv_linux_drm_egl_private.h @@ -15,7 +15,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_LINUX_DRM && LV_LINUX_DRM_USE_EGL @@ -23,7 +23,6 @@ extern "C" { #include "../../opengles/lv_opengles_texture_private.h" #include "../../opengles/lv_opengles_egl.h" #include "../../opengles/lv_opengles_egl_private.h" -#include "lv_linux_drm.h" /********************* * DEFINES diff --git a/src/drivers/display/fb/lv_linux_fbdev.c b/src/drivers/display/fb/lv_linux_fbdev.c index c78b881f82..b0b8c0171f 100644 --- a/src/drivers/display/fb/lv_linux_fbdev.c +++ b/src/drivers/display/fb/lv_linux_fbdev.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_linux_fbdev.h" +#include "../../../lv_public_api.h" #if LV_USE_LINUX_FBDEV #include diff --git a/src/drivers/display/fb/lv_linux_fbdev.h b/src/drivers/display/fb/lv_linux_fbdev.h index a9b7be0759..2ec54db36d 100644 --- a/src/drivers/display/fb/lv_linux_fbdev.h +++ b/src/drivers/display/fb/lv_linux_fbdev.h @@ -1,52 +1,2 @@ -/** - * @file lv_linux_fbdev.h - * - */ - -#ifndef LV_LINUX_FBDEV_H -#define LV_LINUX_FBDEV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../display/lv_display.h" - -#if LV_USE_LINUX_FBDEV - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -lv_display_t * lv_linux_fbdev_create(void); - -lv_result_t lv_linux_fbdev_set_file(lv_display_t * disp, const char * file); - -/** - * Force the display to be refreshed on every change. - * Expected to be used with LV_DISPLAY_RENDER_MODE_DIRECT or LV_DISPLAY_RENDER_MODE_FULL. - */ -void lv_linux_fbdev_set_force_refresh(lv_display_t * disp, bool enabled); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_LINUX_FBDEV */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_LINUX_FBDEV_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/ft81x/lv_ft81x.c b/src/drivers/display/ft81x/lv_ft81x.c index 2013d4a1c8..443b7a69a6 100644 --- a/src/drivers/display/ft81x/lv_ft81x.c +++ b/src/drivers/display/ft81x/lv_ft81x.c @@ -7,15 +7,11 @@ * INCLUDES *********************/ -#include "lv_ft81x.h" +#include "../../../lv_public_api.h" #if LV_USE_FT81X #include "lv_ft81x_defines.h" -#include "../../../stdlib/lv_mem.h" -#include "../../../stdlib/lv_sprintf.h" -#include "../../../stdlib/lv_string.h" -#include "../../../misc/lv_types.h" #include "../../../misc/lv_utils.h" /********************* diff --git a/src/drivers/display/ft81x/lv_ft81x.h b/src/drivers/display/ft81x/lv_ft81x.h index 05899ee029..c2cd940255 100644 --- a/src/drivers/display/ft81x/lv_ft81x.h +++ b/src/drivers/display/ft81x/lv_ft81x.h @@ -1,94 +1,2 @@ -/** - * @file lv_ft81x.h - * - */ - -#ifndef LV_FT81X_H -#define LV_FT81X_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" -#if LV_USE_FT81X - -#include "../../../display/lv_display.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - uint16_t hor_res; /**< active display width */ - uint16_t ver_res; /**< active display height */ - - uint16_t hcycle; /**< total number of clocks per line, incl front/back porch */ - uint16_t hoffset; /**< start of active line */ - uint16_t hsync0; /**< start of horizontal sync pulse */ - uint16_t hsync1; /**< end of horizontal sync pulse */ - uint16_t vcycle; /**< total number of lines per screen, including pre/post */ - uint16_t voffset; /**< start of active screen */ - uint16_t vsync0; /**< start of vertical sync pulse */ - uint16_t vsync1; /**< end of vertical sync pulse */ - uint8_t swizzle; /**< FT8xx output to LCD - pin order */ - uint8_t pclkpol; /**< LCD data is clocked in on this PCLK edge */ - uint8_t cspread; /**< helps with noise, when set to 1 fewer signals are changed simultaneously, reset-default: 1 */ - uint8_t pclk; /**< 60MHz / pclk = pclk frequency */ - - bool has_crystal; /**< has an external clock crystal */ - bool is_bt81x; /**< is a BT series model, not FT */ -} lv_ft81x_parameters_t; - -typedef enum { - LV_FT81X_SPI_OPERATION_CS_ASSERT, - LV_FT81X_SPI_OPERATION_CS_DEASSERT, - LV_FT81X_SPI_OPERATION_SEND, - LV_FT81X_SPI_OPERATION_RECEIVE -} lv_ft81x_spi_operation_t; - -typedef void (*lv_ft81x_spi_cb_t)(lv_display_t * disp, lv_ft81x_spi_operation_t operation, void * data, - uint32_t length); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a framebuffer-based ft81x driver display. - * @param params pointer to a struct of display panel properties. does not need to be static. - * @param partial_buf a single partial buffer - * @param buf_size size of the partial buffer - * @param spi_cb a callback called by the driver to perform SPI operations - * @param user_data use `lv_ft81x_get_user_data` to get this pointer inside the SPI callback - * @return pointer to the display - */ -lv_display_t * lv_ft81x_create(const lv_ft81x_parameters_t * params, void * partial_buf, uint32_t buf_size, - lv_ft81x_spi_cb_t spi_cb, void * user_data); - -/** - * Get the `user_data` parameter that was passed to `lv_ft81x_create`. Useful in the SPI callback. - * @param disp pointer to the ft81x display - * @return the `user_data` pointer - */ -void * lv_ft81x_get_user_data(lv_display_t * disp); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_FT81X*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_FT81X_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/ili9341/lv_ili9341.c b/src/drivers/display/ili9341/lv_ili9341.c index a6b2acf7e1..25301af6d7 100644 --- a/src/drivers/display/ili9341/lv_ili9341.c +++ b/src/drivers/display/ili9341/lv_ili9341.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_ili9341.h" +#include "../../../lv_public_api.h" #if LV_USE_ILI9341 diff --git a/src/drivers/display/ili9341/lv_ili9341.h b/src/drivers/display/ili9341/lv_ili9341.h index 90fe5dafa5..c9ca277c4e 100644 --- a/src/drivers/display/ili9341/lv_ili9341.h +++ b/src/drivers/display/ili9341/lv_ili9341.h @@ -1,94 +1,2 @@ -/** - * @file lv_ili9341.h - * - * This driver is just a wrapper around the generic MIPI compatible LCD controller driver - * - */ - -#ifndef LV_ILI9341_H -#define LV_ILI9341_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../lcd/lv_lcd_generic_mipi.h" - -#if LV_USE_ILI9341 - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef lv_lcd_send_cmd_cb_t lv_ili9341_send_cmd_cb_t; -typedef lv_lcd_send_color_cb_t lv_ili9341_send_color_cb_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an LCD display with ILI9341 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ -lv_display_t * lv_ili9341_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_ili9341_send_cmd_cb_t send_cmd_cb, lv_ili9341_send_color_cb_t send_color_cb); - -/** - * Set gap, i.e., the offset of the (0,0) pixel in the VRAM - * @param disp display object - * @param x x offset - * @param y y offset - */ -void lv_ili9341_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); - -/** - * Set color inversion - * @param disp display object - * @param invert false: normal, true: invert - */ -void lv_ili9341_set_invert(lv_display_t * disp, bool invert); - -/** - * Set gamma curve - * @param disp display object - * @param gamma gamma curve - */ -void lv_ili9341_set_gamma_curve(lv_display_t * disp, uint8_t gamma); - -/** - * Send list of commands. - * @param disp display object - * @param cmd_list controller and panel-specific commands - */ -void lv_ili9341_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); - -/********************** - * OTHERS - **********************/ - -/********************** - * MACROS - **********************/ - - -#endif /*LV_USE_ILI9341*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ILI9341_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/lcd/lv_lcd_generic_mipi.c b/src/drivers/display/lcd/lv_lcd_generic_mipi.c index 05edf3aa7a..cceebadaab 100644 --- a/src/drivers/display/lcd/lv_lcd_generic_mipi.c +++ b/src/drivers/display/lcd/lv_lcd_generic_mipi.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_lcd_generic_mipi.h" +#include "../../../lv_public_api.h" #if LV_USE_GENERIC_MIPI diff --git a/src/drivers/display/lcd/lv_lcd_generic_mipi.h b/src/drivers/display/lcd/lv_lcd_generic_mipi.h index 4c1422b520..7102e12f28 100644 --- a/src/drivers/display/lcd/lv_lcd_generic_mipi.h +++ b/src/drivers/display/lcd/lv_lcd_generic_mipi.h @@ -1,243 +1,2 @@ -/** - * @file lv_lcd_generic_mipi.h - * - * Generic driver for controllers adhering to the MIPI DBI/DCS specification - * - * Works with: - * - * ST7735 - * ST7789 - * ST7796 - * ILI9341 - * ILI9488 (NOTE: in SPI mode ILI9488 only supports RGB666 mode, which is currently not supported) - * - * any probably many more - * - */ - -#ifndef LV_LCD_GENERIC_MIPI_H -#define LV_LCD_GENERIC_MIPI_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../display/lv_display.h" - -#if LV_USE_GENERIC_MIPI - -/********************* - * DEFINES - *********************/ - -/* MIPI DCS (Display Command Set) v1.02.00 User Command Set */ -#define LV_LCD_CMD_NOP 0x00 /* No Operation */ -#define LV_LCD_CMD_SOFT_RESET 0x01 /* Software Reset */ -#define LV_LCD_CMD_GET_POWER_MODE 0x0A /* Get the current power mode */ -#define LV_LCD_CMD_GET_ADDRESS_MODE 0x0B /* Get the data order for transfers from the Host to the display module and from the frame memory to the display device */ -#define LV_LCD_CMD_GET_PIXEL_FORMAT 0x0C /* Get the current pixel format */ -#define LV_LCD_CMD_GET_DISPLAY_MODE 0x0D /* Get the current display mode from the peripheral */ -#define LV_LCD_CMD_GET_SIGNAL_MODE 0x0E /* Get display module signaling mode */ -#define LV_LCD_CMD_GET_DIAGNOSTIC_RESULT 0x0F /* Get Peripheral Self-Diagnostic Result */ -#define LV_LCD_CMD_ENTER_SLEEP_MODE 0x10 /* Power for the display panel is off */ -#define LV_LCD_CMD_EXIT_SLEEP_MODE 0x11 /* Power for the display panel is on */ -#define LV_LCD_CMD_ENTER_PARTIAL_MODE 0x12 /* Part of the display area is used for image display */ -#define LV_LCD_CMD_ENTER_NORMAL_MODE 0x13 /* The whole display area is used for image display */ -#define LV_LCD_CMD_EXIT_INVERT_MODE 0x20 /* Displayed image colors are not inverted */ -#define LV_LCD_CMD_ENTER_INVERT_MODE 0x21 /* Displayed image colors are inverted */ -#define LV_LCD_CMD_SET_GAMMA_CURVE 0x26 /* Selects the gamma curve used by the display device */ -#define LV_LCD_CMD_SET_DISPLAY_OFF 0x28 /* Blanks the display device */ -#define LV_LCD_CMD_SET_DISPLAY_ON 0x29 /* Show the image on the display device */ -#define LV_LCD_CMD_SET_COLUMN_ADDRESS 0x2A /* Set the column extent */ -#define LV_LCD_CMD_SET_PAGE_ADDRESS 0x2B /* Set the page extent */ -#define LV_LCD_CMD_WRITE_MEMORY_START 0x2C /* Transfer image data from the Host Processor to the peripheral starting at the location provided by set_column_address and set_page_address */ -#define LV_LCD_CMD_READ_MEMORY_START 0x2E /* Transfer image data from the peripheral to the Host Processor interface starting at the location provided by set_column_address and set_page_address */ -#define LV_LCD_CMD_SET_PARTIAL_ROWS 0x30 /* Defines the number of rows in the partial display area on the display device */ -#define LV_LCD_CMD_SET_PARTIAL_COLUMNS 0x31 /* Defines the number of columns in the partial display area on the display device */ -#define LV_LCD_CMD_SET_SCROLL_AREA 0x33 /* Defines the vertical scrolling and fixed area on display device */ -#define LV_LCD_CMD_SET_TEAR_OFF 0x34 /* Synchronization information is not sent from the display module to the host processor */ -#define LV_LCD_CMD_SET_TEAR_ON 0x35 /* Synchronization information is sent from the display module to the host processor at the start of VFP */ -#define LV_LCD_CMD_SET_ADDRESS_MODE 0x36 /* Set the data order for transfers from the Host to the display module and from the frame memory to the display device */ -#define LV_LCD_CMD_SET_SCROLL_START 0x37 /* Defines the vertical scrolling starting point */ -#define LV_LCD_CMD_EXIT_IDLE_MODE 0x38 /* Full color depth is used on the display panel */ -#define LV_LCD_CMD_ENTER_IDLE_MODE 0x39 /* Reduced color depth is used on the display panel */ -#define LV_LCD_CMD_SET_PIXEL_FORMAT 0x3A /* Defines how many bits per pixel are used in the interface */ -#define LV_LCD_CMD_WRITE_MEMORY_CONTINUE 0x3C /* Transfer image information from the Host Processor interface to the peripheral from the last written location */ -#define LV_LCD_CMD_READ_MEMORY_CONTINUE 0x3E /* Read image data from the peripheral continuing after the last read_memory_continue or read_memory_start */ -#define LV_LCD_CMD_SET_TEAR_SCANLINE 0x44 /* Synchronization information is sent from the display module to the host processor when the display device refresh reaches the provided scanline */ -#define LV_LCD_CMD_GET_SCANLINE 0x45 /* Get the current scanline */ -#define LV_LCD_CMD_READ_DDB_CONTINUE 0xA8 /* Continue reading the DDB from the last read location */ -#define LV_LCD_CMD_READ_DDB_START 0xA1 /* Read the DDB from the provided location */ - -/* address mode flag masks */ -#define LV_LCD_MASK_FLIP_VERTICAL (1 << 0) /* This bit flips the image shown on the display device top to bottom. No change is made to the frame memory */ -#define LV_LCD_MASK_FLIP_HORIZONTAL (1 << 1) /* This bit flips the image shown on the display device left to right. No change is made to the frame memory */ -#define LV_LCD_MASK_DATA_LATCH_DATA_ORDER (1 << 2) /* Display Data Latch Order */ -#define LV_LCD_MASK_RGB_ORDER (1 << 3) /* RGB/BGR Order */ -#define LV_LCD_MASK_LINE_ADDRESS_ORDER (1 << 4) /* Line Address Order */ -#define LV_LCD_MASK_PAGE_COLUMN_ORDER (1 << 5) /* Page/Column Order */ -#define LV_LCD_MASK_COLUMN_ADDRESS_ORDER (1 << 6) /* Column Address Order */ -#define LV_LCD_MASK_PAGE_ADDRESS_ORDER (1 << 7) /* Page Address Order */ - -#define LV_LCD_BIT_FLIP_VERTICAL__NOT_FLIPPED 0 -#define LV_LCD_BIT_FLIP_VERTICAL__FLIPPED LV_LCD_MASK_FLIP_VERTICAL /* This bit flips the image shown on the display device top to bottom. No change is made to the frame memory */ -#define LV_LCD_BIT_FLIP_HORIZONTAL__NOT_FLIPPED 0 -#define LV_LCD_BIT_FLIP_HORIZONTAL__FLIPPED LV_LCD_MASK_FLIP_HORIZONTAL /* This bit flips the image shown on the display device left to right. No change is made to the frame memory */ -#define LV_LCD_BIT_DATA_LATCH_DATA_ORDER__LTOR 0 /* Display Data Latch Order: LCD Refresh Left to Right */ -#define LV_LCD_BIT_DATA_LATCH_DATA_ORDER__RTOL LV_LCD_MASK_DATA_LATCH_DATA_ORDER /* Display Data Latch Order: LCD Refresh Right to Left */ -#define LV_LCD_BIT_RGB_ORDER__RGB 0 /* RGB/BGR Order: RGB */ -#define LV_LCD_BIT_RGB_ORDER__BGR LV_LCD_MASK_RGB_ORDER /* RGB/BGR Order: BGR */ -#define LV_LCD_BIT_LINE_ADDRESS_ORDER__TTOB 0 /* Line Address Order: LCD Refresh Top to Bottom */ -#define LV_LCD_BIT_LINE_ADDRESS_ORDER__BTOT LV_LCD_MASK_LINE_ADDRESS_ORDER /* Line Address Order: LCD Refresh Bottom to Top */ -#define LV_LCD_BIT_PAGE_COLUMN_ORDER__NORMAL 0 /* Page/Column Order: Normal Mode */ -#define LV_LCD_BIT_PAGE_COLUMN_ORDER__REVERSE LV_LCD_MASK_PAGE_COLUMN_ORDER /* Page/Column Order: Reverse Mode */ -#define LV_LCD_BIT_COLUMN_ADDRESS_ORDER__LTOR 0 /* Column Address Order: Left to Right */ -#define LV_LCD_BIT_COLUMN_ADDRESS_ORDER__RTOL LV_LCD_MASK_COLUMN_ADDRESS_ORDER /* Column Address Order: Right to Left */ -#define LV_LCD_BIT_PAGE_ADDRESS_ORDER__TTOB 0 /* Page Address Order: Top to Bottom */ -#define LV_LCD_BIT_PAGE_ADDRESS_ORDER__BTOT LV_LCD_MASK_PAGE_ADDRESS_ORDER /* Page Address Order: Bottom to Top */ - -/* predefined gamma curves */ -#define LV_LCD_GAMMA_2_2 0x01 /* 2.2 */ -#define LV_LCD_GAMMA_1_8 0x02 /* 1.8 */ -#define LV_LCD_GAMMA_2_5 0x04 /* 2.5 */ -#define LV_LCD_GAMMA_1_0 0x08 /* 1.0 */ - -/* common pixel formats */ -#define LV_LCD_PIXEL_FORMAT_RGB565 0x55 /* bus: 16 bits, pixel: 16 bits */ -#define LV_LCD_PIXEL_FORMAT_RGB666 0x66 /* bus: 18 bits, pixel: 18 bits */ - -/* flags for lv_lcd_xxx_create() */ -#define LV_LCD_FLAG_NONE 0x00000000UL -#define LV_LCD_FLAG_MIRROR_X 0x00000001UL -#define LV_LCD_FLAG_MIRROR_Y 0x00000002UL -#define LV_LCD_FLAG_BGR 0x00000008UL -#define LV_LCD_FLAG_RGB666 0x00000010UL - -/* command list */ -#define LV_LCD_CMD_DELAY_MS 0xff -#define LV_LCD_CMD_EOF 0xff - -/********************** - * TYPEDEFS - **********************/ - -/** - * Configuration flags for lv_lcd_xxx_create() - * - */ -typedef uint32_t lv_lcd_flag_t; - -/** - * Prototype of a platform-dependent callback to transfer commands and data to the LCD controller. - * @param disp display object - * @param cmd command buffer (can handle 16 bit commands as well) - * @param cmd_size number of bytes of the command - * @param param parameter buffer - * @param param_size number of bytes of the parameters - */ -typedef void (*lv_lcd_send_cmd_cb_t)(lv_display_t * disp, const uint8_t * cmd, size_t cmd_size, const uint8_t * param, - size_t param_size); - -/** - * Prototype of a platform-dependent callback to transfer pixel data to the LCD controller. - * @param disp display object - * @param cmd command buffer (can handle 16 bit commands as well) - * @param cmd_size number of bytes of the command - * @param param parameter buffer - * @param param_size number of bytes of the parameters - */ -typedef void (*lv_lcd_send_color_cb_t)(lv_display_t * disp, const uint8_t * cmd, size_t cmd_size, uint8_t * param, - size_t param_size); - -/** - * Generic MIPI compatible LCD driver - */ -typedef struct { - lv_display_t * disp; /* the associated LVGL display object */ - lv_lcd_send_cmd_cb_t send_cmd; /* platform-specific implementation to send a command to the LCD controller */ - lv_lcd_send_color_cb_t send_color; /* platform-specific implementation to send pixel data to the LCD controller */ - uint16_t x_gap; /* x offset of the (0,0) pixel in VRAM */ - uint16_t y_gap; /* y offset of the (0,0) pixel in VRAM */ - uint8_t madctl_reg; /* current value of MADCTL register */ - uint8_t colmod_reg; /* current value of COLMOD register */ - bool mirror_x; - bool mirror_y; - bool swap_xy; -} lv_lcd_generic_mipi_driver_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a MIPI DCS compatible LCD display - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer). - * `lv_display_flush_ready` must be called after the transfer has finished. - * @return pointer to the created display - */ -lv_display_t * lv_lcd_generic_mipi_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_lcd_send_cmd_cb_t send_cmd_cb, lv_lcd_send_color_cb_t send_color_cb); - -/** - * Set gap, i.e., the offset of the (0,0) pixel in the VRAM - * @param disp display object - * @param x x offset - * @param y y offset - */ -void lv_lcd_generic_mipi_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); - -/** - * Set color inversion - * @param disp display object - * @param invert false: normal, true: invert - */ -void lv_lcd_generic_mipi_set_invert(lv_display_t * disp, bool invert); - -/** - * Set address mode - * @param disp display object - * @param mirror_x horizontal mirror (false: normal, true: mirrored) - * @param mirror_y vertical mirror (false: normal, true: mirrored) - * @param swap_xy swap axes (false: normal, true: swap) - * @param bgr RGB/BGR order (false: RGB, true: BGR) - */ -void lv_lcd_generic_mipi_set_address_mode(lv_display_t * disp, bool mirror_x, bool mirror_y, bool swap_xy, bool bgr); - -/** - * Set gamma curve - * @param disp display object - * @param gamma gamma curve - */ -void lv_lcd_generic_mipi_set_gamma_curve(lv_display_t * disp, uint8_t gamma); - -/** - * Send list of commands. - * @param disp display object - * @param cmd_list controller and panel-specific commands - */ -void lv_lcd_generic_mipi_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); - -/********************** - * OTHERS - **********************/ - -/********************** - * MACROS - **********************/ - - -#endif /*LV_USE_GENERIC_MIPI*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_LCD_GENERIC_MIPI_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/lovyan_gfx/lv_lgfx_user.hpp b/src/drivers/display/lovyan_gfx/lv_lgfx_user.hpp index 7dfce479e2..52ec4c7c5f 100644 --- a/src/drivers/display/lovyan_gfx/lv_lgfx_user.hpp +++ b/src/drivers/display/lovyan_gfx/lv_lgfx_user.hpp @@ -1,5 +1,7 @@ #pragma once +#include "../../../lv_public_api.h" + #if LV_USE_LOVYAN_GFX /** @@ -11,43 +13,43 @@ * Create an LGFX wrapper class that implements the functions used in lv_lovyan_gfx.cpp */ class LGFX { -public: - LGFX(void) {} + public: + LGFX(void) {} - bool init(void) - { - return true; - } + bool init(void) + { + return true; + } - void initDMA(void) {} + void initDMA(void) {} - void waitDMA(void) {} + void waitDMA(void) {} - void fillScreen(uint16_t color) {} + void fillScreen(uint16_t color) {} - void setRotation(uint8_t rotation) {} + void setRotation(uint8_t rotation) {} - void pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data) {} + void pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t * data) {} - void pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data) {} + void pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t * data) {} - void startWrite(void) {} + void startWrite(void) {} - uint32_t getStartCount(void) - { - return 0; - } + uint32_t getStartCount(void) + { + return 0; + } - void endWrite(void) {} + void endWrite(void) {} - void setBrightness(uint8_t brightness){} + void setBrightness(uint8_t brightness) {} - void writePixel(int32_t x, int32_t y, const uint16_t color) {} + void writePixel(int32_t x, int32_t y, const uint16_t color) {} - bool getTouch(uint16_t *x, uint16_t *y) - { - return false; - } + bool getTouch(uint16_t * x, uint16_t * y) + { + return false; + } }; #endif diff --git a/src/drivers/display/lovyan_gfx/lv_lovyan_gfx.cpp b/src/drivers/display/lovyan_gfx/lv_lovyan_gfx.cpp index 49103c1c11..53ef76e479 100644 --- a/src/drivers/display/lovyan_gfx/lv_lovyan_gfx.cpp +++ b/src/drivers/display/lovyan_gfx/lv_lovyan_gfx.cpp @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_lovyan_gfx.h" +#include "../../../lv_public_api.h" #if LV_USE_LOVYAN_GFX #include LV_LGFX_USER_INCLUDE diff --git a/src/drivers/display/lovyan_gfx/lv_lovyan_gfx.h b/src/drivers/display/lovyan_gfx/lv_lovyan_gfx.h index 1d27c454d5..de34b2f54f 100644 --- a/src/drivers/display/lovyan_gfx/lv_lovyan_gfx.h +++ b/src/drivers/display/lovyan_gfx/lv_lovyan_gfx.h @@ -1,45 +1,2 @@ -/** - * @file lv_lovyan_gfx.h - * - */ - -#ifndef LV_LOVYAN_GFX_H -#define LV_LOVYAN_GFX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../../display/lv_display.h" -#include "../../../indev/lv_indev.h" - -#if LV_USE_LOVYAN_GFX - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -lv_display_t * lv_lovyan_gfx_create(uint32_t hor_res, uint32_t ver_res, void * buf, uint32_t buf_size_bytes, - bool touch); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_LOVYAN_GFX */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_LOVYAN_GFX_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/nv3007/lv_nv3007.c b/src/drivers/display/nv3007/lv_nv3007.c index 5e96adc7e8..eda8d3248b 100644 --- a/src/drivers/display/nv3007/lv_nv3007.c +++ b/src/drivers/display/nv3007/lv_nv3007.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_nv3007.h" +#include "../../../lv_public_api.h" #if LV_USE_NV3007 diff --git a/src/drivers/display/nv3007/lv_nv3007.h b/src/drivers/display/nv3007/lv_nv3007.h index 9b5d581e6f..c93cea37d0 100644 --- a/src/drivers/display/nv3007/lv_nv3007.h +++ b/src/drivers/display/nv3007/lv_nv3007.h @@ -1,94 +1,2 @@ -/** - * @file lv_nv3007.h - * - * This driver is just a wrapper around the generic MIPI compatible LCD controller driver - * - */ - -#ifndef LV_NV3007_H -#define LV_NV3007_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../lcd/lv_lcd_generic_mipi.h" - -#if LV_USE_NV3007 - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef lv_lcd_send_cmd_cb_t lv_nv3007_send_cmd_cb_t; -typedef lv_lcd_send_color_cb_t lv_nv3007_send_color_cb_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an LCD display with NV3007 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ -lv_display_t * lv_nv3007_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_nv3007_send_cmd_cb_t send_cmd_cb, lv_nv3007_send_color_cb_t send_color_cb); - -/** - * Set gap, i.e., the offset of the (0,0) pixel in the VRAM - * @param disp display object - * @param x x offset - * @param y y offset - */ -void lv_nv3007_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); - -/** - * Set color inversion - * @param disp display object - * @param invert false: normal, true: invert - */ -void lv_nv3007_set_invert(lv_display_t * disp, bool invert); - -/** - * Set gamma curve - * @param disp display object - * @param gamma gamma curve - */ -void lv_nv3007_set_gamma_curve(lv_display_t * disp, uint8_t gamma); - -/** - * Send list of commands. - * @param disp display object - * @param cmd_list controller and panel-specific commands - */ -void lv_nv3007_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); - -/********************** - * OTHERS - **********************/ - -/********************** - * MACROS - **********************/ - - -#endif /*LV_USE_NV3007*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_NV3007_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/nxp_elcdif/lv_nxp_elcdif.c b/src/drivers/display/nxp_elcdif/lv_nxp_elcdif.c index c25b371ee4..e940de484c 100644 --- a/src/drivers/display/nxp_elcdif/lv_nxp_elcdif.c +++ b/src/drivers/display/nxp_elcdif/lv_nxp_elcdif.c @@ -4,9 +4,9 @@ * Driver for NXP's ELCD */ -#include "lv_nxp_elcdif.h" +#include "../../../lv_public_api.h" -#if LV_USE_NXP_ELCDIF == 1 +#if LV_USE_NXP_ELCDIF /********************* * INCLUDES *********************/ diff --git a/src/drivers/display/nxp_elcdif/lv_nxp_elcdif.h b/src/drivers/display/nxp_elcdif/lv_nxp_elcdif.h index 748edd9913..6869d4f9a4 100644 --- a/src/drivers/display/nxp_elcdif/lv_nxp_elcdif.h +++ b/src/drivers/display/nxp_elcdif/lv_nxp_elcdif.h @@ -1,84 +1,2 @@ -/** - * @file lv_nxp_elcdif.h - * Driver for NXP's ELCD - */ - -#ifndef LV_NXP_ELCDIF_H -#define LV_NXP_ELCDIF_H - -#include "../../../lvgl.h" -#include "../../../display/lv_display.h" - -#if LV_USE_NXP_ELCDIF == 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "fsl_elcdif.h" -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Attach LVGL to ELCDIF using DIRECT rendering mode. - * ELCDIF should be already initialized. - * @param base The NXP eLCD controller base address - * @param config NXP eLCD config object - * @param frame_buffer1 pointer the first frame buffers - * @param frame_buffer2 pointer the second frame buffers - * @param buf_size size of a buffer in bytes (must be at least as large as the screen) - * @return a display object initialized and registered on the LVGL runtime - */ -lv_display_t * lv_nxp_display_elcdif_create_direct(LCDIF_Type * base, const elcdif_rgb_mode_config_t * config, - void * frame_buffer1, - void * frame_buffer2, size_t buf_size); - - -/** -* Attach LVGL to ELCDIF using PARTIAL rendering mode. -* ELCDIF should be already initialized. -* @param base The NXP eLCD controller base address -* @param config NXP eLCD config object -* @param frame_buffer1 pointer the first frame buffers -* @param frame_buffer2 pointer the second frame buffers -* @param buf_size size of a buffer in bytes -* @return a display object initialized and registered on the LVGL runtime -*/ -lv_display_t * lv_nxp_display_elcdif_create_partial(LCDIF_Type * base, const elcdif_rgb_mode_config_t * config, - void * frame_buffer1, - void * frame_buffer2, size_t buf_size); - -/** - * Call this function on the LCD Interrupt Service Routine - * It tells to LVGL what to do when a framebuffer is transmitted - * to the LCD panel - * @param disp The display instance that contains the eLCD related data - * - * @note: the parameter disp is typically the return value after - * `lv_nxp_display_elcdif_create_direct` has been successfully executed - */ -void lv_nxp_display_elcdif_event_handler(const lv_display_t * disp); -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_USE_NXP_ELCDIF*/ - -#endif /* LV_NXP_ELCDIF_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/renesas_glcdc/lv_renesas_glcdc.c b/src/drivers/display/renesas_glcdc/lv_renesas_glcdc.c index 7e55799ad2..8d80adfbbb 100644 --- a/src/drivers/display/renesas_glcdc/lv_renesas_glcdc.c +++ b/src/drivers/display/renesas_glcdc/lv_renesas_glcdc.c @@ -3,6 +3,13 @@ * */ +/********************* + * INCLUDES + *********************/ +#include "../../../lv_public_api.h" + +#if LV_USE_RENESAS_GLCDC + /********************* *PLATFORM ABSTRACTION *********************/ @@ -19,13 +26,6 @@ #define DISPLAY_BUFFER_STRIDE_BYTES_INPUT0 LCD_CH0_IN_GR2_LINEOFFSET #endif /*_RENESAS_RA_*/ -/********************* - * INCLUDES - *********************/ -#include "lv_renesas_glcdc.h" - -#if LV_USE_RENESAS_GLCDC - #ifdef _RENESAS_RA_ #include "LVGL_thread.h" #else /* RX */ diff --git a/src/drivers/display/renesas_glcdc/lv_renesas_glcdc.h b/src/drivers/display/renesas_glcdc/lv_renesas_glcdc.h index bb8abefc5a..3620134567 100644 --- a/src/drivers/display/renesas_glcdc/lv_renesas_glcdc.h +++ b/src/drivers/display/renesas_glcdc/lv_renesas_glcdc.h @@ -1,57 +1,2 @@ -/** - * @file lv_renesas_glcdc.h - * - */ - -#ifndef LV_RENESAS_GLCDC_H -#define LV_RENESAS_GLCDC_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../../display/lv_display.h" - -#if LV_USE_RENESAS_GLCDC - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a display using Renesas' GLCDC peripheral in DIRECT render mode - * @return pointer to the created display - */ -lv_display_t * lv_renesas_glcdc_direct_create(void); - -/** - * Create a display using Renesas' GLCDC peripheral in PARTIAL render mode - * @param buf1 first buffer - * @param buf2 second buffer (can be `NULL`) - * @param buf_size buffer size in byte - * @return pointer to the created display - */ -lv_display_t * lv_renesas_glcdc_partial_create(void * buf1, void * buf2, size_t buf_size); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_RENESAS_GLCDC */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_RENESAS_GLCDC_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/st7735/lv_st7735.c b/src/drivers/display/st7735/lv_st7735.c index 6b5e62dcb1..dcce722123 100644 --- a/src/drivers/display/st7735/lv_st7735.c +++ b/src/drivers/display/st7735/lv_st7735.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_st7735.h" +#include "../../../lv_public_api.h" #if LV_USE_ST7735 diff --git a/src/drivers/display/st7735/lv_st7735.h b/src/drivers/display/st7735/lv_st7735.h index c19e9fad19..18a2d7694c 100644 --- a/src/drivers/display/st7735/lv_st7735.h +++ b/src/drivers/display/st7735/lv_st7735.h @@ -1,93 +1,2 @@ -/** - * @file lv_st7735.h - * - * This driver is just a wrapper around the generic MIPI compatible LCD controller driver - * - */ - -#ifndef LV_ST7735_H -#define LV_ST7735_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../lcd/lv_lcd_generic_mipi.h" - -#if LV_USE_ST7735 - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef lv_lcd_send_cmd_cb_t lv_st7735_send_cmd_cb_t; -typedef lv_lcd_send_color_cb_t lv_st7735_send_color_cb_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an LCD display with ST7735 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ -lv_display_t * lv_st7735_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_st7735_send_cmd_cb_t send_cmd_cb, lv_st7735_send_color_cb_t send_color_cb); - -/** - * Set gap, i.e., the offset of the (0,0) pixel in the VRAM - * @param disp display object - * @param x x offset - * @param y y offset - */ -void lv_st7735_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); - -/** - * Set color inversion - * @param disp display object - * @param invert false: normal, true: invert - */ -void lv_st7735_set_invert(lv_display_t * disp, bool invert); - -/** - * Set gamma curve - * @param disp display object - * @param gamma gamma curve - */ -void lv_st7735_set_gamma_curve(lv_display_t * disp, uint8_t gamma); - -/** - * Send list of commands. - * @param disp display object - * @param cmd_list controller and panel-specific commands - */ -void lv_st7735_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); - -/********************** - * OTHERS - **********************/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_ST7735*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ST7735_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/st7789/lv_st7789.c b/src/drivers/display/st7789/lv_st7789.c index 76d08bfb2c..d4313c2980 100644 --- a/src/drivers/display/st7789/lv_st7789.c +++ b/src/drivers/display/st7789/lv_st7789.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_st7789.h" +#include "../../../lv_public_api.h" #if LV_USE_ST7789 diff --git a/src/drivers/display/st7789/lv_st7789.h b/src/drivers/display/st7789/lv_st7789.h index 9770432a12..d34dd00c97 100644 --- a/src/drivers/display/st7789/lv_st7789.h +++ b/src/drivers/display/st7789/lv_st7789.h @@ -1,94 +1,2 @@ -/** - * @file lv_st7789.h - * - * This driver is just a wrapper around the generic MIPI compatible LCD controller driver - * - */ - -#ifndef LV_ST7789_H -#define LV_ST7789_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../lcd/lv_lcd_generic_mipi.h" - -#if LV_USE_ST7789 - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef lv_lcd_send_cmd_cb_t lv_st7789_send_cmd_cb_t; -typedef lv_lcd_send_color_cb_t lv_st7789_send_color_cb_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an LCD display with ST7789 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ -lv_display_t * lv_st7789_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_st7789_send_cmd_cb_t send_cmd_cb, lv_st7789_send_color_cb_t send_color_cb); - -/** - * Set gap, i.e., the offset of the (0,0) pixel in the VRAM - * @param disp display object - * @param x x offset - * @param y y offset - */ -void lv_st7789_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); - -/** - * Set color inversion - * @param disp display object - * @param invert false: normal, true: invert - */ -void lv_st7789_set_invert(lv_display_t * disp, bool invert); - -/** - * Set gamma curve - * @param disp display object - * @param gamma gamma curve - */ -void lv_st7789_set_gamma_curve(lv_display_t * disp, uint8_t gamma); - -/** - * Send list of commands. - * @param disp display object - * @param cmd_list controller and panel-specific commands - */ -void lv_st7789_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); - -/********************** - * OTHERS - **********************/ - -/********************** - * MACROS - **********************/ - - -#endif /*LV_USE_ST7789*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ST7789_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/st7796/lv_st7796.c b/src/drivers/display/st7796/lv_st7796.c index 985b39f012..f25bdc9966 100644 --- a/src/drivers/display/st7796/lv_st7796.c +++ b/src/drivers/display/st7796/lv_st7796.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_st7796.h" +#include "../../../lv_public_api.h" #if LV_USE_ST7796 diff --git a/src/drivers/display/st7796/lv_st7796.h b/src/drivers/display/st7796/lv_st7796.h index 79d7a8834d..c922da3608 100644 --- a/src/drivers/display/st7796/lv_st7796.h +++ b/src/drivers/display/st7796/lv_st7796.h @@ -1,93 +1,2 @@ -/** - * @file lv_st7796.h - * - * This driver is just a wrapper around the generic MIPI compatible LCD controller driver - * - */ - -#ifndef LV_ST7796_H -#define LV_ST7796_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../lcd/lv_lcd_generic_mipi.h" - -#if LV_USE_ST7796 - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef lv_lcd_send_cmd_cb_t lv_st7796_send_cmd_cb_t; -typedef lv_lcd_send_color_cb_t lv_st7796_send_color_cb_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an LCD display with ST7796 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ -lv_display_t * lv_st7796_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_st7796_send_cmd_cb_t send_cmd_cb, lv_st7796_send_color_cb_t send_color_cb); - -/** - * Set gap, i.e., the offset of the (0,0) pixel in the VRAM - * @param disp display object - * @param x x offset - * @param y y offset - */ -void lv_st7796_set_gap(lv_display_t * disp, uint16_t x, uint16_t y); - -/** - * Set color inversion - * @param disp display object - * @param invert false: normal, true: invert - */ -void lv_st7796_set_invert(lv_display_t * disp, bool invert); - -/** - * Set gamma curve - * @param disp display object - * @param gamma gamma curve - */ -void lv_st7796_set_gamma_curve(lv_display_t * disp, uint8_t gamma); - -/** - * Send list of commands. - * @param disp display object - * @param cmd_list controller and panel-specific commands - */ -void lv_st7796_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list); - -/********************** - * OTHERS - **********************/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_ST7796*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ST7796_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/st_ltdc/lv_st_ltdc.c b/src/drivers/display/st_ltdc/lv_st_ltdc.c index c162a840fe..fef8f53c13 100644 --- a/src/drivers/display/st_ltdc/lv_st_ltdc.c +++ b/src/drivers/display/st_ltdc/lv_st_ltdc.c @@ -7,10 +7,9 @@ * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_ST_LTDC -#include "lv_st_ltdc.h" #include "../../../display/lv_display_private.h" #include "../../../draw/sw/lv_draw_sw.h" #include "../../../osal/lv_os_private.h" diff --git a/src/drivers/display/st_ltdc/lv_st_ltdc.h b/src/drivers/display/st_ltdc/lv_st_ltdc.h index 69a0e7b719..68ea93a67f 100644 --- a/src/drivers/display/st_ltdc/lv_st_ltdc.h +++ b/src/drivers/display/st_ltdc/lv_st_ltdc.h @@ -1,65 +1,2 @@ -/** - * @file lv_st_ltdc.h - * - */ - -#ifndef LV_ST_LTDC_H -#define LV_ST_LTDC_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" -#if LV_USE_ST_LTDC - -#include "../../../display/lv_display.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a direct render mode display bound to a LTDC layer. - * @param fb_adr_1 The LTDC layer's framebuffer memory address. - * @param fb_adr_2 An additional framebuffer-sized buffer to use for double buffering, or `NULL`. - * @param layer_idx The LTDC layer number to bind the display to. Typically 0 or 1. - * @return The display. - */ -lv_display_t * lv_st_ltdc_create_direct(void * fb_adr_1, void * fb_adr_2, uint32_t layer_idx); - -/** - * Create a partial render mode display bound to a LTDC layer. The layer's framebuffer is flushed to internally. - * Enable `LV_ST_LTDC_USE_DMA2D_FLUSH` for parallel flushing. - * @param render_buf_1 A render buffer. - * @param render_buf_2 An additional render buffer for double-buffering, or `NULL`. - * @param buf_size The size of the buffer(s) in bytes. - * @param layer_idx The LTDC layer number to bind the display to. Typically 0 or 1. - * @return The display. - */ -lv_display_t * lv_st_ltdc_create_partial(void * render_buf_1, void * render_buf_2, uint32_t buf_size, - uint32_t layer_idx); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_ST_LTDC*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ST_LTDC_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/display/tft_espi/lv_tft_espi.cpp b/src/drivers/display/tft_espi/lv_tft_espi.cpp index 1cb7b45ff6..4ad5884907 100644 --- a/src/drivers/display/tft_espi/lv_tft_espi.cpp +++ b/src/drivers/display/tft_espi/lv_tft_espi.cpp @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_tft_espi.h" +#include "../../../lv_public_api.h" #if LV_USE_TFT_ESPI #include diff --git a/src/drivers/display/tft_espi/lv_tft_espi.h b/src/drivers/display/tft_espi/lv_tft_espi.h index a8f49f8921..4e84130f76 100644 --- a/src/drivers/display/tft_espi/lv_tft_espi.h +++ b/src/drivers/display/tft_espi/lv_tft_espi.h @@ -1,43 +1,2 @@ -/** - * @file lv_tft_espi.h - * - */ - -#ifndef LV_TFT_ESPI_H -#define LV_TFT_ESPI_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../../display/lv_display.h" - -#if LV_USE_TFT_ESPI - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -lv_display_t * lv_tft_espi_create(uint32_t hor_res, uint32_t ver_res, void * buf, uint32_t buf_size_bytes); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_TFT_ESPI */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_TFT_ESPI_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/draw/eve/lv_draw_eve_display.c b/src/drivers/draw/eve/lv_draw_eve_display.c index e6c3d3a14f..066af773b8 100644 --- a/src/drivers/draw/eve/lv_draw_eve_display.c +++ b/src/drivers/draw/eve/lv_draw_eve_display.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_draw_eve_display.h" +#include "../../../lv_public_api.h" #if LV_USE_DRAW_EVE #include "../../../draw/eve/lv_eve.h" diff --git a/src/drivers/draw/eve/lv_draw_eve_display.h b/src/drivers/draw/eve/lv_draw_eve_display.h index 860159ba05..416214c07c 100644 --- a/src/drivers/draw/eve/lv_draw_eve_display.h +++ b/src/drivers/draw/eve/lv_draw_eve_display.h @@ -1,151 +1,2 @@ -/** - * @file lv_draw_eve_display.h - * - */ - -#ifndef LV_DRAW_EVE_DISPLAY_H -#define LV_DRAW_EVE_DISPLAY_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" -#if LV_USE_DRAW_EVE - -#include "../../../draw/eve/lv_draw_eve_target.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a display for the EVE draw unit. - * @param params Pointer to a struct of display parameters. Can be a temporary variable - * @param op_cb A callback that will be called to perform pin and SPI IO operations with the EVE chip - * @param user_data use `lv_draw_eve_display_get_user_data` to get this pointer inside the `op_cb` - * @return the EVE display - */ -lv_display_t * lv_draw_eve_display_create(const lv_draw_eve_parameters_t * params, lv_draw_eve_operation_cb_t op_cb, - void * user_data); - -/** - * Get the `user_data` parameter that was passed to `lv_draw_eve_display_create`. Useful in the operation callback. - * @param disp pointer to the lv_draw_eve display - * @return the `user_data` pointer - */ -void * lv_draw_eve_display_get_user_data(lv_display_t * disp); - -/** - * Create a touchscreen indev for the EVE display. - * @param disp pointer to the lv_draw_eve display - * @return the EVE touchscreen indev - */ -lv_indev_t * lv_draw_eve_touch_create(lv_display_t * disp); - - -/* RAM_G asset pre-upload functions */ - -/** - * Upload an image src to RAM_G now instead of as-needed during rendering. - * @param disp pointer to the lv_draw_eve display - * @param src image src. The value passed to `lv_image_set_src` - */ -void lv_draw_eve_pre_upload_image(lv_display_t * disp, const void * src); - -/** - * Upload font glyphs to RAM_G now instead of as-needed during rendering. - * Upload all the glyphs in the range of unicode code points (inclusive of the start and end values). - * It can be called multiple times with different ranges. - * @param disp pointer to the lv_draw_eve display - * @param font the font to upload glyphs from - * @param unicode_range_start the first unicode code point in the range of glyphs to upload - * @param unicode_range_end the last unicode code point (inclusive) in the range of glyphs to upload - */ -void lv_draw_eve_pre_upload_font_range(lv_display_t * disp, const lv_font_t * font, uint32_t unicode_range_start, - uint32_t unicode_range_end); - -/** - * Upload font glyphs to RAM_G now instead of as-needed during rendering. - * It will upload all the glyphs needed to render the string `text`. - * It can be called multiple times with different strings. - * @param disp pointer to the lv_draw_eve display - * @param font the font to upload glyphs from - * @param text the ASCII or UTF-8 string that will be iterated for glyphs to upload - */ -void lv_draw_eve_pre_upload_font_text(lv_display_t * disp, const lv_font_t * font, const char * text); - - -/* Low-level EVE control functions */ - -/** - * Call `EVE_memRead8` for custom low-level control of the display. - * @param disp the display returned by `lv_draw_eve_display_create` - * @param address the EVE address to read from - * @return the read value - */ -uint8_t lv_draw_eve_memread8(lv_display_t * disp, uint32_t address); - -/** - * Call `EVE_memRead16` for custom low-level control of the display. - * @param disp the display returned by `lv_draw_eve_display_create` - * @param address the EVE address to read from - * @return the read value - */ -uint16_t lv_draw_eve_memread16(lv_display_t * disp, uint32_t address); - -/** - * Call `EVE_memRead32` for custom low-level control of the display. - * @param disp the display returned by `lv_draw_eve_display_create` - * @param address the EVE address to read from - * @return the read value - */ -uint32_t lv_draw_eve_memread32(lv_display_t * disp, uint32_t address); - -/** - * Call `EVE_memWrite8` for custom low-level control of the display. - * @param disp the display returned by `lv_draw_eve_display_create` - * @param address the EVE address to write to - * @param data the value to write - */ -void lv_draw_eve_memwrite8(lv_display_t * disp, uint32_t address, uint8_t data); - -/** - * Call `EVE_memWrite16` for custom low-level control of the display. - * @param disp the display returned by `lv_draw_eve_display_create` - * @param address the EVE address to write to - * @param data the value to write - */ -void lv_draw_eve_memwrite16(lv_display_t * disp, uint32_t address, uint16_t data); - -/** - * Call `EVE_memWrite32` for custom low-level control of the display. - * @param disp the display returned by `lv_draw_eve_display_create` - * @param address the EVE address to write to - * @param data the value to write - */ -void lv_draw_eve_memwrite32(lv_display_t * disp, uint32_t address, uint32_t data); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_DRAW_EVE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_EVE_DISPLAY_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/draw/eve/lv_draw_eve_display_defines.h b/src/drivers/draw/eve/lv_draw_eve_display_defines.h index 2d1ae742d1..6747780962 100644 --- a/src/drivers/draw/eve/lv_draw_eve_display_defines.h +++ b/src/drivers/draw/eve/lv_draw_eve_display_defines.h @@ -1,1207 +1,2 @@ -/** - * @file lv_draw_eve_display_defines.h - * - */ - -#ifndef LV_DRAW_EVE_DISPLAY_DEFINES_H -#define LV_DRAW_EVE_DISPLAY_DEFINES_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" -#if LV_USE_DRAW_EVE - -/********************* - * DEFINES - *********************/ - -/* Memory */ -#define LV_EVE_EVE_RAM_G ((uint32_t) 0x00000000UL) -#define LV_EVE_EVE_ROM_CHIPID ((uint32_t) 0x000C0000UL) -#define LV_EVE_EVE_ROM_FONT ((uint32_t) 0x001E0000UL) -#define LV_EVE_EVE_ROM_FONTROOT ((uint32_t) 0x002FFFFCUL) -#define LV_EVE_EVE_RAM_DL ((uint32_t) 0x00300000UL) -#define LV_EVE_EVE_RAM_REG ((uint32_t) 0x00302000UL) -#define LV_EVE_EVE_RAM_CMD ((uint32_t) 0x00308000UL) - -/* Memory buffer sizes */ -#define LV_EVE_EVE_RAM_G_SIZE ((uint32_t) 1024U*1024UL) -#define LV_EVE_EVE_CMDFIFO_SIZE ((uint32_t) 4U*1024UL) -#define LV_EVE_EVE_RAM_DL_SIZE ((uint32_t) 8U*1024UL) - -/* display list commands, most need OR's arguments */ -#define LV_EVE_DL_DISPLAY ((uint32_t) 0x00000000UL) -#define LV_EVE_DL_BITMAP_SOURCE ((uint32_t) 0x01000000UL) -#define LV_EVE_DL_CLEAR_COLOR_RGB ((uint32_t) 0x02000000UL) -#define LV_EVE_DL_TAG ((uint32_t) 0x03000000UL) -#define LV_EVE_DL_COLOR_RGB ((uint32_t) 0x04000000UL) -#define LV_EVE_DL_BITMAP_HANDLE ((uint32_t) 0x05000000UL) -#define LV_EVE_DL_CELL ((uint32_t) 0x06000000UL) -#define LV_EVE_DL_BITMAP_LAYOUT ((uint32_t) 0x07000000UL) -#define LV_EVE_DL_BITMAP_SIZE ((uint32_t) 0x08000000UL) -#define LV_EVE_DL_ALPHA_FUNC ((uint32_t) 0x09000000UL) -#define LV_EVE_DL_STENCIL_FUNC ((uint32_t) 0x0A000000UL) -#define LV_EVE_DL_BLEND_FUNC ((uint32_t) 0x0B000000UL) -#define LV_EVE_DL_STENCIL_OP ((uint32_t) 0x0C000000UL) -#define LV_EVE_DL_POINT_SIZE ((uint32_t) 0x0D000000UL) -#define LV_EVE_DL_LINE_WIDTH ((uint32_t) 0x0E000000UL) -#define LV_EVE_DL_CLEAR_COLOR_A ((uint32_t) 0x0F000000UL) -#define LV_EVE_DL_COLOR_A ((uint32_t) 0x10000000UL) -#define LV_EVE_DL_CLEAR_STENCIL ((uint32_t) 0x11000000UL) -#define LV_EVE_DL_CLEAR_TAG ((uint32_t) 0x12000000UL) -#define LV_EVE_DL_STENCIL_MASK ((uint32_t) 0x13000000UL) -#define LV_EVE_DL_TAG_MASK ((uint32_t) 0x14000000UL) -#define LV_EVE_DL_BITMAP_TRANSFORM_A ((uint32_t) 0x15000000UL) -#define LV_EVE_DL_BITMAP_TRANSFORM_B ((uint32_t) 0x16000000UL) -#define LV_EVE_DL_BITMAP_TRANSFORM_C ((uint32_t) 0x17000000UL) -#define LV_EVE_DL_BITMAP_TRANSFORM_D ((uint32_t) 0x18000000UL) -#define LV_EVE_DL_BITMAP_TRANSFORM_E ((uint32_t) 0x19000000UL) -#define LV_EVE_DL_BITMAP_TRANSFORM_F ((uint32_t) 0x1A000000UL) -#define LV_EVE_DL_SCISSOR_XY ((uint32_t) 0x1B000000UL) -#define LV_EVE_DL_SCISSOR_SIZE ((uint32_t) 0x1C000000UL) -#define LV_EVE_DL_CALL ((uint32_t) 0x1D000000UL) -#define LV_EVE_DL_JUMP ((uint32_t) 0x1E000000UL) -#define LV_EVE_DL_BEGIN ((uint32_t) 0x1F000000UL) -#define LV_EVE_DL_COLOR_MASK ((uint32_t) 0x20000000UL) -#define LV_EVE_DL_END ((uint32_t) 0x21000000UL) -#define LV_EVE_DL_SAVE_CONTEXT ((uint32_t) 0x22000000UL) -#define LV_EVE_DL_RESTORE_CONTEXT ((uint32_t) 0x23000000UL) -#define LV_EVE_DL_RETURN ((uint32_t) 0x24000000UL) -#define LV_EVE_DL_MACRO ((uint32_t) 0x25000000UL) -#define LV_EVE_DL_CLEAR ((uint32_t) 0x26000000UL) -#define LV_EVE_DL_VERTEX_FORMAT ((uint32_t) 0x27000000UL) -#define LV_EVE_DL_BITMAP_LAYOUT_H ((uint32_t) 0x28000000UL) -#define LV_EVE_DL_BITMAP_SIZE_H ((uint32_t) 0x29000000UL) -#define LV_EVE_DL_PALETTE_SOURCE ((uint32_t) 0x2A000000UL) -#define LV_EVE_DL_VERTEX_TRANSLATE_X ((uint32_t) 0x2B000000UL) -#define LV_EVE_DL_VERTEX_TRANSLATE_Y ((uint32_t) 0x2C000000UL) -#define LV_EVE_DL_NOP ((uint32_t) 0x2D000000UL) - -#define LV_EVE_DL_VERTEX2F ((uint32_t) 0x40000000UL) -#define LV_EVE_DL_VERTEX2II ((uint32_t) 0x80000000UL) - -#define LV_EVE_CLR_COL ((uint8_t) 0x4U) -#define LV_EVE_CLR_STN ((uint8_t) 0x2U) -#define LV_EVE_CLR_TAG ((uint8_t) 0x1U) - -/* Host commands */ -#define LV_EVE_EVE_ACTIVE ((uint8_t) 0x00U) /* place EVE in active state */ -#define LV_EVE_EVE_STANDBY ((uint8_t) 0x41U) /* place EVE in Standby (clk running) */ -#define LV_EVE_EVE_SLEEP ((uint8_t) 0x42U) /* place EVE in Sleep (clk off) */ -#define LV_EVE_EVE_CLKEXT ((uint8_t) 0x44U) /* select external clock source */ -#define LV_EVE_EVE_CLKINT ((uint8_t) 0x48U) /* select internal clock source, not a valid option for BT817 / BT818 */ -#define LV_EVE_EVE_PWRDOWN ((uint8_t) 0x50U) /* place EVE in Power Down (core off) */ -#define LV_EVE_EVE_CLKSEL ((uint8_t) 0x61U) /* configure system clock */ -#define LV_EVE_EVE_RST_PULSE ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ -#define LV_EVE_EVE_CORERST ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ -#define LV_EVE_EVE_PINDRIVE ((uint8_t) 0x70U) /* setup drive strength for various pins */ -#define LV_EVE_EVE_PIN_PD_STATE ((uint8_t) 0x71U) /* setup how pins behave during power down */ - -/* Graphic command defines */ -#define LV_EVE_EVE_NEVER ((uint8_t) 0UL) -#define LV_EVE_EVE_LESS ((uint8_t) 1UL) -#define LV_EVE_EVE_LEQUAL ((uint8_t) 2UL) -#define LV_EVE_EVE_GREATER ((uint8_t) 3UL) -#define LV_EVE_EVE_GEQUAL ((uint8_t) 4UL) -#define LV_EVE_EVE_EQUAL ((uint8_t) 5UL) -#define LV_EVE_EVE_NOTEQUAL ((uint8_t) 6UL) -#define LV_EVE_EVE_ALWAYS ((uint8_t) 7UL) - -/* Bitmap formats */ -#define LV_EVE_EVE_ARGB1555 ((uint8_t) 0UL) -#define LV_EVE_EVE_L1 ((uint8_t) 1UL) -#define LV_EVE_EVE_L4 ((uint8_t) 2UL) -#define LV_EVE_EVE_L8 ((uint8_t) 3UL) -#define LV_EVE_EVE_RGB332 ((uint8_t) 4UL) -#define LV_EVE_EVE_ARGB2 ((uint8_t) 5UL) -#define LV_EVE_EVE_ARGB4 ((uint8_t) 6UL) -#define LV_EVE_EVE_RGB565 ((uint8_t) 7UL) -#define LV_EVE_EVE_PALETTED ((uint8_t) 8UL) -#define LV_EVE_EVE_TEXT8X8 ((uint8_t) 9UL) -#define LV_EVE_EVE_TEXTVGA ((uint8_t) 10UL) -#define LV_EVE_EVE_BARGRAPH ((uint8_t) 11UL) - -/* Bitmap filter types */ -#define LV_EVE_EVE_NEAREST ((uint8_t) 0UL) -#define LV_EVE_EVE_BILINEAR ((uint8_t) 1UL) - -/* Bitmap wrap types */ -#define LV_EVE_EVE_BORDER ((uint8_t) 0UL) -#define LV_EVE_EVE_REPEAT ((uint8_t) 1UL) - -/* Stencil defines */ -#define LV_EVE_EVE_KEEP ((uint8_t) 1UL) -#define LV_EVE_EVE_REPLACE ((uint8_t) 2UL) -#define LV_EVE_EVE_INCR ((uint8_t) 3UL) -#define LV_EVE_EVE_DECR ((uint8_t) 4UL) -#define LV_EVE_EVE_INVERT ((uint8_t) 5UL) - -/* Graphics display list swap defines */ -#define LV_EVE_EVE_DLSWAP_DONE ((uint8_t) 0UL) -#define LV_EVE_EVE_DLSWAP_LINE ((uint8_t) 1UL) -#define LV_EVE_EVE_DLSWAP_FRAME ((uint8_t) 2UL) - -/* Interrupt bits */ -#define LV_EVE_EVE_INT_SWAP ((uint8_t) 0x01) -#define LV_EVE_EVE_INT_TOUCH ((uint8_t) 0x02) -#define LV_EVE_EVE_INT_TAG ((uint8_t) 0x04) -#define LV_EVE_EVE_INT_SOUND ((uint8_t) 0x08) -#define LV_EVE_EVE_INT_PLAYBACK ((uint8_t) 0x10) -#define LV_EVE_EVE_INT_CMDEMPTY ((uint8_t) 0x20) -#define LV_EVE_EVE_INT_CMDFLAG ((uint8_t) 0x40) -#define LV_EVE_EVE_INT_CONVCOMPLETE ((uint8_t) 0x80) - -/* Touch mode */ -#define LV_EVE_EVE_TMODE_OFF ((uint8_t) 0U) -#define LV_EVE_EVE_TMODE_ONESHOT ((uint8_t) 1U) -#define LV_EVE_EVE_TMODE_FRAME ((uint8_t) 2U) -#define LV_EVE_EVE_TMODE_CONTINUOUS ((uint8_t) 3U) - -/* Alpha blending */ -#define LV_EVE_EVE_ZERO ((uint32_t) 0UL) -#define LV_EVE_EVE_ONE ((uint32_t) 1UL) -#define LV_EVE_EVE_SRC_ALPHA ((uint32_t) 2UL) -#define LV_EVE_EVE_DST_ALPHA ((uint32_t) 3UL) -#define LV_EVE_EVE_ONE_MINUS_SRC_ALPHA ((uint32_t) 4UL) -#define LV_EVE_EVE_ONE_MINUS_DST_ALPHA ((uint32_t) 5UL) - -/* Graphics primitives */ -#define LV_EVE_EVE_BITMAPS ((uint32_t) 1UL) -#define LV_EVE_EVE_POINTS ((uint32_t) 2UL) -#define LV_EVE_EVE_LINES ((uint32_t) 3UL) -#define LV_EVE_EVE_LINE_STRIP ((uint32_t) 4UL) -#define LV_EVE_EVE_EDGE_STRIP_R ((uint32_t) 5UL) -#define LV_EVE_EVE_EDGE_STRIP_L ((uint32_t) 6UL) -#define LV_EVE_EVE_EDGE_STRIP_A ((uint32_t) 7UL) -#define LV_EVE_EVE_EDGE_STRIP_B ((uint32_t) 8UL) -#define LV_EVE_EVE_RECTS ((uint32_t) 9UL) -#define LV_EVE_EVE_INT_G8 ((uint32_t) 18UL) -#define LV_EVE_EVE_INT_L8C ((uint32_t) 12UL) -#define LV_EVE_EVE_INT_VGA ((uint32_t) 13UL) -#define LV_EVE_EVE_PALETTED565 ((uint32_t) 14UL) -#define LV_EVE_EVE_PALETTED4444 ((uint32_t) 15UL) -#define LV_EVE_EVE_PALETTED8 ((uint32_t) 16UL) -#define LV_EVE_EVE_L2 ((uint32_t) 17UL) - -/* Widget command options */ -#define LV_EVE_EVE_OPT_MONO ((uint16_t) 1U) -#define LV_EVE_EVE_OPT_NODL ((uint16_t) 2U) -#define LV_EVE_EVE_OPT_FLAT ((uint16_t) 256U) -#define LV_EVE_EVE_OPT_CENTERX ((uint16_t) 512U) -#define LV_EVE_EVE_OPT_CENTERY ((uint16_t) 1024U) -#define LV_EVE_EVE_OPT_CENTER (LV_EVE_EVE_OPT_CENTERX | LV_EVE_EVE_OPT_CENTERY) -#define LV_EVE_EVE_OPT_NOBACK ((uint16_t) 4096U) -#define LV_EVE_EVE_OPT_NOTICKS ((uint16_t) 8192U) -#define LV_EVE_EVE_OPT_NOHM ((uint16_t) 16384U) -#define LV_EVE_EVE_OPT_NOPOINTER ((uint16_t) 16384U) -#define LV_EVE_EVE_OPT_NOSECS ((uint16_t) 32768U) -#define LV_EVE_EVE_OPT_NOHANDS ((uint16_t) 49152U) -#define LV_EVE_EVE_OPT_RIGHTX ((uint16_t) 2048U) -#define LV_EVE_EVE_OPT_SIGNED ((uint16_t) 256U) - -#define LV_EVE_EVE_OPT_MEDIAFIFO ((uint16_t) 16U) -#define LV_EVE_EVE_OPT_FULLSCREEN ((uint16_t) 8U) -#define LV_EVE_EVE_OPT_NOTEAR ((uint16_t) 4U) -#define LV_EVE_EVE_OPT_SOUND ((uint16_t) 32U) - -/* ADC */ -#define LV_EVE_EVE_ADC_DIFFERENTIAL ((uint32_t) 1UL) -#define LV_EVE_EVE_ADC_SINGLE_ENDED ((uint32_t) 0UL) - -/* Fonts */ -#define LV_EVE_EVE_NUMCHAR_PERFONT ((uint32_t) 128UL) /* number of font characters per bitmap handle */ -#define LV_EVE_EVE_FONT_TABLE_SIZE ((uint32_t) 148UL) /* size of the font table - utilized for loopup by the graphics engine */ -#define LV_EVE_EVE_FONT_TABLE_POINTER ((uint32_t) 0xFFFFCUL) /* pointer to the inbuilt font tables starting from bitmap handle 16 */ - -/* Audio sample type defines */ -#define LV_EVE_EVE_LINEAR_SAMPLES ((uint32_t) 0UL) /* 8bit signed samples */ -#define LV_EVE_EVE_ULAW_SAMPLES ((uint32_t) 1UL) /* 8bit ulaw samples */ -#define LV_EVE_EVE_ADPCM_SAMPLES ((uint32_t) 2UL) /* 4bit ima adpcm samples */ - -/* Synthesized sound */ -#define LV_EVE_EVE_SILENCE ((uint8_t) 0x00U) -#define LV_EVE_EVE_SQUAREWAVE ((uint8_t) 0x01U) -#define LV_EVE_EVE_SINEWAVE ((uint8_t) 0x02U) -#define LV_EVE_EVE_SAWTOOTH ((uint8_t) 0x03U) -#define LV_EVE_EVE_TRIANGLE ((uint8_t) 0x04U) -#define LV_EVE_EVE_BEEPING ((uint8_t) 0x05U) -#define LV_EVE_EVE_ALARM ((uint8_t) 0x06U) -#define LV_EVE_EVE_WARBLE ((uint8_t) 0x07U) -#define LV_EVE_EVE_CAROUSEL ((uint8_t) 0x08U) -#define LV_EVE_EVE_PIPS(n) ((uint8_t) (0x0FU + (n))) -#define LV_EVE_EVE_HARP ((uint8_t) 0x40U) -#define LV_EVE_EVE_XYLOPHONE ((uint8_t) 0x41U) -#define LV_EVE_EVE_TUBA ((uint8_t) 0x42U) -#define LV_EVE_EVE_GLOCKENSPIEL ((uint8_t) 0x43U) -#define LV_EVE_EVE_ORGAN ((uint8_t) 0x44U) -#define LV_EVE_EVE_TRUMPET ((uint8_t) 0x45U) -#define LV_EVE_EVE_PIANO ((uint8_t) 0x46U) -#define LV_EVE_EVE_CHIMES ((uint8_t) 0x47U) -#define LV_EVE_EVE_MUSICBOX ((uint8_t) 0x48U) -#define LV_EVE_EVE_BELL ((uint8_t) 0x49U) -#define LV_EVE_EVE_CLICK ((uint8_t) 0x50U) -#define LV_EVE_EVE_SWITCH ((uint8_t) 0x51U) -#define LV_EVE_EVE_COWBELL ((uint8_t) 0x52U) -#define LV_EVE_EVE_NOTCH ((uint8_t) 0x53U) -#define LV_EVE_EVE_HIHAT ((uint8_t) 0x54U) -#define LV_EVE_EVE_KICKDRUM ((uint8_t) 0x55U) -#define LV_EVE_EVE_POP ((uint8_t) 0x56U) -#define LV_EVE_EVE_CLACK ((uint8_t) 0x57U) -#define LV_EVE_EVE_CHACK ((uint8_t) 0x58U) -#define LV_EVE_EVE_MUTE ((uint8_t) 0x60U) -#define LV_EVE_EVE_UNMUTE ((uint8_t) 0x61U) - -/* Synthesized sound frequencies, midi note */ -#define LV_EVE_EVE_MIDI_A0 ((uint8_t) 21U) -#define LV_EVE_EVE_MIDI_A_0 ((uint8_t) 22U) -#define LV_EVE_EVE_MIDI_B0 ((uint8_t) 23U) -#define LV_EVE_EVE_MIDI_C1 ((uint8_t) 24U) -#define LV_EVE_EVE_MIDI_C_1 ((uint8_t) 25U) -#define LV_EVE_EVE_MIDI_D1 ((uint8_t) 26U) -#define LV_EVE_EVE_MIDI_D_1 ((uint8_t) 27U) -#define LV_EVE_EVE_MIDI_E1 ((uint8_t) 28U) -#define LV_EVE_EVE_MIDI_F1 ((uint8_t) 29U) -#define LV_EVE_EVE_MIDI_F_1 ((uint8_t) 30U) -#define LV_EVE_EVE_MIDI_G1 ((uint8_t) 31U) -#define LV_EVE_EVE_MIDI_G_1 ((uint8_t) 32U) -#define LV_EVE_EVE_MIDI_A1 ((uint8_t) 33U) -#define LV_EVE_EVE_MIDI_A_1 ((uint8_t) 34U) -#define LV_EVE_EVE_MIDI_B1 ((uint8_t) 35U) -#define LV_EVE_EVE_MIDI_C2 ((uint8_t) 36U) -#define LV_EVE_EVE_MIDI_C_2 ((uint8_t) 37U) -#define LV_EVE_EVE_MIDI_D2 ((uint8_t) 38U) -#define LV_EVE_EVE_MIDI_D_2 ((uint8_t) 39U) -#define LV_EVE_EVE_MIDI_E2 ((uint8_t) 40U) -#define LV_EVE_EVE_MIDI_F2 ((uint8_t) 41U) -#define LV_EVE_EVE_MIDI_F_2 ((uint8_t) 42U) -#define LV_EVE_EVE_MIDI_G2 ((uint8_t) 43U) -#define LV_EVE_EVE_MIDI_G_2 ((uint8_t) 44U) -#define LV_EVE_EVE_MIDI_A2 ((uint8_t) 45U) -#define LV_EVE_EVE_MIDI_A_2 ((uint8_t) 46U) -#define LV_EVE_EVE_MIDI_B2 ((uint8_t) 47U) -#define LV_EVE_EVE_MIDI_C3 ((uint8_t) 48U) -#define LV_EVE_EVE_MIDI_C_3 ((uint8_t) 49U) -#define LV_EVE_EVE_MIDI_D3 ((uint8_t) 50U) -#define LV_EVE_EVE_MIDI_D_3 ((uint8_t) 51U) -#define LV_EVE_EVE_MIDI_E3 ((uint8_t) 52U) -#define LV_EVE_EVE_MIDI_F3 ((uint8_t) 53U) -#define LV_EVE_EVE_MIDI_F_3 ((uint8_t) 54U) -#define LV_EVE_EVE_MIDI_G3 ((uint8_t) 55U) -#define LV_EVE_EVE_MIDI_G_3 ((uint8_t) 56U) -#define LV_EVE_EVE_MIDI_A3 ((uint8_t) 57U) -#define LV_EVE_EVE_MIDI_A_3 ((uint8_t) 58U) -#define LV_EVE_EVE_MIDI_B3 ((uint8_t) 59U) -#define LV_EVE_EVE_MIDI_C4 ((uint8_t) 60U) -#define LV_EVE_EVE_MIDI_C_4 ((uint8_t) 61U) -#define LV_EVE_EVE_MIDI_D4 ((uint8_t) 62U) -#define LV_EVE_EVE_MIDI_D_4 ((uint8_t) 63U) -#define LV_EVE_EVE_MIDI_E4 ((uint8_t) 64U) -#define LV_EVE_EVE_MIDI_F4 ((uint8_t) 65U) -#define LV_EVE_EVE_MIDI_F_4 ((uint8_t) 66U) -#define LV_EVE_EVE_MIDI_G4 ((uint8_t) 67U) -#define LV_EVE_EVE_MIDI_G_4 ((uint8_t) 68U) -#define LV_EVE_EVE_MIDI_A4 ((uint8_t) 69U) -#define LV_EVE_EVE_MIDI_A_4 ((uint8_t) 70U) -#define LV_EVE_EVE_MIDI_B4 ((uint8_t) 71U) -#define LV_EVE_EVE_MIDI_C5 ((uint8_t) 72U) -#define LV_EVE_EVE_MIDI_C_5 ((uint8_t) 73U) -#define LV_EVE_EVE_MIDI_D5 ((uint8_t) 74U) -#define LV_EVE_EVE_MIDI_D_5 ((uint8_t) 75U) -#define LV_EVE_EVE_MIDI_E5 ((uint8_t) 76U) -#define LV_EVE_EVE_MIDI_F5 ((uint8_t) 77U) -#define LV_EVE_EVE_MIDI_F_5 ((uint8_t) 78U) -#define LV_EVE_EVE_MIDI_G5 ((uint8_t) 79U) -#define LV_EVE_EVE_MIDI_G_5 ((uint8_t) 80U) -#define LV_EVE_EVE_MIDI_A5 ((uint8_t) 81U) -#define LV_EVE_EVE_MIDI_A_5 ((uint8_t) 82U) -#define LV_EVE_EVE_MIDI_B5 ((uint8_t) 83U) -#define LV_EVE_EVE_MIDI_C6 ((uint8_t) 84U) -#define LV_EVE_EVE_MIDI_C_6 ((uint8_t) 85U) -#define LV_EVE_EVE_MIDI_D6 ((uint8_t) 86U) -#define LV_EVE_EVE_MIDI_D_6 ((uint8_t) 87U) -#define LV_EVE_EVE_MIDI_E6 ((uint8_t) 88U) -#define LV_EVE_EVE_MIDI_F6 ((uint8_t) 89U) -#define LV_EVE_EVE_MIDI_F_6 ((uint8_t) 90U) -#define LV_EVE_EVE_MIDI_G6 ((uint8_t) 91U) -#define LV_EVE_EVE_MIDI_G_6 ((uint8_t) 92U) -#define LV_EVE_EVE_MIDI_A6 ((uint8_t) 93U) -#define LV_EVE_EVE_MIDI_A_6 ((uint8_t) 94U) -#define LV_EVE_EVE_MIDI_B6 ((uint8_t) 95U) -#define LV_EVE_EVE_MIDI_C7 ((uint8_t) 96U) -#define LV_EVE_EVE_MIDI_C_7 ((uint8_t) 97U) -#define LV_EVE_EVE_MIDI_D7 ((uint8_t) 98U) -#define LV_EVE_EVE_MIDI_D_7 ((uint8_t) 99U) -#define LV_EVE_EVE_MIDI_E7 ((uint8_t) 100U) -#define LV_EVE_EVE_MIDI_F7 ((uint8_t) 101U) -#define LV_EVE_EVE_MIDI_F_7 ((uint8_t) 102U) -#define LV_EVE_EVE_MIDI_G7 ((uint8_t) 103U) -#define LV_EVE_EVE_MIDI_G_7 ((uint8_t) 104U) -#define LV_EVE_EVE_MIDI_A7 ((uint8_t) 105U) -#define LV_EVE_EVE_MIDI_A_7 ((uint8_t) 106U) -#define LV_EVE_EVE_MIDI_B7 ((uint8_t) 107U) -#define LV_EVE_EVE_MIDI_C8 ((uint8_t) 108U) - -/* GPIO bits */ -#define LV_EVE_EVE_GPIO0 ((uint8_t) 0U) -#define LV_EVE_EVE_GPIO1 ((uint8_t) 1U) /* default gpio pin for audio shutdown, 1 - enable, 0 - disable */ -#define LV_EVE_EVE_GPIO7 ((uint8_t) 7U) /* default gpio pin for display enable, 1 - enable, 0 - disable */ - -/* Display rotation */ -#define LV_EVE_EVE_DISPLAY_0 ((uint8_t) 0U) /* 0 degrees rotation */ -#define LV_EVE_EVE_DISPLAY_180 ((uint8_t) 1U) /* 180 degrees rotation */ - -/* Commands */ -#define LV_EVE_CMD_APPEND ((uint32_t) 0xFFFFFF1EUL) -#define LV_EVE_CMD_BGCOLOR ((uint32_t) 0xFFFFFF09UL) -#define LV_EVE_CMD_BUTTON ((uint32_t) 0xFFFFFF0DUL) -#define LV_EVE_CMD_CALIBRATE ((uint32_t) 0xFFFFFF15UL) -#define LV_EVE_CMD_CLOCK ((uint32_t) 0xFFFFFF14UL) -#define LV_EVE_CMD_COLDSTART ((uint32_t) 0xFFFFFF32UL) -#define LV_EVE_CMD_DIAL ((uint32_t) 0xFFFFFF2DUL) -#define LV_EVE_CMD_DLSTART ((uint32_t) 0xFFFFFF00UL) -#define LV_EVE_CMD_FGCOLOR ((uint32_t) 0xFFFFFF0AUL) -#define LV_EVE_CMD_GAUGE ((uint32_t) 0xFFFFFF13UL) -#define LV_EVE_CMD_GETMATRIX ((uint32_t) 0xFFFFFF33UL) -#define LV_EVE_CMD_GETPROPS ((uint32_t) 0xFFFFFF25UL) -#define LV_EVE_CMD_GETPTR ((uint32_t) 0xFFFFFF23UL) -#define LV_EVE_CMD_GRADCOLOR ((uint32_t) 0xFFFFFF34UL) -#define LV_EVE_CMD_GRADIENT ((uint32_t) 0xFFFFFF0BUL) -#define LV_EVE_CMD_INFLATE ((uint32_t) 0xFFFFFF22UL) -#define LV_EVE_CMD_INTERRUPT ((uint32_t) 0xFFFFFF02UL) -#define LV_EVE_CMD_KEYS ((uint32_t) 0xFFFFFF0EUL) -#define LV_EVE_CMD_LOADIDENTITY ((uint32_t) 0xFFFFFF26UL) -#define LV_EVE_CMD_LOADIMAGE ((uint32_t) 0xFFFFFF24UL) -#define LV_EVE_CMD_LOGO ((uint32_t) 0xFFFFFF31UL) -#define LV_EVE_CMD_MEDIAFIFO ((uint32_t) 0xFFFFFF39UL) -#define LV_EVE_CMD_MEMCPY ((uint32_t) 0xFFFFFF1DUL) -#define LV_EVE_CMD_MEMCRC ((uint32_t) 0xFFFFFF18UL) -#define LV_EVE_CMD_MEMSET ((uint32_t) 0xFFFFFF1BUL) -#define LV_EVE_CMD_MEMWRITE ((uint32_t) 0xFFFFFF1AUL) -#define LV_EVE_CMD_MEMZERO ((uint32_t) 0xFFFFFF1CUL) -#define LV_EVE_CMD_NUMBER ((uint32_t) 0xFFFFFF2EUL) -#define LV_EVE_CMD_PLAYVIDEO ((uint32_t) 0xFFFFFF3AUL) -#define LV_EVE_CMD_PROGRESS ((uint32_t) 0xFFFFFF0FUL) -#define LV_EVE_CMD_REGREAD ((uint32_t) 0xFFFFFF19UL) -#define LV_EVE_CMD_ROMFONT ((uint32_t) 0xFFFFFF3FUL) -#define LV_EVE_CMD_ROTATE ((uint32_t) 0xFFFFFF29UL) -#define LV_EVE_CMD_SCALE ((uint32_t) 0xFFFFFF28UL) -#define LV_EVE_CMD_SCREENSAVER ((uint32_t) 0xFFFFFF2FUL) -#define LV_EVE_CMD_SCROLLBAR ((uint32_t) 0xFFFFFF11UL) -#define LV_EVE_CMD_SETBASE ((uint32_t) 0xFFFFFF38UL) -#define LV_EVE_CMD_SETBITMAP ((uint32_t) 0xFFFFFF43UL) -#define LV_EVE_CMD_SETFONT ((uint32_t) 0xFFFFFF2BUL) -#define LV_EVE_CMD_SETFONT2 ((uint32_t) 0xFFFFFF3BUL) -#define LV_EVE_CMD_SETMATRIX ((uint32_t) 0xFFFFFF2AUL) -#define LV_EVE_CMD_SETROTATE ((uint32_t) 0xFFFFFF36UL) -#define LV_EVE_CMD_SETSCRATCH ((uint32_t) 0xFFFFFF3CUL) -#define LV_EVE_CMD_SKETCH ((uint32_t) 0xFFFFFF30UL) -#define LV_EVE_CMD_SLIDER ((uint32_t) 0xFFFFFF10UL) -#define LV_EVE_CMD_SNAPSHOT ((uint32_t) 0xFFFFFF1FUL) -#define LV_EVE_CMD_SNAPSHOT2 ((uint32_t) 0xFFFFFF37UL) -#define LV_EVE_CMD_SPINNER ((uint32_t) 0xFFFFFF16UL) -#define LV_EVE_CMD_STOP ((uint32_t) 0xFFFFFF17UL) -#define LV_EVE_CMD_SWAP ((uint32_t) 0xFFFFFF01UL) -#define LV_EVE_CMD_TEXT ((uint32_t) 0xFFFFFF0CUL) -#define LV_EVE_CMD_TOGGLE ((uint32_t) 0xFFFFFF12UL) -#define LV_EVE_CMD_TRACK ((uint32_t) 0xFFFFFF2CUL) -#define LV_EVE_CMD_TRANSLATE ((uint32_t) 0xFFFFFF27UL) -#define LV_EVE_CMD_VIDEOFRAME ((uint32_t) 0xFFFFFF41UL) -#define LV_EVE_CMD_VIDEOSTART ((uint32_t) 0xFFFFFF40UL) - -/* Registers */ -#define LV_EVE_REG_ANA_COMP ((uint32_t) 0x00302184UL) /* only listed in datasheet */ -#define LV_EVE_REG_BIST_EN ((uint32_t) 0x00302174UL) /* only listed in datasheet */ -#define LV_EVE_REG_CLOCK ((uint32_t) 0x00302008UL) -#define LV_EVE_REG_CMDB_SPACE ((uint32_t) 0x00302574UL) -#define LV_EVE_REG_CMDB_WRITE ((uint32_t) 0x00302578UL) -#define LV_EVE_REG_CMD_DL ((uint32_t) 0x00302100UL) -#define LV_EVE_REG_CMD_READ ((uint32_t) 0x003020f8UL) -#define LV_EVE_REG_CMD_WRITE ((uint32_t) 0x003020fcUL) -#define LV_EVE_REG_CPURESET ((uint32_t) 0x00302020UL) -#define LV_EVE_REG_CSPREAD ((uint32_t) 0x00302068UL) -#define LV_EVE_REG_CTOUCH_EXTENDED ((uint32_t) 0x00302108UL) -#define LV_EVE_REG_CTOUCH_TOUCH0_XY ((uint32_t) 0x00302124UL) /* only listed in datasheet */ -#define LV_EVE_REG_CTOUCH_TOUCH4_X ((uint32_t) 0x0030216cUL) -#define LV_EVE_REG_CTOUCH_TOUCH4_Y ((uint32_t) 0x00302120UL) -#define LV_EVE_REG_CTOUCH_TOUCH1_XY ((uint32_t) 0x0030211cUL) -#define LV_EVE_REG_CTOUCH_TOUCH2_XY ((uint32_t) 0x0030218cUL) -#define LV_EVE_REG_CTOUCH_TOUCH3_XY ((uint32_t) 0x00302190UL) -#define LV_EVE_REG_TOUCH_CONFIG ((uint32_t) 0x00302168UL) -#define LV_EVE_REG_DATESTAMP ((uint32_t) 0x00302564UL) /* only listed in datasheet */ -#define LV_EVE_REG_DITHER ((uint32_t) 0x00302060UL) -#define LV_EVE_REG_DLSWAP ((uint32_t) 0x00302054UL) -#define LV_EVE_REG_FRAMES ((uint32_t) 0x00302004UL) -#define LV_EVE_REG_FREQUENCY ((uint32_t) 0x0030200cUL) -#define LV_EVE_REG_GPIO ((uint32_t) 0x00302094UL) -#define LV_EVE_REG_GPIOX ((uint32_t) 0x0030209cUL) -#define LV_EVE_REG_GPIOX_DIR ((uint32_t) 0x00302098UL) -#define LV_EVE_REG_GPIO_DIR ((uint32_t) 0x00302090UL) -#define LV_EVE_REG_HCYCLE ((uint32_t) 0x0030202cUL) -#define LV_EVE_REG_HOFFSET ((uint32_t) 0x00302030UL) -#define LV_EVE_REG_HSIZE ((uint32_t) 0x00302034UL) -#define LV_EVE_REG_HSYNC0 ((uint32_t) 0x00302038UL) -#define LV_EVE_REG_HSYNC1 ((uint32_t) 0x0030203cUL) -#define LV_EVE_REG_ID ((uint32_t) 0x00302000UL) -#define LV_EVE_REG_INT_EN ((uint32_t) 0x003020acUL) -#define LV_EVE_REG_INT_FLAGS ((uint32_t) 0x003020a8UL) -#define LV_EVE_REG_INT_MASK ((uint32_t) 0x003020b0UL) -#define LV_EVE_REG_MACRO_0 ((uint32_t) 0x003020d8UL) -#define LV_EVE_REG_MACRO_1 ((uint32_t) 0x003020dcUL) -#define LV_EVE_REG_MEDIAFIFO_READ ((uint32_t) 0x00309014UL) /* only listed in programmers guide */ -#define LV_EVE_REG_MEDIAFIFO_WRITE ((uint32_t) 0x00309018UL) /* only listed in programmers guide */ -#define LV_EVE_REG_OUTBITS ((uint32_t) 0x0030205cUL) -#define LV_EVE_REG_PCLK ((uint32_t) 0x00302070UL) -#define LV_EVE_REG_PCLK_POL ((uint32_t) 0x0030206cUL) -#define LV_EVE_REG_PLAY ((uint32_t) 0x0030208cUL) -#define LV_EVE_REG_PLAYBACK_FORMAT ((uint32_t) 0x003020c4UL) -#define LV_EVE_REG_PLAYBACK_FREQ ((uint32_t) 0x003020c0UL) -#define LV_EVE_REG_PLAYBACK_LENGTH ((uint32_t) 0x003020b8UL) -#define LV_EVE_REG_PLAYBACK_LOOP ((uint32_t) 0x003020c8UL) -#define LV_EVE_REG_PLAYBACK_PLAY ((uint32_t) 0x003020ccUL) -#define LV_EVE_REG_PLAYBACK_READPTR ((uint32_t) 0x003020bcUL) -#define LV_EVE_REG_PLAYBACK_START ((uint32_t) 0x003020b4UL) -#define LV_EVE_REG_PWM_DUTY ((uint32_t) 0x003020d4UL) -#define LV_EVE_REG_PWM_HZ ((uint32_t) 0x003020d0UL) -#define LV_EVE_REG_RENDERMODE ((uint32_t) 0x00302010UL) /* only listed in datasheet */ -#define LV_EVE_REG_ROTATE ((uint32_t) 0x00302058UL) -#define LV_EVE_REG_SNAPFORMAT ((uint32_t) 0x0030201cUL) /* only listed in datasheet */ -#define LV_EVE_REG_SNAPSHOT ((uint32_t) 0x00302018UL) /* only listed in datasheet */ -#define LV_EVE_REG_SNAPY ((uint32_t) 0x00302014UL) /* only listed in datasheet */ -#define LV_EVE_REG_SOUND ((uint32_t) 0x00302088UL) -#define LV_EVE_REG_SPI_WIDTH ((uint32_t) 0x00302188UL) /* listed with false offset in programmers guide V1.1 */ -#define LV_EVE_REG_SWIZZLE ((uint32_t) 0x00302064UL) -#define LV_EVE_REG_TAG ((uint32_t) 0x0030207cUL) -#define LV_EVE_REG_TAG_X ((uint32_t) 0x00302074UL) -#define LV_EVE_REG_TAG_Y ((uint32_t) 0x00302078UL) -#define LV_EVE_REG_TAP_CRC ((uint32_t) 0x00302024UL) /* only listed in datasheet */ -#define LV_EVE_REG_TAP_MASK ((uint32_t) 0x00302028UL) /* only listed in datasheet */ -#define LV_EVE_REG_TOUCH_ADC_MODE ((uint32_t) 0x00302108UL) -#define LV_EVE_REG_TOUCH_CHARGE ((uint32_t) 0x0030210cUL) -#define LV_EVE_REG_TOUCH_DIRECT_XY ((uint32_t) 0x0030218cUL) -#define LV_EVE_REG_TOUCH_DIRECT_Z1Z2 ((uint32_t) 0x00302190UL) -#define LV_EVE_REG_TOUCH_MODE ((uint32_t) 0x00302104UL) -#define LV_EVE_REG_TOUCH_OVERSAMPLE ((uint32_t) 0x00302114UL) -#define LV_EVE_REG_TOUCH_RAW_XY ((uint32_t) 0x0030211cUL) -#define LV_EVE_REG_TOUCH_RZ ((uint32_t) 0x00302120UL) -#define LV_EVE_REG_TOUCH_RZTHRESH ((uint32_t) 0x00302118UL) -#define LV_EVE_REG_TOUCH_SCREEN_XY ((uint32_t) 0x00302124UL) -#define LV_EVE_REG_TOUCH_SETTLE ((uint32_t) 0x00302110UL) -#define LV_EVE_REG_TOUCH_TAG ((uint32_t) 0x0030212cUL) -#define LV_EVE_REG_TOUCH_TAG1 ((uint32_t) 0x00302134UL) /* only listed in datasheet */ -#define LV_EVE_REG_TOUCH_TAG1_XY ((uint32_t) 0x00302130UL) /* only listed in datasheet */ -#define LV_EVE_REG_TOUCH_TAG2 ((uint32_t) 0x0030213cUL) /* only listed in datasheet */ -#define LV_EVE_REG_TOUCH_TAG2_XY ((uint32_t) 0x00302138UL) /* only listed in datasheet */ -#define LV_EVE_REG_TOUCH_TAG3 ((uint32_t) 0x00302144UL) /* only listed in datasheet */ -#define LV_EVE_REG_TOUCH_TAG3_XY ((uint32_t) 0x00302140UL) /* only listed in datasheet */ -#define LV_EVE_REG_TOUCH_TAG4 ((uint32_t) 0x0030214cUL)/* only listed in datasheet */ -#define LV_EVE_REG_TOUCH_TAG4_XY ((uint32_t) 0x00302148UL) /* only listed in datasheet */ -#define LV_EVE_REG_TOUCH_TAG_XY ((uint32_t) 0x00302128UL) -#define LV_EVE_REG_TOUCH_TRANSFORM_A ((uint32_t) 0x00302150UL) -#define LV_EVE_REG_TOUCH_TRANSFORM_B ((uint32_t) 0x00302154UL) -#define LV_EVE_REG_TOUCH_TRANSFORM_C ((uint32_t) 0x00302158UL) -#define LV_EVE_REG_TOUCH_TRANSFORM_D ((uint32_t) 0x0030215cUL) -#define LV_EVE_REG_TOUCH_TRANSFORM_E ((uint32_t) 0x00302160UL) -#define LV_EVE_REG_TOUCH_TRANSFORM_F ((uint32_t) 0x00302164UL) -#define LV_EVE_REG_TRACKER ((uint32_t) 0x00309000UL) /* only listed in programmers guide */ -#define LV_EVE_REG_TRACKER_1 ((uint32_t) 0x00309004UL) /* only listed in programmers guide */ -#define LV_EVE_REG_TRACKER_2 ((uint32_t) 0x00309008UL) /* only listed in programmers guide */ -#define LV_EVE_REG_TRACKER_3 ((uint32_t) 0x0030900cUL) /* only listed in programmers guide */ -#define LV_EVE_REG_TRACKER_4 ((uint32_t) 0x00309010UL) /* only listed in programmers guide */ -#define LV_EVE_REG_TRIM ((uint32_t) 0x00302180UL) -#define LV_EVE_REG_VCYCLE ((uint32_t) 0x00302040UL) -#define LV_EVE_REG_VOFFSET ((uint32_t) 0x00302044UL) -#define LV_EVE_REG_VOL_PB ((uint32_t) 0x00302080UL) -#define LV_EVE_REG_VOL_SOUND ((uint32_t) 0x00302084UL) -#define LV_EVE_REG_VSIZE ((uint32_t) 0x00302048UL) -#define LV_EVE_REG_VSYNC0 ((uint32_t) 0x0030204cUL) -#define LV_EVE_REG_VSYNC1 ((uint32_t) 0x00302050UL) - - -/* Macros for static display list generation */ - -//#define LV_EVE_ALPHA_FUNC(func,ref) ((LV_EVE_DL_ALPHA_FUNC) | (((func) & 7UL) << 8U) | ((ref) & 0xFFUL)) -/** - * @brief Set the alpha test function. - * - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_ALPHA_FUNC(uint8_t func, uint8_t ref) -{ - uint32_t const funcv = ((uint32_t) func & 7U) << 8U; - return (LV_EVE_DL_ALPHA_FUNC | funcv | ref); -} - -//#define LV_EVE_BITMAP_HANDLE(handle) ((LV_EVE_DL_BITMAP_HANDLE) | ((handle) & 0x1FUL)) -/** - * @brief Set the bitmap handle. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_HANDLE(uint8_t handle) -{ - return (LV_EVE_DL_BITMAP_HANDLE | ((handle) & 0x1FUL)); -} - -//#define LV_EVE_BITMAP_LAYOUT(format,linestride,height) ((LV_EVE_DL_BITMAP_LAYOUT) | (((format) & 0x1FUL) << 19U) | (((linestride) & 0x3FFUL) << 9U) | ((height) & 0x1FFUL)) -/** - * @brief Set the source bitmap memory format and layout for the current handle. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_LAYOUT(uint8_t format, uint16_t linestride, uint16_t height) -{ - uint32_t const formatv = ((uint32_t) format & 0x1FUL) << 19U; - uint32_t const linestridev = ((uint32_t) linestride & 0x3FFUL) << 9U; - uint32_t const heightv = height & 0x1FFUL; - return (LV_EVE_DL_BITMAP_LAYOUT | formatv | linestridev | heightv); -} - -//#define LV_EVE_BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((LV_EVE_DL_BITMAP_SIZE) | (((filter) & 1UL) << 20U) | (((wrapx) & 1UL) << 19U) | (((wrapy) & 1UL) << 18U) | (((width) & 0x1FFUL) << 9U) | ((height) & 0x1FFUL)) -/** - * @brief Set the source bitmap memory format and layout for the current handle. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_SIZE(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height) -{ - uint32_t const filterv = (filter & 0x1UL) << 20U; - uint32_t const wrapxv = (wrapx & 0x1UL) << 19U; - uint32_t const wrapyv = (wrapy & 0x1UL) << 18U; - uint32_t const widthv = (width & 0x1FFUL) << 9U; - uint32_t const heightv = height & 0x1FFUL; - return (LV_EVE_DL_BITMAP_SIZE | filterv | wrapxv | wrapyv | widthv | heightv); -} - -//#define LV_EVE_BITMAP_LAYOUT_H(linestride,height) ((LV_EVE_DL_BITMAP_LAYOUT_H) | (((((linestride) & 0xC00U) >> 10U)&3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) -/** - * @brief Set the 2 most significant bits of the source bitmap memory format and layout for the current handle. - * @param linestride 12-bit value specified to BITMAP_LAYOUT - * @param height 11-bit value specified to BITMAP_LAYOUT - * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_LAYOUT_H(uint16_t linestride, uint16_t height) -{ - uint32_t const linestridev = (uint32_t)((((linestride & 0xC00U) >> 10U) & 3UL) << 2U); - uint32_t const heightv = (uint32_t)(((height & 0x600U) >> 9U) & 3UL); - return (LV_EVE_DL_BITMAP_LAYOUT_H | linestridev | heightv); -} - -//#define LV_EVE_BITMAP_SIZE_H(width,height) ((LV_EVE_DL_BITMAP_SIZE_H) | (((((width) & 0x600U) >> 9U) & 3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) -/** - * @brief Set the 2 most significant bits of bitmaps dimension for the current handle. - * @param linestride 11-bit value of bitmap width, the 2 most significant bits are used - * @param height 11-bit value of bitmap width, the 2 most significant bits are used - * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_SIZE_H(uint16_t width, uint16_t height) -{ - uint32_t const widthv = (uint32_t)((((width & 0x600U) >> 9U) & 3UL) << 2U); - uint32_t const heightv = (uint32_t)(((height & 0x600U) >> 9U) & 3UL); - return ((LV_EVE_DL_BITMAP_SIZE_H) | widthv | heightv); -} - -//#define LV_EVE_BITMAP_SOURCE(addr) ((LV_EVE_DL_BITMAP_SOURCE) | ((addr) & 0x3FFFFFUL)) -/** - * @brief Set the source address of bitmap data in RAM_G or flash memory. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_SOURCE(uint32_t addr) -{ - return (LV_EVE_DL_BITMAP_SOURCE | (addr & 0x3FFFFFUL)); -} - -#if LV_DRAW_EVE_EVE_GENERATION < 3 /* only define these for FT81x */ -//#define LV_EVE_BITMAP_TRANSFORM_A(a) ((LV_EVE_DL_BITMAP_TRANSFORM_A) | ((a) & 0x1FFFFUL)) -/** - * @brief Set the A coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_A(uint32_t val) -{ - return (LV_EVE_DL_BITMAP_TRANSFORM_A | (val & 0x1FFFFUL)); -} - -//#define LV_EVE_BITMAP_TRANSFORM_B(b) ((LV_EVE_DL_BITMAP_TRANSFORM_B) | ((b) & 0x1FFFFUL)) -/** - * @brief Set the B coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_B(uint32_t val) -{ - return (LV_EVE_DL_BITMAP_TRANSFORM_B | (val & 0x1FFFFUL)); -} - -//#define LV_EVE_BITMAP_TRANSFORM_D(d) ((LV_EVE_DL_BITMAP_TRANSFORM_D) | ((d) & 0x1FFFFUL)) -/** - * @brief Set the D coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_D(uint32_t val) -{ - return (LV_EVE_DL_BITMAP_TRANSFORM_D | (val & 0x1FFFFUL)); -} - -//#define LV_EVE_BITMAP_TRANSFORM_E(e) ((LV_EVE_DL_BITMAP_TRANSFORM_E) | ((e) & 0x1FFFFUL)) -/** - * @brief Set he E coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_E(uint32_t val) -{ - return (LV_EVE_DL_BITMAP_TRANSFORM_E | (val & 0x1FFFFUL)); -} - -#endif - -//#define LV_EVE_BITMAP_TRANSFORM_C(c) ((LV_EVE_DL_BITMAP_TRANSFORM_C) | ((c) & 0x1FFFFUL)) -/** - * @brief Set the C coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_C(uint32_t val) -{ - return (LV_EVE_DL_BITMAP_TRANSFORM_C | (val & 0x1FFFFUL)); -} - -//#define LV_EVE_BITMAP_TRANSFORM_F(f) ((LV_EVE_DL_BITMAP_TRANSFORM_F) | ((f) & 0x1FFFFUL)) -/** - * @brief Set the F coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_F(uint32_t val) -{ - return (LV_EVE_DL_BITMAP_TRANSFORM_F | (val & 0x1FFFFUL)); -} - -//#define LV_EVE_BLEND_FUNC(src,dst) ((LV_EVE_DL_BLEND_FUNC) | (((src) & 7UL) << 3U) | ((dst) & 7UL)) -/** - * @brief Execute a sequence of commands at another location in the display list. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BLEND_FUNC(uint8_t src, uint8_t dst) -{ - uint32_t const srcv = (uint32_t)((src & 7UL) << 3U); - uint32_t const dstv = (uint32_t)(dst & 7UL); - return (LV_EVE_DL_BLEND_FUNC | srcv | dstv); -} - -//#define LV_EVE_CALL(dest) ((LV_EVE_DL_CALL) | ((dest) & 0xFFFFUL)) -/** - * @brief Execute a sequence of commands at another location in the display list. - * @note valid range for dest is from zero to 2047 - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_CALL(uint16_t dest) -{ - return (LV_EVE_DL_CALL | (dest & 0x7FFUL)); -} - -//#define LV_EVE_JUMP(dest) ((LV_EVE_DL_JUMP) | ((dest) & 0xFFFFUL)) -/** - * @brief Execute commands at another location in the display list. - * @note valid range for dest is from zero to 2047 - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_JUMP(uint16_t dest) -{ - return (LV_EVE_DL_JUMP | (dest & 0x7FFUL)); -} - -//#define LV_EVE_CELL(cell) ((LV_EVE_DL_CELL) | ((cell) & 0x7FUL)) -/** - * @brief Set the bitmap cell number for the VERTEX2F command. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_CELL(uint8_t cell) -{ - return (LV_EVE_DL_CELL | (cell & 0x7FUL)); -} - -//#define LV_EVE_CLEAR(c,s,t) ((LV_EVE_DL_CLEAR) | (((c) & 1UL) << 2U) | (((s) & 1UL) << 1U) | ((t) & 1UL)) -/** - * @brief Clear buffers to preset values. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_CLEAR(uint8_t color, uint8_t stencil, uint8_t tag) -{ - uint32_t const colorv = (color & 1UL) << 2U; - uint32_t const stencilv = (stencil & 1UL) << 1U; - uint32_t const tagv = (tag & 1UL); - return (LV_EVE_DL_CLEAR | colorv | stencilv | tagv); -} - -//#define LV_EVE_CLEAR_COLOR_A(alpha) ((LV_EVE_DL_CLEAR_COLOR_A) | ((alpha) & 0xFFUL)) -/** - * @brief Set clear value for the alpha channel. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_CLEAR_COLOR_A(uint8_t alpha) -{ - return (LV_EVE_DL_CLEAR_COLOR_A | alpha); -} - -//#define LV_EVE_CLEAR_COLOR_RGB(red,green,blue) ((LV_EVE_DL_CLEAR_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) -/** - * @brief Set clear values for red, green and blue channels. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) -{ - uint32_t const redv = ((red & 0xFFUL) << 16U); - uint32_t const greenv = ((green & 0xFFUL) << 8U); - uint32_t const bluev = (blue & 0xFFUL); - return (LV_EVE_DL_CLEAR_COLOR_RGB | redv | greenv | bluev); -} - -//#define LV_EVE_CLEAR_STENCIL(s) ((LV_EVE_DL_CLEAR_STENCIL) | ((s) & 0xFFUL)) -/** - * @brief Set clear value for the stencil buffer. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_CLEAR_STENCIL(uint8_t val) -{ - return (LV_EVE_DL_CLEAR_STENCIL | val); -} - -//#define LV_EVE_CLEAR_TAG(s) ((LV_EVE_DL_CLEAR_TAG) | ((s) & 0xFFUL)) -/** - * @brief Set clear value for the tag buffer. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_CLEAR_TAG(uint8_t val) -{ - return (LV_EVE_DL_CLEAR_TAG | val); -} - -//#define LV_EVE_COLOR_A(alpha) ((LV_EVE_DL_COLOR_A) | ((alpha) & 0xFFUL)) -/** - * @brief Set the current color alpha. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_COLOR_A(uint8_t alpha) -{ - return (LV_EVE_DL_COLOR_A | alpha); -} - -//#define LV_EVE_COLOR_MASK(r,g,b,a) ((LV_EVE_DL_COLOR_MASK) | (((r) & 1UL) << 3U) | (((g) & 1UL) << 2U) | (((b) & 1UL) << 1U) | ((a) & 1UL)) -/** - * @brief Enable or disable writing of color components. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_COLOR_MASK(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) -{ - uint32_t const redv = ((red & 1UL) << 3U); - uint32_t const greenv = ((green & 1UL) << 2U); - uint32_t const bluev = ((blue & 1UL) << 1U); - uint32_t const alphav = (alpha & 1UL); - return (LV_EVE_DL_COLOR_MASK | redv | greenv | bluev | alphav); -} - -//#define LV_EVE_COLOR_RGB(red,green,blue) ((LV_EVE_DL_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) -/** - * @brief Set the current color red, green and blue. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) -{ - uint32_t const redv = ((red & 0xFFUL) << 16U); - uint32_t const greenv = ((green & 0xFFUL) << 8U); - uint32_t const bluev = (blue & 0xFFUL); - return (LV_EVE_DL_COLOR_RGB | redv | greenv | bluev); -} - -//#define LV_EVE_LINE_WIDTH(width) ((LV_EVE_DL_LINE_WIDTH) | (((uint32_t) (width)) & 0xFFFUL)) -/** - * @brief Set the width of lines to be drawn with primitive LINES in 1/16 pixel precision. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_LINE_WIDTH(uint16_t width) -{ - return (LV_EVE_DL_LINE_WIDTH | (width & 0xFFFUL)); -} - -//#define LV_EVE_MACRO(m) ((LV_EVE_DL_MACRO) | ((m) & 1UL)) -/** - * @brief Execute a single command from a macro register. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_MACRO(uint8_t macro) -{ - return (LV_EVE_DL_MACRO | (macro & 0x1UL)); -} - -//#define LV_EVE_PALETTE_SOURCE(addr) ((LV_EVE_DL_PALETTE_SOURCE) | ((addr) & 0x3FFFFF3UL)) -/** - * @brief Set the base address of the palette. - * @note 2-byte alignment is required if pixel format is PALETTE4444 or PALETTE565. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_PALETTE_SOURCE(uint32_t addr) -{ - return (LV_EVE_DL_PALETTE_SOURCE | (addr & 0x3FFFFFUL)); -} - -//#define LV_EVE_POINT_SIZE(size) ((LV_EVE_DL_POINT_SIZE) | ((size) & 0x1FFFUL)) -/** - * @brief Set the radius of points to be drawn with primitive POINTS in 1/16 pixel precision. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_POINT_SIZE(uint16_t size) -{ - return (LV_EVE_DL_POINT_SIZE | (size & 0x1FFFUL)); -} - -//#define LV_EVE_SCISSOR_SIZE(width,height) ((LV_EVE_DL_SCISSOR_SIZE) | (((width) & 0xFFFUL) << 12U) | ((height) & 0xFFFUL)) -/** - * @brief Set the size of the scissor clip rectangle. - * @note valid range for width and height is from zero to 2048 - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_SCISSOR_SIZE(uint16_t width, uint16_t height) -{ - uint32_t const widthv = (uint32_t)((width & 0xFFFUL) << 12U); - uint32_t const heightv = (uint32_t)(height & 0xFFFUL); - return (LV_EVE_DL_SCISSOR_SIZE | widthv | heightv); -} - -//#define LV_EVE_SCISSOR_XY(x,y) ((LV_EVE_DL_SCISSOR_XY) | (((x) & 0x7FFUL) << 11U) | ((y) & 0x7FFUL)) -/** - * @brief Set the top left corner of the scissor clip rectangle. - * @note valid range for width and height is from zero to 2047 - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_SCISSOR_XY(uint16_t xc0, uint16_t yc0) -{ - uint32_t const xc0v = (uint32_t)((xc0 & 0x7FFUL) << 11U); - uint32_t const yc0v = (uint32_t)(yc0 & 0x7FFUL); - return (LV_EVE_DL_SCISSOR_XY | xc0v | yc0v); -} - -//#define LV_EVE_STENCIL_FUNC(func,ref,mask) ((LV_EVE_DL_STENCIL_FUNC) | (((func) & 7UL) << 16U) | (((ref) & 0xFFUL) << 8U)|((mask) & 0xFFUL)) -/** - * @brief Set function and reference value for stencil testing. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_STENCIL_FUNC(uint8_t func, uint8_t ref, uint8_t mask) -{ - uint32_t const funcv = (uint32_t)((func & 7UL) << 16U); - uint32_t const refv = (uint32_t)((ref & 0xFFUL) << 8U); - uint32_t const maskv = (uint32_t)(mask & 0xFFUL); - return (LV_EVE_DL_STENCIL_FUNC | funcv | refv | maskv); -} - -//#define LV_EVE_STENCIL_MASK(mask) ((LV_EVE_DL_STENCIL_MASK) | ((mask) & 0xFFUL)) -/** - * @brief Control the writing of individual bits in the stencil planes. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_STENCIL_MASK(uint8_t mask) -{ - return (LV_EVE_DL_STENCIL_MASK | mask); -} - -//#define LV_EVE_STENCIL_OP(sfail,spass) ((LV_EVE_DL_STENCIL_OP) | (((sfail) & 7UL) << 3U) | ((spass) & 7UL)) -/** - * @brief Set stencil test actions. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_STENCIL_OP(uint8_t sfail, uint8_t spass) -{ - uint32_t const sfailv = (uint32_t)((sfail & 0x07UL) << 3U); - uint32_t const spassv = (uint32_t)(spass & 0x07UL); - return (LV_EVE_DL_STENCIL_OP | sfailv | spassv); -} - -//#define LV_EVE_TAG(s) ((LV_EVE_DL_TAG) | ((s) & 0xFFUL)) -/** - * @brief Attach the tag value for the following graphics objects drawn on the screen. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_TAG(uint8_t tagval) -{ - return (LV_EVE_DL_TAG | tagval); -} - -//#define LV_EVE_TAG_MASK(mask) ((LV_EVE_DL_TAG_MASK) | ((mask) & 1UL)) -/** - * @brief Control the writing of the tag buffer. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_TAG_MASK(uint8_t mask) -{ - return (LV_EVE_DL_TAG_MASK | ((mask) & 1UL)); -} - -//#define LV_EVE_VERTEX2F(x,y) ((LV_EVE_DL_VERTEX2F) | ((((uint32_t) (x)) & 0x7FFFUL) << 15U) | (((uint32_t) (y)) & 0x7FFFUL)) -/** - * @brief Set coordinates for graphics primitives. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_VERTEX2F(int16_t xc0, int16_t yc0) -{ - uint32_t const xc0v = ((((uint32_t)((uint16_t) xc0)) & 0x7FFFUL) << 15U); - uint32_t const yc0v = (((uint32_t)((uint16_t) yc0)) & 0x7FFFUL); - return (LV_EVE_DL_VERTEX2F | xc0v | yc0v); -} - -//#define LV_EVE_VERTEX2II(x,y,handle,cell) ((LV_EVE_DL_VERTEX2II) | (((x) & 0x1FFUL) << 21U) | (((y) & 0x1FFUL) << 12U) | (((handle) & 0x1FUL) << 7U) | ((cell) & 0x7FUL)) -/** - * @brief Set coordinates, bitmap-handle and cell-number for graphics primitives. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_VERTEX2II(uint16_t xc0, uint16_t yc0, uint8_t handle, uint8_t cell) -{ - uint32_t const xc0v = ((((uint32_t) xc0) & 0x1FFUL) << 21U); - uint32_t const yc0v = ((((uint32_t) yc0) & 0x1FFUL) << 12U); - uint32_t const handlev = ((((uint32_t) handle) & 0x1FUL) << 7U); - uint32_t const cellv = (((uint32_t) cell) & 0x7FUL); - return (LV_EVE_DL_VERTEX2II | xc0v | yc0v | handlev | cellv); -} - -//#define LV_EVE_VERTEX_FORMAT(frac) ((LV_EVE_DL_VERTEX_FORMAT) | ((frac) & 7UL)) -/** - * @brief Set the precision of VERTEX2F coordinates. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_VERTEX_FORMAT(uint8_t frac) -{ - return (LV_EVE_DL_VERTEX_FORMAT | ((frac) & 7UL)); -} - -//#define LV_EVE_VERTEX_TRANSLATE_X(x) ((LV_EVE_DL_VERTEX_TRANSLATE_X) | ((x) & 0x1FFFFUL)) -/** - * @brief Set the vertex transformations X translation component. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_VERTEX_TRANSLATE_X(int32_t xco) -{ - return (LV_EVE_DL_VERTEX_TRANSLATE_X | (((uint32_t) xco) & 0x1FFFFUL)); -} - -//#define LV_EVE_VERTEX_TRANSLATE_Y(y) ((LV_EVE_DL_VERTEX_TRANSLATE_Y) | ((y) & 0x1FFFFUL)) -/** - * @brief Set the vertex transformations Y translation component. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_VERTEX_TRANSLATE_Y(int32_t yco) -{ - return (LV_EVE_DL_VERTEX_TRANSLATE_Y | (((uint32_t) yco) & 0x1FFFFUL)); -} - -/* #define LV_EVE_BEGIN(prim) ((LV_EVE_DL_BEGIN) | ((prim) & 15UL)) */ /* use define LV_EVE_DL_BEGIN */ -/* #define LV_EVE_DISPLAY() ((LV_EVE_DL_DISPLAY)) */ /* use define LV_EVE_DL_DISPLAY */ -/* #define LV_EVE_END() ((LV_EVE_DL_END)) */ /* use define LV_EVE_DL_END */ -/* #define LV_EVE_RESTORE_CONTEXT() ((LV_EVE_DL_RESTORE_CONTEXT)) */ /* use define LV_EVE_DL_RESTORE_CONTEXT */ -/* #define LV_EVE_RETURN() ((LV_EVE_DL_RETURN)) */ /* use define LV_EVE_DL_RETURN */ -/* #define LV_EVE_SAVE_CONTEXT() ((LV_EVE_DL_SAVE_CONTEXT)) */ /* use define LV_EVE_DL_SAVE_CONTEXT */ -/* #define LV_EVE_NOP() ((LV_EVE_DL_NOP)) */ - -/* ########## EVE Generation 3: BT815 / BT816 definitions ########## */ - -#if LV_DRAW_EVE_EVE_GENERATION > 2 - -#define LV_EVE_EVE_GLFORMAT ((uint32_t) 31UL) /* used with BITMAP_LAYOUT to indicate bitmap-format is specified by BITMAP_EXT_FORMAT */ - -#define LV_EVE_DL_BITMAP_EXT_FORMAT ((uint32_t) 0x2E000000UL) /* requires OR'd arguments */ -#define LV_EVE_DL_BITMAP_SWIZZLE ((uint32_t) 0x2F000000UL) -/* #define LV_EVE_DL_INT_FRR ((uint32_t) 0x30000000UL) */ /* ESE displays "Internal: flash read result" - undocumented display list command */ - -/* Extended Bitmap formats */ -#define LV_EVE_EVE_ASTC_4X4 ((uint32_t) 37808UL) -#define LV_EVE_EVE_ASTC_5X4 ((uint32_t) 37809UL) -#define LV_EVE_EVE_ASTC_5X5 ((uint32_t) 37810UL) -#define LV_EVE_EVE_ASTC_6X5 ((uint32_t) 37811UL) -#define LV_EVE_EVE_ASTC_6X6 ((uint32_t) 37812UL) -#define LV_EVE_EVE_ASTC_8X5 ((uint32_t) 37813UL) -#define LV_EVE_EVE_ASTC_8X6 ((uint32_t) 37814UL) -#define LV_EVE_EVE_ASTC_8X8 ((uint32_t) 37815UL) -#define LV_EVE_EVE_ASTC_10X5 ((uint32_t) 37816UL) -#define LV_EVE_EVE_ASTC_10X6 ((uint32_t) 37817UL) -#define LV_EVE_EVE_ASTC_10X8 ((uint32_t) 37818UL) -#define LV_EVE_EVE_ASTC_10X10 ((uint32_t) 37819UL) -#define LV_EVE_EVE_ASTC_12X10 ((uint32_t) 37820UL) -#define LV_EVE_EVE_ASTC_12X12 ((uint32_t) 37821UL) - -#define LV_EVE_EVE_RAM_ERR_REPORT ((uint32_t) 0x309800UL) /* max 128 bytes null terminated string */ -#define LV_EVE_EVE_RAM_FLASH ((uint32_t) 0x800000UL) -#define LV_EVE_EVE_RAM_FLASH_POSTBLOB ((uint32_t) 0x801000UL) - -#define LV_EVE_EVE_OPT_FLASH ((uint16_t) 64U) -#define LV_EVE_EVE_OPT_OVERLAY ((uint16_t) 128U) -#define LV_EVE_EVE_OPT_FORMAT ((uint16_t) 4096U) -#define LV_EVE_EVE_OPT_FILL ((uint16_t) 8192U) - -/* Commands for BT815 / BT816 */ -#define LV_EVE_CMD_BITMAP_TRANSFORM ((uint32_t) 0xFFFFFF21UL) -#define LV_EVE_CMD_SYNC ((uint32_t) 0xFFFFFF42UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_SYNC) */ -#define LV_EVE_CMD_FLASHERASE ((uint32_t) 0xFFFFFF44UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHERASE) */ -#define LV_EVE_CMD_FLASHWRITE ((uint32_t) 0xFFFFFF45UL) -#define LV_EVE_CMD_FLASHREAD ((uint32_t) 0xFFFFFF46UL) -#define LV_EVE_CMD_FLASHUPDATE ((uint32_t) 0xFFFFFF47UL) -#define LV_EVE_CMD_FLASHDETACH ((uint32_t) 0xFFFFFF48UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHDETACH) */ -#define LV_EVE_CMD_FLASHATTACH ((uint32_t) 0xFFFFFF49UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHATTACH) */ -#define LV_EVE_CMD_FLASHFAST ((uint32_t) 0xFFFFFF4AUL) -#define LV_EVE_CMD_FLASHSPIDESEL ((uint32_t) 0xFFFFFF4BUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHSPIDESEL) */ -#define LV_EVE_CMD_FLASHSPITX ((uint32_t) 0xFFFFFF4CUL) -#define LV_EVE_CMD_FLASHSPIRX ((uint32_t) 0xFFFFFF4DUL) -#define LV_EVE_CMD_FLASHSOURCE ((uint32_t) 0xFFFFFF4EUL) -#define LV_EVE_CMD_CLEARCACHE ((uint32_t) 0xFFFFFF4FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_CLEARCACHE) */ -#define LV_EVE_CMD_INFLATE2 ((uint32_t) 0xFFFFFF50UL) -#define LV_EVE_CMD_ROTATEAROUND ((uint32_t) 0xFFFFFF51UL) -#define LV_EVE_CMD_RESETFONTS ((uint32_t) 0xFFFFFF52UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RESETFONTS) */ -#define LV_EVE_CMD_ANIMSTART ((uint32_t) 0xFFFFFF53UL) -#define LV_EVE_CMD_ANIMSTOP ((uint32_t) 0xFFFFFF54UL) -#define LV_EVE_CMD_ANIMXY ((uint32_t) 0xFFFFFF55UL) -#define LV_EVE_CMD_ANIMDRAW ((uint32_t) 0xFFFFFF56UL) -#define LV_EVE_CMD_GRADIENTA ((uint32_t) 0xFFFFFF57UL) -#define LV_EVE_CMD_FILLWIDTH ((uint32_t) 0xFFFFFF58UL) -#define LV_EVE_CMD_APPENDF ((uint32_t) 0xFFFFFF59UL) -#define LV_EVE_CMD_ANIMFRAME ((uint32_t) 0xFFFFFF5AUL) -#define LV_EVE_CMD_VIDEOSTARTF ((uint32_t) 0xFFFFFF5FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_VIDEOSTARTF) */ - -/* Registers for BT815 / BT816 */ -#define LV_EVE_REG_ADAPTIVE_FRAMERATE ((uint32_t) 0x0030257cUL) -#define LV_EVE_REG_PLAYBACK_PAUSE ((uint32_t) 0x003025ecUL) -#define LV_EVE_REG_FLASH_STATUS ((uint32_t) 0x003025f0UL) -#define LV_EVE_REG_FLASH_SIZE ((uint32_t) 0x00309024UL) -#define LV_EVE_REG_PLAY_CONTROL ((uint32_t) 0x0030914eUL) -#define LV_EVE_REG_COPRO_PATCH_PTR ((uint32_t) 0x00309162UL) - -/* Macros for BT815 / BT816 */ - -//#define LV_EVE_BITMAP_EXT_FORMAT(format) ((LV_EVE_DL_BITMAP_EXT_FORMAT) | ((format) & 0xFFFFUL)) -/** - * @brief Set the extended format of the bitmap. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_EXT_FORMAT(uint16_t format) -{ - return (LV_EVE_DL_BITMAP_EXT_FORMAT | format); -} - -//#define LV_EVE_BITMAP_SWIZZLE(r,g,b,a) ((LV_EVE_DL_BITMAP_SWIZZLE) | (((r) & 7UL) << 9U) | (((g) & 7UL) << 6U) | (((b) & 7UL) << 3U) | ((a) & 7UL)) -/** - * @brief Set the source for the red, green, blue and alpha channels of a bitmap. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_SWIZZLE(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) -{ - uint32_t const redv = ((red & 7UL) << 9U); - uint32_t const greenv = ((green & 7UL) << 6U); - uint32_t const bluev = ((blue & 7UL) << 3U); - uint32_t const alphav = (alpha & 7UL); - return (LV_EVE_DL_BITMAP_SWIZZLE | redv | greenv | bluev | alphav); -} - -//#define LV_EVE_BITMAP_TRANSFORM_A_EXT(p,v) ((LV_EVE_DL_BITMAP_TRANSFORM_A) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -/** - * @brief Set the A coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_A(uint8_t prc, uint32_t val) -{ - uint32_t const prcv = ((prc & 1UL) << 17U); - uint32_t const valv = (val & 0x1FFFFUL); - return (LV_EVE_DL_BITMAP_TRANSFORM_A | prcv | valv); -} - -//#define LV_EVE_BITMAP_TRANSFORM_B_EXT(p,v) ((LV_EVE_DL_BITMAP_TRANSFORM_B) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -/** - * @brief Set the B coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_B(uint8_t prc, uint32_t val) -{ - uint32_t const prcv = ((prc & 1UL) << 17U); - uint32_t const valv = (val & 0x1FFFFUL); - return (LV_EVE_DL_BITMAP_TRANSFORM_B | prcv | valv); -} - -//#define LV_EVE_BITMAP_TRANSFORM_D_EXT(p,v) ((LV_EVE_DL_BITMAP_TRANSFORM_D) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -/** - * @brief Set the D coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_D(uint8_t prc, uint32_t val) -{ - uint32_t const prcv = ((prc & 1UL) << 17U); - uint32_t const valv = (val & 0x1FFFFUL); - return (LV_EVE_DL_BITMAP_TRANSFORM_D | prcv | valv); -} - -//#define LV_EVE_BITMAP_TRANSFORM_E_EXT(p,v) ((LV_EVE_DL_BITMAP_TRANSFORM_E) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -/** - * @brief Set the E coefficient of the bitmap transform matrix. - * @return a 32 bit word for use with EVE_cmd_dl() - */ -static inline uint32_t LV_EVE_BITMAP_TRANSFORM_E(uint8_t prc, uint32_t val) -{ - uint32_t const prcv = ((prc & 1UL) << 17U); - uint32_t const valv = (val & 0x1FFFFUL); - return (LV_EVE_DL_BITMAP_TRANSFORM_E | prcv | valv); -} - -//#define LV_EVE_BITMAP_TRANSFORM_A(a) LV_EVE_BITMAP_TRANSFORM_A_EXT(0UL,(a)) -//#define LV_EVE_BITMAP_TRANSFORM_B(b) LV_EVE_BITMAP_TRANSFORM_B_EXT(0UL,(b)) -//#define LV_EVE_BITMAP_TRANSFORM_D(d) LV_EVE_BITMAP_TRANSFORM_D_EXT(0UL,(d)) -//#define LV_EVE_BITMAP_TRANSFORM_E(e) LV_EVE_BITMAP_TRANSFORM_E_EXT(0UL,(e)) - -#endif /* LV_DRAW_EVE_EVE_GENERATION > 2 */ - -/* ########## EVE Generation 4: BT817 / BT818 definitions ########## */ - -#if LV_DRAW_EVE_EVE_GENERATION > 3 - -/* Commands for BT817 / BT818 */ -#define LV_EVE_CMD_ANIMFRAMERAM ((uint32_t) 0xFFFFFF6DUL) -#define LV_EVE_CMD_ANIMSTARTRAM ((uint32_t) 0xFFFFFF6EUL) -#define LV_EVE_CMD_APILEVEL ((uint32_t) 0xFFFFFF63UL) -#define LV_EVE_CMD_CALIBRATESUB ((uint32_t) 0xFFFFFF60UL) -#define LV_EVE_CMD_CALLLIST ((uint32_t) 0xFFFFFF67UL) -#define LV_EVE_CMD_ENDLIST ((uint32_t) 0xFFFFFF69UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_ENDLIST) */ -#define LV_EVE_CMD_FLASHPROGRAM ((uint32_t) 0xFFFFFF70UL) -#define LV_EVE_CMD_FONTCACHE ((uint32_t) 0xFFFFFF6BUL) -#define LV_EVE_CMD_FONTCACHEQUERY ((uint32_t) 0xFFFFFF6CUL) -#define LV_EVE_CMD_GETIMAGE ((uint32_t) 0xFFFFFF64UL) -#define LV_EVE_CMD_HSF ((uint32_t) 0xFFFFFF62UL) -#define LV_EVE_CMD_LINETIME ((uint32_t) 0xFFFFFF5EUL) -#define LV_EVE_CMD_NEWLIST ((uint32_t) 0xFFFFFF68UL) -#define LV_EVE_CMD_PCLKFREQ ((uint32_t) 0xFFFFFF6AUL) -#define LV_EVE_CMD_RETURN ((uint32_t) 0xFFFFFF66UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RETURN) */ -#define LV_EVE_CMD_RUNANIM ((uint32_t) 0xFFFFFF6FUL) -#define LV_EVE_CMD_TESTCARD ((uint32_t) 0xFFFFFF61UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_TESTCARD) */ -#define LV_EVE_CMD_WAIT ((uint32_t) 0xFFFFFF65UL) - -/* Registers for BT817 / BT818 */ -#define LV_EVE_REG_UNDERRUN ((uint32_t) 0x0030260cUL) -#define LV_EVE_REG_AH_HCYCLE_MAX ((uint32_t) 0x00302610UL) -#define LV_EVE_REG_PCLK_FREQ ((uint32_t) 0x00302614UL) -#define LV_EVE_REG_PCLK_2X ((uint32_t) 0x00302618UL) -#define LV_EVE_REG_ANIM_ACTIVE ((uint32_t) 0x0030902CUL) - -#endif /* LV_DRAW_EVE_EVE_GENERATION > 3 */ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_DRAW_EVE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_EVE_DISPLAY_DEFINES_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/drivers/evdev/lv_evdev.c b/src/drivers/evdev/lv_evdev.c index 1b8319e049..da11f3ebee 100644 --- a/src/drivers/evdev/lv_evdev.c +++ b/src/drivers/evdev/lv_evdev.c @@ -23,17 +23,9 @@ #include #include #endif /*BSD*/ + #include "../../core/lv_global.h" -#include "../../misc/lv_types.h" -#include "../../misc/lv_assert.h" -#include "../../misc/lv_math.h" -#include "../../misc/lv_async.h" -#include "../../stdlib/lv_mem.h" -#include "../../stdlib/lv_string.h" -#include "../../display/lv_display.h" #include "../../display/lv_display_private.h" -#include "../../widgets/image/lv_image.h" -#include "../../indev/lv_indev_gesture.h" /********************* * DEFINES diff --git a/src/drivers/evdev/lv_evdev.h b/src/drivers/evdev/lv_evdev.h index ed00bb1e65..711bcfdb19 100644 --- a/src/drivers/evdev/lv_evdev.h +++ b/src/drivers/evdev/lv_evdev.h @@ -1,106 +1,2 @@ -/** - * @file lv_evdev.h - * - */ - -#ifndef LV_EVDEV_H -#define LV_EVDEV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../indev/lv_indev.h" - -#if LV_USE_EVDEV - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_EVDEV_TYPE_REL, /**< mice */ - LV_EVDEV_TYPE_ABS, /**< touch screens, mousepads */ - LV_EVDEV_TYPE_KEY /**< keyboards, keypads, buttons */ -} lv_evdev_type_t; - -/** - * @param indev the indev created for the newly discovered evdev - * @param type the type of the evdev - * @param user_data a custom parameter - */ -typedef void (*lv_evdev_discovery_cb_t)(lv_indev_t * indev, lv_evdev_type_t type, void * user_data); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create evdev input device from a given path. - * @param type LV_INDEV_TYPE_POINTER or LV_INDEV_TYPE_KEYPAD - * @param dev_path device path, e.g., /dev/input/event0 - * @return pointer to input device or NULL if opening failed - */ -lv_indev_t * lv_evdev_create(lv_indev_type_t indev_type, const char * dev_path); - -/** - * Create evdev input device, taking ownership of the given file descriptor. - * @param type LV_INDEV_TYPE_POINTER or LV_INDEV_TYPE_KEYPAD - * @param fd file descriptor of the evdev device - * @return pointer to input device or NULL if opening failed - */ -lv_indev_t * lv_evdev_create_fd(lv_indev_type_t indev_type, int fd); - -/** - * Begin automatically creating evdev indevs for all new and existing - * evdev devices found in /dev/input/ - * @param cb function to call when a new evdev indev is discovered, or `NULL` - * @param user_data parameter to pass to the callback - * @return the success or failure status. It will fail if it's - * already running or resources could not be initialized. - */ -lv_result_t lv_evdev_discovery_start(lv_evdev_discovery_cb_t cb, void * user_data); - -/** - * Stop automatically creating evdev indevs. Safe to call from the - * discovery callback. - * @return the success or failure status. It will fail if it's already running. - */ -lv_result_t lv_evdev_discovery_stop(void); - -/** - * Set whether coordinates of pointer device should be swapped. Defaults to - * false. - * @param indev evdev input device - * @param swap_axes whether to swap x and y axes - */ -void lv_evdev_set_swap_axes(lv_indev_t * indev, bool swap_axes); - -/** - * Configure a coordinate transformation for pointer devices. Applied after - * axis swap, if any. Defaults to apply no transformation. - * @param indev evdev input device - * @param min_x pointer coordinate mapped to min x of display - * @param min_y pointer coordinate mapped to min y of display - * @param max_x pointer coordinate mapped to max x of display - * @param max_y pointer coordinate mapped to max y of display - */ -void lv_evdev_set_calibration(lv_indev_t * indev, int min_x, int min_y, int max_x, int max_y); - -/** - * Remove evdev input device. - * @param indev evdev input device to close and free - */ -void lv_evdev_delete(lv_indev_t * indev); - -#endif /*LV_USE_EVDEV*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_EVDEV_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/evdev/lv_evdev_private.h b/src/drivers/evdev/lv_evdev_private.h index d9b3352d41..df20defe63 100644 --- a/src/drivers/evdev/lv_evdev_private.h +++ b/src/drivers/evdev/lv_evdev_private.h @@ -14,7 +14,8 @@ extern "C" { * INCLUDES *********************/ -#include "lv_evdev.h" + +#include "../../lv_public_api.h" #if LV_USE_EVDEV diff --git a/src/drivers/libinput/lv_libinput.h b/src/drivers/libinput/lv_libinput.h index ce19a33b5c..f6c4bb48d0 100644 --- a/src/drivers/libinput/lv_libinput.h +++ b/src/drivers/libinput/lv_libinput.h @@ -1,101 +1,2 @@ -/** - * @file lv_libinput.h - * - */ - -#ifndef LV_LIBINPUT_H -#define LV_LIBINPUT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../indev/lv_indev.h" - -#if LV_USE_LIBINPUT - -#include -#include - -#if LV_LIBINPUT_XKB -#include "lv_xkb.h" -#endif /* LV_LIBINPUT_XKB */ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_LIBINPUT_CAPABILITY_NONE = 0, - LV_LIBINPUT_CAPABILITY_KEYBOARD = 1U << 0, - LV_LIBINPUT_CAPABILITY_POINTER = 1U << 1, - LV_LIBINPUT_CAPABILITY_TOUCH = 1U << 2 -} lv_libinput_capability; - -struct libinput_device; - -#define LV_LIBINPUT_MAX_EVENTS 32 - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Determine the capabilities of a specific libinput device. - * @param device the libinput device to query - * @return the supported input capabilities - */ -lv_libinput_capability lv_libinput_query_capability(struct libinput_device * device); - -/** - * Find connected input device with specific capabilities - * @param capabilities required device capabilities - * @param force_rescan erase the device cache (if any) and rescan the file system for available devices - * @return device node path (e.g. /dev/input/event0) for the first matching device or NULL if no device was found. - * The pointer is safe to use until the next forceful device search. - */ -char * lv_libinput_find_dev(lv_libinput_capability capabilities, bool force_rescan); - -/** - * Find connected input devices with specific capabilities - * @param capabilities required device capabilities - * @param devices pre-allocated array to store the found device node paths (e.g. /dev/input/event0). The pointers are - * safe to use until the next forceful device search. - * @param count maximum number of devices to find (the devices array should be at least this long) - * @param force_rescan erase the device cache (if any) and rescan the file system for available devices - * @return number of devices that were found - */ -size_t lv_libinput_find_devs(lv_libinput_capability capabilities, char ** found, size_t count, bool force_rescan); - -/** - * Create a new libinput input device - * @param type LV_INDEV_TYPE_POINTER or LV_INDEV_TYPE_KEYPAD - * @param dev_path device path, e.g. /dev/input/event0 - * @return pointer to input device or NULL if opening failed - */ -lv_indev_t * lv_libinput_create(lv_indev_type_t indev_type, const char * dev_path); - -/** - * Delete a libinput input device - * @param indev pointer to input device - */ -void lv_libinput_delete(lv_indev_t * indev); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_LIBINPUT */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_LIBINPUT_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/libinput/lv_libinput_private.h b/src/drivers/libinput/lv_libinput_private.h index 2856bbefe9..68fcb76b2d 100644 --- a/src/drivers/libinput/lv_libinput_private.h +++ b/src/drivers/libinput/lv_libinput_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_libinput.h" +#include "../../lv_public_api.h" #if LV_USE_LIBINPUT diff --git a/src/drivers/libinput/lv_xkb.c b/src/drivers/libinput/lv_xkb.c index 1e8ddb10c6..a6b34a38e7 100644 --- a/src/drivers/libinput/lv_xkb.c +++ b/src/drivers/libinput/lv_xkb.c @@ -11,9 +11,6 @@ #if defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB -#include "../../core/lv_group.h" -#include "../../misc/lv_log.h" - #include #include #include diff --git a/src/drivers/libinput/lv_xkb.h b/src/drivers/libinput/lv_xkb.h index 5f45d99992..f61652f070 100644 --- a/src/drivers/libinput/lv_xkb.h +++ b/src/drivers/libinput/lv_xkb.h @@ -1,64 +1,2 @@ -/** - * @file lv_xkb.h - * - */ - -#ifndef LV_XKB_H -#define LV_XKB_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" - -#if defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB - -#include "../../misc/lv_types.h" -#include -#include - -/********************* - * DEFINES - *********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialise an XKB descriptor. - * @return true if the initialisation was successful - */ -bool lv_xkb_init(lv_xkb_t * dsc, struct xkb_rule_names names); - -/** - * De-initialise an XKB descriptor. - * @param dsc Pointer to descriptor - */ -void lv_xkb_deinit(lv_xkb_t * dsc); - -/** - * Process an evdev scancode using a specific XKB descriptor. - * @param state XKB descriptor to use - * @param scancode evdev scancode to process - * @param down true if the key was pressed, false if it was releases - * @return the (first) UTF-8 character produced by the event or 0 if no output was produced - */ -uint32_t lv_xkb_process_key(lv_xkb_t * dsc, uint32_t scancode, bool down); - -/********************** - * MACROS - **********************/ - -#endif /* defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_XKB_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/libinput/lv_xkb_private.h b/src/drivers/libinput/lv_xkb_private.h index 97aad74989..3ad7d0a45e 100644 --- a/src/drivers/libinput/lv_xkb_private.h +++ b/src/drivers/libinput/lv_xkb_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_xkb.h" +#include "../../lv_public_api.h" #if defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB diff --git a/src/drivers/lv_drivers.h b/src/drivers/lv_drivers.h index 8cc91ce21a..93304a38fc 100644 --- a/src/drivers/lv_drivers.h +++ b/src/drivers/lv_drivers.h @@ -1,89 +1,2 @@ -/** - * @file lv_drivers.h - * - */ - -#ifndef LV_DRIVERS_H -#define LV_DRIVERS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "sdl/lv_sdl_window.h" -#include "sdl/lv_sdl_mouse.h" -#include "sdl/lv_sdl_mousewheel.h" -#include "sdl/lv_sdl_keyboard.h" - -#include "x11/lv_x11.h" - -#include "display/drm/lv_linux_drm.h" -#include "display/fb/lv_linux_fbdev.h" - -#include "display/tft_espi/lv_tft_espi.h" -#include "display/lovyan_gfx/lv_lovyan_gfx.h" - -#include "display/lcd/lv_lcd_generic_mipi.h" -#include "display/ili9341/lv_ili9341.h" -#include "display/st7735/lv_st7735.h" -#include "display/st7789/lv_st7789.h" -#include "display/st7796/lv_st7796.h" -#include "display/nv3007/lv_nv3007.h" - -#include "display/renesas_glcdc/lv_renesas_glcdc.h" -#include "display/st_ltdc/lv_st_ltdc.h" -#include "display/ft81x/lv_ft81x.h" - -#include "draw/eve/lv_draw_eve_display.h" -#include "draw/eve/lv_draw_eve_display_defines.h" - -#include "nuttx/lv_nuttx_entry.h" -#include "nuttx/lv_nuttx_fbdev.h" -#include "nuttx/lv_nuttx_touchscreen.h" -#include "nuttx/lv_nuttx_lcd.h" -#include "nuttx/lv_nuttx_libuv.h" - -#include "evdev/lv_evdev.h" -#include "libinput/lv_libinput.h" - -#include "windows/lv_windows_input.h" -#include "windows/lv_windows_display.h" - -#include "opengles/lv_opengles_window.h" -#include "opengles/lv_opengles_texture.h" -#include "opengles/lv_opengles_driver.h" -#include "opengles/lv_opengles_glfw.h" -#include "opengles/lv_opengles_egl.h" - -#include "qnx/lv_qnx.h" - -#include "wayland/lv_wayland.h" - -#include "uefi/lv_uefi_context.h" -#include "uefi/lv_uefi_indev.h" -#include "uefi/lv_uefi_display.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRIVERS_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/drivers/nuttx/lv_nuttx_cache.c b/src/drivers/nuttx/lv_nuttx_cache.c index 9acd1b269e..c2b1b9963a 100644 --- a/src/drivers/nuttx/lv_nuttx_cache.c +++ b/src/drivers/nuttx/lv_nuttx_cache.c @@ -8,7 +8,7 @@ *********************/ #include "lv_nuttx_cache.h" -#include "../../../lvgl.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX diff --git a/src/drivers/nuttx/lv_nuttx_entry.c b/src/drivers/nuttx/lv_nuttx_entry.c index f4949caec3..19886bc4c3 100644 --- a/src/drivers/nuttx/lv_nuttx_entry.c +++ b/src/drivers/nuttx/lv_nuttx_entry.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_nuttx_entry.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX @@ -19,7 +19,7 @@ #include "../../core/lv_global.h" #include "lv_nuttx_profiler.h" #include "lv_nuttx_mouse.h" -#include "../../../lvgl.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX_LIBUV #include diff --git a/src/drivers/nuttx/lv_nuttx_entry.h b/src/drivers/nuttx/lv_nuttx_entry.h index 6100b96c2c..e176a1f9d7 100644 --- a/src/drivers/nuttx/lv_nuttx_entry.h +++ b/src/drivers/nuttx/lv_nuttx_entry.h @@ -1,116 +1,2 @@ -/** - * @file lv_nuttx_entry.h - * - */ - -/********************* - * INCLUDES - *********************/ - -#ifndef LV_NUTTX_ENTRY_H -#define LV_NUTTX_ENTRY_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" -#include "../../display/lv_display.h" -#include "../../indev/lv_indev.h" - -#if LV_USE_NUTTX - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef struct { - const char * fb_path; - const char * input_path; - const char * utouch_path; - const char * mouse_path; - const char * trace_path; -} lv_nuttx_dsc_t; - -typedef struct { - lv_display_t * disp; - lv_indev_t * indev; - lv_indev_t * utouch_indev; - lv_indev_t * mouse_indev; -} lv_nuttx_result_t; - -typedef struct _lv_nuttx_ctx_t { - void * image_cache; - int trace_fd; -} lv_nuttx_ctx_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the lv_nuttx_dsc_t structure with default values for the NuttX port of LVGL. - * @param dsc Pointer to the lv_nuttx_dsc_t structure to be initialized. - */ -void lv_nuttx_dsc_init(lv_nuttx_dsc_t * dsc); - -/** - * Initialize the LVGL display driver for NuttX using the provided configuration information. - * @param dsc Pointer to the lv_nuttx_dsc_t structure containing the configuration information for the display driver. - * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler. - */ -void lv_nuttx_init(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result); - -/** - * Deinitialize the LVGL display driver for NuttX. - * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler. - */ -void lv_nuttx_deinit(lv_nuttx_result_t * result); - -#if LV_USE_NUTTX_CUSTOM_INIT -/** - * Initialize the LVGL display driver for NuttX using the provided custom configuration information. - * @param dsc Pointer to the lv_nuttx_dsc_t structure containing the custom configuration for the display driver. - * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler. - */ -void lv_nuttx_init_custom(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result); - -/** - * Deinitialize the LVGL display driver for NuttX using the provided custom configuration information. - * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler. - */ -void lv_nuttx_deinit_custom(lv_nuttx_result_t * result); -#endif /* LV_USE_NUTTX_CUSTOM_INIT */ - -/** - * Call `lv_timer_handler()` (LVGL's super loop) in an endless loop. - * If LV_USE_NUTTX_LIBUV is enabled an UV timer will be created, - * else `lv_timer_handler()` will be called in a loop with some sleep. - * @param result pointer to a variable initialized by `lv_nuttx_init()` or `lv_nuttx_init_custom()` - */ -void lv_nuttx_run(lv_nuttx_result_t * result); - -/** - * Get the idle percentage of the system. - * @return The idle percentage of the system. - */ -uint32_t lv_nuttx_get_idle(void); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_NUTTX*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_NUTTX_ENTRY_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/nuttx/lv_nuttx_fbdev.c b/src/drivers/nuttx/lv_nuttx_fbdev.c index 4849c52094..ed7c808743 100644 --- a/src/drivers/nuttx/lv_nuttx_fbdev.c +++ b/src/drivers/nuttx/lv_nuttx_fbdev.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_nuttx_fbdev.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX #include @@ -25,7 +25,6 @@ #include "mock/nuttx_video_fb.h" #endif -#include "../../../lvgl.h" #include "../../lvgl_private.h" /********************* diff --git a/src/drivers/nuttx/lv_nuttx_fbdev.h b/src/drivers/nuttx/lv_nuttx_fbdev.h index 4310aa9c1d..8ddf3be102 100644 --- a/src/drivers/nuttx/lv_nuttx_fbdev.h +++ b/src/drivers/nuttx/lv_nuttx_fbdev.h @@ -1,55 +1,2 @@ -/** - * @file lv_nuttx_fbdev.h - * - */ - -#ifndef LV_NUTTX_FBDEV_H -#define LV_NUTTX_FBDEV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" - -#if LV_USE_NUTTX - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a new display with NuttX backend. - */ -lv_display_t * lv_nuttx_fbdev_create(void); - -/** - * Initialize display with specified framebuffer device - * @param disp pointer to display with NuttX backend - * @param file the name of framebuffer device - */ -int lv_nuttx_fbdev_set_file(lv_display_t * disp, const char * file); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_NUTTX */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_NUTTX_FBDEV_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/nuttx/lv_nuttx_image_cache.c b/src/drivers/nuttx/lv_nuttx_image_cache.c index 1426d9b6a6..1f2d5c2af6 100644 --- a/src/drivers/nuttx/lv_nuttx_image_cache.c +++ b/src/drivers/nuttx/lv_nuttx_image_cache.c @@ -9,7 +9,7 @@ #include "lv_nuttx_image_cache.h" #include "../../core/lv_global.h" -#include "../../../lvgl.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX diff --git a/src/drivers/nuttx/lv_nuttx_image_cache.h b/src/drivers/nuttx/lv_nuttx_image_cache.h index 0e056b4aba..7d23fd7564 100644 --- a/src/drivers/nuttx/lv_nuttx_image_cache.h +++ b/src/drivers/nuttx/lv_nuttx_image_cache.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #include LV_STDBOOL_INCLUDE /********************* diff --git a/src/drivers/nuttx/lv_nuttx_lcd.c b/src/drivers/nuttx/lv_nuttx_lcd.c index 3b0fd121f3..89488ac12c 100644 --- a/src/drivers/nuttx/lv_nuttx_lcd.c +++ b/src/drivers/nuttx/lv_nuttx_lcd.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_nuttx_lcd.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX @@ -20,7 +20,6 @@ #include #include -#include "../../../lvgl.h" #include "../../lvgl_private.h" #ifdef __NuttX__ diff --git a/src/drivers/nuttx/lv_nuttx_lcd.h b/src/drivers/nuttx/lv_nuttx_lcd.h index 16e24ff8f1..2b3de2118f 100644 --- a/src/drivers/nuttx/lv_nuttx_lcd.h +++ b/src/drivers/nuttx/lv_nuttx_lcd.h @@ -1,49 +1,2 @@ -/** - * @file lv_nuttx_lcd.h - * - */ - -#ifndef LV_NUTTX_LCD_H -#define LV_NUTTX_LCD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" - -#if LV_USE_NUTTX - -#if LV_USE_NUTTX_LCD - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_display_t * lv_nuttx_lcd_create(const char * dev_path); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_NUTTX_LCD */ - -#endif /* LV_USE_NUTTX*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_NUTTX_LCD_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/nuttx/lv_nuttx_libuv.c b/src/drivers/nuttx/lv_nuttx_libuv.c index 7d25fa29b4..a061119148 100644 --- a/src/drivers/nuttx/lv_nuttx_libuv.c +++ b/src/drivers/nuttx/lv_nuttx_libuv.c @@ -5,12 +5,11 @@ /********************* * INCLUDES *********************/ -#include "lv_nuttx_libuv.h" - -#include "../../lvgl.h" -#include "../../lvgl_private.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX +#include "../../lvgl_private.h" + #include #if LV_USE_NUTTX_LIBUV diff --git a/src/drivers/nuttx/lv_nuttx_libuv.h b/src/drivers/nuttx/lv_nuttx_libuv.h index 0799e67b12..ca4cfa0131 100644 --- a/src/drivers/nuttx/lv_nuttx_libuv.h +++ b/src/drivers/nuttx/lv_nuttx_libuv.h @@ -1,66 +1,2 @@ -/** - * @file lv_nuttx_libuv.h - * - */ - -#ifndef LV_NUTTX_LIBUV_H -#define LV_NUTTX_LIBUV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" -#include "../../indev/lv_indev.h" - -#if LV_USE_NUTTX - -#if LV_USE_NUTTX_LIBUV - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - void * loop; - lv_display_t * disp; - lv_indev_t * indev; -} lv_nuttx_uv_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the uv_loop using the provided configuration information. - * @param uv_info Pointer to the lv_nuttx_uv_t structure to be initialized. - */ -void * lv_nuttx_uv_init(lv_nuttx_uv_t * uv_info); - -/** - * Deinitialize the uv_loop configuration for NuttX porting layer. - * @param data Pointer to user data. - */ -void lv_nuttx_uv_deinit(void ** data); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_NUTTX_LIBUV*/ - -#endif /*LV_USE_NUTTX*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_NUTTX_LIBUV_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/nuttx/lv_nuttx_mouse.c b/src/drivers/nuttx/lv_nuttx_mouse.c index c1516a4d8b..37134c3b78 100644 --- a/src/drivers/nuttx/lv_nuttx_mouse.c +++ b/src/drivers/nuttx/lv_nuttx_mouse.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_nuttx_mouse.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX @@ -21,6 +21,7 @@ #include #include #include "../../lvgl_private.h" +#include "lv_nuttx_mouse.h" #ifdef __NuttX__ #include diff --git a/src/drivers/nuttx/lv_nuttx_mouse.h b/src/drivers/nuttx/lv_nuttx_mouse.h index dfde8e8074..16739bea61 100644 --- a/src/drivers/nuttx/lv_nuttx_mouse.h +++ b/src/drivers/nuttx/lv_nuttx_mouse.h @@ -18,7 +18,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../indev/lv_indev.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX diff --git a/src/drivers/nuttx/lv_nuttx_profiler.c b/src/drivers/nuttx/lv_nuttx_profiler.c index 016de78f51..0505de204c 100644 --- a/src/drivers/nuttx/lv_nuttx_profiler.c +++ b/src/drivers/nuttx/lv_nuttx_profiler.c @@ -11,12 +11,9 @@ #if LV_USE_NUTTX && LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN +#include "../../lv_public_api.h" #include "../../misc/lv_profiler_builtin_private.h" -#include "../../misc/lv_log.h" #include "../../core/lv_global.h" -#include "../../stdlib/lv_sprintf.h" -#include "../../stdlib/lv_string.h" -#include "lv_nuttx_entry.h" #include #include #include diff --git a/src/drivers/nuttx/lv_nuttx_profiler.h b/src/drivers/nuttx/lv_nuttx_profiler.h index 248279bcba..48b020e713 100644 --- a/src/drivers/nuttx/lv_nuttx_profiler.h +++ b/src/drivers/nuttx/lv_nuttx_profiler.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX && LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN diff --git a/src/drivers/nuttx/lv_nuttx_touchscreen.c b/src/drivers/nuttx/lv_nuttx_touchscreen.c index 210e87aace..c56577d470 100644 --- a/src/drivers/nuttx/lv_nuttx_touchscreen.c +++ b/src/drivers/nuttx/lv_nuttx_touchscreen.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_nuttx_touchscreen.h" +#include "../../lv_public_api.h" #if LV_USE_NUTTX diff --git a/src/drivers/nuttx/lv_nuttx_touchscreen.h b/src/drivers/nuttx/lv_nuttx_touchscreen.h index e0dd1f14f7..25a6fcdb7f 100644 --- a/src/drivers/nuttx/lv_nuttx_touchscreen.h +++ b/src/drivers/nuttx/lv_nuttx_touchscreen.h @@ -1,57 +1,2 @@ -/** - * @file lv_nuttx_touchscreen.h - * - */ - -/********************* - * INCLUDES - *********************/ - -#ifndef LV_NUTTX_TOUCHSCREEN_H -#define LV_NUTTX_TOUCHSCREEN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../indev/lv_indev.h" - -#if LV_USE_NUTTX - -#if LV_USE_NUTTX_TOUCHSCREEN - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize indev with specified input device. - * @param dev_path path of input device - */ -lv_indev_t * lv_nuttx_touchscreen_create(const char * dev_path); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_NUTTX_TOUCHSCREEN */ - -#endif /* LV_USE_NUTTX*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_NUTTX_TOUCHSCREEN_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/opengles/assets/lv_opengles_shader.c b/src/drivers/opengles/assets/lv_opengles_shader.c index 8f0e0dd5a7..96720eaf94 100644 --- a/src/drivers/opengles/assets/lv_opengles_shader.c +++ b/src/drivers/opengles/assets/lv_opengles_shader.c @@ -3,7 +3,6 @@ #if LV_USE_OPENGLES #include "../opengl_shader/lv_opengl_shader_internal.h" -#include "../../../misc/lv_types.h" static const lv_opengl_shader_t src_includes_v100[] = {{ "hsv_adjust.glsl", R"( diff --git a/src/drivers/opengles/glad/include/EGL/eglplatform.h b/src/drivers/opengles/glad/include/EGL/eglplatform.h index ed0896b38b..1ca68c57f2 100644 --- a/src/drivers/opengles/glad/include/EGL/eglplatform.h +++ b/src/drivers/opengles/glad/include/EGL/eglplatform.h @@ -1,7 +1,7 @@ #ifndef __eglplatform_h_ #define __eglplatform_h_ -#include "../../../../../lv_conf_internal.h" +#include "../../../../../lv_public_api.h" #if LV_USE_OPENGLES /* diff --git a/src/drivers/opengles/glad/include/KHR/khrplatform.h b/src/drivers/opengles/glad/include/KHR/khrplatform.h index d811122a44..80e9aaaa30 100644 --- a/src/drivers/opengles/glad/include/KHR/khrplatform.h +++ b/src/drivers/opengles/glad/include/KHR/khrplatform.h @@ -1,7 +1,7 @@ #ifndef __khrplatform_h_ #define __khrplatform_h_ -#include "../../../../../lv_conf_internal.h" +#include "../../../../../lv_public_api.h" #if LV_USE_OPENGLES /* ** Copyright (c) 2008-2018 The Khronos Group Inc. diff --git a/src/drivers/opengles/glad/include/glad/egl.h b/src/drivers/opengles/glad/include/glad/egl.h index 2cc345f355..b871c7954c 100644 --- a/src/drivers/opengles/glad/include/glad/egl.h +++ b/src/drivers/opengles/glad/include/glad/egl.h @@ -30,7 +30,7 @@ #define GLAD_EGL_H_ -#include "../../../../../lv_conf_internal.h" +#include "../../../../../lv_public_api.h" #if LV_USE_EGL #define GLAD_EGL diff --git a/src/drivers/opengles/glad/include/glad/gl.h b/src/drivers/opengles/glad/include/glad/gl.h index 102d62e46b..1ac40abbcf 100644 --- a/src/drivers/opengles/glad/include/glad/gl.h +++ b/src/drivers/opengles/glad/include/glad/gl.h @@ -29,7 +29,7 @@ #ifndef GLAD_GL_H_ #define GLAD_GL_H_ -#include "../../../../../lv_conf_internal.h" +#include "../../../../../lv_public_api.h" #if LV_USE_OPENGLES && !LV_USE_EGL diff --git a/src/drivers/opengles/glad/include/glad/gles2.h b/src/drivers/opengles/glad/include/glad/gles2.h index f5016f523f..00fdbf406a 100644 --- a/src/drivers/opengles/glad/include/glad/gles2.h +++ b/src/drivers/opengles/glad/include/glad/gles2.h @@ -29,7 +29,7 @@ #ifndef GLAD_GLES2_H_ #define GLAD_GLES2_H_ -#include "../../../../../lv_conf_internal.h" +#include "../../../../../lv_public_api.h" #if LV_USE_EGL #ifdef __clang__ diff --git a/src/drivers/opengles/lv_opengles_debug.c b/src/drivers/opengles/lv_opengles_debug.c index d0a6844c58..667ed59b41 100644 --- a/src/drivers/opengles/lv_opengles_debug.c +++ b/src/drivers/opengles/lv_opengles_debug.c @@ -8,12 +8,11 @@ *********************/ #include "lv_opengles_debug.h" + #if LV_USE_OPENGLES #include "lv_opengles_private.h" -#include "../../misc/lv_log.h" - /********************* * DEFINES *********************/ diff --git a/src/drivers/opengles/lv_opengles_debug.h b/src/drivers/opengles/lv_opengles_debug.h index 3e26302a9c..3e3476d413 100644 --- a/src/drivers/opengles/lv_opengles_debug.h +++ b/src/drivers/opengles/lv_opengles_debug.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_OPENGLES /********************* diff --git a/src/drivers/opengles/lv_opengles_driver.c b/src/drivers/opengles/lv_opengles_driver.c index 308edceffc..d053bd0a7d 100644 --- a/src/drivers/opengles/lv_opengles_driver.c +++ b/src/drivers/opengles/lv_opengles_driver.c @@ -7,14 +7,11 @@ * INCLUDES *********************/ -#include "lv_opengles_driver.h" +#include "lv_opengles_private.h" + #if LV_USE_OPENGLES -#include "../../misc/lv_types.h" -#include "../../misc/lv_profiler.h" -#include "../../misc/lv_matrix.h" #include "lv_opengles_debug.h" -#include "lv_opengles_private.h" #include "../../display/lv_display_private.h" #include "../../draw/nanovg/lv_draw_nanovg.h" diff --git a/src/drivers/opengles/lv_opengles_driver.h b/src/drivers/opengles/lv_opengles_driver.h index f352ec926e..0dccd3b729 100644 --- a/src/drivers/opengles/lv_opengles_driver.h +++ b/src/drivers/opengles/lv_opengles_driver.h @@ -1,108 +1,2 @@ -/** - * @file lv_opengles_driver.h - * - */ - -#ifndef LV_OPENGLES_DRIVER_H -#define LV_OPENGLES_DRIVER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" -#if LV_USE_OPENGLES - -#include "../../misc/lv_area.h" -#include "../../misc/lv_color.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize OpenGL - * @note it is not necessary to call this if you use `lv_opengles_glfw_window_create` - */ -void lv_opengles_init(void); - -/** - * Deinitialize OpenGL - * @note it is not necessary to call this if you use `lv_opengles_glfw_window_create` - */ -void lv_opengles_deinit(void); - -/** - * Render a texture using alternate blending mode for smoother translucent materials and correct anti-aliasing of glTF elements when using transparent background - * @param texture OpenGL texture ID - * @param texture_area the area in the window to render the texture in - * @param opa opacity to blend the texture with existing contents - * @param disp_w width of the window/framebuffer being rendered to - * @param disp_h height of the window/framebuffer being rendered to - * @param h_flip horizontal flip - * @param v_flip vertical flip - */ -void lv_opengles_render_texture(unsigned int texture, const lv_area_t * texture_area, lv_opa_t opa, int32_t disp_w, - int32_t disp_h, const lv_area_t * texture_clip_area, bool h_flip, bool v_flip); - -/** - * Render a display texture - Supports rotation - Switches red and blue channels - * @param display LVGL Texture display. Created with the `lv_opengles_texture` module - * @param h_flip horizontal flip - * @param v_flip vertical flip - */ -void lv_opengles_render_display_texture(lv_display_t * display, bool h_flip, bool v_flip); - -/** - * Render a fill - * @param color the color of the fill - * @param area the area in the window to render the fill - * @param opa opacity to blend the fill with existing contents - * @param disp_w width of the window/framebuffer being rendered to - * @param disp_h height of the window/framebuffer being rendered to - */ -void lv_opengles_render_fill(lv_color_t color, const lv_area_t * area, lv_opa_t opa, int32_t disp_w, int32_t disp_h); - -/** - * Clear the window/display - */ -void lv_opengles_render_clear(void); - -/** - * Set the OpenGL viewport - * @param x x position of the viewport - * @param y y position of the viewport - * @param w width of the viewport - * @param h height of the viewport - */ -void lv_opengles_viewport(int32_t x, int32_t y, int32_t w, int32_t h); - -/** - * Reinitialize OpenGL state after external GL operations (e.g., NanoVG) - * This rebinds VAO, VBO, IBO and resets vertex attributes - */ -void lv_opengles_reinit_state(void); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_OPENGLES */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_OPENGLES_DRIVER_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/opengles/lv_opengles_egl.c b/src/drivers/opengles/lv_opengles_egl.c index 2ae056125a..b5f3fcd05f 100644 --- a/src/drivers/opengles/lv_opengles_egl.c +++ b/src/drivers/opengles/lv_opengles_egl.c @@ -16,15 +16,10 @@ #include #include "lv_opengles_debug.h" +#include "../../lv_public_api.h" #include "glad/include/glad/egl.h" -#include "../../misc/lv_assert.h" -#include "../../misc/lv_log.h" -#include "../../misc/lv_types.h" -#include "../../misc/lv_types.h" -#include "../../stdlib/lv_mem.h" #include "lv_opengles_private.h" #include "lv_opengles_egl_private.h" -#include "lv_opengles_driver.h" /********************* * DEFINES diff --git a/src/drivers/opengles/lv_opengles_egl.h b/src/drivers/opengles/lv_opengles_egl.h index b32ade9152..4264cb1d03 100644 --- a/src/drivers/opengles/lv_opengles_egl.h +++ b/src/drivers/opengles/lv_opengles_egl.h @@ -13,14 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_EGL -#include "../../misc/lv_types.h" -#include "../../misc/lv_color.h" - - /********************* * DEFINES *********************/ diff --git a/src/drivers/opengles/lv_opengles_egl_private.h b/src/drivers/opengles/lv_opengles_egl_private.h index 342486ff2a..5510d6207f 100644 --- a/src/drivers/opengles/lv_opengles_egl_private.h +++ b/src/drivers/opengles/lv_opengles_egl_private.h @@ -13,12 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_EGL -#include "../../misc/lv_types.h" -#include "../../misc/lv_color.h" #include "lv_opengles_private.h" #include "lv_opengles_egl.h" diff --git a/src/drivers/opengles/lv_opengles_glfw.c b/src/drivers/opengles/lv_opengles_glfw.c index 0740169470..2a75c0d193 100644 --- a/src/drivers/opengles/lv_opengles_glfw.c +++ b/src/drivers/opengles/lv_opengles_glfw.c @@ -7,19 +7,12 @@ * INCLUDES *********************/ -#include "lv_opengles_glfw.h" +#include "../../lv_public_api.h" + #if LV_USE_GLFW -#include "lv_opengles_window.h" -#include "lv_opengles_driver.h" -#include "lv_opengles_texture.h" -#include "lv_opengles_private.h" #include "lv_opengles_debug.h" - -#include "../../core/lv_refr.h" -#include "../../stdlib/lv_string.h" -#include "../../indev/lv_indev.h" -#include "../../lv_init.h" +#include "lv_opengles_private.h" #include "../../misc/lv_area_private.h" #include diff --git a/src/drivers/opengles/lv_opengles_glfw.h b/src/drivers/opengles/lv_opengles_glfw.h index 39d2d51e10..fd43ec6ca9 100644 --- a/src/drivers/opengles/lv_opengles_glfw.h +++ b/src/drivers/opengles/lv_opengles_glfw.h @@ -1,88 +1,2 @@ -/** - * @file lv_opengles_glfw.h - * - */ - -#ifndef LV_OPENGLES_GLFW_H -#define LV_OPENGLES_GLFW_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../lv_conf_internal.h" -#if LV_USE_GLFW - -#include "../../misc/lv_types.h" - -/********************* - * INCLUDES - *********************/ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a GLFW OpenGL window with no textures and initialize OpenGL - * @param hor_res width in pixels of the window - * @param ver_res height in pixels of the window - * @param use_mouse_indev send pointer indev input to LVGL display textures - * @return the new GLFW OpenGL window handle - */ -lv_opengles_window_t * lv_opengles_glfw_window_create(int32_t hor_res, int32_t ver_res, bool use_mouse_indev); - -/** - * Create a GLFW window with no textures and initialize OpenGL - * @param hor_res width in pixels of the window - * @param ver_res height in pixels of the window - * @param use_mouse_indev send pointer indev input to LVGL display textures - * @param h_flip Should the window contents be horizontally mirrored? - * @param v_flip Should the window contents be vertically mirrored? - * @param title The window title - * @return the new GLFW window handle - */ -lv_opengles_window_t * lv_opengles_glfw_window_create_ex(int32_t hor_res, int32_t ver_res, bool use_mouse_indev, - bool h_flip, bool v_flip, const char * title); - -/** - * Set the window's title text - * @param window GLFW window to configure - * @param new_title The new title text - */ -void lv_opengles_glfw_window_set_title(lv_opengles_window_t * window, const char * new_title); - -/** - * Set the horizontal / vertical flipping of a GLFW window - * @param window GLFW window to configure - * @param h_flip Should the window contents be horizontally mirrored? - * @param v_flip Should the window contents be vertically mirrored? - */ -void lv_opengles_glfw_window_set_flip(lv_opengles_window_t * window, bool h_flip, bool v_flip); - -/** - * Get the GLFW window handle for a GLFW lv_opengles_window_t - * @param window GLFW window to return the handle of - * @return the GLFW window handle - */ -void * lv_opengles_glfw_window_get_glfw_window(lv_opengles_window_t * window); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GLFW*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OPENGLES_GLFW_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/opengles/lv_opengles_private.h b/src/drivers/opengles/lv_opengles_private.h index 49b403cdf3..4973e92585 100644 --- a/src/drivers/opengles/lv_opengles_private.h +++ b/src/drivers/opengles/lv_opengles_private.h @@ -14,13 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_OPENGLES -#include "../../misc/lv_area.h" -#include "../../misc/lv_color.h" - #if !LV_USE_MATRIX #error "LV_USE_OPENGLES requires LV_USE_MATRIX" #endif diff --git a/src/drivers/opengles/lv_opengles_texture.c b/src/drivers/opengles/lv_opengles_texture.c index 95fc2a2a99..8ba533a155 100644 --- a/src/drivers/opengles/lv_opengles_texture.c +++ b/src/drivers/opengles/lv_opengles_texture.c @@ -7,14 +7,12 @@ * INCLUDES *********************/ -#include "lv_opengles_texture.h" +#include "../../lv_public_api.h" + #if LV_USE_OPENGLES #include "lv_opengles_debug.h" -#include "lv_opengles_driver.h" -#include "../../misc/lv_types.h" -#include "../../stdlib/lv_mem.h" #include "lv_opengles_private.h" #include "lv_opengles_texture_private.h" #include "../../display/lv_display_private.h" diff --git a/src/drivers/opengles/lv_opengles_texture.h b/src/drivers/opengles/lv_opengles_texture.h index 2a6933a95c..aab8deb859 100644 --- a/src/drivers/opengles/lv_opengles_texture.h +++ b/src/drivers/opengles/lv_opengles_texture.h @@ -1,79 +1,2 @@ -/** - * @file lv_opengles_texture.h - * - */ - -#ifndef LV_OPENGLES_TEXTURE_H -#define LV_OPENGLES_TEXTURE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" -#if LV_USE_OPENGLES - -#include "../../display/lv_display.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a display that flushes to an OpenGL texture - * If you already have a texture and want to bind it to the display, - * see `lv_opengles_texture_create_from_texture_id` - * @param w width in pixels of the texture - * @param h height in pixels of the texture - * @return the new display or NULL on failure - */ -lv_display_t * lv_opengles_texture_create(int32_t w, int32_t h); - -/** - * Create a display that flushes to the provided OpenGL texture - * If you don't have a texture to bind it to the display, - * see `lv_opengles_texture_create` - * @param w width in pixels of the texture - * @param h height in pixels of the texture - * @param texture_id the texture LVGL will render to - * @return the new display or NULL on failure - */ -lv_display_t * lv_opengles_texture_create_from_texture_id(int32_t w, int32_t h, unsigned int texture_id); - -/** - * Get the OpenGL texture ID of the display - * @param disp display - * @return texture ID - */ -unsigned int lv_opengles_texture_get_texture_id(lv_display_t * disp); - -/** - * Get the display of an OpenGL texture if it is associated with one - * @param texture_id OpenGL texture ID - * @return display or `NULL` if there no display with that texture ID - */ -lv_display_t * lv_opengles_texture_get_from_texture_id(unsigned int texture_id); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_OPENGLES */ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OPENGLES_TEXTURE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/opengles/lv_opengles_texture_private.h b/src/drivers/opengles/lv_opengles_texture_private.h index 8a957a615d..b9d92a47bc 100644 --- a/src/drivers/opengles/lv_opengles_texture_private.h +++ b/src/drivers/opengles/lv_opengles_texture_private.h @@ -14,12 +14,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_OPENGLES -#include "lv_opengles_texture.h" - /********************* * DEFINES *********************/ diff --git a/src/drivers/opengles/lv_opengles_window.h b/src/drivers/opengles/lv_opengles_window.h index 9f22af2c55..996f3cdd07 100644 --- a/src/drivers/opengles/lv_opengles_window.h +++ b/src/drivers/opengles/lv_opengles_window.h @@ -1,102 +1,2 @@ -/** - * @file lv_opengles_window.h - * - */ - -#ifndef LV_OPENGLES_WINDOW_H -#define LV_OPENGLES_WINDOW_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" -#if LV_USE_OPENGLES - -#include "../../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Delete an OpenGL window. If it is the last one, the process will exit - * @param window OpenGL window to delete - */ -void lv_opengles_window_delete(lv_opengles_window_t * window); - -/** - * Add a texture to the OpenGL window. It can be an LVGL display texture, or any OpenGL texture - * @param window OpenGL window - * @param texture_id OpenGL texture ID - * @param w width in pixels of the texture - * @param h height in pixels of the texture - * @return the new texture handle - */ -lv_opengles_window_texture_t * lv_opengles_window_add_texture(lv_opengles_window_t * window, unsigned int texture_id, - int32_t w, int32_t h); - -lv_display_t * lv_opengles_window_display_create(lv_opengles_window_t * window, int32_t w, int32_t h); - -lv_opengles_window_texture_t * lv_opengles_window_display_get_window_texture(lv_display_t * window_display); - -/** - * Remove a texture from its OpenGL window and delete it - * @param texture handle of an OpenGL window texture - */ -void lv_opengles_window_texture_remove(lv_opengles_window_texture_t * texture); - -/** - * Set the x position of a texture within its OpenGL window - * @param texture handle of an OpenGL window texture - * @param x new x position of the texture - */ -void lv_opengles_window_texture_set_x(lv_opengles_window_texture_t * texture, int32_t x); - -/** - * Set the y position of a texture within its OpenGL window - * @param texture handle of an OpenGL window texture - * @param y new y position of the texture - */ -void lv_opengles_window_texture_set_y(lv_opengles_window_texture_t * texture, int32_t y); - -/** - * Set the opacity of a texture in an OpenGL window - * @param texture handle of an OpenGL window texture - * @param opa new opacity of the texture - */ -void lv_opengles_window_texture_set_opa(lv_opengles_window_texture_t * texture, lv_opa_t opa); - -/** - * Get the mouse indev associated with a texture in an OpenGL window, if it exists - * @param texture handle of an OpenGL window texture - * @return the indev or `NULL` - * @note there will only be an indev if the texture is based on an - * LVGL display texture and the window was created with - * `use_mouse_indev` as `true` - */ -lv_indev_t * lv_opengles_window_texture_get_mouse_indev(lv_opengles_window_texture_t * texture); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_OPENGLES */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_OPENGLES_WINDOW_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/opengles/opengl_shader/lv_opengl_shader_internal.h b/src/drivers/opengles/opengl_shader/lv_opengl_shader_internal.h index 6190d5f5ee..a2c3b9503a 100644 --- a/src/drivers/opengles/opengl_shader/lv_opengl_shader_internal.h +++ b/src/drivers/opengles/opengl_shader/lv_opengl_shader_internal.h @@ -6,12 +6,12 @@ #ifndef LV_OPENGL_SHADER_INTERNAL_H #define LV_OPENGL_SHADER_INTERNAL_H -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_OPENGLES + #include "../lv_opengles_private.h" #include "../lv_opengles_debug.h" -#include "../../../misc/lv_types.h" #include "../../../misc/lv_rb_private.h" #ifdef __cplusplus diff --git a/src/drivers/opengles/opengl_shader/lv_opengl_shader_manager.c b/src/drivers/opengles/opengl_shader/lv_opengl_shader_manager.c index f369d2efe4..b074ea9b1b 100644 --- a/src/drivers/opengles/opengl_shader/lv_opengl_shader_manager.c +++ b/src/drivers/opengles/opengl_shader/lv_opengl_shader_manager.c @@ -8,18 +8,14 @@ * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" + #if LV_USE_OPENGLES + #include "lv_opengl_shader_internal.h" -#include "../../../misc/lv_assert.h" -#include "../../../misc/lv_log.h" -#include "../../../misc/lv_rb.h" -#include "../../../misc/lv_types.h" -#include "../../../stdlib/lv_mem.h" -#include "../../../stdlib/lv_sprintf.h" +#include "../../../misc/lv_rb_private.h" #include "../lv_opengles_private.h" #include "../lv_opengles_debug.h" -#include "../../../stdlib/lv_string.h" #include diff --git a/src/drivers/opengles/opengl_shader/lv_opengl_shader_program.c b/src/drivers/opengles/opengl_shader/lv_opengl_shader_program.c index ce70a5b557..8a8fd840f2 100644 --- a/src/drivers/opengles/opengl_shader/lv_opengl_shader_program.c +++ b/src/drivers/opengles/opengl_shader/lv_opengl_shader_program.c @@ -13,8 +13,7 @@ #include "../lv_opengles_private.h" #include "../lv_opengles_debug.h" -#include "../../../misc/lv_assert.h" -#include "../../../stdlib/lv_mem.h" + /********************* * DEFINES *********************/ diff --git a/src/drivers/qnx/lv_qnx.c b/src/drivers/qnx/lv_qnx.c index f31e72710b..e146718443 100644 --- a/src/drivers/qnx/lv_qnx.c +++ b/src/drivers/qnx/lv_qnx.c @@ -6,14 +6,11 @@ /********************* * INCLUDES *********************/ -#include "lv_qnx.h" +#include "../../lv_public_api.h" #if LV_USE_QNX #include -#include "../../core/lv_refr.h" -#include "../../stdlib/lv_string.h" #include "../../core/lv_global.h" #include "../../display/lv_display_private.h" -#include "../../lv_init.h" #include #include #include diff --git a/src/drivers/qnx/lv_qnx.h b/src/drivers/qnx/lv_qnx.h index bb8f9409a2..daf3cf052e 100644 --- a/src/drivers/qnx/lv_qnx.h +++ b/src/drivers/qnx/lv_qnx.h @@ -1,86 +1,2 @@ -/** - * @file lv_qnx.h - * @brief LVGL driver for the QNX Screen compositing window manager - */ - -#ifndef LV_QNX_H -#define LV_QNX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" -#include "../../indev/lv_indev.h" - -#if LV_USE_QNX - -#include -#include - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a window to use as a display for LVGL. - * @param hor_res The horizontal resolution (size) of the window - * @param ver_res The vertical resolution (size) of the window - * @return A pointer to a new display object if successful, NULL otherwise - */ -lv_display_t * lv_qnx_window_create(int32_t hor_res, int32_t ver_res); - -/** - * Set the title of the window identified by the given display. - * @param disp The display object for the window - * @param title The new title to set - */ -void lv_qnx_window_set_title(lv_display_t * disp, const char * title); - -/** - * Create a pointer input device for the display. - * Only one pointer object is currently supported. - * @param disp The display object associated with the device - * @return true if successful, false otherwise - */ -bool lv_qnx_add_pointer_device(lv_display_t * disp); - -/** - * Create a keyboard input device for the display. - * Only one keyboard object is currently supported. - * @param disp The display object associated with the device - * @return true if successful, false otherwise - */ -bool lv_qnx_add_keyboard_device(lv_display_t * disp); - -/** - * Runs the event loop for the display. - * The function only returns in response to a close event. - * @param disp The display for the event loop - * @return Exit code - */ -int lv_qnx_event_loop(lv_display_t * disp); - -/********************** - * MACROS - **********************/ - -#endif /* LV_DRV_QNX */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_QNX_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/sdl/lv_sdl_egl.c b/src/drivers/sdl/lv_sdl_egl.c index e90581f626..9b20c0fa8d 100644 --- a/src/drivers/sdl/lv_sdl_egl.c +++ b/src/drivers/sdl/lv_sdl_egl.c @@ -6,15 +6,13 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_SDL_USE_EGL #include #include "lv_sdl_private.h" #include "../opengles/lv_opengles_egl_private.h" -#include "../opengles/lv_opengles_driver.h" -#include "../../draw/lv_draw_buf.h" /********************* * DEFINES diff --git a/src/drivers/sdl/lv_sdl_keyboard.c b/src/drivers/sdl/lv_sdl_keyboard.c index c9b1ee9a83..7a734158ce 100644 --- a/src/drivers/sdl/lv_sdl_keyboard.c +++ b/src/drivers/sdl/lv_sdl_keyboard.c @@ -6,13 +6,12 @@ /********************* * INCLUDES *********************/ -#include "lv_sdl_keyboard.h" + +#include "lv_sdl_private.h" + #if LV_USE_SDL -#include "../../core/lv_group.h" -#include "../../stdlib/lv_string.h" #include "../../misc/lv_text_private.h" -#include "lv_sdl_private.h" /********************* * DEFINES diff --git a/src/drivers/sdl/lv_sdl_keyboard.h b/src/drivers/sdl/lv_sdl_keyboard.h index a18b09d8ac..d0109490c0 100644 --- a/src/drivers/sdl/lv_sdl_keyboard.h +++ b/src/drivers/sdl/lv_sdl_keyboard.h @@ -1,46 +1,2 @@ -/** - * @file lv_sdl_keyboard.h - * - */ - -#ifndef LV_SDL_KEYBOARD_H -#define LV_SDL_KEYBOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_sdl_window.h" -#if LV_USE_SDL - -/********************* - * DEFINES - *********************/ -#ifndef KEYBOARD_BUFFER_SIZE -#define KEYBOARD_BUFFER_SIZE 32 -#endif - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_indev_t * lv_sdl_keyboard_create(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SDL*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_SDL_KEYBOARD_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/sdl/lv_sdl_mouse.c b/src/drivers/sdl/lv_sdl_mouse.c index a401c12561..1131e907ff 100644 --- a/src/drivers/sdl/lv_sdl_mouse.c +++ b/src/drivers/sdl/lv_sdl_mouse.c @@ -6,13 +6,11 @@ /********************* * INCLUDES *********************/ -#include "lv_sdl_mouse.h" -#if LV_USE_SDL -#include "../../core/lv_group.h" -#include "../../stdlib/lv_string.h" #include "lv_sdl_private.h" +#if LV_USE_SDL + /********************* * DEFINES *********************/ diff --git a/src/drivers/sdl/lv_sdl_mouse.h b/src/drivers/sdl/lv_sdl_mouse.h index ef60685f42..9fa1978388 100644 --- a/src/drivers/sdl/lv_sdl_mouse.h +++ b/src/drivers/sdl/lv_sdl_mouse.h @@ -1,43 +1,2 @@ -/** - * @file lv_sdl_mouse.h - * - */ - -#ifndef LV_SDL_MOUSE_H -#define LV_SDL_MOUSE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_sdl_window.h" -#if LV_USE_SDL - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_indev_t * lv_sdl_mouse_create(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SDL*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_SDL_MOUSE_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/sdl/lv_sdl_mousewheel.c b/src/drivers/sdl/lv_sdl_mousewheel.c index f0b5f7d969..c047c63fb7 100644 --- a/src/drivers/sdl/lv_sdl_mousewheel.c +++ b/src/drivers/sdl/lv_sdl_mousewheel.c @@ -6,13 +6,11 @@ /********************* * INCLUDES *********************/ -#include "lv_sdl_mousewheel.h" -#if LV_USE_SDL && LV_SDL_MOUSEWHEEL_MODE == LV_SDL_MOUSEWHEEL_MODE_ENCODER -#include "../../core/lv_group.h" -#include "../../stdlib/lv_string.h" #include "lv_sdl_private.h" +#if LV_USE_SDL && LV_SDL_MOUSEWHEEL_MODE == LV_SDL_MOUSEWHEEL_MODE_ENCODER + /********************* * DEFINES *********************/ diff --git a/src/drivers/sdl/lv_sdl_mousewheel.h b/src/drivers/sdl/lv_sdl_mousewheel.h index dab3dea4b3..6fd5c8ba11 100644 --- a/src/drivers/sdl/lv_sdl_mousewheel.h +++ b/src/drivers/sdl/lv_sdl_mousewheel.h @@ -1,43 +1,2 @@ -/** - * @file lv_sdl_mousewheel.h - * - */ - -#ifndef LV_SDL_MOUSEWHEEL_H -#define LV_SDL_MOUSEWHEEL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_sdl_window.h" -#if LV_USE_SDL && LV_SDL_MOUSEWHEEL_MODE == LV_SDL_MOUSEWHEEL_MODE_ENCODER - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_indev_t * lv_sdl_mousewheel_create(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SDL*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_SDL_MOUSEWHEEL_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/sdl/lv_sdl_private.h b/src/drivers/sdl/lv_sdl_private.h index be5b31fef9..42a0325bb3 100644 --- a/src/drivers/sdl/lv_sdl_private.h +++ b/src/drivers/sdl/lv_sdl_private.h @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_types.h" -#include "lv_sdl_window.h" + +#include "../../lv_public_api.h" #if LV_USE_SDL diff --git a/src/drivers/sdl/lv_sdl_sw.c b/src/drivers/sdl/lv_sdl_sw.c index 7427739dad..ec0ddd4662 100644 --- a/src/drivers/sdl/lv_sdl_sw.c +++ b/src/drivers/sdl/lv_sdl_sw.c @@ -23,8 +23,6 @@ #endif /* _WIN32 */ #include "../../display/lv_display_private.h" -#include "../../misc/lv_types.h" -#include "../../draw/sw/lv_draw_sw_utils.h" /********************* diff --git a/src/drivers/sdl/lv_sdl_texture.c b/src/drivers/sdl/lv_sdl_texture.c index beabb4bd46..6e75a814b0 100644 --- a/src/drivers/sdl/lv_sdl_texture.c +++ b/src/drivers/sdl/lv_sdl_texture.c @@ -11,8 +11,6 @@ #if LV_USE_SDL && !LV_SDL_USE_EGL && LV_USE_DRAW_SDL -#include "../../draw/lv_draw_buf.h" - /********************* * DEFINES *********************/ diff --git a/src/drivers/sdl/lv_sdl_window.c b/src/drivers/sdl/lv_sdl_window.c index 73e102e86e..e7a308ce85 100644 --- a/src/drivers/sdl/lv_sdl_window.c +++ b/src/drivers/sdl/lv_sdl_window.c @@ -10,13 +10,12 @@ /********************* * INCLUDES *********************/ -#include "lv_sdl_window.h" +#include "../../lv_public_api.h" + #if LV_USE_SDL #include -#include "../../core/lv_refr.h" #include "../../core/lv_global.h" #include "../../display/lv_display_private.h" -#include "../../lv_init.h" #define SDL_MAIN_HANDLED /*To fix SDL's "undefined reference to WinMain" issue*/ #include "lv_sdl_private.h" diff --git a/src/drivers/sdl/lv_sdl_window.h b/src/drivers/sdl/lv_sdl_window.h index e30b458289..f756a54496 100644 --- a/src/drivers/sdl/lv_sdl_window.h +++ b/src/drivers/sdl/lv_sdl_window.h @@ -1,75 +1,2 @@ -/** - * @file lv_sdl_window.h - * - */ - -/** - * Modified by NXP in 2025 - */ - -#ifndef LV_SDL_WINDOW_H -#define LV_SDL_WINDOW_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" -#include "../../indev/lv_indev.h" - -#if LV_USE_SDL - -/********************* - * DEFINES - *********************/ - -/* Possible values of LV_SDL_MOUSEWHEEL_MODE */ -#define LV_SDL_MOUSEWHEEL_MODE_ENCODER 0 /* The mousewheel emulates an encoder input device*/ -#define LV_SDL_MOUSEWHEEL_MODE_CROWN 1 /* The mousewheel emulates a smart watch crown*/ - -/********************** - * TYPEDEFS - **********************/ - -struct SDL_Window; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_display_t * lv_sdl_window_create(int32_t hor_res, int32_t ver_res); - -void lv_sdl_window_set_resizeable(lv_display_t * disp, bool value); - -void lv_sdl_window_set_size(lv_display_t * disp, int32_t hor_res, int32_t ver_res); - -void lv_sdl_window_set_zoom(lv_display_t * disp, float zoom); - -float lv_sdl_window_get_zoom(lv_display_t * disp); - -void lv_sdl_window_set_title(lv_display_t * disp, const char * title); - -void lv_sdl_window_set_icon(lv_display_t * disp, void * icon, int32_t width, int32_t height); - -void * lv_sdl_window_get_renderer(lv_display_t * disp); - -void lv_sdl_quit(void); - -struct SDL_Window * lv_sdl_window_get_window(lv_display_t * disp); - -/********************** - * MACROS - **********************/ - - -#endif /* LV_DRV_SDL */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_SDL_WINDOW_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/uefi/lv_uefi.h b/src/drivers/uefi/lv_uefi.h index 6302555c11..1879193010 100644 --- a/src/drivers/uefi/lv_uefi.h +++ b/src/drivers/uefi/lv_uefi.h @@ -1,106 +1,2 @@ -/** - * @file lv_uefi.h - * - */ - -#ifndef LV_UEFI_H -#define LV_UEFI_H - -#if LV_USE_UEFI - - #include LV_USE_UEFI_INCLUDE - - #if defined(__clang__) || defined(__GNUC__) - #if defined(__x86_64__) - #define __LV_UEFI_ARCH_X64__ - #define __LV_UEFI_64BIT__ - #elif defined(__i386__) - #define __LV_UEFI_ARCH_X86__ - #define __LV_UEFI_32BIT__ - #elif defined(__aarch64__) - #define __LV_UEFI_ARCH_AARCH64__ - #define __LV_UEFI_64BIT__ - #else - #error Architecture is not supported - #endif - #define LV_UEFI_STATIC_ASSERT _Static_assert - #elif defined(_MSC_VER) - #if defined(_M_AMD64) && !defined(_M_ARM64) - #define __LV_UEFI_ARCH_X64__ - #define __LV_UEFI_64BIT__ - #elif defined(_M_IX86) - #define __LV_UEFI_ARCH_X86__ - #define __LV_UEFI_32BIT__ - #elif defined(_M_ARM64) - #define __LV_UEFI_ARCH_AARCH64__ - #define __LV_UEFI_64BIT__ - #else - #error Architecture is not supported - #endif - #define LV_UEFI_STATIC_ASSERT static_assert - #else - #error Your compiler is not supported - #endif - - #ifdef LV_USE_UEFI_INCLUDE - #include LV_USE_UEFI_INCLUDE - #else - #error No UEFI headers available - #endif - - // Verify that all required protocols are known - #if !defined(EFI_LOADED_IMAGE_PROTOCOL_GUID) - #error Missing support for EFI_LOADED_IMAGE_PROTOCOL - #endif - #if !defined(EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID) - #error Missing support for EFI_SIMPLE_FILE_SYSTEM_PROTOCOL - #endif - #if !defined(EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID) - #error Missing support for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL - #endif - #if !defined(EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID) - #error Missing support for EFI_SIMPLE_TEXT_INPUT_PROTOCOL - #endif - #if !defined(EFI_SIMPLE_POINTER_PROTOCOL_GUID) - #error Missing support for EFI_SIMPLE_POINTER_PROTOCOL - #endif - #if !defined(EFI_ABSOLUTE_POINTER_PROTOCOL_GUID) - #error Missing support for EFI_ABSOLUTE_POINTER_PROTOCOL - #endif - #if !defined(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID) - #error Missing support for EFI_GRAPHICS_OUTPUT_PROTOCOL - #endif - #if !defined(EFI_EDID_ACTIVE_PROTOCOL_GUID) - #error Missing support for EFI_EDID_ACTIVE_PROTOCOL - #endif - #if !defined(EFI_FILE_INFO_ID) - #error Missing support for EFI_FILE_INFO - #endif - #if !defined(EFI_TIMESTAMP_PROTOCOL_GUID) - #error Missing support for EFI_TIMESTAMP_PROTOCOL_GUID - #endif - - // Verify that all types have the correct size - LV_UEFI_STATIC_ASSERT(sizeof(BOOLEAN) == 1, "Size check for 'BOOLEAN' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(INT8) == 1, "Size check for 'INT8' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(UINT8) == 1, "Size check for 'UINT8' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(INT16) == 2, "Size check for 'INT16' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(UINT16) == 2, "Size check for 'UINT16' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(INT32) == 4, "Size check for 'INT32' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(UINT32) == 4, "Size check for 'UINT32' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(INT64) == 8, "Size check for 'INT64' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(UINT64) == 8, "Size check for 'UINT64' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(CHAR8) == 1, "Size check for 'CHAR8' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(CHAR16) == 2, "Size check for 'CHAR16' failed."); - - #ifdef __LV_UEFI_32BIT__ - LV_UEFI_STATIC_ASSERT(sizeof(INTN) == 4, "Size check for 'INTN' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(UINTN) == 4, "Size check for 'UINTN' failed."); - #else - LV_UEFI_STATIC_ASSERT(sizeof(INTN) == 8, "Size check for 'INTN' failed."); - LV_UEFI_STATIC_ASSERT(sizeof(UINTN) == 8, "Size check for 'UINTN' failed."); - #endif - -#endif - -#endif \ No newline at end of file +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/uefi/lv_uefi_context.c b/src/drivers/uefi/lv_uefi_context.c index 96575fe219..03b507c4d4 100644 --- a/src/drivers/uefi/lv_uefi_context.c +++ b/src/drivers/uefi/lv_uefi_context.c @@ -7,13 +7,10 @@ * INCLUDES *********************/ -#include "../../lvgl.h" +#include "lv_uefi_private.h" #if LV_USE_UEFI -#include "lv_uefi_context.h" -#include "lv_uefi_private.h" - /********************* * DEFINES *********************/ diff --git a/src/drivers/uefi/lv_uefi_context.h b/src/drivers/uefi/lv_uefi_context.h index 1ad0885022..30b6a5bfb9 100644 --- a/src/drivers/uefi/lv_uefi_context.h +++ b/src/drivers/uefi/lv_uefi_context.h @@ -1,72 +1,2 @@ -/** - * @file lv_uefi_context.h - * - */ - -#ifndef __LV_UEFI_CONTEXT_H__ -#define __LV_UEFI_CONTEXT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" - -#if LV_USE_UEFI - -#include "lv_uefi.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Initialize the UEFI cache variables. - * @param image_handle The handle of the current image - * @param system_table Pointer to the system table - * @remark This has to be called before lv_init(). -*/ -void lv_uefi_init( - EFI_HANDLE image_handle, - EFI_SYSTEM_TABLE * system_table); - -/** - * @brief Initialize the LVGL UEFI backend. - * @remark This is a private API which is used for LVGL UEFI backend - * implementation. LVGL users shouldn't use that because the - * LVGL has already used it in lv_init. -*/ -void lv_uefi_platform_init(void); - -/** - * @brief Cleanup the LVGL UEFI backend. - * @remark This is a private API which is used for LVGL UEFI backend - * implementation. LVGL users shouldn't use that because the - * LVGL has already used it in lv_deinit. -*/ -void lv_uefi_platform_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif - -#ifdef __cplusplus -} -#endif - -#endif //__LV_UEFI_CONTEXT_H__ - +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/uefi/lv_uefi_display.c b/src/drivers/uefi/lv_uefi_display.c index 7e2086ee68..0bd9596c92 100644 --- a/src/drivers/uefi/lv_uefi_display.c +++ b/src/drivers/uefi/lv_uefi_display.c @@ -7,13 +7,10 @@ * INCLUDES *********************/ -#include "../../lvgl.h" +#include "lv_uefi_private.h" #if LV_USE_UEFI -#include "lv_uefi_display.h" -#include "lv_uefi_private.h" - #if LV_COLOR_DEPTH != 32 #error [lv_uefi] Unsupported LV_COLOR_DEPTH. #endif diff --git a/src/drivers/uefi/lv_uefi_display.h b/src/drivers/uefi/lv_uefi_display.h index ec09b26aed..af9c070d51 100644 --- a/src/drivers/uefi/lv_uefi_display.h +++ b/src/drivers/uefi/lv_uefi_display.h @@ -1,66 +1,2 @@ -/** - * @file lv_uefi_display.h - * - */ - -#ifndef __LV_UEFI_DISPLAY_H__ -#define __LV_UEFI_DISPLAY_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" - -#if LV_USE_UEFI - -#include "lv_uefi.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Create a LVGL display object. - * @param handle The handle on which an instance of the EFI_GRAPHICS_OUTPUT_PROTOCOL protocol is installed. - * @return The created LVGL display object. -*/ -lv_display_t * lv_uefi_display_create(void * handle); - -/** - * @brief Try to find the active display handle. - * @return The handle or NULL if not found. - * @remark The active display need interfaces for EFI_GRAPHICS_OUTPUT_PROTOCOL and EFI_EDID_ACTIVE_PROTOCOL -*/ -void * lv_uefi_display_get_active(void); - -/** - * @brief Try to find any display handle. - * @return The handle or NULL if not found. -*/ -void * lv_uefi_display_get_any(void); - -/********************** - * MACROS - **********************/ - -#endif - -#ifdef __cplusplus -} -#endif - -#endif //__LV_UEFI_DISPLAY_H__ - +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/uefi/lv_uefi_edk2.h b/src/drivers/uefi/lv_uefi_edk2.h index 870b997829..d6f3d88a31 100644 --- a/src/drivers/uefi/lv_uefi_edk2.h +++ b/src/drivers/uefi/lv_uefi_edk2.h @@ -1,28 +1,2 @@ -/** - * @file lv_uefi_edk2.h - * - */ - -#ifndef LV_UEFI_EDK2_H -#define LV_UEFI_EDK2_H - -#if LV_USE_UEFI - - #define LV_UEFI_EDK2_HEADERS 1 - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - -#endif - -#endif \ No newline at end of file +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/uefi/lv_uefi_gnu_efi.h b/src/drivers/uefi/lv_uefi_gnu_efi.h index 23e9e49559..c8f8c36be8 100644 --- a/src/drivers/uefi/lv_uefi_gnu_efi.h +++ b/src/drivers/uefi/lv_uefi_gnu_efi.h @@ -1,17 +1,2 @@ -/** - * @file lv_uefi_gnu_efi.h - * - */ - -#ifndef LV_UEFI_GNU_EFI_H -#define LV_UEFI_GNU_EFI_H - -#if LV_USE_UEFI - - #define LV_UEFI_GNU_EFI_HEADERS 1 - - #include - -#endif - -#endif \ No newline at end of file +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/uefi/lv_uefi_indev.h b/src/drivers/uefi/lv_uefi_indev.h index 654899f886..71886d4111 100644 --- a/src/drivers/uefi/lv_uefi_indev.h +++ b/src/drivers/uefi/lv_uefi_indev.h @@ -1,109 +1,2 @@ -/** - * @file lv_uefi_indev.h - * - */ - -#ifndef __LV_UEFI_INDEV_H__ -#define __LV_UEFI_INDEV_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../indev/lv_indev.h" - -#if LV_USE_UEFI - -#include "lv_uefi.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Create an indev object. - * @param display_res The resolution of the display in pixels, needed to scale the input. - * If NULL the resolution of the current default display will be used. - * @return The created LVGL indev object. -*/ -lv_indev_t * lv_uefi_simple_pointer_indev_create(lv_point_t * display_res); - -/** - * @brief Add an EFI_SIMPLE_POINTER_PROTOCOL interface to the indev. - * @param indev Indev that was created with lv_uefi_simple_pointer_indev_create. - * @param handle The handle on which an instance of the EFI_SIMPLE_POINTER_PROTOCOL protocol is installed. - * @return True if the interface was added. -*/ -bool lv_uefi_simple_pointer_indev_add_handle(lv_indev_t * indev, EFI_HANDLE handle); - -/** - * @brief Add all available EFI_SIMPLE_POINTER_PROTOCOL interfaces to the indev. - * @param indev Indev that was created with lv_uefi_simple_pointer_indev_create. -*/ -void lv_uefi_simple_pointer_indev_add_all(lv_indev_t * indev); - -/** - * @brief Create a LVGL indev object. - * @param display_res The resolution of the display in pixels, needed to scale the input. - * @return The created LVGL indev object. -*/ -lv_indev_t * lv_uefi_absolute_pointer_indev_create(lv_point_t * display_res); - -/** - * @brief Add an EFI_ABSOLUTE_POINTER_PROTOCOL interface to the indev. - * @param indev Indev that was created with lv_uefi_absolute_pointer_indev_create. - * @param handle The handle on which an instance of the EFI_ABSOLUTE_POINTER_PROTOCOL protocol is installed. - * @return True if the interface was added. -*/ -bool lv_uefi_absolute_pointer_indev_add_handle(lv_indev_t * indev, EFI_HANDLE handle); - -/** - * @brief Add all available EFI_ABSOLUTE_POINTER_PROTOCOL interfaces to the indev. - * @param indev Indev that was created with lv_uefi_absolute_pointer_indev_create. -*/ -void lv_uefi_absolute_pointer_indev_add_all(lv_indev_t * indev); - -/** - * @brief Create an indev object. - * @return The created LVGL indev object. -*/ -lv_indev_t * lv_uefi_simple_text_input_indev_create(void); - -/** - * @brief Add an EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL interface to the indev. - * @param indev Indev that was created with lv_uefi_simple_text_input_indev_create. - * @param handle The handle on which an instance of the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL protocol is installed. - * @return True if the interface was added. -*/ -bool lv_uefi_simple_text_input_indev_add_handle(lv_indev_t * indev, EFI_HANDLE handle); - -/** - * @brief Add all available EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL interfaces to the indev. - * @param indev Indev that was created with lv_uefi_simple_text_input_indev_create. -*/ -void lv_uefi_simple_text_input_indev_add_all(lv_indev_t * indev); - -/********************** - * MACROS - **********************/ - -#endif - -#ifdef __cplusplus -} -#endif - -#endif //__LV_UEFI_INDEV_H__ - +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/uefi/lv_uefi_indev_keyboard.c b/src/drivers/uefi/lv_uefi_indev_keyboard.c index 20bc77d648..5e98f04d6c 100644 --- a/src/drivers/uefi/lv_uefi_indev_keyboard.c +++ b/src/drivers/uefi/lv_uefi_indev_keyboard.c @@ -7,15 +7,11 @@ * INCLUDES *********************/ -#include "../../lvgl.h" -#include "../../stdlib/lv_mem.h" -#include "../../misc/lv_types.h" -#include "../../misc/lv_text_private.h" +#include "lv_uefi_private.h" #if LV_USE_UEFI -#include "lv_uefi_indev.h" -#include "lv_uefi_private.h" +#include "../../misc/lv_text_private.h" /********************* * DEFINES diff --git a/src/drivers/uefi/lv_uefi_indev_pointer.c b/src/drivers/uefi/lv_uefi_indev_pointer.c index 4714a61ee9..3d7648d128 100644 --- a/src/drivers/uefi/lv_uefi_indev_pointer.c +++ b/src/drivers/uefi/lv_uefi_indev_pointer.c @@ -7,15 +7,11 @@ * INCLUDES *********************/ -#include "../../lvgl.h" -#include "../../stdlib/lv_mem.h" -#include "../../misc/lv_types.h" -#include "../../misc/lv_text_private.h" +#include "lv_uefi_private.h" #if LV_USE_UEFI -#include "lv_uefi_indev.h" -#include "lv_uefi_private.h" +#include "../../misc/lv_text_private.h" /********************* * DEFINES diff --git a/src/drivers/uefi/lv_uefi_indev_touch.c b/src/drivers/uefi/lv_uefi_indev_touch.c index 3ac227e50f..539148f4c6 100644 --- a/src/drivers/uefi/lv_uefi_indev_touch.c +++ b/src/drivers/uefi/lv_uefi_indev_touch.c @@ -7,15 +7,11 @@ * INCLUDES *********************/ -#include "../../lvgl.h" -#include "../../stdlib/lv_mem.h" -#include "../../misc/lv_types.h" -#include "../../misc/lv_text_private.h" +#include "lv_uefi_private.h" #if LV_USE_UEFI -#include "lv_uefi_indev.h" -#include "lv_uefi_private.h" +#include "../../misc/lv_text_private.h" /********************* * DEFINES diff --git a/src/drivers/uefi/lv_uefi_private.h b/src/drivers/uefi/lv_uefi_private.h index 7f917ce40b..bd6015ee8f 100644 --- a/src/drivers/uefi/lv_uefi_private.h +++ b/src/drivers/uefi/lv_uefi_private.h @@ -14,12 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "../../lvgl.h" +#include "../../lv_public_api.h" #if LV_USE_UEFI -#include "lv_uefi.h" - /********************* * DEFINES *********************/ @@ -104,4 +102,4 @@ size_t lv_uefi_ascii_to_ucs2(const char * ascii, CHAR16 * ucs2, size_t ucs2_len) } #endif -#endif //__LV_UEFI_PRIVATE_H__ \ No newline at end of file +#endif //__LV_UEFI_PRIVATE_H__ diff --git a/src/drivers/uefi/lv_uefi_std_wrapper.h b/src/drivers/uefi/lv_uefi_std_wrapper.h deleted file mode 100644 index c5fb5cc8b9..0000000000 --- a/src/drivers/uefi/lv_uefi_std_wrapper.h +++ /dev/null @@ -1,155 +0,0 @@ -/** - * @file lv_uefi_std_wrapper.h - * - */ - -#ifndef LV_UEFI_STD_WRAPPER_H -#define LV_UEFI_STD_WRAPPER_H - -#if LV_USE_UEFI - - #include LV_USE_UEFI_INCLUDE - - /************************************* - * TYPES - *************************************/ - typedef UINT8 uint8_t; - typedef UINT16 uint16_t; - typedef UINT32 uint32_t; - typedef UINT64 uint64_t; - typedef INT8 int8_t; - typedef INT16 int16_t; - typedef INT32 int32_t; - typedef INT64 int64_t; - - typedef uint32_t uint_fast32_t; - typedef UINTN uintptr_t; - typedef UINTN size_t; - typedef INTN intptr_t; - typedef INTN intmax_t; - typedef INTN ptrdiff_t; - - typedef UINT8 bool; - - /************************************* - * DEFINES - *************************************/ - #define false 0 - #define true 1 - - #define PRId8 "d" - #define PRId16 "d" - #define PRId32 "d" - #define PRId64 "d" - - #define PRIu8 "u" - #define PRIu16 "u" - #define PRIu32 "u" - #define PRIu64 "u" - - #define PRIx8 "x" - #define PRIx16 "x" - #define PRIx32 "x" - #define PRIx64 "x" - - #define PRIX8 "X" - #define PRIX16 "X" - #define PRIX32 "X" - #define PRIX64 "X" - - /************************************* - * LIMITS - *************************************/ - #ifndef INT8_MAX - #define INT8_MAX (0x7F) - #endif - - #ifndef UINT8_MAX - #define UINT8_MAX (0xFF) - #endif - - #ifndef INT16_MAX - #define INT16_MAX (0x7FFF) - #endif - - #ifndef UINT16_MAX - #define UINT16_MAX (0xFFFF) - #endif - - #ifndef INT32_MAX - #define INT32_MAX (0x7FFFFFFF) - #endif - - #ifndef UINT32_MAX - #define UINT32_MAX (0xFFFFFFFF) - #endif - - #ifndef INT64_MAX - #define INT64_MAX (0x7FFFFFFFFFFFFFFFULL) - #endif - - #ifndef UINT64_MAX - #define UINT64_MAX (0xFFFFFFFFFFFFFFFFULL) - #endif - - #ifndef INT_MAX - #define INT_MAX (0x7FFFFFFFFFFFFFFFULL) - #endif - - #ifndef UINT_MAX - #define UINT_MAX (0xFFFFFFFFFFFFFFFFULL) - #endif - - /// - /// Minimum values for the signed UEFI Data Types - /// - #ifndef INT8_MIN - #define INT8_MIN (( -127) - 1) - #endif - - #ifndef INT16_MIN - #define INT16_MIN (( -32767) - 1) - #endif - - #ifndef INT32_MIN - #define INT32_MIN (( -2147483647) - 1) - #endif - - #ifndef INT64_MIN - #define INT64_MIN (( -9223372036854775807LL) - 1) - #endif - - #ifndef SIZE_MAX - #define SIZE_MAX (0xFFFFFFFF) - #endif - - #ifndef LONG_MAX - #define LONG_MAX (0x7FFFFFFF) - #endif - - #ifndef ULONG_MAX - #define ULONG_MAX (0xFFFFFFFF) - #endif - - #ifndef USHRT_MAX - #define USHRT_MAX (0xFFFF) - #endif - - #ifndef CHAR_BIT - #define CHAR_BIT 8 - #endif - - /************************************* - * VA_ARG - *************************************/ - #if LV_UEFI_EDK2_HEADERS - #define va_list VA_LIST - #define va_start(Marker, Parameter) VA_START(Marker, Parameter) - #define va_arg(Marker, TYPE) VA_ARG(Marker, TYPE) - #define va_end(Marker) VA_END(Marker) - #define va_copy(Dest, Start) VA_COPY(Dest, Start) - #endif - -#endif - -#endif \ No newline at end of file diff --git a/src/drivers/wayland/lv_wayland.c b/src/drivers/wayland/lv_wayland.c index 338233b517..5dec0b3a12 100644 --- a/src/drivers/wayland/lv_wayland.c +++ b/src/drivers/wayland/lv_wayland.c @@ -21,7 +21,6 @@ #endif #endif -#include "lv_wayland_private.h" #include #include #include diff --git a/src/drivers/wayland/lv_wayland.h b/src/drivers/wayland/lv_wayland.h index 28ecd3727a..a95e53790b 100644 --- a/src/drivers/wayland/lv_wayland.h +++ b/src/drivers/wayland/lv_wayland.h @@ -1,53 +1,2 @@ -/** - * @file lv_wayland.h - */ - -#ifndef LV_WAYLAND_H -#define LV_WAYLAND_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" - -#if LV_USE_WAYLAND - -#include "lv_wayland_keyboard.h" -#include "lv_wayland_pointer.h" -#include "lv_wayland_touch.h" -#include "lv_wayland_window.h" -#include "lv_wayland_pointer_axis.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Retrieves the file descriptor of the wayland socket - */ -int lv_wayland_get_fd(void); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_WAYLAND */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_WAYLAND_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/wayland/lv_wayland_backend_egl.c b/src/drivers/wayland/lv_wayland_backend_egl.c index 542577f3f4..edb80d19e8 100644 --- a/src/drivers/wayland/lv_wayland_backend_egl.c +++ b/src/drivers/wayland/lv_wayland_backend_egl.c @@ -11,7 +11,6 @@ #if LV_WAYLAND_USE_EGL #include "../../display/lv_display_private.h" -#include "../opengles/lv_opengles_driver.h" #include "../opengles/lv_opengles_texture_private.h" #include "../opengles/lv_opengles_egl_private.h" #include "../opengles/lv_opengles_debug.h" diff --git a/src/drivers/wayland/lv_wayland_backend_g2d.c b/src/drivers/wayland/lv_wayland_backend_g2d.c index b11f402047..837bad62ee 100644 --- a/src/drivers/wayland/lv_wayland_backend_g2d.c +++ b/src/drivers/wayland/lv_wayland_backend_g2d.c @@ -17,7 +17,6 @@ #include #include #include -#include "../../misc/lv_types.h" #include #include "../../draw/nxp/g2d/lv_g2d_utils.h" #include diff --git a/src/drivers/wayland/lv_wayland_backend_private.h b/src/drivers/wayland/lv_wayland_backend_private.h index c9e617b79f..cef2e0362a 100644 --- a/src/drivers/wayland/lv_wayland_backend_private.h +++ b/src/drivers/wayland/lv_wayland_backend_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_wayland.h" +#include "lv_wayland_private.h" #if LV_USE_WAYLAND diff --git a/src/drivers/wayland/lv_wayland_backend_shm.c b/src/drivers/wayland/lv_wayland_backend_shm.c index c65b497b9c..64366cec52 100644 --- a/src/drivers/wayland/lv_wayland_backend_shm.c +++ b/src/drivers/wayland/lv_wayland_backend_shm.c @@ -11,7 +11,6 @@ #if LV_WAYLAND_USE_SHM -#include "../../draw/sw/lv_draw_sw_utils.h" #include "../../display/lv_display_private.h" #include #include diff --git a/src/drivers/wayland/lv_wayland_keyboard.c b/src/drivers/wayland/lv_wayland_keyboard.c index 2642bf2b72..6b3d044773 100644 --- a/src/drivers/wayland/lv_wayland_keyboard.c +++ b/src/drivers/wayland/lv_wayland_keyboard.c @@ -3,16 +3,14 @@ * */ -#include "lv_wayland_keyboard.h" +#include "lv_wayland_private.h" #if LV_USE_WAYLAND -#include "lv_wayland_private.h" #include #include #include #include -#include "../../misc/lv_log.h" /********************* * INCLUDES diff --git a/src/drivers/wayland/lv_wayland_keyboard.h b/src/drivers/wayland/lv_wayland_keyboard.h index c568497f6d..8330ddd0d5 100644 --- a/src/drivers/wayland/lv_wayland_keyboard.h +++ b/src/drivers/wayland/lv_wayland_keyboard.h @@ -1,52 +1,2 @@ -/** - * @file lv_wayland_keyboard.h - * - */ - -#ifndef LV_WAYLAND_KEYBOARD_H -#define LV_WAYLAND_KEYBOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../indev/lv_indev.h" -#include "../../indev/lv_indev_gesture.h" -#if LV_USE_WAYLAND - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_indev_t * lv_wayland_keyboard_create(void); - -/** - * Get keyboard input device for given LVGL display - * @param display LVGL display - * @return input device connected to keyboard, or NULL on error - */ -lv_indev_t * lv_wayland_get_keyboard(lv_display_t * display); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_WAYLAND */ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_WAYLAND_KEYBOARD_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/wayland/lv_wayland_pointer.c b/src/drivers/wayland/lv_wayland_pointer.c index 91a17cc1f0..c5145fdfda 100644 --- a/src/drivers/wayland/lv_wayland_pointer.c +++ b/src/drivers/wayland/lv_wayland_pointer.c @@ -3,7 +3,7 @@ * */ -#include "lv_wayland_pointer.h" +#include "lv_wayland_private.h" #if LV_USE_WAYLAND @@ -13,7 +13,6 @@ #include #include #include -#include "lv_wayland_private.h" /********************* * INCLUDES diff --git a/src/drivers/wayland/lv_wayland_pointer.h b/src/drivers/wayland/lv_wayland_pointer.h index dc02773a5e..2933eece80 100644 --- a/src/drivers/wayland/lv_wayland_pointer.h +++ b/src/drivers/wayland/lv_wayland_pointer.h @@ -1,54 +1,2 @@ - -/** - * @file lv_wayland_pointer.h - * - */ - -#ifndef LV_WAYLAND_POINTER_H -#define LV_WAYLAND_POINTER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../indev/lv_indev.h" -#include "../../indev/lv_indev_gesture.h" -#if LV_USE_WAYLAND - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_indev_t * lv_wayland_pointer_create(void); - -/** - * Obtains the input device of the mouse pointer - * @note It is used to create an input group on application start - * @param disp Reference to the LVGL display associated to the window - * @return The input device - */ -lv_indev_t * lv_wayland_get_pointer(lv_display_t * disp); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_WAYLAND */ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_WAYLAND_POINTER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/wayland/lv_wayland_pointer_axis.h b/src/drivers/wayland/lv_wayland_pointer_axis.h index 8299bfa736..5c41070e2e 100644 --- a/src/drivers/wayland/lv_wayland_pointer_axis.h +++ b/src/drivers/wayland/lv_wayland_pointer_axis.h @@ -1,54 +1,2 @@ -/** - * @file lv_wayland_pointer_axis.h - * - */ - -#ifndef LV_WAYLAND_POINTER_AXIS_H -#define LV_WAYLAND_POINTER_AXIS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../indev/lv_indev.h" -#include "../../indev/lv_indev_gesture.h" - -#if LV_USE_WAYLAND - -/********************* - * INCLUDES - *********************/ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_indev_t * lv_wayland_pointer_axis_create(void); - -/** - * Obtains the input device of the encoder - * @note It is used to create an input group on application start - * @param display Reference to the LVGL display associated to the window - * @return The input device - */ -lv_indev_t * lv_wayland_get_pointeraxis(lv_display_t * display); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_WAYLAND */ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_WAYLAND_POINTER_AXIS_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/wayland/lv_wayland_private.h b/src/drivers/wayland/lv_wayland_private.h index c51ae7e3a1..7d1e4ffa57 100644 --- a/src/drivers/wayland/lv_wayland_private.h +++ b/src/drivers/wayland/lv_wayland_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_WAYLAND @@ -22,7 +22,6 @@ extern "C" { #include #include #include -#include "../../misc/lv_types.h" #include "lv_wayland_backend_private.h" /********************* diff --git a/src/drivers/wayland/lv_wayland_seat.c b/src/drivers/wayland/lv_wayland_seat.c index 354cfc432f..38fa4f173b 100644 --- a/src/drivers/wayland/lv_wayland_seat.c +++ b/src/drivers/wayland/lv_wayland_seat.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_wayland.h" + +#include "../../lv_public_api.h" #if LV_USE_WAYLAND diff --git a/src/drivers/wayland/lv_wayland_touch.c b/src/drivers/wayland/lv_wayland_touch.c index 88e196d0e1..2ce06746c4 100644 --- a/src/drivers/wayland/lv_wayland_touch.c +++ b/src/drivers/wayland/lv_wayland_touch.c @@ -3,12 +3,10 @@ * */ -#include "lv_wayland_touch.h" +#include "lv_wayland_private.h" #if LV_USE_WAYLAND -#include "lv_wayland_private.h" - #include #include diff --git a/src/drivers/wayland/lv_wayland_touch.h b/src/drivers/wayland/lv_wayland_touch.h index 132f1e6eeb..28462b2c07 100644 --- a/src/drivers/wayland/lv_wayland_touch.h +++ b/src/drivers/wayland/lv_wayland_touch.h @@ -1,52 +1,2 @@ -/** - * @file lv_wayland_touch.h - * - */ - -#ifndef LV_WAYLAND_TOUCH_H -#define LV_WAYLAND_TOUCH_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../indev/lv_indev.h" -#include "../../indev/lv_indev_gesture.h" -#if LV_USE_WAYLAND - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_indev_t * lv_wayland_touch_create(void); - -/** - * Get touchscreen input device for given LVGL display - * @param display LVGL display - * @return input device connected to touchscreen, or NULL on error - */ -lv_indev_t * lv_wayland_get_touchscreen(lv_display_t * display); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_WAYLAND */ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_WAYLAND_TOUCH_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/wayland/lv_wayland_window.c b/src/drivers/wayland/lv_wayland_window.c index 69a4471c73..f83401bdf6 100644 --- a/src/drivers/wayland/lv_wayland_window.c +++ b/src/drivers/wayland/lv_wayland_window.c @@ -6,20 +6,14 @@ /********************* * INCLUDES *********************/ -#include "lv_wayland_window.h" + +#include "lv_wayland_private.h" #if LV_USE_WAYLAND -#include "../../lv_init.h" #include #include #include -#include "lv_wayland_private.h" -#include "lv_wayland_private.h" -#include "lv_wayland_pointer.h" -#include "lv_wayland_pointer_axis.h" -#include "lv_wayland_touch.h" -#include "lv_wayland_keyboard.h" /********************* * DEFINES diff --git a/src/drivers/wayland/lv_wayland_window.h b/src/drivers/wayland/lv_wayland_window.h index 336b50a898..88ec00e7b8 100644 --- a/src/drivers/wayland/lv_wayland_window.h +++ b/src/drivers/wayland/lv_wayland_window.h @@ -1,104 +1,2 @@ - -/** - * @file lv_wayland_window.h - * - */ - -#ifndef LV_WAYLAND_WINDOW_H -#define LV_WAYLAND_WINDOW_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" - -#if LV_USE_WAYLAND - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef bool (*lv_wayland_display_close_cb_t)(lv_display_t * disp); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Creates a window - * @param hor_res The width of the window in pixels - * @param ver_res The height of the window in pixels - * @param title The title of the window - * @param close_cb The callback that will be execute when the user closes the window - * @return The LVGL display associated to the window - */ -lv_display_t * lv_wayland_window_create(uint32_t hor_res, uint32_t ver_res, char * title, - lv_wayland_display_close_cb_t close_cb); - -/** - * Closes the window programmatically - * @param disp Reference to the LVGL display associated to the window - */ -void lv_wayland_window_close(lv_display_t * disp); - -/** - * Check if the window is open - * @param disp Reference to the LVGL display associated to the window - * @return true: The window is open - */ -bool lv_wayland_window_is_open(lv_display_t * disp); - -/** - * Assigns the window to a specific physical display - * @param disp Reference to the LVGL display associated to the window - * @param display Physical display number - */ -void lv_wayland_assign_physical_display(lv_display_t * disp, uint8_t display); - -/** - * Unassigns the current physical display attached to the window - * @param disp Reference to the LVGL display associated to the window - */ -void lv_wayland_unassign_physical_display(lv_display_t * disp); - -/** - * Sets the fullscreen state of the window - * @param disp Reference to the LVGL display associated to the window - * @param fullscreen If true the window enters fullscreen - */ - -void lv_wayland_window_set_fullscreen(lv_display_t * disp, bool fullscreen); - -/** - * Sets the maximized state of the window - * @param disp Reference to the LVGL display associated to the window - * @param fullscreen If true the window is maximized - */ -void lv_wayland_window_set_maximized(lv_display_t * disp, bool maximize); - -/** - * Minimizes the window - * @param disp Reference to the LVGL display associated to the window - */ -void lv_wayland_window_set_minimized(lv_display_t * disp); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_WAYLAND */ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_WAYLAND_WINDOW_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/wayland/lv_wayland_xdg_shell.c b/src/drivers/wayland/lv_wayland_xdg_shell.c index 1e53b6bb71..6f6f416713 100644 --- a/src/drivers/wayland/lv_wayland_xdg_shell.c +++ b/src/drivers/wayland/lv_wayland_xdg_shell.c @@ -12,7 +12,7 @@ #if LV_USE_WAYLAND #include -#include "wayland_xdg_shell.h" +#include /********************* * DEFINES diff --git a/src/drivers/windows/lv_windows_context.c b/src/drivers/windows/lv_windows_context.c index dd2d6a5995..57e1dc746a 100644 --- a/src/drivers/windows/lv_windows_context.c +++ b/src/drivers/windows/lv_windows_context.c @@ -8,13 +8,13 @@ *********************/ #include "lv_windows_context.h" + #if LV_USE_WINDOWS #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wcast-function-type" #endif -#include "lv_windows_display.h" #include "lv_windows_input_private.h" #include "../../osal/lv_os_private.h" diff --git a/src/drivers/windows/lv_windows_context.h b/src/drivers/windows/lv_windows_context.h index d080ca5658..9cd2f96c26 100644 --- a/src/drivers/windows/lv_windows_context.h +++ b/src/drivers/windows/lv_windows_context.h @@ -14,8 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../display/lv_display.h" -#include "../../indev/lv_indev.h" +#include "../../lv_public_api.h" #if LV_USE_WINDOWS diff --git a/src/drivers/windows/lv_windows_display.c b/src/drivers/windows/lv_windows_display.c index 496aada594..b424eeca24 100644 --- a/src/drivers/windows/lv_windows_display.c +++ b/src/drivers/windows/lv_windows_display.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_windows_display.h" +#include "../../lv_public_api.h" #if LV_USE_WINDOWS #include "lv_windows_context.h" diff --git a/src/drivers/windows/lv_windows_display.h b/src/drivers/windows/lv_windows_display.h index 2ac4653433..8f7c55bf66 100644 --- a/src/drivers/windows/lv_windows_display.h +++ b/src/drivers/windows/lv_windows_display.h @@ -1,127 +1,2 @@ -/** - * @file lv_windows_display.h - * - */ - -#ifndef LV_WINDOWS_DISPLAY_H -#define LV_WINDOWS_DISPLAY_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" -#include "../../indev/lv_indev.h" - -#if LV_USE_WINDOWS - -#include - -/********************* - * DEFINES - *********************/ - -#define LV_WINDOWS_ZOOM_BASE_LEVEL 100 - -#ifndef USER_DEFAULT_SCREEN_DPI -#define USER_DEFAULT_SCREEN_DPI 96 -#endif - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Create a LVGL display object. - * @param title The window title of LVGL display. - * @param hor_res The horizontal resolution value of LVGL display. - * @param ver_res The vertical resolution value of LVGL display. - * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%. - * @param allow_dpi_override Allow DPI override if true, or follow the - * Windows DPI scaling setting dynamically. - * @param simulator_mode Create simulator mode display if true (not resizable), - * or create application mode display (resizable). - * @return The created LVGL display object. -*/ -lv_display_t * lv_windows_create_display( - const wchar_t * title, - int32_t hor_res, - int32_t ver_res, - int32_t zoom_level, - bool allow_dpi_override, - bool simulator_mode); - -/** - * @brief Get the window handle from specific LVGL display object. - * @param display The specific LVGL display object. - * @return The window handle from specific LVGL display object. -*/ -HWND lv_windows_get_display_window_handle(lv_display_t * display); - -/** - * @brief Get logical pixel value from physical pixel value taken account - * with zoom level. - * @param physical The physical pixel value taken account with zoom level. - * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%. - * @return The logical pixel value. - * @remark It uses the same calculation style as Windows OS implementation. - * It will be useful for integrate LVGL Windows backend to other - * Windows applications. -*/ -int32_t lv_windows_zoom_to_logical(int32_t physical, int32_t zoom_level); - -/** - * @brief Get physical pixel value taken account with zoom level from - * logical pixel value. - * @param logical The logical pixel value. - * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%. - * @return The physical pixel value taken account with zoom level. - * @remark It uses the same calculation style as Windows OS implementation. - * It will be useful for integrate LVGL Windows backend to other - * Windows applications. -*/ -int32_t lv_windows_zoom_to_physical(int32_t logical, int32_t zoom_level); - -/** - * @brief Get logical pixel value from physical pixel value taken account - * with DPI scaling. - * @param physical The physical pixel value taken account with DPI scaling. - * @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI. - * @return The logical pixel value. - * @remark It uses the same calculation style as Windows OS implementation. - * It will be useful for integrate LVGL Windows backend to other - * Windows applications. -*/ -int32_t lv_windows_dpi_to_logical(int32_t physical, int32_t dpi); - -/** - * @brief Get physical pixel value taken account with DPI scaling from - * logical pixel value. - * @param logical The logical pixel value. - * @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI. - * @return The physical pixel value taken account with DPI scaling. - * @remark It uses the same calculation style as Windows OS implementation. - * It will be useful for integrate LVGL Windows backend to other - * Windows applications. -*/ -int32_t lv_windows_dpi_to_physical(int32_t logical, int32_t dpi); - -/********************** - * MACROS - **********************/ - -#endif // LV_USE_WINDOWS - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_WINDOWS_DISPLAY_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/windows/lv_windows_input.c b/src/drivers/windows/lv_windows_input.c index 3b7ae1ca80..91b671f9cf 100644 --- a/src/drivers/windows/lv_windows_input.c +++ b/src/drivers/windows/lv_windows_input.c @@ -7,7 +7,8 @@ * INCLUDES *********************/ -#include "lv_windows_input.h" +#include "../../lv_public_api.h" + #if LV_USE_WINDOWS #ifdef __GNUC__ @@ -15,7 +16,6 @@ #endif #include "lv_windows_context.h" -#include "lv_windows_display.h" #include "lv_windows_input_private.h" #include "../../misc/lv_text_private.h" #include "../../core/lv_obj_private.h" @@ -23,7 +23,6 @@ #include #include "../../widgets/textarea/lv_textarea_private.h" -#include "../../widgets/keyboard/lv_keyboard.h" /********************* * DEFINES diff --git a/src/drivers/windows/lv_windows_input.h b/src/drivers/windows/lv_windows_input.h index 892014ea34..d94f12aac4 100644 --- a/src/drivers/windows/lv_windows_input.h +++ b/src/drivers/windows/lv_windows_input.h @@ -1,83 +1,2 @@ -/** - * @file lv_windows_input.h - * - */ - -#ifndef LV_WINDOWS_INPUT_H -#define LV_WINDOWS_INPUT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" -#include "../../indev/lv_indev.h" - -#if LV_USE_WINDOWS - -#include - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Get the window handle from specific LVGL input device object. - * @param indev The specific LVGL input device object. - * @return The window handle from specific LVGL input device object. -*/ -HWND lv_windows_get_indev_window_handle(lv_indev_t * indev); - -/** - * @brief Open a LVGL pointer input device object for the specific LVGL - * display object, or create it if the LVGL pointer input device - * object is not created or removed before. - * @param display The specific LVGL display object. - * @return The LVGL pointer input device object for the specific LVGL - * display object. -*/ -lv_indev_t * lv_windows_acquire_pointer_indev(lv_display_t * display); - -/** - * @brief Open a LVGL keypad input device object for the specific LVGL - * display object, or create it if the LVGL keypad input device - * object is not created or removed before. - * @param display The specific LVGL display object. - * @return The LVGL keypad input device object for the specific LVGL - * display object. -*/ -lv_indev_t * lv_windows_acquire_keypad_indev(lv_display_t * display); - -/** - * @brief Open a LVGL encoder input device object for the specific LVGL - * display object, or create it if the LVGL encoder input device - * object is not created or removed before. - * @param display The specific LVGL display object. - * @return The LVGL encoder input device object for the specific LVGL - * display object. -*/ -lv_indev_t * lv_windows_acquire_encoder_indev(lv_display_t * display); - -/********************** - * MACROS - **********************/ - -#endif // LV_USE_WINDOWS - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_WINDOWS_INPUT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/x11/lv_x11.h b/src/drivers/x11/lv_x11.h index bb98b51f93..58f0ab077d 100644 --- a/src/drivers/x11/lv_x11.h +++ b/src/drivers/x11/lv_x11.h @@ -1,82 +1,2 @@ -/** - * @file lv_x11.h - * - */ - -#ifndef LV_X11_H -#define LV_X11_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../display/lv_display.h" -#include "../../indev/lv_indev.h" -#include "../../draw/lv_image_dsc.h" - -#if LV_USE_X11 - -/********************* - * DEFINES - *********************/ - -/** Header of private display driver user data - for internal use only */ -typedef struct { - struct _XDisplay * display; /**< X11 display object */ - struct _x11_inp_data * inp_data; /**< input user data object */ -} _x11_user_hdr_t; - -/** optional window close callback function type - * @see lv_x11_window_set_close_cb -*/ -typedef void(*lv_x11_close_cb)(void * user_data); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * create and add keyboard, mouse and scrollwheel objects and connect them to x11 display. - * - * This is a convenience method handling the typical input initialisation of an X11 window: - * - create keyboard (lv_x11_keyboard_create) - * - create mouse (with scrollwheel, lv_x11_mouse_create lv_x11_mousewheel_create) - * - * @param[in] disp the created X11 display object from @ref lv_x11_window_create - * @param[in] mouse_img optional image description for the mouse cursor (NULL for no/invisible mouse cursor) - */ -void lv_x11_inputs_create(lv_display_t * disp, lv_image_dsc_t const * mouse_img); - -/** - * create the X11 display - * - * The minimal initialisation for initializing the X11 display driver with keyboard/mouse support: - * @code - * lv_display_t* disp = lv_x11_window_create("My Window Title", window_width, window_width); - * lv_x11_inputs_create(disp, NULL); - * @endcode - * or with mouse cursor icon: - * @code - * lv_image_dsc_t mouse_symbol = {.....}; - * lv_display_t* disp = lv_x11_window_create("My Window Title", window_width, window_width); - * lv_x11_inputs_create(disp, &mouse_symbol); - * @endcode - * - * @param[in] title title of the created X11 window - * @param[in] hor_res horizontal resolution (=width) of the X11 window - * @param[in] ver_res vertical resolution (=height) of the X11 window - * @return pointer to the display object - */ -lv_display_t * lv_x11_window_create(char const * title, int32_t hor_res, int32_t ver_res); - -#endif /* LV_USE_X11 */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_X11_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/drivers/x11/lv_x11_display.c b/src/drivers/x11/lv_x11_display.c index d391a4f11c..e110c37559 100644 --- a/src/drivers/x11/lv_x11_display.c +++ b/src/drivers/x11/lv_x11_display.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_x11.h" +#include "../../lv_public_api.h" #if LV_USE_X11 @@ -16,8 +16,6 @@ #include #include #include -#include "../../core/lv_obj_pos.h" -#include "../../core/lv_refr.h" /********************* * DEFINES diff --git a/src/drivers/x11/lv_x11_input.c b/src/drivers/x11/lv_x11_input.c index 6c1bf769dd..5de3ba9fed 100644 --- a/src/drivers/x11/lv_x11_input.c +++ b/src/drivers/x11/lv_x11_input.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_x11.h" +#include "../../lv_public_api.h" #if LV_USE_X11 @@ -14,7 +14,6 @@ #include #include #include -#include "../../widgets/image/lv_image.h" /********************* * DEFINES diff --git a/src/font/binfont_loader/lv_binfont_loader.c b/src/font/binfont_loader/lv_binfont_loader.c index c175d859ae..de41b32e85 100644 --- a/src/font/binfont_loader/lv_binfont_loader.c +++ b/src/font/binfont_loader/lv_binfont_loader.c @@ -6,12 +6,10 @@ /********************* * INCLUDES *********************/ -#include "../../lvgl.h" + +#include "../../lv_public_api.h" #include "../fmt_txt/lv_font_fmt_txt_private.h" #include "../../misc/lv_fs_private.h" -#include "../../misc/lv_types.h" -#include "../../stdlib/lv_string.h" -#include "lv_binfont_loader.h" /********************** * TYPEDEFS diff --git a/src/font/binfont_loader/lv_binfont_loader.h b/src/font/binfont_loader/lv_binfont_loader.h index ef67b9227c..a5b496acc6 100644 --- a/src/font/binfont_loader/lv_binfont_loader.h +++ b/src/font/binfont_loader/lv_binfont_loader.h @@ -1,72 +1,2 @@ -/** - * @file lv_binfont_loader.h - * - */ - -#ifndef LV_BINFONT_LOADER_H -#define LV_BINFONT_LOADER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - - -typedef struct { - uint32_t font_size; /**< Size of the font in pixels*/ - const char * path; /**< Path to font file*/ - const void * buffer; /**< Address of the font file in the memory*/ - uint32_t buffer_size; /**< Size of the font file buffer*/ -} lv_binfont_font_src_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_binfont_font_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Loads a `lv_font_t` object from a binary font file - * @param path path to font file - * @return pointer to font where to load - */ -lv_font_t * lv_binfont_create(const char * path); - -#if LV_USE_FS_MEMFS -/** - * Loads a `lv_font_t` object from a memory buffer containing the binary font file. - * Requires LV_USE_FS_MEMFS - * @param buffer address of the font file in the memory - * @param size size of the font file buffer - * @return pointer to font where to load - */ -lv_font_t * lv_binfont_create_from_buffer(void * buffer, uint32_t size); -#endif - -/** - * Frees the memory allocated by the `lv_binfont_create()` function - * @param font lv_font_t object created by the lv_binfont_create function - */ -void lv_binfont_destroy(lv_font_t * font); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_BINFONT_LOADER_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/font/fmt_txt/lv_font_fmt_txt.c b/src/font/fmt_txt/lv_font_fmt_txt.c index b05c1c268f..87532c1a76 100644 --- a/src/font/fmt_txt/lv_font_fmt_txt.c +++ b/src/font/fmt_txt/lv_font_fmt_txt.c @@ -6,14 +6,10 @@ /********************* * INCLUDES *********************/ -#include "../lv_font.h" +#include "../lv_font_private.h" #include "lv_font_fmt_txt_private.h" #include "../../core/lv_global.h" -#include "../../misc/lv_assert.h" -#include "../../misc/lv_types.h" -#include "../../misc/lv_log.h" #include "../../misc/lv_utils.h" -#include "../../stdlib/lv_mem.h" /********************* * DEFINES diff --git a/src/font/fmt_txt/lv_font_fmt_txt.h b/src/font/fmt_txt/lv_font_fmt_txt.h index 962061776f..906633e425 100644 --- a/src/font/fmt_txt/lv_font_fmt_txt.h +++ b/src/font/fmt_txt/lv_font_fmt_txt.h @@ -1,239 +1,2 @@ -/** - * @file lv_font_fmt_txt.h - * - */ - -#ifndef LV_FONT_FMT_TXT_H -#define LV_FONT_FMT_TXT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_font.h" -#include "../../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** This describes a glyph.*/ -typedef struct { -#if LV_FONT_FMT_TXT_LARGE == 0 - uint32_t bitmap_index : 20; /**< Start index of the bitmap. A font can be max 1 MB.*/ - uint32_t adv_w : 12; /**< Draw the next glyph after this width. 8.4 format (real_value * 16 is stored).*/ - uint8_t box_w; /**< Width of the glyph's bounding box*/ - uint8_t box_h; /**< Height of the glyph's bounding box*/ - int8_t ofs_x; /**< x offset of the bounding box*/ - int8_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/ -#else - uint32_t bitmap_index; /**< Start index of the bitmap. A font can be max 4 GB.*/ - uint32_t adv_w; /**< Draw the next glyph after this width. 28.4 format (real_value * 16 is stored).*/ - uint16_t box_w; /**< Width of the glyph's bounding box*/ - uint16_t box_h; /**< Height of the glyph's bounding box*/ - int16_t ofs_x; /**< x offset of the bounding box*/ - int16_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/ -#endif -} lv_font_fmt_txt_glyph_dsc_t; - -/** Format of font character map.*/ -typedef enum { - LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL, - LV_FONT_FMT_TXT_CMAP_SPARSE_FULL, - LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY, - LV_FONT_FMT_TXT_CMAP_SPARSE_TINY, -} lv_font_fmt_txt_cmap_type_t; - -/** - * Map codepoints to a `glyph_dsc`s - * Several formats are supported to optimize memory usage - * See https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md - */ -typedef struct { - /** First Unicode character for this range*/ - uint32_t range_start; - - /** Number of Unicode characters related to this range. - * Last Unicode character = range_start + range_length - 1*/ - uint16_t range_length; - - /** First glyph ID (array index of `glyph_dsc`) for this range*/ - uint16_t glyph_id_start; - - /* - According the specification there are 4 formats: - https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md - - For simplicity introduce "relative code point": - rcp = codepoint - range_start - - and a search function: - search a "value" in an "array" and returns the index of "value". - - Format 0 tiny - unicode_list == NULL && glyph_id_ofs_list == NULL - glyph_id = glyph_id_start + rcp - - Format 0 full - unicode_list == NULL && glyph_id_ofs_list != NULL - glyph_id = glyph_id_start + glyph_id_ofs_list[rcp] - - Sparse tiny - unicode_list != NULL && glyph_id_ofs_list == NULL - glyph_id = glyph_id_start + search(unicode_list, rcp) - - Sparse full - unicode_list != NULL && glyph_id_ofs_list != NULL - glyph_id = glyph_id_start + glyph_id_ofs_list[search(unicode_list, rcp)] - */ - - const uint16_t * unicode_list; - - /** if(type == LV_FONT_FMT_TXT_CMAP_FORMAT0_...) it's `uint8_t *` - * if(type == LV_FONT_FMT_TXT_CMAP_SPARSE_...) it's `uint16_t *` - */ - const void * glyph_id_ofs_list; - - /** Length of `unicode_list` and/or `glyph_id_ofs_list`*/ - uint16_t list_length; - - /** Type of this character map*/ - lv_font_fmt_txt_cmap_type_t type; -} lv_font_fmt_txt_cmap_t; - -/** A simple mapping of kern values from pairs*/ -typedef struct { - /*To get a kern value of two code points: - 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t - 2. for(i = 0; i < pair_cnt * 2; i += 2) - if(glyph_ids[i] == glyph_id_left && - glyph_ids[i+1] == glyph_id_right) - return values[i / 2]; - */ - const void * glyph_ids; - const int8_t * values; - uint32_t pair_cnt : 30; - uint32_t glyph_ids_size : 2; /**< 0: `glyph_ids` is stored as `uint8_t`; 1: as `uint16_t` */ -} lv_font_fmt_txt_kern_pair_t; - -/** More complex but more optimal class based kern value storage*/ -typedef struct { - /*To get a kern value of two code points: - 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t - 2. Get the class of the left and right glyphs as `left_class` and `right_class` - left_class = left_class_mapping[glyph_id_left]; - right_class = right_class_mapping[glyph_id_right]; - 3. value = class_pair_values[(left_class-1)*right_class_cnt + (right_class-1)] - */ - - const int8_t * class_pair_values; /**< left_class_cnt * right_class_cnt value */ - const uint8_t * left_class_mapping; /**< Map the glyph_ids to classes: index -> glyph_id -> class_id */ - const uint8_t * right_class_mapping; /**< Map the glyph_ids to classes: index -> glyph_id -> class_id */ - uint8_t left_class_cnt; - uint8_t right_class_cnt; -} lv_font_fmt_txt_kern_classes_t; - -/** Bitmap formats*/ -typedef enum { - LV_FONT_FMT_TXT_PLAIN = 0, - LV_FONT_FMT_TXT_COMPRESSED = 1, - LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER = 2, -} lv_font_fmt_txt_bitmap_format_t; - -/** Describe store for additional data for fonts */ -typedef struct { - /** The bitmaps of all glyphs */ - const uint8_t * glyph_bitmap; - - /** Describe the glyphs */ - const lv_font_fmt_txt_glyph_dsc_t * glyph_dsc; - - /** Map the glyphs to Unicode characters. - *Array of `lv_font_cmap_fmt_txt_t` variables */ - const lv_font_fmt_txt_cmap_t * cmaps; - - /** - * Store kerning values. - * Can be `lv_font_fmt_txt_kern_pair_t * or `lv_font_kern_classes_fmt_txt_t *` - * depending on `kern_classes` - */ - const void * kern_dsc; - - /** Scale kern values in 12.4 format */ - uint16_t kern_scale; - - /** Number of cmap tables */ - uint16_t cmap_num : 9; - - /** Bit per pixel: 1, 2, 3, 4, 8 */ - uint16_t bpp : 4; - - /** Type of `kern_dsc` */ - uint16_t kern_classes : 1; - - /** - * storage format of the bitmap - * from `lv_font_fmt_txt_bitmap_format_t` - */ - uint16_t bitmap_format : 2; - - /** - * Bytes to which each line is padded. - * 0: means no align and padding - * 1: e.g. with bpp=4 lines are aligned to 1 byte, so there can be a 4 bits of padding - * 4, 8, 16, 32, 64: each line is padded to the given byte boundaries - */ - uint8_t stride; -} lv_font_fmt_txt_dsc_t; - -typedef struct { - const lv_font_t * font_p; /**< Pointer to built-in font*/ - uint32_t size; /** < Size of the built-in font*/ -} lv_builtin_font_src_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_builtin_font_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Used as `get_glyph_bitmap` callback in lvgl's native font format if the font is uncompressed. - * @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index and format. - * @param draw_buf a draw buffer that can be used to store the bitmap of the glyph, it's OK not to use it. - * @return pointer to an A8 bitmap (not necessarily bitmap_out) or NULL if `unicode_letter` not found - */ -const void * lv_font_get_bitmap_fmt_txt(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf); - -/** - * Used as `get_glyph_dsc` callback in lvgl's native font format if the font is uncompressed. - * @param font pointer to font - * @param dsc_out store the result descriptor here - * @param unicode_letter a UNICODE letter code - * @param unicode_letter_next the unicode letter succeeding the letter under test - * @return true: descriptor is successfully loaded into `dsc_out`. - * false: the letter was not found, no data is loaded to `dsc_out` - */ -bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, - uint32_t unicode_letter_next); - -/********************** - * MACROS - **********************/ - -/********************** - * ADD BUILT IN FONTS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_FONT_FMT_TXT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/font/fmt_txt/lv_font_fmt_txt_private.h b/src/font/fmt_txt/lv_font_fmt_txt_private.h index 66df402d6b..e2d51474b4 100644 --- a/src/font/fmt_txt/lv_font_fmt_txt_private.h +++ b/src/font/fmt_txt/lv_font_fmt_txt_private.h @@ -14,7 +14,9 @@ extern "C" { * INCLUDES *********************/ -#include "lv_font_fmt_txt.h" +#include "../../lv_public_api.h" + +#if LV_USE_FONT_COMPRESSED /********************* * DEFINES @@ -24,7 +26,6 @@ extern "C" { * TYPEDEFS **********************/ -#if LV_USE_FONT_COMPRESSED typedef enum { RLE_STATE_SINGLE = 0, RLE_STATE_REPEATED, @@ -39,7 +40,6 @@ typedef struct { uint8_t count; lv_font_fmt_rle_state_t state; } lv_font_fmt_rle_t; -#endif /********************** * GLOBAL PROTOTYPES @@ -49,6 +49,7 @@ typedef struct { * MACROS **********************/ +#endif #ifdef __cplusplus } /*extern "C"*/ #endif diff --git a/src/font/font_manager/lv_font_manager.c b/src/font/font_manager/lv_font_manager.c index c608a40ff6..9c91c9f45c 100755 --- a/src/font/font_manager/lv_font_manager.c +++ b/src/font/font_manager/lv_font_manager.c @@ -7,13 +7,11 @@ * INCLUDES *********************/ -#include "lv_font_manager.h" +#include "../../lv_public_api.h" #if LV_USE_FONT_MANAGER #include "lv_font_manager_recycle.h" -#include "../../misc/lv_ll.h" -#include "../../stdlib/lv_sprintf.h" /********************* * DEFINES diff --git a/src/font/font_manager/lv_font_manager.h b/src/font/font_manager/lv_font_manager.h old mode 100755 new mode 100644 index e4e1b7628d..7cae704625 --- a/src/font/font_manager/lv_font_manager.h +++ b/src/font/font_manager/lv_font_manager.h @@ -1,115 +1,2 @@ -/** - * @file lv_font_manager.h - * - */ -#ifndef LV_FONT_MANAGER_H -#define LV_FONT_MANAGER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../font/lv_font.h" - -#if LV_USE_FONT_MANAGER - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create main font manager. - * @param recycle_cache_size number of fonts that were recently deleted from the cache. - * @return pointer to main font manager. - */ -lv_font_manager_t * lv_font_manager_create(uint32_t recycle_cache_size); - -/** - * Delete main font manager. - * @param manager pointer to main font manager. - * @return return true if the deletion was successful. - */ -bool lv_font_manager_delete(lv_font_manager_t * manager); - -/** - * Add font resource. - * @param manager pointer to main font manager. - * @param name font name. - * @param src font source. Need to strictly correspond to the font class. - * @param class_p font class. eg. lv_freetype_font_class, lv_builtin_font_class. - * @return return true if the add was successful. - */ -bool lv_font_manager_add_src(lv_font_manager_t * manager, - const char * name, - const void * src, - const lv_font_class_t * class_p); - -/** - * Add font resource with static memory. - * @param manager pointer to main font manager. - * @param name font name. It cannot be a local variable. - * @param src font source. Need to strictly correspond to the font class. And it cannot be a local variable. - * @param class_p font class. E.g. lv_freetype_font_class, lv_builtin_font_class. - * @return return true if the add was successful. - */ -bool lv_font_manager_add_src_static(lv_font_manager_t * manager, - const char * name, - const void * src, - const lv_font_class_t * class_p); - -/** - * Remove font resource. - * @param manager pointer to main font manager. - * @param name font name. - * @return return true if the remove was successful. - */ -bool lv_font_manager_remove_src(lv_font_manager_t * manager, const char * name); - -/** - * Create font. - * @param manager pointer to main font manager. - * @param font_family font family name. Matches the font resource name, using commas to separate different names. E.g. "my_font_1,my_font_2". - * @param render_mode font render mode. see `lv_freetype_font_render_mode_t`. - * @param size font size in pixel. - * @param style font style. see `lv_freetype_font_style_t`. - * @param kerning kerning mode. see `lv_font_kerning_t`. - * @return point to the created font. - */ -lv_font_t * lv_font_manager_create_font(lv_font_manager_t * manager, - const char * font_family, - uint32_t render_mode, - uint32_t size, - uint32_t style, - lv_font_kerning_t kerning); - -/** - * Delete font. - * @param manager pointer to main font manager. - * @param font point to the font. - * @return return true if the deletion was successful. - */ -void lv_font_manager_delete_font(lv_font_manager_t * manager, lv_font_t * font); - -/********************** - * MACROS - **********************/ - -#endif /* LV_USE_FONT_MANAGER */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_FONT_MANAGER_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/font/font_manager/lv_font_manager_recycle.c b/src/font/font_manager/lv_font_manager_recycle.c index 9e56430e6e..fc42e6cd8e 100755 --- a/src/font/font_manager/lv_font_manager_recycle.c +++ b/src/font/font_manager/lv_font_manager_recycle.c @@ -11,9 +11,6 @@ #if LV_USE_FONT_MANAGER -#include "../../font/lv_font.h" -#include "../../misc/lv_ll.h" - /********************* * DEFINES *********************/ diff --git a/src/font/font_manager/lv_font_manager_recycle.h b/src/font/font_manager/lv_font_manager_recycle.h index 596e829c39..5faf01f294 100755 --- a/src/font/font_manager/lv_font_manager_recycle.h +++ b/src/font/font_manager/lv_font_manager_recycle.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../misc/lv_types.h" +#include "../../lv_public_api.h" #if LV_USE_FONT_MANAGER diff --git a/src/font/imgfont/lv_imgfont.h b/src/font/imgfont/lv_imgfont.h index 68c317a6da..848bcad541 100644 --- a/src/font/imgfont/lv_imgfont.h +++ b/src/font/imgfont/lv_imgfont.h @@ -1,63 +1,2 @@ -/** - * @file lv_imgfont.h - * - */ - -#ifndef LV_IMGFONT_H -#define LV_IMGFONT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../font/lv_font.h" - -#if LV_USE_IMGFONT - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/* gets the image path name of this character */ -typedef const void * (*lv_imgfont_get_path_cb_t)(const lv_font_t * font, - uint32_t unicode, uint32_t unicode_next, - int32_t * offset_y, void * user_data); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Creates a image font with info parameter specified. - * @param height font size - * @param path_cb a function to get the image path name of character. - * @param user_data pointer to user data - * @return pointer to the new imgfont or NULL if create error. - */ -lv_font_t * lv_imgfont_create(uint16_t height, lv_imgfont_get_path_cb_t path_cb, void * user_data); - -/** - * Destroy a image font that has been created. - * @param font pointer to image font handle. - */ -void lv_imgfont_destroy(lv_font_t * font); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_IMGFONT*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_IMGFONT_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/font/lv_font.c b/src/font/lv_font.c index eff21a2e6d..c05effc96b 100644 --- a/src/font/lv_font.c +++ b/src/font/lv_font.c @@ -7,13 +7,9 @@ * INCLUDES *********************/ -#include "lv_font.h" #include "lv_font_private.h" #include "../misc/lv_text_private.h" #include "../misc/lv_utils.h" -#include "../misc/lv_log.h" -#include "../misc/lv_assert.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/font/lv_font.h b/src/font/lv_font.h index 3322406c69..9d7a493539 100644 --- a/src/font/lv_font.h +++ b/src/font/lv_font.h @@ -1,397 +1,2 @@ -/** - * @file lv_font.h - * - */ - -#ifndef LV_FONT_H -#define LV_FONT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "../misc/lv_types.h" - -#include "lv_symbol_def.h" -#include "../draw/lv_draw_buf.h" -#include "../misc/lv_area.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/*------------------ - * General types - *-----------------*/ - -/** The font format.*/ -typedef enum { - LV_FONT_GLYPH_FORMAT_NONE = 0, /**< Maybe not visible*/ - - /**< Legacy simple formats*/ - LV_FONT_GLYPH_FORMAT_A1 = 0x01, /**< 1 bit per pixel*/ - LV_FONT_GLYPH_FORMAT_A2 = 0x02, /**< 2 bit per pixel*/ - LV_FONT_GLYPH_FORMAT_A3 = 0x03, /**< 3 bit per pixel*/ - LV_FONT_GLYPH_FORMAT_A4 = 0x04, /**< 4 bit per pixel*/ - LV_FONT_GLYPH_FORMAT_A8 = 0x08, /**< 8 bit per pixel*/ - - LV_FONT_GLYPH_FORMAT_IMAGE = 0x19, /**< Image format*/ - - /**< Advanced formats*/ - LV_FONT_GLYPH_FORMAT_VECTOR = 0x1A, /**< Vectorial format*/ - LV_FONT_GLYPH_FORMAT_SVG = 0x1B, /**< SVG format*/ - LV_FONT_GLYPH_FORMAT_CUSTOM = 0xFF, /**< Custom format*/ -} lv_font_glyph_format_t; - -/** Describes the properties of a glyph.*/ -typedef struct { - const lv_font_t * resolved_font; /**< Pointer to a font where the glyph was actually found after handling fallbacks*/ - lv_cache_entry_t * entry; /**< The cache entry of the glyph draw data. Used by the font cache*/ - union { - uint32_t index; /**< Glyph descriptor index*/ - const void * src; /**< Pointer to the source data used by image fonts*/ - } gid; /**< The index of the glyph in the font file. Used by the font cache*/ - lv_font_glyph_format_t format; /**< Font format of the glyph see lv_font_glyph_format_t */ - int32_t outline_stroke_width; /**< used with freetype vector fonts - width of the letter border */ - uint16_t adv_w; /**< The glyph needs this space. Draw the next glyph after this width.*/ - uint16_t box_w; /**< Width of the glyph's bounding box*/ - uint16_t box_h; /**< Height of the glyph's bounding box*/ - int16_t ofs_x; /**< x offset of the bounding box*/ - int16_t ofs_y; /**< y offset of the bounding box*/ - uint16_t stride;/**< Bytes in each line. If 0 than there is no padding at the end of the line. */ - uint8_t is_placeholder: 1; /**< Glyph is missing. But placeholder will still be displayed*/ - - /** 0: Get bitmap should return an A8 or ARGB8888 image. - * 1: return the bitmap as it is (Maybe A1/2/4 or any proprietary formats). */ - uint8_t req_raw_bitmap: 1; -} lv_font_glyph_dsc_t; - -/** The bitmaps might be upscaled by 3 to achieve subpixel rendering.*/ -typedef enum { - LV_FONT_SUBPX_NONE, - LV_FONT_SUBPX_HOR, - LV_FONT_SUBPX_VER, - LV_FONT_SUBPX_BOTH, -} lv_font_subpx_t; - -/** Adjust letter spacing for specific character pairs.*/ -typedef enum { - LV_FONT_KERNING_NORMAL, - LV_FONT_KERNING_NONE, -} lv_font_kerning_t; - -/** Describe the properties of a font*/ -struct _lv_font_t { - const void * dsc; /**< Store implementation specific or run_time data or caching here*/ - const lv_font_t * fallback; /**< Fallback font for missing glyph. Resolved recursively */ - void * user_data; /**< Custom user data for font.*/ - - /** Get a glyph's descriptor from a font. - * - * Fills `dsc_out` with metrics for the glyph corresponding to `letter` in `font`. - * `letter_next` is provided for kerning. The implementation may adjust `dsc_out->adv_w` - * based on the following character. Pass 0 if there is no next character. - * - * @param font the font to query - * @param dsc_out output descriptor to fill - * @param letter Unicode codepoint of the glyph to look up - * @param letter_next Unicode codepoint of the following glyph, or 0 if none - * @return true if the glyph was found, false otherwise - */ - bool (*get_glyph_dsc)(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, - uint32_t letter, uint32_t letter_next); - - /** Get glyph draw data from a font. - * - * Returns an opaque pointer to draw data for the glyph described by `g_dsc`. The - * concrete type and interpretation of the returned pointer depend on - * `g_dsc->format` (and related flags, e.g. whether a raw bitmap was requested). - * - * For legacy bitmap formats (e.g. A1/A2/A3/A4/A8), the implementation may either: - * - decode/decompress into the caller-provided `draw_buf` and return a pointer to - * that draw buffer (typically an `lv_draw_buf_t *`), or - * - return a pointer to font-internal bitmap storage. - * - * For non-bitmap formats (e.g. `LV_FONT_GLYPH_FORMAT_IMAGE`, vector/outline/SVG, - * or custom formats), the implementation typically ignores `draw_buf` and returns - * a format-specific object (such as an image source or `lv_vector_path_t *`). - * - * The caller must always treat the return value as the authoritative glyph draw - * data and interpret it according to `g_dsc->format`. Do not assume the data was - * written into `draw_buf` or that it is always an alpha bitmap. The returned - * pointer is only valid until `release_glyph` is called. - * - * @param g_dsc glyph descriptor previously filled by `get_glyph_dsc`. - * `g_dsc->entry` may be set by this call to track an internal - * cache entry that must later be released via `release_glyph`. - * @param draw_buf caller-provided scratch buffer offered to the implementation - * as a decode/render target for bitmap formats. May be ignored - * by the implementation. - * @return pointer to glyph draw data appropriate for `g_dsc->format`, - * or NULL on failure - */ - const void * (*get_glyph_bitmap)(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf); - - /** Release a glyph and any resources acquired during `get_glyph_dsc` or `get_glyph_bitmap`. - * - * Must be called after the glyph bitmap is no longer needed. Releases any internal - * cache entry stored in `g_dsc->entry` by the font implementation. - * Calling this with a `g_dsc` whose `entry` is NULL must be treated as a no-op. - * - * @param font the font that owns the glyph - * @param g_dsc glyph descriptor to release - */ - void (*release_glyph)(const lv_font_t * font, lv_font_glyph_dsc_t * g_dsc); - - /*Pointer to the font in a font pack (must have the same line height)*/ - int32_t line_height; /**< The real line height where any text fits*/ - int32_t base_line; /**< Base line measured from the bottom of the line_height*/ - int32_t cap_height; /**< Cap height of the font*/ - int32_t x_height; /**< x-height of the font*/ - - uint8_t subpx : 2; /**< An element of `lv_font_subpx_t`*/ - uint8_t kerning : 1; /**< An element of `lv_font_kerning_t`*/ - uint8_t static_bitmap : 1; /**< The font will be used as static bitmap */ - - int8_t underline_position; /**< Distance between the top of the underline and base line (< 0 means below the base line)*/ - int8_t underline_thickness; /**< Thickness of the underline*/ -}; - -struct _lv_font_class_t { - lv_font_t * (*create_cb)(const lv_font_info_t * info, const void * src); /**< Font creation callback function*/ - void (*delete_cb)(lv_font_t * font); /**< Font deletion callback function*/ - void * (*dup_src_cb)(const void * src); /**< Font source duplication callback function*/ - void (*free_src_cb)(void * src); /**< Font source free callback function*/ -}; - -struct _lv_font_info_t { - const char * name; /**< Font name, used to distinguish different font resources*/ - const lv_font_class_t * class_p; /**< Font backend implementation*/ - uint32_t size; /**< Font size in pixel*/ - uint32_t render_mode; /**< Font rendering mode, see `lv_freetype_font_render_mode_t`*/ - uint32_t style; /**< Font style, see `lv_freetype_font_style_t`*/ - lv_font_kerning_t kerning; /**< Font kerning, see `lv_font_kerning_t`*/ -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Return with the bitmap of a font. - * It always converts the normal fonts to A8 format in a draw_buf with - * LV_DRAW_BUF_ALIGN and LV_DRAW_BUF_STRIDE_ALIGN - * @note You must call lv_font_get_glyph_dsc() to get `g_dsc` (lv_font_glyph_dsc_t) - * before you can call this function. - * @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index - * and the format. - * @param draw_buf a draw buffer that can be used to store the bitmap of the glyph. - * @return pointer to the glyph's data. - * It can be a draw buffer for bitmap fonts or an image source for imgfonts. - */ -const void * lv_font_get_glyph_bitmap(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf); - - -/** - * Return the bitmap as it is. It works only if the font stores the bitmap in - * a non-volitile memory. - * @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index - * and the format. - * @return the bitmap as it is - */ -const void * lv_font_get_glyph_static_bitmap(lv_font_glyph_dsc_t * g_dsc); - -/** - * Get the descriptor of a glyph - * @param font pointer to font - * @param dsc_out store the result descriptor here - * @param letter a UNICODE letter code - * @param letter_next the next letter after `letter`. Used for kerning - * @return true: descriptor is successfully loaded into `dsc_out`. - * false: the letter was not found, no data is loaded to `dsc_out` - */ -bool lv_font_get_glyph_dsc(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t letter, - uint32_t letter_next); -/** - * Release the bitmap of a font. - * @note You must call lv_font_get_glyph_dsc() to get `g_dsc` (lv_font_glyph_dsc_t) before you can call this function. - * @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index and the format. - */ -void lv_font_glyph_release_draw_data(lv_font_glyph_dsc_t * g_dsc); - -/** - * Get the width of a glyph with kerning - * @param font pointer to a font - * @param letter a UNICODE letter - * @param letter_next the next letter after `letter`. Used for kerning - * @return the width of the glyph - */ -uint16_t lv_font_get_glyph_width(const lv_font_t * font, uint32_t letter, uint32_t letter_next); - -/** - * Get the line height of a font. All characters fit into this height - * @param font pointer to a font - * @return the height of a font - */ -int32_t lv_font_get_line_height(const lv_font_t * font); - -/** - * Configure the use of kerning information stored in a font - * @param font pointer to a font - * @param kerning `LV_FONT_KERNING_NORMAL` (default) or `LV_FONT_KERNING_NONE` - */ -void lv_font_set_kerning(lv_font_t * font, lv_font_kerning_t kerning); - -/** - * Get the default font, defined by LV_FONT_DEFAULT - * @return return pointer to the default font - */ -const lv_font_t * lv_font_get_default(void); - -/** - * Compare font information. - * @param ft_info_1 font information 1. - * @param ft_info_2 font information 2. - * @return return true if the fonts are equal. - */ -bool lv_font_info_is_equal(const lv_font_info_t * ft_info_1, const lv_font_info_t * ft_info_2); - -/** - * Checks if a font has a static rendering bitmap. - * @param font pointer to a font - * @return return true if the font has a bitmap generated for static rendering. - */ -bool lv_font_has_static_bitmap(const lv_font_t * font); - -/********************** - * MACROS - **********************/ - -#define LV_FONT_DECLARE(font_name) LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_t font_name; - -#if LV_FONT_MONTSERRAT_8 -LV_FONT_DECLARE(lv_font_montserrat_8) -#endif - -#if LV_FONT_MONTSERRAT_10 -LV_FONT_DECLARE(lv_font_montserrat_10) -#endif - -#if LV_FONT_MONTSERRAT_12 -LV_FONT_DECLARE(lv_font_montserrat_12) -#endif - -#if LV_FONT_MONTSERRAT_14 -LV_FONT_DECLARE(lv_font_montserrat_14) -#endif - -#if LV_FONT_MONTSERRAT_16 -LV_FONT_DECLARE(lv_font_montserrat_16) -#endif - -#if LV_FONT_MONTSERRAT_18 -LV_FONT_DECLARE(lv_font_montserrat_18) -#endif - -#if LV_FONT_MONTSERRAT_20 -LV_FONT_DECLARE(lv_font_montserrat_20) -#endif - -#if LV_FONT_MONTSERRAT_22 -LV_FONT_DECLARE(lv_font_montserrat_22) -#endif - -#if LV_FONT_MONTSERRAT_24 -LV_FONT_DECLARE(lv_font_montserrat_24) -#endif - -#if LV_FONT_MONTSERRAT_26 -LV_FONT_DECLARE(lv_font_montserrat_26) -#endif - -#if LV_FONT_MONTSERRAT_28 -LV_FONT_DECLARE(lv_font_montserrat_28) -#endif - -#if LV_FONT_MONTSERRAT_30 -LV_FONT_DECLARE(lv_font_montserrat_30) -#endif - -#if LV_FONT_MONTSERRAT_32 -LV_FONT_DECLARE(lv_font_montserrat_32) -#endif - -#if LV_FONT_MONTSERRAT_34 -LV_FONT_DECLARE(lv_font_montserrat_34) -#endif - -#if LV_FONT_MONTSERRAT_36 -LV_FONT_DECLARE(lv_font_montserrat_36) -#endif - -#if LV_FONT_MONTSERRAT_38 -LV_FONT_DECLARE(lv_font_montserrat_38) -#endif - -#if LV_FONT_MONTSERRAT_40 -LV_FONT_DECLARE(lv_font_montserrat_40) -#endif - -#if LV_FONT_MONTSERRAT_42 -LV_FONT_DECLARE(lv_font_montserrat_42) -#endif - -#if LV_FONT_MONTSERRAT_44 -LV_FONT_DECLARE(lv_font_montserrat_44) -#endif - -#if LV_FONT_MONTSERRAT_46 -LV_FONT_DECLARE(lv_font_montserrat_46) -#endif - -#if LV_FONT_MONTSERRAT_48 -LV_FONT_DECLARE(lv_font_montserrat_48) -#endif - -#if LV_FONT_MONTSERRAT_28_COMPRESSED -LV_FONT_DECLARE(lv_font_montserrat_28_compressed) -#endif - -#if LV_FONT_DEJAVU_16_PERSIAN_HEBREW -LV_FONT_DECLARE(lv_font_dejavu_16_persian_hebrew) -#endif - -#if LV_FONT_SOURCE_HAN_SANS_SC_14_CJK -LV_FONT_DECLARE(lv_font_source_han_sans_sc_14_cjk) -#endif - -#if LV_FONT_SOURCE_HAN_SANS_SC_16_CJK -LV_FONT_DECLARE(lv_font_source_han_sans_sc_16_cjk) -#endif - -#if LV_FONT_UNSCII_8 -LV_FONT_DECLARE(lv_font_unscii_8) -#endif - -#if LV_FONT_UNSCII_16 -LV_FONT_DECLARE(lv_font_unscii_16) -#endif - -/*Declare the custom (user defined) fonts*/ -#ifdef LV_FONT_CUSTOM_DECLARE -LV_FONT_CUSTOM_DECLARE -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_FONT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/font/lv_font_private.h b/src/font/lv_font_private.h index 9e28eaeb15..87048b19d5 100644 --- a/src/font/lv_font_private.h +++ b/src/font/lv_font_private.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "lv_font.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/font/lv_symbol_def.h b/src/font/lv_symbol_def.h index a3114d1bab..76d6af5235 100644 --- a/src/font/lv_symbol_def.h +++ b/src/font/lv_symbol_def.h @@ -1,357 +1,2 @@ -/** - * @file lv_symbol_def.h - * - */ - -#ifndef LV_SYMBOL_DEF_H -#define LV_SYMBOL_DEF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "../lv_conf_internal.h" - -/*------------------------------- - * Symbols from "normal" font - *-----------------------------*/ -#if !defined LV_SYMBOL_BULLET -#define LV_SYMBOL_BULLET "\xE2\x80\xA2" /*20042, 0x2022*/ -#endif - -/*------------------------------- - * Symbols from FontAwesome font - *-----------------------------*/ - -/*In the font converter use this list as range: - 61441, 61448, 61451, 61452, 61453, 61457, 61459, 61461, 61465, 61468, - 61473, 61478, 61479, 61480, 61502, 61507, 61512, 61515, 61516, 61517, - 61521, 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556, - 61559, 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61641, - 61664, 61671, 61674, 61683, 61724, 61732, 61787, 61931, 62016, 62017, - 62018, 62019, 62020, 62087, 62099, 62189, 62212, 62810, 63426, 63650 -*/ - -/* These symbols can be predefined in the lv_conf.h file. - * If they are not predefined, they will use the following values - */ - -#if !defined LV_SYMBOL_AUDIO -#define LV_SYMBOL_AUDIO "\xEF\x80\x81" /*61441, 0xF001*/ -#endif - -#if !defined LV_SYMBOL_VIDEO -#define LV_SYMBOL_VIDEO "\xEF\x80\x88" /*61448, 0xF008*/ -#endif - -#if !defined LV_SYMBOL_LIST -#define LV_SYMBOL_LIST "\xEF\x80\x8B" /*61451, 0xF00B*/ -#endif - -#if !defined LV_SYMBOL_OK -#define LV_SYMBOL_OK "\xEF\x80\x8C" /*61452, 0xF00C*/ -#endif - -#if !defined LV_SYMBOL_CLOSE -#define LV_SYMBOL_CLOSE "\xEF\x80\x8D" /*61453, 0xF00D*/ -#endif - -#if !defined LV_SYMBOL_POWER -#define LV_SYMBOL_POWER "\xEF\x80\x91" /*61457, 0xF011*/ -#endif - -#if !defined LV_SYMBOL_SETTINGS -#define LV_SYMBOL_SETTINGS "\xEF\x80\x93" /*61459, 0xF013*/ -#endif - -#if !defined LV_SYMBOL_HOME -#define LV_SYMBOL_HOME "\xEF\x80\x95" /*61461, 0xF015*/ -#endif - -#if !defined LV_SYMBOL_DOWNLOAD -#define LV_SYMBOL_DOWNLOAD "\xEF\x80\x99" /*61465, 0xF019*/ -#endif - -#if !defined LV_SYMBOL_DRIVE -#define LV_SYMBOL_DRIVE "\xEF\x80\x9C" /*61468, 0xF01C*/ -#endif - -#if !defined LV_SYMBOL_REFRESH -#define LV_SYMBOL_REFRESH "\xEF\x80\xA1" /*61473, 0xF021*/ -#endif - -#if !defined LV_SYMBOL_MUTE -#define LV_SYMBOL_MUTE "\xEF\x80\xA6" /*61478, 0xF026*/ -#endif - -#if !defined LV_SYMBOL_VOLUME_MID -#define LV_SYMBOL_VOLUME_MID "\xEF\x80\xA7" /*61479, 0xF027*/ -#endif - -#if !defined LV_SYMBOL_VOLUME_MAX -#define LV_SYMBOL_VOLUME_MAX "\xEF\x80\xA8" /*61480, 0xF028*/ -#endif - -#if !defined LV_SYMBOL_IMAGE -#define LV_SYMBOL_IMAGE "\xEF\x80\xBE" /*61502, 0xF03E*/ -#endif - -#if !defined LV_SYMBOL_TINT -#define LV_SYMBOL_TINT "\xEF\x81\x83" /*61507, 0xF043*/ -#endif - -#if !defined LV_SYMBOL_PREV -#define LV_SYMBOL_PREV "\xEF\x81\x88" /*61512, 0xF048*/ -#endif - -#if !defined LV_SYMBOL_PLAY -#define LV_SYMBOL_PLAY "\xEF\x81\x8B" /*61515, 0xF04B*/ -#endif - -#if !defined LV_SYMBOL_PAUSE -#define LV_SYMBOL_PAUSE "\xEF\x81\x8C" /*61516, 0xF04C*/ -#endif - -#if !defined LV_SYMBOL_STOP -#define LV_SYMBOL_STOP "\xEF\x81\x8D" /*61517, 0xF04D*/ -#endif - -#if !defined LV_SYMBOL_NEXT -#define LV_SYMBOL_NEXT "\xEF\x81\x91" /*61521, 0xF051*/ -#endif - -#if !defined LV_SYMBOL_EJECT -#define LV_SYMBOL_EJECT "\xEF\x81\x92" /*61522, 0xF052*/ -#endif - -#if !defined LV_SYMBOL_LEFT -#define LV_SYMBOL_LEFT "\xEF\x81\x93" /*61523, 0xF053*/ -#endif - -#if !defined LV_SYMBOL_RIGHT -#define LV_SYMBOL_RIGHT "\xEF\x81\x94" /*61524, 0xF054*/ -#endif - -#if !defined LV_SYMBOL_PLUS -#define LV_SYMBOL_PLUS "\xEF\x81\xA7" /*61543, 0xF067*/ -#endif - -#if !defined LV_SYMBOL_MINUS -#define LV_SYMBOL_MINUS "\xEF\x81\xA8" /*61544, 0xF068*/ -#endif - -#if !defined LV_SYMBOL_EYE_OPEN -#define LV_SYMBOL_EYE_OPEN "\xEF\x81\xAE" /*61550, 0xF06E*/ -#endif - -#if !defined LV_SYMBOL_EYE_CLOSE -#define LV_SYMBOL_EYE_CLOSE "\xEF\x81\xB0" /*61552, 0xF070*/ -#endif - -#if !defined LV_SYMBOL_WARNING -#define LV_SYMBOL_WARNING "\xEF\x81\xB1" /*61553, 0xF071*/ -#endif - -#if !defined LV_SYMBOL_SHUFFLE -#define LV_SYMBOL_SHUFFLE "\xEF\x81\xB4" /*61556, 0xF074*/ -#endif - -#if !defined LV_SYMBOL_UP -#define LV_SYMBOL_UP "\xEF\x81\xB7" /*61559, 0xF077*/ -#endif - -#if !defined LV_SYMBOL_DOWN -#define LV_SYMBOL_DOWN "\xEF\x81\xB8" /*61560, 0xF078*/ -#endif - -#if !defined LV_SYMBOL_LOOP -#define LV_SYMBOL_LOOP "\xEF\x81\xB9" /*61561, 0xF079*/ -#endif - -#if !defined LV_SYMBOL_DIRECTORY -#define LV_SYMBOL_DIRECTORY "\xEF\x81\xBB" /*61563, 0xF07B*/ -#endif - -#if !defined LV_SYMBOL_UPLOAD -#define LV_SYMBOL_UPLOAD "\xEF\x82\x93" /*61587, 0xF093*/ -#endif - -#if !defined LV_SYMBOL_CALL -#define LV_SYMBOL_CALL "\xEF\x82\x95" /*61589, 0xF095*/ -#endif - -#if !defined LV_SYMBOL_CUT -#define LV_SYMBOL_CUT "\xEF\x83\x84" /*61636, 0xF0C4*/ -#endif - -#if !defined LV_SYMBOL_COPY -#define LV_SYMBOL_COPY "\xEF\x83\x85" /*61637, 0xF0C5*/ -#endif - -#if !defined LV_SYMBOL_SAVE -#define LV_SYMBOL_SAVE "\xEF\x83\x87" /*61639, 0xF0C7*/ -#endif - -#if !defined LV_SYMBOL_BARS -#define LV_SYMBOL_BARS "\xEF\x83\x89" /*61641, 0xF0C9*/ -#endif - -#if !defined LV_SYMBOL_ENVELOPE -#define LV_SYMBOL_ENVELOPE "\xEF\x83\xA0" /*61664, 0xF0E0*/ -#endif - -#if !defined LV_SYMBOL_CHARGE -#define LV_SYMBOL_CHARGE "\xEF\x83\xA7" /*61671, 0xF0E7*/ -#endif - -#if !defined LV_SYMBOL_PASTE -#define LV_SYMBOL_PASTE "\xEF\x83\xAA" /*61674, 0xF0EA*/ -#endif - -#if !defined LV_SYMBOL_BELL -#define LV_SYMBOL_BELL "\xEF\x83\xB3" /*61683, 0xF0F3*/ -#endif - -#if !defined LV_SYMBOL_KEYBOARD -#define LV_SYMBOL_KEYBOARD "\xEF\x84\x9C" /*61724, 0xF11C*/ -#endif - -#if !defined LV_SYMBOL_GPS -#define LV_SYMBOL_GPS "\xEF\x84\xA4" /*61732, 0xF124*/ -#endif - -#if !defined LV_SYMBOL_FILE -#define LV_SYMBOL_FILE "\xEF\x85\x9B" /*61787, 0xF158*/ -#endif - -#if !defined LV_SYMBOL_WIFI -#define LV_SYMBOL_WIFI "\xEF\x87\xAB" /*61931, 0xF1EB*/ -#endif - -#if !defined LV_SYMBOL_BATTERY_FULL -#define LV_SYMBOL_BATTERY_FULL "\xEF\x89\x80" /*62016, 0xF240*/ -#endif - -#if !defined LV_SYMBOL_BATTERY_3 -#define LV_SYMBOL_BATTERY_3 "\xEF\x89\x81" /*62017, 0xF241*/ -#endif - -#if !defined LV_SYMBOL_BATTERY_2 -#define LV_SYMBOL_BATTERY_2 "\xEF\x89\x82" /*62018, 0xF242*/ -#endif - -#if !defined LV_SYMBOL_BATTERY_1 -#define LV_SYMBOL_BATTERY_1 "\xEF\x89\x83" /*62019, 0xF243*/ -#endif - -#if !defined LV_SYMBOL_BATTERY_EMPTY -#define LV_SYMBOL_BATTERY_EMPTY "\xEF\x89\x84" /*62020, 0xF244*/ -#endif - -#if !defined LV_SYMBOL_USB -#define LV_SYMBOL_USB "\xEF\x8a\x87" /*62087, 0xF287*/ -#endif - -#if !defined LV_SYMBOL_BLUETOOTH -#define LV_SYMBOL_BLUETOOTH "\xEF\x8a\x93" /*62099, 0xF293*/ -#endif - -#if !defined LV_SYMBOL_TRASH -#define LV_SYMBOL_TRASH "\xEF\x8B\xAD" /*62189, 0xF2ED*/ -#endif - -#if !defined LV_SYMBOL_EDIT -#define LV_SYMBOL_EDIT "\xEF\x8C\x84" /*62212, 0xF304*/ -#endif - -#if !defined LV_SYMBOL_BACKSPACE -#define LV_SYMBOL_BACKSPACE "\xEF\x95\x9A" /*62810, 0xF55A*/ -#endif - -#if !defined LV_SYMBOL_SD_CARD -#define LV_SYMBOL_SD_CARD "\xEF\x9F\x82" /*63426, 0xF7C2*/ -#endif - -#if !defined LV_SYMBOL_NEW_LINE -#define LV_SYMBOL_NEW_LINE "\xEF\xA2\xA2" /*63650, 0xF8A2*/ -#endif - -#if !defined LV_SYMBOL_DUMMY -/** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will show it as a label*/ -#define LV_SYMBOL_DUMMY "\xEF\xA3\xBF" -#endif - -/* - * The following list is generated using - * cat src/font/lv_symbol_def.h | sed -E -n 's/^#define\s+LV_(SYMBOL_\w+).*".*$/ LV_STR_\1,/p' - */ -enum _lv_str_symbol_id_t { - LV_STR_SYMBOL_BULLET, - LV_STR_SYMBOL_AUDIO, - LV_STR_SYMBOL_VIDEO, - LV_STR_SYMBOL_LIST, - LV_STR_SYMBOL_OK, - LV_STR_SYMBOL_CLOSE, - LV_STR_SYMBOL_POWER, - LV_STR_SYMBOL_SETTINGS, - LV_STR_SYMBOL_HOME, - LV_STR_SYMBOL_DOWNLOAD, - LV_STR_SYMBOL_DRIVE, - LV_STR_SYMBOL_REFRESH, - LV_STR_SYMBOL_MUTE, - LV_STR_SYMBOL_VOLUME_MID, - LV_STR_SYMBOL_VOLUME_MAX, - LV_STR_SYMBOL_IMAGE, - LV_STR_SYMBOL_TINT, - LV_STR_SYMBOL_PREV, - LV_STR_SYMBOL_PLAY, - LV_STR_SYMBOL_PAUSE, - LV_STR_SYMBOL_STOP, - LV_STR_SYMBOL_NEXT, - LV_STR_SYMBOL_EJECT, - LV_STR_SYMBOL_LEFT, - LV_STR_SYMBOL_RIGHT, - LV_STR_SYMBOL_PLUS, - LV_STR_SYMBOL_MINUS, - LV_STR_SYMBOL_EYE_OPEN, - LV_STR_SYMBOL_EYE_CLOSE, - LV_STR_SYMBOL_WARNING, - LV_STR_SYMBOL_SHUFFLE, - LV_STR_SYMBOL_UP, - LV_STR_SYMBOL_DOWN, - LV_STR_SYMBOL_LOOP, - LV_STR_SYMBOL_DIRECTORY, - LV_STR_SYMBOL_UPLOAD, - LV_STR_SYMBOL_CALL, - LV_STR_SYMBOL_CUT, - LV_STR_SYMBOL_COPY, - LV_STR_SYMBOL_SAVE, - LV_STR_SYMBOL_BARS, - LV_STR_SYMBOL_ENVELOPE, - LV_STR_SYMBOL_CHARGE, - LV_STR_SYMBOL_PASTE, - LV_STR_SYMBOL_BELL, - LV_STR_SYMBOL_KEYBOARD, - LV_STR_SYMBOL_GPS, - LV_STR_SYMBOL_FILE, - LV_STR_SYMBOL_WIFI, - LV_STR_SYMBOL_BATTERY_FULL, - LV_STR_SYMBOL_BATTERY_3, - LV_STR_SYMBOL_BATTERY_2, - LV_STR_SYMBOL_BATTERY_1, - LV_STR_SYMBOL_BATTERY_EMPTY, - LV_STR_SYMBOL_USB, - LV_STR_SYMBOL_BLUETOOTH, - LV_STR_SYMBOL_TRASH, - LV_STR_SYMBOL_EDIT, - LV_STR_SYMBOL_BACKSPACE, - LV_STR_SYMBOL_SD_CARD, - LV_STR_SYMBOL_NEW_LINE, - LV_STR_SYMBOL_DUMMY, -}; - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_SYMBOL_DEF_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/indev/lv_gridnav.c b/src/indev/lv_gridnav.c index ddc5136d6d..731c2ff71b 100644 --- a/src/indev/lv_gridnav.c +++ b/src/indev/lv_gridnav.c @@ -6,12 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_gridnav.h" +#include "../lv_public_api.h" #if LV_USE_GRIDNAV -#include "../misc/lv_assert.h" -#include "../misc/lv_math.h" -#include "../indev/lv_indev.h" #include "../core/lv_obj_private.h" /********************* diff --git a/src/indev/lv_gridnav.h b/src/indev/lv_gridnav.h index 59fb80d166..19f9d18b4d 100644 --- a/src/indev/lv_gridnav.h +++ b/src/indev/lv_gridnav.h @@ -1,95 +1,2 @@ -/** - * @file lv_gridnav.h - * - */ - -#ifndef LV_GRIDNAV_H -#define LV_GRIDNAV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../core/lv_obj.h" - -#if LV_USE_GRIDNAV - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_GRIDNAV_CTRL_NONE = 0x0, - - /** - * If there is no next/previous object in a direction, - * the focus goes to the object in the next/previous row (on left/right keys) - * or first/last row (on up/down keys) - */ - LV_GRIDNAV_CTRL_ROLLOVER = 0x1, - - /** - * If an arrow is pressed and the focused object can be scrolled in that direction - * then it will be scrolled instead of going to the next/previous object. - * If there is no more room for scrolling the next/previous object will be focused normally */ - LV_GRIDNAV_CTRL_SCROLL_FIRST = 0x2, - - /** - * Only use left/right keys for grid navigation. Up/down key events will be sent to the - * focused object. - */ - LV_GRIDNAV_CTRL_HORIZONTAL_MOVE_ONLY = 0x4, - - /** - * Only use up/down keys for grid navigation. Left/right key events will be sent to the - * focused object. - */ - LV_GRIDNAV_CTRL_VERTICAL_MOVE_ONLY = 0x8 - -} lv_gridnav_ctrl_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Add grid navigation feature to an object. It expects the children to be arranged - * into a grid-like layout. Although it's not required to have pixel perfect alignment. - * This feature makes possible to use keys to navigate among the children and focus them. - * The keys other than arrows and press/release related events - * are forwarded to the focused child. - * @param obj pointer to an object on which navigation should be applied. - * @param ctrl control flags from `lv_gridnav_ctrl_t`. - */ -void lv_gridnav_add(lv_obj_t * obj, lv_gridnav_ctrl_t ctrl); - -/** - * Remove the grid navigation support from an object - * @param obj pointer to an object - */ -void lv_gridnav_remove(lv_obj_t * obj); - -/** - * Manually focus an object on gridnav container - * @param cont pointer to a gridnav container - * @param to_focus pointer to an object to focus - * @param anim_en LV_ANIM_ON/OFF - */ -void lv_gridnav_set_focused(lv_obj_t * cont, lv_obj_t * to_focus, lv_anim_enable_t anim_en); - -/********************** - * MACROS - **********************/ -#endif /*LV_USE_GRIDNAV*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_GRIDNAV_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/indev/lv_indev.c b/src/indev/lv_indev.c index 9fb86fad73..3a566ca61c 100644 --- a/src/indev/lv_indev.c +++ b/src/indev/lv_indev.c @@ -1,8 +1,3 @@ -#include "lv_indev_private.h" -#include "../misc/lv_event_private.h" -#include "../misc/lv_area_private.h" -#include "../misc/lv_anim_private.h" -#include "../core/lv_obj_draw_private.h" /** * @file lv_indev.c * @@ -11,19 +6,18 @@ /********************* * INCLUDES ********************/ + +#include "lv_indev_private.h" +#include "../misc/lv_event_private.h" +#include "../misc/lv_area_private.h" +#include "../misc/lv_anim_private.h" +#include "../core/lv_obj_draw_private.h" #include "lv_indev_scroll.h" -#include "lv_indev_gesture.h" #include "../display/lv_display_private.h" #include "../core/lv_global.h" #include "../core/lv_obj_private.h" -#include "../core/lv_group.h" -#include "../core/lv_refr.h" -#include "../tick/lv_tick.h" #include "../misc/lv_timer_private.h" -#include "../misc/lv_math.h" -#include "../misc/lv_profiler.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/indev/lv_indev.h b/src/indev/lv_indev.h index 5f86d75a64..23e5143abf 100644 --- a/src/indev/lv_indev.h +++ b/src/indev/lv_indev.h @@ -1,502 +1,2 @@ -/** - * @file lv_indev.h - * - */ - -#ifndef LV_INDEV_H -#define LV_INDEV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../core/lv_group.h" -#include "../misc/lv_area.h" -#include "../misc/lv_timer.h" -#include "../misc/lv_event.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** Possible input device types*/ -typedef enum { - LV_INDEV_TYPE_NONE, /**< Uninitialized state*/ - LV_INDEV_TYPE_POINTER, /**< Touch pad, mouse, external button*/ - LV_INDEV_TYPE_KEYPAD, /**< Keypad or keyboard*/ - LV_INDEV_TYPE_BUTTON, /**< External (hardware button) which is assigned to a specific point of the screen*/ - LV_INDEV_TYPE_ENCODER, /**< Encoder with only Left, Right turn and a Button*/ -} lv_indev_type_t; - -/** States for input devices*/ -typedef enum { - LV_INDEV_STATE_RELEASED = 0, - LV_INDEV_STATE_PRESSED -} lv_indev_state_t; - -typedef enum { - LV_INDEV_MODE_NONE = 0, - LV_INDEV_MODE_TIMER, - LV_INDEV_MODE_EVENT, -} lv_indev_mode_t; - - -/* Supported types of gestures */ -typedef enum { - LV_INDEV_GESTURE_NONE = 0, - LV_INDEV_GESTURE_PINCH, - LV_INDEV_GESTURE_SWIPE, - LV_INDEV_GESTURE_ROTATE, - LV_INDEV_GESTURE_TWO_FINGERS_SWIPE, - LV_INDEV_GESTURE_SCROLL, /* Used with scrollwheels */ - LV_INDEV_GESTURE_CNT, /* Total number of gestures types */ -} lv_indev_gesture_type_t; - -/** Data structure passed to an input driver to fill*/ -typedef struct { - lv_indev_gesture_type_t gesture_type[LV_INDEV_GESTURE_CNT]; /* Current gesture types, per gesture */ - void * gesture_data[LV_INDEV_GESTURE_CNT]; /* Used to store data per gesture */ - - lv_indev_state_t state; /**< LV_INDEV_STATE_RELEASED or LV_INDEV_STATE_PRESSED*/ - - lv_point_t point; /**< For LV_INDEV_TYPE_POINTER the currently pressed point*/ - uint32_t key; /**< For LV_INDEV_TYPE_KEYPAD the currently pressed key*/ - uint32_t btn_id; /**< For LV_INDEV_TYPE_BUTTON the currently pressed button*/ - int16_t enc_diff; /**< For LV_INDEV_TYPE_ENCODER number of steps since the previous read*/ - - uint32_t timestamp; /**< Initialized to lv_tick_get(). Driver may provide more accurate timestamp for buffered events*/ - bool continue_reading; /**< If set to true, the read callback is invoked again, unless the device is in event-driven mode*/ -} lv_indev_data_t; - -typedef void (*lv_indev_read_cb_t)(lv_indev_t * indev, lv_indev_data_t * data); - -/** Indev key remapping callback */ -typedef lv_key_t (*lv_indev_key_remap_cb_t)(lv_indev_t * indev, lv_key_t key); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an indev - * @return Pointer to the created indev or NULL when allocation failed - */ -lv_indev_t * lv_indev_create(void); - -/** - * Remove the provided input device. Make sure not to use the provided input device afterwards anymore. - * @param indev pointer to delete - */ -void lv_indev_delete(lv_indev_t * indev); - -/** - * Get the next input device. - * @param indev pointer to the current input device. NULL to initialize. - * @return the next input device or NULL if there are no more. Provide the first input device when - * the parameter is NULL - */ -lv_indev_t * lv_indev_get_next(lv_indev_t * indev); - -/** - * Read data from an input device. - * @param indev pointer to an input device - */ -void lv_indev_read(lv_indev_t * indev); - -/** - * Called periodically to read the input devices - * @param timer pointer to a timer to read - */ -void lv_indev_read_timer_cb(lv_timer_t * timer); - -/** - * Enable or disable one or all input devices (default enabled) - * @param indev pointer to an input device or NULL to enable/disable all of them - * @param enable true to enable, false to disable - */ -void lv_indev_enable(lv_indev_t * indev, bool enable); - -/** - * Get the currently processed input device. Can be used in action functions too. - * @return pointer to the currently processed input device or NULL if no input device processing - * right now - */ -lv_indev_t * lv_indev_active(void); - -/** - * Set the type of an input device - * @param indev pointer to an input device - * @param indev_type the type of the input device from `lv_indev_type_t` (`LV_INDEV_TYPE_...`) - */ -void lv_indev_set_type(lv_indev_t * indev, lv_indev_type_t indev_type); - -/** - * Set a callback function to read input device data to the indev - * @param indev pointer to an input device - * @param read_cb pointer to callback function to read input device data - */ -void lv_indev_set_read_cb(lv_indev_t * indev, lv_indev_read_cb_t read_cb); - -/** - * Set user data to the indev - * @param indev pointer to an input device - * @param user_data pointer to user data - */ -void lv_indev_set_user_data(lv_indev_t * indev, void * user_data); - -/** - * Set driver data to the indev - * @param indev pointer to an input device - * @param driver_data pointer to driver data - */ -void lv_indev_set_driver_data(lv_indev_t * indev, void * driver_data); - -/** - * Assign a display to the indev - * @param indev pointer to an input device - * @param disp pointer to an display - */ -void lv_indev_set_display(lv_indev_t * indev, struct _lv_display_t * disp); - -/** - * Set long press time to indev - * @param indev pointer to input device - * @param long_press_time time long press time in ms - */ -void lv_indev_set_long_press_time(lv_indev_t * indev, uint16_t long_press_time); - -/** - * Set long press repeat time to indev - * @param indev pointer to input device - * @param long_press_repeat_time long press repeat time in ms - */ -void lv_indev_set_long_press_repeat_time(lv_indev_t * indev, uint16_t long_press_repeat_time); - -/** - * Set scroll limit to the input device - * @param indev pointer to an input device - * @param scroll_limit the number of pixels to slide before actually drag the object - */ -void lv_indev_set_scroll_limit(lv_indev_t * indev, uint8_t scroll_limit); - -/** - * Set scroll throw slow-down to the indev. Greater value means faster slow-down - * @param indev pointer to an input device - * @param scroll_throw the slow-down in [%] - */ -void lv_indev_set_scroll_throw(lv_indev_t * indev, uint8_t scroll_throw); - -/** - * Set the minimum velocity threshold for gesture detection. - * The difference between consecutive points must exceed this value (in pixels) - * for the movement to be considered fast enough to trigger a gesture. - * - * @param indev pointer to an input device - * @param min_velocity minimum velocity threshold in pixels (default: 3) - */ -void lv_indev_set_gesture_min_velocity(lv_indev_t * indev, uint8_t min_velocity); - -/** - * Set the minimum distance threshold for gesture detection. - * The total distance from the first point to the current point must exceed - * this value (in pixels) for the movement to be considered large enough - * to trigger a gesture. - * - * @param indev pointer to an input device - * @param min_distance minimum distance threshold in pixels (default: 50) - */ -void lv_indev_set_gesture_min_distance(lv_indev_t * indev, uint8_t min_distance); - -/** - * Get the type of an input device - * @param indev pointer to an input device - * @return the type of the input device from `lv_hal_indev_type_t` (`LV_INDEV_TYPE_...`) - */ -lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev); - -/** - * Get the callback function to read input device data to the indev - * @param indev pointer to an input device - * @return Pointer to callback function to read input device data or NULL if indev is NULL - */ -lv_indev_read_cb_t lv_indev_get_read_cb(lv_indev_t * indev); - -/** - * Get the indev state - * @param indev pointer to an input device - * @return Indev state or LV_INDEV_STATE_RELEASED if indev is NULL - */ -lv_indev_state_t lv_indev_get_state(const lv_indev_t * indev); - -/** - * Get the indev assigned group - * @param indev pointer to an input device - * @return Pointer to indev assigned group or NULL if indev is NULL - */ -lv_group_t * lv_indev_get_group(const lv_indev_t * indev); - -/** - * Get a pointer to the assigned display of the indev - * @param indev pointer to an input device - * @return pointer to the assigned display or NULL if indev is NULL - */ -lv_display_t * lv_indev_get_display(const lv_indev_t * indev); - -/** - * Get a pointer to the user data of the indev - * @param indev pointer to an input device - * @return pointer to the user data or NULL if indev is NULL - */ -void * lv_indev_get_user_data(const lv_indev_t * indev); - -/** - * Get a pointer to the driver data of the indev - * @param indev pointer to an input device - * @return pointer to the driver data or NULL if indev is NULL - */ -void * lv_indev_get_driver_data(const lv_indev_t * indev); - -/** - * Get whether indev is moved while pressed - * @param indev pointer to an input device - * @return true: indev is moved while pressed; false: indev is not moved while pressed - */ -bool lv_indev_get_press_moved(const lv_indev_t * indev); - -/** - * Reset one or all input devices - * @param indev pointer to an input device to reset or NULL to reset all of them - * @param obj pointer to an object which triggers the reset. - */ -void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj); - -/** - * Touch and key related events are sent to the input device first and to the widget after that. - * If this functions called in an indev event, the event won't be sent to the widget. - * @param indev pointer to an input device - */ -void lv_indev_stop_processing(lv_indev_t * indev); - -/** - * Reset the long press state of an input device - * @param indev pointer to an input device - */ -void lv_indev_reset_long_press(lv_indev_t * indev); - -/** - * Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON) - * @param indev pointer to an input device - * @param cur_obj pointer to an object to be used as cursor - */ -void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj); - -/** - * Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD) - * @param indev pointer to an input device - * @param group pointer to a group - */ -void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group); - -/** - * Set the an array of points for LV_INDEV_TYPE_BUTTON. - * These points will be assigned to the buttons to press a specific point on the screen - * @param indev pointer to an input device - * @param points array of points - */ -void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t points[]); - -/** - * Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON) - * @param indev pointer to an input device - * @param point pointer to a point to store the result - */ -void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point); - -/** -* Get the current gesture direct -* @param indev pointer to an input device -* @return current gesture direct -*/ -lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev); - -/** - * Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD) - * @param indev pointer to an input device - * @return the last pressed key (0 on error) - */ -uint32_t lv_indev_get_key(const lv_indev_t * indev); - - -/** - * Get the counter for consecutive clicks within a short distance and time. - * The counter is updated before LV_EVENT_SHORT_CLICKED is fired. - * @param indev pointer to an input device - * @return short click streak counter - */ -uint8_t lv_indev_get_short_click_streak(const lv_indev_t * indev); - -/** - * Check the current scroll direction of an input device (for LV_INDEV_TYPE_POINTER and - * LV_INDEV_TYPE_BUTTON) - * @param indev pointer to an input device - * @return LV_DIR_NONE: no scrolling now - * LV_DIR_HOR/VER - */ -lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t * indev); - -/** - * Get the currently scrolled object (for LV_INDEV_TYPE_POINTER and - * LV_INDEV_TYPE_BUTTON) - * @param indev pointer to an input device - * @return pointer to the currently scrolled object or NULL if no scrolling by this indev - */ -lv_obj_t * lv_indev_get_scroll_obj(const lv_indev_t * indev); - -/** - * Get the movement vector of an input device (for LV_INDEV_TYPE_POINTER and - * LV_INDEV_TYPE_BUTTON) - * @param indev pointer to an input device - * @param point pointer to a point to store the types.pointer.vector - */ -void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point); - -/** - * Get the cursor object of an input device (for LV_INDEV_TYPE_POINTER only) - * @param indev pointer to an input device - * @return pointer to the cursor object - */ -lv_obj_t * lv_indev_get_cursor(lv_indev_t * indev); - -/** - * Do nothing until the next release - * @param indev pointer to an input device - */ -void lv_indev_wait_release(lv_indev_t * indev); - -/** - * Gets a pointer to the currently active object in the currently processed input device. - * @return pointer to currently active object or NULL if no active object - */ -lv_obj_t * lv_indev_get_active_obj(void); - -/** - * Get a pointer to the indev read timer to - * modify its parameters with `lv_timer_...` functions. - * @param indev pointer to an input device - * @return pointer to the indev read refresher timer. (NULL on error) - */ -lv_timer_t * lv_indev_get_read_timer(lv_indev_t * indev); - -/** -* Set the input device's event model: event-driven mode or timer mode. -* @param indev pointer to an input device -* @param mode the mode of input device -*/ -void lv_indev_set_mode(lv_indev_t * indev, lv_indev_mode_t mode); - -/** - * Get the input device's running mode. - * @param indev pointer to an input device - * @return the running mode for the specified input device. - */ -lv_indev_mode_t lv_indev_get_mode(lv_indev_t * indev); - -/** - * Search the most top, clickable object by a point - * @param obj pointer to a start object, typically the screen - * @param point pointer to a point for searching the most top child - * @return pointer to the found object or NULL if there was no suitable object - */ -lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point); - -/** - * Add an event handler to the indev - * @param indev pointer to an indev - * @param event_cb an event callback - * @param filter event code to react or `LV_EVENT_ALL` - * @param user_data optional user_data - * @return the event descriptor or NULL if the event couldn't be created - */ -lv_event_dsc_t * lv_indev_add_event_cb(lv_indev_t * indev, lv_event_cb_t event_cb, lv_event_code_t filter, - void * user_data); - -/** - * Get the number of event attached to an indev - * @param indev pointer to an indev - * @return number of events - */ -uint32_t lv_indev_get_event_count(lv_indev_t * indev); - -/** - * Get an event descriptor for an event - * @param indev pointer to an indev - * @param index the index of the event - * @return the event descriptor - */ -lv_event_dsc_t * lv_indev_get_event_dsc(lv_indev_t * indev, uint32_t index); - -/** - * Remove an event - * @param indev pointer to an indev - * @param index the index of the event to remove - * @return true: and event was removed; false: no event was removed - */ -bool lv_indev_remove_event(lv_indev_t * indev, uint32_t index); - -/** - * Remove an event_cb with user_data - * @param indev pointer to a indev - * @param event_cb the event_cb of the event to remove - * @param user_data user_data - * @return the count of the event removed - */ -uint32_t lv_indev_remove_event_cb_with_user_data(lv_indev_t * indev, lv_event_cb_t event_cb, void * user_data); - -/** - * Send an event to an indev - * @param indev pointer to an indev - * @param code an event code. LV_EVENT_... - * @param param optional param - * @return LV_RESULT_OK: indev wasn't deleted in the event. - */ -lv_result_t lv_indev_send_event(lv_indev_t * indev, lv_event_code_t code, void * param); - -/** - * Set key remapping callback (LV_INDEV_TYPE_KEYPAD) - * @param indev pointer to an indev - * @param remap_cb remapping function callback. Use NULL to disable callback. - */ -void lv_indev_set_key_remap_cb(lv_indev_t * indev, lv_indev_key_remap_cb_t remap_cb); - -#if LV_USE_EXT_DATA -/** - * @brief Attaches external user data and destructor callback to an indev - * - * Associates custom user data with an LVGL indev and specifies a destructor function - * that will be automatically invoked when the indev is deleted to properly clean up - * the associated resources. - * - * @param indev Pointer to an indev - * @param data User-defined data pointer to associate with the indev - * @param free_cb Callback function for cleaning up ext_data when indev is deleted. - * Receives ext_data as parameter. NULL means no cleanup required. - */ -void lv_indev_set_external_data(lv_indev_t * indev, void * data, void (* free_cb)(void * data)); -#endif - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_INDEV_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/indev/lv_indev_gesture.c b/src/indev/lv_indev_gesture.c index 3882b33a7b..c2ac35a394 100644 --- a/src/indev/lv_indev_gesture.c +++ b/src/indev/lv_indev_gesture.c @@ -1,26 +1,18 @@ -/****************************************************************** +/* * @file lv_indev_gesture.c - * - * Recognize gestures that consist of multiple touch events - * - * Copyright (c) 2024 EDGEMTech Ltd - * - * Author EDGEMTech Ltd. (erik.tagirov@edgemtech.ch) - * - ******************************************************************/ + */ /******************** * INCLUDES ********************/ -#include "lv_indev_private.h" -#include "../misc/lv_event_private.h" +#include "lv_indev_gesture_private.h" #if LV_USE_GESTURE_RECOGNITION #include -#include "lv_indev_gesture.h" -#include "lv_indev_gesture_private.h" +#include "lv_indev_private.h" +#include "../misc/lv_event_private.h" /******************** * DEFINES diff --git a/src/indev/lv_indev_gesture.h b/src/indev/lv_indev_gesture.h index 0129264ca6..10ad9136d3 100644 --- a/src/indev/lv_indev_gesture.h +++ b/src/indev/lv_indev_gesture.h @@ -1,249 +1,2 @@ -/******************************************************************* - * - * @file lv_indev_gesture.h - * - * Copyright (c) 2024 EDGEMTech Ltd. - * - * Author EDGEMTech Ltd, (erik.tagirov@edgemtech.ch) - * - ******************************************************************/ - -#ifndef LV_INDEV_GESTURE_H -#define LV_INDEV_GESTURE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../core/lv_obj.h" - -#if LV_USE_GESTURE_RECOGNITION - -#if LV_USE_FLOAT == 0 -#error "LV_USE_FLOAT is required for gesture detection." -#endif - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/* Opaque types defined in the private header */ -struct lv_indev_gesture; -struct lv_indev_gesture_configuration; - -typedef struct lv_indev_gesture_recognizer lv_indev_gesture_recognizer_t; -typedef struct lv_indev_touch_data lv_indev_touch_data_t; - -typedef struct lv_indev_gesture lv_indev_gesture_t; -typedef struct lv_indev_gesture_configuration lv_indev_gesture_configuration_t; - -typedef void (*lv_recognizer_func_t)(lv_indev_gesture_recognizer_t *, lv_indev_touch_data_t *, uint16_t); - -/* The states of a gesture recognizer */ -typedef enum { - LV_INDEV_GESTURE_STATE_NONE = 0, /* Beginning & end */ - LV_INDEV_GESTURE_STATE_ONGOING, /* Set when there is a probability */ - LV_INDEV_GESTURE_STATE_RECOGNIZED, /* Recognized, the event will contain touch info */ - LV_INDEV_GESTURE_STATE_ENDED, /* A recognized gesture has ended */ - LV_INDEV_GESTURE_STATE_CANCELED, /* Canceled - usually a finger is lifted */ -} lv_indev_gesture_state_t; - -/* Data structures for touch events - used to repsensent a libinput event */ -/* Emitted by devices capable of tracking identifiable contacts (type B) */ -struct lv_indev_touch_data { - lv_point_t point; /* Coordinates of the touch */ - lv_indev_state_t state; /* The state i.e PRESSED or RELEASED */ - uint8_t id; /* Identification/slot of the contact point */ - uint32_t timestamp; /* Timestamp in milliseconds */ -}; - -/* Gesture recognizer */ -struct lv_indev_gesture_recognizer { - lv_indev_gesture_type_t type; /* The detected gesture type */ - lv_indev_gesture_state_t state; /* The gesture state ongoing, recognized */ - lv_indev_gesture_t * info; /* Information on the motion of each touch point */ - float scale; /* Relevant for the pinch gesture */ - float rotation; /* Relevant for rotation */ - float distance; /* Relevant for swipes */ - float speed; - lv_dir_t two_fingers_swipe_dir; /* Relevant for swipes */ - - lv_indev_gesture_configuration_t * config; /* The recognizer config, containing the gestures - thresholds */ - lv_recognizer_func_t recog_fn; /* The recognizer function that this recognizer must execute */ -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize this indev's recognizers. It specifies their recognizer functions - * @param indev pointer to the indev containing the recognizers to initialize - */ -void lv_indev_gesture_init(lv_indev_t * indev); - -/* PINCH Gesture */ - -/** - * Pinch gesture recognizer function - * Will update the recognizer data - * @param recognizer pointer to a gesture recognizer - * @param touches pointer to the first element of the collected touch events - * @param touch_cnt length of passed touch event array. - */ -void lv_indev_gesture_detect_pinch(lv_indev_gesture_recognizer_t * recognizer, lv_indev_touch_data_t * touches, - uint16_t touch_cnt); - -/** - * Rotation gesture recognizer function - * Will update the recognizer data - * @param recognizer pointer to a gesture recognizer - * @param touches pointer to the first element of the collected touch events - * @param touch_cnt length of passed touch event array. - */ -void lv_indev_gesture_detect_rotation(lv_indev_gesture_recognizer_t * recognizer, lv_indev_touch_data_t * touches, - uint16_t touch_cnt); - -/** - * Two finger swipe gesture recognizer function - * Will update the recognizer data - * @param recognizer pointer to a gesture recognizer - * @param touches pointer to the first element of the collected touch events - * @param touch_cnt length of passed touch event array. - */ -void lv_indev_gesture_detect_two_fingers_swipe(lv_indev_gesture_recognizer_t * recognizer, - lv_indev_touch_data_t * touches, - uint16_t touch_cnt); - -/** - * Set the threshold for the pinch gesture scale up, when the scale factor of gesture - * reaches the threshold events get sent - * @param indev pointer to the indev device containing the pinch recognizer - * @param threshold threshold for a pinch up gesture to be recognized - */ -void lv_indev_set_pinch_up_threshold(lv_indev_t * indev, float threshold); - -/** - * Set the threshold for the pinch gesture scale down, when the scale factor of gesture - * reaches the threshold events get sent - * @param indev pointer to the indev device containing the pinch recognizer - * @param threshold threshold for a pinch down gesture to be recognized - */ -void lv_indev_set_pinch_down_threshold(lv_indev_t * indev, float threshold); - -/** - * Set the rotation threshold in radian for the rotation gesture - * @param indev pointer to the indev device containing the rotation recognizer - * @param threshold threshold in radian for a rotation gesture to be recognized - */ -void lv_indev_set_rotation_rad_threshold(lv_indev_t * indev, float threshold); - -/** - * Obtains the current scale of a pinch gesture - * @param gesture_event pointer to a gesture event - * @return the scale of the current gesture - */ -float lv_event_get_pinch_scale(lv_event_t * gesture_event); - -/** - * Obtains the current angle in radian of a rotation gesture - * @param gesture_event pointer to a gesture event - * @return the rotation angle in radian of the current gesture - */ -float lv_event_get_rotation(lv_event_t * gesture_event); - -/** - * Obtains the current distance in pixels of a two fingers swipe gesture, from the starting center - * @param gesture_event pointer to a gesture event - * @return the distance from the center, in pixels, of the current gesture - */ -float lv_event_get_two_fingers_swipe_distance(lv_event_t * gesture_event); - -/** - * Obtains the current direction from the center of a two finger swipe - * @param gesture_event pointer to a gesture event - * @return the rotation angle in radian of the current gesture - */ -lv_dir_t lv_event_get_two_fingers_swipe_dir(lv_event_t * gesture_event); - -/** - * Sets the state of the recognizer to a indev data structure, - * it is usually called from the indev read callback - * @param data the indev data - * @param recognizer pointer to a gesture recognizer - */ -void lv_indev_set_gesture_data(lv_indev_data_t * data, lv_indev_gesture_recognizer_t * recognizer, - lv_indev_gesture_type_t type); - -/** - * Obtains the center point of a gesture - * @param gesture_event pointer to a gesture recognizer event - * @param point pointer to a point - */ -void lv_indev_get_gesture_center_point(lv_indev_gesture_recognizer_t * recognizer, lv_point_t * point); - -/** - * Obtains the current state of the gesture recognizer attached to an event - * @param gesture_event pointer to a gesture recognizer event - * @return current state of the gesture recognizer - */ -lv_indev_gesture_state_t lv_event_get_gesture_state(lv_event_t * gesture_event, lv_indev_gesture_type_t type); - -/** - * Obtains the current event type of the gesture recognizer attached to an event - * @param gesture_event pointer to a gesture recognizer event - * @return current event type of the gesture recognizer - */ -lv_indev_gesture_type_t lv_event_get_gesture_type(lv_event_t * gesture_event); - -/** - * Obtains the coordinates of the current primary point - * @param recognizer pointer to a gesture recognizer - * @param point pointer to a point - */ -void lv_indev_get_gesture_primary_point(lv_indev_gesture_recognizer_t * recognizer, lv_point_t * point); - -/** - * Allows to determine if there is an are ongoing gesture - * @param recognizer pointer to a gesture recognizer - * @return false if there are no contact points, or the gesture has ended - true otherwise - */ -bool lv_indev_recognizer_is_active(lv_indev_gesture_recognizer_t * recognizer); - -/** - * Update the recognizers. It execute the recognizers functions and checks for - * LV_GESTURE_STATE_RECOGNIZED or LV_GESTURE_STATE_ENDED gestures. - * To be called in the indev read_cb. - * @param indev pointer to the indev containing from which the recognizer need an update - * @param touches indev touch data array, containing the last touch data from indev - * since the last recognizers update - * @param touch_cnt number of indev touch data in touches - */ -void lv_indev_gesture_recognizers_update(lv_indev_t * indev, lv_indev_touch_data_t * touches, uint16_t touch_cnt); - -/** - * Set the lv_indev_data_t struct from the recognizer data. - * To be called in the indev read_cb. - */ -void lv_indev_gesture_recognizers_set_data(lv_indev_t * indev, lv_indev_data_t * data); - - -/********************** - * MACROS - **********************/ - -#endif /* END LV_USE_RECOGNITION */ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_INDEV_GESTURE_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/indev/lv_indev_gesture_private.h b/src/indev/lv_indev_gesture_private.h index e927f424a9..597ee27920 100644 --- a/src/indev/lv_indev_gesture_private.h +++ b/src/indev/lv_indev_gesture_private.h @@ -1,15 +1,7 @@ -/******************************************************************* - * +/** * @file lv_indev_gesture_private.h * - * Contains declarations and definition that are internal - * to the gesture detection logic - * - * Copyright (c) 2024 EDGEMTech Ltd. - * - * Author EDGEMTech Ltd, (erik.tagirov@edgemtech.ch) - * - ******************************************************************/ + */ #ifndef LV_INDEV_GESTURE_PRIVATE_H #define LV_INDEV_GESTURE_PRIVATE_H @@ -21,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../core/lv_obj.h" +#include "../lv_public_api.h" #if LV_USE_GESTURE_RECOGNITION diff --git a/src/indev/lv_indev_private.h b/src/indev/lv_indev_private.h index 5ce041854e..05f2f58c39 100644 --- a/src/indev/lv_indev_private.h +++ b/src/indev/lv_indev_private.h @@ -13,11 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../misc/lv_ext_data.h" -#include "lv_indev.h" -#include "../misc/lv_anim.h" +#include "../lv_public_api.h" #include "lv_indev_scroll.h" -#include "lv_indev_gesture.h" /********************* * DEFINES diff --git a/src/indev/lv_indev_scroll.c b/src/indev/lv_indev_scroll.c index d95261d709..b34540a9f4 100644 --- a/src/indev/lv_indev_scroll.c +++ b/src/indev/lv_indev_scroll.c @@ -6,9 +6,9 @@ /********************* * INCLUDES *********************/ + #include "../core/lv_obj_scroll_private.h" #include "../core/lv_obj_private.h" -#include "lv_indev.h" #include "lv_indev_private.h" #include "lv_indev_scroll.h" diff --git a/src/indev/lv_indev_scroll.h b/src/indev/lv_indev_scroll.h index 413376f16b..d4892c9658 100644 --- a/src/indev/lv_indev_scroll.h +++ b/src/indev/lv_indev_scroll.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../core/lv_obj.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/layouts/flex/lv_flex.c b/src/layouts/flex/lv_flex.c index 5f92ee7a4f..24a2dc5f5b 100644 --- a/src/layouts/flex/lv_flex.c +++ b/src/layouts/flex/lv_flex.c @@ -6,8 +6,6 @@ /********************* * INCLUDES *********************/ -#include "lv_flex.h" -#include "../lv_layout.h" #include "../../core/lv_obj_private.h" #if LV_USE_FLEX diff --git a/src/layouts/flex/lv_flex.h b/src/layouts/flex/lv_flex.h index 9724f9b1cb..7c40d468bc 100644 --- a/src/layouts/flex/lv_flex.h +++ b/src/layouts/flex/lv_flex.h @@ -1,102 +1,2 @@ -/** - * @file lv_flex.h - * - */ - -#ifndef LV_FLEX_H -#define LV_FLEX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../misc/lv_area.h" - -#if LV_USE_FLEX - -/********************* - * DEFINES - *********************/ - -#define LV_FLEX_COLUMN (1 << 0) -#define LV_FLEX_WRAP (1 << 2) -#define LV_FLEX_REVERSE (1 << 3) - -/********************** - * TYPEDEFS - **********************/ - -/*Can't include lv_obj.h because it includes this header file*/ - -typedef enum { - LV_FLEX_ALIGN_START, - LV_FLEX_ALIGN_END, - LV_FLEX_ALIGN_CENTER, - LV_FLEX_ALIGN_SPACE_EVENLY, - LV_FLEX_ALIGN_SPACE_AROUND, - LV_FLEX_ALIGN_SPACE_BETWEEN, -} lv_flex_align_t; - -typedef enum { - LV_FLEX_FLOW_ROW = 0x00, - LV_FLEX_FLOW_COLUMN = LV_FLEX_COLUMN, - LV_FLEX_FLOW_ROW_WRAP = LV_FLEX_FLOW_ROW | LV_FLEX_WRAP, - LV_FLEX_FLOW_ROW_REVERSE = LV_FLEX_FLOW_ROW | LV_FLEX_REVERSE, - LV_FLEX_FLOW_ROW_WRAP_REVERSE = LV_FLEX_FLOW_ROW | LV_FLEX_WRAP | LV_FLEX_REVERSE, - LV_FLEX_FLOW_COLUMN_WRAP = LV_FLEX_FLOW_COLUMN | LV_FLEX_WRAP, - LV_FLEX_FLOW_COLUMN_REVERSE = LV_FLEX_FLOW_COLUMN | LV_FLEX_REVERSE, - LV_FLEX_FLOW_COLUMN_WRAP_REVERSE = LV_FLEX_FLOW_COLUMN | LV_FLEX_WRAP | LV_FLEX_REVERSE, -} lv_flex_flow_t; - -/********************** - * GLOBAL VARIABLES - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a flex layout to default values - */ -void lv_flex_init(void); - -/** - * Set how the item should flow - * @param obj pointer to an object. The parent must have flex layout else nothing will happen. - * @param flow an element of `lv_flex_flow_t`. - */ -void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow); - -/** - * Set how to place (where to align) the items and tracks - * @param obj pointer to an object. The parent must have flex layout else nothing will happen. - * @param main_place where to place the items on main axis (in their track). Any value of `lv_flex_align_t`. - * @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_ALIGN_START/END/CENTER` - * @param track_cross_place where to place the tracks in the cross direction. Any value of `lv_flex_align_t`. - */ -void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place, - lv_flex_align_t track_cross_place); - -/** - * Sets the width or height (on main axis) to grow the object in order fill the free space - * @param obj pointer to an object. The parent must have flex layout else nothing will happen. - * @param grow a value to set how much free space to take proportionally to other growing items. - */ -void lv_obj_set_flex_grow(lv_obj_t * obj, uint8_t grow); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_FLEX*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_FLEX_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/layouts/grid/lv_grid.c b/src/layouts/grid/lv_grid.c index ca8366709b..91c7e6c2a9 100644 --- a/src/layouts/grid/lv_grid.c +++ b/src/layouts/grid/lv_grid.c @@ -6,14 +6,14 @@ /********************* * INCLUDES *********************/ -#include "lv_grid.h" + +#include "../../lv_public_api.h" #if LV_USE_GRID -#include "../../stdlib/lv_string.h" -#include "../lv_layout.h" #include "../../core/lv_obj_private.h" #include "../../core/lv_global.h" + /********************* * DEFINES *********************/ diff --git a/src/layouts/grid/lv_grid.h b/src/layouts/grid/lv_grid.h index a7bf738223..2cfe5e0717 100644 --- a/src/layouts/grid/lv_grid.h +++ b/src/layouts/grid/lv_grid.h @@ -1,99 +1,2 @@ -/** - * @file lv_grid.h - * - */ - -#ifndef LV_GRID_H -#define LV_GRID_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../misc/lv_area.h" - -#if LV_USE_GRID - -/********************* - * DEFINES - *********************/ -/** - * Can be used track size to make the track fill the free space. - * @param x how much space to take proportionally to other FR tracks - * @return a special track size - */ -#define LV_GRID_FR(x) (LV_COORD_MAX - 100 + x) - -#define LV_GRID_CONTENT (LV_COORD_MAX - 101) -LV_EXPORT_CONST_INT(LV_GRID_CONTENT); - -#define LV_GRID_TEMPLATE_LAST (LV_COORD_MAX) -LV_EXPORT_CONST_INT(LV_GRID_TEMPLATE_LAST); - -/********************** - * TYPEDEFS - **********************/ - -/*Can't include lv_obj.h because it includes this header file*/ - -typedef enum { - LV_GRID_ALIGN_START, - LV_GRID_ALIGN_CENTER, - LV_GRID_ALIGN_END, - LV_GRID_ALIGN_STRETCH, - LV_GRID_ALIGN_SPACE_EVENLY, - LV_GRID_ALIGN_SPACE_AROUND, - LV_GRID_ALIGN_SPACE_BETWEEN, -} lv_grid_align_t; - -/********************** - * GLOBAL VARIABLES - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -void lv_grid_init(void); - -void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const int32_t col_dsc[], const int32_t row_dsc[]); - -void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align); - -/** - * Set the cell of an object. The object's parent needs to have grid layout, else nothing will happen - * @param obj pointer to an object - * @param column_align the vertical alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH` - * @param col_pos column ID - * @param col_span number of columns to take (>= 1) - * @param row_align the horizontal alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH` - * @param row_pos row ID - * @param row_span number of rows to take (>= 1) - */ -void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t column_align, int32_t col_pos, int32_t col_span, - lv_grid_align_t row_align, int32_t row_pos, int32_t row_span); - -/** - * Just a wrapper to `LV_GRID_FR` for bindings. - */ -int32_t lv_grid_fr(uint8_t x); - -/********************** - * GLOBAL VARIABLES - **********************/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GRID*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_GRID_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/layouts/lv_layout.c b/src/layouts/lv_layout.c index cc6f38233c..6eb792237b 100644 --- a/src/layouts/lv_layout.c +++ b/src/layouts/lv_layout.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_layout.h" + #include "lv_layout_private.h" #include "../core/lv_global.h" diff --git a/src/layouts/lv_layout.h b/src/layouts/lv_layout.h index 56a04cee6d..fd67237885 100644 --- a/src/layouts/lv_layout.h +++ b/src/layouts/lv_layout.h @@ -1,85 +1,2 @@ -/** - * @file lv_layout.h - * - */ - -#ifndef LV_LAYOUT_H -#define LV_LAYOUT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef void (*lv_layout_update_cb_t)(lv_obj_t *, void * user_data); -typedef bool (*lv_layout_get_min_size_cb_t)(lv_obj_t *, int32_t * req_size, bool width, void * user_data); - -typedef struct { - lv_layout_update_cb_t layout_update_cb; - lv_layout_get_min_size_cb_t get_min_size_cb; -} lv_layout_callbacks_t; - - -typedef enum { - LV_LAYOUT_NONE = 0, - -#if LV_USE_FLEX - LV_LAYOUT_FLEX, -#endif - -#if LV_USE_GRID - LV_LAYOUT_GRID, -#endif - - LV_LAYOUT_LAST -} lv_layout_t; - - -/** - * Create a new layout - * @param callbacks the layout callbacks - * @param user_data custom data that will be passed when a callback is invoked - * @return the ID of the new layout - */ -uint32_t lv_layout_create(lv_layout_callbacks_t callbacks, void * user_data); - -/** - * DEPRECATED: `lv_layout_register` is deprecated. `lv_layout_create` should be used instead. - * - * Register a new layout - * @param cb the layout update callback - * @param user_data custom data that will be passed to `cb` - * @return the ID of the new layout - */ -uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data); - -/********************** - * MACROS - **********************/ - -#if LV_USE_FLEX -#include "flex/lv_flex.h" -#endif /* LV_USE_FLEX */ - -#if LV_USE_GRID -#include "grid/lv_grid.h" -#endif /* LV_USE_GRID */ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_LAYOUT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/layouts/lv_layout_private.h b/src/layouts/lv_layout_private.h index 32cd5e0fb6..830fbe9b17 100644 --- a/src/layouts/lv_layout_private.h +++ b/src/layouts/lv_layout_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_layout.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/libs/FT800-FT813/EVE_commands.c b/src/libs/FT800-FT813/EVE_commands.c index 59e3d052f1..201b853540 100644 --- a/src/libs/FT800-FT813/EVE_commands.c +++ b/src/libs/FT800-FT813/EVE_commands.c @@ -1,4 +1,4 @@ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_EVE /* @file EVE_commands.c diff --git a/src/libs/FT800-FT813/EVE_supplemental.c b/src/libs/FT800-FT813/EVE_supplemental.c index 988b62c739..2bc97ab0cb 100644 --- a/src/libs/FT800-FT813/EVE_supplemental.c +++ b/src/libs/FT800-FT813/EVE_supplemental.c @@ -1,4 +1,4 @@ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_DRAW_EVE /* @file EVE_supplemental.h diff --git a/src/libs/FT800-FT813/EVE_target.h b/src/libs/FT800-FT813/EVE_target.h index 76a1f4a95d..0f216baf88 100644 --- a/src/libs/FT800-FT813/EVE_target.h +++ b/src/libs/FT800-FT813/EVE_target.h @@ -1,9 +1,8 @@ #ifndef EVE_TARGET_H #define EVE_TARGET_H +#include "../../lv_public_api.h" #include "../../draw/eve/lv_draw_eve_private.h" -#include "../../tick/lv_tick.h" -#include "../../misc/lv_utils.h" #include "../../core/lv_global.h" #define lv_eve_write_buf (LV_GLOBAL_DEFAULT()->draw_eve_unit->lv_eve_write_buf) @@ -80,7 +79,8 @@ static inline void lv_eve_target_flush_write_buf(void) if(lv_eve_write_buf_len == 0) { return; } - lv_draw_eve_unit_g->op_cb(lv_draw_eve_unit_g->disp, LV_DRAW_EVE_OPERATION_SPI_SEND, lv_eve_write_buf, lv_eve_write_buf_len); + lv_draw_eve_unit_g->op_cb(lv_draw_eve_unit_g->disp, LV_DRAW_EVE_OPERATION_SPI_SEND, lv_eve_write_buf, + lv_eve_write_buf_len); lv_eve_write_buf_len = 0; #endif } @@ -103,7 +103,7 @@ static inline uint8_t spi_receive(uint8_t data) return byte; } -static inline uint8_t fetch_flash_byte(const uint8_t *p_data) +static inline uint8_t fetch_flash_byte(const uint8_t * p_data) { return (*p_data); } diff --git a/src/libs/barcode/lv_barcode.h b/src/libs/barcode/lv_barcode.h index 79f2e519cb..b30f581999 100644 --- a/src/libs/barcode/lv_barcode.h +++ b/src/libs/barcode/lv_barcode.h @@ -1,143 +1,2 @@ -/** - * @file lv_barcode.h - * - */ - -#ifndef LV_BARCODE_H -#define LV_BARCODE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../misc/lv_types.h" -#include "../../misc/lv_color.h" -#include "../../widgets/canvas/lv_canvas.h" - -#if LV_USE_BARCODE - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - /** - * Code 128 with GS1 encoding. Strips `[FCN1]` and spaces. - */ - LV_BARCODE_ENCODING_CODE128_GS1, - /** - * Code 128 with raw encoding. - */ - LV_BARCODE_ENCODING_CODE128_RAW, -} lv_barcode_encoding_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_barcode_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an empty barcode (an `lv_canvas`) object. - * @param parent point to an object where to create the barcode - * @return pointer to the created barcode object - */ -lv_obj_t * lv_barcode_create(lv_obj_t * parent); - -/** - * Set the dark color of a barcode object - * @param obj pointer to barcode object - * @param color dark color of the barcode - */ -void lv_barcode_set_dark_color(lv_obj_t * obj, lv_color_t color); - -/** - * Set the light color of a barcode object - * @param obj pointer to barcode object - * @param color light color of the barcode - */ -void lv_barcode_set_light_color(lv_obj_t * obj, lv_color_t color); - -/** - * Set the scale of a barcode object - * @param obj pointer to barcode object - * @param scale scale factor - */ -void lv_barcode_set_scale(lv_obj_t * obj, uint16_t scale); - -/** - * Set the direction of a barcode object - * @param obj pointer to barcode object - * @param direction draw direction (`LV_DIR_HOR` or `LB_DIR_VER`) - */ -void lv_barcode_set_direction(lv_obj_t * obj, lv_dir_t direction); - -/** - * Set the tiled mode of a barcode object - * @param obj pointer to barcode object - * @param tiled true: tiled mode, false: normal mode (default) - */ -void lv_barcode_set_tiled(lv_obj_t * obj, bool tiled); - -/** - * Set the encoding of a barcode object - * @param obj pointer to barcode object - * @param encoding encoding (default is `LV_BARCODE_CODE128_GS1`) - */ -void lv_barcode_set_encoding(lv_obj_t * obj, lv_barcode_encoding_t encoding); - -/** - * Set the data of a barcode object - * @param obj pointer to barcode object - * @param data data to display - * @return LV_RESULT_OK: if no error; LV_RESULT_INVALID: on error - */ -lv_result_t lv_barcode_update(lv_obj_t * obj, const char * data); - -/** - * Get the dark color of a barcode object - * @param obj pointer to barcode object - * @return dark color of the barcode - */ -lv_color_t lv_barcode_get_dark_color(lv_obj_t * obj); - -/** - * Get the light color of a barcode object - * @param obj pointer to barcode object - * @return light color of the barcode - */ -lv_color_t lv_barcode_get_light_color(lv_obj_t * obj); - -/** - * Get the scale of a barcode object - * @param obj pointer to barcode object - * @return scale factor - */ -uint16_t lv_barcode_get_scale(lv_obj_t * obj); - -/** - * Get the encoding of a barcode object - * @param obj pointer to barcode object - * @return encoding - */ -lv_barcode_encoding_t lv_barcode_get_encoding(const lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_BARCODE*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_BARCODE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/barcode/lv_barcode_private.h b/src/libs/barcode/lv_barcode_private.h index c4c28c5eec..915a213ab7 100644 --- a/src/libs/barcode/lv_barcode_private.h +++ b/src/libs/barcode/lv_barcode_private.h @@ -14,11 +14,12 @@ extern "C" { * INCLUDES *********************/ -#include "../../widgets/canvas/lv_canvas_private.h" -#include "lv_barcode.h" +#include "../../lv_public_api.h" #if LV_USE_BARCODE +#include "../../widgets/canvas/lv_canvas_private.h" + /********************* * DEFINES *********************/ diff --git a/src/libs/bin_decoder/lv_bin_decoder.c b/src/libs/bin_decoder/lv_bin_decoder.c index 9c31576196..f4e5ec2e10 100644 --- a/src/libs/bin_decoder/lv_bin_decoder.c +++ b/src/libs/bin_decoder/lv_bin_decoder.c @@ -6,20 +6,14 @@ /********************* * INCLUDES *********************/ + #include "../../draw/lv_image_decoder_private.h" -#include "lv_bin_decoder.h" -#include "../../draw/lv_draw_image.h" -#include "../../draw/lv_draw_buf.h" -#include "../../stdlib/lv_string.h" -#include "../../stdlib/lv_sprintf.h" -#include "../../libs/rle/lv_rle.h" +#include "../../libs/rle/lv_rle_private.h" #include "../../core/lv_global.h" #if LV_USE_LZ4_EXTERNAL #include -#endif - -#if LV_USE_LZ4_INTERNAL +#elif LV_USE_LZ4_INTERNAL #include "../../libs/lz4/lz4.h" #endif diff --git a/src/libs/bin_decoder/lv_bin_decoder.h b/src/libs/bin_decoder/lv_bin_decoder.h index d441230d08..e9f88043a0 100644 --- a/src/libs/bin_decoder/lv_bin_decoder.h +++ b/src/libs/bin_decoder/lv_bin_decoder.h @@ -1,70 +1,2 @@ -/** - * @file lv_bin_decoder.h - * - */ - -#ifndef LV_BIN_DECODER_H -#define LV_BIN_DECODER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../draw/lv_image_decoder.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the binary image decoder module - */ -void lv_bin_decoder_init(void); - -/** - * Get info about a lvgl binary image - * @param decoder the decoder where this function belongs - * @param dsc image descriptor containing the source and type of the image and other info. - * @param header store the image data here - * @return LV_RESULT_OK: the info is successfully stored in `header`; LV_RESULT_INVALID: unknown format or other error. - */ -lv_result_t lv_bin_decoder_info(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc, lv_image_header_t * header); - -lv_result_t lv_bin_decoder_get_area(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc, - const lv_area_t * full_area, lv_area_t * decoded_area); - -/** - * Open a lvgl binary image - * @param decoder the decoder where this function belongs - * @param dsc pointer to decoder descriptor. `src`, `style` are already initialized in it. - * @return LV_RESULT_OK: the info is successfully stored in `header`; LV_RESULT_INVALID: unknown format or other error. - */ -lv_result_t lv_bin_decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); - -/** - * Close the pending decoding. Free resources etc. - * @param decoder pointer to the decoder the function associated with - * @param dsc pointer to decoder descriptor - */ -void lv_bin_decoder_close(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_BIN_DECODER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/bmp/lv_bmp.h b/src/libs/bmp/lv_bmp.h index a7dbe277b2..20f60b88bc 100644 --- a/src/libs/bmp/lv_bmp.h +++ b/src/libs/bmp/lv_bmp.h @@ -1,43 +1,2 @@ -/** - * @file lv_bmp.h - * - */ - -#ifndef LV_BMP_H -#define LV_BMP_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_BMP - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -void lv_bmp_init(void); -void lv_bmp_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_BMP*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_BMP_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/ffmpeg/lv_ffmpeg.h b/src/libs/ffmpeg/lv_ffmpeg.h index edd384d991..a03cbfbbd5 100644 --- a/src/libs/ffmpeg/lv_ffmpeg.h +++ b/src/libs/ffmpeg/lv_ffmpeg.h @@ -1,108 +1,2 @@ -/** - * @file lv_ffmpeg.h - * - */ -#ifndef LV_FFMPEG_H -#define LV_FFMPEG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_FFMPEG != 0 -#include "../../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -struct ffmpeg_context_s; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_ffmpeg_player_class; - -typedef enum { - LV_FFMPEG_PLAYER_CMD_START, - LV_FFMPEG_PLAYER_CMD_STOP, - LV_FFMPEG_PLAYER_CMD_PAUSE, - LV_FFMPEG_PLAYER_CMD_RESUME, - LV_FFMPEG_PLAYER_CMD_LAST -} lv_ffmpeg_player_cmd_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Register FFMPEG image decoder - */ -void lv_ffmpeg_init(void); - -/** - * De-initialize FFMPEG image decoder - */ -void lv_ffmpeg_deinit(void); - -/** - * Get the number of frames contained in the file - * @param path image or video file name - * @return Number of frames, less than 0 means failed - */ -int lv_ffmpeg_get_frame_num(const char * path); - -/** - * Create ffmpeg_player object - * @param parent pointer to an object, it will be the parent of the new player - * @return pointer to the created ffmpeg_player - */ -lv_obj_t * lv_ffmpeg_player_create(lv_obj_t * parent); - -/** - * Set the path of the file to be played. - * @param obj pointer to a ffmpeg_player object - * @param path video file path - * @return LV_RESULT_OK: no error; LV_RESULT_INVALID: can't get the info. - */ -lv_result_t lv_ffmpeg_player_set_src(lv_obj_t * obj, const char * path); - -/** - * Set command control video player - * @param obj pointer to a ffmpeg_player object - * @param cmd control commands - */ -void lv_ffmpeg_player_set_cmd(lv_obj_t * obj, lv_ffmpeg_player_cmd_t cmd); - -/** - * Set the video to automatically replay - * @param obj pointer to a ffmpeg_player object - * @param en true: enable the auto restart - */ -void lv_ffmpeg_player_set_auto_restart(lv_obj_t * obj, bool en); - -/** - * Set the video decoder - * @param obj pointer to a ffmpeg_player object - * @param decoder_name decoder name - */ -void lv_ffmpeg_player_set_decoder(lv_obj_t * obj, const char * decoder_name); -/*===================== - * Other functions - *====================*/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_FFMPEG*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_FFMPEG_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/ffmpeg/lv_ffmpeg_private.h b/src/libs/ffmpeg/lv_ffmpeg_private.h index 6f381a385a..d3110a4d35 100644 --- a/src/libs/ffmpeg/lv_ffmpeg_private.h +++ b/src/libs/ffmpeg/lv_ffmpeg_private.h @@ -14,8 +14,8 @@ extern "C" { * INCLUDES *********************/ -#include "lv_ffmpeg.h" -#if LV_USE_FFMPEG != 0 +#include "../../lv_public_api.h" +#if LV_USE_FFMPEG #include "../../widgets/image/lv_image_private.h" /********************* diff --git a/src/libs/freetype/lv_freetype.c b/src/libs/freetype/lv_freetype.c index e500beb372..9fb57ddbec 100755 --- a/src/libs/freetype/lv_freetype.c +++ b/src/libs/freetype/lv_freetype.c @@ -12,6 +12,7 @@ #include "../../misc/lv_fs_private.h" #include "../../core/lv_global.h" +#include "../../misc/cache/lv_cache_entry.h" /********************* * DEFINES diff --git a/src/libs/freetype/lv_freetype.h b/src/libs/freetype/lv_freetype.h old mode 100755 new mode 100644 index ac4ab73f9c..7efd0efca2 --- a/src/libs/freetype/lv_freetype.h +++ b/src/libs/freetype/lv_freetype.h @@ -1,148 +1,2 @@ -/** - * @file lv_freetype.h - * - */ -#ifndef LV_FREETYPE_H -#define LV_FREETYPE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_FREETYPE - -#include "../../misc/lv_types.h" -#include "../../misc/lv_event.h" -#include "../../misc/lv_color.h" - -#include LV_STDBOOL_INCLUDE - -/********************* -* DEFINES -*********************/ - -#define LV_FREETYPE_F26DOT6_TO_INT(x) ((x) >> 6) -#define LV_FREETYPE_F26DOT6_TO_FLOAT(x) ((float)(x) / 64) - -#define FT_FONT_STYLE_NORMAL LV_FREETYPE_FONT_STYLE_NORMAL -#define FT_FONT_STYLE_ITALIC LV_FREETYPE_FONT_STYLE_ITALIC -#define FT_FONT_STYLE_BOLD LV_FREETYPE_FONT_STYLE_BOLD - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_FREETYPE_FONT_STYLE_NORMAL = 0, - LV_FREETYPE_FONT_STYLE_ITALIC = 1 << 0, - LV_FREETYPE_FONT_STYLE_BOLD = 1 << 1, -} lv_freetype_font_style_t; - -typedef lv_freetype_font_style_t LV_FT_FONT_STYLE; - -typedef enum { - LV_FREETYPE_FONT_RENDER_MODE_BITMAP = 0, - LV_FREETYPE_FONT_RENDER_MODE_OUTLINE = 1, -} lv_freetype_font_render_mode_t; - -typedef void * lv_freetype_outline_t; - -typedef enum { - LV_FREETYPE_OUTLINE_END, - LV_FREETYPE_OUTLINE_MOVE_TO, - LV_FREETYPE_OUTLINE_LINE_TO, - LV_FREETYPE_OUTLINE_CUBIC_TO, - LV_FREETYPE_OUTLINE_CONIC_TO, -} lv_freetype_outline_type_t; - -/* Only path string is required */ -typedef const char lv_freetype_font_src_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_freetype_font_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the freetype library. - * @return LV_RESULT_OK on success, otherwise LV_RESULT_INVALID. - */ -lv_result_t lv_freetype_init(uint32_t max_glyph_cnt); - -/** - * Uninitialize the freetype library - */ -void lv_freetype_uninit(void); - -/** - * Initialize a font info structure. - * @param font_info font info structure to be initialized. - */ -void lv_freetype_init_font_info(lv_font_info_t * font_info); - -/** - * Create a freetype font with a font info structure. - * @param font_info font info structure. - * @return Created font, or NULL on failure. - */ -lv_font_t * lv_freetype_font_create_with_info(const lv_font_info_t * font_info); - -/** - * Create a freetype font. - * @param pathname font file path. - * @param render_mode font render mode(see @lv_freetype_font_render_mode_t for details). - * @param size font size. - * @param style font style(see lv_freetype_font_style_t for details). - * @return Created font, or NULL on failure. - */ -lv_font_t * lv_freetype_font_create(const char * pathname, lv_freetype_font_render_mode_t render_mode, uint32_t size, - lv_freetype_font_style_t style); - -/** - * Delete a freetype font. - * @param font freetype font to be deleted. - */ -void lv_freetype_font_delete(lv_font_t * font); - -/** - * Register a callback function to generate outlines for FreeType fonts. - * - * @param cb The callback function to be registered. - * @param user_data User data to be passed to the callback function. - * @return The ID of the registered callback function, or a negative value on failure. - */ -void lv_freetype_outline_add_event(lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); - -/** - * Get the scale of a FreeType font. - * - * @param font The FreeType font to get the scale of. - * @return The scale of the FreeType font. - */ -uint32_t lv_freetype_outline_get_scale(const lv_font_t * font); - -/** - * Check if the font is an outline font. - * - * @param font The FreeType font. - * @return Is outline font on success, otherwise false. - */ -bool lv_freetype_is_outline_font(const lv_font_t * font); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_FREETYPE*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_FREETYPE_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/freetype/lv_freetype_glyph.c b/src/libs/freetype/lv_freetype_glyph.c index 65c47b4564..2d708c3a6b 100644 --- a/src/libs/freetype/lv_freetype_glyph.c +++ b/src/libs/freetype/lv_freetype_glyph.c @@ -7,11 +7,13 @@ * INCLUDES *********************/ -#include "../../lvgl.h" #include "lv_freetype_private.h" #if LV_USE_FREETYPE +#include "../../misc/cache/lv_cache.h" +#include "../../misc/cache/lv_cache_entry.h" + /********************* * DEFINES *********************/ diff --git a/src/libs/freetype/lv_freetype_image.c b/src/libs/freetype/lv_freetype_image.c index 415dc6d28d..f350cf938c 100755 --- a/src/libs/freetype/lv_freetype_image.c +++ b/src/libs/freetype/lv_freetype_image.c @@ -13,6 +13,8 @@ #if LV_USE_FREETYPE #include "../../core/lv_global.h" +#include "../../misc/cache/lv_cache.h" +#include "../../misc/cache/lv_cache_entry.h" #define font_draw_buf_handlers &(LV_GLOBAL_DEFAULT()->font_draw_buf_handlers) diff --git a/src/libs/freetype/lv_freetype_outline.c b/src/libs/freetype/lv_freetype_outline.c index 07e393d96b..ccc323c03c 100755 --- a/src/libs/freetype/lv_freetype_outline.c +++ b/src/libs/freetype/lv_freetype_outline.c @@ -7,12 +7,14 @@ * INCLUDES *********************/ +#include "../../lv_public_api.h" #include "../../misc/lv_event_private.h" -#include "../../lvgl.h" #include "lv_freetype_private.h" #if LV_USE_FREETYPE +#include "../../misc/cache/lv_cache_entry.h" + /********************* * DEFINES *********************/ diff --git a/src/libs/freetype/lv_freetype_private.h b/src/libs/freetype/lv_freetype_private.h index 905b61599e..32c575eb38 100755 --- a/src/libs/freetype/lv_freetype_private.h +++ b/src/libs/freetype/lv_freetype_private.h @@ -14,13 +14,11 @@ extern "C" { * INCLUDES *********************/ -#include "lv_freetype.h" +#include "../../lv_public_api.h" #if LV_USE_FREETYPE #include "../../misc/cache/lv_cache.h" -#include "../../misc/lv_ll.h" -#include "../../font/lv_font.h" #include "ft2build.h" #include FT_FREETYPE_H #include FT_GLYPH_H diff --git a/src/libs/frogfs/include/frogfs/frogfs.h b/src/libs/frogfs/include/frogfs/frogfs.h index fdc95acff2..2da6dd87ba 100644 --- a/src/libs/frogfs/include/frogfs/frogfs.h +++ b/src/libs/frogfs/include/frogfs/frogfs.h @@ -8,7 +8,7 @@ extern "C" { #endif -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #include LV_STDDEF_INCLUDE #include LV_STDINT_INCLUDE #include "frogfs_types.h" diff --git a/src/libs/frogfs/include/frogfs/frogfs_types.h b/src/libs/frogfs/include/frogfs/frogfs_types.h index 5ee1eed98c..424a6e13aa 100644 --- a/src/libs/frogfs/include/frogfs/frogfs_types.h +++ b/src/libs/frogfs/include/frogfs/frogfs_types.h @@ -1,6 +1,6 @@ #pragma once -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #include LV_STDINT_INCLUDE typedef intptr_t ssize_t; diff --git a/src/libs/frogfs/src/decomp_raw.c b/src/libs/frogfs/src/decomp_raw.c index 044c74ebdc..58a236f30f 100644 --- a/src/libs/frogfs/src/decomp_raw.c +++ b/src/libs/frogfs/src/decomp_raw.c @@ -2,11 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #include LV_STDDEF_INCLUDE #include LV_STDINT_INCLUDE -#include "../../../stdlib/lv_string.h" -#include "../../../misc/lv_fs.h" #include "frogfs_priv.h" #include "frogfs_format.h" diff --git a/src/libs/frogfs/src/frogfs.c b/src/libs/frogfs/src/frogfs.c index 4c2ed1ce06..3cf7cc4f77 100644 --- a/src/libs/frogfs/src/frogfs.c +++ b/src/libs/frogfs/src/frogfs.c @@ -8,23 +8,13 @@ * tool that comes with this source distribution. */ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_FS_FROGFS -#include LV_INTTYPES_INCLUDE -#include LV_LIMITS_INCLUDE -#include LV_STDINT_INCLUDE -#include "../../../stdlib/lv_string.h" -#include "../../../stdlib/lv_mem.h" -#include "../../../misc/lv_log.h" -#include "../../../misc/lv_assert.h" -#include "../../../misc/lv_fs.h" - #include "frogfs_priv.h" #include "frogfs_format.h" #include "../include/frogfs/frogfs.h" - typedef struct frogfs_fs_t { const frogfs_head_t *head; /**< fs header pointer */ const frogfs_hash_t *hash; /**< hash table pointer */ diff --git a/src/libs/frogfs/src/frogfs_format.h b/src/libs/frogfs/src/frogfs_format.h index 1cdc1d7687..6ebbb7f84e 100644 --- a/src/libs/frogfs/src/frogfs_format.h +++ b/src/libs/frogfs/src/frogfs_format.h @@ -4,7 +4,7 @@ #pragma once -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #include LV_STDINT_INCLUDE diff --git a/src/libs/fsdrv/lv_fs_frogfs.c b/src/libs/fsdrv/lv_fs_frogfs.c index 11a7bde606..1af9c6522c 100644 --- a/src/libs/fsdrv/lv_fs_frogfs.c +++ b/src/libs/fsdrv/lv_fs_frogfs.c @@ -12,7 +12,6 @@ #include "../frogfs/include/frogfs/frogfs.h" #include "../../core/lv_global.h" -#include "../../misc/lv_ll.h" #if !LV_FS_IS_VALID_LETTER(LV_FS_FROGFS_LETTER) #error "Invalid drive letter" diff --git a/src/libs/fsdrv/lv_fsdrv.h b/src/libs/fsdrv/lv_fsdrv.h index 049a80f898..ec79e18fa8 100644 --- a/src/libs/fsdrv/lv_fsdrv.h +++ b/src/libs/fsdrv/lv_fsdrv.h @@ -1,119 +1,2 @@ -/** - * @file lv_fsdrv.h - * - */ - -#ifndef LV_FSDRV_H -#define LV_FSDRV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -/********************* - * DEFINES - *********************/ - -#define LV_FS_MAX_PATH_LEN 256 - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -#if LV_USE_FS_FATFS -void lv_fs_fatfs_init(void); -#endif - -#if LV_USE_FS_STDIO -void lv_fs_stdio_init(void); -#endif - -#if LV_USE_FS_POSIX -void lv_fs_posix_init(void); -#endif - -#if LV_USE_FS_WIN32 -void lv_fs_win32_init(void); -#endif - -#if LV_USE_FS_MEMFS -void lv_fs_memfs_init(void); -#endif - -#if LV_USE_FS_LITTLEFS -#include "lfs.h" -struct lfs; -/** - * Set the default LittleFS handler to be used by LVGL - * @param lfs pointer to an initialized LittleFS filesystem structure - */ -void lv_littlefs_set_handler(struct lfs * lfs); - -/** - * Initialize LittleFS file system driver - */ -void lv_fs_littlefs_init(void); - -/** - * Register a LittleFS drive with LVGL - * @param lfs pointer to an initialized LittleFS filesystem structure - * @param letter driver letter to register (e.g. 'A') - * @return LV_FS_RES_OK: success, LV_FS_RES_INV_PARAM: lfs is NULL or letter not in range A-Z, - * LV_FS_RES_DRIVE_LETTER_ALREADY_USED: A drive with this letter is already registered - */ -lv_fs_res_t lv_fs_littlefs_register_drive(lfs_t * lfs, char letter); -#endif - -#if LV_USE_FS_ARDUINO_ESP_LITTLEFS -void lv_fs_arduino_esp_littlefs_init(void); -#endif - -#if LV_USE_FS_ARDUINO_SD -void lv_fs_arduino_sd_init(void); -#endif - -#if LV_USE_FS_UEFI -void lv_fs_uefi_init(void); -#endif - -#if LV_USE_FS_FROGFS -void lv_fs_frogfs_init(void); -void lv_fs_frogfs_deinit(void); - -/** - * Mount a frogfs blob at the path prefix. If there is a file "foo.txt" - * in the blob and the blob is registered with `path_prefix` as "my_blob", - * it can be opened later at path "my_blob/foo.txt". - * @param blob a frogfs blob/image from mkfrogfs.py - * @param path_prefix a prefix that will be used to refer to this blob when accessing it. - * @return LV_RESULT_OK or LV_RESULT_INVALID if there was an issue with the blob - */ -lv_result_t lv_fs_frogfs_register_blob(const void * blob, const char * path_prefix); - -/** - * Unmount a frogfs blob that was previously mounted by `lv_fs_frogfs_register_blob`. - * All files and dirs should be closed before calling this. - * @param path_prefix the path prefix that the blob was registered with - */ -void lv_fs_frogfs_unregister_blob(const char * path_prefix); - -#endif /*LV_USE_FS_FROGFS*/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_FSDRV_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/gif/AnimatedGIF.h b/src/libs/gif/AnimatedGIF.h index 0922520bee..0bdbcb1f72 100644 --- a/src/libs/gif/AnimatedGIF.h +++ b/src/libs/gif/AnimatedGIF.h @@ -13,12 +13,10 @@ #ifndef __ANIMATEDGIF__ #define __ANIMATEDGIF__ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_GIF -#include "../../misc/lv_fs.h" - // // GIF Animator // Written by Larry Bank diff --git a/src/libs/gif/gif.c b/src/libs/gif/gif.c index b0a0fc77bd..004eadf72e 100644 --- a/src/libs/gif/gif.c +++ b/src/libs/gif/gif.c @@ -22,9 +22,6 @@ #if LV_USE_GIF -#include "../../misc/lv_log.h" -#include "../../stdlib/lv_string.h" - static const unsigned char cGIFBits[9] = {1,4,4,4,8,8,8,8,8}; // convert odd bpp values to ones we can handle // forward references diff --git a/src/libs/gltf/fastgltf/lv_fastgltf.hpp b/src/libs/gltf/fastgltf/lv_fastgltf.hpp index 1626e86430..ec821c889e 100644 --- a/src/libs/gltf/fastgltf/lv_fastgltf.hpp +++ b/src/libs/gltf/fastgltf/lv_fastgltf.hpp @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_GLTF diff --git a/src/libs/gltf/gltf_data/lv_gltf_data.cpp b/src/libs/gltf/gltf_data/lv_gltf_data.cpp index 52dbaf4583..fc54cd7669 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_data.cpp +++ b/src/libs/gltf/gltf_data/lv_gltf_data.cpp @@ -12,10 +12,6 @@ #if LV_USE_GLTF #include -#include "../../../misc/lv_assert.h" -#include "../../../core/lv_obj_pos.h" -#include "../../../misc/lv_timer.h" - /********************* * DEFINES diff --git a/src/libs/gltf/gltf_data/lv_gltf_data_injest.cpp b/src/libs/gltf/gltf_data/lv_gltf_data_injest.cpp index cc4eb014ec..944ea60668 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_data_injest.cpp +++ b/src/libs/gltf/gltf_data/lv_gltf_data_injest.cpp @@ -15,11 +15,6 @@ #include #include #include "../fastgltf/lv_fastgltf.hpp" -#include "../../../misc/lv_assert.h" -#include "../../../misc/lv_log.h" -#include "../../../misc/lv_math.h" -#include "../../../stdlib/lv_sprintf.h" -#include "../../../misc/lv_fs.h" #include "../stb_image/stb_image.h" #include diff --git a/src/libs/gltf/gltf_data/lv_gltf_data_internal.h b/src/libs/gltf/gltf_data/lv_gltf_data_internal.h index ca1c770644..9b0a1e1c40 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_data_internal.h +++ b/src/libs/gltf/gltf_data/lv_gltf_data_internal.h @@ -5,11 +5,11 @@ extern "C" { #endif -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_GLTF + #include "../../../drivers/opengles/opengl_shader/lv_opengl_shader_internal.h" -#include "../../../misc/lv_types.h" typedef struct { diff --git a/src/libs/gltf/gltf_data/lv_gltf_data_internal.hpp b/src/libs/gltf/gltf_data/lv_gltf_data_internal.hpp index d0d5b602f8..5df7c57b11 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_data_internal.hpp +++ b/src/libs/gltf/gltf_data/lv_gltf_data_internal.hpp @@ -1,19 +1,14 @@ #ifndef LV_GLTFDATA_HPP #define LV_GLTFDATA_HPP -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_GLTF -#include "../gltf_view/lv_gltf.h" #include "lv_gltf_data_internal.h" #include "../../../drivers/opengles/lv_opengles_private.h" -#include "../../../misc/lv_types.h" -#include "../../../misc/lv_array.h" -#include "../../../misc/lv_event.h" - #ifdef __cplusplus #include diff --git a/src/libs/gltf/gltf_data/lv_gltf_data_primitive.cpp b/src/libs/gltf/gltf_data/lv_gltf_data_primitive.cpp index 4c20559547..8d2afb3faa 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_data_primitive.cpp +++ b/src/libs/gltf/gltf_data/lv_gltf_data_primitive.cpp @@ -8,8 +8,8 @@ *********************/ #include "lv_gltf_data_internal.hpp" + #if LV_USE_GLTF -#include "../../../misc/lv_math.h" /********************* * DEFINES diff --git a/src/libs/gltf/gltf_data/lv_gltf_data_shader.cpp b/src/libs/gltf/gltf_data/lv_gltf_data_shader.cpp index 3364d0a449..c487061f3d 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_data_shader.cpp +++ b/src/libs/gltf/gltf_data/lv_gltf_data_shader.cpp @@ -10,7 +10,7 @@ #include "lv_gltf_data_internal.hpp" #if LV_USE_GLTF -#include "../../../misc/lv_array.h" + /********************* * DEFINES *********************/ diff --git a/src/libs/gltf/gltf_data/lv_gltf_data_texture.cpp b/src/libs/gltf/gltf_data/lv_gltf_data_texture.cpp index 0448556b02..cb52568894 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_data_texture.cpp +++ b/src/libs/gltf/gltf_data/lv_gltf_data_texture.cpp @@ -11,7 +11,6 @@ #if LV_USE_GLTF #include -#include "../../../misc/lv_color.h" /********************* * DEFINES diff --git a/src/libs/gltf/gltf_data/lv_gltf_model.h b/src/libs/gltf/gltf_data/lv_gltf_model.h index 74a9750534..a1f5af31bf 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_model.h +++ b/src/libs/gltf/gltf_data/lv_gltf_model.h @@ -1,178 +1,2 @@ -#ifndef LV_GLTF_MODEL_H -#define LV_GLTF_MODEL_H - -#include "../../../lv_conf_internal.h" -#if LV_USE_GLTF - -#include "lv_gltf_model_node.h" -#include "../../../misc/lv_types.h" -#include "../../../misc/lv_event.h" -#include "lv_gltf_model_loader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Load a glTF model from a file - * @param file_path path to the glTF file to load - * @param loader pointer to the glTF model loader instance, or NULL to create a new one - * @return pointer to the loaded glTF model, or NULL on failure - * @note If loader is NULL, an internal loader will be created and managed automatically - */ -lv_gltf_model_t * lv_gltf_data_load_from_file(const char * file_path, - lv_gltf_model_loader_t * loader); - -/** - * Load a glTF model from a byte array - * @param data pointer to the glTF data buffer - * @param data_size size of the data buffer in bytes - * @param loader pointer to the glTF model loader instance, or NULL to create a new one - * @return pointer to the loaded glTF model, or NULL on failure - * @note If loader is NULL, an internal loader will be created and managed automatically - */ -lv_gltf_model_t * lv_gltf_data_load_from_bytes(const uint8_t * data, size_t data_size, - lv_gltf_model_loader_t * loader); - - -/** - * Delete a glTF model - * @param model the gltf model to delete - */ -void lv_gltf_model_delete(lv_gltf_model_t * model); - -/** - * @brief Get the number of images in the glTF model - * - * Images in glTF are used as sources for textures and can be stored either as external files - * or embedded as base64-encoded model within the glTF file. - * - * @param model Pointer to the glTF model data structure - * @return Number of images in the model - */ -size_t lv_gltf_model_get_image_count(const lv_gltf_model_t * model); - -/** - * @brief Get the number of textures in the glTF model - * - * Textures define how images are sampled and applied to materials. Each texture references - * an image and may specify sampling parameters like filtering and wrapping modes. - * - * @param model Pointer to the glTF model data structure - * @return Number of textures in the model - */ -size_t lv_gltf_model_get_texture_count(const lv_gltf_model_t * model); - -/** - * @brief Get the number of materials in the glTF model - * - * Materials define the visual appearance of mesh primitives, including properties like - * base color, metallic/roughness values, normal maps, and other surface characteristics. - * - * @param model Pointer to the glTF model data structure - * @return Number of materials in the model - */ -size_t lv_gltf_model_get_material_count(const lv_gltf_model_t * model); - -/** - * @brief Get the number of cameras in the glTF model - * - * Cameras define viewpoints within the 3D scene and can be either perspective or - * orthographic. They are typically attached to nodes in the scene graph. - * - * @param model Pointer to the glTF model data structure - * @return Number of cameras in the model - */ -size_t lv_gltf_model_get_camera_count(const lv_gltf_model_t * model); - - -/** - * @brief Get the number of meshes in the glTF model - * - * Meshes contain the geometric model for 3D objects, including vertex positions, normals, - * texture coordinates, and indices. Each mesh can have multiple primitives with different materials. - * - * @param model Pointer to the glTF model data structure - * @return Number of meshes in the model - */ -size_t lv_gltf_model_get_mesh_count(const lv_gltf_model_t * model); - -/** - * @brief Get the number of scenes in the glTF model - * - * Scenes define the root nodes of the scene graph. A glTF file can contain multiple scenes, - * though typically only one is designated as the default scene to be displayed. - * - * @param model Pointer to the glTF model data structure - * @return Number of scenes in the model - */ -size_t lv_gltf_model_get_scene_count(const lv_gltf_model_t * model); - -/** - * @brief Get the number of animations in the glTF model - * - * Animations define keyframe-based motion for nodes in the scene, including transformations - * like translation, rotation, and scaling over time. - * - * @param model Pointer to the glTF model data structure - * @return Number of animations in the model - */ -size_t lv_gltf_model_get_animation_count(const lv_gltf_model_t * model); - -/** - * @brief Select and start playing an animation - * - * @param model Pointer to the glTF model structure - * @param index Animation number to start playing - * @return LV_RESULT_OK if the animation was started else LV_RESULT_INVALID - */ -lv_result_t lv_gltf_model_play_animation(lv_gltf_model_t * model, size_t index); - -/** - * @brief Pause the current animation - * - * @param model Pointer to the glTF model structure - */ -void lv_gltf_model_pause_animation(lv_gltf_model_t * model); - -/** - * @brief Check if an animation is currently being played - * - * @param model Pointer to the glTF model structure - */ -bool lv_gltf_model_is_animation_paused(lv_gltf_model_t * model); - -/** - * @brief Get the current selected animation. To see if it's playing see `lv_gltf_model_is_animation_paused` - * - * @param model Pointer to the glTF model structure - */ -size_t lv_gltf_model_get_animation(lv_gltf_model_t * model); - -/** - * Set the animation speed ratio - * - * The actual ratio is the value parameter / LV_GLTF_ANIM_SPEED_NORMAL - * Values greater than LV_GLTF_ANIM_SPEED_NORMAL will speed-up the animation - * Values less than LV_GLTF_ANIM_SPEED_NORMAL will slow down the animation - * - * @param model pointer to a glTF model - * @param value speed-up ratio of the animation - */ -void lv_gltf_model_set_animation_speed(lv_gltf_model_t * model, uint32_t value); - -/** - * Get the animation speed ratio - * - * The actual ratio is the return value / LV_GLTF_ANIM_SPEED_NORMAL - * - * @param model pointer to a glTF model - */ -uint32_t lv_gltf_model_get_animation_speed(const lv_gltf_model_t * model); - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_USE_GLTF*/ -#endif /*LV_GLTF_MODEL_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/libs/gltf/gltf_data/lv_gltf_model_loader.c b/src/libs/gltf/gltf_data/lv_gltf_model_loader.c index 5b2935c0d7..acf47ea0b8 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_model_loader.c +++ b/src/libs/gltf/gltf_data/lv_gltf_model_loader.c @@ -7,12 +7,10 @@ * INCLUDES *********************/ -#include "lv_gltf_model_loader.h" +#include "lv_gltf_data_internal.h" #if LV_USE_GLTF -#include "lv_gltf_data_internal.h" -#include "../../../misc/lv_rb.h" -#include "../../../stdlib/lv_sprintf.h" +#include "../../../misc/lv_rb_private.h" /********************* * DEFINES diff --git a/src/libs/gltf/gltf_data/lv_gltf_model_loader.h b/src/libs/gltf/gltf_data/lv_gltf_model_loader.h index 50bfe38b5e..a4eec774ee 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_model_loader.h +++ b/src/libs/gltf/gltf_data/lv_gltf_model_loader.h @@ -1,75 +1,2 @@ -/** - * @file lv_gltf_model_loader.h - * - */ - -#ifndef LV_GLTF_MODEL_LOADER_H -#define LV_GLTF_MODEL_LOADER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" - -#if LV_USE_GLTF - -#include "../../../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct _lv_gltf_model_loader_t lv_gltf_model_loader_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a new glTF model loader instance - * @return pointer to the newly created glTF model loader instance - */ -lv_gltf_model_loader_t * lv_gltf_model_loader_create(void); - -/** - * Store a texture ID associated with a texture hash in the loader - * @param loader pointer to the glTF model loader instance - * @param texture_hash hash value identifying the texture - * @param texture_id the texture ID to associate with the hash - */ -void lv_gltf_model_loader_store_texture(lv_gltf_model_loader_t * loader, uint32_t texture_hash, uint32_t texture_id); - -/** - * Retrieve a texture ID by its hash from the loader - * @param loader pointer to the glTF model loader instance - * @param texture_hash hash value of the texture to retrieve - * @return the texture ID associated with the hash, or 0 if not found - */ -uint32_t lv_gltf_model_loader_get_texture(lv_gltf_model_loader_t * loader, uint32_t texture_hash); - -/** - * Delete a glTF model loader instance and free its resources - * @param loader pointer to the glTF model loader instance to delete - */ -void lv_gltf_model_loader_delete(lv_gltf_model_loader_t * loader); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GLTF*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_GLTF_MODEL_LOADER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/libs/gltf/gltf_data/lv_gltf_model_node.cpp b/src/libs/gltf/gltf_data/lv_gltf_model_node.cpp index c1b9f18ef0..39122d997f 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_model_node.cpp +++ b/src/libs/gltf/gltf_data/lv_gltf_model_node.cpp @@ -12,12 +12,7 @@ #include #include "fastgltf/types.hpp" -#include "../../../misc/lv_array.h" -#include "../../../misc/lv_assert.h" -#include "../../../misc/lv_types.h" #include "../../../misc/lv_event_private.h" -#include "../../../stdlib/lv_string.h" -#include "../../../stdlib/lv_sprintf.h" /********************* * DEFINES diff --git a/src/libs/gltf/gltf_data/lv_gltf_model_node.h b/src/libs/gltf/gltf_data/lv_gltf_model_node.h index 3e1c05d0a0..398ae54171 100644 --- a/src/libs/gltf/gltf_data/lv_gltf_model_node.h +++ b/src/libs/gltf/gltf_data/lv_gltf_model_node.h @@ -1,273 +1,2 @@ -/** - * @file lv_gltf_model_node.h - * - */ - -#ifndef LV_GLTF_MODEL_NODE_H -#define LV_GLTF_MODEL_NODE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" - -#if LV_USE_GLTF - -#include "../../../misc/lv_types.h" -#include "../math/lv_3dmath.h" -#include "../../../misc/lv_event.h" - -/********************* - * DEFINES - *********************/ - -#define LV_GLTF_ANIM_SPEED_TENTH 100 -#define LV_GLTF_ANIM_SPEED_QUARTER 250 -#define LV_GLTF_ANIM_SPEED_HALF 500 -#define LV_GLTF_ANIM_SPEED_NORMAL 1000 -#define LV_GLTF_ANIM_SPEED_2X 2000 -#define LV_GLTF_ANIM_SPEED_3X 3000 -#define LV_GLTF_ANIM_SPEED_4X 4000 -#define LV_GLTF_DEFAULT_CAMERA 0 - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Get a glTF model node by its index - * - * @param data Pointer to the glTF model structure - * @param index The index of the node to retrieve - * @return Pointer to the glTF model node, or NULL if not found - */ -lv_gltf_model_node_t * lv_gltf_model_node_get_by_index(lv_gltf_model_t * data, size_t index); - -/** - * @brief Get a glTF model node by its numeric path - * - * @param data Pointer to the glTF model structure - * @param num_path The numeric path string of the node to retrieve (eg. ".0") - * @return Pointer to the glTF model node, or NULL if not found - */ -lv_gltf_model_node_t * lv_gltf_model_node_get_by_numeric_path(lv_gltf_model_t * data, const char * num_path); - -/** - * @brief Get a glTF model node by its path - * - * @param data Pointer to the glTF model structure - * @param path The path string of the node to retrieve - * @return Pointer to the glTF model node, or NULL if not found - */ -lv_gltf_model_node_t * lv_gltf_model_node_get_by_path(lv_gltf_model_t * data, const char * path); - -/** - * @brief Get the path of a glTF model node - * - * @param node Pointer to the glTF model node structure - * @return The path string of the node, or NULL if node is invalid - */ -const char * lv_gltf_model_node_get_path(lv_gltf_model_node_t * node); - -/** - * @brief Get the IP (internal pointer/identifier) of a glTF model node - * - * @param node Pointer to the glTF model node structure - * @return The IP string of the node, or NULL if node is invalid - */ -const char * lv_gltf_model_node_get_ip(lv_gltf_model_node_t * node); - -/** - * @brief Add an event callback to a glTF model node - * - * @param node Pointer to the glTF model node structure - * @param cb The event callback function to add. Use lv_event_get_param() to retrieve lv_gltf_node_data_t with the node's data. - * @param filter_list Event code filter for the callback - * @param user_data User data to pass to the callback - * @return Pointer to the event descriptor, or NULL if allocation failed - */ -lv_event_dsc_t * lv_gltf_model_node_add_event_cb(lv_gltf_model_node_t * node, lv_event_cb_t cb, - lv_event_code_t filter_list, - void * user_data); - -/** - * @brief Add an event callback to a glTF model node with world position computation enabled. Use this only when world position is needed, as computing it is an expensive operation. - * - * @param node Pointer to the glTF model node structure - * @param cb The event callback function to add. Use lv_event_get_param() to retrieve lv_gltf_node_data_t with the node's data. - * @param filter_list Event code filter for the callback - * @param user_data User data to pass to the callback - * @return Pointer to the event descriptor, or NULL if allocation failed - */ -lv_event_dsc_t * lv_gltf_model_node_add_event_cb_with_world_position(lv_gltf_model_node_t * node, lv_event_cb_t cb, - lv_event_code_t filter_list, - void * user_data); -/** - * @brief Get the number of nodes in the glTF model - * - * Nodes form the scene graph hierarchy and can contain transformations, meshes, cameras, - * or other nodes as children. They define the spatial relationships between objects in the scene. - * - * @param model Pointer to the glTF model data structure - * @return Number of nodes in the model - */ -size_t lv_gltf_model_get_node_count(const lv_gltf_model_t * model); - -/** - * @brief Set the X position of a glTF model node. The operation is queued and applied on the next rendering phase. - * - * @param node Pointer to the glTF model node structure - * @param x The X position value - * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation - */ -lv_result_t lv_gltf_model_node_set_position_x(lv_gltf_model_node_t * node, float x); - -/** - * @brief Set the Y position of a glTF model node. The operation is queued and applied on the next rendering phase. - * - * @param node Pointer to the glTF model node structure - * @param y The Y position value - * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation - */ -lv_result_t lv_gltf_model_node_set_position_y(lv_gltf_model_node_t * node, float y); - -/** - * @brief Set the Z position of a glTF model node. The operation is queued and applied on the next rendering phase. - * - * @param node Pointer to the glTF model node structure - * @param z The Z position value - * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation - */ -lv_result_t lv_gltf_model_node_set_position_z(lv_gltf_model_node_t * node, float z); - -/** - * @brief Set the X component of a glTF model node's rotation quaternion. The operation is queued and applied on the next rendering phase. - * - * @param node Pointer to the glTF model node structure - * @param x The X rotation component value - * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation - */ -lv_result_t lv_gltf_model_node_set_rotation_x(lv_gltf_model_node_t * node, float x); - -/** - * @brief Set the Y component of a glTF model node's rotation quaternion. The operation is queued and applied on the next rendering phase. - * - * @param node Pointer to the glTF model node structure - * @param y The Y rotation component value - * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation - */ -lv_result_t lv_gltf_model_node_set_rotation_y(lv_gltf_model_node_t * node, float y); - -/** - * @brief Set the Z component of a glTF model node's rotation quaternion. The operation is queued and applied on the next rendering phase. - * - * @param node Pointer to the glTF model node structure - * @param z The Z rotation component value - * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation - */ -lv_result_t lv_gltf_model_node_set_rotation_z(lv_gltf_model_node_t * node, float z); - -/** - * @brief Set the X scale of a glTF model node. The operation is queued and applied on the next rendering phase. - * - * @param node Pointer to the glTF model node structure - * @param x The X scale value - * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation - */ -lv_result_t lv_gltf_model_node_set_scale_x(lv_gltf_model_node_t * node, float x); - -/** - * @brief Set the Y scale of a glTF model node. The operation is queued and applied on the next rendering phase. - * - * @param node Pointer to the glTF model node structure - * @param y The Y scale value - * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation - */ -lv_result_t lv_gltf_model_node_set_scale_y(lv_gltf_model_node_t * node, float y); - -/** - * @brief Set the Z scale of a glTF model node. The operation is queued and applied on the next rendering phase. - * - * @param node Pointer to the glTF model node structure - * @param z The Z scale value - * @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation - */ -lv_result_t lv_gltf_model_node_set_scale_z(lv_gltf_model_node_t * node, float z); - -/** - * @brief Get the local position of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback. - * - * Local position is relative to the node's parent. - * - * This function is only valid when called from an event callback registered. - * See `lv_gltf_model_node_add_event_cb()` and `lv_gltf_model_node_add_event_cb_with_world_position()` - * - * @param e Pointer to the event structure from the callback - * @param result Pointer to lv_3dpoint_t structure to store the position (x, y, z) - * @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback or if parameters are null - */ -lv_result_t lv_gltf_model_node_get_local_position(lv_event_t * e, lv_3dpoint_t * result); - -/** - * @brief Get the world position of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback - * registered with world position enabled. - * - * World position is the absolute position in global scene coordinates. - * - * This function requires the event callback to be registered with lv_gltf_model_node_add_event_cb_with_world_position() - * as it involves complex matrix calculations that are computed on-demand. - * - * @param e Pointer to the event structure from the callback - * @param result Pointer to lv_3dpoint_t structure to store the position (x, y, z) - * @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback, world position not enabled, or if parameters are null - */ -lv_result_t lv_gltf_model_node_get_world_position(lv_event_t * e, lv_3dpoint_t * result); - -/** - * @brief Get the scale of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback. - * - * Returns the scale factors for each axis. - * - * This function is only valid when called from an event callback registered. - * See `lv_gltf_model_node_add_event_cb()` and `lv_gltf_model_node_add_event_cb_with_world_position()` - * - * @param e Pointer to the event structure from the callback - * @param result Pointer to lv_3dpoint_t structure to store the scale (x, y, z) - * @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback or if parameters are null - */ -lv_result_t lv_gltf_model_node_get_scale(lv_event_t * e, lv_3dpoint_t * result); - -/** - * @brief Get the Euler rotation of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback. - * - * Returns rotation as Euler angles in radians (x, y, z). - * - * This function is only valid when called from an event callback registered. - * See `lv_gltf_model_node_add_event_cb()` and `lv_gltf_model_node_add_event_cb_with_world_position()` - * - * @param e Pointer to the event structure from the callback - * @param result Pointer to lv_3dpoint_t structure to store the rotation in radians (x, y, z) - * @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback or if parameters are null - */ -lv_result_t lv_gltf_model_node_get_euler_rotation(lv_event_t * e, lv_3dpoint_t * result); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GLTF*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_GLTF_MODEL_NODE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/libs/gltf/gltf_environment/lv_gltf_environment.h b/src/libs/gltf/gltf_environment/lv_gltf_environment.h index 72977eb4ae..737257307f 100644 --- a/src/libs/gltf/gltf_environment/lv_gltf_environment.h +++ b/src/libs/gltf/gltf_environment/lv_gltf_environment.h @@ -1,92 +1,2 @@ -/** - * @file lv_gltf_environment.h - * - */ - -#ifndef LV_GLTF_ENVIRONMENT_H -#define LV_GLTF_ENVIRONMENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../../lv_conf_internal.h" - -#if LV_USE_GLTF - -#include "../../../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -#define LV_GLTF_DEFAULT_CUBE_MAP_RESOLUTION 128 - -/********************** - * TYPEDEFS - **********************/ - - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an IBL sampler for processing environment images - * @return pointer to the created sampler, or NULL on failure - * @note Can be safely deleted after environments are created - */ -lv_gltf_ibl_sampler_t * lv_gltf_ibl_sampler_create(void); - -/** - * Set the resolution for each cubemap face - * @param pointer to a sampler - * @param resolution of each cube map face in pixels (recommended: 64-512 for embedded) - */ -void lv_gltf_ibl_sampler_set_cube_map_pixel_resolution(lv_gltf_ibl_sampler_t * sampler, uint32_t resolution); - -/** - * Delete an IBL sampler - * @param sampler pointer to the sampler to delete - */ -void lv_gltf_ibl_sampler_delete(lv_gltf_ibl_sampler_t * sampler); - -/** - * Create an environment from an HDR or JPEG panoramic image for IBL rendering - * @param sampler IBL sampler defining output resolution (can be deleted after this call) - * @param file_path path to equirectangular environment image, or NULL to use default embedded image - * @return pointer to the created environment, or NULL on failure - * - * @note The source image will be downsampled to the sampler's texture_size - * @note The environment can be shared across multiple glTF objects - */ -lv_gltf_environment_t * lv_gltf_environment_create(lv_gltf_ibl_sampler_t * sampler, const char * file_path); - -/** - * Set the rotation angle of the environment map - * @param env pointer to the environment - * @param angle rotation angle in degrees - */ -void lv_gltf_environment_set_angle(lv_gltf_environment_t * env, float angle); - -/** - * Delete an environment - * @param environment pointer to the environment to delete - */ -void lv_gltf_environment_delete(lv_gltf_environment_t * environment); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GLTF*/ -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_GLTF_ENVIRONMENT_H*/ - - +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/libs/gltf/gltf_environment/lv_gltf_environment_private.h b/src/libs/gltf/gltf_environment/lv_gltf_environment_private.h index 3740f29d85..ec380f5660 100644 --- a/src/libs/gltf/gltf_environment/lv_gltf_environment_private.h +++ b/src/libs/gltf/gltf_environment/lv_gltf_environment_private.h @@ -13,11 +13,9 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_GLTF -#include "lv_gltf_environment.h" -#include "../../../misc/lv_types.h" #include "../../../drivers/opengles/opengl_shader/lv_opengl_shader_internal.h" /********************* diff --git a/src/libs/gltf/gltf_environment/lv_gltf_ibl_sampler.c b/src/libs/gltf/gltf_environment/lv_gltf_ibl_sampler.c index 70e3fb2d86..f96bcabed8 100644 --- a/src/libs/gltf/gltf_environment/lv_gltf_ibl_sampler.c +++ b/src/libs/gltf/gltf_environment/lv_gltf_ibl_sampler.c @@ -11,9 +11,6 @@ #if LV_USE_GLTF -#include "../../../misc/lv_math.h" -#include "../../../misc/lv_log.h" -#include "../../../stdlib/lv_string.h" #include "../../../drivers/opengles/lv_opengles_private.h" #include "../../../drivers/opengles/lv_opengles_debug.h" diff --git a/src/libs/gltf/gltf_view/assets/chromatic.c b/src/libs/gltf/gltf_view/assets/chromatic.c index 34520f010e..d691d2125b 100644 --- a/src/libs/gltf/gltf_view/assets/chromatic.c +++ b/src/libs/gltf/gltf_view/assets/chromatic.c @@ -1,4 +1,4 @@ -#include "../../../../lv_conf_internal.h" +#include "../../../../lv_public_api.h" #if LV_USE_GLTF unsigned char chromatic_jpg[] = { diff --git a/src/libs/gltf/gltf_view/assets/lv_gltf_view_shader.c b/src/libs/gltf/gltf_view/assets/lv_gltf_view_shader.c index bd29d947df..bc64ad9818 100644 --- a/src/libs/gltf/gltf_view/assets/lv_gltf_view_shader.c +++ b/src/libs/gltf/gltf_view/assets/lv_gltf_view_shader.c @@ -3,7 +3,6 @@ #if LV_USE_GLTF -#include "../../../../stdlib/lv_sprintf.h" #include static const lv_opengl_shader_t src_includes[] = { diff --git a/src/libs/gltf/gltf_view/lv_gltf.h b/src/libs/gltf/gltf_view/lv_gltf.h index 8a6ec1e465..4f9d41f575 100644 --- a/src/libs/gltf/gltf_view/lv_gltf.h +++ b/src/libs/gltf/gltf_view/lv_gltf.h @@ -1,429 +1,2 @@ -/** - * @file lv_gltf.h - * - */ - -#ifndef LV_GLTF_H -#define LV_GLTF_H - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" - -#if LV_USE_GLTF - -#include "../math/lv_3dmath.h" -#include "../../../misc/lv_types.h" -#include "../../../misc/lv_area.h" -#include "../gltf_data/lv_gltf_model.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_GLTF_AA_MODE_OFF = 0, /** Anti aliasing off*/ - LV_GLTF_AA_MODE_ON = 1, /** Anti aliasing on*/ - LV_GLTF_AA_MODE_DYNAMIC = 2, /** Anti aliasing on only when frame has no movement*/ -} lv_gltf_aa_mode_t; - -typedef enum { - LV_GLTF_BG_MODE_SOLID = 0, /** Solid background. Use `lv_obj_set_style_bg_color` to set the background color*/ - LV_GLTF_BG_MODE_ENVIRONMENT = 1, /** Environment background*/ -} lv_gltf_bg_mode_t; - - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a glTF object - * @param parent pointer to the parent object - * @return pointer to the created glTF object - */ -lv_obj_t * lv_gltf_create(lv_obj_t * parent); - -/** - * Assign an environment to a glTF object for IBL rendering - * @param obj pointer to a glTF viewer object - * @param environment pointer to the environment to use - * @note The environment can be shared across multiple glTF objects - * @note If no environment is set before attempting to load a file, - * a default one will be created for you - */ -void lv_gltf_set_environment(lv_obj_t * obj, lv_gltf_environment_t * environment); - -/** - * Load a glTF model from a file into the viewer - * @param obj pointer to a glTF viewer object - * @param path file path to the glTF model to load - * @return pointer to the loaded glTF model, or NULL on failure - */ -lv_gltf_model_t * lv_gltf_load_model_from_file(lv_obj_t * obj, const char * path); - -/** - * Load a glTF model from a byte array into the viewer - * @param obj pointer to a glTF viewer object - * @param bytes glTF raw data - * @param len glTF raw data length in bytes - * @return pointer to the loaded glTF model, or NULL on failure - */ -lv_gltf_model_t * lv_gltf_load_model_from_bytes(lv_obj_t * obj, const uint8_t * bytes, size_t len); - -/** - * Add a glTF model to the viewer. - * - * Contrary to `lv_gltf_load_model_from_file` and `lv_gltf_load_model_from_bytes`, the model - * is owned by the caller of this function meaning that it's the caller's responsibility - * to delete the model when it is no longer needed, that is, the model must outlive the viewer's lifetime. - * - * @param obj pointer to a glTF viewer object - * @param model glTF model to add to the viewer - * @return LV_RESULT_OK if the model was added to the viewer or LV_RESULT_INVALID on failure - */ -lv_result_t lv_gltf_add_model(lv_obj_t * obj, lv_gltf_model_t * model); - -/** - * Get the number of models loaded in the glTF viewer - * @param obj pointer to a glTF viewer object - * @return the total number of models in the viewer - */ -size_t lv_gltf_get_model_count(lv_obj_t * obj); - -/** - * Get a specific model by its index - * @param obj pointer to a glTF viewer object - * @param id index of the model to retrieve (0-based) - * @return pointer to the model at the specified index, or NULL if index is invalid - */ -lv_gltf_model_t * lv_gltf_get_model_by_index(const lv_obj_t * obj, size_t id); - -/** - * Get the primary model from the glTF viewer - * The primary model is the first model added to the viewer and can be used - * for camera selection and other primary operations - * @param obj pointer to a glTF viewer object - * @return pointer to the primary model, or NULL if no models are loaded - */ -lv_gltf_model_t * lv_gltf_get_primary_model(const lv_obj_t * obj); - -/** - * Set the yaw (horizontal rotation) of the camera - * @param obj pointer to a glTF viewer object - * @param yaw yaw angle in degrees - */ -void lv_gltf_set_yaw(lv_obj_t * obj, float yaw); - -/** - * Get the yaw (horizontal rotation) of the camera - * @param obj pointer to a glTF viewer object - * @return yaw angle in degrees - */ -float lv_gltf_get_yaw(const lv_obj_t * obj); - -/** - * Set the pitch (vertical rotation) of the camera - * @param obj pointer to a glTF viewer object - * @param pitch pitch angle in degrees - */ -void lv_gltf_set_pitch(lv_obj_t * obj, float pitch); - -/** - * Get the pitch (vertical rotation) of the camera - * @param obj pointer to a glTF viewer object - * @return pitch angle in degrees - */ -float lv_gltf_get_pitch(const lv_obj_t * obj); - -/** - * Set the camera distance from the focal point - * @param obj pointer to a glTF viewer object - * @param value distance value - */ -void lv_gltf_set_distance(lv_obj_t * obj, float value); - -/** - * Get the camera distance scale factor from the focal point - * @param obj pointer to a glTF viewer object - * @return distance scaling factor value - */ -float lv_gltf_get_distance(const lv_obj_t * obj); - -/** - * Get the camera distance from the focal point in world units - * @param obj pointer to a GLTF viewer object - * @return world unit distance value - */ -float lv_gltf_get_world_distance(const lv_obj_t * obj); - -/********************** - * Viewport Functions - **********************/ - -/** - * Set the field of view - * @param obj pointer to a glTF viewer object - * @param value vertical FOV in degrees. If zero, the view will be orthographic (non-perspective) - */ -void lv_gltf_set_fov(lv_obj_t * obj, float value); - -/** - * Get the field of view - * @param obj pointer to a glTF viewer object - * @return vertical FOV in degrees - */ -float lv_gltf_get_fov(const lv_obj_t * obj); - -/********************** - * Focal Point Functions - **********************/ - -/** - * Set the X coordinate of the camera focal point - * @param obj pointer to a glTF viewer object - * @param value X coordinate - */ -void lv_gltf_set_focal_x(lv_obj_t * obj, float value); - -/** - * Get the X coordinate of the camera focal point - * @param obj pointer to a glTF viewer object - * @return X coordinate - */ -float lv_gltf_get_focal_x(const lv_obj_t * obj); - -/** - * Set the Y coordinate of the camera focal point - * @param obj pointer to a glTF viewer object - * @param value Y coordinate - */ -void lv_gltf_set_focal_y(lv_obj_t * obj, float value); - -/** - * Get the Y coordinate of the camera focal point - * @param obj pointer to a glTF viewer object - * @return Y coordinate - */ -float lv_gltf_get_focal_y(const lv_obj_t * obj); - -/** - * Set the Z coordinate of the camera focal point - * @param obj pointer to a glTF viewer object - * @param value Z coordinate - */ -void lv_gltf_set_focal_z(lv_obj_t * obj, float value); - -/** - * Get the Z coordinate of the camera focal point - * @param obj pointer to a glTF viewer object - * @return Z coordinate - */ -float lv_gltf_get_focal_z(const lv_obj_t * obj); - -/** - * Set the focal coordinates to the center point of the model object - * @param obj pointer to a glTF viewer object - * @param model a model attached to this viewer or NULL for the first model - */ -void lv_gltf_recenter(lv_obj_t * obj, lv_gltf_model_t * model); - -/********************** - * Scene Control Functions - **********************/ - -/** - * Set the active camera index - * The camera is selected from the first glTF model added to the viewer - * - * @param obj pointer to a glTF viewer object - * @param value camera index (0 for default camera, 1+ for scene camera index) - * @note Values higher than the scene's camera count will be clamped to the maximum available camera index - */ -void lv_gltf_set_camera(lv_obj_t * obj, uint32_t value); - -/** - * Get the active camera index - * @param obj pointer to a glTF viewer object - * @return active camera index - */ -uint32_t lv_gltf_get_camera(const lv_obj_t * obj); - -/** - * Get the number of cameras in the first glTF model added to the viewer - * This count represents the valid range for the camera index parameter - * used with lv_gltf_set_camera() - * - * To get the camera count of other models, call - * lv_gltf_model_get_camera_count(model) directly with the specific model - * - * @param obj pointer to a glTF viewer object - * @return number of available cameras - */ -uint32_t lv_gltf_get_camera_count(const lv_obj_t * obj); - -/** - * DEPRECATED. See `lv_gltf_model_set_animation_speed` - * - * Set the animation speed ratio - * - * The actual ratio is the value parameter / LV_GLTF_ANIM_SPEED_NORMAL - * Values greater than LV_GLTF_ANIM_SPEED_NORMAL will speed-up the animation - * Values less than LV_GLTF_ANIM_SPEED_NORMAL will slow down the animation - * - * @param obj pointer to a glTF viewer object - * @param value speed-up ratio of the animation - */ -void lv_gltf_set_animation_speed(lv_obj_t * obj, uint32_t value); - -/** - * DEPRECATED. See `lv_gltf_model_get_animation_speed` - * - * Get the animation speed ratio - * - * The actual ratio is the return value / LV_GLTF_ANIM_SPEED_NORMAL - * - * @param obj pointer to a glTF viewer object - */ -uint32_t lv_gltf_get_animation_speed(const lv_obj_t * obj); - -/********************** - * Visual Settings Functions - **********************/ - -/** - * Set the background mode - * @param obj pointer to a glTF viewer object - * @param value background mode - */ -void lv_gltf_set_background_mode(lv_obj_t * obj, lv_gltf_bg_mode_t value); - -/** - * Get the background mode - * @param obj pointer to a glTF viewer object - * @return background mode - */ -lv_gltf_bg_mode_t lv_gltf_get_background_mode(const lv_obj_t * obj); - -/** - * Set the background blur amount - * @param obj pointer to a glTF viewer object - * @param value blur amount between 0 and 100 - */ -void lv_gltf_set_background_blur(lv_obj_t * obj, uint32_t value); - -/** - * Get the background blur amount - * @param obj pointer to a glTF viewer object - * @return blur amount between 0 and 100 - */ -uint32_t lv_gltf_get_background_blur(const lv_obj_t * obj); - -/** - * Set the environmental brightness/power - * @param obj pointer to a glTF viewer object - * @param value brightness multiplier - */ -void lv_gltf_set_env_brightness(lv_obj_t * obj, uint32_t value); - -/** - * Get the environmental brightness/power - * @param obj pointer to a glTF viewer object - * @return brightness multiplier - */ -uint32_t lv_gltf_get_env_brightness(const lv_obj_t * obj); - -/** - * Set the image exposure level - * @param obj pointer to a glTF viewer object - * @param value exposure level (1.0 is default) - */ -void lv_gltf_set_image_exposure(lv_obj_t * obj, float value); - -/** - * Get the image exposure level - * @param obj pointer to a glTF viewer object - * @return exposure level - */ -float lv_gltf_get_image_exposure(const lv_obj_t * obj); - -/********************** - * Rendering Functions - **********************/ - -/** - * Set the anti-aliasing mode - * @param obj pointer to a glTF viewer object - * @param value anti-aliasing mode - */ -void lv_gltf_set_antialiasing_mode(lv_obj_t * obj, lv_gltf_aa_mode_t value); - -/** - * Get the anti-aliasing mode - * @param obj pointer to a glTF viewer object - * @return anti-aliasing mode - */ -lv_gltf_aa_mode_t lv_gltf_get_antialiasing_mode(const lv_obj_t * obj); - -/*********************** - * Raycasting Functions - ***********************/ - -/** - * Get the point that a given ray intersects with a specified plane at, if any - * @param ray the intersection test ray - * @param screen_y the plane to test ray intersection with - * @param collision_point output lv_3dpoint_t holder, values are only valid if true is the return value - * @return LV_RESULT_OK if intersection, LV_RESULT_INVALID if no intersection - */ -lv_result_t lv_intersect_ray_with_plane(const lv_3dray_t * ray, const lv_3dplane_t * plane, - lv_3dpoint_t * collision_point); - -/** - * Get a plane that faces the current view camera, centered some units in front of it - * @param obj pointer to a GLTF viewer object - * @param distance distance in front of the camera to set the plane, in world units. see lv_gltf_get_world_distance to get the auto-distance - * @return camera facing plane - */ -lv_3dplane_t lv_gltf_get_current_view_plane(lv_obj_t * obj, float distance); - -/** - * Calculates a ray originating from the camera and passing through the specified mouse position on the screen. - * @param obj pointer to a GLTF viewer object - * @param screen_pos screen coordinate, in pixels - * @return mouse point ray - */ -lv_3dray_t lv_gltf_get_ray_from_2d_coordinate(lv_obj_t * obj, const lv_point_t * screen_pos); - - -/** - * Get the screen position of a 3d point - * @param obj pointer to a GLTF viewer object - * @param world_pos world position to convert - * @param lv_point_t the resulting point, in pixels. only valid if return value is true - * @return LV_RESULT_OK if conversion valid, LV_RESULT_INVALID if no valid conversion - */ -lv_result_t lv_gltf_world_to_screen(lv_obj_t * obj, const lv_3dpoint_t world_pos, lv_point_t * screen_pos); - - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} -#endif - -#endif /*LV_USE_GLTF*/ - -#endif /*LV_GLTF_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/libs/gltf/gltf_view/lv_gltf_view.cpp b/src/libs/gltf/gltf_view/lv_gltf_view.cpp index eb239c4651..6c86551aac 100644 --- a/src/libs/gltf/gltf_view/lv_gltf_view.cpp +++ b/src/libs/gltf/gltf_view/lv_gltf_view.cpp @@ -11,15 +11,10 @@ #if LV_USE_GLTF -#include "../gltf_data/lv_gltf_model.h" #include "../gltf_data/lv_gltf_data_internal.hpp" #include "../gltf_data/lv_gltf_data_internal.h" -#include "../../../draw/lv_draw_3d.h" #include "../fastgltf/lv_fastgltf.hpp" #include "../../../core/lv_obj_class_private.h" -#include "../../../misc/lv_types.h" -#include "../../../widgets/3dtexture/lv_3dtexture.h" -#include "../gltf_environment/lv_gltf_environment.h" #include "assets/lv_gltf_view_shader.h" #include #include diff --git a/src/libs/gltf/gltf_view/lv_gltf_view_internal.h b/src/libs/gltf/gltf_view/lv_gltf_view_internal.h index 7a9ccc560f..8a53d07dc1 100644 --- a/src/libs/gltf/gltf_view/lv_gltf_view_internal.h +++ b/src/libs/gltf/gltf_view/lv_gltf_view_internal.h @@ -10,12 +10,10 @@ * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_GLTF -#include "lv_gltf.h" -#include "../../../misc/lv_types.h" #include "../../../drivers/opengles/opengl_shader/lv_opengl_shader_internal.h" #include "../../../widgets/3dtexture/lv_3dtexture_private.h" #include "../gltf_data/lv_gltf_data_internal.h" diff --git a/src/libs/gltf/gltf_view/lv_gltf_view_render.cpp b/src/libs/gltf/gltf_view/lv_gltf_view_render.cpp index 2d5b4ddc58..621870f51c 100644 --- a/src/libs/gltf/gltf_view/lv_gltf_view_render.cpp +++ b/src/libs/gltf/gltf_view/lv_gltf_view_render.cpp @@ -14,9 +14,6 @@ #include "../gltf_data/lv_gltf_data_internal.hpp" #include "../fastgltf/lv_fastgltf.hpp" -#include "../../../misc/lv_types.h" -#include "../../../misc/lv_array.h" -#include "../../../stdlib/lv_sprintf.h" #include "../../../drivers/opengles/lv_opengles_private.h" #include "../../../drivers/opengles/lv_opengles_debug.h" #include "../math/lv_gltf_math.hpp" diff --git a/src/libs/gltf/gltf_view/lv_gltf_view_shader.cpp b/src/libs/gltf/gltf_view/lv_gltf_view_shader.cpp index 92f828f7b8..e9d4d7b2e2 100644 --- a/src/libs/gltf/gltf_view/lv_gltf_view_shader.cpp +++ b/src/libs/gltf/gltf_view/lv_gltf_view_shader.cpp @@ -13,11 +13,6 @@ #include "../gltf_data/lv_gltf_data_internal.hpp" #include "../gltf_data/lv_gltf_data_internal.h" #include "../../../drivers/opengles/opengl_shader/lv_opengl_shader_internal.h" -#include "../../../misc/lv_array.h" -#include "../../../misc/lv_assert.h" -#include "../../../misc/lv_types.h" -#include "../../../stdlib/lv_sprintf.h" -#include "../../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/libs/gltf/math/lv_3dmath.c b/src/libs/gltf/math/lv_3dmath.c index 038ddedc6f..64472b340f 100644 --- a/src/libs/gltf/math/lv_3dmath.c +++ b/src/libs/gltf/math/lv_3dmath.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_3dmath.h" +#include "../../../lv_public_api.h" #if LV_USE_GLTF /********************* diff --git a/src/libs/gltf/math/lv_3dmath.h b/src/libs/gltf/math/lv_3dmath.h index 0360e968e5..098ea2aeb6 100644 --- a/src/libs/gltf/math/lv_3dmath.h +++ b/src/libs/gltf/math/lv_3dmath.h @@ -1,72 +1,2 @@ -/** - * @file lv_3dmath.h - * - */ - -#ifndef LV_3DMATH_H -#define LV_3DMATH_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" - -#if LV_USE_GLTF - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - float x; - float y; - float z; -} lv_3dpoint_t; - -typedef struct { - float x; - float y; - float z; - float w; -} lv_quaternion_t; - -typedef struct { - lv_3dpoint_t origin; - lv_3dpoint_t direction; -} lv_3dplane_t; - -typedef lv_3dplane_t lv_3dray_t; - - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Get a plane that faces upward, centered at a given height - * @param elevation elevation of the ground plane, in world units. this is usually zero - * @return ground plane - */ -lv_3dplane_t lv_get_ground_plane(float elevation); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GLTF*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - - -#endif /*LV_3DMATH_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../../include/lvgl/lvgl.h" diff --git a/src/libs/gltf/math/lv_gltf_math.hpp b/src/libs/gltf/math/lv_gltf_math.hpp index fadd1f57c9..bb3002fffd 100644 --- a/src/libs/gltf/math/lv_gltf_math.hpp +++ b/src/libs/gltf/math/lv_gltf_math.hpp @@ -10,7 +10,7 @@ * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_GLTF diff --git a/src/libs/gstreamer/lv_gstreamer.h b/src/libs/gstreamer/lv_gstreamer.h index 3d31bfa274..ae1ef999ac 100644 --- a/src/libs/gstreamer/lv_gstreamer.h +++ b/src/libs/gstreamer/lv_gstreamer.h @@ -1,202 +1,2 @@ -/** - * @file lv_gstreamer.h - * - */ - -#ifndef LV_GSTREAMER_H -#define LV_GSTREAMER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_GSTREAMER -#include "../../core/lv_obj.h" - - -/********************* - * DEFINES - *********************/ - - -/* Using the `URI` "factory", we can specify various URI schemes as media sources including - * - local files (file://) - * - web streams (http://, https://) - * - RTSP streams (rtsp://) - * - UDP streams (udp://) - * and many others. - * GStreamer's uridecodebin automatically selects the appropriate - * source element and decoder based on the URI scheme and media format. */ -#define LV_GSTREAMER_FACTORY_URI_DECODE "uridecodebin" -#define LV_GSTREAMER_PROPERTY_URI_DECODE "uri" - -#define LV_GSTREAMER_FACTORY_FILE "filesrc" -#define LV_GSTREAMER_PROPERTY_FILE "location" - -#define LV_GSTREAMER_FACTORY_HTTP "souphttpsrc" -#define LV_GSTREAMER_PROPERTY_HTTP "location" - -#define LV_GSTREAMER_FACTORY_HTTPS "souphttpsrc" -#define LV_GSTREAMER_PROPERTY_HTTPS "location" - -#define LV_GSTREAMER_FACTORY_V4L2_CAMERA "v4l2src" -#define LV_GSTREAMER_PROPERTY_V4L2_CAMERA "device" - -#define LV_GSTREAMER_FACTORY_ALSA_AUDIO "alsasrc" -#define LV_GSTREAMER_PROPERTY_ALSA_AUDIO "device" - -#define LV_GSTREAMER_FACTORY_PULSE_AUDIO "pulsesrc" -#define LV_GSTREAMER_PROPERTY_PULSE_AUDIO "device" - -#define LV_GSTREAMER_FACTORY_TEST_AUDIO "audiotestsrc" -#define LV_GSTREAMER_PROPERTY_TEST_AUDIO NULL - -#define LV_GSTREAMER_FACTORY_TEST_VIDEO "videotestsrc" -#define LV_GSTREAMER_PROPERTY_TEST_VIDEO NULL - -#define LV_GSTREAMER_FACTORY_APP "appsrc" -#define LV_GSTREAMER_PROPERTY_APP NULL - -#define LV_GSTREAMER_FACTORY_WEBRTCSRC "webrtcsrc" -#define LV_GSTREAMER_PROPERTY_WEBRTCSRC "signaller::uri" - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_GSTREAMER_STATE_NULL, - LV_GSTREAMER_STATE_READY, - LV_GSTREAMER_STATE_PAUSED, - LV_GSTREAMER_STATE_PLAYING -} lv_gstreamer_state_t; - -typedef enum { - LV_GSTREAMER_STREAM_STATE_START, - LV_GSTREAMER_STREAM_STATE_PLAY, - LV_GSTREAMER_STREAM_STATE_PAUSE, - LV_GSTREAMER_STREAM_STATE_STOP, - LV_GSTREAMER_STREAM_STATE_END -} lv_gstreamer_stream_state_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a gstreamer object - * @param parent pointer to an object, it will be the parent of the new gstreamer - * @return pointer to the created gstreamer - */ -lv_obj_t * lv_gstreamer_create(lv_obj_t * parent); - -/** - * Add a source to this gstreamer object - * @param gstreamer pointer to a gstreamer object - * @param factory_name the factory name for the source of this gstreamer object. - * for common factory names, check `LV_GSTREAMER_FACTORY_XXX` defines - * @param property the property name for the gstreamer source object - * for common properties, see `LV_GSTREAMER_PROPERTY_XXX` defines - * Passing NULL will create the source object but not set its source - * @param source the property value for the gstreamer source object - * Passing NULL will create the source object but not set its source - * @return LV_RESULT_OK if the source was correctly set else LV_RESULT_INVALID - */ -lv_result_t lv_gstreamer_set_src(lv_obj_t * gstreamer, const char * factory_name, const char * property, - const char * source); - -/** - * Play this gstreamer - * @param gstreamer pointer to a gstreamer object - */ -void lv_gstreamer_play(lv_obj_t * gstreamer); - -/** - * Pause this gstreamer - * @param gstreamer pointer to a gstreamer object - */ -void lv_gstreamer_pause(lv_obj_t * gstreamer); - -/** - * Stop this gstreamer - * @param gstreamer pointer to a gstreamer object - */ -void lv_gstreamer_stop(lv_obj_t * gstreamer); - -/** - * Seek a position in this gstreamer - * @param gstreamer pointer to a gstreamer object - * @param position position to seek to - */ -void lv_gstreamer_set_position(lv_obj_t * gstreamer, uint32_t position); - -/** - * Get the duration of this gstreamer - * @param gstreamer pointer to a gstreamer object - * @return the duration (in ms) of the gstreamer object - */ -uint32_t lv_gstreamer_get_duration(lv_obj_t * gstreamer); - -/** - * Get the position of this gstreamer - * @param gstreamer pointer to a gstreamer object - * @return the position (in ms) of the gstreamer object - */ -uint32_t lv_gstreamer_get_position(lv_obj_t * gstreamer); - -/** - * Get the state of this gstreamer - * @param gstreamer pointer to a gstreamer object - */ -lv_gstreamer_state_t lv_gstreamer_get_state(lv_obj_t * gstreamer); - -/** - * Set the volume of this gstreamer - * @param gstreamer pointer to a gstreamer object - * @param volume the value to set in the range [0..100]. Higher values are clamped - */ -void lv_gstreamer_set_volume(lv_obj_t * gstreamer, uint8_t volume); - -/** - * Get the volume of this gstreamer - * @param gstreamer pointer to a gstreamer object - * @return the volume for this gstreamer - */ -uint8_t lv_gstreamer_get_volume(lv_obj_t * gstreamer); - -/** - * Set the speed rate of this gstreamer - * @param gstreamer pointer to a gstreamer object - * @param rate the rate factor. Example values: - * - 256: 1x - * - <256: slow down - * - >256: speed up - * - 128: 0.5x - * - 512: 2x - */ -void lv_gstreamer_set_rate(lv_obj_t * gstreamer, uint32_t rate); - -/** - * Retrieve the stream state from a STATE_CHANGED event callback - * @param e pointer to the event - * @return the stream state or -1 if `e` is invalid (i.e. NULL or does not match expected event) - */ -lv_gstreamer_stream_state_t lv_gstreamer_get_stream_state(lv_event_t * e); - - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GSTREAMER*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_GSTREAMER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/gstreamer/lv_gstreamer_internal.h b/src/libs/gstreamer/lv_gstreamer_internal.h index 2c8c123e27..4a348962ff 100644 --- a/src/libs/gstreamer/lv_gstreamer_internal.h +++ b/src/libs/gstreamer/lv_gstreamer_internal.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_GSTREAMER @@ -23,8 +23,6 @@ extern "C" { #include "../../widgets/image/lv_image_private.h" -#include "lv_gstreamer.h" - /********************* * DEFINES *********************/ diff --git a/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c b/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c index f16fa04136..a6fbcb34ef 100644 --- a/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c +++ b/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c @@ -6,11 +6,12 @@ /********************* * INCLUDES *********************/ -#include "../../draw/lv_image_decoder_private.h" -#include "../../../lvgl.h" + +#include "../../lv_public_api.h" + #if LV_USE_LIBJPEG_TURBO -#include "lv_libjpeg_turbo.h" +#include "../../draw/lv_image_decoder_private.h" #include #include #include diff --git a/src/libs/libjpeg_turbo/lv_libjpeg_turbo.h b/src/libs/libjpeg_turbo/lv_libjpeg_turbo.h index 177c83a614..39b84f10b9 100644 --- a/src/libs/libjpeg_turbo/lv_libjpeg_turbo.h +++ b/src/libs/libjpeg_turbo/lv_libjpeg_turbo.h @@ -1,48 +1,2 @@ -/** - * @file lv_libjpeg_turbo.h - * - */ - -#ifndef LV_LIBJPEG_TURBO_H -#define LV_LIBJPEG_TURBO_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_LIBJPEG_TURBO - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Register the JPEG-Turbo decoder functions in LVGL - */ -void lv_libjpeg_turbo_init(void); - -void lv_libjpeg_turbo_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_LIBJPEG_TURBO*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_LIBJPEG_TURBO_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/libpng/lv_libpng.c b/src/libs/libpng/lv_libpng.c index a2dcfad984..eecb07a2bf 100644 --- a/src/libs/libpng/lv_libpng.c +++ b/src/libs/libpng/lv_libpng.c @@ -6,11 +6,12 @@ /********************* * INCLUDES *********************/ -#include "../../draw/lv_image_decoder_private.h" -#include "../../../lvgl.h" + +#include "../../lv_public_api.h" + #if LV_USE_LIBPNG -#include "lv_libpng.h" +#include "../../draw/lv_image_decoder_private.h" #include #include #include "../../core/lv_global.h" diff --git a/src/libs/libpng/lv_libpng.h b/src/libs/libpng/lv_libpng.h index 12794585d0..f18e3b4c75 100644 --- a/src/libs/libpng/lv_libpng.h +++ b/src/libs/libpng/lv_libpng.h @@ -1,48 +1,2 @@ -/** - * @file lv_libpng.h - * - */ - -#ifndef LV_LIBPNG_H -#define LV_LIBPNG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_LIBPNG - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Register the PNG decoder functions in LVGL - */ -void lv_libpng_init(void); - -void lv_libpng_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_LIBPNG*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_LIBPNG_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/libwebp/lv_libwebp.c b/src/libs/libwebp/lv_libwebp.c index 3806d00734..fc3da8f51f 100644 --- a/src/libs/libwebp/lv_libwebp.c +++ b/src/libs/libwebp/lv_libwebp.c @@ -6,11 +6,12 @@ /********************* * INCLUDES *********************/ -#include "../../draw/lv_image_decoder_private.h" -#include "../../../lvgl.h" + +#include "../../lv_public_api.h" + #if LV_USE_LIBWEBP -#include "lv_libwebp.h" +#include "../../draw/lv_image_decoder_private.h" #include #include "../../core/lv_global.h" diff --git a/src/libs/libwebp/lv_libwebp.h b/src/libs/libwebp/lv_libwebp.h index 3a19d04a2c..1a2e76118a 100644 --- a/src/libs/libwebp/lv_libwebp.h +++ b/src/libs/libwebp/lv_libwebp.h @@ -1,48 +1,2 @@ -/** - * @file lv_libwebp.h - * - */ - -#ifndef LV_LIBWEBP_H -#define LV_LIBWEBP_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_LIBWEBP - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Register the WEBP decoder functions in LVGL - */ -void lv_libwebp_init(void); - -void lv_libwebp_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_LIBWEBP*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_LIBWEBP_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/lodepng/lv_lodepng.c b/src/libs/lodepng/lv_lodepng.c index f61db5bd6f..70fc38cd63 100644 --- a/src/libs/lodepng/lv_lodepng.c +++ b/src/libs/lodepng/lv_lodepng.c @@ -6,12 +6,14 @@ /********************* * INCLUDES *********************/ -#include "../../draw/lv_image_decoder_private.h" -#include "../../../lvgl.h" -#include "../../core/lv_global.h" + +#include "../../lv_public_api.h" + #if LV_USE_LODEPNG -#include "lv_lodepng.h" +#include "../../draw/lv_image_decoder_private.h" +#include "../../core/lv_global.h" + #include "lodepng.h" #include diff --git a/src/libs/lodepng/lv_lodepng.h b/src/libs/lodepng/lv_lodepng.h index f3dc4b7713..95f94a73b9 100644 --- a/src/libs/lodepng/lv_lodepng.h +++ b/src/libs/lodepng/lv_lodepng.h @@ -1,48 +1,2 @@ -/** - * @file lv_lodepng.h - * - */ - -#ifndef LV_LODEPNG_H -#define LV_LODEPNG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_LODEPNG - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Register the PNG decoder functions in LVGL - */ -void lv_lodepng_init(void); - -void lv_lodepng_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_LODEPNG*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_LODEPNG_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/lz4/lz4.c b/src/libs/lz4/lz4.c index 852443a287..1d4e5fa235 100644 --- a/src/libs/lz4/lz4.c +++ b/src/libs/lz4/lz4.c @@ -32,7 +32,7 @@ - LZ4 source repository : https://github.com/lz4/lz4 */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_LZ4_INTERNAL /*-************************************ diff --git a/src/libs/lz4/lz4.h b/src/libs/lz4/lz4.h index bbb3f0423d..81d4f7d952 100644 --- a/src/libs/lz4/lz4.h +++ b/src/libs/lz4/lz4.h @@ -33,7 +33,7 @@ - LZ4 source repository : https://github.com/lz4/lz4 */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_LZ4_INTERNAL #if defined (__cplusplus) extern "C" { diff --git a/src/libs/nanovg/nanovg.c b/src/libs/nanovg/nanovg.c index 9e82e23b93..02d92faea8 100644 --- a/src/libs/nanovg/nanovg.c +++ b/src/libs/nanovg/nanovg.c @@ -16,14 +16,11 @@ // 3. This notice may not be removed or altered from any source distribution. // -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_NANOVG #include -#include "../../stdlib/lv_mem.h" -#include "../../stdlib/lv_string.h" -#include "../../misc/lv_log.h" #include "nanovg.h" diff --git a/src/libs/nanovg/nanovg.h b/src/libs/nanovg/nanovg.h index ece8bd60be..670d181246 100644 --- a/src/libs/nanovg/nanovg.h +++ b/src/libs/nanovg/nanovg.h @@ -23,7 +23,7 @@ extern "C" { #endif -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_NANOVG diff --git a/src/libs/nanovg/nanovg_gl.h b/src/libs/nanovg/nanovg_gl.h index 0796c93461..4d924b0434 100644 --- a/src/libs/nanovg/nanovg_gl.h +++ b/src/libs/nanovg/nanovg_gl.h @@ -18,7 +18,7 @@ #ifndef NANOVG_GL_H #define NANOVG_GL_H -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_NANOVG @@ -116,11 +116,7 @@ enum NVGimageFlagsGL { #include #include "nanovg.h" -#include "../../stdlib/lv_mem.h" -#include "../../stdlib/lv_string.h" -#include "../../stdlib/lv_sprintf.h" -#include "../../misc/lv_log.h" -#include "../../misc/lv_profiler.h" +#include "../../lv_public_api.h" enum GLNVGuniformLoc { GLNVG_LOC_VIEWSIZE, diff --git a/src/libs/nanovg/nanovg_gl_utils.h b/src/libs/nanovg/nanovg_gl_utils.h index 93aea96003..8aca7b16a4 100644 --- a/src/libs/nanovg/nanovg_gl_utils.h +++ b/src/libs/nanovg/nanovg_gl_utils.h @@ -18,9 +18,7 @@ #ifndef NANOVG_GL_UTILS_H #define NANOVG_GL_UTILS_H -#include "../../lv_conf_internal.h" -#include "../../stdlib/lv_mem.h" -#include "../../stdlib/lv_string.h" +#include "../../lv_public_api.h" #if LV_USE_NANOVG diff --git a/src/libs/qrcode/lv_qrcode.h b/src/libs/qrcode/lv_qrcode.h index 005682415d..59a11afbf7 100644 --- a/src/libs/qrcode/lv_qrcode.h +++ b/src/libs/qrcode/lv_qrcode.h @@ -1,100 +1,2 @@ -/** - * @file lv_qrcode.h - * - */ - -#ifndef LV_QRCODE_H -#define LV_QRCODE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../misc/lv_color.h" -#include "../../misc/lv_types.h" -#include "../../widgets/canvas/lv_canvas.h" -#include LV_STDBOOL_INCLUDE -#include LV_STDINT_INCLUDE -#if LV_USE_QRCODE - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_qrcode_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an empty QR code (an `lv_canvas`) object. - * @param parent point to an object where to create the QR code - * @return pointer to the created QR code object - */ -lv_obj_t * lv_qrcode_create(lv_obj_t * parent); - -/** - * Set QR code size. - * @param obj pointer to a QR code object - * @param size width and height of the QR code - */ -void lv_qrcode_set_size(lv_obj_t * obj, int32_t size); - -/** - * Set QR code dark color. - * @param obj pointer to a QR code object - * @param color dark color of the QR code - */ -void lv_qrcode_set_dark_color(lv_obj_t * obj, lv_color_t color); - -/** - * Set QR code light color. - * @param obj pointer to a QR code object - * @param color light color of the QR code - */ -void lv_qrcode_set_light_color(lv_obj_t * obj, lv_color_t color); - -/** - * Set the data of a QR code object - * @param obj pointer to a QR code object - * @param data data to display - * @param data_len length of data in bytes - * @return LV_RESULT_OK: if no error; LV_RESULT_INVALID: on error - */ -lv_result_t lv_qrcode_update(lv_obj_t * obj, const void * data, uint32_t data_len); - -/** - * Helper function to set the data of a QR code object - * @param obj pointer to a QR code object - * @param data data to display as a string - */ -void lv_qrcode_set_data(lv_obj_t * obj, const char * data); - -/** - * Enable or disable quiet zone. - * Quiet zone is the area around the QR code where no data is encoded. - * @param obj pointer to a QR code object - * @param enable true: enable quiet zone; false: disable quiet zone - */ -void lv_qrcode_set_quiet_zone(lv_obj_t * obj, bool enable); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_QRCODE*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_QRCODE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/qrcode/lv_qrcode_private.h b/src/libs/qrcode/lv_qrcode_private.h index 86acae290c..a44fdf8894 100644 --- a/src/libs/qrcode/lv_qrcode_private.h +++ b/src/libs/qrcode/lv_qrcode_private.h @@ -14,11 +14,12 @@ extern "C" { * INCLUDES *********************/ -#include "../../widgets/canvas/lv_canvas_private.h" -#include "lv_qrcode.h" +#include "../../lv_public_api.h" #if LV_USE_QRCODE +#include "../../widgets/canvas/lv_canvas_private.h" + /********************* * DEFINES *********************/ diff --git a/src/libs/qrcode/qrcodegen.c b/src/libs/qrcode/qrcodegen.c index f501a248f4..1ca38172a4 100644 --- a/src/libs/qrcode/qrcodegen.c +++ b/src/libs/qrcode/qrcodegen.c @@ -22,7 +22,7 @@ */ #include "qrcodegen.h" -#include "../../misc/lv_assert.h" +#include "../../lv_public_api.h" #if LV_USE_QRCODE #include diff --git a/src/libs/rle/lv_rle.c b/src/libs/rle/lv_rle.c index e715b7cc17..baa15ec105 100644 --- a/src/libs/rle/lv_rle.c +++ b/src/libs/rle/lv_rle.c @@ -6,8 +6,7 @@ * INCLUDES *********************/ -#include "../../stdlib/lv_string.h" -#include "lv_rle.h" +#include "lv_rle_private.h" #if LV_USE_RLE diff --git a/src/libs/rle/lv_rle.h b/src/libs/rle/lv_rle.h index 02ab6a3491..16034a1429 100644 --- a/src/libs/rle/lv_rle.h +++ b/src/libs/rle/lv_rle.h @@ -1,46 +1,3 @@ -/** - * @file lv_rle.h - * - */ +#warning "lv_rle" is no longer part of the public API and will be removed in the future. -#ifndef LV_RLE_H -#define LV_RLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_RLE - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -uint32_t lv_rle_decompress(const uint8_t * input, - uint32_t input_buff_len, uint8_t * output, - uint32_t output_buff_len, uint8_t blk_size); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_RLE*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_RLE_H*/ +#include "lv_rle_private.h" diff --git a/src/libs/rle/lv_rle_private.h b/src/libs/rle/lv_rle_private.h new file mode 100644 index 0000000000..c9712c1aa3 --- /dev/null +++ b/src/libs/rle/lv_rle_private.h @@ -0,0 +1,46 @@ +/** + * @file lv_rle_private.h + * + */ + +#ifndef LV_RLE_PRIVATE_H +#define LV_RLE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../lv_public_api.h" + +#if LV_USE_RLE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +uint32_t lv_rle_decompress(const uint8_t * input, + uint32_t input_buff_len, uint8_t * output, + uint32_t output_buff_len, uint8_t blk_size); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_RLE*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_RLE_PRIVATE_H*/ diff --git a/src/libs/rlottie/lv_rlottie.h b/src/libs/rlottie/lv_rlottie.h index 44bcf2ef4d..8fdadd79c2 100644 --- a/src/libs/rlottie/lv_rlottie.h +++ b/src/libs/rlottie/lv_rlottie.h @@ -1,58 +1,2 @@ -/** - * @file lv_rlottie.h - * - */ - -#ifndef LV_RLOTTIE_H -#define LV_RLOTTIE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_RLOTTIE - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_RLOTTIE_CTRL_FORWARD = 0, - LV_RLOTTIE_CTRL_BACKWARD = 1, - LV_RLOTTIE_CTRL_PAUSE = 2, - LV_RLOTTIE_CTRL_PLAY = 0, /* Yes, play = 0 is the default mode */ - LV_RLOTTIE_CTRL_LOOP = 8, -} lv_rlottie_ctrl_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_rlottie_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent, int32_t width, int32_t height, const char * path); - -lv_obj_t * lv_rlottie_create_from_raw(lv_obj_t * parent, int32_t width, int32_t height, - const char * rlottie_desc); - -void lv_rlottie_set_play_mode(lv_obj_t * rlottie, const lv_rlottie_ctrl_t ctrl); -void lv_rlottie_set_current_frame(lv_obj_t * rlottie, const size_t goto_frame); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_RLOTTIE*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_RLOTTIE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/rlottie/lv_rlottie_private.h b/src/libs/rlottie/lv_rlottie_private.h index 344c3909db..8fd6ab8f44 100644 --- a/src/libs/rlottie/lv_rlottie_private.h +++ b/src/libs/rlottie/lv_rlottie_private.h @@ -14,9 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_rlottie.h" +#include "../../lv_public_api.h" #if LV_USE_RLOTTIE #include "../../widgets/image/lv_image_private.h" +#include "../../../lvgl_private.h" /********************* * DEFINES diff --git a/src/libs/svg/lv_svg.c b/src/libs/svg/lv_svg.c index 8bb6051f06..88cfb83ef0 100644 --- a/src/libs/svg/lv_svg.c +++ b/src/libs/svg/lv_svg.c @@ -6,13 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_svg.h" +#include "../../lv_public_api.h" #if LV_USE_SVG -#include "../../misc/lv_assert.h" -#include "../../misc/lv_log.h" -#include "../../stdlib/lv_mem.h" - #include "lv_svg_token.h" #include "lv_svg_parser.h" diff --git a/src/libs/svg/lv_svg.h b/src/libs/svg/lv_svg.h index 9d96cc7b8a..6451cb02b3 100644 --- a/src/libs/svg/lv_svg.h +++ b/src/libs/svg/lv_svg.h @@ -1,336 +1,2 @@ -/** - * @file lv_svg.h - * - */ - -#ifndef LV_SVG_H -#define LV_SVG_H - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_SVG - -#include "../../misc/lv_array.h" -#include "../../misc/lv_tree.h" -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -enum _lv_svg_tag_t { - LV_SVG_TAG_INVALID = -1, - LV_SVG_TAG_CONTENT, - LV_SVG_TAG_SVG, - LV_SVG_TAG_USE, - LV_SVG_TAG_G, - LV_SVG_TAG_PATH, - LV_SVG_TAG_RECT, - LV_SVG_TAG_CIRCLE, - LV_SVG_TAG_ELLIPSE, - LV_SVG_TAG_LINE, - LV_SVG_TAG_POLYLINE, - LV_SVG_TAG_POLYGON, - LV_SVG_TAG_SOLID_COLOR, - LV_SVG_TAG_LINEAR_GRADIENT, - LV_SVG_TAG_RADIAL_GRADIENT, - LV_SVG_TAG_STOP, - LV_SVG_TAG_DEFS, - LV_SVG_TAG_IMAGE, -#if LV_USE_SVG_ANIMATION - LV_SVG_TAG_MPATH, - LV_SVG_TAG_SET, - LV_SVG_TAG_ANIMATE, - LV_SVG_TAG_ANIMATE_COLOR, - LV_SVG_TAG_ANIMATE_TRANSFORM, - LV_SVG_TAG_ANIMATE_MOTION, -#endif - LV_SVG_TAG_TEXT, - LV_SVG_TAG_TSPAN, - LV_SVG_TAG_TEXT_AREA, -}; -typedef int8_t lv_svg_tag_t; - -enum _lv_svg_attr_type_t { - LV_SVG_ATTR_INVALID = 0, - LV_SVG_ATTR_ID, - LV_SVG_ATTR_XML_ID, - LV_SVG_ATTR_VERSION, - LV_SVG_ATTR_BASE_PROFILE, - LV_SVG_ATTR_VIEWBOX, - LV_SVG_ATTR_PRESERVE_ASPECT_RATIO, - LV_SVG_ATTR_VIEWPORT_FILL, - LV_SVG_ATTR_VIEWPORT_FILL_OPACITY, - LV_SVG_ATTR_DISPLAY, - LV_SVG_ATTR_VISIBILITY, - LV_SVG_ATTR_X, - LV_SVG_ATTR_Y, - LV_SVG_ATTR_WIDTH, - LV_SVG_ATTR_HEIGHT, - LV_SVG_ATTR_RX, - LV_SVG_ATTR_RY, - LV_SVG_ATTR_CX, - LV_SVG_ATTR_CY, - LV_SVG_ATTR_R, - LV_SVG_ATTR_X1, - LV_SVG_ATTR_Y1, - LV_SVG_ATTR_X2, - LV_SVG_ATTR_Y2, - LV_SVG_ATTR_POINTS, - LV_SVG_ATTR_D, - LV_SVG_ATTR_PATH_LENGTH, - LV_SVG_ATTR_XLINK_HREF, - LV_SVG_ATTR_STYLE, - LV_SVG_ATTR_FILL, - LV_SVG_ATTR_FILL_RULE, - LV_SVG_ATTR_FILL_OPACITY, - LV_SVG_ATTR_STROKE, - LV_SVG_ATTR_STROKE_WIDTH, - LV_SVG_ATTR_STROKE_LINECAP, - LV_SVG_ATTR_STROKE_LINEJOIN, - LV_SVG_ATTR_STROKE_MITER_LIMIT, - LV_SVG_ATTR_STROKE_DASH_ARRAY, - LV_SVG_ATTR_STROKE_DASH_OFFSET, - LV_SVG_ATTR_STROKE_OPACITY, - LV_SVG_ATTR_OPACITY, - LV_SVG_ATTR_SOLID_COLOR, - LV_SVG_ATTR_SOLID_OPACITY, - LV_SVG_ATTR_GRADIENT_UNITS, - LV_SVG_ATTR_GRADIENT_STOP_OFFSET, - LV_SVG_ATTR_GRADIENT_STOP_COLOR, - LV_SVG_ATTR_GRADIENT_STOP_OPACITY, - LV_SVG_ATTR_FONT_FAMILY, - LV_SVG_ATTR_FONT_STYLE, - LV_SVG_ATTR_FONT_VARIANT, - LV_SVG_ATTR_FONT_WEIGHT, - LV_SVG_ATTR_FONT_SIZE, - LV_SVG_ATTR_TRANSFORM, - LV_SVG_ATTR_TEXT_ANCHOR, -#if LV_USE_SVG_ANIMATION - LV_SVG_ATTR_ATTRIBUTE_NAME, - LV_SVG_ATTR_ATTRIBUTE_TYPE, - LV_SVG_ATTR_BEGIN, - LV_SVG_ATTR_END, - LV_SVG_ATTR_DUR, - LV_SVG_ATTR_MIN, - LV_SVG_ATTR_MAX, - LV_SVG_ATTR_RESTART, - LV_SVG_ATTR_REPEAT_COUNT, - LV_SVG_ATTR_REPEAT_DUR, - LV_SVG_ATTR_CALC_MODE, - LV_SVG_ATTR_VALUES, - LV_SVG_ATTR_KEY_TIMES, - LV_SVG_ATTR_KEY_SPLINES, - LV_SVG_ATTR_KEY_POINTS, - LV_SVG_ATTR_FROM, - LV_SVG_ATTR_TO, - LV_SVG_ATTR_BY, - LV_SVG_ATTR_ADDITIVE, - LV_SVG_ATTR_ACCUMULATE, - LV_SVG_ATTR_PATH, - LV_SVG_ATTR_ROTATE, - LV_SVG_ATTR_TRANSFORM_TYPE, -#endif -}; -typedef uint8_t lv_svg_attr_type_t; - -enum _lv_svg_transform_type_t { - LV_SVG_TRANSFORM_TYPE_MATRIX = 1, - LV_SVG_TRANSFORM_TYPE_TRANSLATE, - LV_SVG_TRANSFORM_TYPE_ROTATE, - LV_SVG_TRANSFORM_TYPE_SCALE, - LV_SVG_TRANSFORM_TYPE_SKEW_X, - LV_SVG_TRANSFORM_TYPE_SKEW_Y, -}; -typedef uint8_t lv_svg_transform_type_t; - -#if LV_USE_SVG_ANIMATION -enum lv_svg_anim_action_t { - LV_SVG_ANIM_REMOVE = 0, - LV_SVG_ANIM_FREEZE, -}; - -enum _lv_svg_anim_restart_type_t { - LV_SVG_ANIM_RESTART_ALWAYS = 0, - LV_SVG_ANIM_RESTART_WHEN_NOT_ACTIVE, - LV_SVG_ANIM_RESTART_NEVER, -}; - -enum _lv_svg_anim_calc_mode_t { - LV_SVG_ANIM_CALC_MODE_LINEAR = 0, - LV_SVG_ANIM_CALC_MODE_PACED, - LV_SVG_ANIM_CALC_MODE_SPLINE, - LV_SVG_ANIM_CALC_MODE_DISCRETE, -}; - -enum _lv_svg_anim_additive_type_t { - LV_SVG_ANIM_ADDITIVE_REPLACE = 0, - LV_SVG_ANIM_ADDITIVE_SUM, -}; - -enum _lv_svg_anim_accumulate_type_t { - LV_SVG_ANIM_ACCUMULATE_NONE = 0, - LV_SVG_ANIM_ACCUMULATE_SUM, -}; -#endif - -enum _lv_svg_aspect_ratio_t { - LV_SVG_ASPECT_RATIO_NONE = 0, - LV_SVG_ASPECT_RATIO_XMIN_YMIN = (1 << 1), - LV_SVG_ASPECT_RATIO_XMID_YMIN = (2 << 1), - LV_SVG_ASPECT_RATIO_XMAX_YMIN = (3 << 1), - LV_SVG_ASPECT_RATIO_XMIN_YMID = (4 << 1), - LV_SVG_ASPECT_RATIO_XMID_YMID = (5 << 1), - LV_SVG_ASPECT_RATIO_XMAX_YMID = (6 << 1), - LV_SVG_ASPECT_RATIO_XMIN_YMAX = (7 << 1), - LV_SVG_ASPECT_RATIO_XMID_YMAX = (8 << 1), - LV_SVG_ASPECT_RATIO_XMAX_YMAX = (9 << 1), -}; -typedef uint32_t lv_svg_aspect_ratio_t; - -enum _lv_svg_aspect_ratio_opt_t { - LV_SVG_ASPECT_RATIO_OPT_MEET = 0, - LV_SVG_ASPECT_RATIO_OPT_SLICE, -}; - -typedef struct { - float x; - float y; -} lv_svg_point_t; - -typedef struct { - float m[3][3]; -} lv_svg_matrix_t; - -typedef uint32_t lv_svg_color_t; - -enum _lv_svg_fill_rule_t { - LV_SVG_FILL_NONZERO = 0, - LV_SVG_FILL_EVENODD, -}; -typedef uint8_t lv_svg_fill_rule_t; - -enum _lv_svg_line_cap_t { - LV_SVG_LINE_CAP_BUTT = 0, - LV_SVG_LINE_CAP_SQUARE, - LV_SVG_LINE_CAP_ROUND, -}; -typedef uint8_t lv_svg_line_cap_t; - -enum _lv_svg_line_join_t { - LV_SVG_LINE_JOIN_MITER = 0, - LV_SVG_LINE_JOIN_BEVEL, - LV_SVG_LINE_JOIN_ROUND, -}; -typedef uint8_t lv_svg_line_join_t; - -enum _lv_svg_gradient_units_t { - LV_SVG_GRADIENT_UNITS_OBJECT = 0, - LV_SVG_GRADIENT_UNITS_USER_SPACE, -}; -typedef uint8_t lv_svg_gradient_units_t; - -typedef union { - int32_t ival; - uint32_t uval; - float fval; - char * sval; - void * val; -} lv_svg_attr_value_t; - -/* - * to simplify list buffer management, allocate enough memory for all data and length. - * | size | data[0] | data[1] | data[2] | ... | - */ -typedef struct { - uint32_t length; - uint8_t data[1]; -} lv_svg_attr_values_list_t; - -/* https://www.w3.org/TR/SVGTiny12/svgudomidl.html */ -enum _lv_svg_path_cmd_t { - LV_SVG_PATH_CMD_MOVE_TO = 77, - LV_SVG_PATH_CMD_LINE_TO = 76, - LV_SVG_PATH_CMD_CURVE_TO = 67, - LV_SVG_PATH_CMD_QUAD_TO = 81, - LV_SVG_PATH_CMD_ARC_TO = 65, /*svg2 extension*/ - LV_SVG_PATH_CMD_CLOSE = 90, -}; - -/* - * to simplify list buffer management, allocate enough memory for all path data and cmd. - * | cmd | data[0] | data[1] | data[2] | ... | - */ -typedef struct { - uint32_t cmd; - uint8_t data[1]; -} lv_svg_attr_path_value_t; - -enum _lv_svg_attr_value_type_t { - LV_SVG_ATTR_VALUE_DATA = 0, - LV_SVG_ATTR_VALUE_PTR, -}; -typedef uint8_t lv_svg_attr_value_type_t; - -enum _lv_svg_attr_value_class_t { - LV_SVG_ATTR_VALUE_NONE = 0, - LV_SVG_ATTR_VALUE_INITIAL, - LV_SVG_ATTR_VALUE_INHERIT, -}; -typedef uint8_t lv_svg_attr_value_class_t; - -typedef struct { - lv_svg_attr_type_t id; - lv_svg_attr_value_type_t val_type; - lv_svg_attr_value_class_t class_type; - lv_svg_attr_value_t value; -} lv_svg_attr_t; - -struct _lv_svg_render_obj; - -typedef struct { - lv_tree_node_t base; - char * xml_id; /* xml_id or content */ - lv_svg_tag_t type; - lv_array_t attrs; - struct _lv_svg_render_obj * render_obj; -} lv_svg_node_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Loading SVG data and creating the DOM tree - * @param svg_data pointer to the SVG data - * @param data_len the SVG data length - */ -lv_svg_node_t * lv_svg_load_data(const char * svg_data, uint32_t data_len); - -/** - * @brief Create an SVG DOM node - * @param parent pointer to the parent node - * @return true: an new SVG DOM node, false: NULL - */ -lv_svg_node_t * lv_svg_node_create(lv_svg_node_t * parent); - -/** - * @brief Delete an SVG DOM subtree - * @param node pointer to an SVG DOM subtree - */ -void lv_svg_node_delete(lv_svg_node_t * node); - -/********************** - * MACROS - **********************/ -#define LV_SVG_NODE_CHILD(n, i) \ - ((lv_svg_node_t *)(LV_TREE_NODE((n))->children[i])) - -#define LV_SVG_NODE(n) ((lv_svg_node_t*)(n)) - -#endif /*LV_USE_SVG*/ - -#endif /*LV_SVG_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/svg/lv_svg_decoder.c b/src/libs/svg/lv_svg_decoder.c index d77d15d4c8..60333cb043 100644 --- a/src/libs/svg/lv_svg_decoder.c +++ b/src/libs/svg/lv_svg_decoder.c @@ -6,13 +6,13 @@ /********************* * INCLUDES *********************/ +#include "../../lv_public_api.h" #include "../../draw/lv_image_decoder_private.h" -#include "../../../lvgl.h" #if LV_USE_SVG -#include "lv_svg_decoder.h" -#include "lv_svg.h" +#include "lv_svg_decoder.h" +#include "lv_svg_render.h" #include "../../draw/lv_draw_buf_private.h" #include "../../display/lv_display_private.h" diff --git a/src/libs/svg/lv_svg_decoder.h b/src/libs/svg/lv_svg_decoder.h index b73a640750..ffea077932 100644 --- a/src/libs/svg/lv_svg_decoder.h +++ b/src/libs/svg/lv_svg_decoder.h @@ -13,12 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_SVG -#include "../../draw/lv_image_decoder.h" - /********************* * DEFINES *********************/ diff --git a/src/libs/svg/lv_svg_parser.h b/src/libs/svg/lv_svg_parser.h index fc99fe8bd2..435ae05e71 100644 --- a/src/libs/svg/lv_svg_parser.h +++ b/src/libs/svg/lv_svg_parser.h @@ -9,10 +9,11 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" + +#include "../../lv_public_api.h" + #if LV_USE_SVG -#include "lv_svg.h" #include "lv_svg_token.h" /********************* diff --git a/src/libs/svg/lv_svg_render.h b/src/libs/svg/lv_svg_render.h index e2578bf54f..a91c34846d 100644 --- a/src/libs/svg/lv_svg_render.h +++ b/src/libs/svg/lv_svg_render.h @@ -9,15 +9,13 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_SVG #if !LV_USE_VECTOR_GRAPHIC #error "LV_USE_SVG requires LV_USE_VECTOR_GRAPHIC = 1" #endif -#include "lv_svg.h" -#include "../../misc/lv_types.h" #include "../../draw/lv_draw_vector_private.h" /********************* @@ -109,13 +107,6 @@ lv_result_t lv_svg_render_get_viewport_size(const lv_svg_render_obj_t * render, */ void lv_draw_svg_render(lv_draw_vector_dsc_t * dsc, const lv_svg_render_obj_t * render); -/** - * @brief Draw an SVG document to a layer - * @param layer pointer to the target layer - * @param svg_doc pointer to the SVG document to draw - */ -void lv_draw_svg(lv_layer_t * layer, const lv_svg_node_t * svg_doc); - /********************** * MACROS **********************/ diff --git a/src/libs/svg/lv_svg_token.h b/src/libs/svg/lv_svg_token.h index 1c57b91e3b..549b9bc090 100644 --- a/src/libs/svg/lv_svg_token.h +++ b/src/libs/svg/lv_svg_token.h @@ -9,10 +9,10 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" -#if LV_USE_SVG -#include "../../misc/lv_array.h" +#include "../../lv_public_api.h" + +#if LV_USE_SVG /********************* * DEFINES diff --git a/src/libs/thorvg/add_lvgl_if.sh b/src/libs/thorvg/add_lvgl_if.sh index 43ce903060..8608048476 100755 --- a/src/libs/thorvg/add_lvgl_if.sh +++ b/src/libs/thorvg/add_lvgl_if.sh @@ -5,7 +5,7 @@ # find -name "*.cpp" | xargs ./add_lvgl_if.sh # find -name "t*.h" | xargs ./add_lvgl_if.sh -sed '0,/\*\/$/ {/\*\/$/ {n; s|^|\n#include "../../lv_conf_internal.h"\n#if LV_USE_THORVG_INTERNAL\n|}}' $@ -i +sed '0,/\*\/$/ {/\*\/$/ {n; s|^|\n#include "../../lv_public_api.h"\n#if LV_USE_THORVG_INTERNAL\n|}}' $@ -i sed -i -e '$a\ \ diff --git a/src/libs/thorvg/config.h b/src/libs/thorvg/config.h index a5565396d6..40e2f4679b 100644 --- a/src/libs/thorvg/config.h +++ b/src/libs/thorvg/config.h @@ -6,7 +6,7 @@ #ifndef TVG_CONFIG_H #define TVG_CONFIG_H -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #define THORVG_SW_RASTER_SUPPORT 1 diff --git a/src/libs/thorvg/rapidjson/allocators.h b/src/libs/thorvg/rapidjson/allocators.h index 92f712c8bc..841bd4910a 100644 --- a/src/libs/thorvg/rapidjson/allocators.h +++ b/src/libs/thorvg/rapidjson/allocators.h @@ -25,7 +25,7 @@ #include #endif -#include "../../../misc/lv_assert.h" +#include "../../../lv_public_api.h" RAPIDJSON_NAMESPACE_BEGIN diff --git a/src/libs/thorvg/rapidjson/rapidjson.h b/src/libs/thorvg/rapidjson/rapidjson.h index 6aec41eed3..4a5f077bdd 100644 --- a/src/libs/thorvg/rapidjson/rapidjson.h +++ b/src/libs/thorvg/rapidjson/rapidjson.h @@ -690,7 +690,7 @@ RAPIDJSON_NAMESPACE_END /////////////////////////////////////////////////////////////////////////////// // malloc/realloc/free -#include "../../../stdlib/lv_mem.h" +#include "../../../lv_public_api.h" #ifndef RAPIDJSON_MALLOC ///! customization point for global \c malloc #define RAPIDJSON_MALLOC(size) lv_malloc(size) diff --git a/src/libs/thorvg/thorvg.h b/src/libs/thorvg/thorvg.h index 858b81d5e3..4ae28a1179 100644 --- a/src/libs/thorvg/thorvg.h +++ b/src/libs/thorvg/thorvg.h @@ -1,11 +1,11 @@ #ifndef _THORVG_H_ #define _THORVG_H_ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" /*Testing of dependencies*/ #if LV_USE_THORVG && LV_USE_VECTOR_GRAPHIC == 0 -#error "ThorVG: LV_USE_VECTOR_GRAPHIC is required. Enable it in lv_conf.h" + #error "ThorVG: LV_USE_VECTOR_GRAPHIC is required. Enable it in lv_conf.h" #endif #if LV_USE_THORVG_INTERNAL @@ -17,9 +17,7 @@ #include #include #include -#include "../../stdlib/lv_mem.h" -#include "../../stdlib/lv_string.h" -#include "../../misc/lv_assert.h" +#include "../../lv_public_api.h" #ifdef TVG_API #undef TVG_API diff --git a/src/libs/thorvg/thorvg_capi.h b/src/libs/thorvg/thorvg_capi.h index 9d3547986a..75eb178a89 100644 --- a/src/libs/thorvg/thorvg_capi.h +++ b/src/libs/thorvg/thorvg_capi.h @@ -15,7 +15,7 @@ * */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #define TVG_BUILD 1 diff --git a/src/libs/thorvg/thorvg_lottie.h b/src/libs/thorvg/thorvg_lottie.h index 3275107356..c5de3b0225 100644 --- a/src/libs/thorvg/thorvg_lottie.h +++ b/src/libs/thorvg/thorvg_lottie.h @@ -18,7 +18,7 @@ namespace tvg * @since 0.15 */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL class TVG_API LottieAnimation final : public Animation { diff --git a/src/libs/thorvg/tvgAccessor.cpp b/src/libs/thorvg/tvgAccessor.cpp index 5f56c6649f..c660db6fef 100644 --- a/src/libs/thorvg/tvgAccessor.cpp +++ b/src/libs/thorvg/tvgAccessor.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgIteratorAccessor.h" diff --git a/src/libs/thorvg/tvgAnimation.cpp b/src/libs/thorvg/tvgAnimation.cpp index 5c64c27259..19790d041d 100644 --- a/src/libs/thorvg/tvgAnimation.cpp +++ b/src/libs/thorvg/tvgAnimation.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgFrameModule.h" diff --git a/src/libs/thorvg/tvgAnimation.h b/src/libs/thorvg/tvgAnimation.h index d0b4567168..d0a5388fed 100644 --- a/src/libs/thorvg/tvgAnimation.h +++ b/src/libs/thorvg/tvgAnimation.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_ANIMATION_H_ diff --git a/src/libs/thorvg/tvgArray.h b/src/libs/thorvg/tvgArray.h index 4bcd9f64d3..54c5bac728 100644 --- a/src/libs/thorvg/tvgArray.h +++ b/src/libs/thorvg/tvgArray.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_ARRAY_H_ diff --git a/src/libs/thorvg/tvgBinaryDesc.h b/src/libs/thorvg/tvgBinaryDesc.h index e1067542ce..ca17becd3b 100644 --- a/src/libs/thorvg/tvgBinaryDesc.h +++ b/src/libs/thorvg/tvgBinaryDesc.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_BINARY_DESC_H_ diff --git a/src/libs/thorvg/tvgCanvas.cpp b/src/libs/thorvg/tvgCanvas.cpp index 22a97c20d4..945bb7cb36 100644 --- a/src/libs/thorvg/tvgCanvas.cpp +++ b/src/libs/thorvg/tvgCanvas.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgCanvas.h" diff --git a/src/libs/thorvg/tvgCanvas.h b/src/libs/thorvg/tvgCanvas.h index 6459d16f2e..032e87edf8 100644 --- a/src/libs/thorvg/tvgCanvas.h +++ b/src/libs/thorvg/tvgCanvas.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_CANVAS_H_ diff --git a/src/libs/thorvg/tvgCapi.cpp b/src/libs/thorvg/tvgCapi.cpp index 048e6c4822..6def810f91 100644 --- a/src/libs/thorvg/tvgCapi.cpp +++ b/src/libs/thorvg/tvgCapi.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "config.h" diff --git a/src/libs/thorvg/tvgCommon.h b/src/libs/thorvg/tvgCommon.h index 8311d2307f..e9fe86bbd7 100644 --- a/src/libs/thorvg/tvgCommon.h +++ b/src/libs/thorvg/tvgCommon.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_COMMON_H_ diff --git a/src/libs/thorvg/tvgCompressor.cpp b/src/libs/thorvg/tvgCompressor.cpp index c7de009125..d2888c1d53 100644 --- a/src/libs/thorvg/tvgCompressor.cpp +++ b/src/libs/thorvg/tvgCompressor.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL /* diff --git a/src/libs/thorvg/tvgCompressor.h b/src/libs/thorvg/tvgCompressor.h index d38cf83c90..c1a2c29c7f 100644 --- a/src/libs/thorvg/tvgCompressor.h +++ b/src/libs/thorvg/tvgCompressor.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_COMPRESSOR_H_ diff --git a/src/libs/thorvg/tvgFill.cpp b/src/libs/thorvg/tvgFill.cpp index d9ef9f3f52..770fc3de18 100644 --- a/src/libs/thorvg/tvgFill.cpp +++ b/src/libs/thorvg/tvgFill.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgFill.h" diff --git a/src/libs/thorvg/tvgFill.h b/src/libs/thorvg/tvgFill.h index e123bc6d6d..4b842611d2 100644 --- a/src/libs/thorvg/tvgFill.h +++ b/src/libs/thorvg/tvgFill.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_FILL_H_ diff --git a/src/libs/thorvg/tvgFrameModule.h b/src/libs/thorvg/tvgFrameModule.h index 02e69a87ac..cc98b9fa92 100644 --- a/src/libs/thorvg/tvgFrameModule.h +++ b/src/libs/thorvg/tvgFrameModule.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_FRAME_MODULE_H_ diff --git a/src/libs/thorvg/tvgGlCanvas.cpp b/src/libs/thorvg/tvgGlCanvas.cpp index c923763552..526796b4ce 100644 --- a/src/libs/thorvg/tvgGlCanvas.cpp +++ b/src/libs/thorvg/tvgGlCanvas.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgCanvas.h" diff --git a/src/libs/thorvg/tvgInitializer.cpp b/src/libs/thorvg/tvgInitializer.cpp index a770c34c3e..fdc061a68d 100644 --- a/src/libs/thorvg/tvgInitializer.cpp +++ b/src/libs/thorvg/tvgInitializer.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgCommon.h" diff --git a/src/libs/thorvg/tvgInlist.h b/src/libs/thorvg/tvgInlist.h index 4c38ee477e..07942db289 100644 --- a/src/libs/thorvg/tvgInlist.h +++ b/src/libs/thorvg/tvgInlist.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_INLIST_H_ diff --git a/src/libs/thorvg/tvgIteratorAccessor.h b/src/libs/thorvg/tvgIteratorAccessor.h index adc5f6ea88..4293074741 100644 --- a/src/libs/thorvg/tvgIteratorAccessor.h +++ b/src/libs/thorvg/tvgIteratorAccessor.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_ITERATOR_ACCESSOR_H_ diff --git a/src/libs/thorvg/tvgLoadModule.h b/src/libs/thorvg/tvgLoadModule.h index 05e1d06da9..f429056a63 100644 --- a/src/libs/thorvg/tvgLoadModule.h +++ b/src/libs/thorvg/tvgLoadModule.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOAD_MODULE_H_ diff --git a/src/libs/thorvg/tvgLoader.cpp b/src/libs/thorvg/tvgLoader.cpp index 1a1d3d7101..46b1804ec2 100644 --- a/src/libs/thorvg/tvgLoader.cpp +++ b/src/libs/thorvg/tvgLoader.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include diff --git a/src/libs/thorvg/tvgLoader.h b/src/libs/thorvg/tvgLoader.h index 3c7fc7e765..745598ad8c 100644 --- a/src/libs/thorvg/tvgLoader.h +++ b/src/libs/thorvg/tvgLoader.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOADER_H_ diff --git a/src/libs/thorvg/tvgLock.h b/src/libs/thorvg/tvgLock.h index 4baee405ea..2e6d68cef9 100644 --- a/src/libs/thorvg/tvgLock.h +++ b/src/libs/thorvg/tvgLock.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOCK_H_ diff --git a/src/libs/thorvg/tvgLottieAnimation.cpp b/src/libs/thorvg/tvgLottieAnimation.cpp index a74ca49e85..5d35d817a6 100644 --- a/src/libs/thorvg/tvgLottieAnimation.cpp +++ b/src/libs/thorvg/tvgLottieAnimation.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgCommon.h" diff --git a/src/libs/thorvg/tvgLottieBuilder.cpp b/src/libs/thorvg/tvgLottieBuilder.cpp index 3ed21f4fa0..802fdab09b 100644 --- a/src/libs/thorvg/tvgLottieBuilder.cpp +++ b/src/libs/thorvg/tvgLottieBuilder.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include diff --git a/src/libs/thorvg/tvgLottieBuilder.h b/src/libs/thorvg/tvgLottieBuilder.h index 03c7d9c61a..030cbc5d87 100644 --- a/src/libs/thorvg/tvgLottieBuilder.h +++ b/src/libs/thorvg/tvgLottieBuilder.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_BUILDER_H_ diff --git a/src/libs/thorvg/tvgLottieCommon.h b/src/libs/thorvg/tvgLottieCommon.h index c08b10c163..3b3e6def0f 100644 --- a/src/libs/thorvg/tvgLottieCommon.h +++ b/src/libs/thorvg/tvgLottieCommon.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_COMMON_ diff --git a/src/libs/thorvg/tvgLottieExpressions.cpp b/src/libs/thorvg/tvgLottieExpressions.cpp index 662e650652..4662b6d59c 100644 --- a/src/libs/thorvg/tvgLottieExpressions.cpp +++ b/src/libs/thorvg/tvgLottieExpressions.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL diff --git a/src/libs/thorvg/tvgLottieExpressions.h b/src/libs/thorvg/tvgLottieExpressions.h index c50e7ed78a..cf58abb500 100644 --- a/src/libs/thorvg/tvgLottieExpressions.h +++ b/src/libs/thorvg/tvgLottieExpressions.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_EXPRESSIONS_H_ diff --git a/src/libs/thorvg/tvgLottieInterpolator.cpp b/src/libs/thorvg/tvgLottieInterpolator.cpp index f4146e1399..bcfcbd650f 100644 --- a/src/libs/thorvg/tvgLottieInterpolator.cpp +++ b/src/libs/thorvg/tvgLottieInterpolator.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL /* This Source Code Form is subject to the terms of the Mozilla Public diff --git a/src/libs/thorvg/tvgLottieInterpolator.h b/src/libs/thorvg/tvgLottieInterpolator.h index c7d07d47d2..f0c6fd1a4d 100644 --- a/src/libs/thorvg/tvgLottieInterpolator.h +++ b/src/libs/thorvg/tvgLottieInterpolator.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_INTERPOLATOR_H_ diff --git a/src/libs/thorvg/tvgLottieLoader.cpp b/src/libs/thorvg/tvgLottieLoader.cpp index eb58c8f3dc..f3c2d2500f 100644 --- a/src/libs/thorvg/tvgLottieLoader.cpp +++ b/src/libs/thorvg/tvgLottieLoader.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgLottieLoader.h" diff --git a/src/libs/thorvg/tvgLottieLoader.h b/src/libs/thorvg/tvgLottieLoader.h index 27117fdb80..11be2abf74 100644 --- a/src/libs/thorvg/tvgLottieLoader.h +++ b/src/libs/thorvg/tvgLottieLoader.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_LOADER_H_ diff --git a/src/libs/thorvg/tvgLottieModel.cpp b/src/libs/thorvg/tvgLottieModel.cpp index 38804fa86f..d2ddbb87d6 100644 --- a/src/libs/thorvg/tvgLottieModel.cpp +++ b/src/libs/thorvg/tvgLottieModel.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgMath.h" diff --git a/src/libs/thorvg/tvgLottieModel.h b/src/libs/thorvg/tvgLottieModel.h index 6fb53c3309..39d91da5fc 100644 --- a/src/libs/thorvg/tvgLottieModel.h +++ b/src/libs/thorvg/tvgLottieModel.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_MODEL_H_ diff --git a/src/libs/thorvg/tvgLottieModifier.cpp b/src/libs/thorvg/tvgLottieModifier.cpp index e4efae2ade..9d5a948ac2 100644 --- a/src/libs/thorvg/tvgLottieModifier.cpp +++ b/src/libs/thorvg/tvgLottieModifier.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgLottieModifier.h" diff --git a/src/libs/thorvg/tvgLottieModifier.h b/src/libs/thorvg/tvgLottieModifier.h index 7851346483..22d602fc91 100644 --- a/src/libs/thorvg/tvgLottieModifier.h +++ b/src/libs/thorvg/tvgLottieModifier.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_MODIFIER_H_ diff --git a/src/libs/thorvg/tvgLottieParser.cpp b/src/libs/thorvg/tvgLottieParser.cpp index 8f6f42934d..1e954c3ff9 100644 --- a/src/libs/thorvg/tvgLottieParser.cpp +++ b/src/libs/thorvg/tvgLottieParser.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgStr.h" diff --git a/src/libs/thorvg/tvgLottieParser.h b/src/libs/thorvg/tvgLottieParser.h index de13076ed9..af2c1dd418 100644 --- a/src/libs/thorvg/tvgLottieParser.h +++ b/src/libs/thorvg/tvgLottieParser.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_PARSER_H_ diff --git a/src/libs/thorvg/tvgLottieParserHandler.cpp b/src/libs/thorvg/tvgLottieParserHandler.cpp index bb03837f22..3750f30448 100644 --- a/src/libs/thorvg/tvgLottieParserHandler.cpp +++ b/src/libs/thorvg/tvgLottieParserHandler.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL /* diff --git a/src/libs/thorvg/tvgLottieParserHandler.h b/src/libs/thorvg/tvgLottieParserHandler.h index 65b4545a20..d05f210c41 100644 --- a/src/libs/thorvg/tvgLottieParserHandler.h +++ b/src/libs/thorvg/tvgLottieParserHandler.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL /* diff --git a/src/libs/thorvg/tvgLottieProperty.h b/src/libs/thorvg/tvgLottieProperty.h index d0dbd5099d..1ec8624f74 100644 --- a/src/libs/thorvg/tvgLottieProperty.h +++ b/src/libs/thorvg/tvgLottieProperty.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_PROPERTY_H_ diff --git a/src/libs/thorvg/tvgLottieRenderPooler.h b/src/libs/thorvg/tvgLottieRenderPooler.h index 4786df1b03..dd910eeecd 100644 --- a/src/libs/thorvg/tvgLottieRenderPooler.h +++ b/src/libs/thorvg/tvgLottieRenderPooler.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_LOTTIE_RENDER_POOLER_H_ diff --git a/src/libs/thorvg/tvgMath.cpp b/src/libs/thorvg/tvgMath.cpp index 813ad68b65..1229bfd711 100644 --- a/src/libs/thorvg/tvgMath.cpp +++ b/src/libs/thorvg/tvgMath.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgMath.h" diff --git a/src/libs/thorvg/tvgMath.h b/src/libs/thorvg/tvgMath.h index a2b9955a87..227af119ec 100644 --- a/src/libs/thorvg/tvgMath.h +++ b/src/libs/thorvg/tvgMath.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_MATH_H_ diff --git a/src/libs/thorvg/tvgPaint.cpp b/src/libs/thorvg/tvgPaint.cpp index 4beb660ba4..cac94b2ffb 100644 --- a/src/libs/thorvg/tvgPaint.cpp +++ b/src/libs/thorvg/tvgPaint.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgMath.h" diff --git a/src/libs/thorvg/tvgPaint.h b/src/libs/thorvg/tvgPaint.h index 494d5f7cef..0855058de4 100644 --- a/src/libs/thorvg/tvgPaint.h +++ b/src/libs/thorvg/tvgPaint.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_PAINT_H_ diff --git a/src/libs/thorvg/tvgPicture.cpp b/src/libs/thorvg/tvgPicture.cpp index cf41e3737a..2e29bf2a7d 100644 --- a/src/libs/thorvg/tvgPicture.cpp +++ b/src/libs/thorvg/tvgPicture.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgPaint.h" diff --git a/src/libs/thorvg/tvgPicture.h b/src/libs/thorvg/tvgPicture.h index 0577a90ac4..7e99b8b376 100644 --- a/src/libs/thorvg/tvgPicture.h +++ b/src/libs/thorvg/tvgPicture.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_PICTURE_H_ diff --git a/src/libs/thorvg/tvgRawLoader.cpp b/src/libs/thorvg/tvgRawLoader.cpp index cbfa03afcb..0491cffe83 100644 --- a/src/libs/thorvg/tvgRawLoader.cpp +++ b/src/libs/thorvg/tvgRawLoader.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include diff --git a/src/libs/thorvg/tvgRawLoader.h b/src/libs/thorvg/tvgRawLoader.h index 492fd53418..eec95ca7b5 100644 --- a/src/libs/thorvg/tvgRawLoader.h +++ b/src/libs/thorvg/tvgRawLoader.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_RAW_LOADER_H_ diff --git a/src/libs/thorvg/tvgRender.cpp b/src/libs/thorvg/tvgRender.cpp index 4538d31e97..4b4a5708b8 100644 --- a/src/libs/thorvg/tvgRender.cpp +++ b/src/libs/thorvg/tvgRender.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgMath.h" diff --git a/src/libs/thorvg/tvgRender.h b/src/libs/thorvg/tvgRender.h index dc18635923..22d68b3c4e 100644 --- a/src/libs/thorvg/tvgRender.h +++ b/src/libs/thorvg/tvgRender.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_RENDER_H_ diff --git a/src/libs/thorvg/tvgSaveModule.h b/src/libs/thorvg/tvgSaveModule.h index abfd5381af..8037a92d05 100644 --- a/src/libs/thorvg/tvgSaveModule.h +++ b/src/libs/thorvg/tvgSaveModule.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SAVE_MODULE_H_ diff --git a/src/libs/thorvg/tvgSaver.cpp b/src/libs/thorvg/tvgSaver.cpp index f9af0f8220..4366470913 100644 --- a/src/libs/thorvg/tvgSaver.cpp +++ b/src/libs/thorvg/tvgSaver.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgCommon.h" diff --git a/src/libs/thorvg/tvgScene.cpp b/src/libs/thorvg/tvgScene.cpp index 55d6e507bb..9bb65f7723 100644 --- a/src/libs/thorvg/tvgScene.cpp +++ b/src/libs/thorvg/tvgScene.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include diff --git a/src/libs/thorvg/tvgScene.h b/src/libs/thorvg/tvgScene.h index d01c569d0a..77661e9313 100644 --- a/src/libs/thorvg/tvgScene.h +++ b/src/libs/thorvg/tvgScene.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SCENE_H_ diff --git a/src/libs/thorvg/tvgShape.cpp b/src/libs/thorvg/tvgShape.cpp index 7b2b3fab86..6624b2d9e0 100644 --- a/src/libs/thorvg/tvgShape.cpp +++ b/src/libs/thorvg/tvgShape.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgMath.h" diff --git a/src/libs/thorvg/tvgShape.h b/src/libs/thorvg/tvgShape.h index 3cc3a3e5e8..c7312d8175 100644 --- a/src/libs/thorvg/tvgShape.h +++ b/src/libs/thorvg/tvgShape.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SHAPE_H_ diff --git a/src/libs/thorvg/tvgStr.cpp b/src/libs/thorvg/tvgStr.cpp index d0241f4de7..c840232b67 100644 --- a/src/libs/thorvg/tvgStr.cpp +++ b/src/libs/thorvg/tvgStr.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "config.h" diff --git a/src/libs/thorvg/tvgStr.h b/src/libs/thorvg/tvgStr.h index bf21338510..bc4f06acd2 100644 --- a/src/libs/thorvg/tvgStr.h +++ b/src/libs/thorvg/tvgStr.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_STR_H_ diff --git a/src/libs/thorvg/tvgSvgCssStyle.cpp b/src/libs/thorvg/tvgSvgCssStyle.cpp index 0eb6b752ba..caa80e941a 100644 --- a/src/libs/thorvg/tvgSvgCssStyle.cpp +++ b/src/libs/thorvg/tvgSvgCssStyle.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgSvgCssStyle.h" diff --git a/src/libs/thorvg/tvgSvgCssStyle.h b/src/libs/thorvg/tvgSvgCssStyle.h index 24812b3e1a..9920bf3cb2 100644 --- a/src/libs/thorvg/tvgSvgCssStyle.h +++ b/src/libs/thorvg/tvgSvgCssStyle.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SVG_CSS_STYLE_H_ diff --git a/src/libs/thorvg/tvgSvgLoader.cpp b/src/libs/thorvg/tvgSvgLoader.cpp index 0ab6870507..126c1c533e 100644 --- a/src/libs/thorvg/tvgSvgLoader.cpp +++ b/src/libs/thorvg/tvgSvgLoader.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL /* diff --git a/src/libs/thorvg/tvgSvgLoader.h b/src/libs/thorvg/tvgSvgLoader.h index 0f08b2f5ce..ac32eecabc 100644 --- a/src/libs/thorvg/tvgSvgLoader.h +++ b/src/libs/thorvg/tvgSvgLoader.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SVG_LOADER_H_ diff --git a/src/libs/thorvg/tvgSvgLoaderCommon.h b/src/libs/thorvg/tvgSvgLoaderCommon.h index 8f92f66648..ba47e673a8 100644 --- a/src/libs/thorvg/tvgSvgLoaderCommon.h +++ b/src/libs/thorvg/tvgSvgLoaderCommon.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SVG_LOADER_COMMON_H_ diff --git a/src/libs/thorvg/tvgSvgPath.cpp b/src/libs/thorvg/tvgSvgPath.cpp index e2a1e1ff27..3c9f687e44 100644 --- a/src/libs/thorvg/tvgSvgPath.cpp +++ b/src/libs/thorvg/tvgSvgPath.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL /* diff --git a/src/libs/thorvg/tvgSvgPath.h b/src/libs/thorvg/tvgSvgPath.h index 673fa0ddad..1b89007ee9 100644 --- a/src/libs/thorvg/tvgSvgPath.h +++ b/src/libs/thorvg/tvgSvgPath.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SVG_PATH_H_ diff --git a/src/libs/thorvg/tvgSvgSceneBuilder.cpp b/src/libs/thorvg/tvgSvgSceneBuilder.cpp index 9fe2d07d21..cc5ab39bee 100644 --- a/src/libs/thorvg/tvgSvgSceneBuilder.cpp +++ b/src/libs/thorvg/tvgSvgSceneBuilder.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgMath.h" /* to include math.h before cstring */ diff --git a/src/libs/thorvg/tvgSvgSceneBuilder.h b/src/libs/thorvg/tvgSvgSceneBuilder.h index 8ab1b6721d..f179a0bdb2 100644 --- a/src/libs/thorvg/tvgSvgSceneBuilder.h +++ b/src/libs/thorvg/tvgSvgSceneBuilder.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SVG_SCENE_BUILDER_H_ diff --git a/src/libs/thorvg/tvgSvgUtil.cpp b/src/libs/thorvg/tvgSvgUtil.cpp index e8684a7a6a..133e5c84b0 100644 --- a/src/libs/thorvg/tvgSvgUtil.cpp +++ b/src/libs/thorvg/tvgSvgUtil.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include diff --git a/src/libs/thorvg/tvgSvgUtil.h b/src/libs/thorvg/tvgSvgUtil.h index cc4b54c0d0..0f78cf6221 100644 --- a/src/libs/thorvg/tvgSvgUtil.h +++ b/src/libs/thorvg/tvgSvgUtil.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SVG_UTIL_H_ diff --git a/src/libs/thorvg/tvgSwCanvas.cpp b/src/libs/thorvg/tvgSwCanvas.cpp index fa71369ad2..92e09a0c32 100644 --- a/src/libs/thorvg/tvgSwCanvas.cpp +++ b/src/libs/thorvg/tvgSwCanvas.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgCanvas.h" diff --git a/src/libs/thorvg/tvgSwCommon.h b/src/libs/thorvg/tvgSwCommon.h index 3507032d5b..5d66350516 100644 --- a/src/libs/thorvg/tvgSwCommon.h +++ b/src/libs/thorvg/tvgSwCommon.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SW_COMMON_H_ diff --git a/src/libs/thorvg/tvgSwFill.cpp b/src/libs/thorvg/tvgSwFill.cpp index c9e6bb9f20..00d244e5e0 100644 --- a/src/libs/thorvg/tvgSwFill.cpp +++ b/src/libs/thorvg/tvgSwFill.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgMath.h" diff --git a/src/libs/thorvg/tvgSwImage.cpp b/src/libs/thorvg/tvgSwImage.cpp index e2d06837b5..4ce13767e8 100644 --- a/src/libs/thorvg/tvgSwImage.cpp +++ b/src/libs/thorvg/tvgSwImage.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgMath.h" diff --git a/src/libs/thorvg/tvgSwMath.cpp b/src/libs/thorvg/tvgSwMath.cpp index 6161276e44..e6c09afbe9 100644 --- a/src/libs/thorvg/tvgSwMath.cpp +++ b/src/libs/thorvg/tvgSwMath.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgMath.h" diff --git a/src/libs/thorvg/tvgSwMemPool.cpp b/src/libs/thorvg/tvgSwMemPool.cpp index 036690e207..e6d9aee698 100644 --- a/src/libs/thorvg/tvgSwMemPool.cpp +++ b/src/libs/thorvg/tvgSwMemPool.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgSwCommon.h" diff --git a/src/libs/thorvg/tvgSwPostEffect.cpp b/src/libs/thorvg/tvgSwPostEffect.cpp index 386fd73a22..b5b9149c78 100644 --- a/src/libs/thorvg/tvgSwPostEffect.cpp +++ b/src/libs/thorvg/tvgSwPostEffect.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgSwCommon.h" diff --git a/src/libs/thorvg/tvgSwRaster.cpp b/src/libs/thorvg/tvgSwRaster.cpp index 6350597929..a055769c29 100644 --- a/src/libs/thorvg/tvgSwRaster.cpp +++ b/src/libs/thorvg/tvgSwRaster.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifdef _WIN32 diff --git a/src/libs/thorvg/tvgSwRasterAvx.h b/src/libs/thorvg/tvgSwRasterAvx.h index 5c1128c07c..f7df1a3700 100644 --- a/src/libs/thorvg/tvgSwRasterAvx.h +++ b/src/libs/thorvg/tvgSwRasterAvx.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifdef THORVG_AVX_VECTOR_SUPPORT diff --git a/src/libs/thorvg/tvgSwRasterC.h b/src/libs/thorvg/tvgSwRasterC.h index 1e73aa455c..1ad6411d79 100644 --- a/src/libs/thorvg/tvgSwRasterC.h +++ b/src/libs/thorvg/tvgSwRasterC.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL template diff --git a/src/libs/thorvg/tvgSwRasterNeon.h b/src/libs/thorvg/tvgSwRasterNeon.h index 8e05dd98bc..bbb5c080af 100644 --- a/src/libs/thorvg/tvgSwRasterNeon.h +++ b/src/libs/thorvg/tvgSwRasterNeon.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifdef THORVG_NEON_VECTOR_SUPPORT diff --git a/src/libs/thorvg/tvgSwRasterTexmap.h b/src/libs/thorvg/tvgSwRasterTexmap.h index 027af8994a..dbf46af119 100644 --- a/src/libs/thorvg/tvgSwRasterTexmap.h +++ b/src/libs/thorvg/tvgSwRasterTexmap.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL struct Vertex diff --git a/src/libs/thorvg/tvgSwRenderer.cpp b/src/libs/thorvg/tvgSwRenderer.cpp index 1733a1195f..c60457be8f 100644 --- a/src/libs/thorvg/tvgSwRenderer.cpp +++ b/src/libs/thorvg/tvgSwRenderer.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifdef THORVG_SW_OPENMP_SUPPORT diff --git a/src/libs/thorvg/tvgSwRenderer.h b/src/libs/thorvg/tvgSwRenderer.h index 45a54738cf..0717ddf215 100644 --- a/src/libs/thorvg/tvgSwRenderer.h +++ b/src/libs/thorvg/tvgSwRenderer.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SW_RENDERER_H_ diff --git a/src/libs/thorvg/tvgSwRle.cpp b/src/libs/thorvg/tvgSwRle.cpp index d70bac68ce..93da780879 100644 --- a/src/libs/thorvg/tvgSwRle.cpp +++ b/src/libs/thorvg/tvgSwRle.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL /* diff --git a/src/libs/thorvg/tvgSwShape.cpp b/src/libs/thorvg/tvgSwShape.cpp index ca5805b31e..882dffb68e 100644 --- a/src/libs/thorvg/tvgSwShape.cpp +++ b/src/libs/thorvg/tvgSwShape.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgSwCommon.h" diff --git a/src/libs/thorvg/tvgSwStroke.cpp b/src/libs/thorvg/tvgSwStroke.cpp index 527164a1a0..141d8c7a15 100644 --- a/src/libs/thorvg/tvgSwStroke.cpp +++ b/src/libs/thorvg/tvgSwStroke.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include diff --git a/src/libs/thorvg/tvgTaskScheduler.cpp b/src/libs/thorvg/tvgTaskScheduler.cpp index b5c7c2ed9a..69b76a82d9 100644 --- a/src/libs/thorvg/tvgTaskScheduler.cpp +++ b/src/libs/thorvg/tvgTaskScheduler.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgArray.h" diff --git a/src/libs/thorvg/tvgTaskScheduler.h b/src/libs/thorvg/tvgTaskScheduler.h index 5fc2c06296..1fb1677b95 100644 --- a/src/libs/thorvg/tvgTaskScheduler.h +++ b/src/libs/thorvg/tvgTaskScheduler.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_TASK_SCHEDULER_H_ diff --git a/src/libs/thorvg/tvgText.cpp b/src/libs/thorvg/tvgText.cpp index 8888a1bd64..8c7ecc2876 100644 --- a/src/libs/thorvg/tvgText.cpp +++ b/src/libs/thorvg/tvgText.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL diff --git a/src/libs/thorvg/tvgText.h b/src/libs/thorvg/tvgText.h index 42847360d8..9703796a1b 100644 --- a/src/libs/thorvg/tvgText.h +++ b/src/libs/thorvg/tvgText.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_TEXT_H diff --git a/src/libs/thorvg/tvgWgCanvas.cpp b/src/libs/thorvg/tvgWgCanvas.cpp index 591ec0b181..19d508b05d 100644 --- a/src/libs/thorvg/tvgWgCanvas.cpp +++ b/src/libs/thorvg/tvgWgCanvas.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include "tvgCanvas.h" diff --git a/src/libs/thorvg/tvgXmlParser.cpp b/src/libs/thorvg/tvgXmlParser.cpp index 8e9ae15926..0a9c837df1 100644 --- a/src/libs/thorvg/tvgXmlParser.cpp +++ b/src/libs/thorvg/tvgXmlParser.cpp @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #include diff --git a/src/libs/thorvg/tvgXmlParser.h b/src/libs/thorvg/tvgXmlParser.h index be08068608..649166aa7a 100644 --- a/src/libs/thorvg/tvgXmlParser.h +++ b/src/libs/thorvg/tvgXmlParser.h @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_THORVG_INTERNAL #ifndef _TVG_SIMPLE_XML_PARSER_H_ diff --git a/src/libs/tiny_ttf/lv_tiny_ttf.c b/src/libs/tiny_ttf/lv_tiny_ttf.c index 56d62d7f52..4a370dcf24 100644 --- a/src/libs/tiny_ttf/lv_tiny_ttf.c +++ b/src/libs/tiny_ttf/lv_tiny_ttf.c @@ -11,6 +11,8 @@ #if LV_USE_TINY_TTF != 0 #include "../../core/lv_global.h" +#include "../../misc/cache/lv_cache_entry.h" + #define font_draw_buf_handlers &(LV_GLOBAL_DEFAULT()->font_draw_buf_handlers) /********************* diff --git a/src/libs/tiny_ttf/lv_tiny_ttf.h b/src/libs/tiny_ttf/lv_tiny_ttf.h index 09910bca97..6451cb02b3 100644 --- a/src/libs/tiny_ttf/lv_tiny_ttf.h +++ b/src/libs/tiny_ttf/lv_tiny_ttf.h @@ -1,107 +1,2 @@ -/** - * @file lv_tiny_ttf.h - * - */ - -#ifndef LV_TINY_TTF_H -#define LV_TINY_TTF_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_TINY_TTF - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - const char * path; /**< Path to the font file*/ - const void * data; /**< Pointer to the font data*/ - size_t data_size; /**< Size of the font data*/ - size_t cache_size; /**< Size of the font cache*/ -} lv_tiny_ttf_font_src_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_tiny_ttf_font_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -#if LV_TINY_TTF_FILE_SUPPORT != 0 -/** - * Create a font from the specified file or path with the specified line height. - * @param path the path or file name of the font - * @param font_size the font size in pixel - * @return a font object - */ -lv_font_t * lv_tiny_ttf_create_file(const char * path, int32_t font_size); - -/** - * Create a font from the specified file or path with the specified line height with the specified cache size. - * @param path the path or file name of the font - * @param font_size the font size in pixel - * @param kerning kerning value in pixel - * @param cache_size the cache size in count - * @return a font object - */ -lv_font_t * lv_tiny_ttf_create_file_ex(const char * path, int32_t font_size, lv_font_kerning_t kerning, - size_t cache_size); -#endif - -/** - * Create a font from the specified data pointer with the specified line height. - * @param data the data pointer - * @param data_size the data size - * @param font_size the font size in pixel - * @return a font object - */ -lv_font_t * lv_tiny_ttf_create_data(const void * data, size_t data_size, int32_t font_size); - -/** - * Create a font from the specified data pointer with the specified line height and the specified cache size. - * @param data the data pointer - * @param data_size the data size - * @param font_size the font size in pixel - * @param kerning kerning value in pixel - * @param cache_size the cache size in count - * @return - */ -lv_font_t * lv_tiny_ttf_create_data_ex(const void * data, size_t data_size, int32_t font_size, - lv_font_kerning_t kerning, size_t cache_size); - -/** - * Set the size of the font to a new font_size - * @note the font bitmap cache and glyph cache will be flushed. - * @param font the font object - * @param font_size the font size in pixel - */ -void lv_tiny_ttf_set_size(lv_font_t * font, int32_t font_size); - -/** - * Destroy a font previously created with lv_tiny_ttf_create_xxxx() - * @param font the font object - */ -void lv_tiny_ttf_destroy(lv_font_t * font); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TINY_TTF*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TINY_TTF_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/tjpgd/lv_tjpgd.c b/src/libs/tjpgd/lv_tjpgd.c index 3208d1aa13..540b8cbb58 100644 --- a/src/libs/tjpgd/lv_tjpgd.c +++ b/src/libs/tjpgd/lv_tjpgd.c @@ -7,12 +7,12 @@ * INCLUDES *********************/ -#include "../../draw/lv_image_decoder_private.h" -#include "../../../lvgl.h" +#include "../../lv_public_api.h" + #if LV_USE_TJPGD +#include "../../draw/lv_image_decoder_private.h" #include "tjpgd.h" -#include "lv_tjpgd.h" #include "../../misc/lv_fs_private.h" #include diff --git a/src/libs/tjpgd/lv_tjpgd.h b/src/libs/tjpgd/lv_tjpgd.h index ec35800b23..1d70bbd2ed 100644 --- a/src/libs/tjpgd/lv_tjpgd.h +++ b/src/libs/tjpgd/lv_tjpgd.h @@ -1,45 +1,2 @@ -/** - * @file lv_tjpgd.h - * - */ - -#ifndef LV_TJPGD_H -#define LV_TJPGD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#if LV_USE_TJPGD - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -void lv_tjpgd_init(void); - -void lv_tjpgd_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TJPGD*/ - -#ifdef __cplusplus -} -#endif - -#endif /* LV_TJPGD_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/libs/tjpgd/tjpgd.h b/src/libs/tjpgd/tjpgd.h index 887038a2b7..ee268ad5ea 100644 --- a/src/libs/tjpgd/tjpgd.h +++ b/src/libs/tjpgd/tjpgd.h @@ -8,7 +8,7 @@ extern "C" { #endif -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #include "tjpgdcnf.h" #if LV_USE_TJPGD diff --git a/src/libs/vg_lite_driver/VGLite/Series/gc255/0x40A/vg_lite_options.h b/src/libs/vg_lite_driver/VGLite/Series/gc255/0x40A/vg_lite_options.h index 11ee09a160..a0b75c8763 100755 --- a/src/libs/vg_lite_driver/VGLite/Series/gc255/0x40A/vg_lite_options.h +++ b/src/libs/vg_lite_driver/VGLite/Series/gc255/0x40A/vg_lite_options.h @@ -28,7 +28,7 @@ #ifndef VG_LITE_OPTIONS_H #define VG_LITE_OPTIONS_H -#include "../../../../../../lv_conf_internal.h" +#include "../../../../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #define CHIPID 0x255 diff --git a/src/libs/vg_lite_driver/VGLite/Series/gc355/0x0_1215/vg_lite_options.h b/src/libs/vg_lite_driver/VGLite/Series/gc355/0x0_1215/vg_lite_options.h index 80a545b507..87dd96907d 100755 --- a/src/libs/vg_lite_driver/VGLite/Series/gc355/0x0_1215/vg_lite_options.h +++ b/src/libs/vg_lite_driver/VGLite/Series/gc355/0x0_1215/vg_lite_options.h @@ -28,7 +28,7 @@ #ifndef VG_LITE_OPTIONS_H #define VG_LITE_OPTIONS_H -#include "../../../../../../lv_conf_internal.h" +#include "../../../../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #define CHIPID 0x355 diff --git a/src/libs/vg_lite_driver/VGLite/Series/gc355/0x0_1216/vg_lite_options.h b/src/libs/vg_lite_driver/VGLite/Series/gc355/0x0_1216/vg_lite_options.h index 8322499372..ec647f5fe6 100755 --- a/src/libs/vg_lite_driver/VGLite/Series/gc355/0x0_1216/vg_lite_options.h +++ b/src/libs/vg_lite_driver/VGLite/Series/gc355/0x0_1216/vg_lite_options.h @@ -27,7 +27,7 @@ #ifndef VG_LITE_OPTIONS_H #define VG_LITE_OPTIONS_H -#include "../../../../../../lv_conf_internal.h" +#include "../../../../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #define CHIPID 0x355 diff --git a/src/libs/vg_lite_driver/VGLite/Series/gc555/0x423/vg_lite_options.h b/src/libs/vg_lite_driver/VGLite/Series/gc555/0x423/vg_lite_options.h index e6663f2a30..2bff7f0956 100755 --- a/src/libs/vg_lite_driver/VGLite/Series/gc555/0x423/vg_lite_options.h +++ b/src/libs/vg_lite_driver/VGLite/Series/gc555/0x423/vg_lite_options.h @@ -28,7 +28,7 @@ #ifndef VG_LITE_OPTIONS_H #define VG_LITE_OPTIONS_H -#include "../../../../../../lv_conf_internal.h" +#include "../../../../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #define CHIPID 0x555 diff --git a/src/libs/vg_lite_driver/VGLite/Series/gc555/0x423_ECO/vg_lite_options.h b/src/libs/vg_lite_driver/VGLite/Series/gc555/0x423_ECO/vg_lite_options.h index f67dc0a295..e9f771e018 100755 --- a/src/libs/vg_lite_driver/VGLite/Series/gc555/0x423_ECO/vg_lite_options.h +++ b/src/libs/vg_lite_driver/VGLite/Series/gc555/0x423_ECO/vg_lite_options.h @@ -28,7 +28,7 @@ #ifndef VG_LITE_OPTIONS_H #define VG_LITE_OPTIONS_H -#include "../../../../../../lv_conf_internal.h" +#include "../../../../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #define CHIPID 0x555 diff --git a/src/libs/vg_lite_driver/VGLite/vg_lite.c b/src/libs/vg_lite_driver/VGLite/vg_lite.c index 207747a893..7a9b811f88 100755 --- a/src/libs/vg_lite_driver/VGLite/vg_lite.c +++ b/src/libs/vg_lite_driver/VGLite/vg_lite.c @@ -25,7 +25,7 @@ * *****************************************************************************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include "vg_lite_context.h" diff --git a/src/libs/vg_lite_driver/VGLite/vg_lite_context.h b/src/libs/vg_lite_driver/VGLite/vg_lite_context.h index a09cf687ee..07eeb3dac7 100755 --- a/src/libs/vg_lite_driver/VGLite/vg_lite_context.h +++ b/src/libs/vg_lite_driver/VGLite/vg_lite_context.h @@ -25,7 +25,7 @@ * *****************************************************************************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include diff --git a/src/libs/vg_lite_driver/VGLite/vg_lite_image.c b/src/libs/vg_lite_driver/VGLite/vg_lite_image.c index 358eac4f51..82c1aeb88a 100755 --- a/src/libs/vg_lite_driver/VGLite/vg_lite_image.c +++ b/src/libs/vg_lite_driver/VGLite/vg_lite_image.c @@ -25,7 +25,7 @@ * *****************************************************************************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include "vg_lite_context.h" diff --git a/src/libs/vg_lite_driver/VGLite/vg_lite_matrix.c b/src/libs/vg_lite_driver/VGLite/vg_lite_matrix.c index 7858566387..5305f9fcdc 100755 --- a/src/libs/vg_lite_driver/VGLite/vg_lite_matrix.c +++ b/src/libs/vg_lite_driver/VGLite/vg_lite_matrix.c @@ -25,7 +25,7 @@ * *****************************************************************************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include diff --git a/src/libs/vg_lite_driver/VGLite/vg_lite_options.h b/src/libs/vg_lite_driver/VGLite/vg_lite_options.h index 6ee997d7ee..c89388f925 100755 --- a/src/libs/vg_lite_driver/VGLite/vg_lite_options.h +++ b/src/libs/vg_lite_driver/VGLite/vg_lite_options.h @@ -28,7 +28,7 @@ #ifndef VG_LITE_OPTIONS_DISPATCH_H #define VG_LITE_OPTIONS_DISPATCH_H -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #define VG_LITE_OPTIONS VG_LITE_OPTIONS_2 diff --git a/src/libs/vg_lite_driver/VGLite/vg_lite_path.c b/src/libs/vg_lite_driver/VGLite/vg_lite_path.c index e7dfaf9fcb..28a478040d 100755 --- a/src/libs/vg_lite_driver/VGLite/vg_lite_path.c +++ b/src/libs/vg_lite_driver/VGLite/vg_lite_path.c @@ -25,7 +25,7 @@ * *****************************************************************************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include "vg_lite_context.h" diff --git a/src/libs/vg_lite_driver/VGLite/vg_lite_stroke.c b/src/libs/vg_lite_driver/VGLite/vg_lite_stroke.c index 16c7c09d75..f04e9848e9 100755 --- a/src/libs/vg_lite_driver/VGLite/vg_lite_stroke.c +++ b/src/libs/vg_lite_driver/VGLite/vg_lite_stroke.c @@ -25,7 +25,7 @@ * *****************************************************************************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include "vg_lite_context.h" diff --git a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_debug.h b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_debug.h index 9feb7c6de1..e00f254fb3 100755 --- a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_debug.h +++ b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_debug.h @@ -28,7 +28,7 @@ #ifndef VG_LITE_DEBUG_H #define VG_LITE_DEBUG_H -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include "vg_lite_kernel.h" diff --git a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_hal.h b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_hal.h index 182698815e..d00079464f 100755 --- a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_hal.h +++ b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_hal.h @@ -55,7 +55,7 @@ #ifndef VG_LITE_HAL_H #define VG_LITE_HAL_H -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #define VGLITE_MEM_ALIGNMENT 128 diff --git a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_hw.h b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_hw.h index a4c7332616..5d1a4e9384 100755 --- a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_hw.h +++ b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_hw.h @@ -55,7 +55,7 @@ #ifndef VG_LITE_HW_H #define VG_LITE_HW_H -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #define VG_LITE_HW_CLOCK_CONTROL 0x000 diff --git a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_kernel.c b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_kernel.c index 012a02e911..1880317095 100755 --- a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_kernel.c +++ b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_kernel.c @@ -52,7 +52,7 @@ * *****************************************************************************/ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include "../lv_vg_lite_hal/vg_lite_platform.h" diff --git a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_kernel.h b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_kernel.h index 7ed3696ff8..19e5f2dd05 100755 --- a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_kernel.h +++ b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_kernel.h @@ -55,7 +55,7 @@ #ifndef VG_LITE_KERNEL_H #define VG_LITE_KERNEL_H -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include "../VGLite/vg_lite_options.h" diff --git a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_option.h b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_option.h index d47de5b75e..c45a48c534 100755 --- a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_option.h +++ b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_option.h @@ -55,7 +55,7 @@ #ifndef VG_LITE_KERNEL_OPTION_H #define VG_LITE_KERNEL_OPTION_H -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #ifdef __cplusplus diff --git a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_type.h b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_type.h index b24fb0eccf..d451e9e623 100755 --- a/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_type.h +++ b/src/libs/vg_lite_driver/VGLiteKernel/vg_lite_type.h @@ -27,7 +27,7 @@ #ifndef VG_LITE_TYPE_H #define VG_LITE_TYPE_H -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #if __KERNEL__ diff --git a/src/libs/vg_lite_driver/add_lvgl_if.sh b/src/libs/vg_lite_driver/add_lvgl_if.sh index 09c7513ed5..a865a1b2d1 100755 --- a/src/libs/vg_lite_driver/add_lvgl_if.sh +++ b/src/libs/vg_lite_driver/add_lvgl_if.sh @@ -5,7 +5,7 @@ # find -name "*.c" | xargs ./add_lvgl_if.sh # find -name "t*.h" | xargs ./add_lvgl_if.sh -sed '0,/\*\/$/ {/\*\/$/ {n; s|^|\n#include "../../lv_conf_internal.h"\n#if LV_USE_VG_LITE_DRIVER\n|}}' $@ -i +sed '0,/\*\/$/ {/\*\/$/ {n; s|^|\n#include "../../lv_public_api.h"\n#if LV_USE_VG_LITE_DRIVER\n|}}' $@ -i sed -i -e '$a\ \ diff --git a/src/libs/vg_lite_driver/inc/vg_lite.h b/src/libs/vg_lite_driver/inc/vg_lite.h index cf53908f6b..17a17563e0 100755 --- a/src/libs/vg_lite_driver/inc/vg_lite.h +++ b/src/libs/vg_lite_driver/inc/vg_lite.h @@ -36,7 +36,7 @@ extern "C" { #define inline __inline #endif -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include diff --git a/src/libs/vg_lite_driver/lv_vg_lite_hal/lv_vg_lite_hal.c b/src/libs/vg_lite_driver/lv_vg_lite_hal/lv_vg_lite_hal.c index 657b05ea34..bd41386714 100644 --- a/src/libs/vg_lite_driver/lv_vg_lite_hal/lv_vg_lite_hal.c +++ b/src/libs/vg_lite_driver/lv_vg_lite_hal/lv_vg_lite_hal.c @@ -1,9 +1,8 @@ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include "../../../osal/lv_os_private.h" -#include "../../../stdlib/lv_mem.h" #if LV_USE_OS == LV_OS_NONE #error "VGLite hal needs support from an OS, please select one of the supported by LVGL!" diff --git a/src/libs/vg_lite_driver/lv_vg_lite_hal/vg_lite_os.c b/src/libs/vg_lite_driver/lv_vg_lite_hal/vg_lite_os.c index d7950a6bd3..41ef0d01bc 100755 --- a/src/libs/vg_lite_driver/lv_vg_lite_hal/vg_lite_os.c +++ b/src/libs/vg_lite_driver/lv_vg_lite_hal/vg_lite_os.c @@ -1,4 +1,4 @@ -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER #include "../../../lvgl.h" diff --git a/src/libs/vg_lite_driver/lv_vg_lite_hal/vg_lite_platform.h b/src/libs/vg_lite_driver/lv_vg_lite_hal/vg_lite_platform.h index 41f05312e0..0240590237 100644 --- a/src/libs/vg_lite_driver/lv_vg_lite_hal/vg_lite_platform.h +++ b/src/libs/vg_lite_driver/lv_vg_lite_hal/vg_lite_platform.h @@ -1,11 +1,11 @@ #ifndef VG_LITE_PLATFORM_H #define VG_LITE_PLATFORM_H -#include "../../../lv_conf_internal.h" +#include "../../../lv_public_api.h" #if LV_USE_VG_LITE_DRIVER -#include "stdint.h" -#include "stdlib.h" +#include +#include #include #include "../VGLiteKernel/vg_lite_debug.h" #include "../VGLiteKernel/vg_lite_type.h" @@ -49,4 +49,4 @@ void vg_lite_IRQHandler(void); #endif /* LV_USE_VG_LITE_DRIVER */ -#endif /* VG_LITE_PLATFORM_H */ \ No newline at end of file +#endif /* VG_LITE_PLATFORM_H */ diff --git a/src/lv_api_map_v8.h b/src/lv_api_map_v8.h index 822450f574..0509e44863 100644 --- a/src/lv_api_map_v8.h +++ b/src/lv_api_map_v8.h @@ -1,328 +1,2 @@ -/** - * @file lv_api_map_v8.h - * - */ - -#ifndef LV_API_MAP_V8_H -#define LV_API_MAP_V8_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -#define LV_DISP_ROTATION_0 LV_DISPLAY_ROTATION_0 -#define LV_DISP_ROTATION_90 LV_DISPLAY_ROTATION_90 -#define LV_DISP_ROTATION_180 LV_DISPLAY_ROTATION_180 -#define LV_DISP_ROTATION_270 LV_DISPLAY_ROTATION_270 - -#define LV_DISP_RENDER_MODE_PARTIAL LV_DISPLAY_RENDER_MODE_PARTIAL -#define LV_DISP_RENDER_MODE_DIRECT LV_DISPLAY_RENDER_MODE_DIRECT -#define LV_DISP_RENDER_MODE_FULL LV_DISPLAY_RENDER_MODE_FULL - -#if LV_USE_BUTTONMATRIX -#define LV_BTNMATRIX_BTN_NONE LV_BUTTONMATRIX_BUTTON_NONE - -#define LV_BTNMATRIX_CTRL_HIDDEN LV_BUTTONMATRIX_CTRL_HIDDEN -#define LV_BTNMATRIX_CTRL_NO_REPEAT LV_BUTTONMATRIX_CTRL_NO_REPEAT -#define LV_BTNMATRIX_CTRL_DISABLED LV_BUTTONMATRIX_CTRL_DISABLED -#define LV_BTNMATRIX_CTRL_CHECKABLE LV_BUTTONMATRIX_CTRL_CHECKABLE -#define LV_BTNMATRIX_CTRL_CHECKED LV_BUTTONMATRIX_CTRL_CHECKED -#define LV_BTNMATRIX_CTRL_CLICK_TRIG LV_BUTTONMATRIX_CTRL_CLICK_TRIG -#define LV_BTNMATRIX_CTRL_POPOVER LV_BUTTONMATRIX_CTRL_POPOVER -#define LV_BTNMATRIX_CTRL_CUSTOM_1 LV_BUTTONMATRIX_CTRL_CUSTOM_1 -#define LV_BTNMATRIX_CTRL_CUSTOM_2 LV_BUTTONMATRIX_CTRL_CUSTOM_2 -#endif /* LV_USE_BUTTONMATRIX */ - -/********************** - * TYPEDEFS - **********************/ -typedef int32_t lv_coord_t; -typedef lv_result_t lv_res_t; -typedef lv_image_dsc_t lv_img_dsc_t; -typedef lv_display_t lv_disp_t; -typedef lv_display_rotation_t lv_disp_rotation_t; -typedef lv_display_render_mode_t lv_disp_render_t; -typedef lv_anim_completed_cb_t lv_anim_ready_cb_t; -typedef lv_screen_load_anim_t lv_scr_load_anim_t; - -#if LV_USE_BUTTONMATRIX -typedef lv_buttonmatrix_ctrl_t lv_btnmatrix_ctrl_t; -#endif /* LV_USE_BUTTONMATRIX */ - -#if LV_USE_IMAGEBUTTON -#define LV_IMGBTN_STATE_RELEASED LV_IMAGEBUTTON_STATE_RELEASED -#define LV_IMGBTN_STATE_PRESSED LV_IMAGEBUTTON_STATE_PRESSED -#define LV_IMGBTN_STATE_DISABLED LV_IMAGEBUTTON_STATE_DISABLED -#define LV_IMGBTN_STATE_CHECKED_RELEASED LV_IMAGEBUTTON_STATE_CHECKED_RELEASED -#define LV_IMGBTN_STATE_CHECKED_PRESSED LV_IMAGEBUTTON_STATE_CHECKED_PRESSED -#define LV_IMGBTN_STATE_CHECKED_DISABLED LV_IMAGEBUTTON_STATE_CHECKED_DISABLED -#endif /* LV_USE_IMAGEBUTTON */ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -static inline LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_task_handler(void) -{ - return lv_timer_handler(); -} - -/** - * Move the object to the foreground. - * It will look like if it was created as the last child of its parent. - * It also means it can cover any of the siblings. - * @param obj pointer to an object - */ -static inline void lv_obj_move_foreground(lv_obj_t * obj) -{ - lv_obj_t * parent = lv_obj_get_parent(obj); - if(!parent) { - LV_LOG_WARN("parent is NULL"); - return; - } - - lv_obj_move_to_index(obj, lv_obj_get_child_count(parent) - 1); -} - -/** - * Move the object to the background. - * It will look like if it was created as the first child of its parent. - * It also means any of the siblings can cover the object. - * @param obj pointer to an object - */ -static inline void lv_obj_move_background(lv_obj_t * obj) -{ - lv_obj_move_to_index(obj, 0); -} - -/********************** - * MACROS - **********************/ -#define LV_RES_OK LV_RESULT_OK -#define LV_RES_INV LV_RESULT_INVALID - -#define LV_INDEV_STATE_PR LV_INDEV_STATE_PRESSED -#define LV_INDEV_STATE_REL LV_INDEV_STATE_RELEASED - -#define lv_obj_del lv_obj_delete -#define lv_obj_del_async lv_obj_delete_async -#define lv_obj_clear_flag lv_obj_remove_flag -#define lv_obj_clear_state lv_obj_remove_state - -#define lv_indev_set_disp lv_indev_set_display -#define lv_indev_get_act lv_indev_active -#define lv_scr_act lv_screen_active -#define lv_disp_remove lv_display_delete -#define lv_disp_set_default lv_display_set_default -#define lv_disp_get_default lv_display_get_default -#define lv_disp_get_next lv_display_get_next -#define lv_disp_set_rotation lv_display_set_rotation -#define lv_disp_get_hor_res lv_display_get_horizontal_resolution -#define lv_disp_get_ver_res lv_display_get_vertical_resolution -#define lv_disp_get_physical_hor_res lv_display_get_physical_horizontal_resolution -#define lv_disp_get_physical_ver_res lv_display_get_physical_vertical_resolution -#define lv_disp_get_offset_x lv_display_get_offset_x -#define lv_disp_get_offset_y lv_display_get_offset_y -#define lv_disp_get_rotation lv_display_get_rotation -#define lv_disp_get_dpi lv_display_get_dpi -#define lv_disp_get_antialiasing lv_display_get_antialiasing -#define lv_disp_flush_ready lv_display_flush_ready -#define lv_disp_flush_is_last lv_display_flush_is_last -#define lv_disp_get_scr_act lv_display_get_screen_active -#define lv_disp_get_scr_prev lv_display_get_screen_prev -#define lv_disp_load_scr lv_screen_load -#define lv_scr_load lv_screen_load -#define lv_scr_load_anim lv_screen_load_anim -#define lv_disp_get_layer_top lv_display_get_layer_top -#define lv_disp_get_layer_sys lv_display_get_layer_sys -#define lv_disp_send_event lv_display_send_event -#define lv_disp_set_theme lv_display_set_theme -#define lv_disp_get_theme lv_display_get_theme -#define lv_disp_get_inactive_time lv_display_get_inactive_time -#define lv_disp_trig_activity lv_display_trigger_activity -#define lv_disp_enable_invalidation lv_display_enable_invalidation -#define lv_disp_is_invalidation_enabled lv_display_is_invalidation_enabled -#define lv_disp_refr_timer lv_display_refr_timer -#define lv_disp_get_refr_timer lv_display_get_refr_timer - -#define lv_timer_del lv_timer_delete - -#define lv_anim_del lv_anim_delete -#define lv_anim_del_all lv_anim_delete_all -#define lv_anim_set_ready_cb lv_anim_set_completed_cb - -#define lv_group_del lv_group_delete - -#if LV_USE_TEXTAREA -#define lv_txt_get_size lv_text_get_size -#define lv_txt_get_width lv_text_get_width -#endif /* LV_USE_TEXTAREA */ - -#if LV_USE_IMAGE -#define lv_img_create lv_image_create -#define lv_img_set_src lv_image_set_src -#define lv_img_set_offset_x lv_image_set_offset_x -#define lv_img_set_offset_y lv_image_set_offset_y -#define lv_img_set_angle lv_image_set_rotation -#define lv_img_set_pivot lv_image_set_pivot -#define lv_img_set_zoom lv_image_set_scale -#define lv_img_set_antialias lv_image_set_antialias -#define lv_img_get_src lv_image_get_src -#define lv_img_get_offset_x lv_image_get_offset_x -#define lv_img_get_offset_y lv_image_get_offset_y -#define lv_img_get_angle lv_image_get_rotation -#define lv_img_get_pivot lv_image_get_pivot -#define lv_img_get_zoom lv_image_get_scale -#define lv_img_get_antialias lv_image_get_antialias -#endif /* LV_USE_IMAGE */ - -#if LV_USE_IMAGEBUTTON -#define lv_imgbtn_create lv_imagebutton_create -#define lv_imgbtn_set_src lv_imagebutton_set_src -#define lv_imgbtn_set_state lv_imagebutton_set_state -#define lv_imgbtn_get_src_left lv_imagebutton_get_src_left -#define lv_imgbtn_get_src_middle lv_imagebutton_get_src_middle -#define lv_imgbtn_get_src_right lv_imagebutton_get_src_right -#endif /* LV_USE_IMAGEBUTTON */ - -#if LV_USE_LIST -#define lv_list_set_btn_text lv_list_set_button_text -#define lv_list_get_btn_text lv_list_get_button_text -#define lv_list_add_btn lv_list_add_button -#endif /* LV_USE_LIST */ - -#if LV_USE_BUTTON -#define lv_btn_create lv_button_create -#endif /* LV_USE_BUTTON */ - -#if LV_USE_BUTTONMATRIX -#define lv_btnmatrix_create lv_buttonmatrix_create -#define lv_btnmatrix_set_map lv_buttonmatrix_set_map -#define lv_btnmatrix_set_ctrl_map lv_buttonmatrix_set_ctrl_map -#define lv_btnmatrix_set_selected_btn lv_buttonmatrix_set_selected_button -#define lv_btnmatrix_set_btn_ctrl lv_buttonmatrix_set_button_ctrl -#define lv_btnmatrix_clear_btn_ctrl lv_buttonmatrix_clear_button_ctrl -#define lv_btnmatrix_set_btn_ctrl_all lv_buttonmatrix_set_button_ctrl_all -#define lv_btnmatrix_clear_btn_ctrl_all lv_buttonmatrix_clear_button_ctrl_all -#define lv_btnmatrix_set_btn_width lv_buttonmatrix_set_button_width -#define lv_btnmatrix_set_one_checked lv_buttonmatrix_set_one_checked -#define lv_btnmatrix_get_map lv_buttonmatrix_get_map -#define lv_btnmatrix_get_selected_btn lv_buttonmatrix_get_selected_button -#define lv_btnmatrix_get_btn_text lv_buttonmatrix_get_button_text -#define lv_btnmatrix_has_button_ctrl lv_buttonmatrix_has_button_ctrl -#define lv_btnmatrix_get_one_checked lv_buttonmatrix_get_one_checked -#endif /* LV_USE_BUTTONMATRIX */ - -#if LV_USE_TABVIEW -#define lv_tabview_get_tab_btns lv_tabview_get_tab_bar -#define lv_tabview_get_tab_act lv_tabview_get_tab_active -#define lv_tabview_set_act lv_tabview_set_active -#endif /* LV_USE_TABVIEW */ - -#if LV_USE_TILEVIEW -#define lv_tileview_get_tile_act lv_tileview_get_tile_active -#define lv_obj_set_tile_id lv_tileview_set_tile_by_index -#define lv_obj_set_tile lv_tileview_set_tile -#endif /* LV_USE_TILEVIEW */ - -#if LV_USE_ROLLER -#define lv_roller_set_visible_row_cnt lv_roller_set_visible_row_count -#define lv_roller_get_option_cnt lv_roller_get_option_count -#endif /* LV_USE_ROLLER */ - -#if LV_USE_TABLE -#define lv_table_set_col_cnt lv_table_set_column_count -#define lv_table_set_row_cnt lv_table_set_row_count -#define lv_table_get_col_cnt lv_table_get_column_count -#define lv_table_get_row_cnt lv_table_get_row_count -#define lv_table_set_col_width lv_table_set_column_width -#define lv_table_get_col_width lv_table_get_column_width -#endif /* LV_USE_TABLE */ - -#if LV_USE_DROPDOWN -#define lv_dropdown_get_option_cnt lv_dropdown_get_option_count -#endif /* LV_USE_DROPDOWN */ - -#define lv_obj_get_child_cnt lv_obj_get_child_count -#define lv_obj_get_disp lv_obj_get_display -#define lv_obj_delete_anim_ready_cb lv_obj_delete_anim_completed_cb - -#define LV_STYLE_ANIM_TIME LV_STYLE_ANIM_DURATION -#define LV_STYLE_IMG_OPA LV_STYLE_IMAGE_OPA -#define LV_STYLE_IMG_RECOLOR LV_STYLE_IMAGE_RECOLOR -#define LV_STYLE_IMG_RECOLOR_OPA LV_STYLE_IMAGE_RECOLOR_OPA -#define LV_STYLE_SHADOW_OFS_X LV_STYLE_SHADOW_OFFSET_X -#define LV_STYLE_SHADOW_OFS_Y LV_STYLE_SHADOW_OFFSET_Y -#define LV_STYLE_TRANSFORM_ANGLE LV_STYLE_TRANSFORM_ROTATION - -#define lv_obj_get_style_anim_time lv_obj_get_style_anim_duration -#define lv_obj_get_style_img_opa lv_obj_get_style_image_opa -#define lv_obj_get_style_img_recolor lv_obj_get_style_image_recolor -#define lv_obj_get_style_img_recolor_filtered lv_obj_get_style_image_recolor_filtered -#define lv_obj_get_style_img_recolor_opa lv_obj_get_style_image_recolor_opa -#define lv_obj_get_style_shadow_ofs_x lv_obj_get_style_shadow_offset_x -#define lv_obj_get_style_shadow_ofs_y lv_obj_get_style_shadow_offset_y -#define lv_obj_get_style_transform_angle lv_obj_get_style_transform_rotation -#define lv_obj_get_style_bg_img_src lv_obj_get_style_bg_image_src -#define lv_obj_get_style_bg_img_recolor lv_obj_get_style_bg_image_recolor -#define lv_obj_get_style_bg_img_recolor_opa lv_obj_get_style_bg_image_recolor_opa - -#define lv_obj_set_style_anim_time lv_obj_set_style_anim_duration -#define lv_obj_set_style_img_opa lv_obj_set_style_image_opa -#define lv_obj_set_style_img_recolor lv_obj_set_style_image_recolor -#define lv_obj_set_style_img_recolor_opa lv_obj_set_style_image_recolor_opa -#define lv_obj_set_style_shadow_ofs_x lv_obj_set_style_shadow_offset_x -#define lv_obj_set_style_shadow_ofs_y lv_obj_set_style_shadow_offset_y -#define lv_obj_set_style_transform_zoom lv_obj_set_style_transform_scale -#define lv_obj_set_style_transform_angle lv_obj_set_style_transform_rotation -#define lv_obj_set_style_bg_img_src lv_obj_set_style_bg_image_src -#define lv_obj_set_style_bg_img_recolor lv_obj_set_style_bg_image_recolor -#define lv_obj_set_style_bg_img_recolor_opa lv_obj_set_style_bg_image_recolor_opa - -#define lv_style_set_anim_time lv_style_set_anim_duration -#define lv_style_set_img_opa lv_style_set_image_opa -#define lv_style_set_img_recolor lv_style_set_image_recolor -#define lv_style_set_img_recolor_opa lv_style_set_image_recolor_opa -#define lv_style_set_shadow_ofs_x lv_style_set_shadow_offset_x -#define lv_style_set_shadow_ofs_y lv_style_set_shadow_offset_y -#define lv_style_set_transform_angle lv_style_set_transform_rotation -#define lv_style_set_transform_zoom lv_style_set_transform_scale -#define lv_style_set_bg_img_src lv_style_set_bg_image_src -#define lv_style_set_bg_img_recolor lv_style_set_bg_image_recolor -#define lv_style_set_bg_img_recolor_opa lv_style_set_bg_image_recolor_opa - -#if LV_USE_KEYBOARD -#define lv_keyboard_get_selected_btn lv_keyboard_get_selected_button -#define lv_keyboard_get_btn_text lv_keyboard_get_button_text -#endif /* LV_USE_KEYBOARD */ - -#define LV_ZOOM_NONE LV_SCALE_NONE - -#define lv_image_decoder_built_in_open lv_bin_decoder_open -#define lv_image_decoder_built_in_close lv_bin_decoder_close - -/********************** - * MACROS - **********************/ -/** Use this macro to declare an image in a C file*/ -#define LV_IMG_DECLARE(var_name) extern const lv_image_dsc_t var_name; - -/********************** - * DEPRECATED FUNCTIONS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_API_MAP_V8_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_api_map_v9_0.h b/src/lv_api_map_v9_0.h index b0d22cdf50..205af2dc1e 100644 --- a/src/lv_api_map_v9_0.h +++ b/src/lv_api_map_v9_0.h @@ -1,66 +1,2 @@ -/** - * @file lv_api_map_v9_0.h - * - */ - -#ifndef LV_API_MAP_V9_0_H -#define LV_API_MAP_V9_0_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ -#define lv_image_set_align lv_image_set_inner_align -#define lv_image_get_align lv_image_get_inner_align - -#ifndef LV_DRAW_LAYER_SIMPLE_BUF_SIZE -#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE -#endif - -#define lv_button_bind_checked lv_obj_bind_checked - -#define LV_DRAW_BUF_DEFINE LV_DRAW_BUF_DEFINE_STATIC - -#define _lv_utils_bsearch lv_utils_bsearch -#define lv_draw_buf_align_user lv_draw_buf_align_ex -#define lv_draw_buf_create_user lv_draw_buf_create_ex -#define lv_draw_buf_width_to_stride_user lv_draw_buf_width_to_stride_ex -#define lv_draw_buf_dup_user lv_draw_buf_dup_ex - -#define lv_draw_buf_invalidate_cache_user(handlers, drawbuf, area) lv_draw_buf_invalidate_cache(drawbuf, area) -#define lv_draw_buf_flush_cache_user(handlers, drawbuf, area) lv_draw_buf_flush_cache(drawbuf, area) -#define lv_draw_buf_destroy_user(handlers, drawbuf) lv_draw_buf_destroy(drawbuf) - -/********************** - * MACROS - **********************/ - -/********************** - * DEPRECATED FUNCTIONS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_API_MAP_V9_0_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_api_map_v9_1.h b/src/lv_api_map_v9_1.h index 162101365b..dd012e1109 100644 --- a/src/lv_api_map_v9_1.h +++ b/src/lv_api_map_v9_1.h @@ -1,129 +1,2 @@ -/** - * @file lv_api_map_v9_1.h - * - */ - -#ifndef LV_API_MAP_V9_1_H -#define LV_API_MAP_V9_1_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -/********************** - * MACROS - **********************/ - -#define _LV_EVENT_LAST LV_EVENT_LAST -#define _lv_event_code_t lv_event_code_t -#define _lv_event_mark_deleted lv_event_mark_deleted -#define lv_obj_add_event lv_obj_add_event_cb - -#define _LV_STYLE_LAST_BUILT_IN_PROP LV_STYLE_LAST_BUILT_IN_PROP -#define _LV_FLEX_REVERSE LV_FLEX_REVERSE -#define _LV_FLEX_WRAP LV_FLEX_WRAP -#define _LV_FLEX_COLUMN LV_FLEX_COLUMN - -#define _lv_area_is_equal lv_area_is_equal -#define _lv_area_is_in lv_area_is_in -#define _lv_area_intersect lv_area_intersect -#define _lv_area_is_point_on lv_area_is_point_on -#define _lv_area_join lv_area_join -#define _lv_image_buf_get_transformed_area lv_image_buf_get_transformed_area - -#define _lv_ll_init lv_ll_init -#define _lv_ll_ins_head lv_ll_ins_head -#define _lv_ll_ins_prev lv_ll_ins_prev -#define _lv_ll_ins_tail lv_ll_ins_tail -#define _lv_ll_get_head lv_ll_get_head -#define _lv_ll_get_tail lv_ll_get_tail -#define _lv_ll_get_next lv_ll_get_next -#define _lv_ll_get_prev lv_ll_get_prev -#define _lv_ll_get_len lv_ll_get_len -#define _lv_ll_move_before lv_ll_move_before -#define _lv_ll_is_empty lv_ll_is_empty -#define _lv_ll_clear lv_ll_clear -#define _lv_ll_remove lv_ll_remove -#define _lv_ll_chg_list lv_ll_chg_list -#define _LV_LL_READ LV_LL_READ -#define _LV_LL_READ_BACK LV_LL_READ_BACK - -#define _lv_obj_scroll_by_raw lv_obj_scroll_by_raw -#define _lv_obj_get_ext_draw_size lv_obj_get_ext_draw_size -#define _lv_indev_scroll_handler lv_indev_scroll_handler - -#define _lv_display_refr_timer lv_disp_refr_timer -#define _lv_disp_refr_timer lv_disp_refr_timer -#define _lv_disp_get_refr_timer lv_disp_get_refr_timer - -#define lv_obj_get_child_by_id lv_obj_find_by_id -#define lv_obj_update_flag lv_obj_set_flag - -#define _lv_inv_area lv_inv_area -#define lv_chart_set_all_value lv_chart_set_all_values -#define lv_calendar_set_showed_date lv_calendar_set_month_shown -#define lv_chart_set_range lv_chart_set_axis_range -#define lv_chart_set_value_by_id lv_chart_set_series_value_by_id -#define lv_chart_get_x_array lv_chart_get_series_x_array -#define lv_chart_get_y_array lv_chart_get_series_y_array -#define lv_chart_set_ext_x_array lv_chart_set_series_ext_x_array -#define lv_chart_set_ext_y_array lv_chart_set_series_ext_y_array - -#if defined(LV_FS_DEFAULT_DRIVE_LETTER) -#warning LV_FS_DEFAULT_DRIVE_LETTER is deprecated. Rename to LV_FS_DEFAULT_DRIVER_LETTER - -#if LV_FS_DEFAULT_DRIVER_LETTER == '\0' -#undef LV_FS_DEFAULT_DRIVER_LETTER -#define LV_FS_DEFAULT_DRIVER_LETTER LV_FS_DEFAULT_DRIVE_LETTER -#endif - -#endif /* defined(LV_FS_DEFAULT_DRIVE_LETTER) */ - -#define LV_LABEL_LONG_WRAP LV_LABEL_LONG_MODE_WRAP -#define LV_LABEL_LONG_DOT LV_LABEL_LONG_MODE_DOTS -#define LV_LABEL_LONG_SCROLL LV_LABEL_LONG_MODE_SCROLL -#define LV_LABEL_LONG_SCROLL_CIRCULAR LV_LABEL_LONG_MODE_SCROLL_CIRCULAR -#define LV_LABEL_LONG_CLIP LV_LABEL_LONG_MODE_CLIP - -#define lv_anim_set_time lv_anim_set_duration -#define lv_anim_set_playback_time lv_anim_set_reverse_duration -#define lv_anim_set_playback_delay lv_anim_set_reverse_delay -#define lv_anim_set_playback_duration lv_anim_set_reverse_duration - -#define lv_gradient_init_stops lv_grad_init_stops -#define lv_gradient_stop_t lv_grad_stop_t - -#define lv_spangroup_new_span lv_spangroup_add_span -#define lv_spangroup_refr_mode lv_spangroup_refresh - -#define lv_slider_set_left_value lv_slider_set_start_value - -#define lv_calendar_header_arrow_create lv_calendar_add_header_arrow -#define lv_calendar_header_dropdown_create lv_calendar_add_header_dropdown - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_API_MAP_V9_1_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_api_map_v9_2.h b/src/lv_api_map_v9_2.h index 1339452361..3a2412b290 100644 --- a/src/lv_api_map_v9_2.h +++ b/src/lv_api_map_v9_2.h @@ -1,57 +1,2 @@ -/** - * @file lv_api_map_v9_2.h - * - */ - -#ifndef LV_API_MAP_V9_2_H -#define LV_API_MAP_V9_2_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#define LV_SCR_LOAD_ANIM_NONE LV_SCREEN_LOAD_ANIM_NONE -#define LV_SCR_LOAD_ANIM_OVER_LEFT LV_SCREEN_LOAD_ANIM_OVER_LEFT -#define LV_SCR_LOAD_ANIM_OVER_RIGHT LV_SCREEN_LOAD_ANIM_OVER_RIGHT -#define LV_SCR_LOAD_ANIM_OVER_TOP LV_SCREEN_LOAD_ANIM_OVER_TOP -#define LV_SCR_LOAD_ANIM_OVER_BOTTOM LV_SCREEN_LOAD_ANIM_OVER_BOTTOM -#define LV_SCR_LOAD_ANIM_MOVE_LEFT LV_SCREEN_LOAD_ANIM_MOVE_LEFT -#define LV_SCR_LOAD_ANIM_MOVE_RIGHT LV_SCREEN_LOAD_ANIM_MOVE_RIGHT -#define LV_SCR_LOAD_ANIM_MOVE_TOP LV_SCREEN_LOAD_ANIM_MOVE_TOP -#define LV_SCR_LOAD_ANIM_MOVE_BOTTOM LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM -#define LV_SCR_LOAD_ANIM_FADE_IN LV_SCREEN_LOAD_ANIM_FADE_IN -#define LV_SCR_LOAD_ANIM_FADE_ON LV_SCREEN_LOAD_ANIM_FADE_ON -#define LV_SCR_LOAD_ANIM_FADE_OUT LV_SCREEN_LOAD_ANIM_FADE_OUT -#define LV_SCR_LOAD_ANIM_OUT_LEFT LV_SCREEN_LOAD_ANIM_OUT_LEFT -#define LV_SCR_LOAD_ANIM_OUT_RIGHT LV_SCREEN_LOAD_ANIM_OUT_RIGHT -#define LV_SCR_LOAD_ANIM_OUT_TOP LV_SCREEN_LOAD_ANIM_OUT_TOP -#define LV_SCR_LOAD_ANIM_OUT_BOTTOM LV_SCREEN_LOAD_ANIM_OUT_BOTTOM - -#define lv_ft81x_spi_operation lv_ft81x_spi_operation_t - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_API_MAP_V9_2_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_api_map_v9_3.h b/src/lv_api_map_v9_3.h index d6ec98d6c8..7388dba098 100644 --- a/src/lv_api_map_v9_3.h +++ b/src/lv_api_map_v9_3.h @@ -1,97 +1,2 @@ -/** - * @file lv_api_map_v9_3.h - * - */ - -#ifndef LV_API_MAP_V9_3_H -#define LV_API_MAP_V9_3_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#define lv_draw_buf_malloc_cb lv_draw_buf_malloc_cb_t -#define lv_draw_buf_free_cb lv_draw_buf_free_cb_t -#define lv_draw_buf_copy_cb lv_draw_buf_copy_cb_t -#define lv_draw_buf_align_cb lv_draw_buf_align_cb_t -#define lv_draw_buf_cache_operation_cb lv_draw_buf_cache_operation_cb_t -#define lv_draw_buf_width_to_stride_cb lv_draw_buf_width_to_stride_cb_t - -#define lv_glfw_window_t lv_opengles_window_t -#define lv_glfw_texture_t lv_opengles_window_texture_t -#define lv_glfw_window_create lv_opengles_glfw_window_create -#define lv_glfw_window_create_ex lv_opengles_glfw_window_create_ex -#define lv_glfw_window_set_title lv_opengles_glfw_window_set_title -#define lv_glfw_window_delete lv_opengles_window_delete -#define lv_glfw_window_set_flip lv_opengles_glfw_window_set_flip -#define lv_glfw_window_add_texture lv_opengles_window_add_texture -#define lv_glfw_texture_remove lv_opengles_window_texture_remove -#define lv_glfw_texture_set_x lv_opengles_window_texture_set_x -#define lv_glfw_texture_set_y lv_opengles_window_texture_set_y -#define lv_glfw_texture_set_opa lv_opengles_window_texture_set_opa -#define lv_glfw_texture_get_mouse_indev lv_opengles_window_texture_get_mouse_indev -#define lv_glfw_window_get_glfw_window lv_opengles_glfw_window_get_glfw_window - -#define lv_vector_dsc_create lv_draw_vector_dsc_create -#define lv_vector_dsc_delete lv_draw_vector_dsc_delete -#define lv_vector_dsc_set_transform lv_draw_vector_dsc_set_transform -#define lv_vector_dsc_set_blend_mode lv_draw_vector_dsc_set_blend_mode -#define lv_vector_dsc_set_fill_color32 lv_draw_vector_dsc_set_fill_color32 -#define lv_vector_dsc_set_fill_color lv_draw_vector_dsc_set_fill_color -#define lv_vector_dsc_set_fill_opa lv_draw_vector_dsc_set_fill_opa -#define lv_vector_dsc_set_fill_rule lv_draw_vector_dsc_set_fill_rule -#define lv_vector_dsc_set_fill_units lv_draw_vector_dsc_set_fill_units -#define lv_vector_dsc_set_fill_image lv_draw_vector_dsc_set_fill_image -#define lv_vector_dsc_set_fill_linear_gradient lv_draw_vector_dsc_set_fill_linear_gradient -#define lv_vector_dsc_set_fill_radial_gradient lv_draw_vector_dsc_set_fill_radial_gradient -#define lv_vector_dsc_set_fill_gradient_spread lv_draw_vector_dsc_set_fill_gradient_spread -#define lv_vector_dsc_set_fill_gradient_color_stops lv_draw_vector_dsc_set_fill_gradient_color_stops -#define lv_vector_dsc_set_fill_transform lv_draw_vector_dsc_set_fill_transform -#define lv_vector_dsc_set_stroke_color32 lv_draw_vector_dsc_set_stroke_color32 -#define lv_vector_dsc_set_stroke_color lv_draw_vector_dsc_set_stroke_color -#define lv_vector_dsc_set_stroke_opa lv_draw_vector_dsc_set_stroke_opa -#define lv_vector_dsc_set_stroke_width lv_draw_vector_dsc_set_stroke_width -#define lv_vector_dsc_set_stroke_dash lv_draw_vector_dsc_set_stroke_dash -#define lv_vector_dsc_set_stroke_cap lv_draw_vector_dsc_set_stroke_cap -#define lv_vector_dsc_set_stroke_join lv_draw_vector_dsc_set_stroke_join -#define lv_vector_dsc_set_stroke_miter_limit lv_draw_vector_dsc_set_stroke_miter_limit -#define lv_vector_dsc_set_stroke_linear_gradient lv_draw_vector_dsc_set_stroke_linear_gradient -#define lv_vector_dsc_set_stroke_radial_gradient lv_draw_vector_dsc_set_stroke_radial_gradient -#define lv_vector_dsc_set_stroke_gradient_spread lv_draw_vector_dsc_set_stroke_gradient_spread -#define lv_vector_dsc_set_stroke_gradient_color_stops lv_draw_vector_dsc_set_stroke_gradient_color_stops -#define lv_vector_dsc_set_stroke_transform lv_draw_vector_dsc_set_stroke_transform -#define lv_vector_dsc_identity lv_draw_vector_dsc_identity -#define lv_vector_dsc_scale lv_draw_vector_dsc_scale -#define lv_vector_dsc_rotate lv_draw_vector_dsc_rotate -#define lv_vector_dsc_translate lv_draw_vector_dsc_translate -#define lv_vector_dsc_skew lv_draw_vector_dsc_skew -#define lv_vector_dsc_add_path lv_draw_vector_dsc_add_path -#define lv_vector_dsc_clear_area lv_draw_vector_dsc_clear_area - - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_API_MAP_V9_3_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_api_map_v9_4.h b/src/lv_api_map_v9_4.h index 031012dc0b..3e00032145 100644 --- a/src/lv_api_map_v9_4.h +++ b/src/lv_api_map_v9_4.h @@ -1,41 +1,2 @@ -/** - * @file lv_api_map_v9_4.h - * - */ - -#ifndef LV_API_MAP_V9_4_H -#define LV_API_MAP_V9_4_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#define lv_tabview_rename_tab lv_tabview_set_tab_text -#define lv_wayland_timer_handler lv_timer_handler -#define lv_wayland_display_close_f_t lv_wayland_display_close_cb_t - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_API_MAP_V9_4_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_api_map_v9_5.h b/src/lv_api_map_v9_5.h index 1c804578c8..6e4dc871a9 100644 --- a/src/lv_api_map_v9_5.h +++ b/src/lv_api_map_v9_5.h @@ -1,39 +1,2 @@ -/** - * @file lv_api_map_v9_5.h - * - */ - -#ifndef LV_API_MAP_V9_5_H -#define LV_API_MAP_V9_5_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#define lv_display_delete_event lv_display_remove_event - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_API_MAP_V9_5_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index aa91a00472..9d912b1beb 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -1,5029 +1,2 @@ -/** - * GENERATED FILE, DO NOT EDIT IT! - * @file lv_conf_internal.h - * This file ensures all defines of lv_conf.h have a default value. - */ - -#ifndef LV_CONF_INTERNAL_H -#define LV_CONF_INTERNAL_H -/* clang-format off */ - -/* Config options */ -#define LV_OS_NONE 0 -#define LV_OS_PTHREAD 1 -#define LV_OS_FREERTOS 2 -#define LV_OS_CMSIS_RTOS2 3 -#define LV_OS_RTTHREAD 4 -#define LV_OS_WINDOWS 5 -#define LV_OS_MQX 6 -#define LV_OS_SDL2 7 -#define LV_OS_CUSTOM 255 - -#define LV_STDLIB_BUILTIN 0 -#define LV_STDLIB_CLIB 1 -#define LV_STDLIB_MICROPYTHON 2 -#define LV_STDLIB_RTTHREAD 3 -#define LV_STDLIB_CUSTOM 255 - -#define LV_DRAW_SW_ASM_NONE 0 -#define LV_DRAW_SW_ASM_NEON 1 -#define LV_DRAW_SW_ASM_HELIUM 2 -#define LV_DRAW_SW_ASM_RISCV_V 3 -#define LV_DRAW_SW_ASM_CUSTOM 255 - -#define LV_NEMA_LIB_NONE 0 -#define LV_NEMA_LIB_M33_REVC 1 -#define LV_NEMA_LIB_M33_NEMAPVG 2 -#define LV_NEMA_LIB_M55 3 -#define LV_NEMA_LIB_M7 4 - -#define LV_NEMA_HAL_CUSTOM 0 -#define LV_NEMA_HAL_STM32 1 - -#define LV_NANOVG_BACKEND_GL2 1 -#define LV_NANOVG_BACKEND_GL3 2 -#define LV_NANOVG_BACKEND_GLES2 3 -#define LV_NANOVG_BACKEND_GLES3 4 - -/** Handle special Kconfig options. */ -#ifndef LV_KCONFIG_IGNORE - #include "lv_conf_kconfig.h" - #if defined(CONFIG_LV_CONF_SKIP) && !defined(LV_CONF_SKIP) - #define LV_CONF_SKIP - #endif -#endif - -/* If "lv_conf.h" is available from here try to use it later. */ -#ifdef __has_include - #if __has_include("lv_conf.h") - #ifndef LV_CONF_INCLUDE_SIMPLE - #define LV_CONF_INCLUDE_SIMPLE - #endif - #endif -#endif - -/* If lv_conf.h is not skipped, include it. */ -#if !defined(LV_CONF_SKIP) || defined(LV_CONF_PATH) - #ifdef LV_CONF_PATH /* If there is a path defined for lv_conf.h, use it */ - #include LV_CONF_PATH /* Note: Make sure to define custom CONF_PATH as a string */ - #elif defined(LV_CONF_INCLUDE_SIMPLE) /* Or simply include lv_conf.h is enabled. */ - #include "lv_conf.h" - #else - #include "../../lv_conf.h" /* Else assume lv_conf.h is next to the lvgl folder. */ - #endif - #if !defined(LV_CONF_H) && !defined(LV_CONF_SUPPRESS_DEFINE_CHECK) - /* #include will sometimes silently fail when __has_include is used */ - /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80753 */ - #pragma message("Possible failure to include lv_conf.h, please read the comment in this file if you get errors") - #endif -#endif - -#ifdef CONFIG_LV_COLOR_DEPTH - #define LV_KCONFIG_PRESENT -#endif - -/*---------------------------------- - * Start parsing lv_conf_template.h - -----------------------------------*/ - -/* If you need to include anything here, do it inside the `__ASSEMBLY__` guard */ -#if 0 && defined(__ASSEMBLY__) -#include "my_include.h" -#endif - -/*==================== - COLOR SETTINGS - *====================*/ - -/** Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888) */ -#ifndef LV_COLOR_DEPTH - #ifdef CONFIG_LV_COLOR_DEPTH - #define LV_COLOR_DEPTH CONFIG_LV_COLOR_DEPTH - #else - #define LV_COLOR_DEPTH 16 - #endif -#endif - -/*========================= - STDLIB WRAPPER SETTINGS - *=========================*/ - -/** Possible values - * - LV_STDLIB_BUILTIN: LVGL's built in implementation - * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc - * - LV_STDLIB_MICROPYTHON: MicroPython implementation - * - LV_STDLIB_RTTHREAD: RT-Thread implementation - * - LV_STDLIB_CUSTOM: Implement the functions externally - */ -#ifndef LV_USE_STDLIB_MALLOC - #ifdef CONFIG_LV_USE_STDLIB_MALLOC - #define LV_USE_STDLIB_MALLOC CONFIG_LV_USE_STDLIB_MALLOC - #else - #define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN - #endif -#endif - -/** Possible values - * - LV_STDLIB_BUILTIN: LVGL's built in implementation - * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc - * - LV_STDLIB_MICROPYTHON: MicroPython implementation - * - LV_STDLIB_RTTHREAD: RT-Thread implementation - * - LV_STDLIB_CUSTOM: Implement the functions externally - */ -#ifndef LV_USE_STDLIB_STRING - #ifdef CONFIG_LV_USE_STDLIB_STRING - #define LV_USE_STDLIB_STRING CONFIG_LV_USE_STDLIB_STRING - #else - #define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN - #endif -#endif - -/** Possible values - * - LV_STDLIB_BUILTIN: LVGL's built in implementation - * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc - * - LV_STDLIB_MICROPYTHON: MicroPython implementation - * - LV_STDLIB_RTTHREAD: RT-Thread implementation - * - LV_STDLIB_CUSTOM: Implement the functions externally - */ -#ifndef LV_USE_STDLIB_SPRINTF - #ifdef CONFIG_LV_USE_STDLIB_SPRINTF - #define LV_USE_STDLIB_SPRINTF CONFIG_LV_USE_STDLIB_SPRINTF - #else - #define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN - #endif -#endif - -#ifndef LV_STDINT_INCLUDE - #ifdef CONFIG_LV_STDINT_INCLUDE - #define LV_STDINT_INCLUDE CONFIG_LV_STDINT_INCLUDE - #else - #define LV_STDINT_INCLUDE - #endif -#endif -#ifndef LV_STDDEF_INCLUDE - #ifdef CONFIG_LV_STDDEF_INCLUDE - #define LV_STDDEF_INCLUDE CONFIG_LV_STDDEF_INCLUDE - #else - #define LV_STDDEF_INCLUDE - #endif -#endif -#ifndef LV_STDBOOL_INCLUDE - #ifdef CONFIG_LV_STDBOOL_INCLUDE - #define LV_STDBOOL_INCLUDE CONFIG_LV_STDBOOL_INCLUDE - #else - #define LV_STDBOOL_INCLUDE - #endif -#endif -#ifndef LV_INTTYPES_INCLUDE - #ifdef CONFIG_LV_INTTYPES_INCLUDE - #define LV_INTTYPES_INCLUDE CONFIG_LV_INTTYPES_INCLUDE - #else - #define LV_INTTYPES_INCLUDE - #endif -#endif -#ifndef LV_LIMITS_INCLUDE - #ifdef CONFIG_LV_LIMITS_INCLUDE - #define LV_LIMITS_INCLUDE CONFIG_LV_LIMITS_INCLUDE - #else - #define LV_LIMITS_INCLUDE - #endif -#endif -#ifndef LV_STDARG_INCLUDE - #ifdef CONFIG_LV_STDARG_INCLUDE - #define LV_STDARG_INCLUDE CONFIG_LV_STDARG_INCLUDE - #else - #define LV_STDARG_INCLUDE - #endif -#endif - -#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN - /** Size of memory available for `lv_malloc()` in bytes (>= 2kB) */ - #ifndef LV_MEM_SIZE - #ifdef CONFIG_LV_MEM_SIZE - #define LV_MEM_SIZE CONFIG_LV_MEM_SIZE - #else - #define LV_MEM_SIZE (64 * 1024U) /**< [bytes] */ - #endif - #endif - - /** Size of the memory expand for `lv_malloc()` in bytes */ - #ifndef LV_MEM_POOL_EXPAND_SIZE - #ifdef CONFIG_LV_MEM_POOL_EXPAND_SIZE - #define LV_MEM_POOL_EXPAND_SIZE CONFIG_LV_MEM_POOL_EXPAND_SIZE - #else - #define LV_MEM_POOL_EXPAND_SIZE 0 - #endif - #endif - - /** Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too. */ - #ifndef LV_MEM_ADR - #ifdef CONFIG_LV_MEM_ADR - #define LV_MEM_ADR CONFIG_LV_MEM_ADR - #else - #define LV_MEM_ADR 0 /**< 0: unused*/ - #endif - #endif - /* Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc */ - #if LV_MEM_ADR == 0 - #ifndef LV_MEM_POOL_INCLUDE - #ifdef CONFIG_LV_MEM_POOL_INCLUDE - #define LV_MEM_POOL_INCLUDE CONFIG_LV_MEM_POOL_INCLUDE - #else - #undef LV_MEM_POOL_INCLUDE - #endif - #endif - #ifndef LV_MEM_POOL_ALLOC - #ifdef CONFIG_LV_MEM_POOL_ALLOC - #define LV_MEM_POOL_ALLOC CONFIG_LV_MEM_POOL_ALLOC - #else - #undef LV_MEM_POOL_ALLOC - #endif - #endif - #endif -#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/ - -/*==================== - HAL SETTINGS - *====================*/ - -/** Default display refresh, input device read and animation step period. */ -#ifndef LV_DEF_REFR_PERIOD - #ifdef CONFIG_LV_DEF_REFR_PERIOD - #define LV_DEF_REFR_PERIOD CONFIG_LV_DEF_REFR_PERIOD - #else - #define LV_DEF_REFR_PERIOD 33 /**< [ms] */ - #endif -#endif - -/** Default Dots Per Inch. Used to initialize default sizes such as widgets sized, style paddings. - * (Not so important, you can adjust it to modify default sizes and spaces.) */ -#ifndef LV_DPI_DEF - #ifdef CONFIG_LV_DPI_DEF - #define LV_DPI_DEF CONFIG_LV_DPI_DEF - #else - #define LV_DPI_DEF 130 /**< [px/inch] */ - #endif -#endif - -/*================= - * OPERATING SYSTEM - *=================*/ -/** Select operating system to use. Possible options: - * - LV_OS_NONE - * - LV_OS_PTHREAD - * - LV_OS_FREERTOS - * - LV_OS_CMSIS_RTOS2 - * - LV_OS_RTTHREAD - * - LV_OS_WINDOWS - * - LV_OS_MQX - * - LV_OS_SDL2 - * - LV_OS_CUSTOM */ -#ifndef LV_USE_OS - #ifdef CONFIG_LV_USE_OS - #define LV_USE_OS CONFIG_LV_USE_OS - #else - #define LV_USE_OS LV_OS_NONE - #endif -#endif - -#if LV_USE_OS == LV_OS_CUSTOM - #ifndef LV_OS_CUSTOM_INCLUDE - #ifdef CONFIG_LV_OS_CUSTOM_INCLUDE - #define LV_OS_CUSTOM_INCLUDE CONFIG_LV_OS_CUSTOM_INCLUDE - #else - #define LV_OS_CUSTOM_INCLUDE - #endif - #endif -#endif -#if LV_USE_OS == LV_OS_FREERTOS - /* - * Unblocking an RTOS task with a direct notification is 45% faster and uses less RAM - * than unblocking a task using an intermediary object such as a binary semaphore. - * RTOS task notifications can only be used when there is only one task that can be the recipient of the event. - */ - #ifndef LV_USE_FREERTOS_TASK_NOTIFY - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_FREERTOS_TASK_NOTIFY - #define LV_USE_FREERTOS_TASK_NOTIFY CONFIG_LV_USE_FREERTOS_TASK_NOTIFY - #else - #define LV_USE_FREERTOS_TASK_NOTIFY 0 - #endif - #else - #define LV_USE_FREERTOS_TASK_NOTIFY 1 - #endif - #endif - - /* Enable this to provide a custom implementation of lv_os_get_idle_percent. */ - #ifndef LV_OS_IDLE_PERCENT_CUSTOM - #ifdef CONFIG_LV_OS_IDLE_PERCENT_CUSTOM - #define LV_OS_IDLE_PERCENT_CUSTOM CONFIG_LV_OS_IDLE_PERCENT_CUSTOM - #else - #define LV_OS_IDLE_PERCENT_CUSTOM 0 - #endif - #endif -#endif - -/*======================== - * RENDERING CONFIGURATION - *========================*/ - -/** Align stride of all layers and images to this bytes */ -#ifndef LV_DRAW_BUF_STRIDE_ALIGN - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_BUF_STRIDE_ALIGN - #define LV_DRAW_BUF_STRIDE_ALIGN CONFIG_LV_DRAW_BUF_STRIDE_ALIGN - #else - #define LV_DRAW_BUF_STRIDE_ALIGN 0 - #endif - #else - #define LV_DRAW_BUF_STRIDE_ALIGN 1 - #endif -#endif - -/** Align start address of draw_buf addresses to this bytes*/ -#ifndef LV_DRAW_BUF_ALIGN - #ifdef CONFIG_LV_DRAW_BUF_ALIGN - #define LV_DRAW_BUF_ALIGN CONFIG_LV_DRAW_BUF_ALIGN - #else - #define LV_DRAW_BUF_ALIGN 4 - #endif -#endif - -/** Using matrix for transformations. - * Requirements: - * - `LV_USE_MATRIX = 1`. - * - Rendering engine needs to support 3x3 matrix transformations. */ -#ifndef LV_DRAW_TRANSFORM_USE_MATRIX - #ifdef CONFIG_LV_DRAW_TRANSFORM_USE_MATRIX - #define LV_DRAW_TRANSFORM_USE_MATRIX CONFIG_LV_DRAW_TRANSFORM_USE_MATRIX - #else - #define LV_DRAW_TRANSFORM_USE_MATRIX 0 - #endif -#endif - -/* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode - * it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks. - * "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers - * and can't be drawn in chunks. */ - -/** The target buffer size for simple layer chunks. */ -#ifndef LV_DRAW_LAYER_SIMPLE_BUF_SIZE - #ifdef CONFIG_LV_DRAW_LAYER_SIMPLE_BUF_SIZE - #define LV_DRAW_LAYER_SIMPLE_BUF_SIZE CONFIG_LV_DRAW_LAYER_SIMPLE_BUF_SIZE - #else - #define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /**< [bytes]*/ - #endif -#endif - -/* Limit the max allocated memory for simple and transformed layers. - * It should be at least `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` sized but if transformed layers are also used - * it should be enough to store the largest widget too (width x height x 4 area). - * Set it to 0 to have no limit. */ -#ifndef LV_DRAW_LAYER_MAX_MEMORY - #ifdef CONFIG_LV_DRAW_LAYER_MAX_MEMORY - #define LV_DRAW_LAYER_MAX_MEMORY CONFIG_LV_DRAW_LAYER_MAX_MEMORY - #else - #define LV_DRAW_LAYER_MAX_MEMORY 0 /**< No limit by default [bytes]*/ - #endif -#endif - -/** Stack size of drawing thread. - * NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more. - */ -#ifndef LV_DRAW_THREAD_STACK_SIZE - #ifdef CONFIG_LV_DRAW_THREAD_STACK_SIZE - #define LV_DRAW_THREAD_STACK_SIZE CONFIG_LV_DRAW_THREAD_STACK_SIZE - #else - #define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /**< [bytes]*/ - #endif -#endif - -/** Thread priority of the drawing task. - * Higher values mean higher priority. - * Can use values from lv_thread_prio_t enum in lv_os.h: LV_THREAD_PRIO_LOWEST, - * LV_THREAD_PRIO_LOW, LV_THREAD_PRIO_MID, LV_THREAD_PRIO_HIGH, LV_THREAD_PRIO_HIGHEST - * Make sure the priority value aligns with the OS-specific priority levels. - * On systems with limited priority levels (e.g., FreeRTOS), a higher value can improve - * rendering performance but might cause other tasks to starve. */ -#ifndef LV_DRAW_THREAD_PRIO - #ifdef CONFIG_LV_DRAW_THREAD_PRIO - #define LV_DRAW_THREAD_PRIO CONFIG_LV_DRAW_THREAD_PRIO - #else - #define LV_DRAW_THREAD_PRIO LV_THREAD_PRIO_HIGH - #endif -#endif - -#ifndef LV_USE_DRAW_SW - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_DRAW_SW - #define LV_USE_DRAW_SW CONFIG_LV_USE_DRAW_SW - #else - #define LV_USE_DRAW_SW 0 - #endif - #else - #define LV_USE_DRAW_SW 1 - #endif -#endif -#if LV_USE_DRAW_SW == 1 - /* - * Selectively disable color format support in order to reduce code size. - * NOTE: some features use certain color formats internally, e.g. - * - gradients use RGB888 - * - bitmaps with transparency may use ARGB8888 - */ - #ifndef LV_DRAW_SW_SUPPORT_RGB565 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565 - #define LV_DRAW_SW_SUPPORT_RGB565 CONFIG_LV_DRAW_SW_SUPPORT_RGB565 - #else - #define LV_DRAW_SW_SUPPORT_RGB565 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_RGB565 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_RGB565_SWAPPED - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565_SWAPPED - #define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED CONFIG_LV_DRAW_SW_SUPPORT_RGB565_SWAPPED - #else - #define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_RGB565A8 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8 - #define LV_DRAW_SW_SUPPORT_RGB565A8 CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8 - #else - #define LV_DRAW_SW_SUPPORT_RGB565A8 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_RGB565A8 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_RGB888 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB888 - #define LV_DRAW_SW_SUPPORT_RGB888 CONFIG_LV_DRAW_SW_SUPPORT_RGB888 - #else - #define LV_DRAW_SW_SUPPORT_RGB888 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_RGB888 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_XRGB8888 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888 - #define LV_DRAW_SW_SUPPORT_XRGB8888 CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888 - #else - #define LV_DRAW_SW_SUPPORT_XRGB8888 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_XRGB8888 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_ARGB8888 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888 - #define LV_DRAW_SW_SUPPORT_ARGB8888 CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888 - #else - #define LV_DRAW_SW_SUPPORT_ARGB8888 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_ARGB8888 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED - #define LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED - #else - #define LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_L8 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_L8 - #define LV_DRAW_SW_SUPPORT_L8 CONFIG_LV_DRAW_SW_SUPPORT_L8 - #else - #define LV_DRAW_SW_SUPPORT_L8 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_L8 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_AL88 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_AL88 - #define LV_DRAW_SW_SUPPORT_AL88 CONFIG_LV_DRAW_SW_SUPPORT_AL88 - #else - #define LV_DRAW_SW_SUPPORT_AL88 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_AL88 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_A8 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_A8 - #define LV_DRAW_SW_SUPPORT_A8 CONFIG_LV_DRAW_SW_SUPPORT_A8 - #else - #define LV_DRAW_SW_SUPPORT_A8 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_A8 1 - #endif - #endif - #ifndef LV_DRAW_SW_SUPPORT_I1 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_SUPPORT_I1 - #define LV_DRAW_SW_SUPPORT_I1 CONFIG_LV_DRAW_SW_SUPPORT_I1 - #else - #define LV_DRAW_SW_SUPPORT_I1 0 - #endif - #else - #define LV_DRAW_SW_SUPPORT_I1 1 - #endif - #endif - - /* The threshold of the luminance to consider a pixel as - * active in indexed color format */ - #ifndef LV_DRAW_SW_I1_LUM_THRESHOLD - #ifdef CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD - #define LV_DRAW_SW_I1_LUM_THRESHOLD CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD - #else - #define LV_DRAW_SW_I1_LUM_THRESHOLD 127 - #endif - #endif - - /** Set number of draw units. - * - > 1 requires operating system to be enabled in `LV_USE_OS`. - * - > 1 means multiple threads will render the screen in parallel. */ - #ifndef LV_DRAW_SW_DRAW_UNIT_CNT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT - #define LV_DRAW_SW_DRAW_UNIT_CNT CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT - #else - #define LV_DRAW_SW_DRAW_UNIT_CNT 0 - #endif - #else - #define LV_DRAW_SW_DRAW_UNIT_CNT 1 - #endif - #endif - - /** Use Arm-2D to accelerate software (sw) rendering. */ - #ifndef LV_USE_DRAW_ARM2D_SYNC - #ifdef CONFIG_LV_USE_DRAW_ARM2D_SYNC - #define LV_USE_DRAW_ARM2D_SYNC CONFIG_LV_USE_DRAW_ARM2D_SYNC - #else - #define LV_USE_DRAW_ARM2D_SYNC 0 - #endif - #endif - - /** Enable native helium assembly to be compiled. */ - #ifndef LV_USE_NATIVE_HELIUM_ASM - #ifdef CONFIG_LV_USE_NATIVE_HELIUM_ASM - #define LV_USE_NATIVE_HELIUM_ASM CONFIG_LV_USE_NATIVE_HELIUM_ASM - #else - #define LV_USE_NATIVE_HELIUM_ASM 0 - #endif - #endif - - /** - * - 0: Use a simple renderer capable of drawing only simple rectangles with gradient, images, text, and straight lines only. - * - 1: Use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too. */ - #ifndef LV_DRAW_SW_COMPLEX - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_DRAW_SW_COMPLEX - #define LV_DRAW_SW_COMPLEX CONFIG_LV_DRAW_SW_COMPLEX - #else - #define LV_DRAW_SW_COMPLEX 0 - #endif - #else - #define LV_DRAW_SW_COMPLEX 1 - #endif - #endif - - #if LV_DRAW_SW_COMPLEX == 1 - /** Allow buffering some shadow calculation. - * LV_DRAW_SW_SHADOW_CACHE_SIZE is the maximum shadow size to buffer, where shadow size is - * `shadow_width + radius`. Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost. */ - #ifndef LV_DRAW_SW_SHADOW_CACHE_SIZE - #ifdef CONFIG_LV_DRAW_SW_SHADOW_CACHE_SIZE - #define LV_DRAW_SW_SHADOW_CACHE_SIZE CONFIG_LV_DRAW_SW_SHADOW_CACHE_SIZE - #else - #define LV_DRAW_SW_SHADOW_CACHE_SIZE 0 - #endif - #endif - - /** Set number of maximally-cached circle data. - * The circumference of 1/4 circle are saved for anti-aliasing. - * `radius * 4` bytes are used per circle (the most often used radiuses are saved). - * - 0: disables caching */ - #ifndef LV_DRAW_SW_CIRCLE_CACHE_SIZE - #ifdef CONFIG_LV_DRAW_SW_CIRCLE_CACHE_SIZE - #define LV_DRAW_SW_CIRCLE_CACHE_SIZE CONFIG_LV_DRAW_SW_CIRCLE_CACHE_SIZE - #else - #define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4 - #endif - #endif - #endif - - #ifndef LV_USE_DRAW_SW_ASM - #ifdef CONFIG_LV_USE_DRAW_SW_ASM - #define LV_USE_DRAW_SW_ASM CONFIG_LV_USE_DRAW_SW_ASM - #else - #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE - #endif - #endif - - #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM - #ifndef LV_DRAW_SW_ASM_CUSTOM_INCLUDE - #ifdef CONFIG_LV_DRAW_SW_ASM_CUSTOM_INCLUDE - #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE CONFIG_LV_DRAW_SW_ASM_CUSTOM_INCLUDE - #else - #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE "" - #endif - #endif - #endif - - /** Enable drawing complex gradients in software: linear at an angle, radial or conical */ - #ifndef LV_USE_DRAW_SW_COMPLEX_GRADIENTS - #ifdef CONFIG_LV_USE_DRAW_SW_COMPLEX_GRADIENTS - #define LV_USE_DRAW_SW_COMPLEX_GRADIENTS CONFIG_LV_USE_DRAW_SW_COMPLEX_GRADIENTS - #else - #define LV_USE_DRAW_SW_COMPLEX_GRADIENTS 0 - #endif - #endif - -#endif - -/*Use TSi's aka (Think Silicon) NemaGFX */ -#ifndef LV_USE_NEMA_GFX - #ifdef CONFIG_LV_USE_NEMA_GFX - #define LV_USE_NEMA_GFX CONFIG_LV_USE_NEMA_GFX - #else - #define LV_USE_NEMA_GFX 0 - #endif -#endif - -#if LV_USE_NEMA_GFX - /** Select which NemaGFX static library headers to use. Possible options: - * - LV_NEMA_LIB_NONE an alias of LV_NEMA_LIB_M33_REVC - * - LV_NEMA_LIB_M33_REVC - * - LV_NEMA_LIB_M33_NEMAPVG - * - LV_NEMA_LIB_M55 - * - LV_NEMA_LIB_M7 - * You must also take care to link the correct corresponding static library - * in libs/nema_gfx/lib/core/ - */ - #ifndef LV_USE_NEMA_LIB - #ifdef CONFIG_LV_USE_NEMA_LIB - #define LV_USE_NEMA_LIB CONFIG_LV_USE_NEMA_LIB - #else - #define LV_USE_NEMA_LIB LV_NEMA_LIB_NONE - #endif - #endif - - /** Select which NemaGFX HAL to use. Possible options: - * - LV_NEMA_HAL_CUSTOM - * - LV_NEMA_HAL_STM32 */ - #ifndef LV_USE_NEMA_HAL - #ifdef CONFIG_LV_USE_NEMA_HAL - #define LV_USE_NEMA_HAL CONFIG_LV_USE_NEMA_HAL - #else - #define LV_USE_NEMA_HAL LV_NEMA_HAL_CUSTOM - #endif - #endif - #if LV_USE_NEMA_HAL == LV_NEMA_HAL_STM32 - #ifndef LV_NEMA_STM32_HAL_INCLUDE - #ifdef CONFIG_LV_NEMA_STM32_HAL_INCLUDE - #define LV_NEMA_STM32_HAL_INCLUDE CONFIG_LV_NEMA_STM32_HAL_INCLUDE - #else - #define LV_NEMA_STM32_HAL_INCLUDE - #endif - #endif - - /** Set it to a value like __attribute__((section("Nemagfx_Memory_Pool_Buffer"))) - * and define the section in the linker script if you need the GPU memory to - * be, e.g. in a region where accesses will not be cached. - */ - #ifndef LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM - #ifdef CONFIG_LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM - #define LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM CONFIG_LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM - #else - #define LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM - #endif - #endif - #endif - - /*Enable Vector Graphics Operations. Available only if NemaVG library is present*/ - #ifndef LV_USE_NEMA_VG - #ifdef CONFIG_LV_USE_NEMA_VG - #define LV_USE_NEMA_VG CONFIG_LV_USE_NEMA_VG - #else - #define LV_USE_NEMA_VG 0 - #endif - #endif - #if LV_USE_NEMA_VG - /*Define application's resolution used for VG related buffer allocation */ - #ifndef LV_NEMA_GFX_MAX_RESX - #ifdef CONFIG_LV_NEMA_GFX_MAX_RESX - #define LV_NEMA_GFX_MAX_RESX CONFIG_LV_NEMA_GFX_MAX_RESX - #else - #define LV_NEMA_GFX_MAX_RESX 800 - #endif - #endif - #ifndef LV_NEMA_GFX_MAX_RESY - #ifdef CONFIG_LV_NEMA_GFX_MAX_RESY - #define LV_NEMA_GFX_MAX_RESY CONFIG_LV_NEMA_GFX_MAX_RESY - #else - #define LV_NEMA_GFX_MAX_RESY 600 - #endif - #endif - #endif -#endif - -/** Use NXP's PXP on iMX RTxxx platforms. */ -#ifndef LV_USE_PXP - #ifdef CONFIG_LV_USE_PXP - #define LV_USE_PXP CONFIG_LV_USE_PXP - #else - #define LV_USE_PXP 0 - #endif -#endif - -#if LV_USE_PXP - /** Use PXP for drawing.*/ - #ifndef LV_USE_DRAW_PXP - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_DRAW_PXP - #define LV_USE_DRAW_PXP CONFIG_LV_USE_DRAW_PXP - #else - #define LV_USE_DRAW_PXP 0 - #endif - #else - #define LV_USE_DRAW_PXP 1 - #endif - #endif - - /** Use PXP to rotate display.*/ - #ifndef LV_USE_ROTATE_PXP - #ifdef CONFIG_LV_USE_ROTATE_PXP - #define LV_USE_ROTATE_PXP CONFIG_LV_USE_ROTATE_PXP - #else - #define LV_USE_ROTATE_PXP 0 - #endif - #endif - - #if LV_USE_DRAW_PXP && LV_USE_OS - /** Use additional draw thread for PXP processing.*/ - #ifndef LV_USE_PXP_DRAW_THREAD - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_PXP_DRAW_THREAD - #define LV_USE_PXP_DRAW_THREAD CONFIG_LV_USE_PXP_DRAW_THREAD - #else - #define LV_USE_PXP_DRAW_THREAD 0 - #endif - #else - #define LV_USE_PXP_DRAW_THREAD 1 - #endif - #endif - #endif - - /** Enable PXP asserts. */ - #ifndef LV_USE_PXP_ASSERT - #ifdef CONFIG_LV_USE_PXP_ASSERT - #define LV_USE_PXP_ASSERT CONFIG_LV_USE_PXP_ASSERT - #else - #define LV_USE_PXP_ASSERT 0 - #endif - #endif -#endif - -/** Use NXP's G2D on MPU platforms. */ -#ifndef LV_USE_G2D - #ifdef CONFIG_LV_USE_G2D - #define LV_USE_G2D CONFIG_LV_USE_G2D - #else - #define LV_USE_G2D 0 - #endif -#endif - -#if LV_USE_G2D - /** Use G2D for drawing. **/ - #ifndef LV_USE_DRAW_G2D - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_DRAW_G2D - #define LV_USE_DRAW_G2D CONFIG_LV_USE_DRAW_G2D - #else - #define LV_USE_DRAW_G2D 0 - #endif - #else - #define LV_USE_DRAW_G2D 1 - #endif - #endif - - /** Maximum number of buffers that can be stored for G2D draw unit. - * Includes the frame buffers and assets. */ - #ifndef LV_G2D_HASH_TABLE_SIZE - #ifdef CONFIG_LV_G2D_HASH_TABLE_SIZE - #define LV_G2D_HASH_TABLE_SIZE CONFIG_LV_G2D_HASH_TABLE_SIZE - #else - #define LV_G2D_HASH_TABLE_SIZE 50 - #endif - #endif - - #if LV_USE_DRAW_G2D && LV_USE_OS - /** Use additional draw thread for G2D processing.*/ - #ifndef LV_USE_G2D_DRAW_THREAD - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_G2D_DRAW_THREAD - #define LV_USE_G2D_DRAW_THREAD CONFIG_LV_USE_G2D_DRAW_THREAD - #else - #define LV_USE_G2D_DRAW_THREAD 0 - #endif - #else - #define LV_USE_G2D_DRAW_THREAD 1 - #endif - #endif - #endif - - /** Enable G2D asserts. */ - #ifndef LV_USE_G2D_ASSERT - #ifdef CONFIG_LV_USE_G2D_ASSERT - #define LV_USE_G2D_ASSERT CONFIG_LV_USE_G2D_ASSERT - #else - #define LV_USE_G2D_ASSERT 0 - #endif - #endif -#endif - -/** Use Renesas Dave2D on RA platforms. */ -#ifndef LV_USE_DRAW_DAVE2D - #ifdef CONFIG_LV_USE_DRAW_DAVE2D - #define LV_USE_DRAW_DAVE2D CONFIG_LV_USE_DRAW_DAVE2D - #else - #define LV_USE_DRAW_DAVE2D 0 - #endif -#endif - -/** Draw using cached SDL textures*/ -#ifndef LV_USE_DRAW_SDL - #ifdef CONFIG_LV_USE_DRAW_SDL - #define LV_USE_DRAW_SDL CONFIG_LV_USE_DRAW_SDL - #else - #define LV_USE_DRAW_SDL 0 - #endif -#endif - -/** Use VG-Lite GPU. */ -#ifndef LV_USE_DRAW_VG_LITE - #ifdef CONFIG_LV_USE_DRAW_VG_LITE - #define LV_USE_DRAW_VG_LITE CONFIG_LV_USE_DRAW_VG_LITE - #else - #define LV_USE_DRAW_VG_LITE 0 - #endif -#endif -#if LV_USE_DRAW_VG_LITE - /** Enable VG-Lite custom external 'gpu_init()' function */ - #ifndef LV_VG_LITE_USE_GPU_INIT - #ifdef CONFIG_LV_VG_LITE_USE_GPU_INIT - #define LV_VG_LITE_USE_GPU_INIT CONFIG_LV_VG_LITE_USE_GPU_INIT - #else - #define LV_VG_LITE_USE_GPU_INIT 0 - #endif - #endif - - /** Enable VG-Lite assert. */ - #ifndef LV_VG_LITE_USE_ASSERT - #ifdef CONFIG_LV_VG_LITE_USE_ASSERT - #define LV_VG_LITE_USE_ASSERT CONFIG_LV_VG_LITE_USE_ASSERT - #else - #define LV_VG_LITE_USE_ASSERT 0 - #endif - #endif - - /** VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */ - #ifndef LV_VG_LITE_FLUSH_MAX_COUNT - #ifdef CONFIG_LV_VG_LITE_FLUSH_MAX_COUNT - #define LV_VG_LITE_FLUSH_MAX_COUNT CONFIG_LV_VG_LITE_FLUSH_MAX_COUNT - #else - #define LV_VG_LITE_FLUSH_MAX_COUNT 8 - #endif - #endif - - /** Enable border to simulate shadow. - * NOTE: which usually improves performance, - * but does not guarantee the same rendering quality as the software. */ - #ifndef LV_VG_LITE_USE_BOX_SHADOW - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_VG_LITE_USE_BOX_SHADOW - #define LV_VG_LITE_USE_BOX_SHADOW CONFIG_LV_VG_LITE_USE_BOX_SHADOW - #else - #define LV_VG_LITE_USE_BOX_SHADOW 0 - #endif - #else - #define LV_VG_LITE_USE_BOX_SHADOW 1 - #endif - #endif - - /** VG-Lite gradient maximum cache number. - * @note The memory usage of a single gradient image is 4K bytes. */ - #ifndef LV_VG_LITE_GRAD_CACHE_CNT - #ifdef CONFIG_LV_VG_LITE_GRAD_CACHE_CNT - #define LV_VG_LITE_GRAD_CACHE_CNT CONFIG_LV_VG_LITE_GRAD_CACHE_CNT - #else - #define LV_VG_LITE_GRAD_CACHE_CNT 32 - #endif - #endif - - /** VG-Lite stroke maximum cache number. */ - #ifndef LV_VG_LITE_STROKE_CACHE_CNT - #ifdef CONFIG_LV_VG_LITE_STROKE_CACHE_CNT - #define LV_VG_LITE_STROKE_CACHE_CNT CONFIG_LV_VG_LITE_STROKE_CACHE_CNT - #else - #define LV_VG_LITE_STROKE_CACHE_CNT 32 - #endif - #endif - - /** VG-Lite unaligned bitmap font maximum cache number. */ - #ifndef LV_VG_LITE_BITMAP_FONT_CACHE_CNT - #ifdef CONFIG_LV_VG_LITE_BITMAP_FONT_CACHE_CNT - #define LV_VG_LITE_BITMAP_FONT_CACHE_CNT CONFIG_LV_VG_LITE_BITMAP_FONT_CACHE_CNT - #else - #define LV_VG_LITE_BITMAP_FONT_CACHE_CNT 256 - #endif - #endif - - /** Remove VLC_OP_CLOSE path instruction (Workaround for NXP) **/ - #ifndef LV_VG_LITE_DISABLE_VLC_OP_CLOSE - #ifdef CONFIG_LV_VG_LITE_DISABLE_VLC_OP_CLOSE - #define LV_VG_LITE_DISABLE_VLC_OP_CLOSE CONFIG_LV_VG_LITE_DISABLE_VLC_OP_CLOSE - #else - #define LV_VG_LITE_DISABLE_VLC_OP_CLOSE 0 - #endif - #endif - - /** Disable blit rectangular offset to resolve certain hardware errors. */ - #ifndef LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET - #ifdef CONFIG_LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET - #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET CONFIG_LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET - #else - #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET 0 - #endif - #endif - - /** Disable linear gradient extension for some older versions of drivers. */ - #ifndef LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT - #ifdef CONFIG_LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT - #define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT CONFIG_LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT - #else - #define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT 0 - #endif - #endif - - /** Maximum path dump print length (in points) */ - #ifndef LV_VG_LITE_PATH_DUMP_MAX_LEN - #ifdef CONFIG_LV_VG_LITE_PATH_DUMP_MAX_LEN - #define LV_VG_LITE_PATH_DUMP_MAX_LEN CONFIG_LV_VG_LITE_PATH_DUMP_MAX_LEN - #else - #define LV_VG_LITE_PATH_DUMP_MAX_LEN 1000 - #endif - #endif - - /** Enable usage of the LVGL's built-in vg_lite driver */ - #ifndef LV_USE_VG_LITE_DRIVER - #ifdef CONFIG_LV_USE_VG_LITE_DRIVER - #define LV_USE_VG_LITE_DRIVER CONFIG_LV_USE_VG_LITE_DRIVER - #else - #define LV_USE_VG_LITE_DRIVER 0 - #endif - #endif - #if LV_USE_VG_LITE_DRIVER - /** Used to pick the correct GPU series folder valid options are gc255, gc355 and gc555*/ - #ifndef LV_VG_LITE_HAL_GPU_SERIES - #ifdef CONFIG_LV_VG_LITE_HAL_GPU_SERIES - #define LV_VG_LITE_HAL_GPU_SERIES CONFIG_LV_VG_LITE_HAL_GPU_SERIES - #else - #define LV_VG_LITE_HAL_GPU_SERIES gc255 - #endif - #endif - - /** Used to pick the correct GPU revision header it depends on the vendor */ - #ifndef LV_VG_LITE_HAL_GPU_REVISION - #ifdef CONFIG_LV_VG_LITE_HAL_GPU_REVISION - #define LV_VG_LITE_HAL_GPU_REVISION CONFIG_LV_VG_LITE_HAL_GPU_REVISION - #else - #define LV_VG_LITE_HAL_GPU_REVISION 0x40 - #endif - #endif - - /** Base memory address of the GPU IP it depends on SoC, - * default value is for NXP based devices */ - #ifndef LV_VG_LITE_HAL_GPU_BASE_ADDRESS - #ifdef CONFIG_LV_VG_LITE_HAL_GPU_BASE_ADDRESS - #define LV_VG_LITE_HAL_GPU_BASE_ADDRESS CONFIG_LV_VG_LITE_HAL_GPU_BASE_ADDRESS - #else - #define LV_VG_LITE_HAL_GPU_BASE_ADDRESS 0x40240000 - #endif - #endif - #endif /*LV_USE_VG_LITE_DRIVER*/ - - /** Use ThorVG (a software vector library) as VG-Lite driver to allow testing VGLite on PC - * Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */ - #ifndef LV_USE_VG_LITE_THORVG - #ifdef CONFIG_LV_USE_VG_LITE_THORVG - #define LV_USE_VG_LITE_THORVG CONFIG_LV_USE_VG_LITE_THORVG - #else - #define LV_USE_VG_LITE_THORVG 0 - #endif - #endif - #if LV_USE_VG_LITE_THORVG - /** Enable LVGL's blend mode support */ - #ifndef LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT - #ifdef CONFIG_LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT - #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT CONFIG_LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT - #else - #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0 - #endif - #endif - - /** Enable YUV color format support */ - #ifndef LV_VG_LITE_THORVG_YUV_SUPPORT - #ifdef CONFIG_LV_VG_LITE_THORVG_YUV_SUPPORT - #define LV_VG_LITE_THORVG_YUV_SUPPORT CONFIG_LV_VG_LITE_THORVG_YUV_SUPPORT - #else - #define LV_VG_LITE_THORVG_YUV_SUPPORT 0 - #endif - #endif - - /** Enable Linear gradient extension support */ - #ifndef LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT - #ifdef CONFIG_LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT - #define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT CONFIG_LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT - #else - #define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT 0 - #endif - #endif - - /** Enable alignment on 16 pixels */ - #ifndef LV_VG_LITE_THORVG_16PIXELS_ALIGN - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_VG_LITE_THORVG_16PIXELS_ALIGN - #define LV_VG_LITE_THORVG_16PIXELS_ALIGN CONFIG_LV_VG_LITE_THORVG_16PIXELS_ALIGN - #else - #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 0 - #endif - #else - #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1 - #endif - #endif - - /** Buffer address alignment */ - #ifndef LV_VG_LITE_THORVG_BUF_ADDR_ALIGN - #ifdef CONFIG_LV_VG_LITE_THORVG_BUF_ADDR_ALIGN - #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN CONFIG_LV_VG_LITE_THORVG_BUF_ADDR_ALIGN - #else - #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64 - #endif - #endif - - /** Enable multi-thread render */ - #ifndef LV_VG_LITE_THORVG_THREAD_RENDER - #ifdef CONFIG_LV_VG_LITE_THORVG_THREAD_RENDER - #define LV_VG_LITE_THORVG_THREAD_RENDER CONFIG_LV_VG_LITE_THORVG_THREAD_RENDER - #else - #define LV_VG_LITE_THORVG_THREAD_RENDER 0 - #endif - #endif - #endif /*LV_USE_VG_LITE_THORVG*/ -#endif - -/** Accelerate blends, fills, etc. with STM32 DMA2D */ -#ifndef LV_USE_DRAW_DMA2D - #ifdef CONFIG_LV_USE_DRAW_DMA2D - #define LV_USE_DRAW_DMA2D CONFIG_LV_USE_DRAW_DMA2D - #else - #define LV_USE_DRAW_DMA2D 0 - #endif -#endif -#if LV_USE_DRAW_DMA2D - #ifndef LV_DRAW_DMA2D_HAL_INCLUDE - #ifdef CONFIG_LV_DRAW_DMA2D_HAL_INCLUDE - #define LV_DRAW_DMA2D_HAL_INCLUDE CONFIG_LV_DRAW_DMA2D_HAL_INCLUDE - #else - #define LV_DRAW_DMA2D_HAL_INCLUDE "stm32h7xx_hal.h" - #endif - #endif - - /* if enabled, the user is required to call `lv_draw_dma2d_transfer_complete_interrupt_handler` - * upon receiving the DMA2D global interrupt - */ - #ifndef LV_USE_DRAW_DMA2D_INTERRUPT - #ifdef CONFIG_LV_USE_DRAW_DMA2D_INTERRUPT - #define LV_USE_DRAW_DMA2D_INTERRUPT CONFIG_LV_USE_DRAW_DMA2D_INTERRUPT - #else - #define LV_USE_DRAW_DMA2D_INTERRUPT 0 - #endif - #endif -#endif - -/** Draw using cached OpenGLES textures. Requires LV_USE_OPENGLES */ -#ifndef LV_USE_DRAW_OPENGLES - #ifdef CONFIG_LV_USE_DRAW_OPENGLES - #define LV_USE_DRAW_OPENGLES CONFIG_LV_USE_DRAW_OPENGLES - #else - #define LV_USE_DRAW_OPENGLES 0 - #endif -#endif -#if LV_USE_DRAW_OPENGLES - #ifndef LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT - #ifdef CONFIG_LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT - #define LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT CONFIG_LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT - #else - #define LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT 64 - #endif - #endif -#endif - -/** Draw using espressif PPA accelerator */ -#ifndef LV_USE_PPA - #ifdef CONFIG_LV_USE_PPA - #define LV_USE_PPA CONFIG_LV_USE_PPA - #else - #define LV_USE_PPA 0 - #endif -#endif -#if LV_USE_PPA - #ifndef LV_USE_PPA_IMG - #ifdef CONFIG_LV_USE_PPA_IMG - #define LV_USE_PPA_IMG CONFIG_LV_USE_PPA_IMG - #else - #define LV_USE_PPA_IMG 0 - #endif - #endif - #ifndef LV_PPA_BURST_LENGTH - #ifdef CONFIG_LV_PPA_BURST_LENGTH - #define LV_PPA_BURST_LENGTH CONFIG_LV_PPA_BURST_LENGTH - #else - #define LV_PPA_BURST_LENGTH 128 - #endif - #endif -#endif - -/* Use EVE FT81X GPU. */ -#ifndef LV_USE_DRAW_EVE - #ifdef CONFIG_LV_USE_DRAW_EVE - #define LV_USE_DRAW_EVE CONFIG_LV_USE_DRAW_EVE - #else - #define LV_USE_DRAW_EVE 0 - #endif -#endif -#if LV_USE_DRAW_EVE - /* EVE_GEN value: 2, 3, or 4 */ - #ifndef LV_DRAW_EVE_EVE_GENERATION - #ifdef CONFIG_LV_DRAW_EVE_EVE_GENERATION - #define LV_DRAW_EVE_EVE_GENERATION CONFIG_LV_DRAW_EVE_EVE_GENERATION - #else - #define LV_DRAW_EVE_EVE_GENERATION 4 - #endif - #endif - - /* The maximum number of bytes to buffer before a single SPI transmission. - * Set it to 0 to disable write buffering. - */ - #ifndef LV_DRAW_EVE_WRITE_BUFFER_SIZE - #ifdef CONFIG_LV_DRAW_EVE_WRITE_BUFFER_SIZE - #define LV_DRAW_EVE_WRITE_BUFFER_SIZE CONFIG_LV_DRAW_EVE_WRITE_BUFFER_SIZE - #else - #define LV_DRAW_EVE_WRITE_BUFFER_SIZE 2048 - #endif - #endif -#endif - -/** Use NanoVG Renderer - * - Requires LV_USE_NANOVG, LV_USE_MATRIX. - */ -#ifndef LV_USE_DRAW_NANOVG - #ifdef CONFIG_LV_USE_DRAW_NANOVG - #define LV_USE_DRAW_NANOVG CONFIG_LV_USE_DRAW_NANOVG - #else - #define LV_USE_DRAW_NANOVG 0 - #endif -#endif -#if LV_USE_DRAW_NANOVG - /** Select OpenGL backend for NanoVG: - * - LV_NANOVG_BACKEND_GL2: OpenGL 2.0 - * - LV_NANOVG_BACKEND_GL3: OpenGL 3.0+ - * - LV_NANOVG_BACKEND_GLES2: OpenGL ES 2.0 - * - LV_NANOVG_BACKEND_GLES3: OpenGL ES 3.0+ - */ - #ifndef LV_NANOVG_BACKEND - #ifdef CONFIG_LV_NANOVG_BACKEND - #define LV_NANOVG_BACKEND CONFIG_LV_NANOVG_BACKEND - #else - #define LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GLES2 - #endif - #endif - - /** Draw image texture cache count. */ - #ifndef LV_NANOVG_IMAGE_CACHE_CNT - #ifdef CONFIG_LV_NANOVG_IMAGE_CACHE_CNT - #define LV_NANOVG_IMAGE_CACHE_CNT CONFIG_LV_NANOVG_IMAGE_CACHE_CNT - #else - #define LV_NANOVG_IMAGE_CACHE_CNT 128 - #endif - #endif - - /** Draw letter texture cache count. */ - #ifndef LV_NANOVG_LETTER_CACHE_CNT - #ifdef CONFIG_LV_NANOVG_LETTER_CACHE_CNT - #define LV_NANOVG_LETTER_CACHE_CNT CONFIG_LV_NANOVG_LETTER_CACHE_CNT - #else - #define LV_NANOVG_LETTER_CACHE_CNT 512 - #endif - #endif -#endif - -/*======================= - * FEATURE CONFIGURATION - *=======================*/ - -/*------------- - * Logging - *-----------*/ - -/** Enable log module */ -#ifndef LV_USE_LOG - #ifdef CONFIG_LV_USE_LOG - #define LV_USE_LOG CONFIG_LV_USE_LOG - #else - #define LV_USE_LOG 0 - #endif -#endif -#if LV_USE_LOG - /** Set value to one of the following levels of logging detail: - * - LV_LOG_LEVEL_TRACE Log detailed information. - * - LV_LOG_LEVEL_INFO Log important events. - * - LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem. - * - LV_LOG_LEVEL_ERROR Log only critical issues, when system may fail. - * - LV_LOG_LEVEL_USER Log only custom log messages added by the user. - * - LV_LOG_LEVEL_NONE Do not log anything. */ - #ifndef LV_LOG_LEVEL - #ifdef CONFIG_LV_LOG_LEVEL - #define LV_LOG_LEVEL CONFIG_LV_LOG_LEVEL - #else - #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN - #endif - #endif - - /** - 1: Print log with 'printf'; - * - 0: User needs to register a callback with `lv_log_register_print_cb()`. */ - #ifndef LV_LOG_PRINTF - #ifdef CONFIG_LV_LOG_PRINTF - #define LV_LOG_PRINTF CONFIG_LV_LOG_PRINTF - #else - #define LV_LOG_PRINTF 0 - #endif - #endif - - /** Set callback to print logs. - * E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)`. - * Can be overwritten by `lv_log_register_print_cb`. */ - //#define LV_LOG_PRINT_CB - - /** - 1: Enable printing timestamp; - * - 0: Disable printing timestamp. */ - #ifndef LV_LOG_USE_TIMESTAMP - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_USE_TIMESTAMP - #define LV_LOG_USE_TIMESTAMP CONFIG_LV_LOG_USE_TIMESTAMP - #else - #define LV_LOG_USE_TIMESTAMP 0 - #endif - #else - #define LV_LOG_USE_TIMESTAMP 1 - #endif - #endif - - /** - 1: Print file and line number of the log; - * - 0: Do not print file and line number of the log. */ - #ifndef LV_LOG_USE_FILE_LINE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_USE_FILE_LINE - #define LV_LOG_USE_FILE_LINE CONFIG_LV_LOG_USE_FILE_LINE - #else - #define LV_LOG_USE_FILE_LINE 0 - #endif - #else - #define LV_LOG_USE_FILE_LINE 1 - #endif - #endif - - /* Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs. */ - #ifndef LV_LOG_TRACE_MEM - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_TRACE_MEM - #define LV_LOG_TRACE_MEM CONFIG_LV_LOG_TRACE_MEM - #else - #define LV_LOG_TRACE_MEM 0 - #endif - #else - #define LV_LOG_TRACE_MEM 1 /**< Enable/disable trace logs in memory operations. */ - #endif - #endif - #ifndef LV_LOG_TRACE_TIMER - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_TRACE_TIMER - #define LV_LOG_TRACE_TIMER CONFIG_LV_LOG_TRACE_TIMER - #else - #define LV_LOG_TRACE_TIMER 0 - #endif - #else - #define LV_LOG_TRACE_TIMER 1 /**< Enable/disable trace logs in timer operations. */ - #endif - #endif - #ifndef LV_LOG_TRACE_INDEV - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_TRACE_INDEV - #define LV_LOG_TRACE_INDEV CONFIG_LV_LOG_TRACE_INDEV - #else - #define LV_LOG_TRACE_INDEV 0 - #endif - #else - #define LV_LOG_TRACE_INDEV 1 /**< Enable/disable trace logs in input device operations. */ - #endif - #endif - #ifndef LV_LOG_TRACE_DISP_REFR - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_TRACE_DISP_REFR - #define LV_LOG_TRACE_DISP_REFR CONFIG_LV_LOG_TRACE_DISP_REFR - #else - #define LV_LOG_TRACE_DISP_REFR 0 - #endif - #else - #define LV_LOG_TRACE_DISP_REFR 1 /**< Enable/disable trace logs in display re-draw operations. */ - #endif - #endif - #ifndef LV_LOG_TRACE_EVENT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_TRACE_EVENT - #define LV_LOG_TRACE_EVENT CONFIG_LV_LOG_TRACE_EVENT - #else - #define LV_LOG_TRACE_EVENT 0 - #endif - #else - #define LV_LOG_TRACE_EVENT 1 /**< Enable/disable trace logs in event dispatch logic. */ - #endif - #endif - #ifndef LV_LOG_TRACE_OBJ_CREATE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_TRACE_OBJ_CREATE - #define LV_LOG_TRACE_OBJ_CREATE CONFIG_LV_LOG_TRACE_OBJ_CREATE - #else - #define LV_LOG_TRACE_OBJ_CREATE 0 - #endif - #else - #define LV_LOG_TRACE_OBJ_CREATE 1 /**< Enable/disable trace logs in object creation (core `obj` creation plus every widget). */ - #endif - #endif - #ifndef LV_LOG_TRACE_LAYOUT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_TRACE_LAYOUT - #define LV_LOG_TRACE_LAYOUT CONFIG_LV_LOG_TRACE_LAYOUT - #else - #define LV_LOG_TRACE_LAYOUT 0 - #endif - #else - #define LV_LOG_TRACE_LAYOUT 1 /**< Enable/disable trace logs in flex- and grid-layout operations. */ - #endif - #endif - #ifndef LV_LOG_TRACE_ANIM - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_TRACE_ANIM - #define LV_LOG_TRACE_ANIM CONFIG_LV_LOG_TRACE_ANIM - #else - #define LV_LOG_TRACE_ANIM 0 - #endif - #else - #define LV_LOG_TRACE_ANIM 1 /**< Enable/disable trace logs in animation logic. */ - #endif - #endif - #ifndef LV_LOG_TRACE_CACHE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LOG_TRACE_CACHE - #define LV_LOG_TRACE_CACHE CONFIG_LV_LOG_TRACE_CACHE - #else - #define LV_LOG_TRACE_CACHE 0 - #endif - #else - #define LV_LOG_TRACE_CACHE 1 /**< Enable/disable trace logs in cache operations. */ - #endif - #endif -#endif /*LV_USE_LOG*/ - -/*------------- - * Asserts - *-----------*/ - -/* Enable assertion failures if an operation fails or invalid data is found. - * If LV_USE_LOG is enabled, an error message will be printed on failure. */ -#ifndef LV_USE_ASSERT_NULL - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_ASSERT_NULL - #define LV_USE_ASSERT_NULL CONFIG_LV_USE_ASSERT_NULL - #else - #define LV_USE_ASSERT_NULL 0 - #endif - #else - #define LV_USE_ASSERT_NULL 1 /**< Check if the parameter is NULL. (Very fast, recommended) */ - #endif -#endif -#ifndef LV_USE_ASSERT_MALLOC - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_ASSERT_MALLOC - #define LV_USE_ASSERT_MALLOC CONFIG_LV_USE_ASSERT_MALLOC - #else - #define LV_USE_ASSERT_MALLOC 0 - #endif - #else - #define LV_USE_ASSERT_MALLOC 1 /**< Checks is the memory is successfully allocated or no. (Very fast, recommended) */ - #endif -#endif -#ifndef LV_USE_ASSERT_STYLE - #ifdef CONFIG_LV_USE_ASSERT_STYLE - #define LV_USE_ASSERT_STYLE CONFIG_LV_USE_ASSERT_STYLE - #else - #define LV_USE_ASSERT_STYLE 0 /**< Check if the styles are properly initialized. (Very fast, recommended) */ - #endif -#endif -#ifndef LV_USE_ASSERT_MEM_INTEGRITY - #ifdef CONFIG_LV_USE_ASSERT_MEM_INTEGRITY - #define LV_USE_ASSERT_MEM_INTEGRITY CONFIG_LV_USE_ASSERT_MEM_INTEGRITY - #else - #define LV_USE_ASSERT_MEM_INTEGRITY 0 /**< Check the integrity of `lv_mem` after critical operations. (Slow) */ - #endif -#endif -#ifndef LV_USE_ASSERT_OBJ - #ifdef CONFIG_LV_USE_ASSERT_OBJ - #define LV_USE_ASSERT_OBJ CONFIG_LV_USE_ASSERT_OBJ - #else - #define LV_USE_ASSERT_OBJ 0 /**< Check the object's type and existence (e.g. not deleted). (Slow) */ - #endif -#endif - -/** Add a custom handler when assert happens e.g. to restart MCU. */ -#ifndef LV_ASSERT_HANDLER_INCLUDE - #ifdef CONFIG_LV_ASSERT_HANDLER_INCLUDE - #define LV_ASSERT_HANDLER_INCLUDE CONFIG_LV_ASSERT_HANDLER_INCLUDE - #else - #define LV_ASSERT_HANDLER_INCLUDE - #endif -#endif -#ifndef LV_ASSERT_HANDLER - #ifdef CONFIG_LV_ASSERT_HANDLER - #define LV_ASSERT_HANDLER CONFIG_LV_ASSERT_HANDLER - #else - #define LV_ASSERT_HANDLER while(1); /**< Halt by default */ - #endif -#endif - -/*------------- - * Check arg - *-----------*/ - -/** Enable LV_CHECK_ARG macro to validate function arguments at runtime. - * When enabled, failed checks log a warning and execute the specified action. - * 0: Disable all LV_CHECK_ARG checks (checks compile to nothing) - * 1: Enable LV_CHECK_ARG checks */ -#ifndef LV_USE_CHECK_ARG - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_CHECK_ARG - #define LV_USE_CHECK_ARG CONFIG_LV_USE_CHECK_ARG - #else - #define LV_USE_CHECK_ARG 0 - #endif - #else - #define LV_USE_CHECK_ARG 1 - #endif -#endif - -/** If enabled, also call LV_ASSERT_HANDLER when an LV_CHECK_ARG check fails. - * Requires LV_USE_CHECK_ARG to be enabled. */ -#ifndef LV_CHECK_ARG_ASSERT_ON_FAIL - #ifdef CONFIG_LV_CHECK_ARG_ASSERT_ON_FAIL - #define LV_CHECK_ARG_ASSERT_ON_FAIL CONFIG_LV_CHECK_ARG_ASSERT_ON_FAIL - #else - #define LV_CHECK_ARG_ASSERT_ON_FAIL 0 - #endif -#endif - -/*------------- - * Debug - *-----------*/ - -/** 1: Draw random colored rectangles over the redrawn areas. */ -#ifndef LV_USE_REFR_DEBUG - #ifdef CONFIG_LV_USE_REFR_DEBUG - #define LV_USE_REFR_DEBUG CONFIG_LV_USE_REFR_DEBUG - #else - #define LV_USE_REFR_DEBUG 0 - #endif -#endif - -/** 1: Draw a red overlay for ARGB layers and a green overlay for RGB layers*/ -#ifndef LV_USE_LAYER_DEBUG - #ifdef CONFIG_LV_USE_LAYER_DEBUG - #define LV_USE_LAYER_DEBUG CONFIG_LV_USE_LAYER_DEBUG - #else - #define LV_USE_LAYER_DEBUG 0 - #endif -#endif - -/** 1: Adds the following behaviors for debugging: - * - Draw overlays with different colors for each draw_unit's tasks. - * - Draw index number of draw unit on white background. - * - For layers, draws index number of draw unit on black background. */ -#ifndef LV_USE_PARALLEL_DRAW_DEBUG - #ifdef CONFIG_LV_USE_PARALLEL_DRAW_DEBUG - #define LV_USE_PARALLEL_DRAW_DEBUG CONFIG_LV_USE_PARALLEL_DRAW_DEBUG - #else - #define LV_USE_PARALLEL_DRAW_DEBUG 0 - #endif -#endif - -/*------------- - * Others - *-----------*/ - -#ifndef LV_ENABLE_GLOBAL_CUSTOM - #ifdef CONFIG_LV_ENABLE_GLOBAL_CUSTOM - #define LV_ENABLE_GLOBAL_CUSTOM CONFIG_LV_ENABLE_GLOBAL_CUSTOM - #else - #define LV_ENABLE_GLOBAL_CUSTOM 0 - #endif -#endif -#if LV_ENABLE_GLOBAL_CUSTOM - /** Header to include for custom 'lv_global' function" */ - #ifndef LV_GLOBAL_CUSTOM_INCLUDE - #ifdef CONFIG_LV_GLOBAL_CUSTOM_INCLUDE - #define LV_GLOBAL_CUSTOM_INCLUDE CONFIG_LV_GLOBAL_CUSTOM_INCLUDE - #else - #define LV_GLOBAL_CUSTOM_INCLUDE - #endif - #endif -#endif - -/** Default cache size in bytes. - * Used by image decoders such as `lv_lodepng` to keep the decoded image in memory. - * If size is not set to 0, the decoder will fail to decode when the cache is full. - * If size is 0, the cache function is not enabled and the decoded memory will be - * released immediately after use. */ -#ifndef LV_CACHE_DEF_SIZE - #ifdef CONFIG_LV_CACHE_DEF_SIZE - #define LV_CACHE_DEF_SIZE CONFIG_LV_CACHE_DEF_SIZE - #else - #define LV_CACHE_DEF_SIZE 0 - #endif -#endif - -/** Default number of image header cache entries. The cache is used to store the headers of images - * The main logic is like `LV_CACHE_DEF_SIZE` but for image headers. */ -#ifndef LV_IMAGE_HEADER_CACHE_DEF_CNT - #ifdef CONFIG_LV_IMAGE_HEADER_CACHE_DEF_CNT - #define LV_IMAGE_HEADER_CACHE_DEF_CNT CONFIG_LV_IMAGE_HEADER_CACHE_DEF_CNT - #else - #define LV_IMAGE_HEADER_CACHE_DEF_CNT 0 - #endif -#endif - -/** Number of stops allowed per gradient. Increase this to allow more stops. - * This adds (sizeof(lv_color_t) + 1) bytes per additional stop. */ -#ifndef LV_GRADIENT_MAX_STOPS - #ifdef CONFIG_LV_GRADIENT_MAX_STOPS - #define LV_GRADIENT_MAX_STOPS CONFIG_LV_GRADIENT_MAX_STOPS - #else - #define LV_GRADIENT_MAX_STOPS 2 - #endif -#endif - -/** Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. - * - 0: round down, - * - 64: round up from x.75, - * - 128: round up from half, - * - 192: round up from x.25, - * - 254: round up */ -#ifndef LV_COLOR_MIX_ROUND_OFS - #ifdef CONFIG_LV_COLOR_MIX_ROUND_OFS - #define LV_COLOR_MIX_ROUND_OFS CONFIG_LV_COLOR_MIX_ROUND_OFS - #else - #define LV_COLOR_MIX_ROUND_OFS 0 - #endif -#endif - -/** Add 2 x 32-bit variables to each `lv_obj_t` to speed up getting style properties */ -#ifndef LV_OBJ_STYLE_CACHE - #ifdef CONFIG_LV_OBJ_STYLE_CACHE - #define LV_OBJ_STYLE_CACHE CONFIG_LV_OBJ_STYLE_CACHE - #else - #define LV_OBJ_STYLE_CACHE 0 - #endif -#endif - -/** Add `id` field to `lv_obj_t` */ -#ifndef LV_USE_OBJ_ID - #ifdef CONFIG_LV_USE_OBJ_ID - #define LV_USE_OBJ_ID CONFIG_LV_USE_OBJ_ID - #else - #define LV_USE_OBJ_ID 0 - #endif -#endif - -/** Enable support widget names*/ -#ifndef LV_USE_OBJ_NAME - #ifdef CONFIG_LV_USE_OBJ_NAME - #define LV_USE_OBJ_NAME CONFIG_LV_USE_OBJ_NAME - #else - #define LV_USE_OBJ_NAME 0 - #endif -#endif - -/** Automatically assign an ID when obj is created */ -#ifndef LV_OBJ_ID_AUTO_ASSIGN - #ifdef CONFIG_LV_OBJ_ID_AUTO_ASSIGN - #define LV_OBJ_ID_AUTO_ASSIGN CONFIG_LV_OBJ_ID_AUTO_ASSIGN - #else - #define LV_OBJ_ID_AUTO_ASSIGN LV_USE_OBJ_ID - #endif -#endif - -/** Use builtin obj ID handler functions: -* - lv_obj_assign_id: Called when a widget is created. Use a separate counter for each widget class as an ID. -* - lv_obj_id_compare: Compare the ID to decide if it matches with a requested value. -* - lv_obj_stringify_id: Return string-ified identifier, e.g. "button3". -* - lv_obj_free_id: Does nothing, as there is no memory allocation for the ID. -* When disabled these functions needs to be implemented by the user.*/ -#ifndef LV_USE_OBJ_ID_BUILTIN - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_OBJ_ID_BUILTIN - #define LV_USE_OBJ_ID_BUILTIN CONFIG_LV_USE_OBJ_ID_BUILTIN - #else - #define LV_USE_OBJ_ID_BUILTIN 0 - #endif - #else - #define LV_USE_OBJ_ID_BUILTIN 1 - #endif -#endif - -/** Use obj property set/get API. */ -#ifndef LV_USE_OBJ_PROPERTY - #ifdef CONFIG_LV_USE_OBJ_PROPERTY - #define LV_USE_OBJ_PROPERTY CONFIG_LV_USE_OBJ_PROPERTY - #else - #define LV_USE_OBJ_PROPERTY 0 - #endif -#endif - -/** Enable property name support. */ -#ifndef LV_USE_OBJ_PROPERTY_NAME - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_OBJ_PROPERTY_NAME - #define LV_USE_OBJ_PROPERTY_NAME CONFIG_LV_USE_OBJ_PROPERTY_NAME - #else - #define LV_USE_OBJ_PROPERTY_NAME 0 - #endif - #else - #define LV_USE_OBJ_PROPERTY_NAME 1 - #endif -#endif - -/* Enable the multi-touch gesture recognition feature */ -/* Gesture recognition requires the use of floats */ -#ifndef LV_USE_GESTURE_RECOGNITION - #ifdef CONFIG_LV_USE_GESTURE_RECOGNITION - #define LV_USE_GESTURE_RECOGNITION CONFIG_LV_USE_GESTURE_RECOGNITION - #else - #define LV_USE_GESTURE_RECOGNITION 0 - #endif -#endif - -/*===================== - * COMPILER SETTINGS - *====================*/ - -/** For big endian systems set to 1 */ -#ifndef LV_BIG_ENDIAN_SYSTEM - #ifdef CONFIG_LV_BIG_ENDIAN_SYSTEM - #define LV_BIG_ENDIAN_SYSTEM CONFIG_LV_BIG_ENDIAN_SYSTEM - #else - #define LV_BIG_ENDIAN_SYSTEM 0 - #endif -#endif - -/** Define a custom attribute for `lv_tick_inc` function */ -#ifndef LV_ATTRIBUTE_TICK_INC - #ifdef CONFIG_LV_ATTRIBUTE_TICK_INC - #define LV_ATTRIBUTE_TICK_INC CONFIG_LV_ATTRIBUTE_TICK_INC - #else - #define LV_ATTRIBUTE_TICK_INC - #endif -#endif - -/** Define a custom attribute for `lv_timer_handler` function */ -#ifndef LV_ATTRIBUTE_TIMER_HANDLER - #ifdef CONFIG_LV_ATTRIBUTE_TIMER_HANDLER - #define LV_ATTRIBUTE_TIMER_HANDLER CONFIG_LV_ATTRIBUTE_TIMER_HANDLER - #else - #define LV_ATTRIBUTE_TIMER_HANDLER - #endif -#endif - -/** Define a custom attribute for `lv_display_flush_ready` function */ -#ifndef LV_ATTRIBUTE_FLUSH_READY - #ifdef CONFIG_LV_ATTRIBUTE_FLUSH_READY - #define LV_ATTRIBUTE_FLUSH_READY CONFIG_LV_ATTRIBUTE_FLUSH_READY - #else - #define LV_ATTRIBUTE_FLUSH_READY - #endif -#endif - -/** Define a custom attribute for `lv_display_sync_ready` function */ -#ifndef LV_ATTRIBUTE_SYNC_READY - #ifdef CONFIG_LV_ATTRIBUTE_SYNC_READY - #define LV_ATTRIBUTE_SYNC_READY CONFIG_LV_ATTRIBUTE_SYNC_READY - #else - #define LV_ATTRIBUTE_SYNC_READY - #endif -#endif - -/** Align VG_LITE buffers on this number of bytes. - * @note vglite_src_buf_aligned() uses this value to validate alignment of passed buffer pointers. */ -#ifndef LV_ATTRIBUTE_MEM_ALIGN_SIZE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE - #define LV_ATTRIBUTE_MEM_ALIGN_SIZE CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE - #else - #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 0 - #endif - #else - #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 - #endif -#endif - -/** Will be added where memory needs to be aligned (with -Os data might not be aligned to boundary by default). - * E.g. __attribute__((aligned(4)))*/ -#ifndef LV_ATTRIBUTE_MEM_ALIGN - #ifdef CONFIG_LV_ATTRIBUTE_MEM_ALIGN - #define LV_ATTRIBUTE_MEM_ALIGN CONFIG_LV_ATTRIBUTE_MEM_ALIGN - #else - #define LV_ATTRIBUTE_MEM_ALIGN - #endif -#endif - -/** Attribute to mark large constant arrays, for example for font bitmaps */ -#ifndef LV_ATTRIBUTE_LARGE_CONST - #ifdef CONFIG_LV_ATTRIBUTE_LARGE_CONST - #define LV_ATTRIBUTE_LARGE_CONST CONFIG_LV_ATTRIBUTE_LARGE_CONST - #else - #define LV_ATTRIBUTE_LARGE_CONST - #endif -#endif - -/** Compiler prefix for a large array declaration in RAM */ -#ifndef LV_ATTRIBUTE_LARGE_RAM_ARRAY - #ifdef CONFIG_LV_ATTRIBUTE_LARGE_RAM_ARRAY - #define LV_ATTRIBUTE_LARGE_RAM_ARRAY CONFIG_LV_ATTRIBUTE_LARGE_RAM_ARRAY - #else - #define LV_ATTRIBUTE_LARGE_RAM_ARRAY - #endif -#endif - -/** Place performance critical functions into a faster memory (e.g RAM) */ -#ifndef LV_ATTRIBUTE_FAST_MEM - #ifdef CONFIG_LV_ATTRIBUTE_FAST_MEM - #define LV_ATTRIBUTE_FAST_MEM CONFIG_LV_ATTRIBUTE_FAST_MEM - #else - #define LV_ATTRIBUTE_FAST_MEM - #endif -#endif - -/** Export integer constant to binding. This macro is used with constants in the form of LV_ that - * should also appear on LVGL binding API such as MicroPython. */ -#ifndef LV_EXPORT_CONST_INT - #ifdef CONFIG_LV_EXPORT_CONST_INT - #define LV_EXPORT_CONST_INT CONFIG_LV_EXPORT_CONST_INT - #else - #define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /**< The default value just prevents GCC warning */ - #endif -#endif - -/** Prefix all global extern data with this */ -#ifndef LV_ATTRIBUTE_EXTERN_DATA - #ifdef CONFIG_LV_ATTRIBUTE_EXTERN_DATA - #define LV_ATTRIBUTE_EXTERN_DATA CONFIG_LV_ATTRIBUTE_EXTERN_DATA - #else - #define LV_ATTRIBUTE_EXTERN_DATA - #endif -#endif - -/** Use `float` as `lv_value_precise_t` */ -#ifndef LV_USE_FLOAT - #ifdef CONFIG_LV_USE_FLOAT - #define LV_USE_FLOAT CONFIG_LV_USE_FLOAT - #else - #define LV_USE_FLOAT 0 - #endif -#endif - -/** Enable matrix support - * - Requires `LV_USE_FLOAT = 1` */ -#ifndef LV_USE_MATRIX - #ifdef CONFIG_LV_USE_MATRIX - #define LV_USE_MATRIX CONFIG_LV_USE_MATRIX - #else - #define LV_USE_MATRIX 0 - #endif -#endif - -/** Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default */ -#ifndef LV_USE_PRIVATE_API - #ifndef LV_USE_PRIVATE_API - #ifdef CONFIG_LV_USE_PRIVATE_API - #define LV_USE_PRIVATE_API CONFIG_LV_USE_PRIVATE_API - #else - #define LV_USE_PRIVATE_API 0 - #endif - #endif -#endif - -/*================== - * FONT USAGE - *===================*/ - -/* Montserrat fonts with ASCII range and some symbols using bpp = 4 - * https://fonts.google.com/specimen/Montserrat */ -#ifndef LV_FONT_MONTSERRAT_8 - #ifdef CONFIG_LV_FONT_MONTSERRAT_8 - #define LV_FONT_MONTSERRAT_8 CONFIG_LV_FONT_MONTSERRAT_8 - #else - #define LV_FONT_MONTSERRAT_8 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_10 - #ifdef CONFIG_LV_FONT_MONTSERRAT_10 - #define LV_FONT_MONTSERRAT_10 CONFIG_LV_FONT_MONTSERRAT_10 - #else - #define LV_FONT_MONTSERRAT_10 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_12 - #ifdef CONFIG_LV_FONT_MONTSERRAT_12 - #define LV_FONT_MONTSERRAT_12 CONFIG_LV_FONT_MONTSERRAT_12 - #else - #define LV_FONT_MONTSERRAT_12 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_14 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_FONT_MONTSERRAT_14 - #define LV_FONT_MONTSERRAT_14 CONFIG_LV_FONT_MONTSERRAT_14 - #else - #define LV_FONT_MONTSERRAT_14 0 - #endif - #else - #define LV_FONT_MONTSERRAT_14 1 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_16 - #ifdef CONFIG_LV_FONT_MONTSERRAT_16 - #define LV_FONT_MONTSERRAT_16 CONFIG_LV_FONT_MONTSERRAT_16 - #else - #define LV_FONT_MONTSERRAT_16 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_18 - #ifdef CONFIG_LV_FONT_MONTSERRAT_18 - #define LV_FONT_MONTSERRAT_18 CONFIG_LV_FONT_MONTSERRAT_18 - #else - #define LV_FONT_MONTSERRAT_18 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_20 - #ifdef CONFIG_LV_FONT_MONTSERRAT_20 - #define LV_FONT_MONTSERRAT_20 CONFIG_LV_FONT_MONTSERRAT_20 - #else - #define LV_FONT_MONTSERRAT_20 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_22 - #ifdef CONFIG_LV_FONT_MONTSERRAT_22 - #define LV_FONT_MONTSERRAT_22 CONFIG_LV_FONT_MONTSERRAT_22 - #else - #define LV_FONT_MONTSERRAT_22 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_24 - #ifdef CONFIG_LV_FONT_MONTSERRAT_24 - #define LV_FONT_MONTSERRAT_24 CONFIG_LV_FONT_MONTSERRAT_24 - #else - #define LV_FONT_MONTSERRAT_24 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_26 - #ifdef CONFIG_LV_FONT_MONTSERRAT_26 - #define LV_FONT_MONTSERRAT_26 CONFIG_LV_FONT_MONTSERRAT_26 - #else - #define LV_FONT_MONTSERRAT_26 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_28 - #ifdef CONFIG_LV_FONT_MONTSERRAT_28 - #define LV_FONT_MONTSERRAT_28 CONFIG_LV_FONT_MONTSERRAT_28 - #else - #define LV_FONT_MONTSERRAT_28 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_30 - #ifdef CONFIG_LV_FONT_MONTSERRAT_30 - #define LV_FONT_MONTSERRAT_30 CONFIG_LV_FONT_MONTSERRAT_30 - #else - #define LV_FONT_MONTSERRAT_30 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_32 - #ifdef CONFIG_LV_FONT_MONTSERRAT_32 - #define LV_FONT_MONTSERRAT_32 CONFIG_LV_FONT_MONTSERRAT_32 - #else - #define LV_FONT_MONTSERRAT_32 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_34 - #ifdef CONFIG_LV_FONT_MONTSERRAT_34 - #define LV_FONT_MONTSERRAT_34 CONFIG_LV_FONT_MONTSERRAT_34 - #else - #define LV_FONT_MONTSERRAT_34 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_36 - #ifdef CONFIG_LV_FONT_MONTSERRAT_36 - #define LV_FONT_MONTSERRAT_36 CONFIG_LV_FONT_MONTSERRAT_36 - #else - #define LV_FONT_MONTSERRAT_36 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_38 - #ifdef CONFIG_LV_FONT_MONTSERRAT_38 - #define LV_FONT_MONTSERRAT_38 CONFIG_LV_FONT_MONTSERRAT_38 - #else - #define LV_FONT_MONTSERRAT_38 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_40 - #ifdef CONFIG_LV_FONT_MONTSERRAT_40 - #define LV_FONT_MONTSERRAT_40 CONFIG_LV_FONT_MONTSERRAT_40 - #else - #define LV_FONT_MONTSERRAT_40 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_42 - #ifdef CONFIG_LV_FONT_MONTSERRAT_42 - #define LV_FONT_MONTSERRAT_42 CONFIG_LV_FONT_MONTSERRAT_42 - #else - #define LV_FONT_MONTSERRAT_42 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_44 - #ifdef CONFIG_LV_FONT_MONTSERRAT_44 - #define LV_FONT_MONTSERRAT_44 CONFIG_LV_FONT_MONTSERRAT_44 - #else - #define LV_FONT_MONTSERRAT_44 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_46 - #ifdef CONFIG_LV_FONT_MONTSERRAT_46 - #define LV_FONT_MONTSERRAT_46 CONFIG_LV_FONT_MONTSERRAT_46 - #else - #define LV_FONT_MONTSERRAT_46 0 - #endif -#endif -#ifndef LV_FONT_MONTSERRAT_48 - #ifdef CONFIG_LV_FONT_MONTSERRAT_48 - #define LV_FONT_MONTSERRAT_48 CONFIG_LV_FONT_MONTSERRAT_48 - #else - #define LV_FONT_MONTSERRAT_48 0 - #endif -#endif - -/* Demonstrate special features */ -#ifndef LV_FONT_MONTSERRAT_28_COMPRESSED - #ifdef CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED - #define LV_FONT_MONTSERRAT_28_COMPRESSED CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED - #else - #define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */ - #endif -#endif -#ifndef LV_FONT_DEJAVU_16_PERSIAN_HEBREW - #ifdef CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW - #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW - #else - #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /**< Hebrew, Arabic, Persian letters and all their forms */ - #endif -#endif -#ifndef LV_FONT_SOURCE_HAN_SANS_SC_14_CJK - #ifdef CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK - #define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK - #else - #define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 0 /**< 1338 most common CJK radicals */ - #endif -#endif -#ifndef LV_FONT_SOURCE_HAN_SANS_SC_16_CJK - #ifdef CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK - #define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK - #else - #define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 0 /**< 1338 most common CJK radicals */ - #endif -#endif - -/** Pixel perfect monospaced fonts */ -#ifndef LV_FONT_UNSCII_8 - #ifdef CONFIG_LV_FONT_UNSCII_8 - #define LV_FONT_UNSCII_8 CONFIG_LV_FONT_UNSCII_8 - #else - #define LV_FONT_UNSCII_8 0 - #endif -#endif -#ifndef LV_FONT_UNSCII_16 - #ifdef CONFIG_LV_FONT_UNSCII_16 - #define LV_FONT_UNSCII_16 CONFIG_LV_FONT_UNSCII_16 - #else - #define LV_FONT_UNSCII_16 0 - #endif -#endif - -/** Optionally declare custom fonts here. - * - * You can use any of these fonts as the default font too and they will be available - * globally. Example: - * - * @code - * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2) - * @endcode - */ -#ifndef LV_FONT_CUSTOM_DECLARE - #ifdef CONFIG_LV_FONT_CUSTOM_DECLARE - #define LV_FONT_CUSTOM_DECLARE CONFIG_LV_FONT_CUSTOM_DECLARE - #else - #define LV_FONT_CUSTOM_DECLARE - #endif -#endif - -/** Always set a default font */ -#ifndef LV_FONT_DEFAULT - #ifdef CONFIG_LV_FONT_DEFAULT - #define LV_FONT_DEFAULT CONFIG_LV_FONT_DEFAULT - #else - #define LV_FONT_DEFAULT &lv_font_montserrat_14 - #endif -#endif - -/** Enable handling large font and/or fonts with a lot of characters. - * The limit depends on the font size, font face and bpp. - * A compiler error will be triggered if a font needs it. */ -#ifndef LV_FONT_FMT_TXT_LARGE - #ifdef CONFIG_LV_FONT_FMT_TXT_LARGE - #define LV_FONT_FMT_TXT_LARGE CONFIG_LV_FONT_FMT_TXT_LARGE - #else - #define LV_FONT_FMT_TXT_LARGE 0 - #endif -#endif - -/** Enables/disables support for compressed fonts. */ -#ifndef LV_USE_FONT_COMPRESSED - #ifdef CONFIG_LV_USE_FONT_COMPRESSED - #define LV_USE_FONT_COMPRESSED CONFIG_LV_USE_FONT_COMPRESSED - #else - #define LV_USE_FONT_COMPRESSED 0 - #endif -#endif - -/** Enable drawing placeholders when glyph dsc is not found. */ -#ifndef LV_USE_FONT_PLACEHOLDER - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_FONT_PLACEHOLDER - #define LV_USE_FONT_PLACEHOLDER CONFIG_LV_USE_FONT_PLACEHOLDER - #else - #define LV_USE_FONT_PLACEHOLDER 0 - #endif - #else - #define LV_USE_FONT_PLACEHOLDER 1 - #endif -#endif - -/*================= - * TEXT SETTINGS - *=================*/ - -/** - * Select a character encoding for strings. - * Your IDE or editor should have the same character encoding. - * - LV_TXT_ENC_UTF8 - * - LV_TXT_ENC_ASCII - */ -#ifndef LV_TXT_ENC - #ifdef CONFIG_LV_TXT_ENC - #define LV_TXT_ENC CONFIG_LV_TXT_ENC - #else - #define LV_TXT_ENC LV_TXT_ENC_UTF8 - #endif -#endif - -/** While rendering text strings, break (wrap) text on these chars. */ -#ifndef LV_TXT_BREAK_CHARS - #ifdef CONFIG_LV_TXT_BREAK_CHARS - #define LV_TXT_BREAK_CHARS CONFIG_LV_TXT_BREAK_CHARS - #else - #define LV_TXT_BREAK_CHARS " ,.;:-_)]}" - #endif -#endif - -/** If a word is at least this long, will break wherever "prettiest". - * To disable, set to a value <= 0. */ -#ifndef LV_TXT_LINE_BREAK_LONG_LEN - #ifdef CONFIG_LV_TXT_LINE_BREAK_LONG_LEN - #define LV_TXT_LINE_BREAK_LONG_LEN CONFIG_LV_TXT_LINE_BREAK_LONG_LEN - #else - #define LV_TXT_LINE_BREAK_LONG_LEN 0 - #endif -#endif - -/** Minimum number of characters in a long word to put on a line before a break. - * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ -#ifndef LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN - #ifdef CONFIG_LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN - #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN CONFIG_LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN - #else - #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 - #endif -#endif - -/** Minimum number of characters in a long word to put on a line after a break. - * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ -#ifndef LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN - #ifdef CONFIG_LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN - #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN CONFIG_LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN - #else - #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 - #endif -#endif - -/** Support bidirectional text. Allows mixing Left-to-Right and Right-to-Left text. - * The direction will be processed according to the Unicode Bidirectional Algorithm: - * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ -#ifndef LV_USE_BIDI - #ifdef CONFIG_LV_USE_BIDI - #define LV_USE_BIDI CONFIG_LV_USE_BIDI - #else - #define LV_USE_BIDI 0 - #endif -#endif -#if LV_USE_BIDI - /*Set the default direction. Supported values: - *`LV_BASE_DIR_LTR` Left-to-Right - *`LV_BASE_DIR_RTL` Right-to-Left - *`LV_BASE_DIR_AUTO` detect text base direction*/ - #ifndef LV_BIDI_BASE_DIR_DEF - #ifdef CONFIG_LV_BIDI_BASE_DIR_DEF - #define LV_BIDI_BASE_DIR_DEF CONFIG_LV_BIDI_BASE_DIR_DEF - #else - #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO - #endif - #endif -#endif - -/** Enable Arabic/Persian processing - * In these languages characters should be replaced with another form based on their position in the text */ -#ifndef LV_USE_ARABIC_PERSIAN_CHARS - #ifdef CONFIG_LV_USE_ARABIC_PERSIAN_CHARS - #define LV_USE_ARABIC_PERSIAN_CHARS CONFIG_LV_USE_ARABIC_PERSIAN_CHARS - #else - #define LV_USE_ARABIC_PERSIAN_CHARS 0 - #endif -#endif - -/*The control character to use for signaling text recoloring*/ -#ifndef LV_TXT_COLOR_CMD - #ifdef CONFIG_LV_TXT_COLOR_CMD - #define LV_TXT_COLOR_CMD CONFIG_LV_TXT_COLOR_CMD - #else - #define LV_TXT_COLOR_CMD "#" - #endif -#endif - -/*================== - * WIDGETS - *================*/ -/* Documentation for widgets can be found here: https://docs.lvgl.io/master/widgets/index.html . */ - -/** 1: Causes these widgets to be given default values at creation time. - * - lv_buttonmatrix_t: Get default maps: {"Btn1", "Btn2", "Btn3", "\n", "Btn4", "Btn5", ""}, else map not set. - * - lv_checkbox_t : String label set to "Check box", else set to empty string. - * - lv_dropdown_t : Options set to "Option 1", "Option 2", "Option 3", else no values are set. - * - lv_roller_t : Options set to "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", else no values are set. - * - lv_label_t : Text set to "Text", else empty string. - * - lv_arclabel_t : Text set to "Arced Text", else empty string. - * */ -#ifndef LV_WIDGETS_HAS_DEFAULT_VALUE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE - #define LV_WIDGETS_HAS_DEFAULT_VALUE CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE - #else - #define LV_WIDGETS_HAS_DEFAULT_VALUE 0 - #endif - #else - #define LV_WIDGETS_HAS_DEFAULT_VALUE 1 - #endif -#endif - -#ifndef LV_USE_ANIMIMG - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_ANIMIMG - #define LV_USE_ANIMIMG CONFIG_LV_USE_ANIMIMG - #else - #define LV_USE_ANIMIMG 0 - #endif - #else - #define LV_USE_ANIMIMG 1 - #endif -#endif - -#ifndef LV_USE_ARC - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_ARC - #define LV_USE_ARC CONFIG_LV_USE_ARC - #else - #define LV_USE_ARC 0 - #endif - #else - #define LV_USE_ARC 1 - #endif -#endif - -#ifndef LV_USE_ARCLABEL - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_ARCLABEL - #define LV_USE_ARCLABEL CONFIG_LV_USE_ARCLABEL - #else - #define LV_USE_ARCLABEL 0 - #endif - #else - #define LV_USE_ARCLABEL 1 - #endif -#endif - -#ifndef LV_USE_BAR - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_BAR - #define LV_USE_BAR CONFIG_LV_USE_BAR - #else - #define LV_USE_BAR 0 - #endif - #else - #define LV_USE_BAR 1 - #endif -#endif - -#ifndef LV_USE_BUTTON - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_BUTTON - #define LV_USE_BUTTON CONFIG_LV_USE_BUTTON - #else - #define LV_USE_BUTTON 0 - #endif - #else - #define LV_USE_BUTTON 1 - #endif -#endif - -#ifndef LV_USE_BUTTONMATRIX - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_BUTTONMATRIX - #define LV_USE_BUTTONMATRIX CONFIG_LV_USE_BUTTONMATRIX - #else - #define LV_USE_BUTTONMATRIX 0 - #endif - #else - #define LV_USE_BUTTONMATRIX 1 - #endif -#endif - -#ifndef LV_USE_CALENDAR - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_CALENDAR - #define LV_USE_CALENDAR CONFIG_LV_USE_CALENDAR - #else - #define LV_USE_CALENDAR 0 - #endif - #else - #define LV_USE_CALENDAR 1 - #endif -#endif -#if LV_USE_CALENDAR - #ifndef LV_CALENDAR_WEEK_STARTS_MONDAY - #ifdef CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY - #define LV_CALENDAR_WEEK_STARTS_MONDAY CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY - #else - #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 - #endif - #endif - #if LV_CALENDAR_WEEK_STARTS_MONDAY - #ifndef LV_CALENDAR_DEFAULT_DAY_NAMES - #ifdef CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES - #define LV_CALENDAR_DEFAULT_DAY_NAMES CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES - #else - #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} - #endif - #endif - #else - #ifndef LV_CALENDAR_DEFAULT_DAY_NAMES - #ifdef CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES - #define LV_CALENDAR_DEFAULT_DAY_NAMES CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES - #else - #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} - #endif - #endif - #endif - - #ifndef LV_CALENDAR_DEFAULT_MONTH_NAMES - #ifdef CONFIG_LV_CALENDAR_DEFAULT_MONTH_NAMES - #define LV_CALENDAR_DEFAULT_MONTH_NAMES CONFIG_LV_CALENDAR_DEFAULT_MONTH_NAMES - #else - #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} - #endif - #endif - #ifndef LV_USE_CALENDAR_HEADER_ARROW - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_CALENDAR_HEADER_ARROW - #define LV_USE_CALENDAR_HEADER_ARROW CONFIG_LV_USE_CALENDAR_HEADER_ARROW - #else - #define LV_USE_CALENDAR_HEADER_ARROW 0 - #endif - #else - #define LV_USE_CALENDAR_HEADER_ARROW 1 - #endif - #endif - #ifndef LV_USE_CALENDAR_HEADER_DROPDOWN - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN - #define LV_USE_CALENDAR_HEADER_DROPDOWN CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN - #else - #define LV_USE_CALENDAR_HEADER_DROPDOWN 0 - #endif - #else - #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 - #endif - #endif - #ifndef LV_USE_CALENDAR_CHINESE - #ifdef CONFIG_LV_USE_CALENDAR_CHINESE - #define LV_USE_CALENDAR_CHINESE CONFIG_LV_USE_CALENDAR_CHINESE - #else - #define LV_USE_CALENDAR_CHINESE 0 - #endif - #endif -#endif /*LV_USE_CALENDAR*/ - -#ifndef LV_USE_CANVAS - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_CANVAS - #define LV_USE_CANVAS CONFIG_LV_USE_CANVAS - #else - #define LV_USE_CANVAS 0 - #endif - #else - #define LV_USE_CANVAS 1 - #endif -#endif - -#ifndef LV_USE_CHART - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_CHART - #define LV_USE_CHART CONFIG_LV_USE_CHART - #else - #define LV_USE_CHART 0 - #endif - #else - #define LV_USE_CHART 1 - #endif -#endif - -#ifndef LV_USE_CHECKBOX - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_CHECKBOX - #define LV_USE_CHECKBOX CONFIG_LV_USE_CHECKBOX - #else - #define LV_USE_CHECKBOX 0 - #endif - #else - #define LV_USE_CHECKBOX 1 - #endif -#endif - -#ifndef LV_USE_DROPDOWN - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_DROPDOWN - #define LV_USE_DROPDOWN CONFIG_LV_USE_DROPDOWN - #else - #define LV_USE_DROPDOWN 0 - #endif - #else - #define LV_USE_DROPDOWN 1 /**< Requires: lv_label */ - #endif -#endif - -#ifndef LV_USE_IMAGE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_IMAGE - #define LV_USE_IMAGE CONFIG_LV_USE_IMAGE - #else - #define LV_USE_IMAGE 0 - #endif - #else - #define LV_USE_IMAGE 1 /**< Requires: lv_label */ - #endif -#endif - -#ifndef LV_USE_IMAGEBUTTON - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_IMAGEBUTTON - #define LV_USE_IMAGEBUTTON CONFIG_LV_USE_IMAGEBUTTON - #else - #define LV_USE_IMAGEBUTTON 0 - #endif - #else - #define LV_USE_IMAGEBUTTON 1 - #endif -#endif - -#ifndef LV_USE_KEYBOARD - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_KEYBOARD - #define LV_USE_KEYBOARD CONFIG_LV_USE_KEYBOARD - #else - #define LV_USE_KEYBOARD 0 - #endif - #else - #define LV_USE_KEYBOARD 1 - #endif -#endif - -#ifndef LV_USE_LABEL - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_LABEL - #define LV_USE_LABEL CONFIG_LV_USE_LABEL - #else - #define LV_USE_LABEL 0 - #endif - #else - #define LV_USE_LABEL 1 - #endif -#endif -#if LV_USE_LABEL - #ifndef LV_LABEL_TEXT_SELECTION - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LABEL_TEXT_SELECTION - #define LV_LABEL_TEXT_SELECTION CONFIG_LV_LABEL_TEXT_SELECTION - #else - #define LV_LABEL_TEXT_SELECTION 0 - #endif - #else - #define LV_LABEL_TEXT_SELECTION 1 /**< Enable selecting text of the label */ - #endif - #endif - #ifndef LV_LABEL_LONG_TXT_HINT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LABEL_LONG_TXT_HINT - #define LV_LABEL_LONG_TXT_HINT CONFIG_LV_LABEL_LONG_TXT_HINT - #else - #define LV_LABEL_LONG_TXT_HINT 0 - #endif - #else - #define LV_LABEL_LONG_TXT_HINT 1 /**< Store some extra info in labels to speed up drawing of very long text */ - #endif - #endif - #ifndef LV_LABEL_WAIT_CHAR_COUNT - #ifdef CONFIG_LV_LABEL_WAIT_CHAR_COUNT - #define LV_LABEL_WAIT_CHAR_COUNT CONFIG_LV_LABEL_WAIT_CHAR_COUNT - #else - #define LV_LABEL_WAIT_CHAR_COUNT 3 /**< The count of wait chart */ - #endif - #endif -#endif - -#ifndef LV_USE_LED - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_LED - #define LV_USE_LED CONFIG_LV_USE_LED - #else - #define LV_USE_LED 0 - #endif - #else - #define LV_USE_LED 1 - #endif -#endif - -#ifndef LV_USE_LINE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_LINE - #define LV_USE_LINE CONFIG_LV_USE_LINE - #else - #define LV_USE_LINE 0 - #endif - #else - #define LV_USE_LINE 1 - #endif -#endif - -#ifndef LV_USE_LIST - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_LIST - #define LV_USE_LIST CONFIG_LV_USE_LIST - #else - #define LV_USE_LIST 0 - #endif - #else - #define LV_USE_LIST 1 - #endif -#endif - -#ifndef LV_USE_LOTTIE - #ifdef CONFIG_LV_USE_LOTTIE - #define LV_USE_LOTTIE CONFIG_LV_USE_LOTTIE - #else - #define LV_USE_LOTTIE 0 /**< Requires: lv_canvas, thorvg */ - #endif -#endif - -#ifndef LV_USE_MENU - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_MENU - #define LV_USE_MENU CONFIG_LV_USE_MENU - #else - #define LV_USE_MENU 0 - #endif - #else - #define LV_USE_MENU 1 - #endif -#endif - -#ifndef LV_USE_MSGBOX - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_MSGBOX - #define LV_USE_MSGBOX CONFIG_LV_USE_MSGBOX - #else - #define LV_USE_MSGBOX 0 - #endif - #else - #define LV_USE_MSGBOX 1 - #endif -#endif - -#ifndef LV_USE_ROLLER - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_ROLLER - #define LV_USE_ROLLER CONFIG_LV_USE_ROLLER - #else - #define LV_USE_ROLLER 0 - #endif - #else - #define LV_USE_ROLLER 1 /**< Requires: lv_label */ - #endif -#endif - -#ifndef LV_USE_SCALE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_SCALE - #define LV_USE_SCALE CONFIG_LV_USE_SCALE - #else - #define LV_USE_SCALE 0 - #endif - #else - #define LV_USE_SCALE 1 - #endif -#endif - -#ifndef LV_USE_SLIDER - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_SLIDER - #define LV_USE_SLIDER CONFIG_LV_USE_SLIDER - #else - #define LV_USE_SLIDER 0 - #endif - #else - #define LV_USE_SLIDER 1 /**< Requires: lv_bar */ - #endif -#endif - -#ifndef LV_USE_SPAN - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_SPAN - #define LV_USE_SPAN CONFIG_LV_USE_SPAN - #else - #define LV_USE_SPAN 0 - #endif - #else - #define LV_USE_SPAN 1 - #endif -#endif -#if LV_USE_SPAN - /** A line of text can contain this maximum number of span descriptors. */ - #ifndef LV_SPAN_SNIPPET_STACK_SIZE - #ifdef CONFIG_LV_SPAN_SNIPPET_STACK_SIZE - #define LV_SPAN_SNIPPET_STACK_SIZE CONFIG_LV_SPAN_SNIPPET_STACK_SIZE - #else - #define LV_SPAN_SNIPPET_STACK_SIZE 64 - #endif - #endif -#endif - -#ifndef LV_USE_SPINBOX - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_SPINBOX - #define LV_USE_SPINBOX CONFIG_LV_USE_SPINBOX - #else - #define LV_USE_SPINBOX 0 - #endif - #else - #define LV_USE_SPINBOX 1 - #endif -#endif - -#ifndef LV_USE_SPINNER - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_SPINNER - #define LV_USE_SPINNER CONFIG_LV_USE_SPINNER - #else - #define LV_USE_SPINNER 0 - #endif - #else - #define LV_USE_SPINNER 1 - #endif -#endif - -#ifndef LV_USE_SWITCH - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_SWITCH - #define LV_USE_SWITCH CONFIG_LV_USE_SWITCH - #else - #define LV_USE_SWITCH 0 - #endif - #else - #define LV_USE_SWITCH 1 - #endif -#endif - -#ifndef LV_USE_TABLE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_TABLE - #define LV_USE_TABLE CONFIG_LV_USE_TABLE - #else - #define LV_USE_TABLE 0 - #endif - #else - #define LV_USE_TABLE 1 - #endif -#endif - -#ifndef LV_USE_TABVIEW - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_TABVIEW - #define LV_USE_TABVIEW CONFIG_LV_USE_TABVIEW - #else - #define LV_USE_TABVIEW 0 - #endif - #else - #define LV_USE_TABVIEW 1 - #endif -#endif - -#ifndef LV_USE_TEXTAREA - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_TEXTAREA - #define LV_USE_TEXTAREA CONFIG_LV_USE_TEXTAREA - #else - #define LV_USE_TEXTAREA 0 - #endif - #else - #define LV_USE_TEXTAREA 1 /**< Requires: lv_label */ - #endif -#endif -#if LV_USE_TEXTAREA != 0 - #ifndef LV_TEXTAREA_DEF_PWD_SHOW_TIME - #ifdef CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME - #define LV_TEXTAREA_DEF_PWD_SHOW_TIME CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME - #else - #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /**< [ms] */ - #endif - #endif -#endif - -#ifndef LV_USE_TILEVIEW - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_TILEVIEW - #define LV_USE_TILEVIEW CONFIG_LV_USE_TILEVIEW - #else - #define LV_USE_TILEVIEW 0 - #endif - #else - #define LV_USE_TILEVIEW 1 - #endif -#endif - -#ifndef LV_USE_WIN - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_WIN - #define LV_USE_WIN CONFIG_LV_USE_WIN - #else - #define LV_USE_WIN 0 - #endif - #else - #define LV_USE_WIN 1 - #endif -#endif - -#ifndef LV_USE_3DTEXTURE - #ifdef CONFIG_LV_USE_3DTEXTURE - #define LV_USE_3DTEXTURE CONFIG_LV_USE_3DTEXTURE - #else - #define LV_USE_3DTEXTURE 0 - #endif -#endif - -/*================== - * THEMES - *==================*/ -/* Documentation for themes can be found here: https://docs.lvgl.io/master/common-widget-features/styles/styles.html#themes . */ - -/** A simple, impressive and very complete theme */ -#ifndef LV_USE_THEME_DEFAULT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_THEME_DEFAULT - #define LV_USE_THEME_DEFAULT CONFIG_LV_USE_THEME_DEFAULT - #else - #define LV_USE_THEME_DEFAULT 0 - #endif - #else - #define LV_USE_THEME_DEFAULT 1 - #endif -#endif -#if LV_USE_THEME_DEFAULT - /** 0: Light mode; 1: Dark mode */ - #ifndef LV_THEME_DEFAULT_DARK - #ifdef CONFIG_LV_THEME_DEFAULT_DARK - #define LV_THEME_DEFAULT_DARK CONFIG_LV_THEME_DEFAULT_DARK - #else - #define LV_THEME_DEFAULT_DARK 0 - #endif - #endif - - /** 1: Enable grow on press */ - #ifndef LV_THEME_DEFAULT_GROW - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_THEME_DEFAULT_GROW - #define LV_THEME_DEFAULT_GROW CONFIG_LV_THEME_DEFAULT_GROW - #else - #define LV_THEME_DEFAULT_GROW 0 - #endif - #else - #define LV_THEME_DEFAULT_GROW 1 - #endif - #endif - - /** Default transition time in ms. */ - #ifndef LV_THEME_DEFAULT_TRANSITION_TIME - #ifdef CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME - #define LV_THEME_DEFAULT_TRANSITION_TIME CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME - #else - #define LV_THEME_DEFAULT_TRANSITION_TIME 80 - #endif - #endif -#endif /*LV_USE_THEME_DEFAULT*/ - -/** A very simple theme that is a good starting point for a custom theme */ -#ifndef LV_USE_THEME_SIMPLE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_THEME_SIMPLE - #define LV_USE_THEME_SIMPLE CONFIG_LV_USE_THEME_SIMPLE - #else - #define LV_USE_THEME_SIMPLE 0 - #endif - #else - #define LV_USE_THEME_SIMPLE 1 - #endif -#endif - -/** A theme designed for monochrome displays */ -#ifndef LV_USE_THEME_MONO - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_THEME_MONO - #define LV_USE_THEME_MONO CONFIG_LV_USE_THEME_MONO - #else - #define LV_USE_THEME_MONO 0 - #endif - #else - #define LV_USE_THEME_MONO 1 - #endif -#endif - -/*================== - * LAYOUTS - *==================*/ -/* Documentation for layouts can be found here: https://docs.lvgl.io/master/common-widget-features/layouts/index.html . */ - -/** A layout similar to Flexbox in CSS. */ -#ifndef LV_USE_FLEX - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_FLEX - #define LV_USE_FLEX CONFIG_LV_USE_FLEX - #else - #define LV_USE_FLEX 0 - #endif - #else - #define LV_USE_FLEX 1 - #endif -#endif - -/** A layout similar to Grid in CSS. */ -#ifndef LV_USE_GRID - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_GRID - #define LV_USE_GRID CONFIG_LV_USE_GRID - #else - #define LV_USE_GRID 0 - #endif - #else - #define LV_USE_GRID 1 - #endif -#endif - -/*==================== - * 3RD PARTS LIBRARIES - *====================*/ -/* Documentation for libraries can be found here: https://docs.lvgl.io/master/libs/index.html . */ - -/* File system interfaces for common APIs */ - -/** Setting a default driver letter allows skipping the driver prefix in filepaths. - * Documentation about how to use the below driver-identifier letters can be found at - * https://docs.lvgl.io/master/main-modules/fs.html#lv-fs-identifier-letters . */ -#ifndef LV_FS_DEFAULT_DRIVER_LETTER - #ifdef CONFIG_LV_FS_DEFAULT_DRIVER_LETTER - #define LV_FS_DEFAULT_DRIVER_LETTER CONFIG_LV_FS_DEFAULT_DRIVER_LETTER - #else - #define LV_FS_DEFAULT_DRIVER_LETTER '\0' - #endif -#endif - -/** API for fopen, fread, etc. */ -#ifndef LV_USE_FS_STDIO - #ifdef CONFIG_LV_USE_FS_STDIO - #define LV_USE_FS_STDIO CONFIG_LV_USE_FS_STDIO - #else - #define LV_USE_FS_STDIO 0 - #endif -#endif -#if LV_USE_FS_STDIO - #ifndef LV_FS_STDIO_LETTER - #ifdef CONFIG_LV_FS_STDIO_LETTER - #define LV_FS_STDIO_LETTER CONFIG_LV_FS_STDIO_LETTER - #else - #define LV_FS_STDIO_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ - #endif - #endif - #ifndef LV_FS_STDIO_PATH - #ifdef CONFIG_LV_FS_STDIO_PATH - #define LV_FS_STDIO_PATH CONFIG_LV_FS_STDIO_PATH - #else - #define LV_FS_STDIO_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ - #endif - #endif - #ifndef LV_FS_STDIO_CACHE_SIZE - #ifdef CONFIG_LV_FS_STDIO_CACHE_SIZE - #define LV_FS_STDIO_CACHE_SIZE CONFIG_LV_FS_STDIO_CACHE_SIZE - #else - #define LV_FS_STDIO_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ - #endif - #endif -#endif - -/** API for open, read, etc. */ -#ifndef LV_USE_FS_POSIX - #ifdef CONFIG_LV_USE_FS_POSIX - #define LV_USE_FS_POSIX CONFIG_LV_USE_FS_POSIX - #else - #define LV_USE_FS_POSIX 0 - #endif -#endif -#if LV_USE_FS_POSIX - #ifndef LV_FS_POSIX_LETTER - #ifdef CONFIG_LV_FS_POSIX_LETTER - #define LV_FS_POSIX_LETTER CONFIG_LV_FS_POSIX_LETTER - #else - #define LV_FS_POSIX_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ - #endif - #endif - #ifndef LV_FS_POSIX_PATH - #ifdef CONFIG_LV_FS_POSIX_PATH - #define LV_FS_POSIX_PATH CONFIG_LV_FS_POSIX_PATH - #else - #define LV_FS_POSIX_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ - #endif - #endif - #ifndef LV_FS_POSIX_CACHE_SIZE - #ifdef CONFIG_LV_FS_POSIX_CACHE_SIZE - #define LV_FS_POSIX_CACHE_SIZE CONFIG_LV_FS_POSIX_CACHE_SIZE - #else - #define LV_FS_POSIX_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ - #endif - #endif -#endif - -/** API for CreateFile, ReadFile, etc. */ -#ifndef LV_USE_FS_WIN32 - #ifdef CONFIG_LV_USE_FS_WIN32 - #define LV_USE_FS_WIN32 CONFIG_LV_USE_FS_WIN32 - #else - #define LV_USE_FS_WIN32 0 - #endif -#endif -#if LV_USE_FS_WIN32 - #ifndef LV_FS_WIN32_LETTER - #ifdef CONFIG_LV_FS_WIN32_LETTER - #define LV_FS_WIN32_LETTER CONFIG_LV_FS_WIN32_LETTER - #else - #define LV_FS_WIN32_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ - #endif - #endif - #ifndef LV_FS_WIN32_PATH - #ifdef CONFIG_LV_FS_WIN32_PATH - #define LV_FS_WIN32_PATH CONFIG_LV_FS_WIN32_PATH - #else - #define LV_FS_WIN32_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ - #endif - #endif - #ifndef LV_FS_WIN32_CACHE_SIZE - #ifdef CONFIG_LV_FS_WIN32_CACHE_SIZE - #define LV_FS_WIN32_CACHE_SIZE CONFIG_LV_FS_WIN32_CACHE_SIZE - #else - #define LV_FS_WIN32_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ - #endif - #endif -#endif - -/** API for FATFS (needs to be added separately). Uses f_open, f_read, etc. */ -#ifndef LV_USE_FS_FATFS - #ifdef CONFIG_LV_USE_FS_FATFS - #define LV_USE_FS_FATFS CONFIG_LV_USE_FS_FATFS - #else - #define LV_USE_FS_FATFS 0 - #endif -#endif -#if LV_USE_FS_FATFS - #ifndef LV_FS_FATFS_LETTER - #ifdef CONFIG_LV_FS_FATFS_LETTER - #define LV_FS_FATFS_LETTER CONFIG_LV_FS_FATFS_LETTER - #else - #define LV_FS_FATFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ - #endif - #endif - #ifndef LV_FS_FATFS_PATH - #ifdef CONFIG_LV_FS_FATFS_PATH - #define LV_FS_FATFS_PATH CONFIG_LV_FS_FATFS_PATH - #else - #define LV_FS_FATFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ - #endif - #endif - #ifndef LV_FS_FATFS_CACHE_SIZE - #ifdef CONFIG_LV_FS_FATFS_CACHE_SIZE - #define LV_FS_FATFS_CACHE_SIZE CONFIG_LV_FS_FATFS_CACHE_SIZE - #else - #define LV_FS_FATFS_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ - #endif - #endif -#endif - -/** API for memory-mapped file access. */ -#ifndef LV_USE_FS_MEMFS - #ifdef CONFIG_LV_USE_FS_MEMFS - #define LV_USE_FS_MEMFS CONFIG_LV_USE_FS_MEMFS - #else - #define LV_USE_FS_MEMFS 0 - #endif -#endif -#if LV_USE_FS_MEMFS - #ifndef LV_FS_MEMFS_LETTER - #ifdef CONFIG_LV_FS_MEMFS_LETTER - #define LV_FS_MEMFS_LETTER CONFIG_LV_FS_MEMFS_LETTER - #else - #define LV_FS_MEMFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ - #endif - #endif -#endif - -/** API for LittleFs. */ -#ifndef LV_USE_FS_LITTLEFS - #ifdef CONFIG_LV_USE_FS_LITTLEFS - #define LV_USE_FS_LITTLEFS CONFIG_LV_USE_FS_LITTLEFS - #else - #define LV_USE_FS_LITTLEFS 0 - #endif -#endif -#if LV_USE_FS_LITTLEFS - #ifndef LV_FS_LITTLEFS_LETTER - #ifdef CONFIG_LV_FS_LITTLEFS_LETTER - #define LV_FS_LITTLEFS_LETTER CONFIG_LV_FS_LITTLEFS_LETTER - #else - #define LV_FS_LITTLEFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ - #endif - #endif - #ifndef LV_FS_LITTLEFS_PATH - #ifdef CONFIG_LV_FS_LITTLEFS_PATH - #define LV_FS_LITTLEFS_PATH CONFIG_LV_FS_LITTLEFS_PATH - #else - #define LV_FS_LITTLEFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ - #endif - #endif -#endif - -/** API for Arduino LittleFs. */ -#ifndef LV_USE_FS_ARDUINO_ESP_LITTLEFS - #ifdef CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS - #define LV_USE_FS_ARDUINO_ESP_LITTLEFS CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS - #else - #define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0 - #endif -#endif -#if LV_USE_FS_ARDUINO_ESP_LITTLEFS - #ifndef LV_FS_ARDUINO_ESP_LITTLEFS_LETTER - #ifdef CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_LETTER - #define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_LETTER - #else - #define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ - #endif - #endif - #ifndef LV_FS_ARDUINO_ESP_LITTLEFS_PATH - #ifdef CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_PATH - #define LV_FS_ARDUINO_ESP_LITTLEFS_PATH CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_PATH - #else - #define LV_FS_ARDUINO_ESP_LITTLEFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ - #endif - #endif -#endif - -/** API for Arduino Sd. */ -#ifndef LV_USE_FS_ARDUINO_SD - #ifdef CONFIG_LV_USE_FS_ARDUINO_SD - #define LV_USE_FS_ARDUINO_SD CONFIG_LV_USE_FS_ARDUINO_SD - #else - #define LV_USE_FS_ARDUINO_SD 0 - #endif -#endif -#if LV_USE_FS_ARDUINO_SD - #ifndef LV_FS_ARDUINO_SD_LETTER - #ifdef CONFIG_LV_FS_ARDUINO_SD_LETTER - #define LV_FS_ARDUINO_SD_LETTER CONFIG_LV_FS_ARDUINO_SD_LETTER - #else - #define LV_FS_ARDUINO_SD_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ - #endif - #endif - #ifndef LV_FS_ARDUINO_SD_PATH - #ifdef CONFIG_LV_FS_ARDUINO_SD_PATH - #define LV_FS_ARDUINO_SD_PATH CONFIG_LV_FS_ARDUINO_SD_PATH - #else - #define LV_FS_ARDUINO_SD_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ - #endif - #endif -#endif - -/** API for UEFI */ -#ifndef LV_USE_FS_UEFI - #ifdef CONFIG_LV_USE_FS_UEFI - #define LV_USE_FS_UEFI CONFIG_LV_USE_FS_UEFI - #else - #define LV_USE_FS_UEFI 0 - #endif -#endif -#if LV_USE_FS_UEFI - #ifndef LV_FS_UEFI_LETTER - #ifdef CONFIG_LV_FS_UEFI_LETTER - #define LV_FS_UEFI_LETTER CONFIG_LV_FS_UEFI_LETTER - #else - #define LV_FS_UEFI_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ - #endif - #endif -#endif - -#ifndef LV_USE_FS_FROGFS - #ifdef CONFIG_LV_USE_FS_FROGFS - #define LV_USE_FS_FROGFS CONFIG_LV_USE_FS_FROGFS - #else - #define LV_USE_FS_FROGFS 0 - #endif -#endif -#if LV_USE_FS_FROGFS - #ifndef LV_FS_FROGFS_LETTER - #ifdef CONFIG_LV_FS_FROGFS_LETTER - #define LV_FS_FROGFS_LETTER CONFIG_LV_FS_FROGFS_LETTER - #else - #define LV_FS_FROGFS_LETTER '\0' - #endif - #endif -#endif - -/** LODEPNG decoder library */ -#ifndef LV_USE_LODEPNG - #ifdef CONFIG_LV_USE_LODEPNG - #define LV_USE_LODEPNG CONFIG_LV_USE_LODEPNG - #else - #define LV_USE_LODEPNG 0 - #endif -#endif - -/** PNG decoder(libpng) library */ -#ifndef LV_USE_LIBPNG - #ifdef CONFIG_LV_USE_LIBPNG - #define LV_USE_LIBPNG CONFIG_LV_USE_LIBPNG - #else - #define LV_USE_LIBPNG 0 - #endif -#endif - -/** BMP decoder library */ -#ifndef LV_USE_BMP - #ifdef CONFIG_LV_USE_BMP - #define LV_USE_BMP CONFIG_LV_USE_BMP - #else - #define LV_USE_BMP 0 - #endif -#endif - -/** JPG + split JPG decoder library. - * Split JPG is a custom format optimized for embedded systems. */ -#ifndef LV_USE_TJPGD - #ifdef CONFIG_LV_USE_TJPGD - #define LV_USE_TJPGD CONFIG_LV_USE_TJPGD - #else - #define LV_USE_TJPGD 0 - #endif -#endif - -/** libjpeg-turbo decoder library. - * - Supports complete JPEG specifications and high-performance JPEG decoding. */ -#ifndef LV_USE_LIBJPEG_TURBO - #ifdef CONFIG_LV_USE_LIBJPEG_TURBO - #define LV_USE_LIBJPEG_TURBO CONFIG_LV_USE_LIBJPEG_TURBO - #else - #define LV_USE_LIBJPEG_TURBO 0 - #endif -#endif - -/** WebP decoder library */ -#ifndef LV_USE_LIBWEBP - #ifdef CONFIG_LV_USE_LIBWEBP - #define LV_USE_LIBWEBP CONFIG_LV_USE_LIBWEBP - #else - #define LV_USE_LIBWEBP 0 - #endif -#endif - -/** GIF decoder library */ -#ifndef LV_USE_GIF - #ifdef CONFIG_LV_USE_GIF - #define LV_USE_GIF CONFIG_LV_USE_GIF - #else - #define LV_USE_GIF 0 - #endif -#endif -#if LV_USE_GIF - /** GIF decoder accelerate */ - #ifndef LV_GIF_CACHE_DECODE_DATA - #ifdef CONFIG_LV_GIF_CACHE_DECODE_DATA - #define LV_GIF_CACHE_DECODE_DATA CONFIG_LV_GIF_CACHE_DECODE_DATA - #else - #define LV_GIF_CACHE_DECODE_DATA 0 - #endif - #endif -#endif - -/** GStreamer library */ -#ifndef LV_USE_GSTREAMER - #ifdef CONFIG_LV_USE_GSTREAMER - #define LV_USE_GSTREAMER CONFIG_LV_USE_GSTREAMER - #else - #define LV_USE_GSTREAMER 0 - #endif -#endif - -/** Decode bin images to RAM */ -#ifndef LV_BIN_DECODER_RAM_LOAD - #ifdef CONFIG_LV_BIN_DECODER_RAM_LOAD - #define LV_BIN_DECODER_RAM_LOAD CONFIG_LV_BIN_DECODER_RAM_LOAD - #else - #define LV_BIN_DECODER_RAM_LOAD 0 - #endif -#endif - -/** RLE decompress library */ -#ifndef LV_USE_RLE - #ifdef CONFIG_LV_USE_RLE - #define LV_USE_RLE CONFIG_LV_USE_RLE - #else - #define LV_USE_RLE 0 - #endif -#endif - -/** QR code library */ -#ifndef LV_USE_QRCODE - #ifdef CONFIG_LV_USE_QRCODE - #define LV_USE_QRCODE CONFIG_LV_USE_QRCODE - #else - #define LV_USE_QRCODE 0 - #endif -#endif - -/** Barcode code library */ -#ifndef LV_USE_BARCODE - #ifdef CONFIG_LV_USE_BARCODE - #define LV_USE_BARCODE CONFIG_LV_USE_BARCODE - #else - #define LV_USE_BARCODE 0 - #endif -#endif - -/** FreeType library */ -#ifndef LV_USE_FREETYPE - #ifdef CONFIG_LV_USE_FREETYPE - #define LV_USE_FREETYPE CONFIG_LV_USE_FREETYPE - #else - #define LV_USE_FREETYPE 0 - #endif -#endif -#if LV_USE_FREETYPE - /** Let FreeType use LVGL memory and file porting */ - #ifndef LV_FREETYPE_USE_LVGL_PORT - #ifdef CONFIG_LV_FREETYPE_USE_LVGL_PORT - #define LV_FREETYPE_USE_LVGL_PORT CONFIG_LV_FREETYPE_USE_LVGL_PORT - #else - #define LV_FREETYPE_USE_LVGL_PORT 0 - #endif - #endif - - /** Cache count of glyphs in FreeType, i.e. number of glyphs that can be cached. - * The higher the value, the more memory will be used. */ - #ifndef LV_FREETYPE_CACHE_FT_GLYPH_CNT - #ifdef CONFIG_LV_FREETYPE_CACHE_FT_GLYPH_CNT - #define LV_FREETYPE_CACHE_FT_GLYPH_CNT CONFIG_LV_FREETYPE_CACHE_FT_GLYPH_CNT - #else - #define LV_FREETYPE_CACHE_FT_GLYPH_CNT 256 - #endif - #endif - - /** Enable L1 glyph metrics cache for FreeType. - * A per-font, lock-free, 2-way set-associative cache that accelerates - * repeated glyph metric lookups. Automatically disabled when an OS is - * configured (LV_USE_OS != LV_OS_NONE) because the cache is not - * thread-safe. */ - #ifndef LV_FREETYPE_CACHE_FT_GLYPH_L1 - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_FREETYPE_CACHE_FT_GLYPH_L1 - #define LV_FREETYPE_CACHE_FT_GLYPH_L1 CONFIG_LV_FREETYPE_CACHE_FT_GLYPH_L1 - #else - #define LV_FREETYPE_CACHE_FT_GLYPH_L1 0 - #endif - #else - #define LV_FREETYPE_CACHE_FT_GLYPH_L1 1 - #endif - #endif -#endif - -/** Built-in TTF decoder */ -#ifndef LV_USE_TINY_TTF - #ifdef CONFIG_LV_USE_TINY_TTF - #define LV_USE_TINY_TTF CONFIG_LV_USE_TINY_TTF - #else - #define LV_USE_TINY_TTF 0 - #endif -#endif -#if LV_USE_TINY_TTF - /* Enable loading TTF data from files */ - #ifndef LV_TINY_TTF_FILE_SUPPORT - #ifdef CONFIG_LV_TINY_TTF_FILE_SUPPORT - #define LV_TINY_TTF_FILE_SUPPORT CONFIG_LV_TINY_TTF_FILE_SUPPORT - #else - #define LV_TINY_TTF_FILE_SUPPORT 0 - #endif - #endif - #ifndef LV_TINY_TTF_CACHE_GLYPH_CNT - #ifdef CONFIG_LV_TINY_TTF_CACHE_GLYPH_CNT - #define LV_TINY_TTF_CACHE_GLYPH_CNT CONFIG_LV_TINY_TTF_CACHE_GLYPH_CNT - #else - #define LV_TINY_TTF_CACHE_GLYPH_CNT 128 - #endif - #endif - #ifndef LV_TINY_TTF_CACHE_KERNING_CNT - #ifdef CONFIG_LV_TINY_TTF_CACHE_KERNING_CNT - #define LV_TINY_TTF_CACHE_KERNING_CNT CONFIG_LV_TINY_TTF_CACHE_KERNING_CNT - #else - #define LV_TINY_TTF_CACHE_KERNING_CNT 256 - #endif - #endif -#endif - -/** Rlottie library */ -#ifndef LV_USE_RLOTTIE - #ifdef CONFIG_LV_USE_RLOTTIE - #define LV_USE_RLOTTIE CONFIG_LV_USE_RLOTTIE - #else - #define LV_USE_RLOTTIE 0 - #endif -#endif - -/** Requires `LV_USE_3DTEXTURE = 1` */ -#ifndef LV_USE_GLTF - #ifdef CONFIG_LV_USE_GLTF - #define LV_USE_GLTF CONFIG_LV_USE_GLTF - #else - #define LV_USE_GLTF 0 - #endif -#endif - -/** Enable Vector Graphic APIs - * Requires `LV_USE_MATRIX = 1` - * and a rendering engine supporting vector graphics, e.g. - * (LV_USE_DRAW_SW and LV_USE_THORVG) or LV_USE_DRAW_VG_LITE or LV_USE_NEMA_VG. */ -#ifndef LV_USE_VECTOR_GRAPHIC - #ifdef CONFIG_LV_USE_VECTOR_GRAPHIC - #define LV_USE_VECTOR_GRAPHIC CONFIG_LV_USE_VECTOR_GRAPHIC - #else - #define LV_USE_VECTOR_GRAPHIC 0 - #endif -#endif - -/** Enable ThorVG (vector graphics library) from the src/libs folder. - * Requires LV_USE_VECTOR_GRAPHIC */ -#ifndef LV_USE_THORVG_INTERNAL - #ifdef CONFIG_LV_USE_THORVG_INTERNAL - #define LV_USE_THORVG_INTERNAL CONFIG_LV_USE_THORVG_INTERNAL - #else - #define LV_USE_THORVG_INTERNAL 0 - #endif -#endif - -/** Enable ThorVG by assuming that its installed and linked to the project - * Requires LV_USE_VECTOR_GRAPHIC */ -#ifndef LV_USE_THORVG_EXTERNAL - #ifdef CONFIG_LV_USE_THORVG_EXTERNAL - #define LV_USE_THORVG_EXTERNAL CONFIG_LV_USE_THORVG_EXTERNAL - #else - #define LV_USE_THORVG_EXTERNAL 0 - #endif -#endif - -/** Enable NanoVG (vector graphics library) */ -#ifndef LV_USE_NANOVG - #ifdef CONFIG_LV_USE_NANOVG - #define LV_USE_NANOVG CONFIG_LV_USE_NANOVG - #else - #define LV_USE_NANOVG 0 - #endif -#endif - -/** Use lvgl built-in LZ4 lib */ -#ifndef LV_USE_LZ4_INTERNAL - #ifdef CONFIG_LV_USE_LZ4_INTERNAL - #define LV_USE_LZ4_INTERNAL CONFIG_LV_USE_LZ4_INTERNAL - #else - #define LV_USE_LZ4_INTERNAL 0 - #endif -#endif - -/** Use external LZ4 library */ -#ifndef LV_USE_LZ4_EXTERNAL - #ifdef CONFIG_LV_USE_LZ4_EXTERNAL - #define LV_USE_LZ4_EXTERNAL CONFIG_LV_USE_LZ4_EXTERNAL - #else - #define LV_USE_LZ4_EXTERNAL 0 - #endif -#endif - -/*SVG library - * - Requires `LV_USE_VECTOR_GRAPHIC = 1` */ -#ifndef LV_USE_SVG - #ifdef CONFIG_LV_USE_SVG - #define LV_USE_SVG CONFIG_LV_USE_SVG - #else - #define LV_USE_SVG 0 - #endif -#endif -#ifndef LV_USE_SVG_ANIMATION - #ifdef CONFIG_LV_USE_SVG_ANIMATION - #define LV_USE_SVG_ANIMATION CONFIG_LV_USE_SVG_ANIMATION - #else - #define LV_USE_SVG_ANIMATION 0 - #endif -#endif -#ifndef LV_USE_SVG_DEBUG - #ifdef CONFIG_LV_USE_SVG_DEBUG - #define LV_USE_SVG_DEBUG CONFIG_LV_USE_SVG_DEBUG - #else - #define LV_USE_SVG_DEBUG 0 - #endif -#endif - -/** FFmpeg library for image decoding and playing videos. - * Supports all major image formats so do not enable other image decoder with it. */ -#ifndef LV_USE_FFMPEG - #ifdef CONFIG_LV_USE_FFMPEG - #define LV_USE_FFMPEG CONFIG_LV_USE_FFMPEG - #else - #define LV_USE_FFMPEG 0 - #endif -#endif -#if LV_USE_FFMPEG - /** Dump input information to stderr */ - #ifndef LV_FFMPEG_DUMP_FORMAT - #ifdef CONFIG_LV_FFMPEG_DUMP_FORMAT - #define LV_FFMPEG_DUMP_FORMAT CONFIG_LV_FFMPEG_DUMP_FORMAT - #else - #define LV_FFMPEG_DUMP_FORMAT 0 - #endif - #endif - /** Use lvgl file path in FFmpeg Player widget - * You won't be able to open URLs after enabling this feature. - * Note that FFmpeg image decoder will always use lvgl file system. */ - #ifndef LV_FFMPEG_PLAYER_USE_LV_FS - #ifdef CONFIG_LV_FFMPEG_PLAYER_USE_LV_FS - #define LV_FFMPEG_PLAYER_USE_LV_FS CONFIG_LV_FFMPEG_PLAYER_USE_LV_FS - #else - #define LV_FFMPEG_PLAYER_USE_LV_FS 0 - #endif - #endif -#endif - -/*================== - * OTHERS - *==================*/ -/* Documentation for several of the below items can be found here: https://docs.lvgl.io/master/auxiliary-modules/index.html . */ - -/** 1: Enable API to take snapshot for object */ -#ifndef LV_USE_SNAPSHOT - #ifdef CONFIG_LV_USE_SNAPSHOT - #define LV_USE_SNAPSHOT CONFIG_LV_USE_SNAPSHOT - #else - #define LV_USE_SNAPSHOT 0 - #endif -#endif - -/** 1: Enable system monitor component */ -#ifndef LV_USE_SYSMON - #ifdef CONFIG_LV_USE_SYSMON - #define LV_USE_SYSMON CONFIG_LV_USE_SYSMON - #else - #define LV_USE_SYSMON 0 - #endif -#endif -#if LV_USE_SYSMON - /** Get the idle percentage. E.g. uint32_t my_get_idle(void); */ - #ifndef LV_SYSMON_GET_IDLE - #ifdef CONFIG_LV_SYSMON_GET_IDLE - #define LV_SYSMON_GET_IDLE CONFIG_LV_SYSMON_GET_IDLE - #else - #define LV_SYSMON_GET_IDLE lv_os_get_idle_percent - #endif - #endif - /** 1: Enable usage of lv_os_get_proc_idle_percent.*/ - #ifndef LV_SYSMON_PROC_IDLE_AVAILABLE - #ifdef CONFIG_LV_SYSMON_PROC_IDLE_AVAILABLE - #define LV_SYSMON_PROC_IDLE_AVAILABLE CONFIG_LV_SYSMON_PROC_IDLE_AVAILABLE - #else - #define LV_SYSMON_PROC_IDLE_AVAILABLE 0 - #endif - #endif - #if LV_SYSMON_PROC_IDLE_AVAILABLE - /** Get the applications idle percentage. - * - Requires `LV_USE_OS == LV_OS_PTHREAD` */ - #ifndef LV_SYSMON_GET_PROC_IDLE - #ifdef CONFIG_LV_SYSMON_GET_PROC_IDLE - #define LV_SYSMON_GET_PROC_IDLE CONFIG_LV_SYSMON_GET_PROC_IDLE - #else - #define LV_SYSMON_GET_PROC_IDLE lv_os_get_proc_idle_percent - #endif - #endif - #endif - - /** 1: Show CPU usage and FPS count. - * - Requires `LV_USE_SYSMON = 1` */ - #ifndef LV_USE_PERF_MONITOR - #ifdef CONFIG_LV_USE_PERF_MONITOR - #define LV_USE_PERF_MONITOR CONFIG_LV_USE_PERF_MONITOR - #else - #define LV_USE_PERF_MONITOR 0 - #endif - #endif - #if LV_USE_PERF_MONITOR - #ifndef LV_USE_PERF_MONITOR_POS - #ifdef CONFIG_LV_USE_PERF_MONITOR_POS - #define LV_USE_PERF_MONITOR_POS CONFIG_LV_USE_PERF_MONITOR_POS - #else - #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT - #endif - #endif - - /** 0: Displays performance data on the screen; 1: Prints performance data using log. */ - #ifndef LV_USE_PERF_MONITOR_LOG_MODE - #ifdef CONFIG_LV_USE_PERF_MONITOR_LOG_MODE - #define LV_USE_PERF_MONITOR_LOG_MODE CONFIG_LV_USE_PERF_MONITOR_LOG_MODE - #else - #define LV_USE_PERF_MONITOR_LOG_MODE 0 - #endif - #endif - #endif - - /** 1: Show used memory and memory fragmentation. - * - Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` - * - Requires `LV_USE_SYSMON = 1`*/ - #ifndef LV_USE_MEM_MONITOR - #ifdef CONFIG_LV_USE_MEM_MONITOR - #define LV_USE_MEM_MONITOR CONFIG_LV_USE_MEM_MONITOR - #else - #define LV_USE_MEM_MONITOR 0 - #endif - #endif - #if LV_USE_MEM_MONITOR - #ifndef LV_USE_MEM_MONITOR_POS - #ifdef CONFIG_LV_USE_MEM_MONITOR_POS - #define LV_USE_MEM_MONITOR_POS CONFIG_LV_USE_MEM_MONITOR_POS - #else - #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT - #endif - #endif - #endif -#endif /*LV_USE_SYSMON*/ - -/** 1: Enable runtime performance profiler */ -#ifndef LV_USE_PROFILER - #ifdef CONFIG_LV_USE_PROFILER - #define LV_USE_PROFILER CONFIG_LV_USE_PROFILER - #else - #define LV_USE_PROFILER 0 - #endif -#endif -#if LV_USE_PROFILER - /** 1: Enable the built-in profiler */ - #ifndef LV_USE_PROFILER_BUILTIN - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_PROFILER_BUILTIN - #define LV_USE_PROFILER_BUILTIN CONFIG_LV_USE_PROFILER_BUILTIN - #else - #define LV_USE_PROFILER_BUILTIN 0 - #endif - #else - #define LV_USE_PROFILER_BUILTIN 1 - #endif - #endif - #if LV_USE_PROFILER_BUILTIN - /** Default profiler trace buffer size */ - #ifndef LV_PROFILER_BUILTIN_BUF_SIZE - #ifdef CONFIG_LV_PROFILER_BUILTIN_BUF_SIZE - #define LV_PROFILER_BUILTIN_BUF_SIZE CONFIG_LV_PROFILER_BUILTIN_BUF_SIZE - #else - #define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /**< [bytes] */ - #endif - #endif - #ifndef LV_PROFILER_BUILTIN_DEFAULT_ENABLE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_BUILTIN_DEFAULT_ENABLE - #define LV_PROFILER_BUILTIN_DEFAULT_ENABLE CONFIG_LV_PROFILER_BUILTIN_DEFAULT_ENABLE - #else - #define LV_PROFILER_BUILTIN_DEFAULT_ENABLE 0 - #endif - #else - #define LV_PROFILER_BUILTIN_DEFAULT_ENABLE 1 - #endif - #endif - #ifndef LV_USE_PROFILER_BUILTIN_POSIX - #ifdef CONFIG_LV_USE_PROFILER_BUILTIN_POSIX - #define LV_USE_PROFILER_BUILTIN_POSIX CONFIG_LV_USE_PROFILER_BUILTIN_POSIX - #else - #define LV_USE_PROFILER_BUILTIN_POSIX 0 /**< Enable POSIX profiler port */ - #endif - #endif - #endif - - /** Header to include for profiler */ - #ifndef LV_PROFILER_INCLUDE - #ifdef CONFIG_LV_PROFILER_INCLUDE - #define LV_PROFILER_INCLUDE CONFIG_LV_PROFILER_INCLUDE - #else - #define LV_PROFILER_INCLUDE "lvgl/src/misc/lv_profiler_builtin.h" - #endif - #endif - - /** Profiler start point function */ - #ifndef LV_PROFILER_BEGIN - #ifdef CONFIG_LV_PROFILER_BEGIN - #define LV_PROFILER_BEGIN CONFIG_LV_PROFILER_BEGIN - #else - #define LV_PROFILER_BEGIN LV_PROFILER_BUILTIN_BEGIN - #endif - #endif - - /** Profiler end point function */ - #ifndef LV_PROFILER_END - #ifdef CONFIG_LV_PROFILER_END - #define LV_PROFILER_END CONFIG_LV_PROFILER_END - #else - #define LV_PROFILER_END LV_PROFILER_BUILTIN_END - #endif - #endif - - /** Profiler start point function with custom tag */ - #ifndef LV_PROFILER_BEGIN_TAG - #ifdef CONFIG_LV_PROFILER_BEGIN_TAG - #define LV_PROFILER_BEGIN_TAG CONFIG_LV_PROFILER_BEGIN_TAG - #else - #define LV_PROFILER_BEGIN_TAG LV_PROFILER_BUILTIN_BEGIN_TAG - #endif - #endif - - /** Profiler end point function with custom tag */ - #ifndef LV_PROFILER_END_TAG - #ifdef CONFIG_LV_PROFILER_END_TAG - #define LV_PROFILER_END_TAG CONFIG_LV_PROFILER_END_TAG - #else - #define LV_PROFILER_END_TAG LV_PROFILER_BUILTIN_END_TAG - #endif - #endif - - /*Enable layout profiler*/ - #ifndef LV_PROFILER_LAYOUT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_LAYOUT - #define LV_PROFILER_LAYOUT CONFIG_LV_PROFILER_LAYOUT - #else - #define LV_PROFILER_LAYOUT 0 - #endif - #else - #define LV_PROFILER_LAYOUT 1 - #endif - #endif - - /*Enable disp refr profiler*/ - #ifndef LV_PROFILER_REFR - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_REFR - #define LV_PROFILER_REFR CONFIG_LV_PROFILER_REFR - #else - #define LV_PROFILER_REFR 0 - #endif - #else - #define LV_PROFILER_REFR 1 - #endif - #endif - - /*Enable draw profiler*/ - #ifndef LV_PROFILER_DRAW - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_DRAW - #define LV_PROFILER_DRAW CONFIG_LV_PROFILER_DRAW - #else - #define LV_PROFILER_DRAW 0 - #endif - #else - #define LV_PROFILER_DRAW 1 - #endif - #endif - - /*Enable indev profiler*/ - #ifndef LV_PROFILER_INDEV - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_INDEV - #define LV_PROFILER_INDEV CONFIG_LV_PROFILER_INDEV - #else - #define LV_PROFILER_INDEV 0 - #endif - #else - #define LV_PROFILER_INDEV 1 - #endif - #endif - - /*Enable decoder profiler*/ - #ifndef LV_PROFILER_DECODER - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_DECODER - #define LV_PROFILER_DECODER CONFIG_LV_PROFILER_DECODER - #else - #define LV_PROFILER_DECODER 0 - #endif - #else - #define LV_PROFILER_DECODER 1 - #endif - #endif - - /*Enable font profiler*/ - #ifndef LV_PROFILER_FONT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_FONT - #define LV_PROFILER_FONT CONFIG_LV_PROFILER_FONT - #else - #define LV_PROFILER_FONT 0 - #endif - #else - #define LV_PROFILER_FONT 1 - #endif - #endif - - /*Enable fs profiler*/ - #ifndef LV_PROFILER_FS - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_FS - #define LV_PROFILER_FS CONFIG_LV_PROFILER_FS - #else - #define LV_PROFILER_FS 0 - #endif - #else - #define LV_PROFILER_FS 1 - #endif - #endif - - /*Enable style profiler*/ - #ifndef LV_PROFILER_STYLE - #ifdef CONFIG_LV_PROFILER_STYLE - #define LV_PROFILER_STYLE CONFIG_LV_PROFILER_STYLE - #else - #define LV_PROFILER_STYLE 0 - #endif - #endif - - /*Enable timer profiler*/ - #ifndef LV_PROFILER_TIMER - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_TIMER - #define LV_PROFILER_TIMER CONFIG_LV_PROFILER_TIMER - #else - #define LV_PROFILER_TIMER 0 - #endif - #else - #define LV_PROFILER_TIMER 1 - #endif - #endif - - /*Enable cache profiler*/ - #ifndef LV_PROFILER_CACHE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_CACHE - #define LV_PROFILER_CACHE CONFIG_LV_PROFILER_CACHE - #else - #define LV_PROFILER_CACHE 0 - #endif - #else - #define LV_PROFILER_CACHE 1 - #endif - #endif - - /*Enable event profiler*/ - #ifndef LV_PROFILER_EVENT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_PROFILER_EVENT - #define LV_PROFILER_EVENT CONFIG_LV_PROFILER_EVENT - #else - #define LV_PROFILER_EVENT 0 - #endif - #else - #define LV_PROFILER_EVENT 1 - #endif - #endif -#endif - -/** 1: Enable Monkey test */ -#ifndef LV_USE_MONKEY - #ifdef CONFIG_LV_USE_MONKEY - #define LV_USE_MONKEY CONFIG_LV_USE_MONKEY - #else - #define LV_USE_MONKEY 0 - #endif -#endif - -/** 1: Enable grid navigation */ -#ifndef LV_USE_GRIDNAV - #ifdef CONFIG_LV_USE_GRIDNAV - #define LV_USE_GRIDNAV CONFIG_LV_USE_GRIDNAV - #else - #define LV_USE_GRIDNAV 0 - #endif -#endif - -/** 1: Enable `lv_obj` fragment logic */ -#ifndef LV_USE_FRAGMENT - #ifdef CONFIG_LV_USE_FRAGMENT - #define LV_USE_FRAGMENT CONFIG_LV_USE_FRAGMENT - #else - #define LV_USE_FRAGMENT 0 - #endif -#endif - -/** 1: Support using images as font in label or span widgets */ -#ifndef LV_USE_IMGFONT - #ifdef CONFIG_LV_USE_IMGFONT - #define LV_USE_IMGFONT CONFIG_LV_USE_IMGFONT - #else - #define LV_USE_IMGFONT 0 - #endif -#endif - -/** 1: Enable an observer pattern implementation */ -#ifndef LV_USE_OBSERVER - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_OBSERVER - #define LV_USE_OBSERVER CONFIG_LV_USE_OBSERVER - #else - #define LV_USE_OBSERVER 0 - #endif - #else - #define LV_USE_OBSERVER 1 - #endif -#endif - -/** 1: Enable Pinyin input method - * - Requires: lv_keyboard */ -#ifndef LV_USE_IME_PINYIN - #ifdef CONFIG_LV_USE_IME_PINYIN - #define LV_USE_IME_PINYIN CONFIG_LV_USE_IME_PINYIN - #else - #define LV_USE_IME_PINYIN 0 - #endif -#endif -#if LV_USE_IME_PINYIN - /** 1: Use default thesaurus. - * @note If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesaurus. */ - #ifndef LV_IME_PINYIN_USE_DEFAULT_DICT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_IME_PINYIN_USE_DEFAULT_DICT - #define LV_IME_PINYIN_USE_DEFAULT_DICT CONFIG_LV_IME_PINYIN_USE_DEFAULT_DICT - #else - #define LV_IME_PINYIN_USE_DEFAULT_DICT 0 - #endif - #else - #define LV_IME_PINYIN_USE_DEFAULT_DICT 1 - #endif - #endif - /** Set maximum number of candidate panels that can be displayed. - * @note This needs to be adjusted according to size of screen. */ - #ifndef LV_IME_PINYIN_CAND_TEXT_NUM - #ifdef CONFIG_LV_IME_PINYIN_CAND_TEXT_NUM - #define LV_IME_PINYIN_CAND_TEXT_NUM CONFIG_LV_IME_PINYIN_CAND_TEXT_NUM - #else - #define LV_IME_PINYIN_CAND_TEXT_NUM 6 - #endif - #endif - - /** Use 9-key input (k9). */ - #ifndef LV_IME_PINYIN_USE_K9_MODE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_IME_PINYIN_USE_K9_MODE - #define LV_IME_PINYIN_USE_K9_MODE CONFIG_LV_IME_PINYIN_USE_K9_MODE - #else - #define LV_IME_PINYIN_USE_K9_MODE 0 - #endif - #else - #define LV_IME_PINYIN_USE_K9_MODE 1 - #endif - #endif - #if LV_IME_PINYIN_USE_K9_MODE == 1 - #ifndef LV_IME_PINYIN_K9_CAND_TEXT_NUM - #ifdef CONFIG_LV_IME_PINYIN_K9_CAND_TEXT_NUM - #define LV_IME_PINYIN_K9_CAND_TEXT_NUM CONFIG_LV_IME_PINYIN_K9_CAND_TEXT_NUM - #else - #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 - #endif - #endif - #endif /*LV_IME_PINYIN_USE_K9_MODE*/ -#endif - -/** 1: Enable file explorer. - * - Requires: lv_table */ -#ifndef LV_USE_FILE_EXPLORER - #ifdef CONFIG_LV_USE_FILE_EXPLORER - #define LV_USE_FILE_EXPLORER CONFIG_LV_USE_FILE_EXPLORER - #else - #define LV_USE_FILE_EXPLORER 0 - #endif -#endif -#if LV_USE_FILE_EXPLORER - /** Maximum length of path */ - #ifndef LV_FILE_EXPLORER_PATH_MAX_LEN - #ifdef CONFIG_LV_FILE_EXPLORER_PATH_MAX_LEN - #define LV_FILE_EXPLORER_PATH_MAX_LEN CONFIG_LV_FILE_EXPLORER_PATH_MAX_LEN - #else - #define LV_FILE_EXPLORER_PATH_MAX_LEN (128) - #endif - #endif - /** Quick access bar, 1:use, 0:do not use. - * - Requires: lv_list */ - #ifndef LV_FILE_EXPLORER_QUICK_ACCESS - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_FILE_EXPLORER_QUICK_ACCESS - #define LV_FILE_EXPLORER_QUICK_ACCESS CONFIG_LV_FILE_EXPLORER_QUICK_ACCESS - #else - #define LV_FILE_EXPLORER_QUICK_ACCESS 0 - #endif - #else - #define LV_FILE_EXPLORER_QUICK_ACCESS 1 - #endif - #endif -#endif - -/** 1: Enable Font manager */ -#ifndef LV_USE_FONT_MANAGER - #ifdef CONFIG_LV_USE_FONT_MANAGER - #define LV_USE_FONT_MANAGER CONFIG_LV_USE_FONT_MANAGER - #else - #define LV_USE_FONT_MANAGER 0 - #endif -#endif -#if LV_USE_FONT_MANAGER - -/**Font manager name max length*/ -#ifndef LV_FONT_MANAGER_NAME_MAX_LEN - #ifdef CONFIG_LV_FONT_MANAGER_NAME_MAX_LEN - #define LV_FONT_MANAGER_NAME_MAX_LEN CONFIG_LV_FONT_MANAGER_NAME_MAX_LEN - #else - #define LV_FONT_MANAGER_NAME_MAX_LEN 32 - #endif -#endif - -#endif - -/** Enable emulated input devices, time emulation, and screenshot compares. */ -#ifndef LV_USE_TEST - #ifdef CONFIG_LV_USE_TEST - #define LV_USE_TEST CONFIG_LV_USE_TEST - #else - #define LV_USE_TEST 0 - #endif -#endif -#if LV_USE_TEST - -/** Enable `lv_test_screenshot_compare`. - * Requires lodepng and a few MB of extra RAM. */ -#ifndef LV_USE_TEST_SCREENSHOT_COMPARE - #ifdef CONFIG_LV_USE_TEST_SCREENSHOT_COMPARE - #define LV_USE_TEST_SCREENSHOT_COMPARE CONFIG_LV_USE_TEST_SCREENSHOT_COMPARE - #else - #define LV_USE_TEST_SCREENSHOT_COMPARE 0 - #endif -#endif - -#if LV_USE_TEST_SCREENSHOT_COMPARE - /** 1: Automatically create missing reference images*/ - #ifndef LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE - #define LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE CONFIG_LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE - #else - #define LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE 0 - #endif - #else - #define LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE 1 - #endif - #endif -#endif /*LV_USE_TEST_SCREENSHOT_COMPARE*/ - -#endif /*LV_USE_TEST*/ - -/** 1: Enable text translation support */ -#ifndef LV_USE_TRANSLATION - #ifdef CONFIG_LV_USE_TRANSLATION - #define LV_USE_TRANSLATION CONFIG_LV_USE_TRANSLATION - #else - #define LV_USE_TRANSLATION 0 - #endif -#endif - -/*1: Enable color filter style*/ -#ifndef LV_USE_COLOR_FILTER - #ifdef CONFIG_LV_USE_COLOR_FILTER - #define LV_USE_COLOR_FILTER CONFIG_LV_USE_COLOR_FILTER - #else - #define LV_USE_COLOR_FILTER 0 - #endif -#endif - -/*================== - * DEVICES - *==================*/ - -/** Use SDL to open window on PC and handle mouse and keyboard. */ -#ifndef LV_USE_SDL - #ifdef CONFIG_LV_USE_SDL - #define LV_USE_SDL CONFIG_LV_USE_SDL - #else - #define LV_USE_SDL 0 - #endif -#endif -#if LV_USE_SDL - #ifndef LV_SDL_INCLUDE_PATH - #ifdef CONFIG_LV_SDL_INCLUDE_PATH - #define LV_SDL_INCLUDE_PATH CONFIG_LV_SDL_INCLUDE_PATH - #else - #define LV_SDL_INCLUDE_PATH - #endif - #endif - #ifndef LV_SDL_RENDER_MODE - #ifdef CONFIG_LV_SDL_RENDER_MODE - #define LV_SDL_RENDER_MODE CONFIG_LV_SDL_RENDER_MODE - #else - #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /**< LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance */ - #endif - #endif - #ifndef LV_SDL_BUF_COUNT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_SDL_BUF_COUNT - #define LV_SDL_BUF_COUNT CONFIG_LV_SDL_BUF_COUNT - #else - #define LV_SDL_BUF_COUNT 0 - #endif - #else - #define LV_SDL_BUF_COUNT 1 /**< 1 or 2 */ - #endif - #endif - #ifndef LV_SDL_ACCELERATED - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_SDL_ACCELERATED - #define LV_SDL_ACCELERATED CONFIG_LV_SDL_ACCELERATED - #else - #define LV_SDL_ACCELERATED 0 - #endif - #else - #define LV_SDL_ACCELERATED 1 /**< 1: Use hardware acceleration*/ - #endif - #endif - #ifndef LV_SDL_FULLSCREEN - #ifdef CONFIG_LV_SDL_FULLSCREEN - #define LV_SDL_FULLSCREEN CONFIG_LV_SDL_FULLSCREEN - #else - #define LV_SDL_FULLSCREEN 0 /**< 1: Make the window full screen by default */ - #endif - #endif - #ifndef LV_SDL_DIRECT_EXIT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_SDL_DIRECT_EXIT - #define LV_SDL_DIRECT_EXIT CONFIG_LV_SDL_DIRECT_EXIT - #else - #define LV_SDL_DIRECT_EXIT 0 - #endif - #else - #define LV_SDL_DIRECT_EXIT 1 /**< 1: Exit the application when all SDL windows are closed */ - #endif - #endif - #ifndef LV_SDL_MOUSEWHEEL_MODE - #ifdef CONFIG_LV_SDL_MOUSEWHEEL_MODE - #define LV_SDL_MOUSEWHEEL_MODE CONFIG_LV_SDL_MOUSEWHEEL_MODE - #else - #define LV_SDL_MOUSEWHEEL_MODE LV_SDL_MOUSEWHEEL_MODE_ENCODER /*LV_SDL_MOUSEWHEEL_MODE_ENCODER/CROWN*/ - #endif - #endif -#endif - -/** Use X11 to open window on Linux desktop and handle mouse and keyboard */ -#ifndef LV_USE_X11 - #ifdef CONFIG_LV_USE_X11 - #define LV_USE_X11 CONFIG_LV_USE_X11 - #else - #define LV_USE_X11 0 - #endif -#endif -#if LV_USE_X11 - #ifndef LV_X11_DIRECT_EXIT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_X11_DIRECT_EXIT - #define LV_X11_DIRECT_EXIT CONFIG_LV_X11_DIRECT_EXIT - #else - #define LV_X11_DIRECT_EXIT 0 - #endif - #else - #define LV_X11_DIRECT_EXIT 1 /**< Exit application when all X11 windows have been closed */ - #endif - #endif - #ifndef LV_X11_DOUBLE_BUFFER - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_X11_DOUBLE_BUFFER - #define LV_X11_DOUBLE_BUFFER CONFIG_LV_X11_DOUBLE_BUFFER - #else - #define LV_X11_DOUBLE_BUFFER 0 - #endif - #else - #define LV_X11_DOUBLE_BUFFER 1 /**< Use double buffers for rendering */ - #endif - #endif - /* Select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!). */ - #ifndef LV_X11_RENDER_MODE_PARTIAL - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_X11_RENDER_MODE_PARTIAL - #define LV_X11_RENDER_MODE_PARTIAL CONFIG_LV_X11_RENDER_MODE_PARTIAL - #else - #define LV_X11_RENDER_MODE_PARTIAL 0 - #endif - #else - #define LV_X11_RENDER_MODE_PARTIAL 1 /**< Partial render mode (preferred) */ - #endif - #endif - #ifndef LV_X11_RENDER_MODE_DIRECT - #ifdef CONFIG_LV_X11_RENDER_MODE_DIRECT - #define LV_X11_RENDER_MODE_DIRECT CONFIG_LV_X11_RENDER_MODE_DIRECT - #else - #define LV_X11_RENDER_MODE_DIRECT 0 /**< Direct render mode */ - #endif - #endif - #ifndef LV_X11_RENDER_MODE_FULL - #ifdef CONFIG_LV_X11_RENDER_MODE_FULL - #define LV_X11_RENDER_MODE_FULL CONFIG_LV_X11_RENDER_MODE_FULL - #else - #define LV_X11_RENDER_MODE_FULL 0 /**< Full render mode */ - #endif - #endif -#endif - -/** Use Wayland to open a window and handle input on Linux or BSD desktops */ -#ifndef LV_USE_WAYLAND - #ifdef CONFIG_LV_USE_WAYLAND - #define LV_USE_WAYLAND CONFIG_LV_USE_WAYLAND - #else - #define LV_USE_WAYLAND 0 - #endif -#endif -#if LV_USE_WAYLAND - #ifndef LV_WAYLAND_DIRECT_EXIT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_WAYLAND_DIRECT_EXIT - #define LV_WAYLAND_DIRECT_EXIT CONFIG_LV_WAYLAND_DIRECT_EXIT - #else - #define LV_WAYLAND_DIRECT_EXIT 0 - #endif - #else - #define LV_WAYLAND_DIRECT_EXIT 1 /**< 1: Exit the application when all Wayland windows are closed */ - #endif - #endif -#endif - -/** Driver for /dev/fb */ -#ifndef LV_USE_LINUX_FBDEV - #ifdef CONFIG_LV_USE_LINUX_FBDEV - #define LV_USE_LINUX_FBDEV CONFIG_LV_USE_LINUX_FBDEV - #else - #define LV_USE_LINUX_FBDEV 0 - #endif -#endif -#if LV_USE_LINUX_FBDEV - #ifndef LV_LINUX_FBDEV_BSD - #ifdef CONFIG_LV_LINUX_FBDEV_BSD - #define LV_LINUX_FBDEV_BSD CONFIG_LV_LINUX_FBDEV_BSD - #else - #define LV_LINUX_FBDEV_BSD 0 - #endif - #endif - #ifndef LV_LINUX_FBDEV_RENDER_MODE - #ifdef CONFIG_LV_LINUX_FBDEV_RENDER_MODE - #define LV_LINUX_FBDEV_RENDER_MODE CONFIG_LV_LINUX_FBDEV_RENDER_MODE - #else - #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL - #endif - #endif - #ifndef LV_LINUX_FBDEV_BUFFER_COUNT - #ifdef CONFIG_LV_LINUX_FBDEV_BUFFER_COUNT - #define LV_LINUX_FBDEV_BUFFER_COUNT CONFIG_LV_LINUX_FBDEV_BUFFER_COUNT - #else - #define LV_LINUX_FBDEV_BUFFER_COUNT 0 - #endif - #endif - #ifndef LV_LINUX_FBDEV_BUFFER_SIZE - #ifdef CONFIG_LV_LINUX_FBDEV_BUFFER_SIZE - #define LV_LINUX_FBDEV_BUFFER_SIZE CONFIG_LV_LINUX_FBDEV_BUFFER_SIZE - #else - #define LV_LINUX_FBDEV_BUFFER_SIZE 60 - #endif - #endif - #ifndef LV_LINUX_FBDEV_MMAP - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_LINUX_FBDEV_MMAP - #define LV_LINUX_FBDEV_MMAP CONFIG_LV_LINUX_FBDEV_MMAP - #else - #define LV_LINUX_FBDEV_MMAP 0 - #endif - #else - #define LV_LINUX_FBDEV_MMAP 1 - #endif - #endif -#endif - -/** Use Nuttx to open window and handle touchscreen */ -#ifndef LV_USE_NUTTX - #ifdef CONFIG_LV_USE_NUTTX - #define LV_USE_NUTTX CONFIG_LV_USE_NUTTX - #else - #define LV_USE_NUTTX 0 - #endif -#endif - -#if LV_USE_NUTTX - #ifndef LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP - #ifdef CONFIG_LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP - #define LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP CONFIG_LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP - #else - #define LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP 0 - #endif - #endif - - /** Use independent image heap for default draw buffer */ - #ifndef LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP - #ifdef CONFIG_LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP - #define LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP CONFIG_LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP - #else - #define LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP 0 - #endif - #endif - - #ifndef LV_USE_NUTTX_LIBUV - #ifdef CONFIG_LV_USE_NUTTX_LIBUV - #define LV_USE_NUTTX_LIBUV CONFIG_LV_USE_NUTTX_LIBUV - #else - #define LV_USE_NUTTX_LIBUV 0 - #endif - #endif - - /** Use Nuttx custom init API to open window and handle touchscreen */ - #ifndef LV_USE_NUTTX_CUSTOM_INIT - #ifdef CONFIG_LV_USE_NUTTX_CUSTOM_INIT - #define LV_USE_NUTTX_CUSTOM_INIT CONFIG_LV_USE_NUTTX_CUSTOM_INIT - #else - #define LV_USE_NUTTX_CUSTOM_INIT 0 - #endif - #endif - - /** Driver for /dev/lcd */ - #ifndef LV_USE_NUTTX_LCD - #ifdef CONFIG_LV_USE_NUTTX_LCD - #define LV_USE_NUTTX_LCD CONFIG_LV_USE_NUTTX_LCD - #else - #define LV_USE_NUTTX_LCD 0 - #endif - #endif - #if LV_USE_NUTTX_LCD - #ifndef LV_NUTTX_LCD_BUFFER_COUNT - #ifdef CONFIG_LV_NUTTX_LCD_BUFFER_COUNT - #define LV_NUTTX_LCD_BUFFER_COUNT CONFIG_LV_NUTTX_LCD_BUFFER_COUNT - #else - #define LV_NUTTX_LCD_BUFFER_COUNT 0 - #endif - #endif - #ifndef LV_NUTTX_LCD_BUFFER_SIZE - #ifdef CONFIG_LV_NUTTX_LCD_BUFFER_SIZE - #define LV_NUTTX_LCD_BUFFER_SIZE CONFIG_LV_NUTTX_LCD_BUFFER_SIZE - #else - #define LV_NUTTX_LCD_BUFFER_SIZE 60 - #endif - #endif - #endif - - /** Driver for /dev/input */ - #ifndef LV_USE_NUTTX_TOUCHSCREEN - #ifdef CONFIG_LV_USE_NUTTX_TOUCHSCREEN - #define LV_USE_NUTTX_TOUCHSCREEN CONFIG_LV_USE_NUTTX_TOUCHSCREEN - #else - #define LV_USE_NUTTX_TOUCHSCREEN 0 - #endif - #endif - - /** Touchscreen cursor size in pixels(<=0: disable cursor) */ - #ifndef LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE - #ifdef CONFIG_LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE - #define LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE CONFIG_LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE - #else - #define LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE 0 - #endif - #endif - - /** Driver for /dev/mouse */ - #ifndef LV_USE_NUTTX_MOUSE - #ifdef CONFIG_LV_USE_NUTTX_MOUSE - #define LV_USE_NUTTX_MOUSE CONFIG_LV_USE_NUTTX_MOUSE - #else - #define LV_USE_NUTTX_MOUSE 0 - #endif - #endif - - /** Mouse movement step (pixels) */ - #ifndef LV_USE_NUTTX_MOUSE_MOVE_STEP - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_NUTTX_MOUSE_MOVE_STEP - #define LV_USE_NUTTX_MOUSE_MOVE_STEP CONFIG_LV_USE_NUTTX_MOUSE_MOVE_STEP - #else - #define LV_USE_NUTTX_MOUSE_MOVE_STEP 0 - #endif - #else - #define LV_USE_NUTTX_MOUSE_MOVE_STEP 1 - #endif - #endif - - /*NuttX trace file and its path*/ - #ifndef LV_USE_NUTTX_TRACE_FILE - #ifdef CONFIG_LV_USE_NUTTX_TRACE_FILE - #define LV_USE_NUTTX_TRACE_FILE CONFIG_LV_USE_NUTTX_TRACE_FILE - #else - #define LV_USE_NUTTX_TRACE_FILE 0 - #endif - #endif - #if LV_USE_NUTTX_TRACE_FILE - #ifndef LV_NUTTX_TRACE_FILE_PATH - #ifdef CONFIG_LV_NUTTX_TRACE_FILE_PATH - #define LV_NUTTX_TRACE_FILE_PATH CONFIG_LV_NUTTX_TRACE_FILE_PATH - #else - #define LV_NUTTX_TRACE_FILE_PATH "/data/lvgl-trace.log" - #endif - #endif - #endif - -#endif - -/** Driver for /dev/dri/card */ -#ifndef LV_USE_LINUX_DRM - #ifdef CONFIG_LV_USE_LINUX_DRM - #define LV_USE_LINUX_DRM CONFIG_LV_USE_LINUX_DRM - #else - #define LV_USE_LINUX_DRM 0 - #endif -#endif - -#if LV_USE_LINUX_DRM - - /* Use the MESA GBM library to allocate DMA buffers that can be - * shared across sub-systems and libraries using the Linux DMA-BUF API. - * The GBM library aims to provide a platform independent memory management system - * it supports the major GPU vendors - This option requires linking with libgbm */ - #ifndef LV_USE_LINUX_DRM_GBM_BUFFERS - #ifdef CONFIG_LV_USE_LINUX_DRM_GBM_BUFFERS - #define LV_USE_LINUX_DRM_GBM_BUFFERS CONFIG_LV_USE_LINUX_DRM_GBM_BUFFERS - #else - #define LV_USE_LINUX_DRM_GBM_BUFFERS 0 - #endif - #endif -#endif - -/** Interface for TFT_eSPI */ -#ifndef LV_USE_TFT_ESPI - #ifdef CONFIG_LV_USE_TFT_ESPI - #define LV_USE_TFT_ESPI CONFIG_LV_USE_TFT_ESPI - #else - #define LV_USE_TFT_ESPI 0 - #endif -#endif - -/** Interface for Lovyan_GFX */ -#ifndef LV_USE_LOVYAN_GFX - #ifdef CONFIG_LV_USE_LOVYAN_GFX - #define LV_USE_LOVYAN_GFX CONFIG_LV_USE_LOVYAN_GFX - #else - #define LV_USE_LOVYAN_GFX 0 - #endif -#endif - -#if LV_USE_LOVYAN_GFX - #ifndef LV_LGFX_USER_INCLUDE - #ifdef CONFIG_LV_LGFX_USER_INCLUDE - #define LV_LGFX_USER_INCLUDE CONFIG_LV_LGFX_USER_INCLUDE - #else - #define LV_LGFX_USER_INCLUDE "lv_lgfx_user.hpp" - #endif - #endif - -#endif /*LV_USE_LOVYAN_GFX*/ - -/** Driver for evdev input devices */ -#ifndef LV_USE_EVDEV - #ifdef CONFIG_LV_USE_EVDEV - #define LV_USE_EVDEV CONFIG_LV_USE_EVDEV - #else - #define LV_USE_EVDEV 0 - #endif -#endif - -/** Driver for libinput input devices */ -#ifndef LV_USE_LIBINPUT - #ifdef CONFIG_LV_USE_LIBINPUT - #define LV_USE_LIBINPUT CONFIG_LV_USE_LIBINPUT - #else - #define LV_USE_LIBINPUT 0 - #endif -#endif - -#if LV_USE_LIBINPUT - #ifndef LV_LIBINPUT_BSD - #ifdef CONFIG_LV_LIBINPUT_BSD - #define LV_LIBINPUT_BSD CONFIG_LV_LIBINPUT_BSD - #else - #define LV_LIBINPUT_BSD 0 - #endif - #endif - - /** Full keyboard support */ - #ifndef LV_LIBINPUT_XKB - #ifdef CONFIG_LV_LIBINPUT_XKB - #define LV_LIBINPUT_XKB CONFIG_LV_LIBINPUT_XKB - #else - #define LV_LIBINPUT_XKB 0 - #endif - #endif - #if LV_LIBINPUT_XKB - /** "setxkbmap -query" can help find the right values for your keyboard */ - #ifndef LV_LIBINPUT_XKB_KEY_MAP - #ifdef CONFIG_LV_LIBINPUT_XKB_KEY_MAP - #define LV_LIBINPUT_XKB_KEY_MAP CONFIG_LV_LIBINPUT_XKB_KEY_MAP - #else - #define LV_LIBINPUT_XKB_KEY_MAP { .rules = NULL, .model = "pc101", .layout = "us", .variant = NULL, .options = NULL } - #endif - #endif - #endif -#endif - -/* Drivers for LCD devices connected via SPI/parallel port */ -#ifndef LV_USE_ST7735 - #ifdef CONFIG_LV_USE_ST7735 - #define LV_USE_ST7735 CONFIG_LV_USE_ST7735 - #else - #define LV_USE_ST7735 0 - #endif -#endif -#ifndef LV_USE_ST7789 - #ifdef CONFIG_LV_USE_ST7789 - #define LV_USE_ST7789 CONFIG_LV_USE_ST7789 - #else - #define LV_USE_ST7789 0 - #endif -#endif -#ifndef LV_USE_ST7796 - #ifdef CONFIG_LV_USE_ST7796 - #define LV_USE_ST7796 CONFIG_LV_USE_ST7796 - #else - #define LV_USE_ST7796 0 - #endif -#endif -#ifndef LV_USE_ILI9341 - #ifdef CONFIG_LV_USE_ILI9341 - #define LV_USE_ILI9341 CONFIG_LV_USE_ILI9341 - #else - #define LV_USE_ILI9341 0 - #endif -#endif -#ifndef LV_USE_FT81X - #ifdef CONFIG_LV_USE_FT81X - #define LV_USE_FT81X CONFIG_LV_USE_FT81X - #else - #define LV_USE_FT81X 0 - #endif -#endif -#ifndef LV_USE_NV3007 - #ifdef CONFIG_LV_USE_NV3007 - #define LV_USE_NV3007 CONFIG_LV_USE_NV3007 - #else - #define LV_USE_NV3007 0 - #endif -#endif - -#if (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341 | LV_USE_NV3007) - #ifndef LV_USE_GENERIC_MIPI - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_GENERIC_MIPI - #define LV_USE_GENERIC_MIPI CONFIG_LV_USE_GENERIC_MIPI - #else - #define LV_USE_GENERIC_MIPI 0 - #endif - #else - #define LV_USE_GENERIC_MIPI 1 - #endif - #endif -#else - #ifndef LV_USE_GENERIC_MIPI - #ifdef CONFIG_LV_USE_GENERIC_MIPI - #define LV_USE_GENERIC_MIPI CONFIG_LV_USE_GENERIC_MIPI - #else - #define LV_USE_GENERIC_MIPI 0 - #endif - #endif -#endif - -/** Driver for Renesas GLCD */ -#ifndef LV_USE_RENESAS_GLCDC - #ifdef CONFIG_LV_USE_RENESAS_GLCDC - #define LV_USE_RENESAS_GLCDC CONFIG_LV_USE_RENESAS_GLCDC - #else - #define LV_USE_RENESAS_GLCDC 0 - #endif -#endif - -/** Driver for ST LTDC */ -#ifndef LV_USE_ST_LTDC - #ifdef CONFIG_LV_USE_ST_LTDC - #define LV_USE_ST_LTDC CONFIG_LV_USE_ST_LTDC - #else - #define LV_USE_ST_LTDC 0 - #endif -#endif -#if LV_USE_ST_LTDC - /* Only used for partial. */ - #ifndef LV_ST_LTDC_USE_DMA2D_FLUSH - #ifdef CONFIG_LV_ST_LTDC_USE_DMA2D_FLUSH - #define LV_ST_LTDC_USE_DMA2D_FLUSH CONFIG_LV_ST_LTDC_USE_DMA2D_FLUSH - #else - #define LV_ST_LTDC_USE_DMA2D_FLUSH 0 - #endif - #endif -#endif - -/** Driver for NXP ELCDIF */ -#ifndef LV_USE_NXP_ELCDIF - #ifdef CONFIG_LV_USE_NXP_ELCDIF - #define LV_USE_NXP_ELCDIF CONFIG_LV_USE_NXP_ELCDIF - #else - #define LV_USE_NXP_ELCDIF 0 - #endif -#endif - -/** LVGL Windows backend */ -#ifndef LV_USE_WINDOWS - #ifdef CONFIG_LV_USE_WINDOWS - #define LV_USE_WINDOWS CONFIG_LV_USE_WINDOWS - #else - #define LV_USE_WINDOWS 0 - #endif -#endif - -/** LVGL UEFI backend */ -#ifndef LV_USE_UEFI - #ifdef CONFIG_LV_USE_UEFI - #define LV_USE_UEFI CONFIG_LV_USE_UEFI - #else - #define LV_USE_UEFI 0 - #endif -#endif -#if LV_USE_UEFI - #ifndef LV_USE_UEFI_INCLUDE - #ifdef CONFIG_LV_USE_UEFI_INCLUDE - #define LV_USE_UEFI_INCLUDE CONFIG_LV_USE_UEFI_INCLUDE - #else - #define LV_USE_UEFI_INCLUDE "myefi.h" /**< Header that hides the actual framework (EDK2, gnu-efi, ...) */ - #endif - #endif - #ifndef LV_UEFI_USE_MEMORY_SERVICES - #ifdef CONFIG_LV_UEFI_USE_MEMORY_SERVICES - #define LV_UEFI_USE_MEMORY_SERVICES CONFIG_LV_UEFI_USE_MEMORY_SERVICES - #else - #define LV_UEFI_USE_MEMORY_SERVICES 0 /**< Use the memory functions from the boot services table */ - #endif - #endif -#endif - -/** Use a generic OpenGL driver that can be used to embed in other applications or used with GLFW/EGL - * - Requires LV_USE_MATRIX. - */ -#ifndef LV_USE_OPENGLES - #ifdef CONFIG_LV_USE_OPENGLES - #define LV_USE_OPENGLES CONFIG_LV_USE_OPENGLES - #else - #define LV_USE_OPENGLES 0 - #endif -#endif -#if LV_USE_OPENGLES - #ifndef LV_USE_OPENGLES_DEBUG - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_USE_OPENGLES_DEBUG - #define LV_USE_OPENGLES_DEBUG CONFIG_LV_USE_OPENGLES_DEBUG - #else - #define LV_USE_OPENGLES_DEBUG 0 - #endif - #else - #define LV_USE_OPENGLES_DEBUG 1 /**< Enable or disable debug for opengles */ - #endif - #endif -#endif - -/** Use GLFW to open window on PC and handle mouse and keyboard. Requires*/ -#ifndef LV_USE_GLFW - #ifdef CONFIG_LV_USE_GLFW - #define LV_USE_GLFW CONFIG_LV_USE_GLFW - #else - #define LV_USE_GLFW 0 - #endif -#endif - - -/** QNX Screen display and input drivers */ -#ifndef LV_USE_QNX - #ifdef CONFIG_LV_USE_QNX - #define LV_USE_QNX CONFIG_LV_USE_QNX - #else - #define LV_USE_QNX 0 - #endif -#endif -#if LV_USE_QNX - #ifndef LV_QNX_BUF_COUNT - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_QNX_BUF_COUNT - #define LV_QNX_BUF_COUNT CONFIG_LV_QNX_BUF_COUNT - #else - #define LV_QNX_BUF_COUNT 0 - #endif - #else - #define LV_QNX_BUF_COUNT 1 /**< 1 or 2 */ - #endif - #endif -#endif - -/** Enable or disable for external data and destructor function */ -#ifndef LV_USE_EXT_DATA - #ifdef CONFIG_LV_USE_EXT_DATA - #define LV_USE_EXT_DATA CONFIG_LV_USE_EXT_DATA - #else - #define LV_USE_EXT_DATA 0 - #endif -#endif - -/*===================== -* BUILD OPTIONS -*======================*/ - -/** Enable examples to be built with the library. */ -#ifndef LV_BUILD_EXAMPLES - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_BUILD_EXAMPLES - #define LV_BUILD_EXAMPLES CONFIG_LV_BUILD_EXAMPLES - #else - #define LV_BUILD_EXAMPLES 0 - #endif - #else - #define LV_BUILD_EXAMPLES 1 - #endif -#endif - -/** Build the demos */ -#ifndef LV_BUILD_DEMOS - #ifdef LV_KCONFIG_PRESENT - #ifdef CONFIG_LV_BUILD_DEMOS - #define LV_BUILD_DEMOS CONFIG_LV_BUILD_DEMOS - #else - #define LV_BUILD_DEMOS 0 - #endif - #else - #define LV_BUILD_DEMOS 1 - #endif -#endif - -/*=================== - * DEMO USAGE - ====================*/ - -#if LV_BUILD_DEMOS - /** Show some widgets. This might be required to increase `LV_MEM_SIZE`. */ - #ifndef LV_USE_DEMO_WIDGETS - #ifdef CONFIG_LV_USE_DEMO_WIDGETS - #define LV_USE_DEMO_WIDGETS CONFIG_LV_USE_DEMO_WIDGETS - #else - #define LV_USE_DEMO_WIDGETS 0 - #endif - #endif - - /** Demonstrate usage of encoder and keyboard. */ - #ifndef LV_USE_DEMO_KEYPAD_AND_ENCODER - #ifdef CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER - #define LV_USE_DEMO_KEYPAD_AND_ENCODER CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER - #else - #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 - #endif - #endif - - /** Benchmark your system */ - #ifndef LV_USE_DEMO_BENCHMARK - #ifdef CONFIG_LV_USE_DEMO_BENCHMARK - #define LV_USE_DEMO_BENCHMARK CONFIG_LV_USE_DEMO_BENCHMARK - #else - #define LV_USE_DEMO_BENCHMARK 0 - #endif - #endif - - #if LV_USE_DEMO_BENCHMARK - /** Use fonts where bitmaps are aligned 16 byte and has Nx16 byte stride */ - #ifndef LV_DEMO_BENCHMARK_ALIGNED_FONTS - #ifdef CONFIG_LV_DEMO_BENCHMARK_ALIGNED_FONTS - #define LV_DEMO_BENCHMARK_ALIGNED_FONTS CONFIG_LV_DEMO_BENCHMARK_ALIGNED_FONTS - #else - #define LV_DEMO_BENCHMARK_ALIGNED_FONTS 0 - #endif - #endif - #endif - - /** Render test for each primitive. - * - Requires at least 480x272 display. */ - #ifndef LV_USE_DEMO_RENDER - #ifdef CONFIG_LV_USE_DEMO_RENDER - #define LV_USE_DEMO_RENDER CONFIG_LV_USE_DEMO_RENDER - #else - #define LV_USE_DEMO_RENDER 0 - #endif - #endif - - /** Stress test for LVGL */ - #ifndef LV_USE_DEMO_STRESS - #ifdef CONFIG_LV_USE_DEMO_STRESS - #define LV_USE_DEMO_STRESS CONFIG_LV_USE_DEMO_STRESS - #else - #define LV_USE_DEMO_STRESS 0 - #endif - #endif - - /** Music player demo */ - #ifndef LV_USE_DEMO_MUSIC - #ifdef CONFIG_LV_USE_DEMO_MUSIC - #define LV_USE_DEMO_MUSIC CONFIG_LV_USE_DEMO_MUSIC - #else - #define LV_USE_DEMO_MUSIC 0 - #endif - #endif - #if LV_USE_DEMO_MUSIC - #ifndef LV_DEMO_MUSIC_SQUARE - #ifdef CONFIG_LV_DEMO_MUSIC_SQUARE - #define LV_DEMO_MUSIC_SQUARE CONFIG_LV_DEMO_MUSIC_SQUARE - #else - #define LV_DEMO_MUSIC_SQUARE 0 - #endif - #endif - #ifndef LV_DEMO_MUSIC_LANDSCAPE - #ifdef CONFIG_LV_DEMO_MUSIC_LANDSCAPE - #define LV_DEMO_MUSIC_LANDSCAPE CONFIG_LV_DEMO_MUSIC_LANDSCAPE - #else - #define LV_DEMO_MUSIC_LANDSCAPE 0 - #endif - #endif - #ifndef LV_DEMO_MUSIC_ROUND - #ifdef CONFIG_LV_DEMO_MUSIC_ROUND - #define LV_DEMO_MUSIC_ROUND CONFIG_LV_DEMO_MUSIC_ROUND - #else - #define LV_DEMO_MUSIC_ROUND 0 - #endif - #endif - #ifndef LV_DEMO_MUSIC_LARGE - #ifdef CONFIG_LV_DEMO_MUSIC_LARGE - #define LV_DEMO_MUSIC_LARGE CONFIG_LV_DEMO_MUSIC_LARGE - #else - #define LV_DEMO_MUSIC_LARGE 0 - #endif - #endif - #ifndef LV_DEMO_MUSIC_AUTO_PLAY - #ifdef CONFIG_LV_DEMO_MUSIC_AUTO_PLAY - #define LV_DEMO_MUSIC_AUTO_PLAY CONFIG_LV_DEMO_MUSIC_AUTO_PLAY - #else - #define LV_DEMO_MUSIC_AUTO_PLAY 0 - #endif - #endif - #endif - - /** Vector graphic demo */ - #ifndef LV_USE_DEMO_VECTOR_GRAPHIC - #ifdef CONFIG_LV_USE_DEMO_VECTOR_GRAPHIC - #define LV_USE_DEMO_VECTOR_GRAPHIC CONFIG_LV_USE_DEMO_VECTOR_GRAPHIC - #else - #define LV_USE_DEMO_VECTOR_GRAPHIC 0 - #endif - #endif - - /** GLTF demo */ - #ifndef LV_USE_DEMO_GLTF - #ifdef CONFIG_LV_USE_DEMO_GLTF - #define LV_USE_DEMO_GLTF CONFIG_LV_USE_DEMO_GLTF - #else - #define LV_USE_DEMO_GLTF 0 - #endif - #endif - - /*--------------------------- - * Demos from lvgl/lv_demos - ---------------------------*/ - - /** Flex layout demo */ - #ifndef LV_USE_DEMO_FLEX_LAYOUT - #ifdef CONFIG_LV_USE_DEMO_FLEX_LAYOUT - #define LV_USE_DEMO_FLEX_LAYOUT CONFIG_LV_USE_DEMO_FLEX_LAYOUT - #else - #define LV_USE_DEMO_FLEX_LAYOUT 0 - #endif - #endif - - /** Smart-phone like multi-language demo */ - #ifndef LV_USE_DEMO_MULTILANG - #ifdef CONFIG_LV_USE_DEMO_MULTILANG - #define LV_USE_DEMO_MULTILANG CONFIG_LV_USE_DEMO_MULTILANG - #else - #define LV_USE_DEMO_MULTILANG 0 - #endif - #endif - - /*E-bike demo with Lottie animations (if LV_USE_LOTTIE is enabled)*/ - #ifndef LV_USE_DEMO_EBIKE - #ifdef CONFIG_LV_USE_DEMO_EBIKE - #define LV_USE_DEMO_EBIKE CONFIG_LV_USE_DEMO_EBIKE - #else - #define LV_USE_DEMO_EBIKE 0 - #endif - #endif - #if LV_USE_DEMO_EBIKE - #ifndef LV_DEMO_EBIKE_PORTRAIT - #ifdef CONFIG_LV_DEMO_EBIKE_PORTRAIT - #define LV_DEMO_EBIKE_PORTRAIT CONFIG_LV_DEMO_EBIKE_PORTRAIT - #else - #define LV_DEMO_EBIKE_PORTRAIT 0 /*0: for 480x270..480x320, 1: for 480x800..720x1280*/ - #endif - #endif - #endif - - /** High-resolution demo */ - #ifndef LV_USE_DEMO_HIGH_RES - #ifdef CONFIG_LV_USE_DEMO_HIGH_RES - #define LV_USE_DEMO_HIGH_RES CONFIG_LV_USE_DEMO_HIGH_RES - #else - #define LV_USE_DEMO_HIGH_RES 0 - #endif - #endif - - /* Smart watch demo */ - #ifndef LV_USE_DEMO_SMARTWATCH - #ifdef CONFIG_LV_USE_DEMO_SMARTWATCH - #define LV_USE_DEMO_SMARTWATCH CONFIG_LV_USE_DEMO_SMARTWATCH - #else - #define LV_USE_DEMO_SMARTWATCH 0 - #endif - #endif -#endif /* LV_BUILD_DEMOS */ - - - -/*---------------------------------- - * End of parsing lv_conf_template.h - -----------------------------------*/ - -/*Fix inconsistent name*/ -#define LV_USE_ANIMIMAGE LV_USE_ANIMIMG - -#ifndef __ASSEMBLY__ -LV_EXPORT_CONST_INT(LV_DPI_DEF); -LV_EXPORT_CONST_INT(LV_DRAW_BUF_STRIDE_ALIGN); -LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN); -#endif - -#undef LV_KCONFIG_PRESENT - -/* Disable VGLite drivers if VGLite drawing is disabled */ -#ifndef LV_USE_VG_LITE_DRIVER - #define LV_USE_VG_LITE_DRIVER 0 -#endif - -#ifndef LV_USE_VG_LITE_THORVG - #define LV_USE_VG_LITE_THORVG 0 -#endif - -/* Set some defines if a dependency is disabled. */ -#if LV_USE_LOG == 0 - #define LV_LOG_LEVEL LV_LOG_LEVEL_NONE - #define LV_LOG_TRACE_MEM 0 - #define LV_LOG_TRACE_TIMER 0 - #define LV_LOG_TRACE_INDEV 0 - #define LV_LOG_TRACE_DISP_REFR 0 - #define LV_LOG_TRACE_EVENT 0 - #define LV_LOG_TRACE_OBJ_CREATE 0 - #define LV_LOG_TRACE_LAYOUT 0 - #define LV_LOG_TRACE_ANIM 0 -#endif /*LV_USE_LOG*/ - -#if LV_USE_WAYLAND - /*Automatically detect wayland backend*/ - #if LV_USE_OPENGLES - #define LV_WAYLAND_USE_EGL 1 - #define LV_WAYLAND_USE_G2D 0 - #define LV_WAYLAND_USE_SHM 0 - #elif LV_USE_G2D - #define LV_WAYLAND_USE_EGL 0 - #define LV_WAYLAND_USE_G2D 1 - #define LV_WAYLAND_USE_SHM 0 - #else - #define LV_WAYLAND_USE_EGL 0 - #define LV_WAYLAND_USE_G2D 0 - #define LV_WAYLAND_USE_SHM 1 - #endif -#else - #define LV_WAYLAND_USE_G2D 0 - #define LV_WAYLAND_USE_SHM 0 - #define LV_WAYLAND_USE_EGL 0 -#endif - -#if LV_USE_LINUX_DRM - #if LV_USE_OPENGLES - #define LV_LINUX_DRM_USE_EGL 1 - #else - #define LV_LINUX_DRM_USE_EGL 0 - #endif /* LV_USE_OPENGLES */ -#else - #define LV_LINUX_DRM_USE_EGL 0 -#endif /*LV_USE_LINUX_DRM*/ - -#if LV_USE_SYSMON == 0 - #define LV_USE_PERF_MONITOR 0 - #define LV_USE_MEM_MONITOR 0 - #define LV_SYSMON_PROC_IDLE_AVAILABLE 0 -#endif /*LV_USE_SYSMON*/ - -#if LV_USE_PERF_MONITOR == 0 - #define LV_USE_PERF_MONITOR_LOG_MODE 0 -#endif /*LV_USE_PERF_MONITOR*/ - -#if LV_BUILD_DEMOS == 0 - #define LV_USE_DEMO_WIDGETS 0 - #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 - #define LV_USE_DEMO_BENCHMARK 0 - #define LV_USE_DEMO_RENDER 0 - #define LV_USE_DEMO_STRESS 0 - #define LV_USE_DEMO_MUSIC 0 - #define LV_USE_DEMO_VECTOR_GRAPHIC 0 - #define LV_USE_DEMO_FLEX_LAYOUT 0 - #define LV_USE_DEMO_MULTILANG 0 - #define LV_USE_DEMO_EBIKE 0 - #define LV_USE_DEMO_HIGH_RES 0 - #define LV_USE_DEMO_SMARTWATCH 0 - #define LV_USE_DEMO_GLTF 0 -#endif /* LV_BUILD_DEMOS */ - -#ifndef LV_USE_LZ4 - #if (LV_USE_LZ4_INTERNAL || LV_USE_LZ4_EXTERNAL) - #define LV_USE_LZ4 1 - #else - #define LV_USE_LZ4 0 - #endif -#endif - -#ifndef LV_USE_THORVG - #if (LV_USE_THORVG_INTERNAL || LV_USE_THORVG_EXTERNAL) - #define LV_USE_THORVG 1 - #else - #define LV_USE_THORVG 0 - #endif -#endif - -#if LV_USE_SDL && LV_USE_OPENGLES && (LV_USE_DRAW_OPENGLES || LV_USE_DRAW_NANOVG) - #define LV_SDL_USE_EGL 1 -#else - #define LV_SDL_USE_EGL 0 -#endif - -#ifndef LV_USE_EGL - #if LV_LINUX_DRM_USE_EGL || LV_WAYLAND_USE_EGL || LV_SDL_USE_EGL - #define LV_USE_EGL 1 - #else - #define LV_USE_EGL 0 - #endif -#endif /* LV_USE_EGL */ - - -#if LV_USE_OS - #if (LV_USE_FREETYPE || LV_USE_THORVG) && LV_DRAW_THREAD_STACK_SIZE < (32 * 1024) - #error "Increase LV_DRAW_THREAD_STACK_SIZE to at least 32KB for FreeType or ThorVG." - #endif - - #if defined(LV_DRAW_THREAD_STACKSIZE) && !defined(LV_DRAW_THREAD_STACK_SIZE) - #warning "LV_DRAW_THREAD_STACKSIZE was renamed to LV_DRAW_THREAD_STACK_SIZE. Please update lv_conf.h or run menuconfig again." - #define LV_DRAW_THREAD_STACK_SIZE LV_DRAW_THREAD_STACKSIZE - #endif -#endif - -/*Allow only upper case letters and '/' ('/' is a special case for backward compatibility)*/ -#define LV_FS_IS_VALID_LETTER(l) ((l) == '/' || ((l) >= 'A' && (l) <= 'Z')) - -/* If running without lv_conf.h, add typedefs with default value. */ -#ifdef LV_CONF_SKIP - #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/ - #define _CRT_SECURE_NO_WARNINGS - #endif -#endif /*defined(LV_CONF_SKIP)*/ - -#endif /*LV_CONF_INTERNAL_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_conf_kconfig.h b/src/lv_conf_kconfig.h index 5900cf4422..107cd4a67c 100644 --- a/src/lv_conf_kconfig.h +++ b/src/lv_conf_kconfig.h @@ -1,325 +1,2 @@ -/** * @file lv_conf_kconfig.h * Configs that need special handling when LVGL is used with Kconfig */ - -#ifndef LV_CONF_KCONFIG_H -#define LV_CONF_KCONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef LV_CONF_KCONFIG_EXTERNAL_INCLUDE -# include LV_CONF_KCONFIG_EXTERNAL_INCLUDE -#else - -# ifdef ESP_PLATFORM -# include "sdkconfig.h" -# include "esp_attr.h" -# endif - -# ifdef __NuttX__ -# include -/* - * Make sure version number in Kconfig file is correctly set. - * Mismatch can happen when user manually copy lvgl/Kconfig file to their project, like what NuttX does. - */ -# include "../lv_version.h" - -# if CONFIG_LVGL_VERSION_MAJOR != LVGL_VERSION_MAJOR || CONFIG_LVGL_VERSION_MINOR != LVGL_VERSION_MINOR \ - || CONFIG_LVGL_VERSION_PATCH != LVGL_VERSION_PATCH -# warning "Version mismatch between Kconfig and lvgl/lv_version.h" -# endif -# elif defined(__RTTHREAD__) -# define LV_CONF_INCLUDE_SIMPLE -# include -# endif - -#endif /*LV_CONF_KCONFIG_EXTERNAL_INCLUDE*/ - -/******************* - * LV_USE_STDLIB_MALLOC - *******************/ - -#ifdef CONFIG_LV_USE_BUILTIN_MALLOC -# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN -#elif defined(CONFIG_LV_USE_CLIB_MALLOC) -# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB -#elif defined(CONFIG_LV_USE_MICROPYTHON_MALLOC) -# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_MICROPYTHON -#elif defined(CONFIG_LV_USE_RTTHREAD_MALLOC) -# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_RTTHREAD -#elif defined (CONFIG_LV_USE_CUSTOM_MALLOC) -# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_CUSTOM -#endif - -/******************* - * LV_USE_STDLIB_STRING - *******************/ - -#ifdef CONFIG_LV_USE_BUILTIN_STRING -# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN -#elif defined(CONFIG_LV_USE_CLIB_STRING) -# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_CLIB -#elif defined(CONFIG_LV_USE_MICROPYTHON_STRING) -# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_MICROPYTHON -#elif defined(CONFIG_LV_USE_RTTHREAD_STRING) -# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_RTTHREAD -#elif defined (CONFIG_LV_USE_CUSTOM_STRING) -# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_CUSTOM -#endif - -/******************* - * LV_USE_STDLIB_SPRINTF - *******************/ - -#ifdef CONFIG_LV_USE_BUILTIN_SPRINTF -# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN -#elif defined(CONFIG_LV_USE_CLIB_SPRINTF) -# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_CLIB -#elif defined(CONFIG_LV_USE_MICROPYTHON_SPRINTF) -# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_MICROPYTHON -#elif defined(CONFIG_LV_USE_RTTHREAD_SPRINTF) -# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_RTTHREAD -#elif defined (CONFIG_LV_USE_CUSTOM_SPRINTF) -# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_CUSTOM -#endif - -/******************* - * LV_USE_OS - *******************/ - -#ifdef CONFIG_LV_OS_NONE -# define CONFIG_LV_USE_OS LV_OS_NONE -#elif defined(CONFIG_LV_OS_PTHREAD) -# define CONFIG_LV_USE_OS LV_OS_PTHREAD -#elif defined(CONFIG_LV_OS_FREERTOS) -# define CONFIG_LV_USE_OS LV_OS_FREERTOS -#elif defined(CONFIG_LV_OS_CMSIS_RTOS2) -# define CONFIG_LV_USE_OS LV_OS_CMSIS_RTOS2 -#elif defined (CONFIG_LV_OS_RTTHREAD) -# define CONFIG_LV_USE_OS LV_OS_RTTHREAD -#elif defined (CONFIG_LV_OS_WINDOWS) -# define CONFIG_LV_USE_OS LV_OS_WINDOWS -#elif defined (CONFIG_LV_OS_MQX) -# define CONFIG_LV_USE_OS LV_OS_MQX -#elif defined (CONFIG_LV_OS_SDL2) -# define CONFIG_LV_USE_OS LV_OS_SDL2 -#elif defined (CONFIG_LV_OS_CUSTOM) -# define CONFIG_LV_USE_OS LV_OS_CUSTOM -#endif - -/******************* - * LV_NANOVG_BACKEND - *******************/ - -#ifdef CONFIG_LV_NANOVG_BACKEND_GL2 -# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GL2 -#elif defined(CONFIG_LV_NANOVG_BACKEND_GL3) -# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GL3 -#elif defined(CONFIG_LV_NANOVG_BACKEND_GLES2) -# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GLES2 -#elif defined(CONFIG_LV_NANOVG_BACKEND_GLES3) -# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GLES3 -#endif - -/******************* - * LV_MEM_SIZE - *******************/ - -#ifdef CONFIG_LV_MEM_SIZE_KILOBYTES -# if(CONFIG_LV_MEM_SIZE_KILOBYTES < 2) -# error "LV_MEM_SIZE >= 2kB is required" -# endif - -# define CONFIG_LV_MEM_SIZE (CONFIG_LV_MEM_SIZE_KILOBYTES * 1024U) -#endif - -#ifdef CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES -# define CONFIG_LV_MEM_POOL_EXPAND_SIZE (CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES * 1024U) -#endif - -/*------------------ - * MONITOR POSITION - *-----------------*/ - -#ifdef CONFIG_LV_PERF_MONITOR_ALIGN_TOP_LEFT -# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_LEFT -#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_TOP_MID) -# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_MID -#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_TOP_RIGHT) -# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_RIGHT -#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_LEFT) -# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_LEFT -#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_MID) -# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_MID -#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT) -# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT -#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_LEFT_MID) -# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_LEFT_MID -#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_RIGHT_MID) -# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_RIGHT_MID -#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_CENTER) -# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_CENTER -#endif - -#ifdef CONFIG_LV_MEM_MONITOR_ALIGN_TOP_LEFT -# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_TOP_LEFT -#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_TOP_MID) -# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_TOP_MID -#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_TOP_RIGHT) -# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_TOP_RIGHT -#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT) -# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT -#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_MID) -# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_MID -#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_RIGHT) -# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT -#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_LEFT_MID) -# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_LEFT_MID -#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_RIGHT_MID) -# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_RIGHT_MID -#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_CENTER) -# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_CENTER -#endif - -/******************** - * FONT SELECTION - *******************/ - -/** - * NOTE: In Kconfig instead of `LV_DEFAULT_FONT` - * `CONFIG_LV_FONT_DEFAULT_` is defined - * hence the large selection with if-s - */ - -/*------------------ - * DEFAULT FONT - *-----------------*/ -#ifdef CONFIG_LV_FONT_DEFAULT_MONTSERRAT_8 -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_8 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_10) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_10 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_12 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_14) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_14 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_16) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_16 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_18) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_18 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_20) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_20 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_22) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_22 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_24) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_24 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_26 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_28 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_30) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_30 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_32 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_34) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_34 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_36) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_36 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_38) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_38 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_40) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_40 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_42) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_42 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_44) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_44 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_46) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_46 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_48) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_48 -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12_SUBPX) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_12_subpx -#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28_COMPRESSED) -# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_28_compressed -#elif defined(CONFIG_LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW) -# define CONFIG_LV_FONT_DEFAULT &lv_font_dejavu_16_persian_hebrew -#elif defined(CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK) -# define CONFIG_LV_FONT_DEFAULT &lv_font_source_han_sans_sc_14_cjk -#elif defined(CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK) -# define CONFIG_LV_FONT_DEFAULT &lv_font_source_han_sans_sc_16_cjk -#elif defined(CONFIG_LV_FONT_DEFAULT_UNSCII_8) -# define CONFIG_LV_FONT_DEFAULT &lv_font_unscii_8 -#elif defined(CONFIG_LV_FONT_DEFAULT_UNSCII_16) -# define CONFIG_LV_FONT_DEFAULT &lv_font_unscii_16 -#endif - -/*------------------ - * TEXT ENCODING - *-----------------*/ -#ifdef CONFIG_LV_TXT_ENC_UTF8 -# define CONFIG_LV_TXT_ENC LV_TXT_ENC_UTF8 -#elif defined(CONFIG_LV_TXT_ENC_ASCII) -# define CONFIG_LV_TXT_ENC LV_TXT_ENC_ASCII -#endif - -/*------------------ - * BIDI DIRECTION - *-----------------*/ - -#ifdef CONFIG_LV_BASE_DIR_LTR -# define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_LTR -#elif defined(CONFIG_LV_BASE_DIR_RTL) -# define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_RTL -#elif defined(CONFIG_LV_BASE_DIR_AUTO) -# define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO -#endif - -/*------------------ - * SDL - *-----------------*/ - -#ifdef CONFIG_LV_SDL_RENDER_MODE_PARTIAL -# define CONFIG_LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL -#elif defined(CONFIG_LV_SDL_RENDER_MODE_DIRECT) -# define CONFIG_LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT -#elif defined(CONFIG_LV_SDL_RENDER_MODE_FULL) -# define CONFIG_LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_FULL -#endif - -/*------------------ - * WAYLAND - *-----------------*/ - -#ifdef CONFIG_LV_WAYLAND_RENDER_MODE_PARTIAL -# define CONFIG_LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL -#elif defined(CONFIG_LV_WAYLAND_RENDER_MODE_DIRECT) -# define CONFIG_LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT -#elif defined(CONFIG_LV_WAYLAND_RENDER_MODE_FULL) -# define CONFIG_LV_WAYLAND_RENDER_MODE_FULL LV_DISPLAY_RENDER_MODE_FULL -#endif - -/*------------------ - * LINUX FBDEV - *-----------------*/ - -#ifdef CONFIG_LV_LINUX_FBDEV_RENDER_MODE_PARTIAL -# define CONFIG_LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL -#elif defined(CONFIG_LV_LINUX_FBDEV_RENDER_MODE_DIRECT) -# define CONFIG_LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT -#elif defined(CONFIG_LV_LINUX_FBDEV_RENDER_MODE_FULL) -# define CONFIG_LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_FULL -#endif - - -#ifdef CONFIG_LV_USE_CALENDAR -# ifdef CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY -# define CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES { CONFIG_LV_MONDAY_STR , CONFIG_LV_TUESDAY_STR, CONFIG_LV_WEDNESDAY_STR, CONFIG_LV_THURSDAY_STR, CONFIG_LV_FRIDAY_STR, CONFIG_LV_SATURDAY_STR, CONFIG_LV_SUNDAY_STR } -# else -# define CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES { CONFIG_LV_SUNDAY_STR, CONFIG_LV_MONDAY_STR , CONFIG_LV_TUESDAY_STR, CONFIG_LV_WEDNESDAY_STR, CONFIG_LV_THURSDAY_STR, CONFIG_LV_FRIDAY_STR, CONFIG_LV_SATURDAY_STR } -# endif -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CONF_KCONFIG_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_init.c b/src/lv_init.c index 804e1a0376..1f27c9a165 100644 --- a/src/lv_init.c +++ b/src/lv_init.c @@ -6,6 +6,8 @@ /********************* * INCLUDES *********************/ + +#include "lv_public_api.h" #include "misc/lv_timer_private.h" #include "misc/lv_profiler_builtin_private.h" #include "misc/lv_anim_private.h" @@ -14,33 +16,13 @@ #include "core/lv_refr_private.h" #include "core/lv_obj_style_private.h" #include "core/lv_group_private.h" -#include "lv_init.h" #include "core/lv_global.h" -#include "core/lv_obj.h" #include "display/lv_display_private.h" #include "indev/lv_indev_private.h" #include "layouts/lv_layout_private.h" -#include "libs/bin_decoder/lv_bin_decoder.h" -#include "libs/bmp/lv_bmp.h" -#include "libs/ffmpeg/lv_ffmpeg.h" -#include "libs/freetype/lv_freetype.h" -#include "libs/fsdrv/lv_fsdrv.h" -#include "libs/tjpgd/lv_tjpgd.h" -#include "libs/libjpeg_turbo/lv_libjpeg_turbo.h" -#include "libs/lodepng/lv_lodepng.h" -#include "libs/libpng/lv_libpng.h" -#include "libs/libwebp/lv_libwebp.h" -#include "libs/tiny_ttf/lv_tiny_ttf.h" -#include "draw/lv_draw.h" -#include "misc/lv_async.h" #include "misc/lv_fs_private.h" -#include "widgets/gif/lv_gif.h" -#include "widgets/span/lv_span.h" -#include "themes/simple/lv_theme_simple.h" -#include "misc/lv_fs.h" #include "osal/lv_os_private.h" #include "debugging/sysmon/lv_sysmon_private.h" -#include "others/translation/lv_translation.h" #include "drivers/wayland/lv_wayland_private.h" #if LV_USE_SVG @@ -81,9 +63,6 @@ #if LV_USE_WINDOWS #include "drivers/windows/lv_windows_context.h" #endif -#if LV_USE_UEFI - #include "drivers/uefi/lv_uefi_context.h" -#endif #if LV_USE_EVDEV #include "drivers/evdev/lv_evdev_private.h" #endif diff --git a/src/lv_init.h b/src/lv_init.h index 0815142cbf..b942a6edbf 100644 --- a/src/lv_init.h +++ b/src/lv_init.h @@ -1,55 +1,2 @@ -/** - * @file lv_init.h - * - */ - -#ifndef LV_INIT_H -#define LV_INIT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_conf_internal.h" -#include "misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize LVGL library. - * Should be called before any other LVGL related function. - */ -void lv_init(void); - -/** - * Deinit the 'lv' library - */ -void lv_deinit(void); - -/** - * Returns whether the 'lv' library is currently initialized - */ -bool lv_is_initialized(void); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_INIT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../include/lvgl/lvgl.h" diff --git a/src/lv_public_api.h b/src/lv_public_api.h new file mode 100644 index 0000000000..265546e8ea --- /dev/null +++ b/src/lv_public_api.h @@ -0,0 +1,7 @@ +#ifndef LV_INTERNAL_H +#define LV_INTERNAL_H + +/*Include every public header*/ +#include "../include/lvgl/lvgl.h" + +#endif /*LV_INTERNAL_H*/ diff --git a/src/lvgl.h b/src/lvgl.h index f49fcc71ca..4ec3236b1d 100644 --- a/src/lvgl.h +++ b/src/lvgl.h @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lvgl.h" -#include "lv_conf_internal.h" + +#include "../include/lvgl/lvgl.h" /********************* * DEFINES diff --git a/src/misc/cache/class/lv_cache_lru_ll.c b/src/misc/cache/class/lv_cache_lru_ll.c index 593194f897..23ab0226cc 100644 --- a/src/misc/cache/class/lv_cache_lru_ll.c +++ b/src/misc/cache/class/lv_cache_lru_ll.c @@ -46,12 +46,7 @@ #include "lv_cache_lru_ll.h" #include "../lv_cache_entry.h" -#include "../../../stdlib/lv_sprintf.h" -#include "../../../stdlib/lv_string.h" -#include "../../lv_ll.h" - -#include "../../lv_iter.h" -#include "../../lv_assert.h" +#include "../../lv_iter_private.h" /********************* * DEFINES diff --git a/src/misc/cache/class/lv_cache_lru_ll.h b/src/misc/cache/class/lv_cache_lru_ll.h index 8c0352b4ad..ba5033a8b7 100644 --- a/src/misc/cache/class/lv_cache_lru_ll.h +++ b/src/misc/cache/class/lv_cache_lru_ll.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../lv_cache_private.h" +#include "../lv_cache.h" /********************* * DEFINES diff --git a/src/misc/cache/class/lv_cache_lru_rb.c b/src/misc/cache/class/lv_cache_lru_rb.c index 79b64b1882..1609531827 100644 --- a/src/misc/cache/class/lv_cache_lru_rb.c +++ b/src/misc/cache/class/lv_cache_lru_rb.c @@ -46,12 +46,9 @@ #include "lv_cache_lru_rb.h" #include "../lv_cache_entry.h" -#include "../../../stdlib/lv_sprintf.h" -#include "../../../stdlib/lv_string.h" -#include "../../lv_ll.h" +#include "../../../lv_public_api.h" #include "../../lv_rb_private.h" -#include "../../lv_rb.h" -#include "../../lv_iter.h" +#include "../../lv_iter_private.h" /********************* * DEFINES diff --git a/src/misc/cache/class/lv_cache_lru_rb.h b/src/misc/cache/class/lv_cache_lru_rb.h index a7dbdc0995..e5924966fa 100644 --- a/src/misc/cache/class/lv_cache_lru_rb.h +++ b/src/misc/cache/class/lv_cache_lru_rb.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../lv_cache_private.h" +#include "../lv_cache.h" /********************* * DEFINES diff --git a/src/misc/cache/class/lv_cache_sc_da.c b/src/misc/cache/class/lv_cache_sc_da.c index 0dfe261ca2..6273f16cc2 100644 --- a/src/misc/cache/class/lv_cache_sc_da.c +++ b/src/misc/cache/class/lv_cache_sc_da.c @@ -57,13 +57,8 @@ #include "lv_cache_sc_da.h" #include "../lv_cache_entry.h" #include "../lv_cache_entry_private.h" -#include "../../../stdlib/lv_sprintf.h" -#include "../../../stdlib/lv_string.h" - -#include "../../lv_iter.h" -#include "../../lv_assert.h" -#include "../../lv_math.h" -#include "../../lv_types.h" +#include "../../../lv_public_api.h" +#include "../../lv_iter_private.h" /********************* * DEFINES diff --git a/src/misc/cache/class/lv_cache_sc_da.h b/src/misc/cache/class/lv_cache_sc_da.h index 8223db729d..d95a54adb1 100644 --- a/src/misc/cache/class/lv_cache_sc_da.h +++ b/src/misc/cache/class/lv_cache_sc_da.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../lv_cache_private.h" +#include "../lv_cache.h" /********************* * DEFINES diff --git a/src/misc/cache/instance/lv_image_cache.c b/src/misc/cache/instance/lv_image_cache.c index aaa236294d..4bda95d0dc 100644 --- a/src/misc/cache/instance/lv_image_cache.c +++ b/src/misc/cache/instance/lv_image_cache.c @@ -8,11 +8,12 @@ *********************/ #include "../../../draw/lv_image_decoder_private.h" -#include "../../lv_assert.h" #include "../../../core/lv_global.h" -#include "../../../misc/lv_iter.h" +#include "../../../misc/lv_iter_private.h" #include "lv_image_cache.h" +#include "lv_image_header_cache.h" +#include "../lv_cache_entry.h" /********************* * DEFINES diff --git a/src/misc/cache/instance/lv_image_cache.h b/src/misc/cache/instance/lv_image_cache.h index 2d1e827f2c..62f03e5adc 100644 --- a/src/misc/cache/instance/lv_image_cache.h +++ b/src/misc/cache/instance/lv_image_cache.h @@ -14,7 +14,9 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_types.h" +#include "../../../lv_public_api.h" +#include "../../lv_iter_private.h" +#include "../lv_cache.h" /********************* * DEFINES diff --git a/src/misc/cache/instance/lv_image_header_cache.c b/src/misc/cache/instance/lv_image_header_cache.c index de5e28750a..c9515d7be9 100644 --- a/src/misc/cache/instance/lv_image_header_cache.c +++ b/src/misc/cache/instance/lv_image_header_cache.c @@ -8,11 +8,11 @@ *********************/ #include "../../../draw/lv_image_decoder_private.h" -#include "../../lv_assert.h" #include "../../../core/lv_global.h" +#include "../lv_cache_entry.h" #include "lv_image_header_cache.h" -#include "../../lv_iter.h" +#include "../../lv_iter_private.h" /********************* * DEFINES diff --git a/src/misc/cache/instance/lv_image_header_cache.h b/src/misc/cache/instance/lv_image_header_cache.h index 44179812ab..4ee6dd0b05 100644 --- a/src/misc/cache/instance/lv_image_header_cache.h +++ b/src/misc/cache/instance/lv_image_header_cache.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_types.h" +#include "../../../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/cache/lv_cache.c b/src/misc/cache/lv_cache.c index a029db1790..7cd01fb6b7 100644 --- a/src/misc/cache/lv_cache.c +++ b/src/misc/cache/lv_cache.c @@ -7,11 +7,7 @@ * INCLUDES *********************/ #include "lv_cache.h" -#include "../../stdlib/lv_sprintf.h" -#include "../lv_assert.h" #include "lv_cache_entry_private.h" -#include "lv_cache_private.h" -#include "../lv_profiler.h" /********************* * DEFINES diff --git a/src/misc/cache/lv_cache.h b/src/misc/cache/lv_cache.h index 3e393e8732..280f8e2b4c 100644 --- a/src/misc/cache/lv_cache.h +++ b/src/misc/cache/lv_cache.h @@ -14,12 +14,9 @@ extern "C" { * INCLUDES *********************/ -#include "../lv_types.h" - -#include "lv_cache_entry.h" - -#include "class/lv_cache_class.h" -#include "instance/lv_cache_instance.h" +#include "../../lv_public_api.h" +#include "../lv_iter_private.h" +#include "../../osal/lv_os_private.h" /********************* * DEFINES @@ -29,6 +26,162 @@ extern "C" { * TYPEDEFS **********************/ +typedef struct _lv_cache_entry_t lv_cache_entry_t; +typedef struct _lv_cache_t lv_cache_t; + +/** + * The result of the cache reserve condition callback + */ +typedef enum { + LV_CACHE_RESERVE_COND_OK, /**< The condition is met and no entries need to be evicted */ + LV_CACHE_RESERVE_COND_TOO_LARGE, /**< The condition is not met and the reserve size is too large */ + LV_CACHE_RESERVE_COND_NEED_VICTIM, /**< The condition is not met and a victim is needed to be evicted */ + LV_CACHE_RESERVE_COND_ERROR /**< An error occurred while checking the condition */ +} lv_cache_reserve_cond_res_t; + + +typedef struct _lv_cache_ops_t lv_cache_ops_t; +typedef struct _lv_cache_class_t lv_cache_class_t; + +typedef int32_t lv_cache_compare_res_t; +typedef bool (*lv_cache_create_cb_t)(void * node, void * user_data); +typedef void (*lv_cache_free_cb_t)(void * node, void * user_data); +typedef lv_cache_compare_res_t (*lv_cache_compare_cb_t)(const void * a, const void * b); + +/** + * The cache instance allocation function, used by the cache class to allocate memory for cache instances. + * @return It should return a pointer to the allocated instance. + */ +typedef void * (*lv_cache_alloc_cb_t)(void); + +/** + * The cache instance initialization function, used by the cache class to initialize the cache instance. + * @return It should return true if the initialization is successful, false otherwise. + */ +typedef bool (*lv_cache_init_cb_t)(lv_cache_t * cache); + +/** + * The cache instance destruction function, used by the cache class to destroy the cache instance. + */ +typedef void (*lv_cache_destroy_cb_t)(lv_cache_t * cache, void * user_data); + +/** + * The cache get function, used by the cache class to get a cache entry by its key. + * @return `NULL` if the key is not found. + */ +typedef lv_cache_entry_t * (*lv_cache_get_cb_t)(lv_cache_t * cache, const void * key, void * user_data); + +/** + * The cache add function, used by the cache class to add a cache entry with a given key. + * This function only cares about how to add the entry, it doesn't check if the entry already exists and doesn't care about is it a victim or not. + * @return the added cache entry, or NULL if the entry is not added. + */ +typedef lv_cache_entry_t * (*lv_cache_add_cb_t)(lv_cache_t * cache, const void * key, void * user_data); + +/** + * The cache remove function, used by the cache class to remove a cache entry from the cache but doesn't free the memory.. + * This function only cares about how to remove the entry, it doesn't care about is it a victim or not. + */ +typedef void (*lv_cache_remove_cb_t)(lv_cache_t * cache, lv_cache_entry_t * entry, void * user_data); + +/** + * The cache drop function, used by the cache class to remove a cache entry from the cache and free the memory. + */ +typedef void (*lv_cache_drop_cb_t)(lv_cache_t * cache, const void * key, void * user_data); + +/** + * The cache drop all function, used by the cache class to remove all cache entries from the cache and free the memory. + */ +typedef void (*lv_cache_drop_all_cb_t)(lv_cache_t * cache, void * user_data); + +/** + * The cache get victim function, used by the cache class to get a victim entry to be evicted. + */ +typedef lv_cache_entry_t * (*lv_cache_get_victim_cb)(lv_cache_t * cache, void * user_data); + +/** + * The cache reserve condition function, used by the cache class to check if a new entry can be added to the cache without exceeding its maximum size. + * See lv_cache_reserve_cond_res_t for the possible results. + */ +typedef lv_cache_reserve_cond_res_t (*lv_cache_reserve_cond_cb)(lv_cache_t * cache, const void * key, size_t size, + void * user_data); + +/** + * The cache iterator creation function, used by the cache class to create an iterator for the cache. + * @return A pointer to the created iterator, or NULL if the iterator cannot be created. + */ +typedef lv_iter_t * (*lv_cache_iter_create_cb)(lv_cache_t * cache); + +/** + * The cache operations struct + */ +struct _lv_cache_ops_t { + lv_cache_compare_cb_t compare_cb; /**< Compare function for keys */ + lv_cache_create_cb_t create_cb; /**< Create function for nodes */ + lv_cache_free_cb_t free_cb; /**< Free function for nodes */ +}; + +/** + * The cache entry struct + */ +struct _lv_cache_t { + const lv_cache_class_t * clz; /**< Cache class. There are two built-in classes: + * - lv_cache_class_lru_rb_count for LRU-based cache with count-based eviction policy. + * - lv_cache_class_lru_rb_size for LRU-based cache with size-based eviction policy. */ + + uint32_t node_size; /**< Size of a node */ + + uint32_t max_size; /**< Maximum size of the cache */ + uint32_t size; /**< Current size of the cache */ + + lv_cache_ops_t ops; /**< Cache operations struct _lv_cache_ops_t */ + + lv_mutex_t lock; /**< Cache lock used to protect the cache in multithreading environments */ + + const char * name; /**< Name of the cache */ +}; + +/** + * Cache class struct for building custom cache classes + * + * Examples: + * - lv_cache_class_lru_rb_count for LRU-based cache with count-based eviction policy. + * - lv_cache_class_lru_rb_size for LRU-based cache with size-based eviction policy. + */ +struct _lv_cache_class_t { + lv_cache_alloc_cb_t alloc_cb; /**< The allocation function for cache entries */ + lv_cache_init_cb_t init_cb; /**< The initialization function for cache entries */ + lv_cache_destroy_cb_t destroy_cb; /**< The destruction function for cache entries */ + + lv_cache_get_cb_t get_cb; /**< The get function for cache entries */ + lv_cache_add_cb_t add_cb; /**< The add function for cache entries */ + lv_cache_remove_cb_t remove_cb; /**< The remove function for cache entries */ + lv_cache_drop_cb_t drop_cb; /**< The drop function for cache entries */ + lv_cache_drop_all_cb_t drop_all_cb; /**< The drop all function for cache entries */ + lv_cache_get_victim_cb get_victim_cb; /**< The get victim function for cache entries */ + lv_cache_reserve_cond_cb reserve_cond_cb; /**< The reserve condition function for cache entries */ + + lv_cache_iter_create_cb iter_create_cb; /**< The iterator creation function for cache entries */ +}; + +/*----------------- + * Cache entry slot + *----------------*/ + +struct _lv_cache_slot_size_t; + +typedef struct _lv_cache_slot_size_t lv_cache_slot_size_t; + +/** + * Cache entry slot struct + * + * To add new fields to the cache entry, add them to a new struct and add it to the first + * field of the cache data struct. And this one is a size slot for the cache entry. + */ +struct _lv_cache_slot_size_t { + size_t size; +}; + /********************** * GLOBAL PROTOTYPES **********************/ @@ -222,6 +375,38 @@ const char * lv_cache_get_name(lv_cache_t * cache); */ lv_iter_t * lv_cache_iter_create(lv_cache_t * cache); +/** + * Get the cache instance of a cache entry. + * @param entry The cache entry to get the cache instance of. + * @return The pointer to the cache instance of the cache entry. + */ +const lv_cache_t * lv_cache_entry_get_cache(const lv_cache_entry_t * entry); + +/** + * Allocate a cache entry. + * @param node_size The size of the node in the cache. + * @param cache The cache instance to allocate the cache entry from. + * @return The pointer to the allocated cache entry. + */ +lv_cache_entry_t * lv_cache_entry_alloc(const uint32_t node_size, const lv_cache_t * cache); + +/** + * Initialize a cache entry. + * @param entry The cache entry to initialize. + * @param cache The cache instance to allocate the cache entry from. + * @param node_size The size of the node in the cache. + */ +void lv_cache_entry_init(lv_cache_entry_t * entry, const lv_cache_t * cache, const uint32_t node_size); + +/** + * Deallocate a cache entry. And the data of the cache entry will be freed. + * @param entry The cache entry to deallocate. + */ +void lv_cache_entry_delete(lv_cache_entry_t * entry); + +#include "class/lv_cache_class.h" +#include "instance/lv_image_cache.h" + /************************* * GLOBAL VARIABLES *************************/ diff --git a/src/misc/cache/lv_cache_entry.c b/src/misc/cache/lv_cache_entry.c index 66a9f84a5f..9b2b5ae135 100644 --- a/src/misc/cache/lv_cache_entry.c +++ b/src/misc/cache/lv_cache_entry.c @@ -7,10 +7,7 @@ * INCLUDES *********************/ #include "lv_cache_entry.h" -#include "../../stdlib/lv_sprintf.h" -#include "../lv_assert.h" #include "lv_cache_entry_private.h" -#include "../../misc/lv_math.h" /********************* * DEFINES diff --git a/src/misc/cache/lv_cache_entry.h b/src/misc/cache/lv_cache_entry.h index 3c28f2d929..527f19627c 100644 --- a/src/misc/cache/lv_cache_entry.h +++ b/src/misc/cache/lv_cache_entry.h @@ -13,7 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_types.h" + +#include "lv_cache.h" /********************* * DEFINES @@ -23,6 +24,7 @@ extern "C" { * TYPEDEFS **********************/ + /********************** * GLOBAL PROTOTYPES **********************/ @@ -62,13 +64,6 @@ bool lv_cache_entry_is_invalid(lv_cache_entry_t * entry); */ void * lv_cache_entry_get_data(lv_cache_entry_t * entry); -/** - * Get the cache instance of a cache entry. - * @param entry The cache entry to get the cache instance of. - * @return The pointer to the cache instance of the cache entry. - */ -const lv_cache_t * lv_cache_entry_get_cache(const lv_cache_entry_t * entry); - /** * Get the cache entry of a data. The data should be allocated by the cache instance. * @param data The data to get the cache entry of. @@ -77,27 +72,6 @@ const lv_cache_t * lv_cache_entry_get_cache(const lv_cache_entry_t * entry); */ lv_cache_entry_t * lv_cache_entry_get_entry(void * data, const uint32_t node_size); -/** - * Allocate a cache entry. - * @param node_size The size of the node in the cache. - * @param cache The cache instance to allocate the cache entry from. - * @return The pointer to the allocated cache entry. - */ -lv_cache_entry_t * lv_cache_entry_alloc(const uint32_t node_size, const lv_cache_t * cache); - -/** - * Initialize a cache entry. - * @param entry The cache entry to initialize. - * @param cache The cache instance to allocate the cache entry from. - * @param node_size The size of the node in the cache. - */ -void lv_cache_entry_init(lv_cache_entry_t * entry, const lv_cache_t * cache, const uint32_t node_size); - -/** - * Deallocate a cache entry. And the data of the cache entry will be freed. - * @param entry The cache entry to deallocate. - */ -void lv_cache_entry_delete(lv_cache_entry_t * entry); /************************* * GLOBAL VARIABLES *************************/ diff --git a/src/misc/cache/lv_cache_entry_private.h b/src/misc/cache/lv_cache_entry_private.h index de16ff5480..217f547c19 100644 --- a/src/misc/cache/lv_cache_entry_private.h +++ b/src/misc/cache/lv_cache_entry_private.h @@ -6,7 +6,6 @@ #ifndef LV_CACHE_ENTRY_PRIVATE_H #define LV_CACHE_ENTRY_PRIVATE_H -#include #ifdef __cplusplus extern "C" { #endif @@ -14,7 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_types.h" +#include "lv_cache.h" +#include "lv_cache_entry.h" /********************* * DEFINES diff --git a/src/misc/cache/lv_cache_private.h b/src/misc/cache/lv_cache_private.h deleted file mode 100644 index 1f3e6ef175..0000000000 --- a/src/misc/cache/lv_cache_private.h +++ /dev/null @@ -1,199 +0,0 @@ -/** -* @file lv_cache_private.h -* -*/ - -#ifndef LV_CACHE_PRIVATE_H -#define LV_CACHE_PRIVATE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_types.h" -#include "../../osal/lv_os_private.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * The result of the cache reserve condition callback - */ -typedef enum { - LV_CACHE_RESERVE_COND_OK, /**< The condition is met and no entries need to be evicted */ - LV_CACHE_RESERVE_COND_TOO_LARGE, /**< The condition is not met and the reserve size is too large */ - LV_CACHE_RESERVE_COND_NEED_VICTIM, /**< The condition is not met and a victim is needed to be evicted */ - LV_CACHE_RESERVE_COND_ERROR /**< An error occurred while checking the condition */ -} lv_cache_reserve_cond_res_t; - -struct _lv_cache_ops_t; -struct _lv_cache_t; -struct _lv_cache_class_t; -struct _lv_cache_entry_t; - -typedef struct _lv_cache_ops_t lv_cache_ops_t; -typedef struct _lv_cache_class_t lv_cache_class_t; - -typedef int32_t lv_cache_compare_res_t; -typedef bool (*lv_cache_create_cb_t)(void * node, void * user_data); -typedef void (*lv_cache_free_cb_t)(void * node, void * user_data); -typedef lv_cache_compare_res_t (*lv_cache_compare_cb_t)(const void * a, const void * b); - -/** - * The cache instance allocation function, used by the cache class to allocate memory for cache instances. - * @return It should return a pointer to the allocated instance. - */ -typedef void * (*lv_cache_alloc_cb_t)(void); - -/** - * The cache instance initialization function, used by the cache class to initialize the cache instance. - * @return It should return true if the initialization is successful, false otherwise. - */ -typedef bool (*lv_cache_init_cb_t)(lv_cache_t * cache); - -/** - * The cache instance destruction function, used by the cache class to destroy the cache instance. - */ -typedef void (*lv_cache_destroy_cb_t)(lv_cache_t * cache, void * user_data); - -/** - * The cache get function, used by the cache class to get a cache entry by its key. - * @return `NULL` if the key is not found. - */ -typedef lv_cache_entry_t * (*lv_cache_get_cb_t)(lv_cache_t * cache, const void * key, void * user_data); - -/** - * The cache add function, used by the cache class to add a cache entry with a given key. - * This function only cares about how to add the entry, it doesn't check if the entry already exists and doesn't care about is it a victim or not. - * @return the added cache entry, or NULL if the entry is not added. - */ -typedef lv_cache_entry_t * (*lv_cache_add_cb_t)(lv_cache_t * cache, const void * key, void * user_data); - -/** - * The cache remove function, used by the cache class to remove a cache entry from the cache but doesn't free the memory.. - * This function only cares about how to remove the entry, it doesn't care about is it a victim or not. - */ -typedef void (*lv_cache_remove_cb_t)(lv_cache_t * cache, lv_cache_entry_t * entry, void * user_data); - -/** - * The cache drop function, used by the cache class to remove a cache entry from the cache and free the memory. - */ -typedef void (*lv_cache_drop_cb_t)(lv_cache_t * cache, const void * key, void * user_data); - -/** - * The cache drop all function, used by the cache class to remove all cache entries from the cache and free the memory. - */ -typedef void (*lv_cache_drop_all_cb_t)(lv_cache_t * cache, void * user_data); - -/** - * The cache get victim function, used by the cache class to get a victim entry to be evicted. - */ -typedef lv_cache_entry_t * (*lv_cache_get_victim_cb)(lv_cache_t * cache, void * user_data); - -/** - * The cache reserve condition function, used by the cache class to check if a new entry can be added to the cache without exceeding its maximum size. - * See lv_cache_reserve_cond_res_t for the possible results. - */ -typedef lv_cache_reserve_cond_res_t (*lv_cache_reserve_cond_cb)(lv_cache_t * cache, const void * key, size_t size, - void * user_data); - -/** - * The cache iterator creation function, used by the cache class to create an iterator for the cache. - * @return A pointer to the created iterator, or NULL if the iterator cannot be created. - */ -typedef lv_iter_t * (*lv_cache_iter_create_cb)(lv_cache_t * cache); - -/** - * The cache operations struct - */ -struct _lv_cache_ops_t { - lv_cache_compare_cb_t compare_cb; /**< Compare function for keys */ - lv_cache_create_cb_t create_cb; /**< Create function for nodes */ - lv_cache_free_cb_t free_cb; /**< Free function for nodes */ -}; - -/** - * The cache entry struct - */ -struct _lv_cache_t { - const lv_cache_class_t * clz; /**< Cache class. There are two built-in classes: - * - lv_cache_class_lru_rb_count for LRU-based cache with count-based eviction policy. - * - lv_cache_class_lru_rb_size for LRU-based cache with size-based eviction policy. */ - - uint32_t node_size; /**< Size of a node */ - - uint32_t max_size; /**< Maximum size of the cache */ - uint32_t size; /**< Current size of the cache */ - - lv_cache_ops_t ops; /**< Cache operations struct _lv_cache_ops_t */ - - lv_mutex_t lock; /**< Cache lock used to protect the cache in multithreading environments */ - - const char * name; /**< Name of the cache */ -}; - -/** - * Cache class struct for building custom cache classes - * - * Examples: - * - lv_cache_class_lru_rb_count for LRU-based cache with count-based eviction policy. - * - lv_cache_class_lru_rb_size for LRU-based cache with size-based eviction policy. - */ -struct _lv_cache_class_t { - lv_cache_alloc_cb_t alloc_cb; /**< The allocation function for cache entries */ - lv_cache_init_cb_t init_cb; /**< The initialization function for cache entries */ - lv_cache_destroy_cb_t destroy_cb; /**< The destruction function for cache entries */ - - lv_cache_get_cb_t get_cb; /**< The get function for cache entries */ - lv_cache_add_cb_t add_cb; /**< The add function for cache entries */ - lv_cache_remove_cb_t remove_cb; /**< The remove function for cache entries */ - lv_cache_drop_cb_t drop_cb; /**< The drop function for cache entries */ - lv_cache_drop_all_cb_t drop_all_cb; /**< The drop all function for cache entries */ - lv_cache_get_victim_cb get_victim_cb; /**< The get victim function for cache entries */ - lv_cache_reserve_cond_cb reserve_cond_cb; /**< The reserve condition function for cache entries */ - - lv_cache_iter_create_cb iter_create_cb; /**< The iterator creation function for cache entries */ -}; - -/*----------------- - * Cache entry slot - *----------------*/ - -struct _lv_cache_slot_size_t; - -typedef struct _lv_cache_slot_size_t lv_cache_slot_size_t; - -/** - * Cache entry slot struct - * - * To add new fields to the cache entry, add them to a new struct and add it to the first - * field of the cache data struct. And this one is a size slot for the cache entry. - */ -struct _lv_cache_slot_size_t { - size_t size; -}; -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/************************* - * GLOBAL VARIABLES - *************************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CACHE_PRIVATE_H*/ diff --git a/src/misc/lv_anim.c b/src/misc/lv_anim.c index 23f04797d9..291f20c2d1 100644 --- a/src/misc/lv_anim.c +++ b/src/misc/lv_anim.c @@ -9,12 +9,6 @@ #include "lv_anim_private.h" #include "../core/lv_global.h" -#include "../tick/lv_tick.h" -#include "lv_assert.h" -#include "lv_timer.h" -#include "lv_math.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/misc/lv_anim.h b/src/misc/lv_anim.h index 10416892b3..de104b5890 100644 --- a/src/misc/lv_anim.h +++ b/src/misc/lv_anim.h @@ -1,593 +1,2 @@ -/** - * @file lv_anim.h - * - */ - -#ifndef LV_ANIM_H -#define LV_ANIM_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_ext_data.h" -#include "lv_types.h" -#include "lv_math.h" -#include "lv_timer.h" -#include "lv_ll.h" - -/********************* - * DEFINES - *********************/ - -#define LV_ANIM_REPEAT_INFINITE 0xFFFFFFFF -#define LV_ANIM_PLAYTIME_INFINITE 0xFFFFFFFF -#define LV_ANIM_PAUSE_FOREVER 0xFFFFFFFF - -/* - * Macros used to set cubic-bezier anim parameter. - * Parameters come from https://easings.net/ - * - * Usage: - * - * lv_anim_t a; - * lv_anim_init(&a); - * ... - * lv_anim_set_path_cb(&a, lv_anim_path_custom_bezier3); - * LV_ANIM_SET_EASE_IN_SINE(&a); //Set cubic-bezier anim parameter to easeInSine - * ... - * lv_anim_start(&a); - */ - -#define _PARA(a, x1, y1, x2, y2) ((a)->parameter.bezier3 = \ -(lv_anim_bezier3_para_t) { \ - LV_BEZIER_VAL_FLOAT(x1), LV_BEZIER_VAL_FLOAT(y1), \ - LV_BEZIER_VAL_FLOAT(x2), LV_BEZIER_VAL_FLOAT(y2) } \ - ) - -#define LV_ANIM_SET_EASE_IN_SINE(a) _PARA(a, 0.12, 0, 0.39, 0) -#define LV_ANIM_SET_EASE_OUT_SINE(a) _PARA(a, 0.61, 1, 0.88, 1) -#define LV_ANIM_SET_EASE_IN_OUT_SINE(a) _PARA(a, 0.37, 0, 0.63, 1) -#define LV_ANIM_SET_EASE_IN_QUAD(a) _PARA(a, 0.11, 0, 0.5, 0) -#define LV_ANIM_SET_EASE_OUT_QUAD(a) _PARA(a, 0.5, 1, 0.89, 1) -#define LV_ANIM_SET_EASE_IN_OUT_QUAD(a) _PARA(a, 0.45, 0, 0.55, 1) -#define LV_ANIM_SET_EASE_IN_CUBIC(a) _PARA(a, 0.32, 0, 0.67, 0) -#define LV_ANIM_SET_EASE_OUT_CUBIC(a) _PARA(a, 0.33, 1, 0.68, 1) -#define LV_ANIM_SET_EASE_IN_OUT_CUBIC(a) _PARA(a, 0.65, 0, 0.35, 1) -#define LV_ANIM_SET_EASE_IN_QUART(a) _PARA(a, 0.5, 0, 0.75, 0) -#define LV_ANIM_SET_EASE_OUT_QUART(a) _PARA(a, 0.25, 1, 0.5, 1) -#define LV_ANIM_SET_EASE_IN_OUT_QUART(a) _PARA(a, 0.76, 0, 0.24, 1) -#define LV_ANIM_SET_EASE_IN_QUINT(a) _PARA(a, 0.64, 0, 0.78, 0) -#define LV_ANIM_SET_EASE_OUT_QUINT(a) _PARA(a, 0.22, 1, 0.36, 1) -#define LV_ANIM_SET_EASE_IN_OUT_QUINT(a) _PARA(a, 0.83, 0, 0.17, 1) -#define LV_ANIM_SET_EASE_IN_EXPO(a) _PARA(a, 0.7, 0, 0.84, 0) -#define LV_ANIM_SET_EASE_OUT_EXPO(a) _PARA(a, 0.16, 1, 0.3, 1) -#define LV_ANIM_SET_EASE_IN_OUT_EXPO(a) _PARA(a, 0.87, 0, 0.13, 1) -#define LV_ANIM_SET_EASE_IN_CIRC(a) _PARA(a, 0.55, 0, 1, 0.45) -#define LV_ANIM_SET_EASE_OUT_CIRC(a) _PARA(a, 0, 0.55, 0.45, 1) -#define LV_ANIM_SET_EASE_IN_OUT_CIRC(a) _PARA(a, 0.85, 0, 0.15, 1) -#define LV_ANIM_SET_EASE_IN_BACK(a) _PARA(a, 0.36, 0, 0.66, -0.56) -#define LV_ANIM_SET_EASE_OUT_BACK(a) _PARA(a, 0.34, 1.56, 0.64, 1) -#define LV_ANIM_SET_EASE_IN_OUT_BACK(a) _PARA(a, 0.68, -0.6, 0.32, 1.6) - -LV_EXPORT_CONST_INT(LV_ANIM_REPEAT_INFINITE); -LV_EXPORT_CONST_INT(LV_ANIM_PLAYTIME_INFINITE); - -/********************** - * TYPEDEFS - **********************/ - -/** Can be used to indicate if animations are enabled or disabled in a case*/ -#define LV_ANIM_OFF false -#define LV_ANIM_ON true -typedef bool lv_anim_enable_t; - -/** Get the current value during an animation*/ -typedef int32_t (*lv_anim_path_cb_t)(const lv_anim_t *); - -/** Generic prototype of "animator" functions. - * First parameter is the variable to animate. - * Second parameter is the value to set. - * Compatible with `lv_xxx_set_yyy(obj, value)` functions - * The `x` in `_xcb_t` means it's not a fully generic prototype because - * it doesn't receive `lv_anim_t *` as its first argument*/ -typedef void (*lv_anim_exec_xcb_t)(void *, int32_t); - -/** Same as `lv_anim_exec_xcb_t` but receives `lv_anim_t *` as the first parameter. - * It's more consistent but less convenient. Might be used by binding generator functions.*/ -typedef void (*lv_anim_custom_exec_cb_t)(lv_anim_t *, int32_t); - -/** Callback to call when the animation is ready*/ -typedef void (*lv_anim_completed_cb_t)(lv_anim_t *); - -/** Callback to call when the animation really stars (considering `delay`)*/ -typedef void (*lv_anim_start_cb_t)(lv_anim_t *); - -/** Callback used when the animation values are relative to get the current value*/ -typedef int32_t (*lv_anim_get_value_cb_t)(lv_anim_t *); - -/** Callback used when the animation is deleted*/ -typedef void (*lv_anim_deleted_cb_t)(lv_anim_t *); - -/** Parameter used when path is custom_bezier */ -typedef struct { - int16_t x1; - int16_t y1; - int16_t x2; - int16_t y2; -} lv_anim_bezier3_para_t; - -/** Describes an animation*/ -struct _lv_anim_t { -#if LV_USE_EXT_DATA - lv_ext_data_t ext_data; -#endif - void * var; /**< Variable (Widget or other user-provided object) to animate */ - lv_anim_exec_xcb_t exec_cb; /**< Function to execute to animate */ - lv_anim_custom_exec_cb_t custom_exec_cb; /**< Function to execute to animate, - * same purpose as exec_cb but different parameters */ - lv_anim_start_cb_t start_cb; /**< Call it when animation is starts (considering `delay`) */ - lv_anim_completed_cb_t completed_cb; /**< Call it when animation is fully completed */ - lv_anim_deleted_cb_t deleted_cb; /**< Call it when animation is deleted */ - lv_anim_get_value_cb_t get_value_cb; /**< Get current value in relative mode */ - void * user_data; /**< Custom user data */ - lv_anim_path_cb_t path_cb; /**< Provides path (curve) of animation */ - int32_t start_value; /**< Start value */ - int32_t current_value; /**< Current value */ - int32_t end_value; /**< End value */ - int32_t duration; /**< Animation duration in ms */ - int32_t act_time; /**< Ms elapsed since animation started. Set to negative to make delay. */ - uint32_t reverse_delay; /**< Wait (in ms) after forward play ends and before reverse play begins. */ - uint32_t reverse_duration; /**< Reverse animation duration in ms */ - uint32_t repeat_delay; /**< Wait before repeating */ - uint32_t repeat_cnt; /**< Repeat count for animation */ - union _lv_anim_path_para_t { - lv_anim_bezier3_para_t bezier3; /**< Parameter used when path is custom_bezier */ - } parameter; - - /* Animation system use these - user shouldn't set */ - uint32_t last_timer_run; - uint32_t pause_time; /**parameter.bezier3 - * @param a pointer to an animation - * @return the current value to set - */ -int32_t lv_anim_path_custom_bezier3(const lv_anim_t * a); - -#if LV_USE_EXT_DATA -/** - * @brief Associates external user data with an animation instance - * - * Attaches arbitrary user-defined data to an LVGL animation object along with an optional - * destructor callback that will be automatically invoked when the animation completes - * or is deleted, enabling proper resource cleanup. - * - * @param anim Pointer to the animation object to configure - * @param data User-defined data pointer to associate - * @param free_cb Cleanup callback that receives ext_data when: - * - Animation completes naturally - * - Animation is deleted prematurely - * - New data replaces current association - * NULL indicates no cleanup required - */ -void lv_anim_set_external_data(lv_anim_t * anim, void * data, void (* free_cb)(void * data)); -#endif - -/********************** - * GLOBAL VARIABLES - **********************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ANIM_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_anim_private.h b/src/misc/lv_anim_private.h index 83e4cd6bef..62afeecc08 100644 --- a/src/misc/lv_anim_private.h +++ b/src/misc/lv_anim_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_anim.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_anim_timeline.c b/src/misc/lv_anim_timeline.c index a3cb876169..6cfd8a12c1 100644 --- a/src/misc/lv_anim_timeline.c +++ b/src/misc/lv_anim_timeline.c @@ -6,14 +6,9 @@ /********************* * INCLUDES *********************/ + #include "lv_anim_private.h" -#include "lv_assert.h" #include "lv_anim_timeline_private.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" -#if LV_USE_OBJ_NAME - #include "../core/lv_obj_tree.h" -#endif /********************* * DEFINES diff --git a/src/misc/lv_anim_timeline.h b/src/misc/lv_anim_timeline.h index 941d315526..1c4e204e3c 100644 --- a/src/misc/lv_anim_timeline.h +++ b/src/misc/lv_anim_timeline.h @@ -1,179 +1,2 @@ -/** - * @file lv_anim_timeline.h - * - */ - -#ifndef LV_ANIM_TIMELINE_H -#define LV_ANIM_TIMELINE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_anim.h" - -/********************* - * DEFINES - *********************/ - -#define LV_ANIM_TIMELINE_PROGRESS_MAX 0xFFFF - -/********************** - * TYPEDEFS - **********************/ - -/*Data of anim_timeline_dsc*/ -typedef struct _lv_anim_timeline_dsc_t { - lv_anim_t anim; - uint32_t start_time; - uint8_t is_started : 1; - uint8_t is_completed : 1; -} lv_anim_timeline_dsc_t; - - -/********************** -* GLOBAL PROTOTYPES -**********************/ - -/** - * Create an animation timeline. - * @return pointer to the animation timeline. - */ -lv_anim_timeline_t * lv_anim_timeline_create(void); - -/** - * Delete animation timeline. - * @param at pointer to the animation timeline. - */ -void lv_anim_timeline_delete(lv_anim_timeline_t * at); - -/** - * Add animation to the animation timeline. - * @param at pointer to the animation timeline. - * @param start_time the time the animation started on the timeline, note that start_time will override the value of delay. - * @param a pointer to an animation. - */ -void lv_anim_timeline_add(lv_anim_timeline_t * at, uint32_t start_time, const lv_anim_t * a); - -/** - * Start the animation timeline. - * @param at pointer to the animation timeline. - * @return total time spent in animation timeline. - */ -uint32_t lv_anim_timeline_start(lv_anim_timeline_t * at); - -/** - * Pause the animation timeline. - * @param at pointer to the animation timeline. - */ -void lv_anim_timeline_pause(lv_anim_timeline_t * at); - -/** - * Set the playback direction of the animation timeline. - * @param at pointer to the animation timeline. - * @param reverse whether to play in reverse. - */ -void lv_anim_timeline_set_reverse(lv_anim_timeline_t * at, bool reverse); - -/** - * Set the time to wait before starting the animation. - * Applies only when playing from the very start, or reverse from the very end. - * @param at pointer to an animation timeline - * @param delay the delay time in milliseconds - */ -void lv_anim_timeline_set_delay(lv_anim_timeline_t * at, uint32_t delay); - -/** - * Make the animation timeline repeat itself. - * @param at pointer to the animation timeline. - * @param cnt repeat count or `LV_ANIM_REPEAT_INFINITE` for infinite repetition. 0: to disable repetition. - */ -void lv_anim_timeline_set_repeat_count(lv_anim_timeline_t * at, uint32_t cnt); - -/** - * Set a delay before repeating the animation timeline. - * @param at pointer to the animation timeline. - * @param delay delay in milliseconds before repeating the animation timeline. - */ -void lv_anim_timeline_set_repeat_delay(lv_anim_timeline_t * at, uint32_t delay); - -/** - * Set the progress of the animation timeline. - * @param at pointer to the animation timeline. - * @param progress set value 0~65535 to map 0~100% animation progress. - */ -void lv_anim_timeline_set_progress(lv_anim_timeline_t * at, uint16_t progress); - -/** - * Set the user_data of a an animation timeline - * @param at pointer to the animation timeline. - * @param user_data pointer to any data. Only the pointer will be saved. - */ -void lv_anim_timeline_set_user_data(lv_anim_timeline_t * at, void * user_data); - -/** - * Get the time used to play the animation timeline. - * @param at pointer to the animation timeline. - * @return total time spent in animation timeline. - */ -uint32_t lv_anim_timeline_get_playtime(lv_anim_timeline_t * at); - -/** - * Get whether the animation timeline is played in reverse. - * @param at pointer to the animation timeline. - * @return return true if it is reverse playback. - */ -bool lv_anim_timeline_get_reverse(lv_anim_timeline_t * at); - -/** - * Get the wait time when playing from the very start, or reverse from the very end. - * @param at pointer to an animation timeline - * @return the remaining time in milliseconds - */ -uint32_t lv_anim_timeline_get_delay(lv_anim_timeline_t * at); - -/** - * Get the progress of the animation timeline. - * @param at pointer to the animation timeline. - * @return return value 0~65535 to map 0~100% animation progress. - */ -uint16_t lv_anim_timeline_get_progress(lv_anim_timeline_t * at); - -/** - * Get repeat count of the animation timeline. - * @param at pointer to the animation timeline. - */ -uint32_t lv_anim_timeline_get_repeat_count(lv_anim_timeline_t * at); - -/** - * Get repeat delay of the animation timeline. - * @param at pointer to the animation timeline. - */ -uint32_t lv_anim_timeline_get_repeat_delay(lv_anim_timeline_t * at); - -/** - * Get the user_data of a an animation timeline - * @param at pointer to the animation timeline. - */ -void * lv_anim_timeline_get_user_data(lv_anim_timeline_t * at); - -/** - * Merge (add) all animations of a timeline to another - * @param dest merge animation into this timeline - * @param src merge the animations of this timeline - * @param delay add the animations with this extra delay - */ -void lv_anim_timeline_merge(lv_anim_timeline_t * dest, const lv_anim_timeline_t * src, int32_t delay); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ANIM_TIMELINE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_anim_timeline_private.h b/src/misc/lv_anim_timeline_private.h index cf94baed30..8f3e66d22b 100644 --- a/src/misc/lv_anim_timeline_private.h +++ b/src/misc/lv_anim_timeline_private.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "lv_anim_timeline.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_area.c b/src/misc/lv_area.c index 34743e8e54..ee57424cef 100644 --- a/src/misc/lv_area.c +++ b/src/misc/lv_area.c @@ -6,11 +6,10 @@ /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "../lv_public_api.h" #include "../core/lv_global.h" #include "lv_area_private.h" -#include "lv_math.h" /********************* * DEFINES diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index 0798c74fb7..f7f2f9bd77 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -1,254 +1,2 @@ -/** - * @file lv_area.h - * - */ - -#ifndef LV_AREA_H -#define LV_AREA_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_types.h" -#include "lv_math.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * Represents a point on the screen. - */ -typedef struct { - int32_t x; - int32_t y; -} lv_point_t; - -typedef struct { - lv_value_precise_t x; - lv_value_precise_t y; -} lv_point_precise_t; - -/** Represents an area of the screen.*/ -typedef struct { - int32_t x1; - int32_t y1; - int32_t x2; - int32_t y2; -} lv_area_t; - -/** Alignments*/ - -typedef enum { - LV_ALIGN_DEFAULT = 0, - LV_ALIGN_TOP_LEFT, - LV_ALIGN_TOP_MID, - LV_ALIGN_TOP_RIGHT, - LV_ALIGN_BOTTOM_LEFT, - LV_ALIGN_BOTTOM_MID, - LV_ALIGN_BOTTOM_RIGHT, - LV_ALIGN_LEFT_MID, - LV_ALIGN_RIGHT_MID, - LV_ALIGN_CENTER, - - LV_ALIGN_OUT_TOP_LEFT, - LV_ALIGN_OUT_TOP_MID, - LV_ALIGN_OUT_TOP_RIGHT, - LV_ALIGN_OUT_BOTTOM_LEFT, - LV_ALIGN_OUT_BOTTOM_MID, - LV_ALIGN_OUT_BOTTOM_RIGHT, - LV_ALIGN_OUT_LEFT_TOP, - LV_ALIGN_OUT_LEFT_MID, - LV_ALIGN_OUT_LEFT_BOTTOM, - LV_ALIGN_OUT_RIGHT_TOP, - LV_ALIGN_OUT_RIGHT_MID, - LV_ALIGN_OUT_RIGHT_BOTTOM, -} lv_align_t; - -typedef enum { - LV_DIR_NONE = 0x00, - LV_DIR_LEFT = (1 << 0), - LV_DIR_RIGHT = (1 << 1), - LV_DIR_TOP = (1 << 2), - LV_DIR_BOTTOM = (1 << 3), - LV_DIR_HOR = LV_DIR_LEFT | LV_DIR_RIGHT, - LV_DIR_VER = LV_DIR_TOP | LV_DIR_BOTTOM, - LV_DIR_ALL = LV_DIR_HOR | LV_DIR_VER, -} lv_dir_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize an area - * @param area_p pointer to an area - * @param x1 left coordinate of the area - * @param y1 top coordinate of the area - * @param x2 right coordinate of the area - * @param y2 bottom coordinate of the area - */ -void lv_area_set(lv_area_t * area_p, int32_t x1, int32_t y1, int32_t x2, int32_t y2); - -/** - * Copy an area - * @param dest pointer to the destination area - * @param src pointer to the source area - */ -inline static void lv_area_copy(lv_area_t * dest, const lv_area_t * src) -{ - dest->x1 = src->x1; - dest->y1 = src->y1; - dest->x2 = src->x2; - dest->y2 = src->y2; -} - -/** - * Get the width of an area - * @param area_p pointer to an area - * @return the width of the area (if x1 == x2 -> width = 1) - */ -int32_t lv_area_get_width(const lv_area_t * area_p); - -/** - * Get the height of an area - * @param area_p pointer to an area - * @return the height of the area (if y1 == y2 -> height = 1) - */ -int32_t lv_area_get_height(const lv_area_t * area_p); - -/** - * Set the width of an area - * @param area_p pointer to an area - * @param w the new width of the area (w == 1 makes x1 == x2) - */ -void lv_area_set_width(lv_area_t * area_p, int32_t w); - -/** - * Set the height of an area - * @param area_p pointer to an area - * @param h the new height of the area (h == 1 makes y1 == y2) - */ -void lv_area_set_height(lv_area_t * area_p, int32_t h); - -/** - * Return with area of an area (x * y) - * @param area_p pointer to an area - * @return size of area - */ -uint32_t lv_area_get_size(const lv_area_t * area_p); - -void lv_area_increase(lv_area_t * area, int32_t w_extra, int32_t h_extra); - -void lv_area_move(lv_area_t * area, int32_t x_ofs, int32_t y_ofs); - -/** - * Align an area to another - * @param base an area where the other will be aligned - * @param to_align the area to align - * @param align `LV_ALIGN_...` - * @param ofs_x X offset - * @param ofs_y Y offset - */ -void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t align, int32_t ofs_x, int32_t ofs_y); - -/** - * Transform a point - * @param point pointer to a point - * @param angle angle with 0.1 resolutions (123 means 12.3°) - * @param scale_x horizontal zoom, 256 means 100% - * @param scale_y vertical zoom, 256 means 100% - * @param pivot pointer to the pivot point of the transformation - * @param zoom_first true: zoom first and rotate after that; else: opposite order - */ -void lv_point_transform(lv_point_t * point, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t * pivot, - bool zoom_first); - -/** - * Transform an array of points - * @param points pointer to an array of points - * @param count number of points in the array - * @param angle angle with 0.1 resolutions (123 means 12.3°) - * @param scale_x horizontal zoom, 256 means 100% - * @param scale_y vertical zoom, 256 means 100% - * @param pivot pointer to the pivot point of the transformation - * @param zoom_first true: zoom first and rotate after that; else: opposite order - */ -void lv_point_array_transform(lv_point_t * points, size_t count, int32_t angle, int32_t scale_x, int32_t scale_y, - const lv_point_t * pivot, - bool zoom_first); - -lv_point_t lv_point_from_precise(const lv_point_precise_t * p); - -lv_point_precise_t lv_point_to_precise(const lv_point_t * p); - -void lv_point_set(lv_point_t * p, int32_t x, int32_t y); - -void lv_point_precise_set(lv_point_precise_t * p, lv_value_precise_t x, lv_value_precise_t y); - -void lv_point_swap(lv_point_t * p1, lv_point_t * p2); - -void lv_point_precise_swap(lv_point_precise_t * p1, lv_point_precise_t * p2); - -/********************** - * MACROS - **********************/ - -#define LV_COORD_TYPE_SHIFT (29U) - -#define LV_COORD_TYPE_MASK (3 << LV_COORD_TYPE_SHIFT) -#define LV_COORD_TYPE(x) ((x) & LV_COORD_TYPE_MASK) /*Extract type specifiers*/ -#define LV_COORD_PLAIN(x) ((x) & ~LV_COORD_TYPE_MASK) /*Remove type specifiers*/ - -#define LV_COORD_TYPE_PX (0 << LV_COORD_TYPE_SHIFT) -#define LV_COORD_TYPE_SPEC (1 << LV_COORD_TYPE_SHIFT) -#define LV_COORD_TYPE_PX_NEG (3 << LV_COORD_TYPE_SHIFT) - -#define LV_COORD_IS_PX(x) (LV_COORD_TYPE(x) == LV_COORD_TYPE_PX || LV_COORD_TYPE(x) == LV_COORD_TYPE_PX_NEG) -#define LV_COORD_IS_SPEC(x) (LV_COORD_TYPE(x) == LV_COORD_TYPE_SPEC) - -#define LV_COORD_SET_SPEC(x) ((x) | LV_COORD_TYPE_SPEC) - -/** Max coordinate value */ -#define LV_COORD_MAX ((1 << LV_COORD_TYPE_SHIFT) - 1) -#define LV_COORD_MIN (-LV_COORD_MAX) - -/*Special coordinates*/ -#define LV_SIZE_CONTENT LV_COORD_SET_SPEC(LV_COORD_MAX) -#define LV_PCT_STORED_MAX (LV_COORD_MAX - 1) -#if LV_PCT_STORED_MAX % 2 != 0 -#error LV_PCT_STORED_MAX should be an even number -#endif -#define LV_PCT_POS_MAX (LV_PCT_STORED_MAX / 2) -#define LV_PCT(x) (LV_COORD_SET_SPEC(((x) < 0 ? (LV_PCT_POS_MAX - LV_MAX((x), -LV_PCT_POS_MAX)) : LV_MIN((x), LV_PCT_POS_MAX)))) -#define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && LV_COORD_PLAIN(x) <= LV_PCT_STORED_MAX)) -#define LV_COORD_GET_PCT(x) (LV_COORD_PLAIN(x) > LV_PCT_POS_MAX ? LV_PCT_POS_MAX - LV_COORD_PLAIN(x) : LV_COORD_PLAIN(x)) - -LV_EXPORT_CONST_INT(LV_COORD_MAX); -LV_EXPORT_CONST_INT(LV_COORD_MIN); -LV_EXPORT_CONST_INT(LV_SIZE_CONTENT); - -/** - * Convert a percentage value to `int32_t`. - * Percentage values are stored in special range - * @param x the percentage (0..1000) - * @return a coordinate that stores the percentage - */ -int32_t lv_pct(int32_t x); - -int32_t lv_pct_to_px(int32_t v, int32_t base); - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_area_private.h b/src/misc/lv_area_private.h index bebca59406..96df87404b 100644 --- a/src/misc/lv_area_private.h +++ b/src/misc/lv_area_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_area.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_array.c b/src/misc/lv_array.c index f41a35c386..c4acfbae96 100644 --- a/src/misc/lv_array.c +++ b/src/misc/lv_array.c @@ -7,12 +7,8 @@ /********************* * INCLUDES *********************/ -#include "lv_array.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" +#include "../lv_public_api.h" -#include "lv_assert.h" -#include "lv_types.h" /********************* * DEFINES *********************/ diff --git a/src/misc/lv_array.h b/src/misc/lv_array.h index 3559e208b3..56875ba9a7 100644 --- a/src/misc/lv_array.h +++ b/src/misc/lv_array.h @@ -1,240 +1,3 @@ -/** - * @file lv_array.h - * Array. The elements are dynamically allocated by the 'lv_mem' module. - */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file -#ifndef LV_ARRAY_H -#define LV_ARRAY_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -#ifndef LV_ARRAY_DEFAULT_CAPACITY -#define LV_ARRAY_DEFAULT_CAPACITY 4 -#endif - -#ifndef LV_ARRAY_DEFAULT_SHRINK_RATIO -#define LV_ARRAY_DEFAULT_SHRINK_RATIO 2 -#endif - -/********************** - * TYPEDEFS - **********************/ - -/** Description of a array*/ -struct _lv_array_t { - uint8_t * data; - uint32_t size; - uint32_t capacity; - uint32_t element_size; - - bool inner_alloc; /* true: data is allocated by the array; false: data is allocated by the user */ -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Init an array. - * @param array pointer to an `lv_array_t` variable to initialize - * @param capacity the initial capacity of the array - * @param element_size the size of an element in bytes - */ -void lv_array_init(lv_array_t * array, uint32_t capacity, uint32_t element_size); - -/** - * Init an array from a buffer. - * @note The buffer must be large enough to store `capacity` elements. The array will not release the buffer and reallocate it. - * The user must ensure that the buffer is valid during the lifetime of the array. And release the buffer when the array is no longer needed. - * @param array pointer to an `lv_array_t` variable to initialize - * @param buf pointer to a buffer to use as the array's data - * @param capacity the initial capacity of the array - * @param element_size the size of an element in bytes - */ -void lv_array_init_from_buf(lv_array_t * array, void * buf, uint32_t capacity, uint32_t element_size); - -/** - * Resize the array to the given capacity. - * @note if the new capacity is smaller than the current size, the array will be truncated. - * @param array pointer to an `lv_array_t` variable - * @param new_capacity the new capacity of the array - */ -bool lv_array_resize(lv_array_t * array, uint32_t new_capacity); - -/** - * Deinit the array, and free the allocated memory - * @param array pointer to an `lv_array_t` variable to deinitialize - */ -void lv_array_deinit(lv_array_t * array); - -/** - * Return how many elements are stored in the array. - * @param array pointer to an `lv_array_t` variable - * @return the number of elements stored in the array - */ -static inline uint32_t lv_array_size(const lv_array_t * array) -{ - return array->size; -} - -/** - * Return the capacity of the array, i.e. how many elements can be stored. - * @param array pointer to an `lv_array_t` variable - * @return the capacity of the array - */ -static inline uint32_t lv_array_capacity(const lv_array_t * array) -{ - return array->capacity; -} - -/** - * Return if the array is empty - * @param array pointer to an `lv_array_t` variable - * @return true: array is empty; false: array is not empty - */ -static inline bool lv_array_is_empty(const lv_array_t * array) -{ - return array->size == 0; -} - -/** - * Return if the array is full - * @param array pointer to an `lv_array_t` variable - * @return true: array is full; false: array is not full - */ -static inline bool lv_array_is_full(const lv_array_t * array) -{ - return array->size == array->capacity; -} - -/** - * Copy an array to another. - * @note this will create a new array with the same capacity and size as the source array. - * @param target pointer to an `lv_array_t` variable to copy to - * @param source pointer to an `lv_array_t` variable to copy from - */ -void lv_array_copy(lv_array_t * target, const lv_array_t * source); - -/** - * Remove all elements in array. - * @param array pointer to an `lv_array_t` variable - */ -static inline void lv_array_clear(lv_array_t * array) -{ - array->size = 0; -} - -/** - * Shrink the memory capacity of array if necessary. - * @param array pointer to an `lv_array_t` variable - */ -void lv_array_shrink(lv_array_t * array); - -/** - * Remove the element at the specified position in the array. - * - * This function keeps the array order. Complexity is O(n) - * - * @param array pointer to an `lv_array_t` variable - * @param index the index of the element to remove - * @return LV_RESULT_OK: success, otherwise: error - */ -lv_result_t lv_array_remove(lv_array_t * array, uint32_t index); - -/** - * Remove the element at the specified position in the array. - * - * This function does not guarantee the array order. Complexity is O(1) - * - * @param array pointer to an `lv_array_t` variable - * @param index the index of the element to remove - * @return LV_RESULT_OK: success, otherwise: error - */ -lv_result_t lv_array_remove_unordered(lv_array_t * array, uint32_t index); - -/** - * Remove from the array either a single element or a range of elements ([start, end)). - * @note This effectively reduces the container size by the number of elements removed. - * @note When start equals to end, the function has no effect. - * @param array pointer to an `lv_array_t` variable - * @param start the index of the first element to be removed - * @param end the index of the first element that is not to be removed - * @return LV_RESULT_OK: success, otherwise: error - */ -lv_result_t lv_array_erase(lv_array_t * array, uint32_t start, uint32_t end); - -/** - * Concatenate two arrays. Adds new elements to the end of the array. - * @note The destination array is automatically expanded as necessary. - * @param array pointer to an `lv_array_t` variable - * @param other pointer to the array to concatenate - * @return LV_RESULT_OK: success, otherwise: error - */ -lv_result_t lv_array_concat(lv_array_t * array, const lv_array_t * other); - -/** - * Push back element. Adds a new element to the end of the array. - * If the array capacity is not enough for the new element, the array will be resized automatically. - * @note If the element is NULL, it will be added as an empty element. - * @param array pointer to an `lv_array_t` variable - * @param element pointer to the element to add. NULL to push an empty element. - * @return LV_RESULT_OK: success, otherwise: error - */ -lv_result_t lv_array_push_back(lv_array_t * array, const void * element); - -/** - * Assigns one content to the array, replacing its current content. - * @param array pointer to an `lv_array_t` variable - * @param index the index of the element to replace - * @param value pointer to the elements to add - * @return true: success; false: error - */ -lv_result_t lv_array_assign(lv_array_t * array, uint32_t index, const void * value); - -/** - * Returns a pointer to the element at position n in the array. - * @param array pointer to an `lv_array_t` variable - * @param index the index of the element to return - * @return a pointer to the requested element, NULL if `index` is out of range - */ -void * lv_array_at(const lv_array_t * array, uint32_t index); - -/** - * Returns a pointer to the first element in the array. - * @param array pointer to an `lv_array_t` variable - * @return a pointer to the first element in the array - */ -static inline void * lv_array_front(const lv_array_t * array) -{ - return lv_array_at(array, 0); -} - -/** - * Returns a pointer to the last element in the array. - * @param array pointer to an `lv_array_t` variable - */ -static inline void * lv_array_back(const lv_array_t * array) -{ - return lv_array_at(array, lv_array_size(array) - 1); -} - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_array_private.h b/src/misc/lv_array_private.h new file mode 100644 index 0000000000..be8f745a07 --- /dev/null +++ b/src/misc/lv_array_private.h @@ -0,0 +1,240 @@ +/** + * @file lv_array_private.h + * Array. The elements are dynamically allocated by the 'lv_mem' module. + */ + +#ifndef LV_ARRAY_PRIVATE_H +#define LV_ARRAY_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lv_types.h" + +/********************* + * DEFINES + *********************/ + +#ifndef LV_ARRAY_DEFAULT_CAPACITY +#define LV_ARRAY_DEFAULT_CAPACITY 4 +#endif + +#ifndef LV_ARRAY_DEFAULT_SHRINK_RATIO +#define LV_ARRAY_DEFAULT_SHRINK_RATIO 2 +#endif + +/********************** + * TYPEDEFS + **********************/ + +/** Description of a array*/ +struct _lv_array_t { + uint8_t * data; + uint32_t size; + uint32_t capacity; + uint32_t element_size; + + bool inner_alloc; /* true: data is allocated by the array; false: data is allocated by the user */ +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Init an array. + * @param array pointer to an `lv_array_t` variable to initialize + * @param capacity the initial capacity of the array + * @param element_size the size of an element in bytes + */ +void lv_array_init(lv_array_t * array, uint32_t capacity, uint32_t element_size); + +/** + * Init an array from a buffer. + * @note The buffer must be large enough to store `capacity` elements. The array will not release the buffer and reallocate it. + * The user must ensure that the buffer is valid during the lifetime of the array. And release the buffer when the array is no longer needed. + * @param array pointer to an `lv_array_t` variable to initialize + * @param buf pointer to a buffer to use as the array's data + * @param capacity the initial capacity of the array + * @param element_size the size of an element in bytes + */ +void lv_array_init_from_buf(lv_array_t * array, void * buf, uint32_t capacity, uint32_t element_size); + +/** + * Resize the array to the given capacity. + * @note if the new capacity is smaller than the current size, the array will be truncated. + * @param array pointer to an `lv_array_t` variable + * @param new_capacity the new capacity of the array + */ +bool lv_array_resize(lv_array_t * array, uint32_t new_capacity); + +/** + * Deinit the array, and free the allocated memory + * @param array pointer to an `lv_array_t` variable to deinitialize + */ +void lv_array_deinit(lv_array_t * array); + +/** + * Return how many elements are stored in the array. + * @param array pointer to an `lv_array_t` variable + * @return the number of elements stored in the array + */ +static inline uint32_t lv_array_size(const lv_array_t * array) +{ + return array->size; +} + +/** + * Return the capacity of the array, i.e. how many elements can be stored. + * @param array pointer to an `lv_array_t` variable + * @return the capacity of the array + */ +static inline uint32_t lv_array_capacity(const lv_array_t * array) +{ + return array->capacity; +} + +/** + * Return if the array is empty + * @param array pointer to an `lv_array_t` variable + * @return true: array is empty; false: array is not empty + */ +static inline bool lv_array_is_empty(const lv_array_t * array) +{ + return array->size == 0; +} + +/** + * Return if the array is full + * @param array pointer to an `lv_array_t` variable + * @return true: array is full; false: array is not full + */ +static inline bool lv_array_is_full(const lv_array_t * array) +{ + return array->size == array->capacity; +} + +/** + * Copy an array to another. + * @note this will create a new array with the same capacity and size as the source array. + * @param target pointer to an `lv_array_t` variable to copy to + * @param source pointer to an `lv_array_t` variable to copy from + */ +void lv_array_copy(lv_array_t * target, const lv_array_t * source); + +/** + * Remove all elements in array. + * @param array pointer to an `lv_array_t` variable + */ +static inline void lv_array_clear(lv_array_t * array) +{ + array->size = 0; +} + +/** + * Shrink the memory capacity of array if necessary. + * @param array pointer to an `lv_array_t` variable + */ +void lv_array_shrink(lv_array_t * array); + +/** + * Remove the element at the specified position in the array. + * + * This function keeps the array order. Complexity is O(n) + * + * @param array pointer to an `lv_array_t` variable + * @param index the index of the element to remove + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_remove(lv_array_t * array, uint32_t index); + +/** + * Remove the element at the specified position in the array. + * + * This function does not guarantee the array order. Complexity is O(1) + * + * @param array pointer to an `lv_array_t` variable + * @param index the index of the element to remove + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_remove_unordered(lv_array_t * array, uint32_t index); + +/** + * Remove from the array either a single element or a range of elements ([start, end)). + * @note This effectively reduces the container size by the number of elements removed. + * @note When start equals to end, the function has no effect. + * @param array pointer to an `lv_array_t` variable + * @param start the index of the first element to be removed + * @param end the index of the first element that is not to be removed + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_erase(lv_array_t * array, uint32_t start, uint32_t end); + +/** + * Concatenate two arrays. Adds new elements to the end of the array. + * @note The destination array is automatically expanded as necessary. + * @param array pointer to an `lv_array_t` variable + * @param other pointer to the array to concatenate + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_concat(lv_array_t * array, const lv_array_t * other); + +/** + * Push back element. Adds a new element to the end of the array. + * If the array capacity is not enough for the new element, the array will be resized automatically. + * @note If the element is NULL, it will be added as an empty element. + * @param array pointer to an `lv_array_t` variable + * @param element pointer to the element to add. NULL to push an empty element. + * @return LV_RESULT_OK: success, otherwise: error + */ +lv_result_t lv_array_push_back(lv_array_t * array, const void * element); + +/** + * Assigns one content to the array, replacing its current content. + * @param array pointer to an `lv_array_t` variable + * @param index the index of the element to replace + * @param value pointer to the elements to add + * @return true: success; false: error + */ +lv_result_t lv_array_assign(lv_array_t * array, uint32_t index, const void * value); + +/** + * Returns a pointer to the element at position n in the array. + * @param array pointer to an `lv_array_t` variable + * @param index the index of the element to return + * @return a pointer to the requested element, NULL if `index` is out of range + */ +void * lv_array_at(const lv_array_t * array, uint32_t index); + +/** + * Returns a pointer to the first element in the array. + * @param array pointer to an `lv_array_t` variable + * @return a pointer to the first element in the array + */ +static inline void * lv_array_front(const lv_array_t * array) +{ + return lv_array_at(array, 0); +} + +/** + * Returns a pointer to the last element in the array. + * @param array pointer to an `lv_array_t` variable + */ +static inline void * lv_array_back(const lv_array_t * array) +{ + return lv_array_at(array, lv_array_size(array) - 1); +} + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ARRAY_PRIVATE_H*/ diff --git a/src/misc/lv_assert.h b/src/misc/lv_assert.h index c9dc849c76..333b9cb414 100644 --- a/src/misc/lv_assert.h +++ b/src/misc/lv_assert.h @@ -1,87 +1,2 @@ -/** - * @file lv_assert.h - * - */ - -#ifndef LV_ASSERT_H -#define LV_ASSERT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_log.h" -#include "../stdlib/lv_mem.h" -#include LV_ASSERT_HANDLER_INCLUDE - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#define LV_ASSERT(expr) \ - do { \ - if(!(expr)) { \ - LV_LOG_ERROR("Asserted at expression: %s", #expr); \ - LV_ASSERT_HANDLER \ - } \ - } while(0) - -#define LV_ASSERT_MSG(expr, msg) \ - do { \ - if(!(expr)) { \ - LV_LOG_ERROR("Asserted at expression: %s (%s)", #expr, msg); \ - LV_ASSERT_HANDLER \ - } \ - } while(0) - -#define LV_ASSERT_FORMAT_MSG(expr, format, ...) \ - do { \ - if(!(expr)) { \ - LV_LOG_ERROR("Asserted at expression: %s " format , #expr, __VA_ARGS__); \ - LV_ASSERT_HANDLER \ - } \ - } while(0) - -/*----------------- - * ASSERTS - *-----------------*/ - -#if LV_USE_ASSERT_NULL -# define LV_ASSERT_NULL(p) LV_ASSERT_MSG(p != NULL, "NULL pointer"); -#else -# define LV_ASSERT_NULL(p) -#endif - -#if LV_USE_ASSERT_MALLOC -# define LV_ASSERT_MALLOC(p) LV_ASSERT_MSG(p != NULL, "Out of memory"); -#else -# define LV_ASSERT_MALLOC(p) -#endif - -#if LV_USE_ASSERT_MEM_INTEGRITY -# define LV_ASSERT_MEM_INTEGRITY() LV_ASSERT_MSG(lv_mem_test() == LV_RESULT_OK, "Memory integrity error"); -#else -# define LV_ASSERT_MEM_INTEGRITY() -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ASSERT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_async.c b/src/misc/lv_async.c index b2e718dd3a..c784569d09 100644 --- a/src/misc/lv_async.c +++ b/src/misc/lv_async.c @@ -7,9 +7,8 @@ * INCLUDES *********************/ -#include "lv_async.h" +#include "../lv_public_api.h" #include "lv_timer_private.h" -#include "../stdlib/lv_mem.h" /********************* * DEFINES diff --git a/src/misc/lv_async.h b/src/misc/lv_async.h index 362a0ffade..9f3345a90b 100644 --- a/src/misc/lv_async.h +++ b/src/misc/lv_async.h @@ -1,61 +1,2 @@ -/** - * @file lv_async.h - * - */ - -#ifndef LV_ASYNC_H -#define LV_ASYNC_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * Type for async callback. - */ -typedef void (*lv_async_cb_t)(void *); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Call an asynchronous function the next time lv_timer_handler() is run. This function is likely to return - * **before** the call actually happens! - * @param async_xcb a callback which is the task itself. - * (the 'x' in the argument name indicates that it's not a fully generic function because it not follows - * the `func_name(object, callback, ...)` convention) - * @param user_data custom parameter - */ -lv_result_t lv_async_call(lv_async_cb_t async_xcb, void * user_data); - -/** - * Cancel an asynchronous function call - * @param async_xcb a callback which is the task itself. - * @param user_data custom parameter - */ -lv_result_t lv_async_call_cancel(lv_async_cb_t async_xcb, void * user_data); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ASYNC_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_bidi.c b/src/misc/lv_bidi.c index 17ee47be26..38698422c6 100644 --- a/src/misc/lv_bidi.c +++ b/src/misc/lv_bidi.c @@ -6,11 +6,9 @@ /********************* * INCLUDES *********************/ + #include "lv_bidi_private.h" #include "lv_text_private.h" -#include "lv_types.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" #if LV_USE_BIDI diff --git a/src/misc/lv_bidi.h b/src/misc/lv_bidi.h index 77575efb3a..fed49761b6 100644 --- a/src/misc/lv_bidi.h +++ b/src/misc/lv_bidi.h @@ -1,83 +1,2 @@ -/** - * @file lv_bidi.h - * - */ - -#ifndef LV_BIDI_H -#define LV_BIDI_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_types.h" -#include "lv_text.h" - -/********************* - * DEFINES - *********************/ -/** Special non printable strong characters. - * They can be inserted to texts to affect the run's direction */ -#define LV_BIDI_LRO "\xE2\x80\xAD" /*U+202D*/ -#define LV_BIDI_RLO "\xE2\x80\xAE" /*U+202E*/ - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_BASE_DIR_LTR = 0x00, - LV_BASE_DIR_RTL = 0x01, - LV_BASE_DIR_AUTO = 0x02, - - LV_BASE_DIR_NEUTRAL = 0x20, - LV_BASE_DIR_WEAK = 0x21, -} lv_base_dir_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ -#if LV_USE_BIDI - -/** - * Get the real text alignment from the a text alignment, base direction and a text. - * @param align LV_TEXT_ALIGN_..., write back the calculated align here (LV_TEXT_ALIGN_LEFT/RIGHT/CENTER) - * @param base_dir LV_BASE_DIR_..., write the calculated base dir here (LV_BASE_DIR_LTR/RTL) - * @param txt a text, used with LV_BASE_DIR_AUTO to determine the base direction - */ -void lv_bidi_calculate_align(lv_text_align_t * align, lv_base_dir_t * base_dir, const char * txt); - -/** - * Set custom neutrals string - * @param neutrals default " \t\n\r.,:;'\"`!?%/\\-=()[]{}<>@#&$|" - */ -void lv_bidi_set_custom_neutrals_static(const char * neutrals); - -/********************** - * MACROS - **********************/ - -#else /*LV_USE_BIDI*/ -/** - * For compatibility if LV_USE_BIDI = 0 - * Get the real text alignment from the a text alignment, base direction and a text. - * @param align For LV_TEXT_ALIGN_AUTO give LV_TEXT_ALIGN_LEFT else leave unchanged, write back the calculated align here - * @param base_dir Unused - * @param txt Unused - */ -static inline void lv_bidi_calculate_align(lv_text_align_t * align, lv_base_dir_t * base_dir, const char * txt) -{ - LV_UNUSED(txt); - LV_UNUSED(base_dir); - if(*align == LV_TEXT_ALIGN_AUTO) * align = LV_TEXT_ALIGN_LEFT; -} -#endif /*LV_USE_BIDI*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_BIDI_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_bidi_private.h b/src/misc/lv_bidi_private.h index 0b684daecf..47cccdfe2b 100644 --- a/src/misc/lv_bidi_private.h +++ b/src/misc/lv_bidi_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_bidi.h" +#include "../lv_public_api.h" #if LV_USE_BIDI /********************* diff --git a/src/misc/lv_check_arg.h b/src/misc/lv_check_arg.h index dbd706f94b..528c1f405a 100644 --- a/src/misc/lv_check_arg.h +++ b/src/misc/lv_check_arg.h @@ -1,109 +1,2 @@ -/** - * @file lv_check_arg.h - * - */ - -#ifndef LV_CHECK_ARG_H -#define LV_CHECK_ARG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_log.h" -#include "lv_assert.h" - -/********************* - * DEFINES - *********************/ - -#if defined(__GNUC__) || defined(__clang__) -#define LV_LIKELY(x) (__builtin_expect(!!(x), 1)) -#define LV_UNLIKELY(x) (__builtin_expect(!!(x), 0)) -#else -#define LV_LIKELY(x) (x) -#define LV_UNLIKELY(x) (x) -#endif - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#if LV_USE_CHECK_ARG - -#if LV_CHECK_ARG_ASSERT_ON_FAIL - -/** - * Internal macro: checks a condition, logs a warning, calls the assert handler, - * and then executes the specified action on failure. - * Do not use directly; use LV_CHECK_ARG instead. - */ -#define LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...) \ - if(LV_UNLIKELY(!(cond))) { \ - LV_LOG_WARN("Check failed: " cond_str " " __VA_ARGS__); \ - LV_ASSERT_HANDLER \ - action_on_fail; \ - } else {} - -#else - -/** - * Internal macro: checks a condition, logs a warning, and executes the - * specified action on failure. - * Do not use directly; use LV_CHECK_ARG instead. - */ -#define LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...) \ - if(LV_UNLIKELY(!(cond))) { \ - LV_LOG_WARN("Check failed: " cond_str " " __VA_ARGS__); \ - action_on_fail; \ - } else {} - -#endif /*LV_CHECK_ARG_ASSERT_ON_FAIL*/ - -#else - -/** LV_CHECK_ARG is disabled; all checks compile to nothing. */ -#define LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...) ((void)0) - -#endif /*LV_USE_CHECK_ARG*/ - -/** - * Check that a condition is true. If the condition is false, log a warning - * and execute `action_on_fail` (e.g. `return`, `return val`, `break`). - * Additional printf-style arguments are appended to the log message. - * - * Can be disabled entirely by setting LV_USE_CHECK_ARG to 0 in lv_conf.h. - * If LV_CHECK_ARG_ASSERT_ON_FAIL is 1, LV_ASSERT_HANDLER is also invoked - * before the action. - * - * Example: - * @code - * LV_CHECK_ARG(ptr != NULL, return, "pointer must not be NULL"); - * LV_CHECK_ARG(len > 0, return -1, "len=%d", (int)len); - * @endcode - * - * @param cond condition to check - * @param action_on_fail statement to execute on failure (e.g. `return`, `return 0`, `break`) - * @param ... optional printf-style format string and arguments appended to the log - */ -#define LV_CHECK_ARG(cond, action_on_fail, ...) \ - LV_CHECK_ARG_INTERNAL_(cond, #cond, action_on_fail, __VA_ARGS__) - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CHECK_ARG_H*/ - +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_circle_buf.c b/src/misc/lv_circle_buf.c index 455435c8d7..4465ea94c7 100644 --- a/src/misc/lv_circle_buf.c +++ b/src/misc/lv_circle_buf.c @@ -7,10 +7,8 @@ * INCLUDES *********************/ -#include "lv_assert.h" - -#include "lv_circle_buf.h" -#include "lv_array.h" +#include "lv_circle_buf_private.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_circle_buf.h b/src/misc/lv_circle_buf.h index 2b4f27bf8d..15a9bc0c4c 100644 --- a/src/misc/lv_circle_buf.h +++ b/src/misc/lv_circle_buf.h @@ -1,191 +1,3 @@ -/** -* @file lv_circle_buf.h -* - */ +#warning "lv_circle_buf" is no longer part of the public API and will be removed in the future. - -#ifndef LV_CIRCLE_BUF_H -#define LV_CIRCLE_BUF_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef bool (*lv_circle_buf_fill_cb_t)(void * buf, uint32_t buff_len, int32_t index, void * user_data); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a circle buffer - * @param capacity the maximum number of elements in the buffer - * @param element_size the size of an element in bytes - * @return pointer to the created buffer - */ -lv_circle_buf_t * lv_circle_buf_create(uint32_t capacity, uint32_t element_size); - -/** - * Create a circle buffer from an existing buffer - * @param buf pointer to a buffer - * @param capacity the maximum number of elements in the buffer - * @param element_size the size of an element in bytes - * @return pointer to the created buffer - */ -lv_circle_buf_t * lv_circle_buf_create_from_buf(void * buf, uint32_t capacity, uint32_t element_size); - -/** - * Create a circle buffer from an existing array - * @param array pointer to an array - * @return pointer to the created buffer - */ -lv_circle_buf_t * lv_circle_buf_create_from_array(const lv_array_t * array); - -/** - * Resize the buffer - * @param circle_buf pointer to a buffer - * @param capacity the new capacity of the buffer - * @return LV_RESULT_OK: the buffer is resized; LV_RESULT_INVALID: the buffer is not resized - */ -lv_result_t lv_circle_buf_resize(lv_circle_buf_t * circle_buf, uint32_t capacity); - -/** - * Destroy a circle buffer - * @param circle_buf pointer to buffer - */ -void lv_circle_buf_destroy(lv_circle_buf_t * circle_buf); - -/** - * Get the size of the buffer - * @param circle_buf pointer to buffer - * @return the number of elements in the buffer - */ -uint32_t lv_circle_buf_size(const lv_circle_buf_t * circle_buf); - -/** - * Get the capacity of the buffer - * @param circle_buf pointer to buffer - * @return the maximum number of elements in the buffer - */ -uint32_t lv_circle_buf_capacity(const lv_circle_buf_t * circle_buf); - -/** - * Get the remaining space in the buffer - * @param circle_buf pointer to buffer - * @return the number of elements that can be written to the buffer - */ -uint32_t lv_circle_buf_remain(const lv_circle_buf_t * circle_buf); - -/** - * Check if the buffer is empty - * @param circle_buf pointer to buffer - * @return true: the buffer is empty; false: the buffer is not empty - */ -bool lv_circle_buf_is_empty(const lv_circle_buf_t * circle_buf); - -/** - * Check if the buffer is full - * @param circle_buf pointer to buffer - * @return true: the buffer is full; false: the buffer is not full - */ -bool lv_circle_buf_is_full(const lv_circle_buf_t * circle_buf); - -/** - * Reset the buffer - * @param circle_buf pointer to buffer - * @return LV_RESULT_OK: the buffer is reset; LV_RESULT_INVALID: the buffer is not reset - */ -void lv_circle_buf_reset(lv_circle_buf_t * circle_buf); - -/** - * Get the head of the buffer - * @param circle_buf pointer to buffer - * @return pointer to the head of the buffer - */ -void * lv_circle_buf_head(const lv_circle_buf_t * circle_buf); - -/** - * Get the tail of the buffer - * @param circle_buf pointer to buffer - * @return pointer to the tail of the buffer - */ -void * lv_circle_buf_tail(const lv_circle_buf_t * circle_buf); - -/** - * Read a value - * @param circle_buf pointer to buffer - * @param data pointer to a variable to store the read value - * @return LV_RESULT_OK: the value is read; LV_RESULT_INVALID: the value is not read - */ -lv_result_t lv_circle_buf_read(lv_circle_buf_t * circle_buf, void * data); - -/** - * Write a value - * @param circle_buf pointer to buffer - * @param data pointer to the value to write - * @return LV_RESULT_OK: the value is written; LV_RESULT_INVALID: the value is not written - */ -lv_result_t lv_circle_buf_write(lv_circle_buf_t * circle_buf, const void * data); - -/** - * Fill the buffer with values - * @param circle_buf pointer to buffer - * @param count the number of values to fill - * @param fill_cb the callback function to fill the buffer - * @param user_data - * @return the number of values filled - */ -uint32_t lv_circle_buf_fill(lv_circle_buf_t * circle_buf, uint32_t count, lv_circle_buf_fill_cb_t fill_cb, - void * user_data); - -/** - * Skip a value - * @param circle_buf pointer to buffer - * @return LV_RESULT_OK: the value is skipped; LV_RESULT_INVALID: the value is not skipped - */ -lv_result_t lv_circle_buf_skip(lv_circle_buf_t * circle_buf); - -/** - * Peek a value - * @param circle_buf pointer to buffer - * @param data pointer to a variable to store the peeked value - * @return LV_RESULT_OK: the value is peeked; LV_RESULT_INVALID: the value is not peeked - */ -lv_result_t lv_circle_buf_peek(const lv_circle_buf_t * circle_buf, void * data); - -/** - * Peek a value at an index - * @param circle_buf pointer to buffer - * @param index the index of the value to peek, if the index is greater than the size of the buffer, it will return looply. - * @param data pointer to a variable to store the peeked value - * @return LV_RESULT_OK: the value is peeked; LV_RESULT_INVALID: the value is not peeked - */ -lv_result_t lv_circle_buf_peek_at(const lv_circle_buf_t * circle_buf, uint32_t index, void * data); - -/************************* - * GLOBAL VARIABLES - *************************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CIRCLE_BUF_H*/ +#include "lv_circle_buf_private.h" diff --git a/src/misc/lv_circle_buf_private.h b/src/misc/lv_circle_buf_private.h new file mode 100644 index 0000000000..0ed04e5874 --- /dev/null +++ b/src/misc/lv_circle_buf_private.h @@ -0,0 +1,192 @@ +/** +* @file lv_circle_buf_private.h +* + */ + + +#ifndef LV_CIRCLE_BUF_PRIVATE_H +#define LV_CIRCLE_BUF_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../lv_public_api.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct _lv_circle_buf_t lv_circle_buf_t; +typedef bool (*lv_circle_buf_fill_cb_t)(void * buf, uint32_t buff_len, int32_t index, void * user_data); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a circle buffer + * @param capacity the maximum number of elements in the buffer + * @param element_size the size of an element in bytes + * @return pointer to the created buffer + */ +lv_circle_buf_t * lv_circle_buf_create(uint32_t capacity, uint32_t element_size); + +/** + * Create a circle buffer from an existing buffer + * @param buf pointer to a buffer + * @param capacity the maximum number of elements in the buffer + * @param element_size the size of an element in bytes + * @return pointer to the created buffer + */ +lv_circle_buf_t * lv_circle_buf_create_from_buf(void * buf, uint32_t capacity, uint32_t element_size); + +/** + * Create a circle buffer from an existing array + * @param array pointer to an array + * @return pointer to the created buffer + */ +lv_circle_buf_t * lv_circle_buf_create_from_array(const lv_array_t * array); + +/** + * Resize the buffer + * @param circle_buf pointer to a buffer + * @param capacity the new capacity of the buffer + * @return LV_RESULT_OK: the buffer is resized; LV_RESULT_INVALID: the buffer is not resized + */ +lv_result_t lv_circle_buf_resize(lv_circle_buf_t * circle_buf, uint32_t capacity); + +/** + * Destroy a circle buffer + * @param circle_buf pointer to buffer + */ +void lv_circle_buf_destroy(lv_circle_buf_t * circle_buf); + +/** + * Get the size of the buffer + * @param circle_buf pointer to buffer + * @return the number of elements in the buffer + */ +uint32_t lv_circle_buf_size(const lv_circle_buf_t * circle_buf); + +/** + * Get the capacity of the buffer + * @param circle_buf pointer to buffer + * @return the maximum number of elements in the buffer + */ +uint32_t lv_circle_buf_capacity(const lv_circle_buf_t * circle_buf); + +/** + * Get the remaining space in the buffer + * @param circle_buf pointer to buffer + * @return the number of elements that can be written to the buffer + */ +uint32_t lv_circle_buf_remain(const lv_circle_buf_t * circle_buf); + +/** + * Check if the buffer is empty + * @param circle_buf pointer to buffer + * @return true: the buffer is empty; false: the buffer is not empty + */ +bool lv_circle_buf_is_empty(const lv_circle_buf_t * circle_buf); + +/** + * Check if the buffer is full + * @param circle_buf pointer to buffer + * @return true: the buffer is full; false: the buffer is not full + */ +bool lv_circle_buf_is_full(const lv_circle_buf_t * circle_buf); + +/** + * Reset the buffer + * @param circle_buf pointer to buffer + * @return LV_RESULT_OK: the buffer is reset; LV_RESULT_INVALID: the buffer is not reset + */ +void lv_circle_buf_reset(lv_circle_buf_t * circle_buf); + +/** + * Get the head of the buffer + * @param circle_buf pointer to buffer + * @return pointer to the head of the buffer + */ +void * lv_circle_buf_head(const lv_circle_buf_t * circle_buf); + +/** + * Get the tail of the buffer + * @param circle_buf pointer to buffer + * @return pointer to the tail of the buffer + */ +void * lv_circle_buf_tail(const lv_circle_buf_t * circle_buf); + +/** + * Read a value + * @param circle_buf pointer to buffer + * @param data pointer to a variable to store the read value + * @return LV_RESULT_OK: the value is read; LV_RESULT_INVALID: the value is not read + */ +lv_result_t lv_circle_buf_read(lv_circle_buf_t * circle_buf, void * data); + +/** + * Write a value + * @param circle_buf pointer to buffer + * @param data pointer to the value to write + * @return LV_RESULT_OK: the value is written; LV_RESULT_INVALID: the value is not written + */ +lv_result_t lv_circle_buf_write(lv_circle_buf_t * circle_buf, const void * data); + +/** + * Fill the buffer with values + * @param circle_buf pointer to buffer + * @param count the number of values to fill + * @param fill_cb the callback function to fill the buffer + * @param user_data + * @return the number of values filled + */ +uint32_t lv_circle_buf_fill(lv_circle_buf_t * circle_buf, uint32_t count, lv_circle_buf_fill_cb_t fill_cb, + void * user_data); + +/** + * Skip a value + * @param circle_buf pointer to buffer + * @return LV_RESULT_OK: the value is skipped; LV_RESULT_INVALID: the value is not skipped + */ +lv_result_t lv_circle_buf_skip(lv_circle_buf_t * circle_buf); + +/** + * Peek a value + * @param circle_buf pointer to buffer + * @param data pointer to a variable to store the peeked value + * @return LV_RESULT_OK: the value is peeked; LV_RESULT_INVALID: the value is not peeked + */ +lv_result_t lv_circle_buf_peek(const lv_circle_buf_t * circle_buf, void * data); + +/** + * Peek a value at an index + * @param circle_buf pointer to buffer + * @param index the index of the value to peek, if the index is greater than the size of the buffer, it will return looply. + * @param data pointer to a variable to store the peeked value + * @return LV_RESULT_OK: the value is peeked; LV_RESULT_INVALID: the value is not peeked + */ +lv_result_t lv_circle_buf_peek_at(const lv_circle_buf_t * circle_buf, uint32_t index, void * data); + +/************************* + * GLOBAL VARIABLES + *************************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CIRCLE_BUF_PRIVATE_H*/ diff --git a/src/misc/lv_color.c b/src/misc/lv_color.c index fa8d3e7264..1fbd1d1114 100644 --- a/src/misc/lv_color.c +++ b/src/misc/lv_color.c @@ -6,8 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_color.h" -#include "lv_log.h" + +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_color.h b/src/misc/lv_color.h index c135372b93..dec1ebec50 100644 --- a/src/misc/lv_color.h +++ b/src/misc/lv_color.h @@ -1,494 +1,2 @@ -/** - * @file lv_color.h - * - */ - -#ifndef LV_COLOR_H -#define LV_COLOR_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_assert.h" -#include "lv_math.h" -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ -LV_EXPORT_CONST_INT(LV_COLOR_DEPTH); - -#if LV_COLOR_DEPTH == 8 -#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 2 -#elif LV_COLOR_DEPTH == 16 -#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 3 -#elif LV_COLOR_DEPTH == 24 -#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 4 -#elif LV_COLOR_DEPTH == 32 -#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 4 -#endif - -/** - * Opacity percentages. - */ - -enum _lv_opacity_level_t { - LV_OPA_TRANSP = 0, - LV_OPA_0 = 0, - LV_OPA_10 = 25, - LV_OPA_20 = 51, - LV_OPA_30 = 76, - LV_OPA_40 = 102, - LV_OPA_50 = 127, - LV_OPA_60 = 153, - LV_OPA_70 = 178, - LV_OPA_80 = 204, - LV_OPA_90 = 229, - LV_OPA_100 = 255, - LV_OPA_COVER = 255, -}; - -#define LV_OPA_MIN 2 /**< Fully transparent if opa <= LV_OPA_MIN */ -#define LV_OPA_MAX 253 /**< Fully cover if opa >= LV_OPA_MAX */ - -/** - * Get the pixel size of a color format in bits, bpp - * @param cf a color format (`LV_COLOR_FORMAT_...`) - * @return the pixel size in bits - * @sa lv_color_format_get_bpp - */ -#define LV_COLOR_FORMAT_GET_BPP(cf) ( \ - (cf) == LV_COLOR_FORMAT_I1 ? 1 : \ - (cf) == LV_COLOR_FORMAT_A1 ? 1 : \ - (cf) == LV_COLOR_FORMAT_I2 ? 2 : \ - (cf) == LV_COLOR_FORMAT_A2 ? 2 : \ - (cf) == LV_COLOR_FORMAT_I4 ? 4 : \ - (cf) == LV_COLOR_FORMAT_A4 ? 4 : \ - (cf) == LV_COLOR_FORMAT_NEMA_TSC4 ? 4 : \ - (cf) == LV_COLOR_FORMAT_NEMA_TSC6 ? 6 : \ - (cf) == LV_COLOR_FORMAT_NEMA_TSC6A ? 6 : \ - (cf) == LV_COLOR_FORMAT_NEMA_TSC6AP ? 6 : \ - (cf) == LV_COLOR_FORMAT_L8 ? 8 : \ - (cf) == LV_COLOR_FORMAT_A8 ? 8 : \ - (cf) == LV_COLOR_FORMAT_I8 ? 8 : \ - (cf) == LV_COLOR_FORMAT_ARGB2222 ? 8 : \ - (cf) == LV_COLOR_FORMAT_NEMA_TSC12 ? 12 : \ - (cf) == LV_COLOR_FORMAT_NEMA_TSC12A ? 12 : \ - (cf) == LV_COLOR_FORMAT_AL88 ? 16 : \ - (cf) == LV_COLOR_FORMAT_RGB565 ? 16 : \ - (cf) == LV_COLOR_FORMAT_RGB565_SWAPPED ? 16 : \ - (cf) == LV_COLOR_FORMAT_RGB565A8 ? 16 : \ - (cf) == LV_COLOR_FORMAT_YUY2 ? 16 : \ - (cf) == LV_COLOR_FORMAT_ARGB1555 ? 16 : \ - (cf) == LV_COLOR_FORMAT_ARGB4444 ? 16 : \ - (cf) == LV_COLOR_FORMAT_ARGB8565 ? 24 : \ - (cf) == LV_COLOR_FORMAT_RGB888 ? 24 : \ - (cf) == LV_COLOR_FORMAT_ARGB8888 ? 32 : \ - (cf) == LV_COLOR_FORMAT_ARGB8888_PREMULTIPLIED ? 32 : \ - (cf) == LV_COLOR_FORMAT_XRGB8888 ? 32 : \ - 0 \ - ) - -/** - * Get the pixel size of a color format in bytes - * @param cf a color format (`LV_COLOR_FORMAT_...`) - * @return the pixel size in bytes - * @sa lv_color_format_get_size - */ -#define LV_COLOR_FORMAT_GET_SIZE(cf) ((LV_COLOR_FORMAT_GET_BPP(cf) + 7) >> 3) - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - uint8_t blue; - uint8_t green; - uint8_t red; -} lv_color_t; - -typedef struct { - uint16_t blue : 5; - uint16_t green : 6; - uint16_t red : 5; -} lv_color16_t; - -typedef struct { - uint8_t blue; - uint8_t green; - uint8_t red; - uint8_t alpha; -} lv_color32_t; - -typedef struct { - uint16_t h; - uint8_t s; - uint8_t v; -} lv_color_hsv_t; - -typedef struct { - uint8_t lumi; - uint8_t alpha; -} lv_color16a_t; - -typedef enum { - LV_COLOR_FORMAT_UNKNOWN = 0, - - LV_COLOR_FORMAT_RAW = 0x01, - LV_COLOR_FORMAT_RAW_ALPHA = 0x02, - - /*<=1 byte (+alpha) formats*/ - LV_COLOR_FORMAT_L8 = 0x06, - LV_COLOR_FORMAT_I1 = 0x07, - LV_COLOR_FORMAT_I2 = 0x08, - LV_COLOR_FORMAT_I4 = 0x09, - LV_COLOR_FORMAT_I8 = 0x0A, - LV_COLOR_FORMAT_A8 = 0x0E, - - /*2 byte (+alpha) formats*/ - LV_COLOR_FORMAT_RGB565 = 0x12, - LV_COLOR_FORMAT_ARGB8565 = 0x13, /**< Not supported by sw renderer yet. */ - LV_COLOR_FORMAT_RGB565A8 = 0x14, /**< Color array followed by Alpha array*/ - LV_COLOR_FORMAT_AL88 = 0x15, /**< L8 with alpha >*/ - LV_COLOR_FORMAT_RGB565_SWAPPED = 0x1B, - - /*3 byte (+alpha) formats*/ - LV_COLOR_FORMAT_RGB888 = 0x0F, - LV_COLOR_FORMAT_ARGB8888 = 0x10, - LV_COLOR_FORMAT_XRGB8888 = 0x11, - LV_COLOR_FORMAT_ARGB8888_PREMULTIPLIED = 0x1A, - - /*Formats not supported by software renderer but kept here so GPU can use it*/ - LV_COLOR_FORMAT_A1 = 0x0B, - LV_COLOR_FORMAT_A2 = 0x0C, - LV_COLOR_FORMAT_A4 = 0x0D, - LV_COLOR_FORMAT_ARGB1555 = 0x16, - LV_COLOR_FORMAT_ARGB4444 = 0x17, - LV_COLOR_FORMAT_ARGB2222 = 0X18, - - /* reference to https://wiki.videolan.org/YUV/ */ - /*YUV planar formats*/ - LV_COLOR_FORMAT_YUV_START = 0x20, - LV_COLOR_FORMAT_I420 = LV_COLOR_FORMAT_YUV_START, /*YUV420 planar(3 plane)*/ - LV_COLOR_FORMAT_I422 = 0x21, /*YUV422 planar(3 plane)*/ - LV_COLOR_FORMAT_I444 = 0x22, /*YUV444 planar(3 plane)*/ - LV_COLOR_FORMAT_I400 = 0x23, /*YUV400 no chroma channel*/ - LV_COLOR_FORMAT_NV21 = 0x24, /*YUV420 planar(2 plane), UV plane in 'V, U, V, U'*/ - LV_COLOR_FORMAT_NV12 = 0x25, /*YUV420 planar(2 plane), UV plane in 'U, V, U, V'*/ - - /*YUV packed formats*/ - LV_COLOR_FORMAT_YUY2 = 0x26, /*YUV422 packed like 'Y U Y V'*/ - LV_COLOR_FORMAT_UYVY = 0x27, /*YUV422 packed like 'U Y V Y'*/ - - LV_COLOR_FORMAT_YUV_END = LV_COLOR_FORMAT_UYVY, - - LV_COLOR_FORMAT_PROPRIETARY_START = 0x30, - - LV_COLOR_FORMAT_NEMA_TSC_START = LV_COLOR_FORMAT_PROPRIETARY_START, - LV_COLOR_FORMAT_NEMA_TSC4 = LV_COLOR_FORMAT_NEMA_TSC_START, - LV_COLOR_FORMAT_NEMA_TSC6 = 0x31, - LV_COLOR_FORMAT_NEMA_TSC6A = 0x32, - LV_COLOR_FORMAT_NEMA_TSC6AP = 0x33, - LV_COLOR_FORMAT_NEMA_TSC12 = 0x34, - LV_COLOR_FORMAT_NEMA_TSC12A = 0x35, - LV_COLOR_FORMAT_NEMA_TSC_END = LV_COLOR_FORMAT_NEMA_TSC12A, - - /*Color formats in which LVGL can render*/ -#if LV_COLOR_DEPTH == 1 - LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_I1, - LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_I1, -#elif LV_COLOR_DEPTH == 8 - LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_L8, - LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_AL88, -#elif LV_COLOR_DEPTH == 16 - LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB565, - LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_RGB565A8, -#elif LV_COLOR_DEPTH == 24 - LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB888, - LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888, -#elif LV_COLOR_DEPTH == 32 - LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_XRGB8888, - LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888, -#else -#error "LV_COLOR_DEPTH should be 1, 8, 16, 24 or 32" -#endif - -} lv_color_format_t; - -#define LV_COLOR_FORMAT_IS_ALPHA_ONLY(cf) ((cf) >= LV_COLOR_FORMAT_A1 && (cf) <= LV_COLOR_FORMAT_A8) -#define LV_COLOR_FORMAT_IS_INDEXED(cf) ((cf) >= LV_COLOR_FORMAT_I1 && (cf) <= LV_COLOR_FORMAT_I8) -#define LV_COLOR_FORMAT_IS_YUV(cf) ((cf) >= LV_COLOR_FORMAT_YUV_START && (cf) <= LV_COLOR_FORMAT_YUV_END) -#define LV_COLOR_INDEXED_PALETTE_SIZE(cf) ((cf) == LV_COLOR_FORMAT_I1 ? 2 :\ - (cf) == LV_COLOR_FORMAT_I2 ? 4 :\ - (cf) == LV_COLOR_FORMAT_I4 ? 16 :\ - (cf) == LV_COLOR_FORMAT_I8 ? 256 : 0) - -/********************** - * MACROS - **********************/ - -#define LV_COLOR_MAKE(r8, g8, b8) {b8, g8, r8} - -#define LV_OPA_MIX2(a1, a2) ((lv_opa_t)(((int32_t)(a1) * (a2)) >> 8)) -#define LV_OPA_MIX3(a1, a2, a3) ((lv_opa_t)(((int32_t)(a1) * (a2) * (a3)) >> 16)) - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Get the pixel size of a color format in bits, bpp - * @param cf a color format (`LV_COLOR_FORMAT_...`) - * @return the pixel size in bits - * @sa LV_COLOR_FORMAT_GET_BPP - */ -uint8_t lv_color_format_get_bpp(lv_color_format_t cf); - -/** - * Get the pixel size of a color format in bytes - * @param cf a color format (`LV_COLOR_FORMAT_...`) - * @return the pixel size in bytes - * @sa LV_COLOR_FORMAT_GET_SIZE - */ -uint8_t lv_color_format_get_size(lv_color_format_t cf); - -/** - * Check if a color format has alpha channel or not - * @param src_cf a color format (`LV_COLOR_FORMAT_...`) - * @return true: has alpha channel; false: doesn't have alpha channel - */ -bool lv_color_format_has_alpha(lv_color_format_t src_cf); - -/** - * Create an ARGB8888 color from RGB888 + alpha - * @param color an RGB888 color - * @param opa the alpha value - * @return the ARGB8888 color - */ -lv_color32_t lv_color_to_32(lv_color_t color, lv_opa_t opa); - -/** - * Convert an RGB888 color to an integer - * @param c an RGB888 color - * @return `c` as an integer - */ -uint32_t lv_color_to_int(lv_color_t c); - -/** - * Check if two RGB888 color are equal - * @param c1 the first color - * @param c2 the second color - * @return true: equal - */ -bool lv_color_eq(lv_color_t c1, lv_color_t c2); - -/** - * Check if two ARGB8888 color are equal - * @param c1 the first color - * @param c2 the second color - * @return true: equal - */ -bool lv_color32_eq(lv_color32_t c1, lv_color32_t c2); - -/** - * Create a color from 0x000000..0xffffff input - * @param c the hex input - * @return the color - */ -lv_color_t lv_color_hex(uint32_t c); - -/** - * Create an RGB888 color - * @param r the red channel (0..255) - * @param g the green channel (0..255) - * @param b the blue channel (0..255) - * @return the color - */ -lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b); - -/** - * Create an ARGB8888 color - * @param r the red channel (0..255) - * @param g the green channel (0..255) - * @param b the blue channel (0..255) - * @param a the alpha channel (0..255) - * @return the color - */ -lv_color32_t lv_color32_make(uint8_t r, uint8_t g, uint8_t b, uint8_t a); - -/** - * Create a color from 0x000..0xfff input - * @param c the hex input (e.g. 0x123 will be 0x112233) - * @return the color - */ -lv_color_t lv_color_hex3(uint32_t c); - -/** - * Check if a color with an RGB888 color is within the color range defined by l_color and h_color. - * @param color the color to check - * @param l_color the lower bound color - * @param h_color the upper bound color - * @return true: pixel is within the color range - */ -static inline bool lv_color_is_in_range(lv_color_t color, lv_color_t l_color, lv_color_t h_color) -{ - return (color.red <= h_color.red && - color.green <= h_color.green && - color.blue <= h_color.blue && - color.red >= l_color.red && - color.green >= l_color.green && - color.blue >= l_color.blue); -} - -/** - * Convert a RGB565 color to RGB888 - * @param c a RGB565 color on lv_color16_t - * @return the color - */ -static inline lv_color_t lv_color16_to_color(lv_color16_t c) -{ - return lv_color_make((uint8_t)(c.red << 3), (uint8_t)(c.green << 2), (uint8_t)(c.blue << 3)); -} - -/** - * Convert am RGB888 color to RGB565 stored in `uint16_t` - * @param color and RGB888 color - * @return `color` as RGB565 on `uin16_t` - */ -uint16_t lv_color_to_u16(lv_color_t color); - -/** - * Convert am RGB888 color to XRGB8888 stored in `uint32_t` - * @param color and RGB888 color - * @return `color` as XRGB8888 on `uin32_t` (the alpha channel is always set to 0xFF) - */ -uint32_t lv_color_to_u32(lv_color_t color); - -/** - * Mix two RGB565 colors - * @param c1 the first color (typically the foreground color) - * @param c2 the second color (typically the background color) - * @param mix 0..255, or LV_OPA_0/10/20... - * @return mix == 0: c2 - * mix == 255: c1 - * mix == 128: 0.5 x c1 + 0.5 x c2 - */ -uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_16_16_mix(uint16_t c1, uint16_t c2, uint8_t mix); - -/** - * Mix white to a color - * @param c the base color - * @param lvl the intensity of white (0: no change, 255: fully white) - * @return the mixed color - */ -lv_color_t lv_color_lighten(lv_color_t c, lv_opa_t lvl); - -/** - * Mix black to a color - * @param c the base color - * @param lvl the intensity of black (0: no change, 255: fully black) - * @return the mixed color - */ -lv_color_t lv_color_darken(lv_color_t c, lv_opa_t lvl); - -/** - * Convert a HSV color to RGB - * @param h hue [0..359] - * @param s saturation [0..100] - * @param v value [0..100] - * @return the given RGB color in RGB (with LV_COLOR_DEPTH depth) - */ -lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v); - -/** - * Convert a 32-bit RGB color to HSV - * @param r8 8-bit red - * @param g8 8-bit green - * @param b8 8-bit blue - * @return the given RGB color in HSV - */ -lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8); - -/** - * Convert a color to HSV - * @param color color - * @return the given color in HSV - */ -lv_color_hsv_t lv_color_to_hsv(lv_color_t color); - -/*Source: https://vuetifyjs.com/en/styles/colors/#material-colors*/ - -/** - * A helper for white color - * @return a white color - */ -lv_color_t lv_color_white(void); - -/** - * A helper for black color - * @return a black color - */ -lv_color_t lv_color_black(void); - -void lv_color_premultiply(lv_color32_t * c); - -void lv_color16_premultiply(lv_color16_t * c, lv_opa_t a); - -/** - * Get the luminance of a color: luminance = 0.3 R + 0.59 G + 0.11 B - * @param c a color - * @return the brightness [0..255] - */ -uint8_t lv_color_luminance(lv_color_t c); - -/** - * Get the luminance of a color16: luminance = 0.3 R + 0.59 G + 0.11 B - * @param c a color - * @return the brightness [0..255] - */ -uint8_t lv_color16_luminance(const lv_color16_t c); - -/** - * Get the luminance of a color24: luminance = 0.3 R + 0.59 G + 0.11 B - * @param c a color - * @return the brightness [0..255] - */ -uint8_t lv_color24_luminance(const uint8_t * c); - -/** - * Get the luminance of a color32: luminance = 0.3 R + 0.59 G + 0.11 B - * @param c a color - * @return the brightness [0..255] - */ -uint8_t lv_color32_luminance(lv_color32_t c); - - -/** - * Swap the endianness of an rgb565 color - * @param c a color - * @return the swapped color - */ -static inline uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_swap_16(uint16_t c) -{ - return (c >> 8) | (c << 8); -} - -/********************** - * MACROS - **********************/ - -#include "lv_palette.h" -#include "lv_color_op.h" - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_color_filter_dsc_t lv_color_filter_shade; - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_COLOR_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_color_op.c b/src/misc/lv_color_op.c index cf0f77c7e5..846e2635ae 100644 --- a/src/misc/lv_color_op.c +++ b/src/misc/lv_color_op.c @@ -6,8 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_color_op_private.h" -#include "lv_log.h" + +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_color_op.h b/src/misc/lv_color_op.h index 0c28c0b17e..d6cc5d4044 100644 --- a/src/misc/lv_color_op.h +++ b/src/misc/lv_color_op.h @@ -1,105 +1,2 @@ -/** - * @file lv_color_op.h - * - */ - -#ifndef LV_COLOR_OP_H -#define LV_COLOR_OP_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_assert.h" -#include "lv_math.h" -#include "lv_color.h" -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -struct _lv_color_filter_dsc_t; - -typedef lv_color_t (*lv_color_filter_cb_t)(const struct _lv_color_filter_dsc_t *, lv_color_t, lv_opa_t); - -struct _lv_color_filter_dsc_t { - lv_color_filter_cb_t filter_cb; - void * user_data; -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Mix two colors with a given ratio. - * @param c1 the first color to mix (usually the foreground) - * @param c2 the second color to mix (usually the background) - * @param mix The ratio of the colors. 0: full `c2`, 255: full `c1`, 127: half `c1` and half`c2` - * @return the mixed color - */ -lv_color_t LV_ATTRIBUTE_FAST_MEM lv_color_mix(lv_color_t c1, lv_color_t c2, uint8_t mix); - -/** - * - * @param fg - * @param bg - * @return - * @note Use bg.alpha in the return value - * @note Use fg.alpha as mix ratio - */ -lv_color32_t lv_color_mix32(lv_color32_t fg, lv_color32_t bg); - -/** - * @brief Blends two premultiplied ARGB8888 colors while maintaining correct alpha compositing. - * - * This function correctly blends the foreground (fg) and background (bg) colors, - * ensuring that the output remains in a premultiplied alpha format. - * - * @param fg The foreground color in premultiplied ARGB8888 format. - * @param bg The background color in premultiplied ARGB8888 format. - * @return The resulting blended color in premultiplied ARGB8888 format. - * - * @note If the foreground is fully opaque, it is returned as is. - * @note If the foreground is fully transparent, the background is returned. - */ -lv_color32_t lv_color_mix32_premultiplied(lv_color32_t fg, lv_color32_t bg); - -/** - * Get the brightness of a color - * @param c a color - * @return brightness in range [0..255] - */ -uint8_t lv_color_brightness(lv_color_t c); - -void lv_color_filter_dsc_init(lv_color_filter_dsc_t * dsc, lv_color_filter_cb_t cb); - -/** - * Blend two colors that have not been pre-multiplied using their alpha values - * @param fg the foreground color - * @param bg the background color - * @return result color - */ -lv_color32_t lv_color_over32(lv_color32_t fg, lv_color32_t bg); - -/********************** - * PREDEFINED COLORS - **********************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_COLOR_OP_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_event.c b/src/misc/lv_event.c index dc2538d1be..ee9409302c 100644 --- a/src/misc/lv_event.c +++ b/src/misc/lv_event.c @@ -8,9 +8,6 @@ *********************/ #include "lv_event_private.h" #include "../core/lv_global.h" -#include "../stdlib/lv_mem.h" -#include "lv_assert.h" -#include "lv_types.h" /********************* * DEFINES diff --git a/src/misc/lv_event.h b/src/misc/lv_event.h index f9ff4a7c37..a957977fcb 100644 --- a/src/misc/lv_event.h +++ b/src/misc/lv_event.h @@ -1,273 +1,2 @@ -/** - * @file lv_event.h - * - */ - -#ifndef LV_EVENT_H -#define LV_EVENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_types.h" -#include "../lv_conf_internal.h" - -#include "lv_array.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef void (*lv_event_cb_t)(lv_event_t * e); - -/** - * Type of event being sent to Widget - */ -typedef enum { - LV_EVENT_ALL = 0, - - /** Input device events*/ - LV_EVENT_PRESSED, /**< Widget has been pressed */ - LV_EVENT_PRESSING, /**< Widget is being pressed (sent continuously while pressing)*/ - LV_EVENT_PRESS_LOST, /**< Widget is still being pressed but slid cursor/finger off Widget */ - LV_EVENT_SHORT_CLICKED, /**< Widget was pressed for a short period of time, then released. Not sent if scrolled. */ - LV_EVENT_SINGLE_CLICKED, /**< Sent for first short click within a small distance and short time */ - LV_EVENT_DOUBLE_CLICKED, /**< Sent for second short click within small distance and short time */ - LV_EVENT_TRIPLE_CLICKED, /**< Sent for third short click within small distance and short time */ - LV_EVENT_LONG_PRESSED, /**< Object has been pressed for at least `long_press_time`. Not sent if scrolled. */ - LV_EVENT_LONG_PRESSED_REPEAT, /**< Sent after `long_press_time` in every `long_press_repeat_time` ms. Not sent if scrolled. */ - LV_EVENT_CLICKED, /**< Sent on release if not scrolled (regardless to long press)*/ - LV_EVENT_RELEASED, /**< Sent in every cases when Widget has been released */ - LV_EVENT_SCROLL_BEGIN, /**< Scrolling begins. The event parameter is a pointer to the animation of the scroll. Can be modified */ - LV_EVENT_SCROLL_THROW_BEGIN, - LV_EVENT_SCROLL_END, /**< Scrolling ends */ - LV_EVENT_SCROLL, /**< Scrolling */ - LV_EVENT_GESTURE, /**< A gesture is detected. Get gesture with `lv_indev_get_gesture_dir(lv_indev_active());` */ - LV_EVENT_KEY, /**< A key is sent to Widget. Get key with `lv_indev_get_key(lv_indev_active());`*/ - LV_EVENT_ROTARY, /**< An encoder or wheel was rotated. Get rotation count with `lv_event_get_rotary_diff(e);`*/ - LV_EVENT_FOCUSED, /**< Widget received focus */ - LV_EVENT_DEFOCUSED, /**< Widget's focus has been lost */ - LV_EVENT_LEAVE, /**< Widget's focus has been lost but is still selected */ - LV_EVENT_HIT_TEST, /**< Perform advanced hit-testing */ - LV_EVENT_INDEV_RESET, /**< Indev has been reset */ - LV_EVENT_HOVER_OVER, /**< Indev hover over object */ - LV_EVENT_HOVER_LEAVE, /**< Indev hover leave object */ - - /** Drawing events */ - LV_EVENT_COVER_CHECK, /**< Check if Widget fully covers an area. The event parameter is `lv_cover_check_info_t *`. */ - LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get required extra draw area around Widget (e.g. for shadow). The event parameter is `int32_t *` to store the size. */ - LV_EVENT_DRAW_MAIN_BEGIN, /**< Starting the main drawing phase */ - LV_EVENT_DRAW_MAIN, /**< Perform the main drawing */ - LV_EVENT_DRAW_MAIN_END, /**< Finishing the main drawing phase */ - LV_EVENT_DRAW_POST_BEGIN, /**< Starting the post draw phase (when all children are drawn)*/ - LV_EVENT_DRAW_POST, /**< Perform the post draw phase (when all children are drawn)*/ - LV_EVENT_DRAW_POST_END, /**< Finishing the post draw phase (when all children are drawn)*/ - LV_EVENT_DRAW_TASK_ADDED, /**< Adding a draw task. The `LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS` flag needs to be set */ - - /** Special events */ - LV_EVENT_VALUE_CHANGED, /**< Widget's value has changed (i.e. slider moved)*/ - LV_EVENT_INSERT, /**< Text has been inserted into Widget. The event data is `char *` being inserted. */ - LV_EVENT_REFRESH, /**< Notify Widget to refresh something on it (for user)*/ - LV_EVENT_READY, /**< A process has finished */ - LV_EVENT_CANCEL, /**< A process has been cancelled */ - LV_EVENT_STATE_CHANGED, /**< The state of the widget changed*/ - - /** Other events */ - LV_EVENT_CREATE, /**< Object is being created */ - LV_EVENT_DELETE, /**< Object is being deleted */ - LV_EVENT_CHILD_CHANGED, /**< Child was removed, added, or its size, position were changed */ - LV_EVENT_CHILD_CREATED, /**< Child was created, always bubbles up to all parents */ - LV_EVENT_CHILD_DELETED, /**< Child was deleted, always bubbles up to all parents */ - LV_EVENT_SCREEN_UNLOAD_START, /**< A screen unload started, fired immediately when scr_load is called */ - LV_EVENT_SCREEN_LOAD_START, /**< A screen load started, fired when the screen change delay is expired */ - LV_EVENT_SCREEN_LOADED, /**< A screen was loaded */ - LV_EVENT_SCREEN_UNLOADED, /**< A screen was unloaded */ - LV_EVENT_SIZE_CHANGED, /**< Object coordinates/size have changed */ - LV_EVENT_STYLE_CHANGED, /**< Object's style has changed */ - LV_EVENT_LAYOUT_CHANGED, /**< A child's position position has changed due to a layout recalculation */ - LV_EVENT_GET_SELF_SIZE, /**< Get internal size of a widget */ - - /** Events of optional LVGL components */ - LV_EVENT_INVALIDATE_AREA, /**< An area is invalidated (marked for redraw). `lv_event_get_param(e)` - * returns a pointer to an `lv_area_t` object with the coordinates of the - * area to be invalidated. The area can be freely modified if needed to - * adapt it a special requirement of the display. Usually needed with - * monochrome displays to invalidate `N x 8` rows or columns in one pass. */ - LV_EVENT_RESOLUTION_CHANGED, /**< Sent when the resolution changes due to `lv_display_set_resolution()` or `lv_display_set_rotation()`. */ - LV_EVENT_COLOR_FORMAT_CHANGED,/**< Sent as a result of any call to `lv_display_set_color_format()`. */ - LV_EVENT_REFR_REQUEST, /**< Sent when something happened that requires redraw. */ - LV_EVENT_REFR_START, /**< Sent before a refreshing cycle starts. Sent even if there is nothing to redraw. */ - LV_EVENT_REFR_READY, /**< Sent when refreshing has been completed (after rendering and calling flush callback). Sent even if no redraw happened. */ - LV_EVENT_RENDER_START, /**< Sent just before rendering begins. */ - LV_EVENT_RENDER_READY, /**< Sent after rendering has been completed. */ - LV_EVENT_FLUSH_START, /**< Sent before flush callback is called. */ - LV_EVENT_FLUSH_FINISH, /**< Sent after flush callback call has returned. */ - LV_EVENT_FLUSH_WAIT_START, /**< Sent before flush wait callback is called. */ - LV_EVENT_FLUSH_WAIT_FINISH, /**< Sent after flush wait callback call has returned. */ - LV_EVENT_SYNC_START, /**< Sent before sync callback is called. */ - LV_EVENT_SYNC_FINISH, /**< Sent after sync callback call has returned. */ - LV_EVENT_SYNC_WAIT_START, /**< Sent before sync wait callback is called. */ - LV_EVENT_SYNC_WAIT_FINISH, /**< Sent after sync wait callback call has returned. */ - LV_EVENT_UPDATE_LAYOUT_COMPLETED, /**< Sent after layout update completes*/ - - LV_EVENT_VSYNC, - LV_EVENT_VSYNC_REQUEST, -#if LV_USE_TRANSLATION - LV_EVENT_TRANSLATION_LANGUAGE_CHANGED, /**< Sent when the translation language changed. */ -#endif /*LV_USE_TRANSLATION*/ - - LV_EVENT_LAST, /** Number of default events */ - - LV_EVENT_PREPROCESS = 0x8000, /** This is a flag that can be set with an event so it's processed - before the class default event processing */ - LV_EVENT_MARKED_DELETING = 0x10000, -} lv_event_code_t; - -typedef struct { - lv_array_t array; - uint8_t is_traversing: 1; /**< True: the list is being nested traversed */ - uint8_t has_marked_deleting: 1; /**< True: the list has marked deleting objects - when some of events are marked as deleting */ -} lv_event_list_t; - -/** - * @brief Event callback. - * Events are used to notify the user of some action being taken on Widget. - * For details, see ::lv_event_t. - */ - -lv_result_t lv_event_send(lv_event_list_t * list, lv_event_t * e, bool preprocess); - -lv_event_dsc_t * lv_event_add(lv_event_list_t * list, lv_event_cb_t cb, lv_event_code_t filter, void * user_data); -bool lv_event_remove_dsc(lv_event_list_t * list, lv_event_dsc_t * dsc); - -uint32_t lv_event_get_count(lv_event_list_t * list); - -lv_event_dsc_t * lv_event_get_dsc(lv_event_list_t * list, uint32_t index); - -lv_event_cb_t lv_event_dsc_get_cb(lv_event_dsc_t * dsc); - -void * lv_event_dsc_get_user_data(lv_event_dsc_t * dsc); - -bool lv_event_remove(lv_event_list_t * list, uint32_t index); - -void lv_event_remove_all(lv_event_list_t * list); - -/** - * Get Widget originally targeted by the event. It's the same even if event was bubbled. - * @param e pointer to the event descriptor - * @return the target of the event_code - */ -void * lv_event_get_target(lv_event_t * e); - -/** - * Get current target of the event. It's the Widget for which the event handler being called. - * If the event is not bubbled it's the same as "normal" target. - * @param e pointer to the event descriptor - * @return pointer to the current target of the event_code - */ -void * lv_event_get_current_target(lv_event_t * e); - -/** - * Get event code of an event. - * @param e pointer to the event descriptor - * @return the event code. (E.g. `LV_EVENT_CLICKED`, `LV_EVENT_FOCUSED`, etc) - */ -lv_event_code_t lv_event_get_code(lv_event_t * e); - -/** - * Get parameter passed when event was sent. - * @param e pointer to the event descriptor - * @return pointer to the parameter - */ -void * lv_event_get_param(lv_event_t * e); - -/** - * Get user_data passed when event was registered on Widget. - * @param e pointer to the event descriptor - * @return pointer to the user_data - */ -void * lv_event_get_user_data(lv_event_t * e); - -/** - * Stop event from bubbling. - * This is only valid when called in the middle of an event processing chain. - * @param e pointer to the event descriptor - */ -void lv_event_stop_bubbling(lv_event_t * e); - -/** - * Stop event from trickling down to children. - * This is only valid when called in the middle of an event processing chain. - * @param e pointer to the event descriptor - */ -void lv_event_stop_trickling(lv_event_t * e); - -/** - * Stop processing this event. - * This is only valid when called in the middle of an event processing chain. - * @param e pointer to the event descriptor - */ -void lv_event_stop_processing(lv_event_t * e); - -/** - * Helper function typically used in LV_EVENT_DELETE - * to free the event's user_data - * @param e pointer to an event descriptor - */ -void lv_event_free_user_data_cb(lv_event_t * e); - - -/** - * Register a new, custom event ID. - * It can be used the same way as e.g. `LV_EVENT_CLICKED` to send custom events - * @return the new event id - * - * Example: - * @code - * uint32_t LV_EVENT_MINE = 0; - * ... - * e = lv_event_register_id(); - * ... - * lv_obj_send_event(obj, LV_EVENT_MINE, &some_data); - * @endcode - */ -uint32_t lv_event_register_id(void); - -/** - * Get the name of an event code. - * @param code the event code - * @return the name of the event code as a string - */ -const char * lv_event_code_get_name(lv_event_code_t code); - -#if LV_USE_EXT_DATA -/** - * Set external data and its destructor for an event descriptor. - * This allows associating custom data with an event callback that will be automatically cleaned up - * when the event descriptor is removed or destroyed. - * @param dsc pointer to an event descriptor (from lv_obj_add_event_cb) - * @param data pointer to the external data to associate with the event descriptor - * @param free_cb function pointer to a destructor that will be called to clean up the external data. - * The destructor will receive the data pointer as its parameter. - */ -void lv_event_desc_set_external_data(lv_event_dsc_t * dsc, void * data, void (* free_cb)(void * data)); -#endif - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_EVENT_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_event_private.h b/src/misc/lv_event_private.h index 92efc3e812..862e169389 100644 --- a/src/misc/lv_event_private.h +++ b/src/misc/lv_event_private.h @@ -14,8 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_ext_data.h" -#include "lv_event.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_ext_data.h b/src/misc/lv_ext_data.h index a7d288eed4..3dddc5af2a 100644 --- a/src/misc/lv_ext_data.h +++ b/src/misc/lv_ext_data.h @@ -1,44 +1,2 @@ -/** - * @file lv_ext_data.h - * - */ - -#ifndef LV_EXT_DATA_H -#define LV_EXT_DATA_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -#if LV_USE_EXT_DATA -typedef struct { - void * data; - void (* free_cb)(void * data); -} lv_ext_data_t; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_EXT_DATA_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_fs.c b/src/misc/lv_fs.c index f50ada6401..80b28346f4 100644 --- a/src/misc/lv_fs.c +++ b/src/misc/lv_fs.c @@ -6,12 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_fs_private.h" -#include "../misc/lv_assert.h" -#include "../misc/lv_profiler.h" -#include "../stdlib/lv_string.h" -#include "lv_ll.h" +#include "lv_fs_private.h" #include "../core/lv_global.h" /********************* diff --git a/src/misc/lv_fs.h b/src/misc/lv_fs.h index 62bbfad6d9..dbc2a7e40e 100644 --- a/src/misc/lv_fs.h +++ b/src/misc/lv_fs.h @@ -1,344 +1,2 @@ -/** - * @file lv_fs.h - * - */ - -#ifndef LV_FS_H -#define LV_FS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ -#define LV_FS_MAX_FN_LENGTH 64 -#define LV_FS_MAX_PATH_LENGTH 256 - -#define LV_FS_CACHE_FROM_BUFFER UINT32_MAX - -/********************** - * TYPEDEFS - **********************/ - -/** - * Errors in the file system module. - */ -typedef enum { - LV_FS_RES_OK = 0, - LV_FS_RES_HW_ERR, /*Low level hardware error*/ - LV_FS_RES_FS_ERR, /*Error in the file system structure*/ - LV_FS_RES_NOT_EX, /*Driver, file or directory is not exists*/ - LV_FS_RES_FULL, /*Disk full*/ - LV_FS_RES_LOCKED, /*The file is already opened*/ - LV_FS_RES_DENIED, /*Access denied. Check 'fs_open' modes and write protect*/ - LV_FS_RES_BUSY, /*The file system now can't handle it, try later*/ - LV_FS_RES_TOUT, /*Process time outed*/ - LV_FS_RES_NOT_IMP, /*Requested function is not implemented*/ - LV_FS_RES_OUT_OF_MEM, /*Not enough memory for an internal operation*/ - LV_FS_RES_INV_PARAM, /*Invalid parameter among arguments*/ - LV_FS_RES_DRIVE_LETTER_ALREADY_USED, /*A drive with this letter is already registered*/ - LV_FS_RES_UNKNOWN, /*Other unknown error*/ -} lv_fs_res_t; - -/** - * File open mode. - */ -typedef enum { - LV_FS_MODE_WR = 0x01, - LV_FS_MODE_RD = 0x02, -} lv_fs_mode_t; - -/** - * Seek modes. - */ -typedef enum { - LV_FS_SEEK_SET = 0x00, /**< Set the position from absolutely (from the start of file)*/ - LV_FS_SEEK_CUR = 0x01, /**< Set the position from the current position*/ - LV_FS_SEEK_END = 0x02, /**< Set the position from the end of the file*/ -} lv_fs_whence_t; - -struct _lv_fs_drv_t; -typedef struct _lv_fs_drv_t lv_fs_drv_t; -struct _lv_fs_drv_t { - char letter; - uint32_t cache_size; - bool (*ready_cb)(lv_fs_drv_t * drv); - - void(*remove_cb)(lv_fs_drv_t * drv); /*Optional*/ - - void * (*open_cb)(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode); - lv_fs_res_t (*close_cb)(lv_fs_drv_t * drv, void * file_p); - lv_fs_res_t (*read_cb)(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br); - lv_fs_res_t (*write_cb)(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw); - lv_fs_res_t (*seek_cb)(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence); - lv_fs_res_t (*tell_cb)(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p); - - void * (*dir_open_cb)(lv_fs_drv_t * drv, const char * path); - lv_fs_res_t (*dir_read_cb)(lv_fs_drv_t * drv, void * rddir_p, char * fn, uint32_t fn_len); - lv_fs_res_t (*dir_close_cb)(lv_fs_drv_t * drv, void * rddir_p); - - void * user_data; /**< Custom file user data*/ -}; - -typedef struct { - void * file_d; - lv_fs_drv_t * drv; - lv_fs_file_cache_t * cache; -} lv_fs_file_t; - - -typedef struct { - void * dir_d; - lv_fs_drv_t * drv; -} lv_fs_dir_t; - - -/** Extended path object to specify buffer for memory-mapped files */ -typedef struct { - char path[64]; /**< Store the driver letter address and size*/ -} lv_fs_path_ex_t; - - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a file system driver with default values. - * It is used to ensure all fields have known values and not memory junk. - * After it you can set the fields. - * @param drv pointer to driver variable to initialize - */ -void lv_fs_drv_init(lv_fs_drv_t * drv); - -/** - * Add a new drive - * @param drv pointer to an lv_fs_drv_t structure which is inited with the - * corresponding function pointers. Only pointer is saved, so the - * driver should be static or dynamically allocated. - */ -void lv_fs_drv_register(lv_fs_drv_t * drv); - -/** - * Give a pointer to a driver from its letter - * @param letter the driver-identifier letter - * @return pointer to a driver or NULL if not found - */ -lv_fs_drv_t * lv_fs_get_drv(char letter); - -/** - * Remove a drive and call its remove function if available - * @param letter letter identifier of the drive to remove - */ -void lv_fs_remove_drive(char letter); - -/** - * Test if a drive is ready or not. If the `ready` function was not initialized `true` will be - * returned. - * @param letter letter of the drive - * @return true: drive is ready; false: drive is not ready - */ -bool lv_fs_is_ready(char letter); - -/** - * Open a file - * @param file_p pointer to a lv_fs_file_t variable - * @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt) - * @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -lv_fs_res_t lv_fs_open(lv_fs_file_t * file_p, const char * path, lv_fs_mode_t mode); - -/** - * Create a special object from buffer/ memory address which looks like a file and can be passed - * as path to `lv_fs_open` and other functions accepting a path. - * - * For example - * @code - * //Create a PNG file from t a buffer and use it - * lv_fs_path_ex_t p; - * lv_fs_make_path_from_buffer(&p, 'A', my_buf, my_buf_size, "png"); - * lv_image_set_src(image1, &p); - * - * @endcode - * @param path path to a lv_fs_path_ex object - * @param letter the identifier letter of the driver. E.g. `LV_FS_MEMFS_LETTER` - * @param buf address of the memory buffer - * @param size size of the memory buffer in bytes - * @param ext the extension, e.g. "png", if NULL no extension will be added. - */ -void lv_fs_make_path_from_buffer(lv_fs_path_ex_t * path, char letter, const void * buf, uint32_t size, - const char * ext); - -/** - * Get the buffer address and size from a path object - * @param path pointer to an initialized `lv_fs_path_ex` data - * @param buffer pointer to a `void *` variable to store the address - * @param size pointer to an `uint32_t` data to store the size - * @return LV_RESULT_OK: buffer and size are set; LV_RESULT_INVALID: an error happened. - */ -lv_result_t lv_fs_get_buffer_from_path(lv_fs_path_ex_t * path, void ** buffer, uint32_t * size); - -/** - * Close an already opened file - * @param file_p pointer to a lv_fs_file_t variable - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p); - -/** - * Read from a file - * @param file_p pointer to a lv_fs_file_t variable - * @param buf pointer to a buffer where the read bytes are stored - * @param btr Bytes To Read - * @param br the number of real read bytes (Bytes Read). NULL if unused. - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -lv_fs_res_t lv_fs_read(lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t * br); - -/** - * Write into a file - * @param file_p pointer to a lv_fs_file_t variable - * @param buf pointer to a buffer with the bytes to write - * @param btw Bytes To Write - * @param bw the number of real written bytes (Bytes Written). NULL if unused. - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -lv_fs_res_t lv_fs_write(lv_fs_file_t * file_p, const void * buf, uint32_t btw, uint32_t * bw); - -/** - * Set the position of the 'cursor' (read write pointer) in a file - * @param file_p pointer to a lv_fs_file_t variable - * @param pos the new position expressed in bytes index (0: start of file) - * @param whence tells from where to set position. See lv_fs_whence_t - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -lv_fs_res_t lv_fs_seek(lv_fs_file_t * file_p, uint32_t pos, lv_fs_whence_t whence); - -/** - * Give the position of the read write pointer - * @param file_p pointer to a lv_fs_file_t variable - * @param pos pointer to store the position of the read write pointer - * @return LV_FS_RES_OK or any error from 'fs_res_t' - */ -lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos); - -/** - * Get the size in bytes of an open file. - * The file read/write position will not be affected. - * @param file_p pointer to a lv_fs_file_t variable - * @param size_res pointer to store the file size - * @return LV_FS_RES_OK or any error from `lv_fs_res_t` - */ -lv_fs_res_t lv_fs_get_size(lv_fs_file_t * file_p, uint32_t * size_res); - -/** - * Get the size in bytes of a file at the given path. - * @param path the path of the file - * @param size_res pointer to store the file size - * @return LV_FS_RES_OK or any error from `lv_fs_res_t` - */ -lv_fs_res_t lv_fs_path_get_size(const char * path, uint32_t * size_res); - -/** - * Read the contents of a file at the given path into a buffer. - * @param buf a buffer to read the contents of the file into - * @param buf_size the size of the buffer and the amount to read from the file - * @param path the path of the file - * @return LV_FS_RES_OK on success, LV_FS_RES_UNKNOWN if fewer than - * `buf_size` bytes could be read from the file, - * or any error from `lv_fs_res_t` - */ -lv_fs_res_t lv_fs_load_to_buf(void * buf, uint32_t buf_size, const char * path); - -/** - * Load a file into a memory buffer. - * @param filename the path of the file - * @param size pointer to store the size of the loaded file - * @return a pointer to the loaded file buffer, or NULL if an error occurred - */ -void * lv_fs_load_with_alloc(const char * path, uint32_t * size); - -/** - * Initialize a 'fs_dir_t' variable for directory reading - * @param rddir_p pointer to a 'lv_fs_dir_t' variable - * @param path path to a directory - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path); - -/** - * Read the next filename form a directory. - * The name of the directories will begin with '/' - * @param rddir_p pointer to an initialized 'fs_dir_t' variable - * @param fn pointer to a buffer to store the filename - * @param fn_len length of the buffer to store the filename - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn, uint32_t fn_len); - -/** - * Close the directory reading - * @param rddir_p pointer to an initialized 'fs_dir_t' variable - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p); - -/** - * Fill a buffer with the letters of existing drivers - * @param buf buffer to store the letters ('\0' added after the last letter) - * @return the buffer - */ -char * lv_fs_get_letters(char * buf); - -/** - * Return with the extension of the filename - * @param fn string with a filename - * @return pointer to the beginning extension or empty string if no extension - */ -const char * lv_fs_get_ext(const char * fn); - -/** - * Step up one level - * @param path pointer to a file name - * @return the truncated file name - */ -char * lv_fs_up(char * path); - -/** - * Get the last element of a path (e.g. U:/folder/file -> file) - * @param path pointer to a file name - * @return pointer to the beginning of the last element in the path - */ -const char * lv_fs_get_last(const char * path); - -/** - * Concatenate two path components and automatically add/remove a separator as needed. - * buf, buf_sz, and the return value are analogous to lv_snprintf - * @param buf the buffer to place the result in - * @param buf_sz the size of buf. At most buf_sz - 1 characters will be written to buf, - * and a null terminator - * @param base the first path component - * @param end the second path component - * @return the number of characters (not including the null terminator) - * that would be written to buf, even if buf_sz-1 was smaller - */ -int lv_fs_path_join(char * buf, size_t buf_sz, const char * base, const char * end); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_FS_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_fs_private.h b/src/misc/lv_fs_private.h index 0c67840080..49dd4be8c2 100644 --- a/src/misc/lv_fs_private.h +++ b/src/misc/lv_fs_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_fs.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_grad.c b/src/misc/lv_grad.c index 298837aa1f..c0ca035c00 100644 --- a/src/misc/lv_grad.c +++ b/src/misc/lv_grad.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_grad.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_grad.h b/src/misc/lv_grad.h index 60f880fba3..9f7565fbb0 100644 --- a/src/misc/lv_grad.h +++ b/src/misc/lv_grad.h @@ -1,176 +1,2 @@ -/** - * @file lv_grad.h - * - */ - -#ifndef LV_GRAD_H -#define LV_GRAD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_color.h" -#include "lv_area.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * The direction of the gradient. - */ -typedef enum { - LV_GRAD_DIR_NONE, /**< No gradient (the `grad_color` property is ignored)*/ - LV_GRAD_DIR_VER, /**< Simple vertical (top to bottom) gradient*/ - LV_GRAD_DIR_HOR, /**< Simple horizontal (left to right) gradient*/ - LV_GRAD_DIR_LINEAR, /**< Linear gradient defined by start and end points. Can be at any angle.*/ - LV_GRAD_DIR_RADIAL, /**< Radial gradient defined by start and end circles*/ - LV_GRAD_DIR_CONICAL, /**< Conical gradient defined by center point, start and end angles*/ -} lv_grad_dir_t; - -/** - * Gradient behavior outside the defined range. - */ -typedef enum { - LV_GRAD_EXTEND_PAD, /**< Repeat the same color*/ - LV_GRAD_EXTEND_REPEAT, /**< Repeat the pattern*/ - LV_GRAD_EXTEND_REFLECT, /**< Repeat the pattern mirrored*/ -} lv_grad_extend_t; - -/** A gradient stop definition. - * This matches a color and a position in a virtual 0-255 scale. - */ -typedef struct { - lv_color_t color; /**< The stop color */ - lv_opa_t opa; /**< The opacity of the color*/ - uint8_t frac; /**< The stop position in 1/255 unit */ -} lv_grad_stop_t; - -/** A descriptor of a gradient. */ -typedef struct { - lv_grad_stop_t stops[LV_GRADIENT_MAX_STOPS]; /**< A gradient stop array */ - uint8_t stops_count; /**< The number of used stops in the array */ - lv_grad_dir_t dir : 4; /**< The gradient direction. - * Any of LV_GRAD_DIR_NONE, LV_GRAD_DIR_VER, LV_GRAD_DIR_HOR, - * LV_GRAD_TYPE_LINEAR, LV_GRAD_TYPE_RADIAL, LV_GRAD_TYPE_CONICAL */ - lv_grad_extend_t extend : 3; /**< Behaviour outside the defined range. - * LV_GRAD_EXTEND_NONE, LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT, LV_GRAD_EXTEND_REFLECT */ - union { - /*Linear gradient parameters*/ - struct { - lv_point_t start; /**< Linear gradient vector start point */ - lv_point_t end; /**< Linear gradient vector end point */ - } linear; - /*Radial gradient parameters*/ - struct { - lv_point_t focal; /**< Center of the focal (starting) circle in local coordinates */ - /* (can be the same as the ending circle to create concentric circles) */ - lv_point_t focal_extent; /**< Point on the circle (can be the same as the center) */ - lv_point_t end; /**< Center of the ending circle in local coordinates */ - lv_point_t end_extent; /**< Point on the circle determining the radius of the gradient */ - } radial; - /*Conical gradient parameters*/ - struct { - lv_point_t center; /**< Conical gradient center point */ - int16_t start_angle; /**< Start angle 0..3600 */ - int16_t end_angle; /**< End angle 0..3600 */ - } conical; - } params; - void * state; -} lv_grad_dsc_t; - - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize gradient color map from a table - * @param grad pointer to a gradient descriptor - * @param colors color array - * @param fracs position array (0..255): if NULL, then colors are distributed evenly - * @param opa opacity array: if NULL, then LV_OPA_COVER is assumed - * @param num_stops number of gradient stops (1..LV_GRADIENT_MAX_STOPS) - */ -void lv_grad_init_stops(lv_grad_dsc_t * grad, const lv_color_t colors[], const lv_opa_t opa[], - const uint8_t fracs[], int num_stops); - -/** - * Helper function to initialize a horizontal gradient. - * @param dsc gradient descriptor - */ -void lv_grad_horizontal_init(lv_grad_dsc_t * dsc); - -/** - * Helper function to initialize a vertical gradient. - * @param dsc gradient descriptor - */ -void lv_grad_vertical_init(lv_grad_dsc_t * dsc); - -/** - * Helper function to initialize linear gradient - * @param dsc gradient descriptor - * @param from_x start x position: can be a coordinate or an lv_pct() value - * predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well - * @param from_y start y position - * @param to_x end x position - * @param to_y end y position - * @param extend one of LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT or LV_GRAD_EXTEND_REFLECT - */ -void lv_grad_linear_init(lv_grad_dsc_t * dsc, int32_t from_x, int32_t from_y, int32_t to_x, int32_t to_y, - lv_grad_extend_t extend); - -/** - * Helper function to initialize radial gradient - * @param dsc gradient descriptor - * @param center_x center x position: can be a coordinate or an lv_pct() value - * predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well - * @param center_y center y position - * @param to_x point on the end circle x position - * @param to_y point on the end circle y position - * @param extend one of LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT or LV_GRAD_EXTEND_REFLECT - */ -void lv_grad_radial_init(lv_grad_dsc_t * dsc, int32_t center_x, int32_t center_y, int32_t to_x, int32_t to_y, - lv_grad_extend_t extend); - -/** - * Set focal (starting) circle of a radial gradient - * @param dsc gradient descriptor - * @param center_x center x position: can be a coordinate or an lv_pct() value - * predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well - * @param center_y center y position - * @param radius radius of the starting circle (NOTE: this must be a scalar number, not percentage) - */ -void lv_grad_radial_set_focal(lv_grad_dsc_t * dsc, int32_t center_x, int32_t center_y, int32_t radius); - -/** - * Helper function to initialize conical gradient - * @param dsc gradient descriptor - * @param center_x center x position: can be a coordinate or an lv_pct() value - * predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well - * @param center_y center y position - * @param start_angle start angle in degrees - * @param end_angle end angle in degrees - * @param extend one of LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT or LV_GRAD_EXTEND_REFLECT - */ -void lv_grad_conical_init(lv_grad_dsc_t * dsc, int32_t center_x, int32_t center_y, int32_t start_angle, - int32_t end_angle, lv_grad_extend_t extend); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_GRAD_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_iter.c b/src/misc/lv_iter.c index cb6377c0b5..fffedb356c 100644 --- a/src/misc/lv_iter.c +++ b/src/misc/lv_iter.c @@ -7,11 +7,8 @@ * INCLUDES *********************/ -#include "lv_assert.h" - -#include "lv_iter.h" - -#include "lv_circle_buf.h" +#include "lv_iter_private.h" +#include "lv_circle_buf_private.h" /********************* * DEFINES diff --git a/src/misc/lv_iter.h b/src/misc/lv_iter.h index 469d441e76..49c41f48ac 100644 --- a/src/misc/lv_iter.h +++ b/src/misc/lv_iter.h @@ -1,120 +1,3 @@ -/** -* @file lv_iter.h -* - */ +#warning "lv_iter" is no longer part of the public API and will be removed in the future. - -#ifndef LV_ITER_H -#define LV_ITER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef lv_result_t (*lv_iter_next_cb)(void * instance, void * context, void * elem); -typedef void (*lv_iter_inspect_cb)(void * elem); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an iterator based on an instance, and then the next element of the iterator can be obtained through lv_iter_next, - * In order to obtain the next operation in a unified and abstract way. - * @param instance The instance to be iterated - * @param elem_size The size of the element to be iterated in bytes - * @param context_size The size of the context to be passed to the next_cb in bytes - * @param next_cb The callback function to get the next element - * @return The iterator object - */ -lv_iter_t * lv_iter_create(void * instance, uint32_t elem_size, uint32_t context_size, lv_iter_next_cb next_cb); - -/** - * Get the context of the iterator. You can use it to store some temporary variables associated with current iterator.. - * @param iter `lv_iter_t` object create before - * @return the iter context - */ -void * lv_iter_get_context(const lv_iter_t * iter); - -/** - * Destroy the iterator object, and release the context. Other resources allocated by the user are not released. - * The user needs to release it by itself. - * @param iter `lv_iter_t` object create before - */ -void lv_iter_destroy(lv_iter_t * iter); - -/** - * Get the next element of the iterator. - * @param iter `lv_iter_t` object create before - * @param elem The pointer to store the next element - * @return LV_RESULT_OK: Get the next element successfully - * LV_RESULT_INVALID: The next element is invalid - */ -lv_result_t lv_iter_next(lv_iter_t * iter, void * elem); - -/** - * Make the iterator peekable, which means that the user can peek the next element without advancing the iterator. - * @param iter `lv_iter_t` object create before - * @param capacity The capacity of the peek buffer - */ -void lv_iter_make_peekable(lv_iter_t * iter, uint32_t capacity); - -/** - * Peek the next element of the iterator without advancing the iterator. - * @param iter `lv_iter_t` object create before - * @param elem The pointer to store the next element - * @return LV_RESULT_OK: Peek the next element successfully - * LV_RESULT_INVALID: The next element is invalid - */ -lv_result_t lv_iter_peek(lv_iter_t * iter, void * elem); - -/** - * Only advance the iterator without getting the next element. - * @param iter `lv_iter_t` object create before - * @return LV_RESULT_OK: Peek the next element successfully - * LV_RESULT_INVALID: The next element is invalid - */ -lv_result_t lv_iter_peek_advance(lv_iter_t * iter); - -/** - * Reset the peek cursor to the `next` cursor. - * @param iter `lv_iter_t` object create before - * @return LV_RESULT_OK: Reset the peek buffer successfully - * LV_RESULT_INVALID: The peek buffer is invalid - */ -lv_result_t lv_iter_peek_reset(lv_iter_t * iter); - -/** - * Inspect the element of the iterator. The callback function will be called for each element of the iterator. - * @param iter `lv_iter_t` object create before - * @param inspect_cb The callback function to inspect the element - */ -void lv_iter_inspect(lv_iter_t * iter, lv_iter_inspect_cb inspect_cb); - -/************************* - * GLOBAL VARIABLES - *************************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ITER_H*/ +#include "lv_iter_private.h" diff --git a/src/misc/lv_iter_private.h b/src/misc/lv_iter_private.h new file mode 100644 index 0000000000..97c9a82c4c --- /dev/null +++ b/src/misc/lv_iter_private.h @@ -0,0 +1,121 @@ +/** +* @file lv_iter_private.h +* + */ + + +#ifndef LV_ITER_PRIVATE_H +#define LV_ITER_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../lv_public_api.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct _lv_iter_t lv_iter_t; +typedef lv_result_t (*lv_iter_next_cb)(void * instance, void * context, void * elem); +typedef void (*lv_iter_inspect_cb)(void * elem); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create an iterator based on an instance, and then the next element of the iterator can be obtained through lv_iter_next, + * In order to obtain the next operation in a unified and abstract way. + * @param instance The instance to be iterated + * @param elem_size The size of the element to be iterated in bytes + * @param context_size The size of the context to be passed to the next_cb in bytes + * @param next_cb The callback function to get the next element + * @return The iterator object + */ +lv_iter_t * lv_iter_create(void * instance, uint32_t elem_size, uint32_t context_size, lv_iter_next_cb next_cb); + +/** + * Get the context of the iterator. You can use it to store some temporary variables associated with current iterator.. + * @param iter `lv_iter_t` object create before + * @return the iter context + */ +void * lv_iter_get_context(const lv_iter_t * iter); + +/** + * Destroy the iterator object, and release the context. Other resources allocated by the user are not released. + * The user needs to release it by itself. + * @param iter `lv_iter_t` object create before + */ +void lv_iter_destroy(lv_iter_t * iter); + +/** + * Get the next element of the iterator. + * @param iter `lv_iter_t` object create before + * @param elem The pointer to store the next element + * @return LV_RESULT_OK: Get the next element successfully + * LV_RESULT_INVALID: The next element is invalid + */ +lv_result_t lv_iter_next(lv_iter_t * iter, void * elem); + +/** + * Make the iterator peekable, which means that the user can peek the next element without advancing the iterator. + * @param iter `lv_iter_t` object create before + * @param capacity The capacity of the peek buffer + */ +void lv_iter_make_peekable(lv_iter_t * iter, uint32_t capacity); + +/** + * Peek the next element of the iterator without advancing the iterator. + * @param iter `lv_iter_t` object create before + * @param elem The pointer to store the next element + * @return LV_RESULT_OK: Peek the next element successfully + * LV_RESULT_INVALID: The next element is invalid + */ +lv_result_t lv_iter_peek(lv_iter_t * iter, void * elem); + +/** + * Only advance the iterator without getting the next element. + * @param iter `lv_iter_t` object create before + * @return LV_RESULT_OK: Peek the next element successfully + * LV_RESULT_INVALID: The next element is invalid + */ +lv_result_t lv_iter_peek_advance(lv_iter_t * iter); + +/** + * Reset the peek cursor to the `next` cursor. + * @param iter `lv_iter_t` object create before + * @return LV_RESULT_OK: Reset the peek buffer successfully + * LV_RESULT_INVALID: The peek buffer is invalid + */ +lv_result_t lv_iter_peek_reset(lv_iter_t * iter); + +/** + * Inspect the element of the iterator. The callback function will be called for each element of the iterator. + * @param iter `lv_iter_t` object create before + * @param inspect_cb The callback function to inspect the element + */ +void lv_iter_inspect(lv_iter_t * iter, lv_iter_inspect_cb inspect_cb); + +/************************* + * GLOBAL VARIABLES + *************************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ITER_PRIVATE_H*/ diff --git a/src/misc/lv_ll.c b/src/misc/lv_ll.c index 9d86f1daac..59f08babab 100644 --- a/src/misc/lv_ll.c +++ b/src/misc/lv_ll.c @@ -7,8 +7,8 @@ /********************* * INCLUDES *********************/ -#include "lv_ll.h" -#include "../stdlib/lv_mem.h" + +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_ll.h b/src/misc/lv_ll.h index ee0836ef5e..35b36a7774 100644 --- a/src/misc/lv_ll.h +++ b/src/misc/lv_ll.h @@ -1,169 +1,2 @@ -/** - * @file lv_ll.h - * Handle linked lists. The nodes are dynamically allocated by the 'lv_mem' module. - */ - -#ifndef LV_LL_H -#define LV_LL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** Dummy type to make handling easier*/ -typedef uint8_t lv_ll_node_t; - -/** Description of a linked list*/ -typedef struct { - uint32_t n_size; - lv_ll_node_t * head; - lv_ll_node_t * tail; -} lv_ll_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize linked list - * @param ll_p pointer to lv_ll_t variable - * @param node_size the size of 1 node in bytes - */ -void lv_ll_init(lv_ll_t * ll_p, uint32_t node_size); - -/** - * Add a new head to a linked list - * @param ll_p pointer to linked list - * @return pointer to the new head - */ -void * lv_ll_ins_head(lv_ll_t * ll_p); - -/** - * Insert a new node in front of the n_act node - * @param ll_p pointer to linked list - * @param n_act pointer a node - * @return pointer to the new node - */ -void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act); - -/** - * Add a new tail to a linked list - * @param ll_p pointer to linked list - * @return pointer to the new tail - */ -void * lv_ll_ins_tail(lv_ll_t * ll_p); - -/** - * Remove the node 'node_p' from 'll_p' linked list. - * It does not free the memory of node. - * @param ll_p pointer to the linked list of 'node_p' - * @param node_p pointer to node in 'll_p' linked list - */ -void lv_ll_remove(lv_ll_t * ll_p, void * node_p); - -void lv_ll_clear_custom(lv_ll_t * ll_p, void(*cleanup)(void *)); - -/** - * Remove and free all elements from a linked list. The list remain valid but become empty. - * @param ll_p pointer to linked list - */ -void lv_ll_clear(lv_ll_t * ll_p); - -/** - * Move a node to a new linked list - * @param ll_ori_p pointer to the original (old) linked list - * @param ll_new_p pointer to the new linked list - * @param node pointer to a node - * @param head true: be the head in the new list - * false be the tail in the new list - */ -void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head); - -/** - * Return with head node of the linked list - * @param ll_p pointer to linked list - * @return pointer to the head of 'll_p' - */ -void * lv_ll_get_head(const lv_ll_t * ll_p); - -/** - * Return with tail node of the linked list - * @param ll_p pointer to linked list - * @return pointer to the tail of 'll_p' - */ -void * lv_ll_get_tail(const lv_ll_t * ll_p); - -/** - * Return with the pointer of the next node after 'n_act' - * @param ll_p pointer to linked list - * @param n_act pointer a node - * @return pointer to the next node - */ -void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act); - -/** - * Return with the pointer of the previous node after 'n_act' - * @param ll_p pointer to linked list - * @param n_act pointer a node - * @return pointer to the previous node - */ -void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act); - -/** - * Return the length of the linked list. - * @param ll_p pointer to linked list - * @return length of the linked list - */ -uint32_t lv_ll_get_len(const lv_ll_t * ll_p); - -/* - * TODO - * @param ll_p - * @param n1_p - * @param n2_p -void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p); - */ - -/** - * Move a node before another node in the same linked list - * - * @param ll_p pointer to a linked list - * @param n_act pointer to node to move - * @param n_after pointer to a node which should be after `n_act` - */ -void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after); - -/** - * Check if a linked list is empty - * @param ll_p pointer to a linked list - * @return true: the linked list is empty; false: not empty - */ -bool lv_ll_is_empty(lv_ll_t * ll_p); - -/********************** - * MACROS - **********************/ - -#define LV_LL_READ(list, i) for(i = lv_ll_get_head(list); i != NULL; i = lv_ll_get_next(list, i)) - -#define LV_LL_READ_BACK(list, i) for(i = lv_ll_get_tail(list); i != NULL; i = lv_ll_get_prev(list, i)) - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_log.c b/src/misc/lv_log.c index 4dd197587d..33db65a458 100644 --- a/src/misc/lv_log.c +++ b/src/misc/lv_log.c @@ -6,14 +6,10 @@ /********************* * INCLUDES *********************/ -#include "lv_log.h" +#include "../lv_public_api.h" + #if LV_USE_LOG -#include "../misc/lv_types.h" -#include "../stdlib/lv_sprintf.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" -#include "../tick/lv_tick.h" #include "../core/lv_global.h" #if LV_LOG_PRINTF diff --git a/src/misc/lv_log.h b/src/misc/lv_log.h index 305d309f5d..c9ba0c6b13 100644 --- a/src/misc/lv_log.h +++ b/src/misc/lv_log.h @@ -1,162 +1,2 @@ -/** - * @file lv_log.h - * - */ - -#ifndef LV_LOG_H -#define LV_LOG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -/*Possible log level. For compatibility declare it independently from `LV_USE_LOG`*/ - -#define LV_LOG_LEVEL_TRACE 0 /**< Log detailed information. */ -#define LV_LOG_LEVEL_INFO 1 /**< Log important events. */ -#define LV_LOG_LEVEL_WARN 2 /**< Log if something unwanted happened but didn't caused problem. */ -#define LV_LOG_LEVEL_ERROR 3 /**< Log only critical issues, when system may fail. */ -#define LV_LOG_LEVEL_USER 4 /**< Log only custom log messages added by the user. */ -#define LV_LOG_LEVEL_NONE 5 /**< Do not log anything. */ -#define LV_LOG_LEVEL_NUM 5 /**< Number of log levels */ - -LV_EXPORT_CONST_INT(LV_LOG_LEVEL_TRACE); -LV_EXPORT_CONST_INT(LV_LOG_LEVEL_INFO); -LV_EXPORT_CONST_INT(LV_LOG_LEVEL_WARN); -LV_EXPORT_CONST_INT(LV_LOG_LEVEL_ERROR); -LV_EXPORT_CONST_INT(LV_LOG_LEVEL_USER); -LV_EXPORT_CONST_INT(LV_LOG_LEVEL_NONE); - -typedef int8_t lv_log_level_t; - -#if LV_USE_LOG - -#if LV_LOG_USE_FILE_LINE -#define LV_LOG_FILE __FILE__ -#define LV_LOG_LINE __LINE__ -#else -#define LV_LOG_FILE NULL -#define LV_LOG_LINE 0 -#endif - -/********************** - * TYPEDEFS - **********************/ - -/** - * Log print function. Receives a string buffer to print". - */ -typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char * buf); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Register custom print/write function to call when a log is added. - * It can format its "File path", "Line number" and "Description" as required - * and send the formatted log message to a console or serial port. - * @param print_cb a function pointer to print a log - */ -void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb); - -/** - * Print a log message via `printf` if enabled with `LV_LOG_PRINTF` in `lv_conf.h` - * and/or a print callback if registered with `lv_log_register_print_cb` - * @param format printf-like format string - * @param ... parameters for `format` - */ -void lv_log(const char * format, ...) LV_FORMAT_ATTRIBUTE(1, 2); - -/** - * Add a log - * @param level the level of log. (From `lv_log_level_t` enum) - * @param file name of the file when the log added - * @param line line number in the source code where the log added - * @param func name of the function when the log added - * @param format printf-like format string - * @param ... parameters for `format` - */ -void lv_log_add(lv_log_level_t level, const char * file, int line, - const char * func, const char * format, ...) LV_FORMAT_ATTRIBUTE(5, 6); - -/********************** - * MACROS - **********************/ -#ifndef LV_LOG_TRACE -# if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE -# define LV_LOG_TRACE(...) lv_log_add(LV_LOG_LEVEL_TRACE, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) -# else -# define LV_LOG_TRACE(...) do {}while(0) -# endif -#endif - -#ifndef LV_LOG_INFO -# if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO -# define LV_LOG_INFO(...) lv_log_add(LV_LOG_LEVEL_INFO, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) -# else -# define LV_LOG_INFO(...) do {}while(0) -# endif -#endif - -#ifndef LV_LOG_WARN -# if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN -# define LV_LOG_WARN(...) lv_log_add(LV_LOG_LEVEL_WARN, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) -# else -# define LV_LOG_WARN(...) do {}while(0) -# endif -#endif - -#ifndef LV_LOG_ERROR -# if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR -# define LV_LOG_ERROR(...) lv_log_add(LV_LOG_LEVEL_ERROR, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) -# else -# define LV_LOG_ERROR(...) do {}while(0) -# endif -#endif - -#ifndef LV_LOG_USER -# if LV_LOG_LEVEL <= LV_LOG_LEVEL_USER -# define LV_LOG_USER(...) lv_log_add(LV_LOG_LEVEL_USER, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) -# else -# define LV_LOG_USER(...) do {}while(0) -# endif -#endif - -#ifndef LV_LOG -# if LV_LOG_LEVEL < LV_LOG_LEVEL_NONE -# define LV_LOG(...) lv_log(__VA_ARGS__) -# else -# define LV_LOG(...) do {} while(0) -# endif -#endif - -#else /*LV_USE_LOG*/ - -/*Do nothing if `LV_USE_LOG 0`*/ -#define lv_log_add(level, file, line, ...) -#define LV_LOG_TRACE(...) do {}while(0) -#define LV_LOG_INFO(...) do {}while(0) -#define LV_LOG_WARN(...) do {}while(0) -#define LV_LOG_ERROR(...) do {}while(0) -#define LV_LOG_USER(...) do {}while(0) -#define LV_LOG(...) do {}while(0) - -#endif /*LV_USE_LOG*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_LOG_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_lru.c b/src/misc/lv_lru.c index 3bff0e2e28..a0013b0f54 100755 --- a/src/misc/lv_lru.c +++ b/src/misc/lv_lru.c @@ -9,11 +9,6 @@ *********************/ #include "lv_lru.h" -#include "lv_math.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" -#include "lv_assert.h" -#include "lv_log.h" /********************* * DEFINES diff --git a/src/misc/lv_lru.h b/src/misc/lv_lru.h index fe41322dc8..f1dfb17f71 100755 --- a/src/misc/lv_lru.h +++ b/src/misc/lv_lru.h @@ -14,9 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../lv_conf_internal.h" - -#include "lv_types.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_math.c b/src/misc/lv_math.c index 41fc4dcf29..ed2a14e634 100644 --- a/src/misc/lv_math.c +++ b/src/misc/lv_math.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_math.h" + +#include "../lv_public_api.h" #include "../core/lv_global.h" /********************* diff --git a/src/misc/lv_math.h b/src/misc/lv_math.h index 4395994fa9..841ec95b81 100644 --- a/src/misc/lv_math.h +++ b/src/misc/lv_math.h @@ -1,174 +1,2 @@ -/** - * @file lv_math.h - * - */ - -#ifndef LV_MATH_H -#define LV_MATH_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ -#define LV_TRIGO_SIN_MAX 32768 -#define LV_TRIGO_SHIFT 15 /**< >> LV_TRIGO_SHIFT to normalize*/ - -#define LV_BEZIER_VAL_SHIFT 10 /**< log2(LV_BEZIER_VAL_MAX): used to normalize up scaled values*/ -#define LV_BEZIER_VAL_MAX (1L << LV_BEZIER_VAL_SHIFT) /**< Max time in Bezier functions (not [0..1] to use integers)*/ -#define LV_BEZIER_VAL_FLOAT(f) ((int32_t)((f) * LV_BEZIER_VAL_MAX)) /**< Convert const float number cubic-bezier values to fix-point value*/ - -/** Align up value x to align, align must be a power of two */ -#define LV_ALIGN_UP(x, align) (((x) + ((align) - 1)) & ~((align) - 1)) - -/** Round up value x to round, round can be any integer number */ -#define LV_ROUND_UP(x, round) ((((x) + ((round) - 1)) / (round)) * (round)) - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - uint16_t i; - uint16_t f; -} lv_sqrt_res_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Return with sinus of an angle - * @param angle - * @return sinus of 'angle'. sin(-90) = -32767, sin(90) = 32767 - */ -int32_t /* LV_ATTRIBUTE_FAST_MEM */ lv_trigo_sin(int16_t angle); - -int32_t LV_ATTRIBUTE_FAST_MEM lv_trigo_cos(int16_t angle); - -/** - * Calculate the y value of cubic-bezier(x1, y1, x2, y2) function as specified x. - * @param x time in range of [0..LV_BEZIER_VAL_MAX] - * @param x1 x of control point 1 in range of [0..LV_BEZIER_VAL_MAX] - * @param y1 y of control point 1 in range of [0..LV_BEZIER_VAL_MAX] - * @param x2 x of control point 2 in range of [0..LV_BEZIER_VAL_MAX] - * @param y2 y of control point 2 in range of [0..LV_BEZIER_VAL_MAX] - * @return the value calculated - */ -int32_t lv_cubic_bezier(int32_t x, int32_t x1, int32_t y1, int32_t x2, int32_t y2); - -/** - * Calculate a value of a Cubic Bezier function. - * @param t time in range of [0..LV_BEZIER_VAL_MAX] - * @param u0 must be 0 - * @param u1 control value 1 values in range of [0..LV_BEZIER_VAL_MAX] - * @param u2 control value 2 in range of [0..LV_BEZIER_VAL_MAX] - * @param u3 must be LV_BEZIER_VAL_MAX - * @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX] - */ -int32_t lv_bezier3(int32_t t, int32_t u0, uint32_t u1, int32_t u2, int32_t u3); - - -/** - * Calculate the atan2 of a vector. - * @param x - * @param y - * @return the angle in degree calculated from the given parameters in range of [0..360] - */ -uint16_t lv_atan2(int x, int y); - -/** - * Get the square root of a number - * @param x integer which square root should be calculated - * @param q store the result here. q->i: integer part, q->f: fractional part in 1/256 unit - * @param mask optional to skip some iterations if the magnitude of the root is known. - * Set to 0x8000 by default. - * If root < 16: mask = 0x80 - * If root < 256: mask = 0x800 - * Else: mask = 0x8000 - */ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask); - -/** - * Alternative (fast, approximate) implementation for getting the square root of an integer. - * @param x integer which square root should be calculated - */ -int32_t /* LV_ATTRIBUTE_FAST_MEM */ lv_sqrt32(uint32_t x); - -/** - * Calculate the square of an integer (input range is 0..32767). - * @param x input - * @return square - */ -static inline int32_t lv_sqr(int32_t x) -{ - return x * x; -} - -/** - * Calculate the integer exponents. - * @param base - * @param exp - * @return base raised to the power exponent - */ -int64_t lv_pow(int64_t base, int8_t exp); - -/** - * Get the mapped of a number given an input and output range - * @param x integer which mapped value should be calculated - * @param min_in min input range - * @param max_in max input range - * @param min_out max output range - * @param max_out max output range - * @return the mapped number - */ -int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min_out, int32_t max_out); - -/** - * Set the seed of the pseudo random number generator - * @param seed a number to initialize the random generator - */ -void lv_rand_set_seed(uint32_t seed); - -/** - * Get a pseudo random number in the given range - * @param min the minimum value - * @param max the maximum value - * @return return the random number. min <= return_value <= max - */ -uint32_t lv_rand(uint32_t min, uint32_t max); - -/********************** - * MACROS - **********************/ -#define LV_MIN(a, b) ((a) < (b) ? (a) : (b)) -#define LV_MIN3(a, b, c) (LV_MIN(LV_MIN(a,b), c)) -#define LV_MIN4(a, b, c, d) (LV_MIN(LV_MIN(a,b), LV_MIN(c,d))) - -#define LV_MAX(a, b) ((a) > (b) ? (a) : (b)) -#define LV_MAX3(a, b, c) (LV_MAX(LV_MAX(a,b), c)) -#define LV_MAX4(a, b, c, d) (LV_MAX(LV_MAX(a,b), LV_MAX(c,d))) - -#define LV_CLAMP(min, val, max) (LV_MAX(min, (LV_MIN(val, max)))) - -#define LV_ABS(x) ((x) > 0 ? (x) : (-(x))) -#define LV_UDIV255(x) (((x) * 0x8081U) >> 0x17) - -#define LV_IS_SIGNED(t) (((t)(-1)) < ((t)0)) -#define LV_UMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0xFULL << ((sizeof(t) * 8ULL) - 4ULL))) -#define LV_SMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0x7ULL << ((sizeof(t) * 8ULL) - 4ULL))) -#define LV_MAX_OF(t) ((unsigned long)(LV_IS_SIGNED(t) ? LV_SMAX_OF(t) : LV_UMAX_OF(t))) - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_matrix.c b/src/misc/lv_matrix.c index f8b0ba0166..8a2ab04837 100644 --- a/src/misc/lv_matrix.c +++ b/src/misc/lv_matrix.c @@ -7,15 +7,13 @@ * INCLUDES *********************/ -#include "lv_matrix.h" +#include "../lv_public_api.h" #if LV_USE_MATRIX -#include "../stdlib/lv_string.h" -#include "lv_math.h" #include #include -#include "../misc/lv_log.h" + /********************* * DEFINES *********************/ diff --git a/src/misc/lv_matrix.h b/src/misc/lv_matrix.h index d963d0d99a..7a22a38bf8 100644 --- a/src/misc/lv_matrix.h +++ b/src/misc/lv_matrix.h @@ -1,144 +1,2 @@ -/** - * @file lv_matrix.h - * - */ - -#ifndef LV_MATRIX_H -#define LV_MATRIX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../lv_conf_internal.h" - -#if LV_USE_MATRIX - -#include "lv_types.h" -#include "lv_area.h" - -/********************* - * DEFINES - *********************/ - -#if !LV_USE_FLOAT -#error "LV_USE_FLOAT is required for lv_matrix" -#endif - -/********************** - * TYPEDEFS - **********************/ - -struct _lv_matrix_t { - float m[3][3]; -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Set matrix to identity matrix - * @param matrix pointer to a matrix - */ -void lv_matrix_identity(lv_matrix_t * matrix); - -/** - * Translate the matrix to new position - * @param matrix pointer to a matrix - * @param tx the amount of translate in x direction - * @param tx the amount of translate in y direction - */ -void lv_matrix_translate(lv_matrix_t * matrix, float tx, float ty); - -/** - * Change the scale factor of the matrix - * @param matrix pointer to a matrix - * @param scale_x the scale factor for the X direction - * @param scale_y the scale factor for the Y direction - */ -void lv_matrix_scale(lv_matrix_t * matrix, float scale_x, float scale_y); - -/** - * Rotate the matrix with origin - * @param matrix pointer to a matrix - * @param degree angle to rotate - */ -void lv_matrix_rotate(lv_matrix_t * matrix, float degree); - -/** - * Change the skew factor of the matrix - * @param matrix pointer to a matrix - * @param skew_x the skew factor for x direction - * @param skew_y the skew factor for y direction - */ -void lv_matrix_skew(lv_matrix_t * matrix, float skew_x, float skew_y); - -/** - * Multiply two matrix and store the result to the first one - * @param matrix pointer to a matrix - * @param matrix2 pointer to another matrix - */ -void lv_matrix_multiply(lv_matrix_t * matrix, const lv_matrix_t * mul); - -/** - * Invert the matrix - * @param matrix pointer to a matrix - * @param m pointer to another matrix (optional) - * @return true: the matrix is invertible, false: the matrix is singular and cannot be inverted - */ -bool lv_matrix_inverse(lv_matrix_t * matrix, const lv_matrix_t * m); - -/** - * Transform a point by a matrix - * @param matrix pointer to a matrix - * @param point pointer to a point - * @return the transformed point - */ -lv_point_precise_t lv_matrix_transform_precise_point(const lv_matrix_t * matrix, const lv_point_precise_t * point); - -/** - * Transform an area by a matrix - * @param matrix pointer to a matrix - * @param area pointer to an area - * @return the transformed area - */ -lv_area_t lv_matrix_transform_area(const lv_matrix_t * matrix, const lv_area_t * area); - -/** - * Check if the matrix is identity - * @param matrix pointer to a matrix - * @return true: the matrix is identity , false: the matrix is not identity - */ -bool lv_matrix_is_identity(const lv_matrix_t * matrix); - -/** - * Check if the matrix is identity or translation matrix - * @param matrix pointer to a matrix - * @return true: the matrix is identity or translation matrix, false: the matrix is not identity or translation matrix - */ -bool lv_matrix_is_identity_or_translation(const lv_matrix_t * matrix); - -/** - * Transpose a matrix. - * @param src pointer to the source matrix. If NULL, the function returns. - * @param dst pointer to the destination matrix. If NULL, the function returns. - * Note: src and dst may point to the same matrix for in-place transposition. - */ -void lv_matrix_transpose(const lv_matrix_t * src, lv_matrix_t * dst); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_MATRIX*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_MATRIX_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_palette.c b/src/misc/lv_palette.c index cbcdf4e64c..e19aaf7d50 100644 --- a/src/misc/lv_palette.c +++ b/src/misc/lv_palette.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_palette.h" + +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_palette.h b/src/misc/lv_palette.h index d2f408ca27..a958412b7c 100644 --- a/src/misc/lv_palette.h +++ b/src/misc/lv_palette.h @@ -1,68 +1,2 @@ -/** - * @file lv_palette.h - * - */ - -#ifndef LV_PALETTE_H -#define LV_PALETTE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_color.h" -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_PALETTE_RED, - LV_PALETTE_PINK, - LV_PALETTE_PURPLE, - LV_PALETTE_DEEP_PURPLE, - LV_PALETTE_INDIGO, - LV_PALETTE_BLUE, - LV_PALETTE_LIGHT_BLUE, - LV_PALETTE_CYAN, - LV_PALETTE_TEAL, - LV_PALETTE_GREEN, - LV_PALETTE_LIGHT_GREEN, - LV_PALETTE_LIME, - LV_PALETTE_YELLOW, - LV_PALETTE_AMBER, - LV_PALETTE_ORANGE, - LV_PALETTE_DEEP_ORANGE, - LV_PALETTE_BROWN, - LV_PALETTE_BLUE_GREY, - LV_PALETTE_GREY, - LV_PALETTE_LAST, - LV_PALETTE_NONE = 0xff, -} lv_palette_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/*Source: https://vuetifyjs.com/en/styles/colors/#material-colors*/ - -lv_color_t lv_palette_main(lv_palette_t p); -lv_color_t lv_palette_lighten(lv_palette_t p, uint8_t lvl); -lv_color_t lv_palette_darken(lv_palette_t p, uint8_t lvl); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_PALETTE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_pending.c b/src/misc/lv_pending.c index 8feac7d469..da4f848537 100644 --- a/src/misc/lv_pending.c +++ b/src/misc/lv_pending.c @@ -8,8 +8,7 @@ *********************/ #include "lv_pending.h" -#include "lv_array.h" -#include "lv_assert.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_pending.h b/src/misc/lv_pending.h index 9a23d0ea75..29e179aee9 100644 --- a/src/misc/lv_pending.h +++ b/src/misc/lv_pending.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_types.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_profiler.h b/src/misc/lv_profiler.h index 840ee9a5a5..9b02a51c6b 100644 --- a/src/misc/lv_profiler.h +++ b/src/misc/lv_profiler.h @@ -1,184 +1,2 @@ -/** - * @file lv_profiler.h - * - */ - -#ifndef LV_PROFILER_H -#define LV_PROFILER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../lv_conf_internal.h" - -#if LV_USE_PROFILER - -#include LV_PROFILER_INCLUDE - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#else - -#define LV_PROFILER_BEGIN -#define LV_PROFILER_END -#define LV_PROFILER_BEGIN_TAG(tag) LV_UNUSED(tag) -#define LV_PROFILER_END_TAG(tag) LV_UNUSED(tag) - -#endif /*LV_USE_PROFILER*/ - -#if LV_USE_PROFILER && LV_PROFILER_LAYOUT -#define LV_PROFILER_LAYOUT_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_LAYOUT_END LV_PROFILER_END -#define LV_PROFILER_LAYOUT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_LAYOUT_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_LAYOUT_BEGIN -#define LV_PROFILER_LAYOUT_END -#define LV_PROFILER_LAYOUT_BEGIN_TAG(tag) -#define LV_PROFILER_LAYOUT_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_STYLE -#define LV_PROFILER_STYLE_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_STYLE_END LV_PROFILER_END -#define LV_PROFILER_STYLE_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_STYLE_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_STYLE_BEGIN -#define LV_PROFILER_STYLE_END -#define LV_PROFILER_STYLE_BEGIN_TAG(tag) -#define LV_PROFILER_STYLE_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_DRAW -#define LV_PROFILER_DRAW_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_DRAW_END LV_PROFILER_END -#define LV_PROFILER_DRAW_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_DRAW_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_DRAW_BEGIN -#define LV_PROFILER_DRAW_END -#define LV_PROFILER_DRAW_BEGIN_TAG(tag) -#define LV_PROFILER_DRAW_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_DECODER -#define LV_PROFILER_DECODER_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_DECODER_END LV_PROFILER_END -#define LV_PROFILER_DECODER_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_DECODER_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_DECODER_BEGIN -#define LV_PROFILER_DECODER_END -#define LV_PROFILER_DECODER_BEGIN_TAG(tag) -#define LV_PROFILER_DECODER_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_REFR -#define LV_PROFILER_REFR_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_REFR_END LV_PROFILER_END -#define LV_PROFILER_REFR_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_REFR_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_REFR_BEGIN -#define LV_PROFILER_REFR_END -#define LV_PROFILER_REFR_BEGIN_TAG(tag) -#define LV_PROFILER_REFR_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_INDEV -#define LV_PROFILER_INDEV_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_INDEV_END LV_PROFILER_END -#define LV_PROFILER_INDEV_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_INDEV_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_INDEV_BEGIN -#define LV_PROFILER_INDEV_END -#define LV_PROFILER_INDEV_BEGIN_TAG(tag) -#define LV_PROFILER_INDEV_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_FONT -#define LV_PROFILER_FONT_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_FONT_END LV_PROFILER_END -#define LV_PROFILER_FONT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_FONT_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_FONT_BEGIN -#define LV_PROFILER_FONT_END -#define LV_PROFILER_FONT_BEGIN_TAG(tag) -#define LV_PROFILER_FONT_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_CACHE -#define LV_PROFILER_CACHE_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_CACHE_END LV_PROFILER_END -#define LV_PROFILER_CACHE_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_CACHE_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_CACHE_BEGIN -#define LV_PROFILER_CACHE_END -#define LV_PROFILER_CACHE_BEGIN_TAG(tag) -#define LV_PROFILER_CACHE_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_FS -#define LV_PROFILER_FS_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_FS_END LV_PROFILER_END -#define LV_PROFILER_FS_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_FS_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_FS_BEGIN -#define LV_PROFILER_FS_END -#define LV_PROFILER_FS_BEGIN_TAG(tag) -#define LV_PROFILER_FS_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_TIMER -#define LV_PROFILER_TIMER_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_TIMER_END LV_PROFILER_END -#define LV_PROFILER_TIMER_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_TIMER_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_TIMER_BEGIN -#define LV_PROFILER_TIMER_END -#define LV_PROFILER_TIMER_BEGIN_TAG(tag) -#define LV_PROFILER_TIMER_END_TAG(tag) -#endif - -#if LV_USE_PROFILER && LV_PROFILER_EVENT -#define LV_PROFILER_EVENT_BEGIN LV_PROFILER_BEGIN -#define LV_PROFILER_EVENT_END LV_PROFILER_END -#define LV_PROFILER_EVENT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag) -#define LV_PROFILER_EVENT_END_TAG(tag) LV_PROFILER_END_TAG(tag) -#else -#define LV_PROFILER_EVENT_BEGIN -#define LV_PROFILER_EVENT_END -#define LV_PROFILER_EVENT_BEGIN_TAG(tag) -#define LV_PROFILER_EVENT_END_TAG(tag) -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_PROFILER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_profiler_builtin.h b/src/misc/lv_profiler_builtin.h index aa0220b20f..043706c5ee 100644 --- a/src/misc/lv_profiler_builtin.h +++ b/src/misc/lv_profiler_builtin.h @@ -1,85 +1,2 @@ -/** - * @file lv_profiler_builtin.h - * - */ - -#ifndef LV_PROFILER_BUILTIN_H -#define LV_PROFILER_BUILTIN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../lv_conf_internal.h" - -#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN - -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -#define LV_PROFILER_BUILTIN_BEGIN_TAG(tag) lv_profiler_builtin_write((tag), 'B') -#define LV_PROFILER_BUILTIN_END_TAG(tag) lv_profiler_builtin_write((tag), 'E') -#define LV_PROFILER_BUILTIN_BEGIN LV_PROFILER_BUILTIN_BEGIN_TAG(__func__) -#define LV_PROFILER_BUILTIN_END LV_PROFILER_BUILTIN_END_TAG(__func__) - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Initialize the configuration of the built-in profiler - * @param config Pointer to the configuration structure of the built-in profiler - */ -void lv_profiler_builtin_config_init(lv_profiler_builtin_config_t * config); - -/** - * @brief Initialize the built-in profiler with the given configuration - * @param config Pointer to the configuration structure of the built-in profiler - */ -void lv_profiler_builtin_init(const lv_profiler_builtin_config_t * config); - -/** - * @brief Uninitialize the built-in profiler - */ -void lv_profiler_builtin_uninit(void); - -/** - * @brief Enable or disable the built-in profiler - * @param enable true to enable the built-in profiler, false to disable - */ -void lv_profiler_builtin_set_enable(bool enable); - -/** - * @brief Flush the profiling data to the console - */ -void lv_profiler_builtin_flush(void); - -/** - * @brief Write the profiling data for a function with the given tag - * @param func Name of the function being profiled - * @param tag Tag to associate with the profiling data for the function - */ -void lv_profiler_builtin_write(const char * func, char tag); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_PROFILER_BUILTIN*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_PROFILER_BUILTIN_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_profiler_builtin_private.h b/src/misc/lv_profiler_builtin_private.h index 92c424cebd..942d81f335 100644 --- a/src/misc/lv_profiler_builtin_private.h +++ b/src/misc/lv_profiler_builtin_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_profiler_builtin.h" +#include "../lv_public_api.h" #if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN diff --git a/src/misc/lv_rb.c b/src/misc/lv_rb.c index 8a7328caaa..e8570334fb 100755 --- a/src/misc/lv_rb.c +++ b/src/misc/lv_rb.c @@ -6,8 +6,8 @@ /********************* * INCLUDES *********************/ + #include "lv_rb_private.h" -#include "../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/misc/lv_rb.h b/src/misc/lv_rb.h index ef2766bc4a..ce79028e1d 100755 --- a/src/misc/lv_rb.h +++ b/src/misc/lv_rb.h @@ -1,66 +1,3 @@ -/** - * @file lv_rb.h - * - */ +#warning "lv_rb" is no longer part of the public API and will be removed in the future. -#ifndef LV_RB_H -#define LV_RB_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_types.h" -#include "lv_assert.h" -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_RB_COLOR_RED, - LV_RB_COLOR_BLACK -} lv_rb_color_t; - -typedef int32_t lv_rb_compare_res_t; - -typedef lv_rb_compare_res_t (*lv_rb_compare_t)(const void * a, const void * b); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -bool lv_rb_init(lv_rb_t * tree, lv_rb_compare_t compare, size_t node_size); -lv_rb_node_t * lv_rb_insert(lv_rb_t * tree, void * key); -lv_rb_node_t * lv_rb_find(lv_rb_t * tree, const void * key); -void * lv_rb_remove_node(lv_rb_t * tree, lv_rb_node_t * node); -void * lv_rb_remove(lv_rb_t * tree, const void * key); -bool lv_rb_drop_node(lv_rb_t * tree, lv_rb_node_t * node); -bool lv_rb_drop(lv_rb_t * tree, const void * key); -lv_rb_node_t * lv_rb_minimum(lv_rb_t * node); -lv_rb_node_t * lv_rb_maximum(lv_rb_t * node); -lv_rb_node_t * lv_rb_minimum_from(lv_rb_node_t * node); -lv_rb_node_t * lv_rb_maximum_from(lv_rb_node_t * node); -void lv_rb_destroy(lv_rb_t * tree); - -/************************* - * GLOBAL VARIABLES - *************************/ - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_RB_H*/ +#include "lv_rb_private.h" diff --git a/src/misc/lv_rb_private.h b/src/misc/lv_rb_private.h index 492ca2e23f..1b6df60b8a 100644 --- a/src/misc/lv_rb_private.h +++ b/src/misc/lv_rb_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_rb.h" +#include "../lv_public_api.h" /********************* * DEFINES @@ -24,25 +24,46 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_rb_node_t { +typedef int32_t lv_rb_compare_res_t; + +typedef lv_rb_compare_res_t (*lv_rb_compare_t)(const void * a, const void * b); + +typedef enum { + LV_RB_COLOR_RED, + LV_RB_COLOR_BLACK +} lv_rb_color_t; + +typedef struct _lv_rb_node_t { struct _lv_rb_node_t * parent; struct _lv_rb_node_t * left; struct _lv_rb_node_t * right; lv_rb_color_t color; void * data; -}; +} lv_rb_node_t; -struct _lv_rb_t { +typedef struct _lv_rb_t { lv_rb_node_t * root; lv_rb_compare_t compare; size_t size; -}; - +} lv_rb_t; /********************** * GLOBAL PROTOTYPES **********************/ +bool lv_rb_init(lv_rb_t * tree, lv_rb_compare_t compare, size_t node_size); +lv_rb_node_t * lv_rb_insert(lv_rb_t * tree, void * key); +lv_rb_node_t * lv_rb_find(lv_rb_t * tree, const void * key); +void * lv_rb_remove_node(lv_rb_t * tree, lv_rb_node_t * node); +void * lv_rb_remove(lv_rb_t * tree, const void * key); +bool lv_rb_drop_node(lv_rb_t * tree, lv_rb_node_t * node); +bool lv_rb_drop(lv_rb_t * tree, const void * key); +lv_rb_node_t * lv_rb_minimum(lv_rb_t * node); +lv_rb_node_t * lv_rb_maximum(lv_rb_t * node); +lv_rb_node_t * lv_rb_minimum_from(lv_rb_node_t * node); +lv_rb_node_t * lv_rb_maximum_from(lv_rb_node_t * node); +void lv_rb_destroy(lv_rb_t * tree); + /********************** * MACROS **********************/ diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index 97ccc36ac4..2f22ca5229 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -6,12 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_style_private.h" + +#include "../lv_public_api.h" #include "../core/lv_global.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" -#include "lv_assert.h" -#include "lv_types.h" /********************* * DEFINES diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index 5f7af06190..d488cff725 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -1,737 +1,2 @@ -/** - * @file lv_style.h - * - */ - -#ifndef LV_STYLE_H -#define LV_STYLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../font/lv_font.h" -#include "lv_color.h" -#include "lv_area.h" -#include "lv_anim.h" -#include "lv_text.h" -#include "lv_types.h" -#include "lv_assert.h" -#include "lv_bidi.h" -#include "lv_grad.h" -#include "../layouts/lv_layout.h" - -/********************* - * DEFINES - *********************/ - -#define LV_STYLE_SENTINEL_VALUE 0xAABBCCDD - -/* - * Flags for style behavior - */ -#define LV_STYLE_PROP_FLAG_NONE (0) /**< No special behavior */ -#define LV_STYLE_PROP_FLAG_INHERITABLE (1 << 0) /**< Inherited */ -#define LV_STYLE_PROP_FLAG_EXT_DRAW_UPDATE (1 << 1) /**< Requires ext. draw size update when changed */ -#define LV_STYLE_PROP_FLAG_LAYOUT_UPDATE (1 << 2) /**< Requires layout update when changed */ -#define LV_STYLE_PROP_FLAG_PARENT_LAYOUT_UPDATE (1 << 3) /**< Requires layout update on parent when changed */ -#define LV_STYLE_PROP_FLAG_LAYER_UPDATE (1 << 4) /**< Affects layer handling */ -#define LV_STYLE_PROP_FLAG_TRANSFORM (1 << 5) /**< Affects the object's transformation */ -#define LV_STYLE_PROP_FLAG_ALL (0x3F) /**< Indicating all flags */ - -/* - * Other constants - */ -#define LV_SCALE_NONE 256 /**< Value for not zooming the image */ -LV_EXPORT_CONST_INT(LV_SCALE_NONE); - -// *INDENT-OFF* -#if LV_USE_ASSERT_STYLE -#define LV_STYLE_CONST_INIT(var_name, prop_array) \ - const lv_style_t var_name = { \ - .sentinel = LV_STYLE_SENTINEL_VALUE, \ - .values_and_props = (void*)prop_array, \ - .has_group = 0xFFFFFFFF, \ - .prop_cnt = 255 \ - } -#else -#define LV_STYLE_CONST_INIT(var_name, prop_array) \ - const lv_style_t var_name = { \ - .values_and_props = (void*)prop_array, \ - .has_group = 0xFFFFFFFF, \ - .prop_cnt = 255, \ - } -#endif -// *INDENT-ON* - -#define LV_STYLE_CONST_PROPS_END { .prop = LV_STYLE_PROP_INV, .value = { .num = 0 } } - -#if LV_GRADIENT_MAX_STOPS < 2 -#error LVGL needs at least 2 stops for gradients. Please increase the LV_GRADIENT_MAX_STOPS -#endif - -#define LV_GRAD_LEFT LV_PCT(0) -#define LV_GRAD_RIGHT LV_PCT(100) -#define LV_GRAD_TOP LV_PCT(0) -#define LV_GRAD_BOTTOM LV_PCT(100) -#define LV_GRAD_CENTER LV_PCT(50) - -/********************** - * TYPEDEFS - **********************/ - -/** - * Possible options for blending opaque drawings - */ -typedef enum { - LV_BLEND_MODE_NORMAL, /**< Simply mix according to the opacity value*/ - LV_BLEND_MODE_ADDITIVE, /**< Add the respective color channels*/ - LV_BLEND_MODE_SUBTRACTIVE,/**< Subtract the foreground from the background*/ - LV_BLEND_MODE_MULTIPLY, /**< Multiply the foreground and background*/ - LV_BLEND_MODE_DIFFERENCE, /**< Absolute difference between foreground and background*/ -} lv_blend_mode_t; - -/** - * Some options to apply decorations on texts. - * 'OR'ed values can be used. - */ -typedef enum { - LV_TEXT_DECOR_NONE = 0x00, - LV_TEXT_DECOR_UNDERLINE = 0x01, - LV_TEXT_DECOR_STRIKETHROUGH = 0x02, -} lv_text_decor_t; - -/** - * Selects on which sides border should be drawn - * 'OR'ed values can be used. - */ -typedef enum { - LV_BORDER_SIDE_NONE = 0x00, - LV_BORDER_SIDE_BOTTOM = 0x01, - LV_BORDER_SIDE_TOP = 0x02, - LV_BORDER_SIDE_LEFT = 0x04, - LV_BORDER_SIDE_RIGHT = 0x08, - LV_BORDER_SIDE_FULL = 0x0F, - LV_BORDER_SIDE_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/ -} lv_border_side_t; - -typedef enum { - LV_BLUR_QUALITY_AUTO = 0, /**< Set the quality automatically */ - LV_BLUR_QUALITY_SPEED, /**< Prefer speed over precision */ - LV_BLUR_QUALITY_PRECISION, /**< Prefer precision over speed*/ -} lv_blur_quality_t; - -/** A image colorkey definition. - * The transparency within the color range of [low, high] will be set to LV_OPA_TRANSP If the "enable" flag is set to true. - */ -typedef struct { - lv_color_t low; - lv_color_t high; -} lv_image_colorkey_t; - -/** - * A common type to handle all the property types in the same way. - */ -typedef union { - int32_t num; /**< Number integer number (opacity, enums, booleans or "normal" numbers)*/ - const void * ptr; /**< Constant pointers (font, cone text, etc)*/ - lv_color_t color; /**< Colors*/ -} lv_style_value_t; - -/** - * Enumeration of all built in style properties - * - * Props are split into groups of 16. When adding a new prop to a group, ensure it does not overflow into the next one. - */ -enum _lv_style_id_t { - LV_STYLE_PROP_INV = 0, - - /*The properties are listed in a special order to make caching more effective. - *Groups are used when LV_OBJ_STYLE_CACHE is enabled. - *If a property from a groups is set, a bit will be set in - *obj->style_main_prop_is_set and style_other_prop_is_set - *to indicate that the property is set. - * - *Strategy 1: group related properties. E.g. if no "border" properties are set - * they will be skipped quickly. - * - *Strategy 2: group common property with rarely used properties. This way - * the common property is cached properly and it's rarely affected - * by other props. The other props are cached in an sub-optimal way, - * but they are used rarely. - * - *Strategy 3: group properties they are used rarely together so that caching doesn't - * interfere - * - *Each group can have 8 properties. (see STYLE_PROP_SHIFTED)*/ - - /* Size related properties*/ - LV_STYLE_WIDTH = 1, - LV_STYLE_HEIGHT, - LV_STYLE_LENGTH, - LV_STYLE_TRANSFORM_WIDTH, - LV_STYLE_TRANSFORM_HEIGHT, - - LV_STYLE_MIN_WIDTH = 8, - LV_STYLE_MAX_WIDTH, - LV_STYLE_MIN_HEIGHT, - LV_STYLE_MAX_HEIGHT, - LV_STYLE_TRANSLATE_X, - LV_STYLE_TRANSLATE_Y, - LV_STYLE_RADIAL_OFFSET, - - /*Position related properties */ - LV_STYLE_X = 16, - LV_STYLE_Y, - LV_STYLE_ALIGN, - - /*Padding related properties */ - LV_STYLE_PAD_TOP = 24, - LV_STYLE_PAD_BOTTOM, - LV_STYLE_PAD_LEFT, - LV_STYLE_PAD_RIGHT, - LV_STYLE_PAD_RADIAL, - LV_STYLE_PAD_ROW, - LV_STYLE_PAD_COLUMN, - - /*Margin related properties*/ - LV_STYLE_MARGIN_TOP = 32, - LV_STYLE_MARGIN_BOTTOM, - LV_STYLE_MARGIN_LEFT, - LV_STYLE_MARGIN_RIGHT, - - /*Bg. Gradient*/ - LV_STYLE_BG_GRAD = 40, - LV_STYLE_BG_GRAD_DIR, - LV_STYLE_BG_MAIN_OPA, - LV_STYLE_BG_GRAD_OPA, - LV_STYLE_BG_GRAD_COLOR, - LV_STYLE_BG_MAIN_STOP, - LV_STYLE_BG_GRAD_STOP, - - /*Bg image*/ - LV_STYLE_BG_IMAGE_SRC = 48, - LV_STYLE_BG_IMAGE_OPA, - LV_STYLE_BG_IMAGE_RECOLOR_OPA, - LV_STYLE_BG_IMAGE_TILED, - LV_STYLE_BG_IMAGE_RECOLOR, - - /*Group 3*/ - LV_STYLE_BORDER_WIDTH = 56, - LV_STYLE_BORDER_COLOR, - LV_STYLE_BORDER_OPA, - LV_STYLE_BORDER_POST, - LV_STYLE_BORDER_SIDE, - - /*Outline */ - LV_STYLE_OUTLINE_WIDTH = 64, - LV_STYLE_OUTLINE_COLOR, - LV_STYLE_OUTLINE_OPA, - LV_STYLE_OUTLINE_PAD, - - /*Image, Shadow, Line, Arc, and Text are rarely used together.*/ - LV_STYLE_BG_OPA = 72, - LV_STYLE_BG_COLOR, - LV_STYLE_SHADOW_WIDTH, - LV_STYLE_LINE_WIDTH, - LV_STYLE_ARC_WIDTH, - LV_STYLE_TEXT_FONT, - LV_STYLE_IMAGE_RECOLOR_OPA, - - LV_STYLE_IMAGE_OPA = 80, - LV_STYLE_SHADOW_OPA, - LV_STYLE_LINE_OPA, - LV_STYLE_ARC_OPA, - LV_STYLE_TEXT_OPA, - - LV_STYLE_SHADOW_COLOR = 88, - LV_STYLE_IMAGE_RECOLOR, - LV_STYLE_LINE_COLOR, - LV_STYLE_ARC_COLOR, - LV_STYLE_TEXT_COLOR, - - LV_STYLE_ARC_IMAGE_SRC = 96, - LV_STYLE_SHADOW_OFFSET_X, - LV_STYLE_SHADOW_OFFSET_Y, - LV_STYLE_SHADOW_SPREAD, - LV_STYLE_LINE_DASH_WIDTH, - LV_STYLE_TEXT_ALIGN, - LV_STYLE_TEXT_LETTER_SPACE, - LV_STYLE_TEXT_LINE_SPACE, - - LV_STYLE_LINE_DASH_GAP = 104, - LV_STYLE_LINE_ROUNDED, - LV_STYLE_IMAGE_COLORKEY, - LV_STYLE_TEXT_OUTLINE_STROKE_WIDTH, - LV_STYLE_TEXT_OUTLINE_STROKE_OPA, - LV_STYLE_TEXT_OUTLINE_STROKE_COLOR, - LV_STYLE_TEXT_DECOR, - LV_STYLE_ARC_ROUNDED, - - /*Group unrelated props*/ - LV_STYLE_OPA = 112, - LV_STYLE_OPA_LAYERED, - LV_STYLE_COLOR_FILTER_DSC, - LV_STYLE_COLOR_FILTER_OPA, - LV_STYLE_ANIM, - LV_STYLE_ANIM_DURATION, - LV_STYLE_TRANSITION, - - /*Radius is requested a lot, group it with rarely requested ones*/ - LV_STYLE_RADIUS = 120, - LV_STYLE_BITMAP_MASK_SRC, - LV_STYLE_BLEND_MODE, - LV_STYLE_ROTARY_SENSITIVITY, - LV_STYLE_TRANSLATE_RADIAL, - - /*Requested a lot but rarely used*/ - LV_STYLE_CLIP_CORNER = 128, - LV_STYLE_BASE_DIR, - LV_STYLE_RECOLOR, - LV_STYLE_RECOLOR_OPA, - LV_STYLE_LAYOUT, - - /*Blur*/ - LV_STYLE_BLUR_RADIUS = 136, - LV_STYLE_BLUR_BACKDROP, - LV_STYLE_BLUR_QUALITY, - - /*Drop shadow*/ - LV_STYLE_DROP_SHADOW_RADIUS = 144, - LV_STYLE_DROP_SHADOW_OFFSET_X, - LV_STYLE_DROP_SHADOW_OFFSET_Y, - LV_STYLE_DROP_SHADOW_COLOR, - LV_STYLE_DROP_SHADOW_OPA, - LV_STYLE_DROP_SHADOW_QUALITY, - - /*Scale and transform*/ - LV_STYLE_TRANSFORM_SCALE_X = 152, - LV_STYLE_TRANSFORM_SCALE_Y, - LV_STYLE_TRANSFORM_PIVOT_X, - LV_STYLE_TRANSFORM_PIVOT_Y, - LV_STYLE_TRANSFORM_ROTATION, - LV_STYLE_TRANSFORM_SKEW_X, - LV_STYLE_TRANSFORM_SKEW_Y, - - /*Flex and basic grid (rarely used together)*/ - LV_STYLE_FLEX_FLOW = 160, - LV_STYLE_FLEX_MAIN_PLACE, - LV_STYLE_FLEX_CROSS_PLACE, - LV_STYLE_FLEX_TRACK_PLACE, - LV_STYLE_FLEX_GROW, - LV_STYLE_GRID_COLUMN_DSC_ARRAY, - LV_STYLE_GRID_ROW_DSC_ARRAY, - - LV_STYLE_GRID_COLUMN_ALIGN = 168, - LV_STYLE_GRID_ROW_ALIGN, - LV_STYLE_GRID_CELL_COLUMN_POS, - LV_STYLE_GRID_CELL_COLUMN_SPAN, - LV_STYLE_GRID_CELL_X_ALIGN, - LV_STYLE_GRID_CELL_ROW_POS, - LV_STYLE_GRID_CELL_ROW_SPAN, - LV_STYLE_GRID_CELL_Y_ALIGN, - - LV_STYLE_TEXT_LEADING_TRIM = 176, - - LV_STYLE_LAST_BUILT_IN_PROP, - LV_STYLE_NUM_BUILT_IN_PROPS = LV_STYLE_LAST_BUILT_IN_PROP + 1, - - LV_STYLE_PROP_ANY = 0xFF, - LV_STYLE_PROP_CONST = 0xFF /* magic value for const styles */ -}; - -typedef enum { - LV_STYLE_RES_NOT_FOUND, - LV_STYLE_RES_FOUND, -} lv_style_res_t; - -/** - * Descriptor for style transitions - */ -typedef struct { - const lv_style_prop_t * props; /**< An array with the properties to animate.*/ - void * user_data; /**< A custom user data that will be passed to the animation's user_data */ - lv_anim_path_cb_t path_xcb; /**< A path for the animation.*/ - uint32_t time; /**< Duration of the transition in [ms]*/ - uint32_t delay; /**< Delay before the transition in [ms]*/ -} lv_style_transition_dsc_t; - -/** - * Descriptor of a constant style property. - */ -typedef struct { - lv_style_prop_t prop; - lv_style_value_t value; -} lv_style_const_prop_t; - -/** - * Descriptor of a style (a collection of properties and values). - */ -typedef struct { - -#if LV_USE_ASSERT_STYLE - uint32_t sentinel; -#endif - - void * values_and_props; - - uint32_t has_group; - uint8_t prop_cnt; /**< 255 means it's a constant style*/ -} lv_style_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize a style - * @param style pointer to a style to initialize - * @note Do not call `lv_style_init` on styles that already have some properties - * because this function won't free the used memory, just sets a default state for the style. - * In other words be sure to initialize styles only once! - */ -void lv_style_init(lv_style_t * style); - -/** - * Clear all properties from a style and free all allocated memories. - * @param style pointer to a style - */ -void lv_style_reset(lv_style_t * style); - -/** - * Copy all properties of a style to an other. - * It has the same affect callying the same `lv_set_style_...` - * functions on both styles. - * It means new memory will be allocated to store the properties in - * the destination style. - * After the copy the destination style is fully independent of the source - * and source can removed without affecting the destination style. - * @param dst the destination to copy into (can not the a constant style) - * @param src the source style to copy from. - */ -void lv_style_copy(lv_style_t * dst, const lv_style_t * src); - -/** - * Copy all properties of a style to an other without resetting the dst style. - * It has the same effect as calling the same `lv_set_style_...` - * functions on both styles. - * It means new memory will be allocated to store the properties in - * the destination style. - * After the copy the destination style is fully independent of the source - * and source can removed without affecting the destination style. - * @param dst the destination to copy into (cannot be a constant style) - * @param src the source style to copy from. - */ -void lv_style_merge(lv_style_t * dst, const lv_style_t * src); - - -/** - * Check if a style is constant - * @param style pointer to a style - * @return true: the style is constant - */ -static inline bool lv_style_is_const(const lv_style_t * style) -{ - if(style->prop_cnt == 255) return true; - return false; -} - - -/** - * Register a new style property for custom usage - * @return a new property ID, or LV_STYLE_PROP_INV if there are no more available. - * - * Example: - * @code - * lv_style_prop_t MY_PROP; - * static inline void lv_style_set_my_prop(lv_style_t * style, lv_color_t value) { - * lv_style_value_t v = {.color = value}; lv_style_set_prop(style, MY_PROP, v); } - * - * ... - * MY_PROP = lv_style_register_prop(); - * ... - * lv_style_set_my_prop(&style1, lv_palette_main(LV_PALETTE_RED)); - * @endcode - */ -lv_style_prop_t lv_style_register_prop(uint8_t flag); - -/** - * Get the number of custom properties that have been registered thus far. - */ -lv_style_prop_t lv_style_get_num_custom_props(void); - -/** - * Remove a property from a style - * @param style pointer to a style - * @param prop a style property ORed with a state. - * @return true: the property was found and removed; false: the property wasn't found - */ -bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop); - -/** - * Set the value of property in a style. - * This function shouldn't be used directly by the user. - * Instead use `lv_style_set_()`. E.g. `lv_style_set_bg_color()` - * @param style pointer to style - * @param prop the ID of a property (e.g. `LV_STYLE_BG_COLOR`) - * @param value `lv_style_value_t` variable in which a field is set according to the type of `prop` - */ -void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t value); - -/** - * Get the value of a property - * @param style pointer to a style - * @param prop the ID of a property - * @param value pointer to a `lv_style_value_t` variable to store the value - * @return LV_RESULT_INVALID: the property wasn't found in the style (`value` is unchanged) - * LV_RESULT_OK: the property was fond, and `value` is set accordingly - * @note For performance reasons there are no sanity check on `style` - */ -lv_style_res_t lv_style_get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value); - -/** - * Initialize a transition descriptor. - * @param tr pointer to a transition descriptor to initialize - * @param props an array with the properties to transition. The last element must be zero. - * @param path_cb an animation path (ease) callback. If `NULL` liner path will be used. - * @param time duration of the transition in [ms] - * @param delay delay before the transition in [ms] - * @param user_data any custom data that will be saved in the transition animation and will be available when `path_cb` is called - * - * Example: - * @code - * const static lv_style_prop_t trans_props[] = { LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, 0 }; - * static lv_style_transition_dsc_t trans1; - * lv_style_transition_dsc_init(&trans1, trans_props, NULL, 300, 0, NULL); - * @endcode - */ -void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[], - lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay, void * user_data); - -/** - * Get the default value of a property - * @param prop the ID of a property - * @return the default value - */ -lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop); - -/** - * Get the value of a property - * @param style pointer to a style - * @param prop the ID of a property - * @param value pointer to a `lv_style_value_t` variable to store the value - * @return LV_RESULT_INVALID: the property wasn't found in the style (`value` is unchanged) - * LV_RESULT_OK: the property was fond, and `value` is set accordingly - * @note For performance reasons there are no sanity check on `style` - * @note This function is the same as ::lv_style_get_prop but inlined. Use it only on performance critical places - */ -static inline lv_style_res_t lv_style_get_prop_inlined(const lv_style_t * style, lv_style_prop_t prop, - lv_style_value_t * value) -{ - if(lv_style_is_const(style)) { - lv_style_const_prop_t * props = (lv_style_const_prop_t *)style->values_and_props; - uint32_t i; - for(i = 0; props[i].prop != LV_STYLE_PROP_INV; i++) { - if(props[i].prop == prop) { - *value = props[i].value; - return LV_STYLE_RES_FOUND; - } - } - } - else { - lv_style_prop_t * props = (lv_style_prop_t *)style->values_and_props + style->prop_cnt * sizeof(lv_style_value_t); - uint32_t i; - for(i = 0; i < style->prop_cnt; i++) { - if(props[i] == prop) { - lv_style_value_t * values = (lv_style_value_t *)style->values_and_props; - *value = values[i]; - return LV_STYLE_RES_FOUND; - } - } - } - return LV_STYLE_RES_NOT_FOUND; -} - -/** - * Checks if a style is empty (has no properties) - * @param style pointer to a style - * @return true if the style is empty - */ -bool lv_style_is_empty(const lv_style_t * style); - -/** - * Tell the group of a property. If the a property from a group is set in a style the (1 << group) bit of style->has_group is set. - * It allows early skipping the style if the property is not exists in the style at all. - * @param prop a style property - * @return the group [0..30] 30 means all the custom properties with index > 120 - */ -static inline uint32_t lv_style_get_prop_group(lv_style_prop_t prop) -{ - uint32_t group = prop >> 2; - if(group > 30) group = 31; /*The MSB marks all the custom properties*/ - return group; - -} - -/** - * Get the flags of a built-in or custom property. - * - * @param prop a style property - * @return the flags of the property - */ -uint8_t lv_style_prop_lookup_flags(lv_style_prop_t prop); - -#include "lv_style_gen.h" - -/** - * Set `style`s width and height. - * @param style pointer to style to be modified - * @param width width in pixels - * @param height height in pixels - */ -static inline void lv_style_set_size(lv_style_t * style, int32_t width, int32_t height) -{ - lv_style_set_width(style, width); - lv_style_set_height(style, height); -} - -/** - * Set all 4 of `style`s padding values. - * @param style pointer to style to be modified - * @param value padding dimension in pixels - */ -static inline void lv_style_set_pad_all(lv_style_t * style, int32_t value) -{ - lv_style_set_pad_left(style, value); - lv_style_set_pad_right(style, value); - lv_style_set_pad_top(style, value); - lv_style_set_pad_bottom(style, value); -} - -/** - * Set `style`s left and right padding values. - * @param style pointer to style to be modified - * @param value padding dimension in pixels - */ -static inline void lv_style_set_pad_hor(lv_style_t * style, int32_t value) -{ - lv_style_set_pad_left(style, value); - lv_style_set_pad_right(style, value); -} - -/** - * Set `style`s top and bottom padding values. - * @param style pointer to style to be modified - * @param value padding dimension in pixels - */ -static inline void lv_style_set_pad_ver(lv_style_t * style, int32_t value) -{ - lv_style_set_pad_top(style, value); - lv_style_set_pad_bottom(style, value); -} - -/** - * Set `style`s row and column padding gaps (applies only to Grid and Flex layouts). - * @param style pointer to style to be modified - * @param value gap dimension in pixels - */ -static inline void lv_style_set_pad_gap(lv_style_t * style, int32_t value) -{ - lv_style_set_pad_row(style, value); - lv_style_set_pad_column(style, value); -} - -/** - * Set `style`s left and right margin values. - * @param style pointer to style to be modified - * @param value margin dimension in pixels - */ -static inline void lv_style_set_margin_hor(lv_style_t * style, int32_t value) -{ - lv_style_set_margin_left(style, value); - lv_style_set_margin_right(style, value); -} - -/** - * Set `style`s top and bottom margin values. - * @param style pointer to style to be modified - * @param value margin dimension in pixels - */ -static inline void lv_style_set_margin_ver(lv_style_t * style, int32_t value) -{ - lv_style_set_margin_top(style, value); - lv_style_set_margin_bottom(style, value); -} - -/** - * Set all 4 of `style`s margin values. - * @param style pointer to style to be modified - * @param value margin dimension in pixels - */ -static inline void lv_style_set_margin_all(lv_style_t * style, int32_t value) -{ - lv_style_set_margin_left(style, value); - lv_style_set_margin_right(style, value); - lv_style_set_margin_top(style, value); - lv_style_set_margin_bottom(style, value); -} - -/** - * Set `style`s X and Y transform scale values. - * @param style pointer to style to be modified - * @param value scale factor. Example values: - * - 256 or LV_SCALE_NONE: no zoom - * - <256: scale down - * - >256: scale up - * - 128: half size - * - 512: double size - */ -static inline void lv_style_set_transform_scale(lv_style_t * style, int32_t value) -{ - lv_style_set_transform_scale_x(style, value); - lv_style_set_transform_scale_y(style, value); -} - -/** - * @brief Check if the style property has a specified behavioral flag. - * - * Do not pass multiple flags to this function as backwards-compatibility is not guaranteed - * for that. - * - * @param prop Property ID - * @param flag Flag - * @return true if the flag is set for this property - */ -static inline bool lv_style_prop_has_flag(lv_style_prop_t prop, uint8_t flag) -{ - return lv_style_prop_lookup_flags(prop) & flag; -} - -/************************* - * GLOBAL VARIABLES - *************************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t lv_style_const_prop_id_inv; - -/********************** - * MACROS - **********************/ - -#if LV_USE_ASSERT_STYLE -# define LV_ASSERT_STYLE(style_p) \ - do { \ - LV_ASSERT_MSG(style_p != NULL, "The style is NULL"); \ - LV_ASSERT_MSG(style_p->sentinel == LV_STYLE_SENTINEL_VALUE, "Style is not initialized or corrupted"); \ - } while(0) -#else -# define LV_ASSERT_STYLE(p) do{}while(0) -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_STYLE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_style_gen.c b/src/misc/lv_style_gen.c index 4e9a12477f..a72e9722d1 100644 --- a/src/misc/lv_style_gen.c +++ b/src/misc/lv_style_gen.c @@ -8,7 +8,7 @@ */ -#include "lv_style.h" +#include "../lv_public_api.h" void lv_style_set_width(lv_style_t * style, int32_t value) diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h index cea70036e1..6308713a5e 100644 --- a/src/misc/lv_style_gen.h +++ b/src/misc/lv_style_gen.h @@ -1,2549 +1,2 @@ -/* - * @file - * - ********************************************************************** - * DO NOT EDIT - * This file is automatically generated by "style_api_gen.py" - ********************************************************************** - */ - - -#ifndef LV_STYLE_GEN_H -#define LV_STYLE_GEN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Sets width of Widget. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. - * Percentage values are relative to the width of the parent's content area. - * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_width(lv_style_t * style, int32_t value); - -/** - * Sets a minimal width. Pixel and percentage values can be used. Percentage values - * are relative to the width of the parent's content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_min_width(lv_style_t * style, int32_t value); - -/** - * Sets a maximal width. Pixel and percentage values can be used. Percentage values - * are relative to the width of the parent's content area. - * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_max_width(lv_style_t * style, int32_t value); - -/** - * Sets height of Widget. Pixel, percentage and `LV_SIZE_CONTENT` can be used. - * Percentage values are relative to the height of the parent's content area. - * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_height(lv_style_t * style, int32_t value); - -/** - * Sets a minimal height. Pixel and percentage values can be used. Percentage values - * are relative to the height of the parent's content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_min_height(lv_style_t * style, int32_t value); - -/** - * Sets a maximal height. Pixel and percentage values can be used. Percentage values - * are relative to the height of the parent's content area. - * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_max_height(lv_style_t * style, int32_t value); - -/** - * Its meaning depends on the type of Widget. For example in case of lv_scale it means - * the length of the ticks. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_length(lv_style_t * style, int32_t value); - -/** - * Set X coordinate of Widget considering the ``align`` setting. Pixel and percentage - * values can be used. Percentage values are relative to the width of the parent's - * content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_x(lv_style_t * style, int32_t value); - -/** - * Set Y coordinate of Widget considering the ``align`` setting. Pixel and percentage - * values can be used. Percentage values are relative to the height of the parent's - * content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_y(lv_style_t * style, int32_t value); - -/** - * Set the alignment which tells from which point of the parent the X and Y - * coordinates should be interpreted. Possible values are: `LV_ALIGN_DEFAULT`, - * `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, - * `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means - * `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base - * direction. - * Default: `LV_ALIGN_DEFAULT`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_align(lv_style_t * style, lv_align_t value); - -/** - * Make Widget wider on both sides with this value. Pixel and percentage (with - * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's width. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_transform_width(lv_style_t * style, int32_t value); - -/** - * Make Widget higher on both sides with this value. Pixel and percentage (with - * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's height. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_transform_height(lv_style_t * style, int32_t value); - -/** - * Move Widget with this value in X direction. Applied after layouts, aligns and other - * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage - * values are relative to Widget's width. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_translate_x(lv_style_t * style, int32_t value); - -/** - * Move Widget with this value in Y direction. Applied after layouts, aligns and other - * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage - * values are relative to Widget's height. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_translate_y(lv_style_t * style, int32_t value); - -/** - * Move object around the centre of the parent object (e.g. around the circumference - * of a scale). - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_translate_radial(lv_style_t * style, int32_t value); - -/** - * Zoom Widget horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 - * half size, 512 double size, and so on. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_transform_scale_x(lv_style_t * style, int32_t value); - -/** - * Zoom Widget vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 - * half size, 512 double size, and so on. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_transform_scale_y(lv_style_t * style, int32_t value); - -/** - * Rotate Widget. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_transform_rotation(lv_style_t * style, int32_t value); - -/** - * Set pivot point's X coordinate for transformations. Relative to Widget's top left corner. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_transform_pivot_x(lv_style_t * style, int32_t value); - -/** - * Set pivot point's Y coordinate for transformations. Relative to Widget's top left corner. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_transform_pivot_y(lv_style_t * style, int32_t value); - -/** - * Skew Widget horizontally. The value is interpreted in 0.1 degree units. E.g. 450 - * means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_transform_skew_x(lv_style_t * style, int32_t value); - -/** - * Skew Widget vertically. The value is interpreted in 0.1 degree units. E.g. 450 - * means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_transform_skew_y(lv_style_t * style, int32_t value); - -/** - * Sets the padding on the top. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_pad_top(lv_style_t * style, int32_t value); - -/** - * Sets the padding on the bottom. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_pad_bottom(lv_style_t * style, int32_t value); - -/** - * Sets the padding on the left. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_pad_left(lv_style_t * style, int32_t value); - -/** - * Sets the padding on the right. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_pad_right(lv_style_t * style, int32_t value); - -/** - * Sets the padding between the rows. Used by the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_pad_row(lv_style_t * style, int32_t value); - -/** - * Sets the padding between the columns. Used by the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_pad_column(lv_style_t * style, int32_t value); - -/** - * Pad text labels away from the scale ticks/remainder of the ``LV_PART_``. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_pad_radial(lv_style_t * style, int32_t value); - -/** - * Sets margin on the top. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_margin_top(lv_style_t * style, int32_t value); - -/** - * Sets margin on the bottom. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_margin_bottom(lv_style_t * style, int32_t value); - -/** - * Sets margin on the left. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_margin_left(lv_style_t * style, int32_t value); - -/** - * Sets margin on the right. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_margin_right(lv_style_t * style, int32_t value); - -/** - * Set background color of Widget. - * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_bg_color(lv_style_t * style, lv_color_t value); - -/** - * Set opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value); - -/** - * Set direction of the gradient of the background. Possible values are - * `LV_GRAD_DIR_NONE/HOR/VER`. - * Default: `LV_GRAD_DIR_NONE`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value); - -/** - * Set point from which background color should start for gradients. 0 means to - * top/left side, 255 the bottom/right side, 128 the center, and so on. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_bg_main_stop(lv_style_t * style, int32_t value); - -/** - * Set point from which background's gradient color should start. 0 means to top/left - * side, 255 the bottom/right side, 128 the center, and so on. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_bg_grad_stop(lv_style_t * style, int32_t value); - -/** - * Set opacity of the first gradient color. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_bg_main_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set opacity of the second gradient color. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_bg_grad_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set gradient definition. The pointed instance must exist while Widget is alive. - * NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and - * `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors - * as well. If it's set other gradient related properties will be ignored. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to gradient descriptor - */ -void lv_style_set_bg_grad(lv_style_t * style, const lv_grad_dsc_t * value); - -/** - * Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or - * an `LV_SYMBOL_...`. - * Default: `NULL`, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Pointer to image source - */ -void lv_style_set_bg_image_src(lv_style_t * style, const void * value); - -/** - * Set opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means - * fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other - * values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_bg_image_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set a color to mix to the background image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_bg_image_recolor(lv_style_t * style, lv_color_t value); - -/** - * Set intensity of background image recoloring. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full - * recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted - * proportionally. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_bg_image_recolor_opa(lv_style_t * style, lv_opa_t value); - -/** - * If enabled the background image will be tiled. Possible values are `true` or `false`. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_bg_image_tiled(lv_style_t * style, bool value); - -/** - * Set color of the border. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_border_color(lv_style_t * style, lv_color_t value); - -/** - * Set opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set width of the border. Only pixel values can be used. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_border_width(lv_style_t * style, int32_t value); - -/** - * Set only which side(s) the border should be drawn. Possible values are - * `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as - * well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`. - * Default: `LV_BORDER_SIDE_FULL`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_border_side(lv_style_t * style, lv_border_side_t value); - -/** - * Sets whether the border should be drawn before or after the children are drawn. - * `true`: after children, `false`: before children. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_border_post(lv_style_t * style, bool value); - -/** - * Set width of outline in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_outline_width(lv_style_t * style, int32_t value); - -/** - * Set color of outline. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_outline_color(lv_style_t * style, lv_color_t value); - -/** - * Set opacity of outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set padding of outline, i.e. the gap between Widget and the outline. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_outline_pad(lv_style_t * style, int32_t value); - -/** - * Set width of the shadow in pixels. The value should be >= 0. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_shadow_width(lv_style_t * style, int32_t value); - -/** - * Set an offset on the shadow in pixels in X direction. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_shadow_offset_x(lv_style_t * style, int32_t value); - -/** - * Set an offset on the shadow in pixels in Y direction. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_shadow_offset_y(lv_style_t * style, int32_t value); - -/** - * Make shadow calculation to use a larger or smaller rectangle as base. The value can - * be in pixels to make the area larger/smaller. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_shadow_spread(lv_style_t * style, int32_t value); - -/** - * Set color of shadow. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value); - -/** - * Set opacity of shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_image_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set color to mix with the image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_image_recolor(lv_style_t * style, lv_color_t value); - -/** - * Set intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_image_recolor_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set image colorkey definition. The lv_image_colorkey_t contains two color values: - * `high_color` and `low_color`. the color of pixels ranging from `low_color` to - * `high_color` will be transparent. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to image color key - */ -void lv_style_set_image_colorkey(lv_style_t * style, const lv_image_colorkey_t * value); - -/** - * Set width of lines in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_line_width(lv_style_t * style, int32_t value); - -/** - * Set width of dashes in pixels. Note that dash works only on horizontal and vertical lines. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_line_dash_width(lv_style_t * style, int32_t value); - -/** - * Set gap between dashes in pixels. Note that dash works only on horizontal and - * vertical lines. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_line_dash_gap(lv_style_t * style, int32_t value); - -/** - * Make end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_line_rounded(lv_style_t * style, bool value); - -/** - * Set color of lines. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_line_color(lv_style_t * style, lv_color_t value); - -/** - * Set opacity of lines. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set width (thickness) of arcs in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_arc_width(lv_style_t * style, int32_t value); - -/** - * Make end points of arcs rounded. `true`: rounded, `false`: perpendicular line ending. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_arc_rounded(lv_style_t * style, bool value); - -/** - * Set color of arc. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_arc_color(lv_style_t * style, lv_color_t value); - -/** - * Set opacity of arcs. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set an image from which arc will be masked out. It's useful to display complex - * effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to image source - */ -void lv_style_set_arc_image_src(lv_style_t * style, const void * value); - -/** - * Sets color of text. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_text_color(lv_style_t * style, lv_color_t value); - -/** - * Set opacity of text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set font of text (a pointer `lv_font_t *`). - * Default: `LV_FONT_DEFAULT`, inherited: Yes, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to font - */ -void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value); - -/** - * Set letter space in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_text_letter_space(lv_style_t * style, int32_t value); - -/** - * Set line space in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_text_line_space(lv_style_t * style, int32_t value); - -/** - * Set decoration for the text. Possible values are - * `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well. - * Default: `LV_TEXT_DECOR_NONE`, inherited: Yes, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t value); - -/** - * Set how to align the lines of the text. Note that it doesn't align the Widget - * itself, only the lines inside the Widget. Possible values are - * `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base - * direction and uses left or right alignment accordingly. - * Default: `LV_TEXT_ALIGN_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value); - -/** - * Sets the color of letter outline stroke. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_text_outline_stroke_color(lv_style_t * style, lv_color_t value); - -/** - * Set the letter outline stroke width in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_text_outline_stroke_width(lv_style_t * style, int32_t value); - -/** - * Set the opacity of the letter outline stroke. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means - * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_text_outline_stroke_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set the text leading trim mode. Removes empty space above and/or below text based - * on font metrics (cap-height, x-height, baseline). Similar to CSS `text-box-trim`. - * Possible values are `LV_TEXT_LEADING_TRIM_NONE/CAPITAL_BASELINE/LOWER_BASELINE/CAPITAL/LOWER`. - * Default: `LV_TEXT_LEADING_TRIM_NONE`, inherited: Yes, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_text_leading_trim(lv_style_t * style, lv_text_leading_trim_t value); - -/** - * Sets the intensity of blurring. Applied on each lv_part separately before the - * children are rendered. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_blur_radius(lv_style_t * style, int32_t value); - -/** - * If `true` the background of the widget will be blurred. The part should have < 100% - * opacity to make it visible. If `false` the given part will be blurred when it's - * rendered but before drawing the children. - * Default: `false`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_blur_backdrop(lv_style_t * style, bool value); - -/** - * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over - * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower - * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. - * Default: `LV_BLUR_QUALITY_AUTO`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_blur_quality(lv_style_t * style, lv_blur_quality_t value); - -/** - * Sets the intensity of blurring. Applied on each lv_part separately before the - * children are rendered. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_drop_shadow_radius(lv_style_t * style, int32_t value); - -/** - * Set an offset on the shadow in pixels in X direction. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_drop_shadow_offset_x(lv_style_t * style, int32_t value); - -/** - * Set an offset on the shadow in pixels in Y direction. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_drop_shadow_offset_y(lv_style_t * style, int32_t value); - -/** - * Set the color of the shadow. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_drop_shadow_color(lv_style_t * style, lv_color_t value); - -/** - * Set the opacity of the shadow. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_drop_shadow_opa(lv_style_t * style, lv_opa_t value); - -/** - * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over - * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower - * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. - * Default: `LV_BLUR_QUALITY_PRECISION`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_drop_shadow_quality(lv_style_t * style, lv_blur_quality_t value); - -/** - * Set radius on every corner. The value is interpreted in pixels (>= 0) or - * `LV_RADIUS_CIRCLE` for max radius. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_radius(lv_style_t * style, int32_t value); - -/** - * Move start point of object (e.g. scale tick) radially. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_radial_offset(lv_style_t * style, int32_t value); - -/** - * Enable clipping of content that overflows rounded corners of parent Widget. Can be - * `true` or `false`. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_clip_corner(lv_style_t * style, bool value); - -/** - * Scale down all opacity values of the Widget by this factor. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means - * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_opa(lv_style_t * style, lv_opa_t value); - -/** - * First draw Widget on the layer, then scale down layer opacity factor. Value 0, - * `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or - * `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc - * means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value); - -/** - * Mix a color with all colors of the Widget. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to color-filter descriptor - */ -void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value); - -/** - * The intensity of mixing of color filter. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value); - -/** - * Set a color to mix to the obj. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Color to submit - */ -void lv_style_set_recolor(lv_style_t * style, lv_color_t value); - -/** - * Sets the intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means - * fully transparent. A value of 255, `LV_OPA_100` or `LV_OPA_COVER` means fully - * opaque. Intermediate values like LV_OPA_10, LV_OPA_20, etc result in - * semi-transparency. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_recolor_opa(lv_style_t * style, lv_opa_t value); - -/** - * Animation template for Widget's animation. Should be a pointer to `lv_anim_t`. The - * animation parameters are widget specific, e.g. animation time could be the E.g. - * blink time of the cursor on the Text Area or scroll time of a roller. See Widgets' - * documentation to learn more. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to animation descriptor - */ -void lv_style_set_anim(lv_style_t * style, const lv_anim_t * value); - -/** - * Animation duration in milliseconds. Its meaning is widget specific. E.g. blink time - * of the cursor on the Text Area or scroll time of a roller. See Widgets' - * documentation to learn more. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_anim_duration(lv_style_t * style, uint32_t value); - -/** - * An initialized ``lv_style_transition_dsc_t`` to describe a transition. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to transition descriptor - */ -void lv_style_set_transition(lv_style_t * style, const lv_style_transition_dsc_t * value); - -/** - * Describes how to blend the colors to the background. Possible values are - * `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY/DIFFERENCE`. - * Default: `LV_BLEND_MODE_NORMAL`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value); - -/** - * Set layout of Widget. Children will be repositioned and resized according to - * policies set for the layout. For possible values see documentation of the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_layout(lv_style_t * style, uint16_t value); - -/** - * Set base direction of Widget. Possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`. - * Default: `LV_BASE_DIR_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value); - -/** - * If set, a layer will be created for the widget and the layer will be masked with - * this A8 bitmap mask. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to A8 bitmap mask - */ -void lv_style_set_bitmap_mask_src(lv_style_t * style, const void * value); - -/** - * Adjust sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the - * rotary to half, 512: speeds up to double, 256: no change. - * Default: `256`, inherited: Yes, layout: No, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_rotary_sensitivity(lv_style_t * style, uint32_t value); - -#if LV_USE_FLEX -/** - * Defines in which direction the flex layout should arrange the children. - * Default: `LV_FLEX_FLOW_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value); - -/** - * Defines how to align the children in the direction of flex flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value); - -/** - * Defines how to align the children perpendicular to the direction of flex flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value); - -/** - * Defines how to align the tracks of the flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value); - -/** - * Defines how much space to take proportionally from the free space of the Widget's track. - * Default: `0`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_flex_grow(lv_style_t * style, uint8_t value); - -#endif /* LV_USE_FLEX */ - -#if LV_USE_GRID -/** - * An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. - * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to grid-column descriptor array - */ -void lv_style_set_grid_column_dsc_array(lv_style_t * style, const int32_t * value); - -/** - * Defines how to distribute the columns. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value); - -/** - * An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. - * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Pointer to grid-row descriptor array - */ -void lv_style_set_grid_row_dsc_array(lv_style_t * style, const int32_t * value); - -/** - * Defines how to distribute the rows. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value); - -/** - * Set column in which Widget should be placed. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_grid_cell_column_pos(lv_style_t * style, int32_t value); - -/** - * Set how to align Widget horizontally. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_grid_align_t value); - -/** - * Set how many columns Widget should span. Needs to be >= 1. - * Default: 1, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_grid_cell_column_span(lv_style_t * style, int32_t value); - -/** - * Set row in which Widget should be placed. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_grid_cell_row_pos(lv_style_t * style, int32_t value); - -/** - * Set how to align Widget vertically. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_grid_align_t value); - -/** - * Set how many rows Widget should span. Needs to be >= 1. - * Default: 1, inherited: No, layout: Yes, ext. draw: No. - * @param style Pointer to style - * @param value Value to submit - */ -void lv_style_set_grid_cell_row_span(lv_style_t * style, int32_t value); - -#endif /* LV_USE_GRID */ - -/** - * Sets width of Widget. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. - * Percentage values are relative to the width of the parent's content area. - * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_WIDTH(val) \ - { \ - .prop = LV_STYLE_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Sets a minimal width. Pixel and percentage values can be used. Percentage values - * are relative to the width of the parent's content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_MIN_WIDTH(val) \ - { \ - .prop = LV_STYLE_MIN_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Sets a maximal width. Pixel and percentage values can be used. Percentage values - * are relative to the width of the parent's content area. - * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_MAX_WIDTH(val) \ - { \ - .prop = LV_STYLE_MAX_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Sets height of Widget. Pixel, percentage and `LV_SIZE_CONTENT` can be used. - * Percentage values are relative to the height of the parent's content area. - * Default: Widget dependent, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_HEIGHT(val) \ - { \ - .prop = LV_STYLE_HEIGHT, .value = { .num = (int32_t)val } \ - } - -/** - * Sets a minimal height. Pixel and percentage values can be used. Percentage values - * are relative to the height of the parent's content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_MIN_HEIGHT(val) \ - { \ - .prop = LV_STYLE_MIN_HEIGHT, .value = { .num = (int32_t)val } \ - } - -/** - * Sets a maximal height. Pixel and percentage values can be used. Percentage values - * are relative to the height of the parent's content area. - * Default: LV_COORD_MAX, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_MAX_HEIGHT(val) \ - { \ - .prop = LV_STYLE_MAX_HEIGHT, .value = { .num = (int32_t)val } \ - } - -/** - * Its meaning depends on the type of Widget. For example in case of lv_scale it means - * the length of the ticks. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_LENGTH(val) \ - { \ - .prop = LV_STYLE_LENGTH, .value = { .num = (int32_t)val } \ - } - -/** - * Set X coordinate of Widget considering the ``align`` setting. Pixel and percentage - * values can be used. Percentage values are relative to the width of the parent's - * content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_X(val) \ - { \ - .prop = LV_STYLE_X, .value = { .num = (int32_t)val } \ - } - -/** - * Set Y coordinate of Widget considering the ``align`` setting. Pixel and percentage - * values can be used. Percentage values are relative to the height of the parent's - * content area. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_Y(val) \ - { \ - .prop = LV_STYLE_Y, .value = { .num = (int32_t)val } \ - } - -/** - * Set the alignment which tells from which point of the parent the X and Y - * coordinates should be interpreted. Possible values are: `LV_ALIGN_DEFAULT`, - * `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, - * `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means - * `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base - * direction. - * Default: `LV_ALIGN_DEFAULT`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_ALIGN(val) \ - { \ - .prop = LV_STYLE_ALIGN, .value = { .num = (int32_t)val } \ - } - -/** - * Make Widget wider on both sides with this value. Pixel and percentage (with - * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's width. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSFORM_WIDTH(val) \ - { \ - .prop = LV_STYLE_TRANSFORM_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Make Widget higher on both sides with this value. Pixel and percentage (with - * `lv_pct(x)`) values can be used. Percentage values are relative to Widget's height. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSFORM_HEIGHT(val) \ - { \ - .prop = LV_STYLE_TRANSFORM_HEIGHT, .value = { .num = (int32_t)val } \ - } - -/** - * Move Widget with this value in X direction. Applied after layouts, aligns and other - * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage - * values are relative to Widget's width. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSLATE_X(val) \ - { \ - .prop = LV_STYLE_TRANSLATE_X, .value = { .num = (int32_t)val } \ - } - -/** - * Move Widget with this value in Y direction. Applied after layouts, aligns and other - * positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage - * values are relative to Widget's height. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSLATE_Y(val) \ - { \ - .prop = LV_STYLE_TRANSLATE_Y, .value = { .num = (int32_t)val } \ - } - -/** - * Move object around the centre of the parent object (e.g. around the circumference - * of a scale). - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSLATE_RADIAL(val) \ - { \ - .prop = LV_STYLE_TRANSLATE_RADIAL, .value = { .num = (int32_t)val } \ - } - -/** - * Zoom Widget horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 - * half size, 512 double size, and so on. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSFORM_SCALE_X(val) \ - { \ - .prop = LV_STYLE_TRANSFORM_SCALE_X, .value = { .num = (int32_t)val } \ - } - -/** - * Zoom Widget vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 - * half size, 512 double size, and so on. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSFORM_SCALE_Y(val) \ - { \ - .prop = LV_STYLE_TRANSFORM_SCALE_Y, .value = { .num = (int32_t)val } \ - } - -/** - * Rotate Widget. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSFORM_ROTATION(val) \ - { \ - .prop = LV_STYLE_TRANSFORM_ROTATION, .value = { .num = (int32_t)val } \ - } - -/** - * Set pivot point's X coordinate for transformations. Relative to Widget's top left corner. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSFORM_PIVOT_X(val) \ - { \ - .prop = LV_STYLE_TRANSFORM_PIVOT_X, .value = { .num = (int32_t)val } \ - } - -/** - * Set pivot point's Y coordinate for transformations. Relative to Widget's top left corner. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSFORM_PIVOT_Y(val) \ - { \ - .prop = LV_STYLE_TRANSFORM_PIVOT_Y, .value = { .num = (int32_t)val } \ - } - -/** - * Skew Widget horizontally. The value is interpreted in 0.1 degree units. E.g. 450 - * means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSFORM_SKEW_X(val) \ - { \ - .prop = LV_STYLE_TRANSFORM_SKEW_X, .value = { .num = (int32_t)val } \ - } - -/** - * Skew Widget vertically. The value is interpreted in 0.1 degree units. E.g. 450 - * means 45 deg. - * Default: 0, inherited: No, layout: Yes, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TRANSFORM_SKEW_Y(val) \ - { \ - .prop = LV_STYLE_TRANSFORM_SKEW_Y, .value = { .num = (int32_t)val } \ - } - -/** - * Sets the padding on the top. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_PAD_TOP(val) \ - { \ - .prop = LV_STYLE_PAD_TOP, .value = { .num = (int32_t)val } \ - } - -/** - * Sets the padding on the bottom. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_PAD_BOTTOM(val) \ - { \ - .prop = LV_STYLE_PAD_BOTTOM, .value = { .num = (int32_t)val } \ - } - -/** - * Sets the padding on the left. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_PAD_LEFT(val) \ - { \ - .prop = LV_STYLE_PAD_LEFT, .value = { .num = (int32_t)val } \ - } - -/** - * Sets the padding on the right. It makes the content area smaller in this direction. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_PAD_RIGHT(val) \ - { \ - .prop = LV_STYLE_PAD_RIGHT, .value = { .num = (int32_t)val } \ - } - -/** - * Sets the padding between the rows. Used by the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_PAD_ROW(val) \ - { \ - .prop = LV_STYLE_PAD_ROW, .value = { .num = (int32_t)val } \ - } - -/** - * Sets the padding between the columns. Used by the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_PAD_COLUMN(val) \ - { \ - .prop = LV_STYLE_PAD_COLUMN, .value = { .num = (int32_t)val } \ - } - -/** - * Pad text labels away from the scale ticks/remainder of the ``LV_PART_``. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_PAD_RADIAL(val) \ - { \ - .prop = LV_STYLE_PAD_RADIAL, .value = { .num = (int32_t)val } \ - } - -/** - * Sets margin on the top. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_MARGIN_TOP(val) \ - { \ - .prop = LV_STYLE_MARGIN_TOP, .value = { .num = (int32_t)val } \ - } - -/** - * Sets margin on the bottom. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_MARGIN_BOTTOM(val) \ - { \ - .prop = LV_STYLE_MARGIN_BOTTOM, .value = { .num = (int32_t)val } \ - } - -/** - * Sets margin on the left. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_MARGIN_LEFT(val) \ - { \ - .prop = LV_STYLE_MARGIN_LEFT, .value = { .num = (int32_t)val } \ - } - -/** - * Sets margin on the right. Widget will keep this space from its siblings in layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_MARGIN_RIGHT(val) \ - { \ - .prop = LV_STYLE_MARGIN_RIGHT, .value = { .num = (int32_t)val } \ - } - -/** - * Set background color of Widget. - * Default: `0xffffff`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_BG_COLOR(val) \ - { \ - .prop = LV_STYLE_BG_COLOR, .value = { .color = val } \ - } - -/** - * Set opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BG_OPA(val) \ - { \ - .prop = LV_STYLE_BG_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_BG_GRAD_COLOR(val) \ - { \ - .prop = LV_STYLE_BG_GRAD_COLOR, .value = { .color = val } \ - } - -/** - * Set direction of the gradient of the background. Possible values are - * `LV_GRAD_DIR_NONE/HOR/VER`. - * Default: `LV_GRAD_DIR_NONE`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BG_GRAD_DIR(val) \ - { \ - .prop = LV_STYLE_BG_GRAD_DIR, .value = { .num = (int32_t)val } \ - } - -/** - * Set point from which background color should start for gradients. 0 means to - * top/left side, 255 the bottom/right side, 128 the center, and so on. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BG_MAIN_STOP(val) \ - { \ - .prop = LV_STYLE_BG_MAIN_STOP, .value = { .num = (int32_t)val } \ - } - -/** - * Set point from which background's gradient color should start. 0 means to top/left - * side, 255 the bottom/right side, 128 the center, and so on. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BG_GRAD_STOP(val) \ - { \ - .prop = LV_STYLE_BG_GRAD_STOP, .value = { .num = (int32_t)val } \ - } - -/** - * Set opacity of the first gradient color. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BG_MAIN_OPA(val) \ - { \ - .prop = LV_STYLE_BG_MAIN_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set opacity of the second gradient color. - * Default: 255, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BG_GRAD_OPA(val) \ - { \ - .prop = LV_STYLE_BG_GRAD_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set gradient definition. The pointed instance must exist while Widget is alive. - * NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and - * `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors - * as well. If it's set other gradient related properties will be ignored. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param val Pointer to gradient descriptor - */ -#define LV_STYLE_CONST_BG_GRAD(val) \ - { \ - .prop = LV_STYLE_BG_GRAD, .value = { .ptr = val } \ - } - -/** - * Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or - * an `LV_SYMBOL_...`. - * Default: `NULL`, inherited: No, layout: No, ext. draw: Yes. - * @param val Pointer to image source - */ -#define LV_STYLE_CONST_BG_IMAGE_SRC(val) \ - { \ - .prop = LV_STYLE_BG_IMAGE_SRC, .value = { .ptr = val } \ - } - -/** - * Set opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means - * fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other - * values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BG_IMAGE_OPA(val) \ - { \ - .prop = LV_STYLE_BG_IMAGE_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set a color to mix to the background image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_BG_IMAGE_RECOLOR(val) \ - { \ - .prop = LV_STYLE_BG_IMAGE_RECOLOR, .value = { .color = val } \ - } - -/** - * Set intensity of background image recoloring. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full - * recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted - * proportionally. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BG_IMAGE_RECOLOR_OPA(val) \ - { \ - .prop = LV_STYLE_BG_IMAGE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * If enabled the background image will be tiled. Possible values are `true` or `false`. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BG_IMAGE_TILED(val) \ - { \ - .prop = LV_STYLE_BG_IMAGE_TILED, .value = { .num = (int32_t)val } \ - } - -/** - * Set color of the border. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_BORDER_COLOR(val) \ - { \ - .prop = LV_STYLE_BORDER_COLOR, .value = { .color = val } \ - } - -/** - * Set opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BORDER_OPA(val) \ - { \ - .prop = LV_STYLE_BORDER_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set width of the border. Only pixel values can be used. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BORDER_WIDTH(val) \ - { \ - .prop = LV_STYLE_BORDER_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Set only which side(s) the border should be drawn. Possible values are - * `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as - * well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`. - * Default: `LV_BORDER_SIDE_FULL`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BORDER_SIDE(val) \ - { \ - .prop = LV_STYLE_BORDER_SIDE, .value = { .num = (int32_t)val } \ - } - -/** - * Sets whether the border should be drawn before or after the children are drawn. - * `true`: after children, `false`: before children. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BORDER_POST(val) \ - { \ - .prop = LV_STYLE_BORDER_POST, .value = { .num = (int32_t)val } \ - } - -/** - * Set width of outline in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_OUTLINE_WIDTH(val) \ - { \ - .prop = LV_STYLE_OUTLINE_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Set color of outline. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_OUTLINE_COLOR(val) \ - { \ - .prop = LV_STYLE_OUTLINE_COLOR, .value = { .color = val } \ - } - -/** - * Set opacity of outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_OUTLINE_OPA(val) \ - { \ - .prop = LV_STYLE_OUTLINE_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set padding of outline, i.e. the gap between Widget and the outline. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_OUTLINE_PAD(val) \ - { \ - .prop = LV_STYLE_OUTLINE_PAD, .value = { .num = (int32_t)val } \ - } - -/** - * Set width of the shadow in pixels. The value should be >= 0. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_SHADOW_WIDTH(val) \ - { \ - .prop = LV_STYLE_SHADOW_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Set an offset on the shadow in pixels in X direction. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_SHADOW_OFFSET_X(val) \ - { \ - .prop = LV_STYLE_SHADOW_OFFSET_X, .value = { .num = (int32_t)val } \ - } - -/** - * Set an offset on the shadow in pixels in Y direction. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_SHADOW_OFFSET_Y(val) \ - { \ - .prop = LV_STYLE_SHADOW_OFFSET_Y, .value = { .num = (int32_t)val } \ - } - -/** - * Make shadow calculation to use a larger or smaller rectangle as base. The value can - * be in pixels to make the area larger/smaller. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_SHADOW_SPREAD(val) \ - { \ - .prop = LV_STYLE_SHADOW_SPREAD, .value = { .num = (int32_t)val } \ - } - -/** - * Set color of shadow. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_SHADOW_COLOR(val) \ - { \ - .prop = LV_STYLE_SHADOW_COLOR, .value = { .color = val } \ - } - -/** - * Set opacity of shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_SHADOW_OPA(val) \ - { \ - .prop = LV_STYLE_SHADOW_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_IMAGE_OPA(val) \ - { \ - .prop = LV_STYLE_IMAGE_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set color to mix with the image. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_IMAGE_RECOLOR(val) \ - { \ - .prop = LV_STYLE_IMAGE_RECOLOR, .value = { .color = val } \ - } - -/** - * Set intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_IMAGE_RECOLOR_OPA(val) \ - { \ - .prop = LV_STYLE_IMAGE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set image colorkey definition. The lv_image_colorkey_t contains two color values: - * `high_color` and `low_color`. the color of pixels ranging from `low_color` to - * `high_color` will be transparent. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param val Pointer to image color key - */ -#define LV_STYLE_CONST_IMAGE_COLORKEY(val) \ - { \ - .prop = LV_STYLE_IMAGE_COLORKEY, .value = { .ptr = val } \ - } - -/** - * Set width of lines in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_LINE_WIDTH(val) \ - { \ - .prop = LV_STYLE_LINE_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Set width of dashes in pixels. Note that dash works only on horizontal and vertical lines. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_LINE_DASH_WIDTH(val) \ - { \ - .prop = LV_STYLE_LINE_DASH_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Set gap between dashes in pixels. Note that dash works only on horizontal and - * vertical lines. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_LINE_DASH_GAP(val) \ - { \ - .prop = LV_STYLE_LINE_DASH_GAP, .value = { .num = (int32_t)val } \ - } - -/** - * Make end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_LINE_ROUNDED(val) \ - { \ - .prop = LV_STYLE_LINE_ROUNDED, .value = { .num = (int32_t)val } \ - } - -/** - * Set color of lines. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_LINE_COLOR(val) \ - { \ - .prop = LV_STYLE_LINE_COLOR, .value = { .color = val } \ - } - -/** - * Set opacity of lines. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_LINE_OPA(val) \ - { \ - .prop = LV_STYLE_LINE_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set width (thickness) of arcs in pixels. - * Default: 0, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_ARC_WIDTH(val) \ - { \ - .prop = LV_STYLE_ARC_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Make end points of arcs rounded. `true`: rounded, `false`: perpendicular line ending. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_ARC_ROUNDED(val) \ - { \ - .prop = LV_STYLE_ARC_ROUNDED, .value = { .num = (int32_t)val } \ - } - -/** - * Set color of arc. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_ARC_COLOR(val) \ - { \ - .prop = LV_STYLE_ARC_COLOR, .value = { .color = val } \ - } - -/** - * Set opacity of arcs. - * Default: `LV_OPA_COVER`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_ARC_OPA(val) \ - { \ - .prop = LV_STYLE_ARC_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set an image from which arc will be masked out. It's useful to display complex - * effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param val Pointer to image source - */ -#define LV_STYLE_CONST_ARC_IMAGE_SRC(val) \ - { \ - .prop = LV_STYLE_ARC_IMAGE_SRC, .value = { .ptr = val } \ - } - -/** - * Sets color of text. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_TEXT_COLOR(val) \ - { \ - .prop = LV_STYLE_TEXT_COLOR, .value = { .color = val } \ - } - -/** - * Set opacity of text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully - * transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values - * or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TEXT_OPA(val) \ - { \ - .prop = LV_STYLE_TEXT_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set font of text (a pointer `lv_font_t *`). - * Default: `LV_FONT_DEFAULT`, inherited: Yes, layout: Yes, ext. draw: No. - * @param val Pointer to font - */ -#define LV_STYLE_CONST_TEXT_FONT(val) \ - { \ - .prop = LV_STYLE_TEXT_FONT, .value = { .ptr = val } \ - } - -/** - * Set letter space in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TEXT_LETTER_SPACE(val) \ - { \ - .prop = LV_STYLE_TEXT_LETTER_SPACE, .value = { .num = (int32_t)val } \ - } - -/** - * Set line space in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TEXT_LINE_SPACE(val) \ - { \ - .prop = LV_STYLE_TEXT_LINE_SPACE, .value = { .num = (int32_t)val } \ - } - -/** - * Set decoration for the text. Possible values are - * `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well. - * Default: `LV_TEXT_DECOR_NONE`, inherited: Yes, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TEXT_DECOR(val) \ - { \ - .prop = LV_STYLE_TEXT_DECOR, .value = { .num = (int32_t)val } \ - } - -/** - * Set how to align the lines of the text. Note that it doesn't align the Widget - * itself, only the lines inside the Widget. Possible values are - * `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base - * direction and uses left or right alignment accordingly. - * Default: `LV_TEXT_ALIGN_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TEXT_ALIGN(val) \ - { \ - .prop = LV_STYLE_TEXT_ALIGN, .value = { .num = (int32_t)val } \ - } - -/** - * Sets the color of letter outline stroke. - * Default: `0x000000`, inherited: Yes, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_TEXT_OUTLINE_STROKE_COLOR(val) \ - { \ - .prop = LV_STYLE_TEXT_OUTLINE_STROKE_COLOR, .value = { .color = val } \ - } - -/** - * Set the letter outline stroke width in pixels. - * Default: 0, inherited: Yes, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TEXT_OUTLINE_STROKE_WIDTH(val) \ - { \ - .prop = LV_STYLE_TEXT_OUTLINE_STROKE_WIDTH, .value = { .num = (int32_t)val } \ - } - -/** - * Set the opacity of the letter outline stroke. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means - * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TEXT_OUTLINE_STROKE_OPA(val) \ - { \ - .prop = LV_STYLE_TEXT_OUTLINE_STROKE_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set the text leading trim mode. Removes empty space above and/or below text based - * on font metrics (cap-height, x-height, baseline). Similar to CSS `text-box-trim`. - * Possible values are `LV_TEXT_LEADING_TRIM_NONE/CAPITAL_BASELINE/LOWER_BASELINE/CAPITAL/LOWER`. - * Default: `LV_TEXT_LEADING_TRIM_NONE`, inherited: Yes, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_TEXT_LEADING_TRIM(val) \ - { \ - .prop = LV_STYLE_TEXT_LEADING_TRIM, .value = { .num = (int32_t)val } \ - } - -/** - * Sets the intensity of blurring. Applied on each lv_part separately before the - * children are rendered. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BLUR_RADIUS(val) \ - { \ - .prop = LV_STYLE_BLUR_RADIUS, .value = { .num = (int32_t)val } \ - } - -/** - * If `true` the background of the widget will be blurred. The part should have < 100% - * opacity to make it visible. If `false` the given part will be blurred when it's - * rendered but before drawing the children. - * Default: `false`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BLUR_BACKDROP(val) \ - { \ - .prop = LV_STYLE_BLUR_BACKDROP, .value = { .num = (int32_t)val } \ - } - -/** - * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over - * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower - * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. - * Default: `LV_BLUR_QUALITY_AUTO`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BLUR_QUALITY(val) \ - { \ - .prop = LV_STYLE_BLUR_QUALITY, .value = { .num = (int32_t)val } \ - } - -/** - * Sets the intensity of blurring. Applied on each lv_part separately before the - * children are rendered. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_DROP_SHADOW_RADIUS(val) \ - { \ - .prop = LV_STYLE_DROP_SHADOW_RADIUS, .value = { .num = (int32_t)val } \ - } - -/** - * Set an offset on the shadow in pixels in X direction. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_DROP_SHADOW_OFFSET_X(val) \ - { \ - .prop = LV_STYLE_DROP_SHADOW_OFFSET_X, .value = { .num = (int32_t)val } \ - } - -/** - * Set an offset on the shadow in pixels in Y direction. - * Default: `0`, inherited: No, layout: No, ext. draw: Yes. - * @param val Value to submit - */ -#define LV_STYLE_CONST_DROP_SHADOW_OFFSET_Y(val) \ - { \ - .prop = LV_STYLE_DROP_SHADOW_OFFSET_Y, .value = { .num = (int32_t)val } \ - } - -/** - * Set the color of the shadow. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_DROP_SHADOW_COLOR(val) \ - { \ - .prop = LV_STYLE_DROP_SHADOW_COLOR, .value = { .color = val } \ - } - -/** - * Set the opacity of the shadow. - * Default: `0`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_DROP_SHADOW_OPA(val) \ - { \ - .prop = LV_STYLE_DROP_SHADOW_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over - * quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower - * blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. - * Default: `LV_BLUR_QUALITY_PRECISION`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_DROP_SHADOW_QUALITY(val) \ - { \ - .prop = LV_STYLE_DROP_SHADOW_QUALITY, .value = { .num = (int32_t)val } \ - } - -/** - * Set radius on every corner. The value is interpreted in pixels (>= 0) or - * `LV_RADIUS_CIRCLE` for max radius. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_RADIUS(val) \ - { \ - .prop = LV_STYLE_RADIUS, .value = { .num = (int32_t)val } \ - } - -/** - * Move start point of object (e.g. scale tick) radially. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_RADIAL_OFFSET(val) \ - { \ - .prop = LV_STYLE_RADIAL_OFFSET, .value = { .num = (int32_t)val } \ - } - -/** - * Enable clipping of content that overflows rounded corners of parent Widget. Can be - * `true` or `false`. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_CLIP_CORNER(val) \ - { \ - .prop = LV_STYLE_CLIP_CORNER, .value = { .num = (int32_t)val } \ - } - -/** - * Scale down all opacity values of the Widget by this factor. Value 0, `LV_OPA_0` or - * `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means - * fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_OPA(val) \ - { \ - .prop = LV_STYLE_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * First draw Widget on the layer, then scale down layer opacity factor. Value 0, - * `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or - * `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc - * means semi transparency. - * Default: `LV_OPA_COVER`, inherited: Yes, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_OPA_LAYERED(val) \ - { \ - .prop = LV_STYLE_OPA_LAYERED, .value = { .num = (int32_t)val } \ - } - -/** - * Mix a color with all colors of the Widget. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param val Pointer to color-filter descriptor - */ -#define LV_STYLE_CONST_COLOR_FILTER_DSC(val) \ - { \ - .prop = LV_STYLE_COLOR_FILTER_DSC, .value = { .ptr = val } \ - } - -/** - * The intensity of mixing of color filter. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_COLOR_FILTER_OPA(val) \ - { \ - .prop = LV_STYLE_COLOR_FILTER_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Set a color to mix to the obj. - * Default: `0x000000`, inherited: No, layout: No, ext. draw: No. - * @param val Color to submit - */ -#define LV_STYLE_CONST_RECOLOR(val) \ - { \ - .prop = LV_STYLE_RECOLOR, .value = { .color = val } \ - } - -/** - * Sets the intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means - * fully transparent. A value of 255, `LV_OPA_100` or `LV_OPA_COVER` means fully - * opaque. Intermediate values like LV_OPA_10, LV_OPA_20, etc result in - * semi-transparency. - * Default: `LV_OPA_TRANSP`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_RECOLOR_OPA(val) \ - { \ - .prop = LV_STYLE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ - } - -/** - * Animation template for Widget's animation. Should be a pointer to `lv_anim_t`. The - * animation parameters are widget specific, e.g. animation time could be the E.g. - * blink time of the cursor on the Text Area or scroll time of a roller. See Widgets' - * documentation to learn more. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param val Pointer to animation descriptor - */ -#define LV_STYLE_CONST_ANIM(val) \ - { \ - .prop = LV_STYLE_ANIM, .value = { .ptr = val } \ - } - -/** - * Animation duration in milliseconds. Its meaning is widget specific. E.g. blink time - * of the cursor on the Text Area or scroll time of a roller. See Widgets' - * documentation to learn more. - * Default: 0, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_ANIM_DURATION(val) \ - { \ - .prop = LV_STYLE_ANIM_DURATION, .value = { .num = (int32_t)val } \ - } - -/** - * An initialized ``lv_style_transition_dsc_t`` to describe a transition. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param val Pointer to transition descriptor - */ -#define LV_STYLE_CONST_TRANSITION(val) \ - { \ - .prop = LV_STYLE_TRANSITION, .value = { .ptr = val } \ - } - -/** - * Describes how to blend the colors to the background. Possible values are - * `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY/DIFFERENCE`. - * Default: `LV_BLEND_MODE_NORMAL`, inherited: No, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BLEND_MODE(val) \ - { \ - .prop = LV_STYLE_BLEND_MODE, .value = { .num = (int32_t)val } \ - } - -/** - * Set layout of Widget. Children will be repositioned and resized according to - * policies set for the layout. For possible values see documentation of the layouts. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_LAYOUT(val) \ - { \ - .prop = LV_STYLE_LAYOUT, .value = { .num = (int32_t)val } \ - } - -/** - * Set base direction of Widget. Possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`. - * Default: `LV_BASE_DIR_AUTO`, inherited: Yes, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_BASE_DIR(val) \ - { \ - .prop = LV_STYLE_BASE_DIR, .value = { .num = (int32_t)val } \ - } - -/** - * If set, a layer will be created for the widget and the layer will be masked with - * this A8 bitmap mask. - * Default: `NULL`, inherited: No, layout: No, ext. draw: No. - * @param val Pointer to A8 bitmap mask - */ -#define LV_STYLE_CONST_BITMAP_MASK_SRC(val) \ - { \ - .prop = LV_STYLE_BITMAP_MASK_SRC, .value = { .ptr = val } \ - } - -/** - * Adjust sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the - * rotary to half, 512: speeds up to double, 256: no change. - * Default: `256`, inherited: Yes, layout: No, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_ROTARY_SENSITIVITY(val) \ - { \ - .prop = LV_STYLE_ROTARY_SENSITIVITY, .value = { .num = (int32_t)val } \ - } - -#if LV_USE_FLEX -/** - * Defines in which direction the flex layout should arrange the children. - * Default: `LV_FLEX_FLOW_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_FLEX_FLOW(val) \ - { \ - .prop = LV_STYLE_FLEX_FLOW, .value = { .num = (int32_t)val } \ - } - -/** - * Defines how to align the children in the direction of flex flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_FLEX_MAIN_PLACE(val) \ - { \ - .prop = LV_STYLE_FLEX_MAIN_PLACE, .value = { .num = (int32_t)val } \ - } - -/** - * Defines how to align the children perpendicular to the direction of flex flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_FLEX_CROSS_PLACE(val) \ - { \ - .prop = LV_STYLE_FLEX_CROSS_PLACE, .value = { .num = (int32_t)val } \ - } - -/** - * Defines how to align the tracks of the flow. - * Default: `LV_FLEX_ALIGN_NONE`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_FLEX_TRACK_PLACE(val) \ - { \ - .prop = LV_STYLE_FLEX_TRACK_PLACE, .value = { .num = (int32_t)val } \ - } - -/** - * Defines how much space to take proportionally from the free space of the Widget's track. - * Default: `0`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_FLEX_GROW(val) \ - { \ - .prop = LV_STYLE_FLEX_GROW, .value = { .num = (int32_t)val } \ - } - -#endif /* LV_USE_FLEX */ - -#if LV_USE_GRID -/** - * An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. - * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. - * @param val Pointer to grid-column descriptor array - */ -#define LV_STYLE_CONST_GRID_COLUMN_DSC_ARRAY(val) \ - { \ - .prop = LV_STYLE_GRID_COLUMN_DSC_ARRAY, .value = { .ptr = val } \ - } - -/** - * Defines how to distribute the columns. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_GRID_COLUMN_ALIGN(val) \ - { \ - .prop = LV_STYLE_GRID_COLUMN_ALIGN, .value = { .num = (int32_t)val } \ - } - -/** - * An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated. - * Default: `NULL`, inherited: No, layout: Yes, ext. draw: No. - * @param val Pointer to grid-row descriptor array - */ -#define LV_STYLE_CONST_GRID_ROW_DSC_ARRAY(val) \ - { \ - .prop = LV_STYLE_GRID_ROW_DSC_ARRAY, .value = { .ptr = val } \ - } - -/** - * Defines how to distribute the rows. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_GRID_ROW_ALIGN(val) \ - { \ - .prop = LV_STYLE_GRID_ROW_ALIGN, .value = { .num = (int32_t)val } \ - } - -/** - * Set column in which Widget should be placed. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_GRID_CELL_COLUMN_POS(val) \ - { \ - .prop = LV_STYLE_GRID_CELL_COLUMN_POS, .value = { .num = (int32_t)val } \ - } - -/** - * Set how to align Widget horizontally. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_GRID_CELL_X_ALIGN(val) \ - { \ - .prop = LV_STYLE_GRID_CELL_X_ALIGN, .value = { .num = (int32_t)val } \ - } - -/** - * Set how many columns Widget should span. Needs to be >= 1. - * Default: 1, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_GRID_CELL_COLUMN_SPAN(val) \ - { \ - .prop = LV_STYLE_GRID_CELL_COLUMN_SPAN, .value = { .num = (int32_t)val } \ - } - -/** - * Set row in which Widget should be placed. - * Default: 0, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_GRID_CELL_ROW_POS(val) \ - { \ - .prop = LV_STYLE_GRID_CELL_ROW_POS, .value = { .num = (int32_t)val } \ - } - -/** - * Set how to align Widget vertically. - * Default: `LV_GRID_ALIGN_START`, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_GRID_CELL_Y_ALIGN(val) \ - { \ - .prop = LV_STYLE_GRID_CELL_Y_ALIGN, .value = { .num = (int32_t)val } \ - } - -/** - * Set how many rows Widget should span. Needs to be >= 1. - * Default: 1, inherited: No, layout: Yes, ext. draw: No. - * @param val Value to submit - */ -#define LV_STYLE_CONST_GRID_CELL_ROW_SPAN(val) \ - { \ - .prop = LV_STYLE_GRID_CELL_ROW_SPAN, .value = { .num = (int32_t)val } \ - } - -#endif /* LV_USE_GRID */ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV_STYLE_GEN_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_text.c b/src/misc/lv_text.c index 608216d724..edac1e38fc 100644 --- a/src/misc/lv_text.c +++ b/src/misc/lv_text.c @@ -6,14 +6,9 @@ /********************* * INCLUDES *********************/ + #include "lv_text_private.h" #include "lv_text_ap.h" -#include "lv_math.h" -#include "lv_log.h" -#include "lv_assert.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" -#include "../misc/lv_types.h" /********************* * DEFINES diff --git a/src/misc/lv_text.h b/src/misc/lv_text.h index ca1cf1a150..061e631be2 100644 --- a/src/misc/lv_text.h +++ b/src/misc/lv_text.h @@ -1,151 +1,2 @@ -/** - * @file lv_text.h - * - */ - -#ifndef LV_TEXT_H -#define LV_TEXT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "lv_types.h" -#include "lv_area.h" -#include "../font/lv_font.h" -#include "../stdlib/lv_sprintf.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * Options for text rendering. - */ -typedef enum { - LV_TEXT_FLAG_NONE = 0x00, - - /** Ignore max-width to avoid automatic word wrapping*/ - LV_TEXT_FLAG_EXPAND = 0x01, - - /** Max-width is already equal to the longest line. (Used to skip some calculation)*/ - LV_TEXT_FLAG_FIT = 0x02, - - /** To prevent overflow, insert breaks between any two characters. - * Otherwise breaks are inserted at word boundaries, as configured via LV_TXT_BREAK_CHARS - * or according to LV_TXT_LINE_BREAK_LONG_LEN, LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN, - * and LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN.*/ - LV_TEXT_FLAG_BREAK_ALL = 0x04, - - /**Enable parsing of recolor command*/ - LV_TEXT_FLAG_RECOLOR = 0x08, - -} lv_text_flag_t; - -/** Label align policy*/ -typedef enum { - LV_TEXT_ALIGN_AUTO, /**< Align text auto*/ - LV_TEXT_ALIGN_LEFT, /**< Align text to left*/ - LV_TEXT_ALIGN_CENTER, /**< Align text to center*/ - LV_TEXT_ALIGN_RIGHT, /**< Align text to right*/ -} lv_text_align_t; - -/**Text leading trim mode (similar to CSS text-box-trim / text-box-edge) - * using more intuitive naming. - * See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/text-box-edge*/ -typedef enum { - - /** No trimming (default behavior)*/ - LV_TEXT_LEADING_TRIM_NONE = 0, - - /** Trim to the top of the capital letters (cap height) - * and the bottom to the (alphabetic) baseline*/ - LV_TEXT_LEADING_TRIM_CAPITAL_BASELINE, - - /** Trim to the top of the lower case letters (x-height) - * and the bottom to the (alphabetic) baseline*/ - LV_TEXT_LEADING_TRIM_LOWER_BASELINE, - - /**< Trim only the top to the height of the capital letters (cap-height)*/ - LV_TEXT_LEADING_TRIM_CAPITAL, - - /**< Trim only the top to the height of the lower case letters (x-height)*/ - LV_TEXT_LEADING_TRIM_LOWER, - -} lv_text_leading_trim_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Get the number of pixels to trim from the top of text for a given - * leading-trim mode. - * @param font pointer to a font - * @param trim leading-trim mode - * @return pixels to trim from the top (0 if no trimming) - */ -static inline int32_t lv_font_get_top_trim(const lv_font_t * font, - lv_text_leading_trim_t trim) -{ - switch(trim) { - case LV_TEXT_LEADING_TRIM_CAPITAL_BASELINE: - case LV_TEXT_LEADING_TRIM_CAPITAL: - return (font->line_height - font->base_line) - font->cap_height; - case LV_TEXT_LEADING_TRIM_LOWER_BASELINE: - case LV_TEXT_LEADING_TRIM_LOWER: - return (font->line_height - font->base_line) - font->x_height; - default: - return 0; - } -} - -/** - * Get the number of pixels to trim from the bottom of text for a given - * leading-trim mode. - * @param font pointer to a font - * @param trim leading-trim mode - * @return pixels to trim from the bottom (0 if no trimming) - */ -static inline int32_t lv_font_get_bottom_trim(const lv_font_t * font, - lv_text_leading_trim_t trim) -{ - switch(trim) { - case LV_TEXT_LEADING_TRIM_CAPITAL_BASELINE: - case LV_TEXT_LEADING_TRIM_LOWER_BASELINE: - return font->base_line; - default: - return 0; - } -} - -/** - * Get size of a text - * @param size_res pointer to a 'point_t' variable to store the result - * @param text pointer to a text - * @param font pointer to font of the text - * @param letter_space letter space of the text - * @param line_space line space of the text - * @param max_width max width of the text (break the lines to fit this size). Set COORD_MAX to avoid - * @param flag settings for the text from ::lv_text_flag_t - */ -void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, int32_t letter_space, - int32_t line_space, int32_t max_width, lv_text_flag_t flag); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TEXT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_text_ap.c b/src/misc/lv_text_ap.c index ebd492b2a4..5bd9b00bee 100644 --- a/src/misc/lv_text_ap.c +++ b/src/misc/lv_text_ap.c @@ -6,12 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_bidi.h" -#include "lv_text_private.h" + #include "lv_text_ap.h" -#include "lv_types.h" -#include "../stdlib/lv_mem.h" -#include "../draw/lv_draw.h" +#include "lv_text_private.h" /********************* * DEFINES diff --git a/src/misc/lv_text_ap.h b/src/misc/lv_text_ap.h index b4fe690923..ee0311f69c 100644 --- a/src/misc/lv_text_ap.h +++ b/src/misc/lv_text_ap.h @@ -13,11 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "lv_text.h" -#include "lv_types.h" -#include "../draw/lv_draw.h" -#if LV_USE_ARABIC_PERSIAN_CHARS == 1 +#include "../lv_public_api.h" + +#if LV_USE_ARABIC_PERSIAN_CHARS /********************* * DEFINES diff --git a/src/misc/lv_text_private.h b/src/misc/lv_text_private.h index a54a351bc9..6f9d2a5fda 100644 --- a/src/misc/lv_text_private.h +++ b/src/misc/lv_text_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_text.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_timer.c b/src/misc/lv_timer.c index eb29603b1a..ecd0d5a683 100644 --- a/src/misc/lv_timer.c +++ b/src/misc/lv_timer.c @@ -5,14 +5,9 @@ /********************* * INCLUDES *********************/ + #include "lv_timer_private.h" #include "../core/lv_global.h" -#include "../tick/lv_tick.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_sprintf.h" -#include "lv_assert.h" -#include "lv_ll.h" -#include "lv_profiler.h" /********************* * DEFINES diff --git a/src/misc/lv_timer.h b/src/misc/lv_timer.h index 76644f6120..1afcb378b6 100644 --- a/src/misc/lv_timer.h +++ b/src/misc/lv_timer.h @@ -1,223 +1,2 @@ -/** - * @file lv_timer.h - */ - -#ifndef LV_TIMER_H -#define LV_TIMER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "../tick/lv_tick.h" -#include "lv_types.h" -#include "lv_ll.h" - -/********************* - * DEFINES - *********************/ -#ifndef LV_ATTRIBUTE_TIMER_HANDLER -#define LV_ATTRIBUTE_TIMER_HANDLER -#endif - -#define LV_NO_TIMER_READY 0xFFFFFFFF - -/********************** - * TYPEDEFS - **********************/ - -/** - * Timers execute this type of functions. - */ -typedef void (*lv_timer_cb_t)(lv_timer_t *); - -/** - * Timer handler resume this type of function. - */ -typedef void (*lv_timer_handler_resume_cb_t)(void * data); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Call it periodically to handle lv_timers. - * @return time till it needs to be run next (in ms) - */ -LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void); - -/** - * Call it in the super-loop of main() or threads. It will run lv_timer_handler() - * with a given period in ms. You can use it with sleep or delay in OS environment. - * This function is used to simplify the porting. - * @param period the period for running lv_timer_handler() - * @return the time after which it must be called again - */ -LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler_run_in_period(uint32_t period); - -/** - * Call it in the super-loop of main() or threads. It will automatically call lv_timer_handler() at the right time. - * This function is used to simplify the porting. - */ -LV_ATTRIBUTE_TIMER_HANDLER void lv_timer_periodic_handler(void); - -/** - * Set the resume callback to the timer handler - * @param cb the function to call when timer handler is resumed - * @param data pointer to a resume data - */ -void lv_timer_handler_set_resume_cb(lv_timer_handler_resume_cb_t cb, void * data); - -/** - * Create an "empty" timer. It needs to be initialized with at least - * `lv_timer_set_cb` and `lv_timer_set_period` - * @return pointer to the created timer - */ -lv_timer_t * lv_timer_create_basic(void); - -/** - * Create a new lv_timer - * @param timer_xcb a callback to call periodically. - * (the 'x' in the argument name indicates that it's not a fully generic function because it not follows - * the `func_name(object, callback, ...)` convention) - * @param period call period in ms unit - * @param user_data custom parameter - * @return pointer to the new timer - */ -lv_timer_t * lv_timer_create(lv_timer_cb_t timer_xcb, uint32_t period, void * user_data); - -/** - * Delete a lv_timer - * @param timer pointer to an lv_timer - */ -void lv_timer_delete(lv_timer_t * timer); - -/** - * Pause a timer. - * It is typically safe to call from an interrupt handler or a different thread. - * @param timer pointer to an lv_timer - */ -void lv_timer_pause(lv_timer_t * timer); - -/** - * Resume a timer. - * @param timer pointer to an lv_timer - */ -void lv_timer_resume(lv_timer_t * timer); - -/** - * Set the callback to the timer (the function to call periodically) - * @param timer pointer to a timer - * @param timer_cb the function to call periodically - */ -void lv_timer_set_cb(lv_timer_t * timer, lv_timer_cb_t timer_cb); - -/** - * Set new period for a lv_timer - * @param timer pointer to a lv_timer - * @param period the new period - */ -void lv_timer_set_period(lv_timer_t * timer, uint32_t period); - -/** - * Make a lv_timer ready. It will not wait its period. - * @param timer pointer to a lv_timer. - */ -void lv_timer_ready(lv_timer_t * timer); - -/** - * Set the number of times a timer will repeat. - * @param timer pointer to a lv_timer. - * @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times - */ -void lv_timer_set_repeat_count(lv_timer_t * timer, int32_t repeat_count); - -/** - * Set whether a lv_timer will be deleted automatically when it is called `repeat_count` times. - * @param timer pointer to a lv_timer. - * @param auto_delete true: auto delete; false: timer will be paused when it is called `repeat_count` times. - */ -void lv_timer_set_auto_delete(lv_timer_t * timer, bool auto_delete); - -/** - * Set custom parameter to the lv_timer. - * @param timer pointer to a lv_timer. - * @param user_data custom parameter - */ -void lv_timer_set_user_data(lv_timer_t * timer, void * user_data); - -/** - * Reset a lv_timer. - * It will be called the previously set period milliseconds later. - * @param timer pointer to a lv_timer. - */ -void lv_timer_reset(lv_timer_t * timer); - -/** - * Enable or disable the whole lv_timer handling - * @param en true: lv_timer handling is running, false: lv_timer handling is suspended - */ -void lv_timer_enable(bool en); - -/** - * Get idle percentage - * @return the lv_timer idle in percentage - */ -uint32_t lv_timer_get_idle(void); - -/** - * Get the time remaining until the next timer will run - * @return the time remaining in ms - */ -uint32_t lv_timer_get_time_until_next(void); - -/** - * Iterate through the timers - * @param timer NULL to start iteration or the previous return value to get the next timer - * @return the next timer or NULL if there is no more timer - */ -lv_timer_t * lv_timer_get_next(lv_timer_t * timer); - -/** - * Get the user_data passed when the timer was created - * @param timer pointer to the lv_timer - * @return pointer to the user_data - */ -void * lv_timer_get_user_data(lv_timer_t * timer); - -/** - * Get the pause state of a timer - * @param timer pointer to a lv_timer - * @return true: timer is paused; false: timer is running - */ -bool lv_timer_get_paused(lv_timer_t * timer); - -#if LV_USE_EXT_DATA -/** - * @brief Attaches external user data and destructor callback to a timer object - * - * Associates custom user data with an LVGL timer and specifies a destructor function - * that will be automatically invoked when the timer is deleted to properly clean up - * the associated resources. - * - * @param timer Pointer to the timer object - * @param data User-defined data pointer to associate with the timer - * @param destructor Callback function for cleaning up ext_data when timer is deleted. - * Receives ext_data as parameter. NULL means no cleanup required. - */ -void lv_timer_set_external_data(lv_timer_t * timer, void * data, void (* free_cb)(void * data)); -#endif - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_timer_private.h b/src/misc/lv_timer_private.h index 713c73844a..63a6f5c40f 100644 --- a/src/misc/lv_timer_private.h +++ b/src/misc/lv_timer_private.h @@ -14,8 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_ext_data.h" -#include "lv_timer.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_tree.c b/src/misc/lv_tree.c index 93fcff972f..5dde356ee9 100644 --- a/src/misc/lv_tree.c +++ b/src/misc/lv_tree.c @@ -7,11 +7,8 @@ /********************* * INCLUDES *********************/ -#include "lv_tree.h" -#include "../stdlib/lv_mem.h" -#include "../stdlib/lv_string.h" -#include "lv_assert.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/misc/lv_tree.h b/src/misc/lv_tree.h index bec73be78e..027d872515 100644 --- a/src/misc/lv_tree.h +++ b/src/misc/lv_tree.h @@ -1,109 +1,2 @@ -/** - * @file lv_tree.h - * Tree. The tree nodes are dynamically allocated by the 'lv_mem' module. - */ - -#ifndef LV_TREE_H -#define LV_TREE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_types.h" - -/********************* - * DEFINES - *********************/ - -#define LV_TREE_NODE(n) ((lv_tree_node_t*)(n)) - -/********************** - * TYPEDEFS - **********************/ - -typedef struct _lv_tree_class_t lv_tree_class_t; -typedef struct _lv_tree_node_t lv_tree_node_t; - -typedef void (*lv_tree_constructor_cb_t)(const lv_tree_class_t * class_p, lv_tree_node_t * node); -typedef void (*lv_tree_destructor_cb_t)(const lv_tree_class_t * class_p, lv_tree_node_t * node); - -/** - * Describe the common methods of every object. - * Similar to a C++ class. - */ -struct _lv_tree_class_t { - const lv_tree_class_t * base_class; - uint32_t instance_size; - lv_tree_constructor_cb_t constructor_cb; - lv_tree_destructor_cb_t destructor_cb; -}; - -/** Description of a tree node*/ -struct _lv_tree_node_t { - lv_tree_node_t * parent; - lv_tree_node_t ** children; - uint32_t child_cnt; - uint32_t child_cap; - const lv_tree_class_t * class_p; -}; - -enum _lv_tree_walk_mode_t { - LV_TREE_WALK_PRE_ORDER = 0, - LV_TREE_WALK_POST_ORDER, -}; -typedef uint8_t lv_tree_walk_mode_t; - -typedef bool (*lv_tree_traverse_cb_t)(const lv_tree_node_t * node, void * user_data); -typedef bool (*lv_tree_before_cb_t)(const lv_tree_node_t * node, void * user_data); -typedef void (*lv_tree_after_cb_t)(const lv_tree_node_t * node, void * user_data); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -extern const lv_tree_class_t lv_tree_node_class; - -/** - * @brief Create a tree node - * @param class_p pointer to a class of the node - * @param parent pointer to the parent node (or NULL if it's the root node) - * @return pointer to the new node - */ -lv_tree_node_t * lv_tree_node_create(const lv_tree_class_t * class_p, lv_tree_node_t * parent); - -/** - * @brief Delete a tree node and all its children recursively - * @param node pointer to the node to delete - */ -void lv_tree_node_delete(lv_tree_node_t * node); - -/** - * @brief Walk the tree recursively and call a callback function on each node - * @param node pointer to the root node of the tree - * @param mode LV_TREE_WALK_PRE_ORDER or LV_TREE_WALK_POST_ORDER - * @param cb callback function to call on each node - * @param bcb callback function to call before visiting a node - * @param acb callback function to call after visiting a node - * @param user_data user data to pass to the callback functions - * @return true: traversal is finished; false: traversal broken - */ -bool lv_tree_walk(const lv_tree_node_t * node, - lv_tree_walk_mode_t mode, - lv_tree_traverse_cb_t cb, - lv_tree_before_cb_t bcb, - lv_tree_after_cb_t acb, - void * user_data); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_types.h b/src/misc/lv_types.h index dcc73f06aa..c00774d3f8 100644 --- a/src/misc/lv_types.h +++ b/src/misc/lv_types.h @@ -1,459 +1,2 @@ -/** - * @file lv_types.h - * - */ - -#ifndef LV_TYPES_H -#define LV_TYPES_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -#ifndef __ASSEMBLY__ -#include LV_STDINT_INCLUDE -#include LV_STDDEF_INCLUDE -#include LV_STDBOOL_INCLUDE -#include LV_INTTYPES_INCLUDE -#include LV_LIMITS_INCLUDE -#include LV_STDARG_INCLUDE -#endif - -/********************* - * DEFINES - *********************/ - -/*If __UINTPTR_MAX__ or UINTPTR_MAX are available, use them to determine arch size*/ -#if defined(__UINTPTR_MAX__) && __UINTPTR_MAX__ > 0xFFFFFFFF -#define LV_ARCH_64 - -#elif defined(UINTPTR_MAX) && UINTPTR_MAX > 0xFFFFFFFF -#define LV_ARCH_64 - -/*Otherwise use compiler-dependent means to determine arch size*/ -#elif defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined (__aarch64__) -#define LV_ARCH_64 - -#endif - -#if LV_USE_3DTEXTURE -#if LV_USE_OPENGLES -#define LV_3DTEXTURE_ID_NULL 0u -#endif - -#ifndef LV_3DTEXTURE_ID_NULL -#error enable LV_USE_OPENGLES to use LV_USE_3DTEXTURE -#endif -#endif /*LV_USE_3DTEXTURE*/ - -/********************** - * TYPEDEFS - **********************/ - -/* Exclude C enum and struct definitions when included by assembly code */ -#ifndef __ASSEMBLY__ - -/** - * LVGL error codes. - */ -typedef enum { - LV_RESULT_INVALID = 0, /*Typically indicates that the object is deleted (become invalid) in the action - function or an operation was failed*/ - LV_RESULT_OK, /*The object is valid (no deleted) after the action*/ -} lv_result_t; - -#if defined(__cplusplus) || __STDC_VERSION__ >= 199901L -/*If c99 or newer, use the definition of uintptr_t directly from */ -typedef uintptr_t lv_uintptr_t; -typedef intptr_t lv_intptr_t; - -#else - -/*Otherwise, use the arch size determination*/ -#ifdef LV_ARCH_64 -typedef uint64_t lv_uintptr_t; -typedef int64_t lv_intptr_t; -#else -typedef uint32_t lv_uintptr_t; -typedef int32_t lv_intptr_t; -#endif - -#endif - -#if LV_USE_FLOAT -typedef float lv_value_precise_t; -#else -typedef int32_t lv_value_precise_t; -#endif - -#if LV_USE_3DTEXTURE -#if LV_USE_OPENGLES -typedef unsigned int lv_3dtexture_id_t; -#endif -#endif - -/** - * Typedefs from various lvgl modules. - * They are defined here to avoid circular dependencies. - */ - -typedef struct _lv_obj_t lv_obj_t; - -typedef lv_obj_t * (*lv_screen_create_cb_t)(void); - -typedef uint8_t lv_opa_t; - -typedef uint8_t lv_style_prop_t; - -typedef struct _lv_obj_class_t lv_obj_class_t; - -typedef struct _lv_group_t lv_group_t; - -typedef struct _lv_display_t lv_display_t; - -typedef struct _lv_layer_t lv_layer_t; -typedef struct _lv_draw_unit_t lv_draw_unit_t; -typedef struct _lv_draw_task_t lv_draw_task_t; - -typedef struct _lv_indev_t lv_indev_t; - -typedef struct _lv_event_t lv_event_t; - -typedef struct _lv_timer_t lv_timer_t; - -typedef struct _lv_theme_t lv_theme_t; - -typedef struct _lv_anim_t lv_anim_t; - -typedef struct _lv_anim_timeline_t lv_anim_timeline_t; - -typedef struct _lv_font_t lv_font_t; -typedef struct _lv_font_class_t lv_font_class_t; -typedef struct _lv_font_info_t lv_font_info_t; - -typedef struct _lv_font_manager_t lv_font_manager_t; - -typedef struct _lv_image_decoder_t lv_image_decoder_t; - -typedef struct _lv_image_decoder_dsc_t lv_image_decoder_dsc_t; - -typedef struct _lv_draw_image_dsc_t lv_draw_image_dsc_t; - -typedef struct _lv_fragment_t lv_fragment_t; -typedef struct _lv_fragment_class_t lv_fragment_class_t; -typedef struct _lv_fragment_managed_states_t lv_fragment_managed_states_t; - -typedef struct _lv_profiler_builtin_config_t lv_profiler_builtin_config_t; - -typedef struct _lv_rb_node_t lv_rb_node_t; - -typedef struct _lv_rb_t lv_rb_t; - -typedef struct _lv_color_filter_dsc_t lv_color_filter_dsc_t; - -typedef struct _lv_event_dsc_t lv_event_dsc_t; - -typedef struct _lv_cache_t lv_cache_t; - -typedef struct _lv_cache_entry_t lv_cache_entry_t; - -typedef struct _lv_fs_file_cache_t lv_fs_file_cache_t; - -typedef struct _lv_image_decoder_args_t lv_image_decoder_args_t; - -typedef struct _lv_image_cache_data_t lv_image_cache_data_t; - -typedef struct _lv_image_header_cache_data_t lv_image_header_cache_data_t; - -typedef struct _lv_draw_mask_t lv_draw_mask_t; - -typedef struct _lv_draw_label_hint_t lv_draw_label_hint_t; - -typedef struct _lv_draw_glyph_dsc_t lv_draw_glyph_dsc_t; - -typedef struct _lv_draw_image_sup_t lv_draw_image_sup_t; - -typedef struct _lv_draw_mask_rect_dsc_t lv_draw_mask_rect_dsc_t; - -typedef struct _lv_obj_style_t lv_obj_style_t; - -typedef struct _lv_obj_style_transition_dsc_t lv_obj_style_transition_dsc_t; - -typedef struct _lv_hit_test_info_t lv_hit_test_info_t; - -typedef struct _lv_cover_check_info_t lv_cover_check_info_t; - -typedef struct _lv_image_t lv_image_t; - -typedef struct _lv_animimg_t lv_animimg_t; - -typedef struct _lv_arc_t lv_arc_t; - -typedef struct _lv_arclabel_t lv_arclabel_t; - -typedef struct _lv_label_t lv_label_t; - -typedef struct _lv_bar_anim_t lv_bar_anim_t; - -typedef struct _lv_bar_t lv_bar_t; - -typedef struct _lv_button_t lv_button_t; - -typedef struct _lv_buttonmatrix_t lv_buttonmatrix_t; - -typedef struct _lv_calendar_t lv_calendar_t; - -typedef struct _lv_canvas_t lv_canvas_t; - -typedef struct _lv_chart_series_t lv_chart_series_t; - -typedef struct _lv_chart_cursor_t lv_chart_cursor_t; - -typedef struct _lv_chart_t lv_chart_t; - -typedef struct _lv_checkbox_t lv_checkbox_t; - -typedef struct _lv_dropdown_t lv_dropdown_t; - -typedef struct _lv_dropdown_list_t lv_dropdown_list_t; - -typedef struct _lv_imagebutton_src_info_t lv_imagebutton_src_info_t; - -typedef struct _lv_imagebutton_t lv_imagebutton_t; - -typedef struct _lv_keyboard_t lv_keyboard_t; - -typedef struct _lv_led_t lv_led_t; - -typedef struct _lv_line_t lv_line_t; - -typedef struct _lv_menu_load_page_event_data_t lv_menu_load_page_event_data_t; - -typedef struct _lv_menu_history_t lv_menu_history_t; - -typedef struct _lv_menu_t lv_menu_t; - -typedef struct _lv_menu_page_t lv_menu_page_t; - -typedef struct _lv_msgbox_t lv_msgbox_t; - -typedef struct _lv_roller_t lv_roller_t; - -typedef struct _lv_scale_section_t lv_scale_section_t; - -typedef struct _lv_scale_t lv_scale_t; - -typedef struct _lv_slider_t lv_slider_t; - -typedef struct _lv_span_t lv_span_t; - -typedef struct _lv_spangroup_t lv_spangroup_t; - -typedef struct _lv_textarea_t lv_textarea_t; - -typedef struct _lv_spinbox_t lv_spinbox_t; - -typedef struct _lv_switch_t lv_switch_t; - -typedef struct _lv_table_cell_t lv_table_cell_t; - -typedef struct _lv_table_t lv_table_t; - -typedef struct _lv_tabview_t lv_tabview_t; - -typedef struct _lv_tileview_t lv_tileview_t; - -typedef struct _lv_tileview_tile_t lv_tileview_tile_t; - -typedef struct _lv_win_t lv_win_t; - -typedef struct _lv_spinner_t lv_spinner_t; - -typedef struct _lv_3dtexture_t lv_3dtexture_t; - -typedef struct _lv_gltf_t lv_gltf_t; - -typedef struct _lv_gltf_model_t lv_gltf_model_t; - -typedef struct _lv_gltf_model_node_t lv_gltf_model_node_t; - -typedef struct _lv_gltf_environment lv_gltf_environment_t; - -typedef struct _lv_gltf_ibl_sampler lv_gltf_ibl_sampler_t; - -typedef struct _lv_subject_t lv_subject_t; - -typedef struct _lv_observer_t lv_observer_t; - -typedef struct _lv_subject_increment_dsc_t lv_subject_increment_dsc_t; - -typedef struct _lv_monkey_config_t lv_monkey_config_t; - -typedef struct _lv_ime_pinyin_t lv_ime_pinyin_t; - -typedef struct _lv_file_explorer_t lv_file_explorer_t; - -typedef struct _lv_barcode_t lv_barcode_t; - -typedef struct _lv_qrcode_t lv_qrcode_t; - -typedef struct _lv_freetype_outline_vector_t lv_freetype_outline_vector_t; - -typedef struct _lv_freetype_outline_event_param_t lv_freetype_outline_event_param_t; - -typedef struct _lv_fpoint_t lv_fpoint_t; - -typedef struct _lv_matrix_t lv_matrix_t; - -typedef struct _lv_vector_path_t lv_vector_path_t; - -typedef struct _lv_vector_gradient_t lv_vector_gradient_t; - -typedef struct _lv_vector_fill_dsc_t lv_vector_fill_dsc_t; - -typedef struct _lv_vector_stroke_dsc_t lv_vector_stroke_dsc_t; - -typedef struct _lv_vector_path_ctx_t lv_vector_path_ctx_t; - -typedef struct _lv_draw_vector_dsc_t lv_draw_vector_dsc_t; - -typedef struct _lv_xkb_t lv_xkb_t; - -typedef struct _lv_libinput_event_t lv_libinput_event_t; - -typedef struct _lv_libinput_t lv_libinput_t; - -typedef struct _lv_draw_sw_unit_t lv_draw_sw_unit_t; - -typedef struct _lv_draw_sw_mask_common_dsc_t lv_draw_sw_mask_common_dsc_t; - -typedef struct _lv_draw_sw_mask_line_param_t lv_draw_sw_mask_line_param_t; - -typedef struct _lv_draw_sw_mask_angle_param_t lv_draw_sw_mask_angle_param_t; - -typedef struct _lv_draw_sw_mask_radius_param_t lv_draw_sw_mask_radius_param_t; - -typedef struct _lv_draw_sw_mask_fade_param_t lv_draw_sw_mask_fade_param_t; - -typedef struct _lv_draw_sw_mask_map_param_t lv_draw_sw_mask_map_param_t; - -typedef struct _lv_draw_sw_blend_dsc_t lv_draw_sw_blend_dsc_t; - -typedef struct _lv_draw_sw_blend_fill_dsc_t lv_draw_sw_blend_fill_dsc_t; - -typedef struct _lv_draw_sw_blend_image_dsc_t lv_draw_sw_blend_image_dsc_t; - -typedef struct _lv_draw_buf_handlers_t lv_draw_buf_handlers_t; - -typedef struct _lv_rlottie_t lv_rlottie_t; - -typedef struct _lv_ffmpeg_player_t lv_ffmpeg_player_t; - -typedef struct _lv_opengles_window_t lv_opengles_window_t; -typedef struct _lv_opengles_window_texture_t lv_opengles_window_texture_t; - -typedef uint32_t lv_prop_id_t; - -typedef struct _lv_array_t lv_array_t; - -typedef struct _lv_iter_t lv_iter_t; - -typedef struct _lv_circle_buf_t lv_circle_buf_t; - -typedef struct _lv_draw_buf_t lv_draw_buf_t; - -#if LV_USE_OBJ_PROPERTY -typedef struct _lv_property_name_t lv_property_name_t; -#endif - -#if LV_USE_SYSMON - -typedef struct _lv_sysmon_backend_data_t lv_sysmon_backend_data_t; - -#if LV_USE_PERF_MONITOR -typedef struct _lv_sysmon_perf_info_t lv_sysmon_perf_info_t; -#endif /*LV_USE_PERF_MONITOR*/ - -#endif /*LV_USE_SYSMON*/ - - -#if LV_USE_EVDEV -typedef struct _lv_evdev_discovery_t lv_evdev_discovery_t; -#endif - -#if LV_USE_TRANSLATION -typedef struct _lv_translation_tag_dsc_t lv_translation_tag_dsc_t; - -typedef struct _lv_translation_pack_t lv_translation_pack_t; -#endif - -#if LV_USE_DRAW_EVE -typedef struct _lv_draw_eve_unit_t lv_draw_eve_unit_t; -#endif - -#endif /*__ASSEMBLY__*/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -#define LV_UNUSED(x) ((void)x) - -#define _LV_CONCAT(x, y) x ## y -#define LV_CONCAT(x, y) _LV_CONCAT(x, y) -#undef _LV_CONCAT - -#define _LV_CONCAT3(x, y, z) x ## y ## z -#define LV_CONCAT3(x, y, z) _LV_CONCAT3(x, y, z) -#undef _LV_CONCAT3 - -#if defined(PYCPARSER) || defined(__CC_ARM) -#define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) -#elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __GNUC__ > 4) -#define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) __attribute__((format(gnu_printf, fmtstr, vararg))) -#elif (defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(__IAR_SYSTEMS_ICC__)) -#define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) __attribute__((format(printf, fmtstr, vararg))) -#else -#define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) -#endif - -#ifndef LV_NORETURN -#if defined(PYCPARSER) -#define LV_NORETURN -#elif defined(__GNUC__) -#define LV_NORETURN __attribute__((noreturn)) -#elif defined(_MSC_VER) -#define LV_NORETURN __declspec(noreturn) -#else -#define LV_NORETURN -#endif -#endif /* LV_NORETURN not defined */ - -#ifndef LV_UNREACHABLE -#if defined(__GNUC__) -#define LV_UNREACHABLE() __builtin_unreachable() -#elif defined(_MSC_VER) -#define LV_UNREACHABLE() __assume(0) -#else -#define LV_UNREACHABLE() while(1) -#endif -#endif /* LV_UNREACHABLE not defined */ - -#ifndef LV_ARRAYLEN -#define LV_ARRAYLEN(a) (sizeof(a)/sizeof((a)[0])) -#endif /*LV_ARRAYLEN*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TYPES_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/misc/lv_utils.c b/src/misc/lv_utils.c index 0a4e626a2f..8b1f27ef00 100644 --- a/src/misc/lv_utils.c +++ b/src/misc/lv_utils.c @@ -6,9 +6,8 @@ /********************* * INCLUDES *********************/ + #include "lv_utils.h" -#include "lv_fs.h" -#include "lv_types.h" #include "cache/lv_cache.h" /********************* diff --git a/src/misc/lv_utils.h b/src/misc/lv_utils.h index 9f30251a6f..f4b5a51384 100644 --- a/src/misc/lv_utils.h +++ b/src/misc/lv_utils.h @@ -14,8 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_types.h" -#include "../draw/lv_draw_buf.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/osal/lv_cmsis_rtos2.c b/src/osal/lv_cmsis_rtos2.c index 7eb898315a..b1a0480759 100644 --- a/src/osal/lv_cmsis_rtos2.c +++ b/src/osal/lv_cmsis_rtos2.c @@ -16,9 +16,6 @@ #if LV_USE_OS == LV_OS_CMSIS_RTOS2 -#include "../misc/lv_log.h" -#include "../misc/lv_timer.h" - /********************* * DEFINES *********************/ diff --git a/src/osal/lv_freertos.c b/src/osal/lv_freertos.c index 8c33b2ed15..33c59c3110 100644 --- a/src/osal/lv_freertos.c +++ b/src/osal/lv_freertos.c @@ -21,8 +21,6 @@ #include "atomic.h" #endif -#include "../tick/lv_tick.h" -#include "../misc/lv_log.h" #include "../core/lv_global.h" /********************* diff --git a/src/osal/lv_linux.c b/src/osal/lv_linux.c index 99ea96d2fc..a6649ad1f6 100644 --- a/src/osal/lv_linux.c +++ b/src/osal/lv_linux.c @@ -12,7 +12,6 @@ #if defined(__linux__) #include "../core/lv_global.h" -#include "../misc/lv_log.h" #include "lv_linux.h" #include #include diff --git a/src/osal/lv_linux.h b/src/osal/lv_linux.h index a94e64bc32..d2517c1089 100644 --- a/src/osal/lv_linux.h +++ b/src/osal/lv_linux.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_os.h" +#include "lv_os_private.h" #ifdef __linux__ /********************* * DEFINES diff --git a/src/osal/lv_mqx.c b/src/osal/lv_mqx.c index 3b2442f4ab..232a893847 100644 --- a/src/osal/lv_mqx.c +++ b/src/osal/lv_mqx.c @@ -10,10 +10,6 @@ #if LV_USE_OS == LV_OS_MQX -#include "../misc/lv_log.h" -#include "../misc/lv_timer.h" -#include "../stdlib/lv_string.h" - /********************* * DEFINES *********************/ diff --git a/src/osal/lv_os.c b/src/osal/lv_os.c index c8142a6d36..35807c4722 100644 --- a/src/osal/lv_os.c +++ b/src/osal/lv_os.c @@ -8,7 +8,6 @@ *********************/ #include "lv_os_private.h" #include "../core/lv_global.h" -#include "../tick/lv_tick.h" /********************* * DEFINES diff --git a/src/osal/lv_os.h b/src/osal/lv_os.h index eaa20e9337..5d50f64328 100644 --- a/src/osal/lv_os.h +++ b/src/osal/lv_os.h @@ -1,71 +1,2 @@ -/** - * @file lv_os.h - * - */ - -#ifndef LV_OS_H -#define LV_OS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * OS OPTIONS - *********************/ - -/********************* - * INCLUDES - *********************/ -#include "../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Lock LVGL's general mutex. - * LVGL is not thread safe, so a mutex is used to avoid executing multiple LVGL functions at the same time - * from different threads. It shall be called when calling LVGL functions from threads - * different than lv_timer_handler's thread. It doesn't need to be called in LVGL events because - * they are called from lv_timer_handler(). - * It is called internally in lv_timer_handler(). - */ -void lv_lock(void); - -/** - * Same as `lv_lock()` but can be called from an interrupt. - * @return LV_RESULT_OK: success; LV_RESULT_INVALID: failure - */ -lv_result_t lv_lock_isr(void); - -/** - * The pair of `lv_lock()` and `lv_lock_isr()`. - * It unlocks LVGL general mutex. - * It is called internally in lv_timer_handler(). - */ -void lv_unlock(void); - -/** - * Sleeps the current thread by an amount of milliseconds. - * @param ms amount of milliseconds to sleep the current thread. - */ -void lv_sleep_ms(uint32_t ms); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_OS_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/osal/lv_os_none.c b/src/osal/lv_os_none.c index 71fb2bb9a0..5b650ab4b8 100644 --- a/src/osal/lv_os_none.c +++ b/src/osal/lv_os_none.c @@ -7,11 +7,10 @@ * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "../lv_public_api.h" #if LV_USE_OS == LV_OS_NONE #include "lv_os_private.h" -#include "../misc/lv_timer.h" /********************* * DEFINES diff --git a/src/osal/lv_os_private.h b/src/osal/lv_os_private.h index 029e90c258..b7846f6944 100644 --- a/src/osal/lv_os_private.h +++ b/src/osal/lv_os_private.h @@ -17,10 +17,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" - -#include "lv_os.h" -#include "../misc/lv_types.h" +#include "../lv_public_api.h" #ifdef __linux__ #include "lv_linux.h" diff --git a/src/osal/lv_pthread.c b/src/osal/lv_pthread.c index 6bec2c77fa..10b02a35b0 100644 --- a/src/osal/lv_pthread.c +++ b/src/osal/lv_pthread.c @@ -10,12 +10,6 @@ #if LV_USE_OS == LV_OS_PTHREAD -#include "../misc/lv_log.h" - -#ifndef __linux__ - #include "../misc/lv_timer.h" -#endif - /********************* * DEFINES *********************/ diff --git a/src/osal/lv_rtthread.c b/src/osal/lv_rtthread.c index 9608ee24e3..f702d7c7ac 100644 --- a/src/osal/lv_rtthread.c +++ b/src/osal/lv_rtthread.c @@ -10,9 +10,6 @@ #if LV_USE_OS == LV_OS_RTTHREAD -#include "../misc/lv_log.h" -#include "../misc/lv_timer.h" - /********************* * DEFINES *********************/ diff --git a/src/osal/lv_sdl2.c b/src/osal/lv_sdl2.c index a5ba0bedb3..3baa5d41bc 100644 --- a/src/osal/lv_sdl2.c +++ b/src/osal/lv_sdl2.c @@ -6,16 +6,12 @@ /********************* * INCLUDES *********************/ + #include "lv_os_private.h" #if LV_USE_OS == LV_OS_SDL2 #include -#include "../misc/lv_log.h" - -#ifndef __linux__ - #include "../misc/lv_timer.h" -#endif /********************* * DEFINES diff --git a/src/osal/lv_windows.c b/src/osal/lv_windows.c index c28bc07970..d6ff3e39b7 100644 --- a/src/osal/lv_windows.c +++ b/src/osal/lv_windows.c @@ -12,7 +12,6 @@ #if LV_USE_OS == LV_OS_WINDOWS #include -#include "../misc/lv_timer.h" /********************* * DEFINES diff --git a/src/others/file_explorer/lv_file_explorer.c b/src/others/file_explorer/lv_file_explorer.c index a97f4eaaf5..511b58bf89 100644 --- a/src/others/file_explorer/lv_file_explorer.c +++ b/src/others/file_explorer/lv_file_explorer.c @@ -7,11 +7,12 @@ * INCLUDES *********************/ #include "lv_file_explorer_private.h" -#include "../../misc/lv_fs_private.h" -#include "../../core/lv_obj_class_private.h" + #if LV_USE_FILE_EXPLORER -#include "../../lvgl.h" +#include "../../misc/lv_fs_private.h" +#include "../../core/lv_obj_class_private.h" +#include "../../lv_public_api.h" #include "../../core/lv_global.h" /********************* diff --git a/src/others/file_explorer/lv_file_explorer.h b/src/others/file_explorer/lv_file_explorer.h index a860cf5478..0d2dbb4674 100644 --- a/src/others/file_explorer/lv_file_explorer.h +++ b/src/others/file_explorer/lv_file_explorer.h @@ -1,175 +1,2 @@ -/** - * @file lv_file_explorer.h - * - */ - -#ifndef LV_FILE_EXPLORER_H -#define LV_FILE_EXPLORER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../core/lv_obj.h" - -#if LV_USE_FILE_EXPLORER != 0 - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_EXPLORER_SORT_NONE, - LV_EXPLORER_SORT_KIND, -} lv_file_explorer_sort_t; - -#if LV_FILE_EXPLORER_QUICK_ACCESS -typedef enum { - LV_EXPLORER_HOME_DIR, - LV_EXPLORER_MUSIC_DIR, - LV_EXPLORER_PICTURES_DIR, - LV_EXPLORER_VIDEO_DIR, - LV_EXPLORER_DOCS_DIR, - LV_EXPLORER_FS_DIR, -} lv_file_explorer_dir_t; -#endif - -extern const lv_obj_class_t lv_file_explorer_class; - -/*********************** - * GLOBAL VARIABLES - ***********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -lv_obj_t * lv_file_explorer_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -#if LV_FILE_EXPLORER_QUICK_ACCESS -/** - * Set file_explorer - * @param obj pointer to a label object - * @param dir the dir from 'lv_file_explorer_dir_t' enum. - * @param path path - - */ -void lv_file_explorer_set_quick_access_path(lv_obj_t * obj, lv_file_explorer_dir_t dir, const char * path); -#endif - -/** - * Set file_explorer sort - * @param obj pointer to a file explorer object - * @param sort the sort from 'lv_file_explorer_sort_t' enum. - */ -void lv_file_explorer_set_sort(lv_obj_t * obj, lv_file_explorer_sort_t sort); - -/** - * Set the visibility of the "< Back" button - * @param obj pointer to a file explorer object - * @param show bool true/false, enable or disable button - */ -void lv_file_explorer_show_back_button(lv_obj_t * obj, bool show); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get file explorer Selected file - * @param obj pointer to a file explorer object - * @return pointer to the file explorer selected file name - */ -const char * lv_file_explorer_get_selected_file_name(const lv_obj_t * obj); - -/** - * Get file explorer cur path - * @param obj pointer to a file explorer object - * @return pointer to the file explorer cur path - */ -const char * lv_file_explorer_get_current_path(const lv_obj_t * obj); - -/** - * Get file explorer file list obj(lv_table) - * @param obj pointer to a file explorer object - * @return pointer to the file explorer file table obj(lv_table) - */ -lv_obj_t * lv_file_explorer_get_file_table(lv_obj_t * obj); - -/** - * Get file explorer head area obj - * @param obj pointer to a file explorer object - * @return pointer to the file explorer head area obj(lv_obj) - */ -lv_obj_t * lv_file_explorer_get_header(lv_obj_t * obj); - -/** - * Get file explorer path obj(label) - * @param obj pointer to a file explorer object - * @return pointer to the file explorer path obj(lv_label) - */ -lv_obj_t * lv_file_explorer_get_path_label(lv_obj_t * obj); - -#if LV_FILE_EXPLORER_QUICK_ACCESS -/** - * Get file explorer head area obj - * @param obj pointer to a file explorer object - * @return pointer to the file explorer quick access area obj(lv_obj) - */ -lv_obj_t * lv_file_explorer_get_quick_access_area(lv_obj_t * obj); - -/** - * Get file explorer places list obj(lv_list) - * @param obj pointer to a file explorer object - * @return pointer to the file explorer places list obj(lv_list) - */ -lv_obj_t * lv_file_explorer_get_places_list(lv_obj_t * obj); - -/** - * Get file explorer device list obj(lv_list) - * @param obj pointer to a file explorer object - * @return pointer to the file explorer device list obj(lv_list) - */ -lv_obj_t * lv_file_explorer_get_device_list(lv_obj_t * obj); -#endif - -/** - * Set file_explorer sort - * @param obj pointer to a file explorer object - * @return the current mode from 'lv_file_explorer_sort_t' - */ -lv_file_explorer_sort_t lv_file_explorer_get_sort(const lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -/** - * Open a specified path - * @param obj pointer to a file explorer object - * @param dir pointer to the path - */ -void lv_file_explorer_open_dir(lv_obj_t * obj, const char * dir); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_FILE_EXPLORER*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_FILE_EXPLORER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/others/file_explorer/lv_file_explorer_private.h b/src/others/file_explorer/lv_file_explorer_private.h index 1611b47b1b..d0932f10fd 100644 --- a/src/others/file_explorer/lv_file_explorer_private.h +++ b/src/others/file_explorer/lv_file_explorer_private.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "../../core/lv_obj_private.h" -#include "lv_file_explorer.h" +#include "../../lv_public_api.h" -#if LV_USE_FILE_EXPLORER != 0 +#if LV_USE_FILE_EXPLORER +#include "../../core/lv_obj_private.h" /********************* * DEFINES diff --git a/src/others/fragment/lv_fragment.c b/src/others/fragment/lv_fragment.c index 9d7fd71f4a..fcc61c06cb 100644 --- a/src/others/fragment/lv_fragment.c +++ b/src/others/fragment/lv_fragment.c @@ -10,7 +10,6 @@ #include "lv_fragment_private.h" #if LV_USE_FRAGMENT -#include "../../stdlib/lv_string.h" /********************** * STATIC PROTOTYPES diff --git a/src/others/fragment/lv_fragment.h b/src/others/fragment/lv_fragment.h index 1e7d29fcff..fabea534f0 100644 --- a/src/others/fragment/lv_fragment.h +++ b/src/others/fragment/lv_fragment.h @@ -1,297 +1,2 @@ -/** - * Public header for Fragment - * @file lv_fragment.h - */ - -#ifndef LV_FRAGMENT_H -#define LV_FRAGMENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" - -#if LV_USE_FRAGMENT - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct _lv_fragment_manager_t lv_fragment_manager_t; - -struct _lv_fragment_t { - /** - * Class of this fragment - */ - const lv_fragment_class_t * cls; - /** - * Managed fragment states. If not null, then this fragment is managed. - * - * @warning Don't modify values inside this struct! - */ - lv_fragment_managed_states_t * managed; - /** - * Child fragment manager - */ - lv_fragment_manager_t * child_manager; - /** - * lv_obj returned by create_obj_cb - */ - lv_obj_t * obj; - -}; - -struct _lv_fragment_class_t { - /** - * Constructor function for fragment class - * @param self Fragment instance - * @param args Arguments assigned by fragment manager - */ - void (*constructor_cb)(lv_fragment_t * self, void * args); - - /** - * Destructor function for fragment class - * @param self Fragment instance, will be freed after this call - */ - void (*destructor_cb)(lv_fragment_t * self); - - /** - * Fragment attached to manager - * @param self Fragment instance - */ - void (*attached_cb)(lv_fragment_t * self); - - /** - * Fragment detached from manager - * @param self Fragment instance - */ - void (*detached_cb)(lv_fragment_t * self); - - /** - * Create objects - * @param self Fragment instance - * @param container Container of the objects should be created upon - * @return Created object, NULL if multiple objects has been created - */ - lv_obj_t * (*create_obj_cb)(lv_fragment_t * self, lv_obj_t * container); - - /** - * - * @param self Fragment instance - * @param obj lv_obj returned by create_obj_cb - */ - void (*obj_created_cb)(lv_fragment_t * self, lv_obj_t * obj); - - /** - * Called before objects in the fragment will be deleted. - * - * @param self Fragment instance - * @param obj object with this fragment - */ - void (*obj_will_delete_cb)(lv_fragment_t * self, lv_obj_t * obj); - - /** - * Called when the object created by fragment received `LV_EVENT_DELETE` event - * @param self Fragment instance - * @param obj object with this fragment - */ - void (*obj_deleted_cb)(lv_fragment_t * self, lv_obj_t * obj); - - /** - * Handle event - * @param self Fragment instance - * @param which User-defined ID of event - * @param data1 User-defined data - * @param data2 User-defined data - */ - bool (*event_cb)(lv_fragment_t * self, int code, void * userdata); - - /** - * *REQUIRED*: Allocation size of fragment - */ - size_t instance_size; -}; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create fragment manager instance - * @param parent Parent fragment if this manager is placed inside another fragment, can be null. - * @return Fragment manager instance - */ -lv_fragment_manager_t * lv_fragment_manager_create(lv_fragment_t * parent); - -/** - * Destroy fragment manager instance - * @param manager Fragment manager instance - */ -void lv_fragment_manager_delete(lv_fragment_manager_t * manager); - -/** - * Create object of all fragments managed by this manager. - * @param manager Fragment manager instance - */ -void lv_fragment_manager_create_obj(lv_fragment_manager_t * manager); - -/** - * Delete object created by all fragments managed by this manager. Instance of fragments will not be deleted. - * @param manager Fragment manager instance - */ -void lv_fragment_manager_delete_obj(lv_fragment_manager_t * manager); - -/** - * Attach fragment to manager, and add to container. - * @param manager Fragment manager instance - * @param fragment Fragment instance - * @param container Pointer to container object for manager to add objects to - */ -void lv_fragment_manager_add(lv_fragment_manager_t * manager, lv_fragment_t * fragment, lv_obj_t * const * container); - -/** - * Detach and destroy fragment. If fragment is in navigation stack, remove from it. - * @param manager Fragment manager instance - * @param fragment Fragment instance - */ -void lv_fragment_manager_remove(lv_fragment_manager_t * manager, lv_fragment_t * fragment); - -/** - * Attach fragment to manager and add to navigation stack. - * @param manager Fragment manager instance - * @param fragment Fragment instance - * @param container Pointer to container object for manager to add objects to - */ -void lv_fragment_manager_push(lv_fragment_manager_t * manager, lv_fragment_t * fragment, lv_obj_t * const * container); - -/** - * Remove the top-most fragment for stack - * @param manager Fragment manager instance - * @return true if there is fragment to pop - */ -bool lv_fragment_manager_pop(lv_fragment_manager_t * manager); - -/** - * Replace fragment. Old item in the stack will be removed. - * @param manager Fragment manager instance - * @param fragment Fragment instance - * @param container Pointer to container object for manager to add objects to - */ -void lv_fragment_manager_replace(lv_fragment_manager_t * manager, lv_fragment_t * fragment, - lv_obj_t * const * container); - -/** - * Send event to top-most fragment - * @param manager Fragment manager instance - * @param code User-defined ID of event - * @param userdata User-defined data - * @return true if fragment returned true - */ -bool lv_fragment_manager_send_event(lv_fragment_manager_t * manager, int code, void * userdata); - -/** - * Get stack size of this fragment manager - * @param manager Fragment manager instance - * @return Stack size of this fragment manager - */ -size_t lv_fragment_manager_get_stack_size(lv_fragment_manager_t * manager); - -/** - * Get top most fragment instance - * @param manager Fragment manager instance - * @return Top most fragment instance - */ -lv_fragment_t * lv_fragment_manager_get_top(lv_fragment_manager_t * manager); - -/** - * Find first fragment instance in the container - * @param manager Fragment manager instance - * @param container Container which target fragment added to - * @return First fragment instance in the container - */ -lv_fragment_t * lv_fragment_manager_find_by_container(lv_fragment_manager_t * manager, const lv_obj_t * container); - -/** - * Get parent fragment - * @param manager Fragment manager instance - * @return Parent fragment instance - */ -lv_fragment_t * lv_fragment_manager_get_parent_fragment(lv_fragment_manager_t * manager); - -/** - * Create a fragment instance. - * - * @param cls Fragment class. This fragment must return non null object. - * @param args Arguments assigned by fragment manager - * @return Fragment instance - */ -lv_fragment_t * lv_fragment_create(const lv_fragment_class_t * cls, void * args); - -/** - * Destroy a fragment. - * @param fragment Fragment instance. - */ -void lv_fragment_delete(lv_fragment_t * fragment); - -/** - * Get associated manager of this fragment - * @param fragment Fragment instance - * @return Fragment manager instance - */ -lv_fragment_manager_t * lv_fragment_get_manager(lv_fragment_t * fragment); - -/** - * Get container object of this fragment - * @param fragment Fragment instance - * @return Reference to container object - */ -lv_obj_t * const * lv_fragment_get_container(lv_fragment_t * fragment); - -/** - * Get parent fragment of this fragment - * @param fragment Fragment instance - * @return Parent fragment - */ -lv_fragment_t * lv_fragment_get_parent(lv_fragment_t * fragment); - -/** - * Create object by fragment. - * - * @param fragment Fragment instance. - * @param container Container of the objects should be created upon. - * @return Created object - */ -lv_obj_t * lv_fragment_create_obj(lv_fragment_t * fragment, lv_obj_t * container); - -/** - * Delete created object of a fragment - * - * @param fragment Fragment instance. - */ -void lv_fragment_delete_obj(lv_fragment_t * fragment); - -/** - * Destroy obj in fragment, and recreate them. - * @param fragment Fragment instance - */ -void lv_fragment_recreate_obj(lv_fragment_t * fragment); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_FRAGMENT*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_FRAGMENT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/others/fragment/lv_fragment_manager.c b/src/others/fragment/lv_fragment_manager.c index 5782a1652a..e4f8f7d445 100644 --- a/src/others/fragment/lv_fragment_manager.c +++ b/src/others/fragment/lv_fragment_manager.c @@ -11,9 +11,6 @@ #if LV_USE_FRAGMENT -#include "../../misc/lv_ll.h" -#include "../../stdlib/lv_string.h" - /********************* * DEFINES *********************/ diff --git a/src/others/fragment/lv_fragment_private.h b/src/others/fragment/lv_fragment_private.h index bf0d23f4cb..ba20009f86 100644 --- a/src/others/fragment/lv_fragment_private.h +++ b/src/others/fragment/lv_fragment_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_fragment.h" +#include "../../lv_public_api.h" #if LV_USE_FRAGMENT diff --git a/src/others/translation/lv_translation.c b/src/others/translation/lv_translation.c index 7d1407422a..61428777f8 100644 --- a/src/others/translation/lv_translation.c +++ b/src/others/translation/lv_translation.c @@ -6,17 +6,10 @@ /********************* * INCLUDES *********************/ -#include "lv_translation.h" +#include "lv_translation_private.h" #if LV_USE_TRANSLATION -#include "lv_translation_private.h" -#include "../../misc/lv_ll.h" -#include "../../stdlib/lv_mem.h" -#include "../../stdlib/lv_string.h" -#include "../../misc/lv_log.h" -#include "../../misc/lv_assert.h" #include "../../core/lv_global.h" -#include "../../lvgl_private.h" /********************* * DEFINES diff --git a/src/others/translation/lv_translation.h b/src/others/translation/lv_translation.h index cab96cf6f3..64cc1e7b7d 100644 --- a/src/others/translation/lv_translation.h +++ b/src/others/translation/lv_translation.h @@ -1,147 +1,2 @@ -/** - * @file lv_translation.h - * - */ - -#ifndef LV_TRANSLATION_H -#define LV_TRANSLATION_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_TRANSLATION - -#include LV_STDINT_INCLUDE -#include "../../misc/lv_array.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the translation module - */ -void lv_translation_init(void); - -/** - * De-initialize the translation module and free all allocated translations - */ -void lv_translation_deinit(void); - -/** - * Register a translation pack from static arrays. - * All the pointers need to be static, that is to live while they are used - * @param languages List of languages. E.g. `{"en", "de", NULL}` - * @param tags Tags that are using in the UI. E.g. `{"dog", "cat", NULL}` - * @param translations List of translations. E.g. `{"Dog", "Cat", "Hund", "Katze"}` - * @return The created pack - */ -lv_translation_pack_t * lv_translation_add_static(const char * const languages[], const char * const tags[], - const char * const translations[]); - -/** - * Add a pack to which translations can be added dynamically. - * `pack->languages` needs to be a malloc-ed array where each language is also malloc-ed as an element. - * `pack->translation_array` stores the translation having `lv_translation_tag_dsc_t` items - * In each array element `tag` is a malloced string, `translations` is a malloc-ed array - * with malloc-ed array for each element. - * @return the created pack to which data can be added manually. - */ -lv_translation_pack_t * lv_translation_add_dynamic(void); - -/** - * Select the current language - * The `LV_EVENT_TRANSLATION_LANGUAGE_CHANGED` event will be sent to every widget - * @param lang a string from the defined languages. E.g. "en" or "de" - */ -void lv_translation_set_language(const char * lang); - -/** - * Get the current selected language - * @return the current selected language - */ -const char * lv_translation_get_language(void); - -/** - * Get the translated version of a tag on the selected language - * @param tag the tag to translate - * @return the translation - * @note fallback rules: - * - if the tag is found on the selected language return it - * - if the tag is not found on the selected language, use the fist language - * - if the tag is not found on the first language, return the tag - */ -const char * lv_translation_get(const char * tag); - -/** - * Shorthand of lv_translation_set_language - * @param tag the tag to translate - * @return the translation - */ -static inline const char * lv_tr(const char * tag) -{ - return lv_translation_get(tag); -} - -/** - * Add a new language to a dynamic language pack. - * All languages should be added before adding tags - * @param pack pointer to a dynamic translation pack - * @param lang language to add, e.g. "en", or "de" - * @return LV_RESULT_OK: success, LV_RESULT_INVALID: failed - */ -lv_result_t lv_translation_add_language(lv_translation_pack_t * pack, const char * lang); - -/** - * Get the index of a language in a pack. - * @param pack pointer to a static or dynamic language pack - * @param lang_name name of the language to find - * @return index of the language or -1 if not found. - */ -int32_t lv_translation_get_language_index(lv_translation_pack_t * pack, const char * lang_name); - -/** - * Add a new tag to a dynamic language pack. - * Once the tag is added the translations for each language can be added too by using - * `lv_translation_set_tag_translation` - * @param pack pointer to a dynamic translation pack - * @param tag_name name of the tag, e.g. "dog", or "house" - * @return pointer to the allocated tag descriptor - */ -lv_translation_tag_dsc_t * lv_translation_add_tag(lv_translation_pack_t * pack, const char * tag_name); - -/** - * Add a translation to a tag in a dynamic translation pack - * @param pack pointer to a dynamic translation pack - * @param tag return value of `lv_translation_add_tag` - * @param lang_idx index of the language for which translation should be set - * @param trans the translation on the given language - * @return LV_RESULT_OK: success, LV_RESULT_INVALID: failed - */ -lv_result_t lv_translation_set_tag_translation(lv_translation_pack_t * pack, lv_translation_tag_dsc_t * tag, - uint32_t lang_idx, const char * trans); - -/********************** - * MACROS - **********************/ -#endif /*LV_USE_TRANSLATION*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_TRANSLATION_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/others/translation/lv_translation_private.h b/src/others/translation/lv_translation_private.h index 3fae69451d..580c3f3e7b 100644 --- a/src/others/translation/lv_translation_private.h +++ b/src/others/translation/lv_translation_private.h @@ -13,12 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_TRANSLATION #include LV_STDINT_INCLUDE -#include "../../misc/lv_array.h" /********************* * DEFINES diff --git a/src/stdlib/builtin/lv_mem_core_builtin.c b/src/stdlib/builtin/lv_mem_core_builtin.c index a07a8da322..d6bb705038 100644 --- a/src/stdlib/builtin/lv_mem_core_builtin.c +++ b/src/stdlib/builtin/lv_mem_core_builtin.c @@ -5,15 +5,12 @@ /********************* * INCLUDES *********************/ -#include "../lv_mem.h" + +#include "../../lv_public_api.h" + #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN #include "lv_tlsf.h" -#include "../lv_string.h" -#include "../../misc/lv_assert.h" -#include "../../misc/lv_log.h" -#include "../../misc/lv_ll.h" -#include "../../misc/lv_math.h" #include "../../osal/lv_os_private.h" #include "../../core/lv_global.h" diff --git a/src/stdlib/builtin/lv_sprintf_builtin.c b/src/stdlib/builtin/lv_sprintf_builtin.c index c9737523a1..2bd4070162 100644 --- a/src/stdlib/builtin/lv_sprintf_builtin.c +++ b/src/stdlib/builtin/lv_sprintf_builtin.c @@ -32,13 +32,9 @@ /*Original repository: https://github.com/mpaland/printf*/ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_STDLIB_SPRINTF == LV_STDLIB_BUILTIN -#include "../lv_sprintf.h" -#include "../lv_string.h" -#include "../../misc/lv_types.h" - #define PRINTF_DISABLE_SUPPORT_FLOAT (!LV_USE_FLOAT) // 'ntoa' conversion buffer size, this must be big enough to hold one converted diff --git a/src/stdlib/builtin/lv_string_builtin.c b/src/stdlib/builtin/lv_string_builtin.c index c998ee18a6..4ea959b456 100644 --- a/src/stdlib/builtin/lv_string_builtin.c +++ b/src/stdlib/builtin/lv_string_builtin.c @@ -5,13 +5,10 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" + +#include "../../lv_public_api.h" + #if LV_USE_STDLIB_STRING == LV_STDLIB_BUILTIN -#include "../../misc/lv_assert.h" -#include "../../misc/lv_log.h" -#include "../../misc/lv_math.h" -#include "../../stdlib/lv_string.h" -#include "../../stdlib/lv_mem.h" /********************* * DEFINES diff --git a/src/stdlib/builtin/lv_tlsf.c b/src/stdlib/builtin/lv_tlsf.c index 4232ae3249..59b30cb1c3 100644 --- a/src/stdlib/builtin/lv_tlsf.c +++ b/src/stdlib/builtin/lv_tlsf.c @@ -1,11 +1,7 @@ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN #include "lv_tlsf_private.h" -#include "../../stdlib/lv_string.h" -#include "../../misc/lv_log.h" -#include "../../misc/lv_assert.h" -#include "../../misc/lv_types.h" #undef printf #define printf LV_LOG_ERROR diff --git a/src/stdlib/builtin/lv_tlsf.h b/src/stdlib/builtin/lv_tlsf.h index d56327274d..4b40074183 100644 --- a/src/stdlib/builtin/lv_tlsf.h +++ b/src/stdlib/builtin/lv_tlsf.h @@ -1,4 +1,4 @@ -#include "../../lv_conf_internal.h" +#include "../../lv_public_api.h" #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN #ifndef LV_TLSF_H @@ -41,8 +41,7 @@ ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../../misc/lv_ll.h" -#include "../../misc/lv_types.h" +#include "../../lv_public_api.h" #if defined(__cplusplus) extern "C" { diff --git a/src/stdlib/clib/lv_mem_core_clib.c b/src/stdlib/clib/lv_mem_core_clib.c index 83e90a92c4..f7c9cc7dc4 100644 --- a/src/stdlib/clib/lv_mem_core_clib.c +++ b/src/stdlib/clib/lv_mem_core_clib.c @@ -5,9 +5,11 @@ /********************* * INCLUDES *********************/ -#include "../lv_mem.h" + +#include "../../lv_public_api.h" + #if LV_USE_STDLIB_MALLOC == LV_STDLIB_CLIB -#include "../../stdlib/lv_mem.h" + #include /********************* diff --git a/src/stdlib/clib/lv_sprintf_clib.c b/src/stdlib/clib/lv_sprintf_clib.c index 32eaee5a25..9c0389fddd 100644 --- a/src/stdlib/clib/lv_sprintf_clib.c +++ b/src/stdlib/clib/lv_sprintf_clib.c @@ -7,11 +7,12 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" + +#include "../../lv_public_api.h" #if LV_USE_STDLIB_SPRINTF == LV_STDLIB_CLIB + #include #include -#include "../lv_sprintf.h" /********************* * DEFINES diff --git a/src/stdlib/clib/lv_string_clib.c b/src/stdlib/clib/lv_string_clib.c index 97acfaa995..707c977f0b 100644 --- a/src/stdlib/clib/lv_string_clib.c +++ b/src/stdlib/clib/lv_string_clib.c @@ -5,10 +5,11 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" + +#include "../../lv_public_api.h" + #if LV_USE_STDLIB_STRING == LV_STDLIB_CLIB -#include "../lv_string.h" -#include "../lv_mem.h" /*Need lv_malloc*/ + #include /********************* diff --git a/src/stdlib/lv_mem.c b/src/stdlib/lv_mem.c index 41a002d745..ed5589a18c 100644 --- a/src/stdlib/lv_mem.c +++ b/src/stdlib/lv_mem.c @@ -5,10 +5,7 @@ /********************* * INCLUDES *********************/ -#include "lv_mem_private.h" -#include "lv_string.h" -#include "../misc/lv_assert.h" -#include "../misc/lv_log.h" +#include "../lv_public_api.h" #include "../core/lv_global.h" #if LV_USE_OS == LV_OS_PTHREAD diff --git a/src/stdlib/lv_mem.h b/src/stdlib/lv_mem.h index 2b9e2defb6..9288cd13fc 100644 --- a/src/stdlib/lv_mem.h +++ b/src/stdlib/lv_mem.h @@ -1,166 +1,2 @@ -/** - * @file lv_mem.h - * - */ - -#ifndef LV_MEM_H -#define LV_MEM_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -#include "lv_string.h" - -#include "../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef void * lv_mem_pool_t; - -/** - * Heap information structure. - */ -typedef struct { - size_t total_size; /**< Total heap size */ - size_t free_cnt; - size_t free_size; /**< Size of available memory */ - size_t free_biggest_size; - size_t used_cnt; - size_t max_used; /**< Max size of Heap memory used */ - uint8_t used_pct; /**< Percentage used */ - uint8_t frag_pct; /**< Amount of fragmentation */ -} lv_mem_monitor_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize to use malloc/free/realloc etc - */ -void lv_mem_init(void); - -/** - * Drop all dynamically allocated memory and reset the memory pools' state - */ -void lv_mem_deinit(void); - -lv_mem_pool_t lv_mem_add_pool(void * mem, size_t bytes); - -void lv_mem_remove_pool(lv_mem_pool_t pool); - -/** - * Allocate memory dynamically - * @param size requested size in bytes - * @return pointer to allocated uninitialized memory, or NULL on failure - */ -void * lv_malloc(size_t size); - -/** - * Allocate a block of zeroed memory dynamically - * @param num requested number of element to be allocated. - * @param size requested size of each element in bytes. - * @return pointer to allocated zeroed memory, or NULL on failure - */ -void * lv_calloc(size_t num, size_t size); - -/** - * Allocate zeroed memory dynamically - * @param size requested size in bytes - * @return pointer to allocated zeroed memory, or NULL on failure - */ -void * lv_zalloc(size_t size); - -/** - * Allocate zeroed memory dynamically - * @param size requested size in bytes - * @return pointer to allocated zeroed memory, or NULL on failure - */ -void * lv_malloc_zeroed(size_t size); - -/** - * Free an allocated data - * @param data pointer to an allocated memory - */ -void lv_free(void * data); - -/** - * Reallocate a memory with a new size. The old content will be kept. - * @param data_p pointer to an allocated memory. - * Its content will be copied to the new memory block and freed - * @param new_size the desired new size in byte - * @return pointer to the new memory, NULL on failure - */ -void * lv_realloc(void * data_p, size_t new_size); - -/** - * Reallocate a memory with a new size. The old content will be kept. - * In case of failure, the old pointer is free'd. - * @param data_p pointer to an allocated memory. - * Its content will be copied to the new memory block and freed - * @param new_size the desired new size in byte - * @return pointer to the new memory, NULL on failure - */ -void * lv_reallocf(void * data_p, size_t new_size); - -/** - * Used internally to execute a plain `malloc` operation - * @param size size in bytes to `malloc` - */ -void * lv_malloc_core(size_t size); - -/** - * Used internally to execute a plain `free` operation - * @param p memory address to free - */ -void lv_free_core(void * p); - -/** - * Used internally to execute a plain realloc operation - * @param p memory address to realloc - * @param new_size size in bytes to realloc - */ -void * lv_realloc_core(void * p, size_t new_size); - -/** - * Used internally by lv_mem_monitor() to gather LVGL heap state information. - * @param mon_p pointer to lv_mem_monitor_t object to be populated. - */ -void lv_mem_monitor_core(lv_mem_monitor_t * mon_p); - -lv_result_t lv_mem_test_core(void); - -/** - * @brief Tests the memory allocation system by allocating and freeing a block of memory. - * @return LV_RESULT_OK if the memory allocation system is working properly, or LV_RESULT_INVALID if there is an error. - */ -lv_result_t lv_mem_test(void); - -/** - * Give information about the work memory of dynamic allocation - * @param mon_p pointer to a lv_mem_monitor_t variable, - * the result of the analysis will be stored here - */ -void lv_mem_monitor(lv_mem_monitor_t * mon_p); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_MEM_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/stdlib/lv_sprintf.h b/src/stdlib/lv_sprintf.h index 19bfd2f4ea..295910dd5d 100644 --- a/src/stdlib/lv_sprintf.h +++ b/src/stdlib/lv_sprintf.h @@ -1,60 +1,2 @@ -/** - * @file lv_sprintf.h - * - */ - -#ifndef LV_SPRINTF_H -#define LV_SPRINTF_H - -#if defined(__has_include) - #if __has_include(LV_INTTYPES_INCLUDE) - #include LV_INTTYPES_INCLUDE - /* platform-specific printf format for int32_t, usually "d" or "ld" */ - #define LV_PRId32 PRId32 - #define LV_PRIu32 PRIu32 - #define LV_PRIx32 PRIx32 - #define LV_PRIX32 PRIX32 - - #define LV_PRId64 PRId64 - #define LV_PRIu64 PRIu64 - #define LV_PRIx64 PRIx64 - #define LV_PRIX64 PRIX64 - #else - #define LV_PRId32 "d" - #define LV_PRIu32 "u" - #define LV_PRIx32 "x" - #define LV_PRIX32 "X" - - #define LV_PRId64 "lld" - #define LV_PRIu64 "llu" - #define LV_PRIx64 "llx" - #define LV_PRIX64 "llX" - #endif -#else - /* hope this is correct for ports without __has_include or without inttypes.h */ - #define LV_PRId32 "d" - #define LV_PRIu32 "u" - #define LV_PRIx32 "x" - #define LV_PRIX32 "X" - - #define LV_PRId64 "lld" - #define LV_PRIu64 "llu" - #define LV_PRIx64 "llx" - #define LV_PRIX64 "llX" -#endif - -#include "../misc/lv_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int lv_snprintf(char * buffer, size_t count, const char * format, ...); - -int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va); - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_SPRINTF_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/stdlib/lv_string.h b/src/stdlib/lv_string.h index 12466c6cbc..b97b31b3d4 100644 --- a/src/stdlib/lv_string.h +++ b/src/stdlib/lv_string.h @@ -1,204 +1,2 @@ -/** - * @file lv_string.h - * - */ - -#ifndef LV_STRING_H -#define LV_STRING_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" -#include "../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * @brief Copies a block of memory from a source address to a destination address. - * @param dst Pointer to the destination array where the content is to be copied. - * @param src Pointer to the source of data to be copied. - * @param len Number of bytes to copy. - * @return Pointer to the destination array. - * @note The function does not check for any overlapping of the source and destination memory blocks. - */ -void * lv_memcpy(void * dst, const void * src, size_t len); - -/** - * @brief Fills a block of memory with a specified value. - * @param dst Pointer to the destination array to fill with the specified value. - * @param v Value to be set. The value is passed as an int, but the function fills - * the block of memory using the unsigned char conversion of this value. - * @param len Number of bytes to be set to the value. - */ -void lv_memset(void * dst, uint8_t v, size_t len); - -/** - * @brief Move a block of memory from source to destination - * @param dst Pointer to the destination array where the content is to be copied. - * @param src Pointer to the source of data to be copied. - * @param len Number of bytes to copy - * @return Pointer to the destination array. - */ -void * lv_memmove(void * dst, const void * src, size_t len); - -/** - * @brief This function will compare two memory blocks - * @param p1 Pointer to the first memory block - * @param p2 Pointer to the second memory block - * @param len Number of bytes to compare - * @return The difference between the value of the first unmatching byte. - */ -int lv_memcmp(const void * p1, const void * p2, size_t len); - -/** - * Same as `memset(dst, 0x00, len)`. - * @param dst pointer to the destination buffer - * @param len number of byte to set - */ -static inline void lv_memzero(void * dst, size_t len) -{ - lv_memset(dst, 0x00, len); -} - -/** - * @brief Computes the length of the string str up to (but not including) the terminating null character. - * @param str Pointer to the null-terminated byte string to be examined. - * @return The length of the string in bytes. - */ -size_t lv_strlen(const char * str); - -/** - * @brief Computes the length of the string str up to (but not including) the terminating null character, - * or the given maximum length. - * @param str Pointer to byte string that is null-terminated or at least max_len bytes long. - * @param max_len Maximum number of characters to examine. - * @return The length of the string in bytes. - */ -size_t lv_strnlen(const char * str, size_t max_len); - -/** - * @brief Copies up to dst_size-1 (non-null) characters from src to dst. A null terminator is always added. - * @param dst Pointer to the destination array where the content is to be copied. - * @param src Pointer to the source of data to be copied. - * @param dst_size Maximum number of characters to be copied to dst, including the null character. - * @return The length of src. The return value is equivalent to the value returned by lv_strlen(src) - */ -size_t lv_strlcpy(char * dst, const char * src, size_t dst_size); - -/** - * @brief Copies up to dest_size characters from the string pointed to by src to the character array pointed to by dst - * and fills the remaining length with null bytes. - * @param dst Pointer to the destination array where the content is to be copied. - * @param src Pointer to the source of data to be copied. - * @param dest_size Maximum number of characters to be copied to dst. - * @return A pointer to the destination array, which is dst. - * @note dst will not be null terminated if dest_size bytes were copied from src before the end of src was reached. - */ -char * lv_strncpy(char * dst, const char * src, size_t dest_size); - -/** - * @brief Copies the string pointed to by src, including the terminating null character, - * to the character array pointed to by dst. - * @param dst Pointer to the destination array where the content is to be copied. - * @param src Pointer to the source of data to be copied. - * @return A pointer to the destination array, which is dst. - */ -char * lv_strcpy(char * dst, const char * src); - -/** - * @brief This function will compare two strings without specified length. - * @param s1 pointer to the first string - * @param s2 pointer to the second string - * @return the difference between the value of the first unmatching character. - */ -int lv_strcmp(const char * s1, const char * s2); - -/** - * @brief This function will compare two strings up to the given length. - * @param s1 pointer to the first string - * @param s2 pointer to the second string - * @param len the maximum amount of characters to compare - * @return the difference between the value of the first unmatching character. - */ -int lv_strncmp(const char * s1, const char * s2, size_t len); - -/** Returns true if the two strings are equal. - * Just a wrapper around strcmp for convenience. - * @param s1 pointer to the first string - * @param s2 pointer to the second string - * @return true: the strings are equal; false: otherwise - */ -static inline bool lv_streq(const char * s1, const char * s2) -{ - return lv_strcmp(s1, s2) == 0; -} - -/** - * @brief Duplicate a string by allocating a new one and copying the content. - * @param src Pointer to the source of data to be copied. - * @return A pointer to the new allocated string. NULL if failed. - */ -char * lv_strdup(const char * src); - -/** - * @brief Duplicate a string by allocating a new one and copying the content - * up to the end or the specified maximum length, whichever comes first. - * @param src Pointer to the source of data to be copied. - * @param max_len Maximum number of characters to be copied. - * @return Pointer to a newly allocated null-terminated string. NULL if failed. - */ -char * lv_strndup(const char * src, size_t max_len); - -/** - * @brief Copies the string pointed to by src, including the terminating null character, - * to the end of the string pointed to by dst. - * @param dst Pointer to the destination string where the content is to be appended. - * @param src Pointer to the source of data to be copied. - * @return A pointer to the destination string, which is dst. - */ -char * lv_strcat(char * dst, const char * src); - -/** - * @brief Copies up to src_len characters from the string pointed to by src - * to the end of the string pointed to by dst. - * A terminating null character is appended to dst even if no null character - * was encountered in src after src_len characters were copied. - * @param dst Pointer to the destination string where the content is to be appended. - * @param src Pointer to the source of data to be copied. - * @param src_len Maximum number of characters from src to be copied to the end of dst. - * @return A pointer to the destination string, which is dst. - */ -char * lv_strncat(char * dst, const char * src, size_t src_len); - -/** - * @brief Searches for the first occurrence of character c in the string str. - * @param str Pointer to the null-terminated byte string to be searched. - * @param c The character to be searched for. - * @return A pointer to the first occurrence of character c in the string str, or a null pointer if c is not found. - */ -char * lv_strchr(const char * str, int c); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_STRING_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/stdlib/micropython/lv_mem_core_micropython.c b/src/stdlib/micropython/lv_mem_core_micropython.c index b306a729d2..3ae7d7c795 100644 --- a/src/stdlib/micropython/lv_mem_core_micropython.c +++ b/src/stdlib/micropython/lv_mem_core_micropython.c @@ -5,10 +5,12 @@ /********************* * INCLUDES *********************/ -#include "../lv_mem.h" + +#include "../../lv_public_api.h" + #if LV_USE_STDLIB_MALLOC == LV_STDLIB_MICROPYTHON -#include "../../stdlib/lv_mem.h" -#include "include/lv_mp_mem_custom_include.h" + +#include /********************* * DEFINES diff --git a/src/stdlib/rtthread/lv_mem_core_rtthread.c b/src/stdlib/rtthread/lv_mem_core_rtthread.c index a52526bda7..a500c4b48a 100644 --- a/src/stdlib/rtthread/lv_mem_core_rtthread.c +++ b/src/stdlib/rtthread/lv_mem_core_rtthread.c @@ -5,9 +5,10 @@ /********************* * INCLUDES *********************/ -#include "../lv_mem.h" + +#include "../../lv_public_api.h" + #if LV_USE_STDLIB_MALLOC == LV_STDLIB_RTTHREAD -#include "../../stdlib/lv_mem.h" #include #ifndef RT_USING_HEAP diff --git a/src/stdlib/rtthread/lv_sprintf_rtthread.c b/src/stdlib/rtthread/lv_sprintf_rtthread.c index 721f4fd053..bacddaef38 100644 --- a/src/stdlib/rtthread/lv_sprintf_rtthread.c +++ b/src/stdlib/rtthread/lv_sprintf_rtthread.c @@ -6,11 +6,13 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" + +#include "../../lv_public_api.h" + #if LV_USE_STDLIB_SPRINTF == LV_STDLIB_RTTHREAD + #include #include -#include "../lv_sprintf.h" #if LV_USE_FLOAT == 1 #warning "lv_sprintf_rtthread: rtthread not support float in sprintf" diff --git a/src/stdlib/rtthread/lv_string_rtthread.c b/src/stdlib/rtthread/lv_string_rtthread.c index fd2ff2a952..c48ed346c6 100644 --- a/src/stdlib/rtthread/lv_string_rtthread.c +++ b/src/stdlib/rtthread/lv_string_rtthread.c @@ -5,10 +5,11 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" + +#include "../../lv_public_api.h" + #if LV_USE_STDLIB_STRING == LV_STDLIB_RTTHREAD -#include "../lv_string.h" -#include "../lv_mem.h" /*Need lv_malloc*/ + #include /********************* diff --git a/src/stdlib/uefi/lv_mem_core_uefi.c b/src/stdlib/uefi/lv_mem_core_uefi.c index 619c2edd7d..9b7f683788 100644 --- a/src/stdlib/uefi/lv_mem_core_uefi.c +++ b/src/stdlib/uefi/lv_mem_core_uefi.c @@ -5,10 +5,10 @@ /********************* * INCLUDES *********************/ -#include "../lv_mem.h" +#include "../../lv_public_api.h" #if LV_USE_UEFI #if LV_UEFI_USE_MEMORY_SERVICES && LV_USE_STDLIB_MALLOC == LV_STDLIB_CUSTOM -#include "../drivers/uefi/lv_uefi_private.h" +#include "../../drivers/uefi/lv_uefi_private.h" /********************* * DEFINES diff --git a/src/themes/default/lv_theme_default.c b/src/themes/default/lv_theme_default.c index 80f58a2283..d21820cd78 100644 --- a/src/themes/default/lv_theme_default.c +++ b/src/themes/default/lv_theme_default.c @@ -6,12 +6,11 @@ /********************* * INCLUDES *********************/ -#include "../../../lvgl.h" /*To see all the widgets*/ +#include "../../lv_public_api.h" #if LV_USE_THEME_DEFAULT #include "../lv_theme_private.h" -#include "../../misc/lv_color.h" #include "../../core/lv_global.h" /********************* diff --git a/src/themes/default/lv_theme_default.h b/src/themes/default/lv_theme_default.h index 26fad8de1e..e34ea17b71 100644 --- a/src/themes/default/lv_theme_default.h +++ b/src/themes/default/lv_theme_default.h @@ -1,71 +1,2 @@ -/** - * @file lv_theme_default.h - * - */ - -#ifndef LV_THEME_DEFAULT_H -#define LV_THEME_DEFAULT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_theme.h" - -#if LV_USE_THEME_DEFAULT - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the theme - * @param disp pointer to display - * @param color_primary the primary color of the theme - * @param color_secondary the secondary color for the theme - * @param dark - * @param font pointer to a font to use. - * @return a pointer to reference this theme later - */ -lv_theme_t * lv_theme_default_init(lv_display_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark, - const lv_font_t * font); - -/** - * Check if default theme is initialized - * @return true if default theme is initialized, false otherwise - */ -bool lv_theme_default_is_inited(void); - -/** - * Get default theme - * @return a pointer to default theme, or NULL if this is not initialized - */ -lv_theme_t * lv_theme_default_get(void); - -/** - * Deinitialize the default theme - */ -void lv_theme_default_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_THEME_DEFAULT_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/themes/lv_theme.c b/src/themes/lv_theme.c index f226d5320c..c7dafee569 100644 --- a/src/themes/lv_theme.c +++ b/src/themes/lv_theme.c @@ -10,7 +10,6 @@ #include "../core/lv_obj_private.h" #include "../core/lv_obj_style_private.h" #include "../core/lv_obj_class_private.h" -#include "../../lvgl.h" /********************* * DEFINES diff --git a/src/themes/lv_theme.h b/src/themes/lv_theme.h index dab88a4e4b..4f85616414 100644 --- a/src/themes/lv_theme.h +++ b/src/themes/lv_theme.h @@ -1,144 +1,2 @@ -/** - *@file lv_theme.h - * - */ - -#ifndef LV_THEME_H -#define LV_THEME_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../core/lv_obj.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef void (*lv_theme_apply_cb_t)(lv_theme_t *, lv_obj_t *); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Creates a new theme - * @return the new theme or NULL if allocation failed - */ -lv_theme_t * lv_theme_create(void); - -/** - * Copy 'src' theme into 'dst' - * @param dst pointer to the destination theme - * @param src pointer to the source theme - */ -void lv_theme_copy(lv_theme_t * dst, const lv_theme_t * src); - -/** - * Get the theme assigned to the display of the object - * @param obj pointer to a theme object - * @return the theme of the object's display (can be NULL) - */ -lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj); - -/** - * Apply the active theme on an object - * @param obj pointer to an object - */ -void lv_theme_apply(lv_obj_t * obj); - -/** - * Set a base theme for a theme. - * The styles from the base them will be added before the styles of the current theme. - * Arbitrary long chain of themes can be created by setting base themes. - * @param theme pointer to theme which base should be set - * @param parent pointer to the base theme - */ -void lv_theme_set_parent(lv_theme_t * theme, lv_theme_t * parent); - -/** - * Set an apply callback for a theme. - * The apply callback is used to add styles to different objects - * @param theme pointer to theme which callback should be set - * @param apply_cb pointer to the callback - */ -void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb); - -/** - * Get the small font of the theme - * @param obj pointer to an object - * @return pointer to the font - */ -const lv_font_t * lv_theme_get_font_small(lv_obj_t * obj); -/** - * Get the normal font of the theme - * @param obj pointer to an object - * @return pointer to the font - */ -const lv_font_t * lv_theme_get_font_normal(lv_obj_t * obj); - -/** - * Get the subtitle font of the theme - * @param obj pointer to an object - * @return pointer to the font - */ -const lv_font_t * lv_theme_get_font_large(lv_obj_t * obj); - -/** - * Get the primary color of the theme - * @param obj pointer to an object - * @return the color - */ -lv_color_t lv_theme_get_color_primary(lv_obj_t * obj); - -/** - * Get the secondary color of the theme - * @param obj pointer to an object - * @return the color - */ -lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj); - - -/** - * Delete a theme - * @param theme the theme to destroy - */ -void lv_theme_delete(lv_theme_t * theme); - -#if LV_USE_EXT_DATA -/** - * @brief Attaches external user data and destructor callback to the theme - * - * Associates custom user data with an LVGL theme and specifies a destructor function - * that will be automatically invoked when the theme is deleted to properly clean up - * the associated resources. - * - * @param theme Pointer to theme which callback should be set - * @param data User-defined data pointer to associate with the theme - * @param free_cb Callback function for cleaning up ext_data when theme is deleted. - * Receives ext_data as parameter. NULL means no cleanup required. - */ -void lv_theme_set_external_data(lv_theme_t * theme, void * data, void (* free_cb)(void * data)); -#endif - -/********************** - * MACROS - **********************/ - -#include "default/lv_theme_default.h" -#include "mono/lv_theme_mono.h" -#include "simple/lv_theme_simple.h" - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_THEME_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/themes/lv_theme_private.h b/src/themes/lv_theme_private.h index 4a8ebcbdd4..d46dc830b2 100644 --- a/src/themes/lv_theme_private.h +++ b/src/themes/lv_theme_private.h @@ -14,8 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../misc/lv_ext_data.h" -#include "lv_theme.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/themes/mono/lv_theme_mono.c b/src/themes/mono/lv_theme_mono.c index 0c539bf058..f83ca66a13 100644 --- a/src/themes/mono/lv_theme_mono.c +++ b/src/themes/mono/lv_theme_mono.c @@ -6,12 +6,12 @@ /********************* * INCLUDES *********************/ -#include "../lv_theme_private.h" -#include "../../../lvgl.h" /*To see all the widgets*/ + +#include "../../lv_public_api.h" #if LV_USE_THEME_MONO -#include "lv_theme_mono.h" +#include "../lv_theme_private.h" #include "../../core/lv_global.h" /********************* diff --git a/src/themes/mono/lv_theme_mono.h b/src/themes/mono/lv_theme_mono.h index 794411b499..be8372c0f1 100644 --- a/src/themes/mono/lv_theme_mono.h +++ b/src/themes/mono/lv_theme_mono.h @@ -1,68 +1,2 @@ -/** - * @file lv_theme_mono.h - * - */ - -#ifndef LV_THEME_MONO_H -#define LV_THEME_MONO_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_theme.h" - -#if LV_USE_THEME_MONO - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the theme - * @param disp pointer to display - * @param dark_bg - * @param font pointer to a font to use. - * @return a pointer to reference this theme later - */ -lv_theme_t * lv_theme_mono_init(lv_display_t * disp, bool dark_bg, const lv_font_t * font); - -/** -* Check if the theme is initialized -* @return true if default theme is initialized, false otherwise -*/ -bool lv_theme_mono_is_inited(void); - -/** - * Get mono theme - * @return a pointer to mono theme, or NULL if this is not initialized - */ -lv_theme_t * lv_theme_mono_get(void); - -/** - * Deinitialize the mono theme - */ -void lv_theme_mono_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /* LV_THEME_MONO_H */ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/themes/simple/lv_theme_simple.c b/src/themes/simple/lv_theme_simple.c index 33266c0304..434478849a 100644 --- a/src/themes/simple/lv_theme_simple.c +++ b/src/themes/simple/lv_theme_simple.c @@ -6,12 +6,12 @@ /********************* * INCLUDES *********************/ -#include "../lv_theme_private.h" -#include "../../../lvgl.h" /*To see all the widgets*/ + +#include "../../lv_public_api.h" #if LV_USE_THEME_SIMPLE -#include "lv_theme_simple.h" +#include "../lv_theme_private.h" #include "../../core/lv_global.h" /********************* diff --git a/src/themes/simple/lv_theme_simple.h b/src/themes/simple/lv_theme_simple.h index 4b02a0e60c..5aeb51bc25 100644 --- a/src/themes/simple/lv_theme_simple.h +++ b/src/themes/simple/lv_theme_simple.h @@ -1,67 +1,2 @@ -/** - * @file lv_theme_simple.h - * - */ - -#ifndef LV_THEME_SIMPLE_H -#define LV_THEME_SIMPLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_theme.h" -#include "../../display/lv_display.h" - -#if LV_USE_THEME_SIMPLE - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Initialize the theme - * @param disp pointer to display - * @return a pointer to reference this theme later - */ -lv_theme_t * lv_theme_simple_init(lv_display_t * disp); - -/** -* Check if the theme is initialized -* @return true if default theme is initialized, false otherwise -*/ -bool lv_theme_simple_is_inited(void); - -/** - * Get simple theme - * @return a pointer to simple theme, or NULL if this is not initialized - */ -lv_theme_t * lv_theme_simple_get(void); - -/** - * Deinitialize the simple theme - */ -void lv_theme_simple_deinit(void); - -/********************** - * MACROS - **********************/ - -#endif - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_THEME_SIMPLE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/tick/lv_tick.c b/src/tick/lv_tick.c index 4fb6d9c2ab..1682cd80d1 100644 --- a/src/tick/lv_tick.c +++ b/src/tick/lv_tick.c @@ -7,7 +7,6 @@ * INCLUDES *********************/ #include "lv_tick_private.h" -#include "../misc/lv_types.h" #include "../core/lv_global.h" /********************* diff --git a/src/tick/lv_tick.h b/src/tick/lv_tick.h index 838fe8b1a9..3aef5a954c 100644 --- a/src/tick/lv_tick.h +++ b/src/tick/lv_tick.h @@ -1,100 +1,2 @@ -/** - * @file lv_tick.h - * Provide access to the system tick with 1 millisecond resolution - */ - -#ifndef LV_TICK_H -#define LV_TICK_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -#include "../misc/lv_types.h" - -/********************* - * DEFINES - *********************/ -#ifndef LV_ATTRIBUTE_TICK_INC -#define LV_ATTRIBUTE_TICK_INC -#endif - -/********************** - * TYPEDEFS - **********************/ -typedef uint32_t (*lv_tick_get_cb_t)(void); - -typedef void (*lv_delay_cb_t)(uint32_t ms); - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * You have to call this function periodically. - * It is typically safe to call from an interrupt handler or a different thread. - * @param tick_period the call period of this function in milliseconds - */ -LV_ATTRIBUTE_TICK_INC void lv_tick_inc(uint32_t tick_period); - -/** - * Get the elapsed milliseconds since start up - * @return the elapsed milliseconds - */ -uint32_t lv_tick_get(void); - -/** - * Get the elapsed milliseconds since a previous time stamp - * @param prev_tick a previous time stamp (return value of lv_tick_get() ) - * @return the elapsed milliseconds since 'prev_tick' - */ -uint32_t lv_tick_elaps(uint32_t prev_tick); - -/** - * Get the elapsed milliseconds between two time stamps - * @param tick a time stamp - * @param prev_tick a time stamp before `tick` - * @return the elapsed milliseconds between `prev_tick` and `tick` - */ -uint32_t lv_tick_diff(uint32_t tick, uint32_t prev_tick); - -/** - * Delay for the given milliseconds. - * By default it's a blocking delay, but with `lv_delay_set_cb()` - * a custom delay function can be set too - * @param ms the number of milliseconds to delay - */ -void lv_delay_ms(uint32_t ms); - -/** - * Set a callback for a blocking delay - * @param cb pointer to a callback - */ -void lv_delay_set_cb(lv_delay_cb_t cb); - -/** - * Set the custom callback for 'lv_tick_get' - * @param cb call this callback on 'lv_tick_get' - */ -void lv_tick_set_cb(lv_tick_get_cb_t cb); - -/** - * Get the custom callback for 'lv_tick_get' - * @return call this callback on 'lv_tick_get' - */ -lv_tick_get_cb_t lv_tick_get_cb(void); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TICK_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../include/lvgl/lvgl.h" diff --git a/src/tick/lv_tick_private.h b/src/tick/lv_tick_private.h index 2450f32219..40b95bbbbc 100644 --- a/src/tick/lv_tick_private.h +++ b/src/tick/lv_tick_private.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "lv_tick.h" +#include "../lv_public_api.h" /********************* * DEFINES diff --git a/src/widgets/3dtexture/lv_3dtexture.c b/src/widgets/3dtexture/lv_3dtexture.c index 9c76dcacb3..27c4573cd9 100644 --- a/src/widgets/3dtexture/lv_3dtexture.c +++ b/src/widgets/3dtexture/lv_3dtexture.c @@ -11,7 +11,6 @@ #if LV_USE_3DTEXTURE #include "../../core/lv_obj_class_private.h" -#include "../../draw/lv_draw_3d.h" /********************* * DEFINES diff --git a/src/widgets/3dtexture/lv_3dtexture.h b/src/widgets/3dtexture/lv_3dtexture.h index f5b522d1ba..e5bc12f0b0 100644 --- a/src/widgets/3dtexture/lv_3dtexture.h +++ b/src/widgets/3dtexture/lv_3dtexture.h @@ -1,86 +1,2 @@ -/** - * @file lv_3dtexture.h - * - */ - -#ifndef LV_3DTEXTURE_H -#define LV_3DTEXTURE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" -#if LV_USE_3DTEXTURE - -#include "../../core/lv_obj.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_3dtexture_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a 3dtexture object - * @param parent pointer to an object, it will be the parent of the new 3dtexture - * @return pointer to the created 3dtexture - */ -lv_obj_t * lv_3dtexture_create(lv_obj_t * parent); - -/** - * Set the source texture of the widget. - * The object size should be manually set to match. - * @param obj the 3dtexture widget - * @param id the texture handle from the 3D graphics backend. - * I.e., an `unsigned int` texture for OpenGL. - */ -void lv_3dtexture_set_src(lv_obj_t * obj, lv_3dtexture_id_t id); - -/** - * Set the flipping behavior of the widget. - * @param obj the 3dtexture widget - * @param h_flip true to flip horizontally. - * @param v_flip true to flip vertically. - */ -void lv_3dtexture_set_flip(lv_obj_t * obj, bool h_flip, bool v_flip); - -/*====================== - * Add/remove functions - *=====================*/ - -/*===================== - * Setter functions - *====================*/ - -/*===================== - * Getter functions - *====================*/ - -/*===================== - * Other functions - *====================*/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_3DTEXTURE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_3DTEXTURE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/3dtexture/lv_3dtexture_private.h b/src/widgets/3dtexture/lv_3dtexture_private.h index 744fef695b..4ac1198d1c 100644 --- a/src/widgets/3dtexture/lv_3dtexture_private.h +++ b/src/widgets/3dtexture/lv_3dtexture_private.h @@ -14,7 +14,8 @@ extern "C" { * INCLUDES *********************/ -#include "lv_3dtexture.h" +#include "../../lv_public_api.h" + #if LV_USE_3DTEXTURE #include "../../core/lv_obj_private.h" diff --git a/src/widgets/animimage/lv_animimage.c b/src/widgets/animimage/lv_animimage.c index 2149b0a675..adc111f7f2 100644 --- a/src/widgets/animimage/lv_animimage.c +++ b/src/widgets/animimage/lv_animimage.c @@ -11,21 +11,16 @@ * INCLUDES *********************/ #include "lv_animimage_private.h" -#include "../../core/lv_obj_class_private.h" -#if LV_USE_ANIMIMG != 0 +#if LV_USE_ANIMIMG + +#include "../../core/lv_obj_class_private.h" /*Testing of dependencies*/ #if LV_USE_IMAGE == 0 #error "lv_animimg: lv_img is required. Enable it in lv_conf.h (LV_USE_IMAGE 1) " #endif -#include "../../draw/lv_image_decoder.h" -#include "../../misc/lv_assert.h" -#include "../../misc/lv_fs.h" #include "../../misc/lv_text_private.h" -#include "../../misc/lv_math.h" -#include "../../misc/lv_log.h" -#include "../../misc/lv_anim.h" /********************* * DEFINES diff --git a/src/widgets/animimage/lv_animimage.h b/src/widgets/animimage/lv_animimage.h index d193ad5cc2..0f9346497f 100644 --- a/src/widgets/animimage/lv_animimage.h +++ b/src/widgets/animimage/lv_animimage.h @@ -1,185 +1,2 @@ -/** - * @file lv_animimage.h - * - */ - -/** - * Modified by NXP in 2025 - */ - -#ifndef LV_ANIMIMAGE_H -#define LV_ANIMIMAGE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../image/lv_image.h" -#include "../../misc/lv_types.h" - -#if LV_USE_ANIMIMG != 0 - -/*Testing of dependencies*/ -#if LV_USE_IMAGE == 0 -#error "lv_animimg: lv_img is required. Enable it in lv_conf.h (LV_USE_IMAGE 1)" -#endif - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_animimage_id_t { - LV_PROPERTY_ID2(ANIMIMAGE, SRC, LV_PROPERTY_TYPE_POINTER, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(ANIMIMAGE, DURATION, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(ANIMIMAGE, REPEAT_COUNT, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(ANIMIMAGE, SRC_COUNT, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_ANIMIMAGE_END, -}; -#endif - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_animimg_class; - -/** Image parts */ -typedef enum { - LV_ANIM_IMAGE_PART_MAIN, -} lv_animimg_part_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an animation image objects - * @param parent pointer to an object, it will be the parent of the new button - * @return pointer to the created animation image object - */ -lv_obj_t * lv_animimg_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the image animation images source. - * @param obj pointer to an animation image object - * @param dsc pointer to a series images - * @param num images' number - */ -void lv_animimg_set_src(lv_obj_t * obj, const void * dsc[], size_t num); - -/** - * Set the images source for flip playback of animation image. - * @param obj pointer to an animation image object - * @param dsc pointer to a series images - * @param num images' number - */ -void lv_animimg_set_src_reverse(lv_obj_t * obj, const void * dsc[], size_t num); - -/** - * Startup the image animation. - * @param obj pointer to an animation image object - */ -void lv_animimg_start(lv_obj_t * obj); - -/** - * Delete the image animation. - * @param obj pointer to an animation image object - */ -bool lv_animimg_delete(lv_obj_t * obj); - -/** - * Set the image animation duration time. unit:ms - * @param obj pointer to an animation image object - * @param duration the duration in milliseconds - */ -void lv_animimg_set_duration(lv_obj_t * obj, uint32_t duration); - -/** - * Set the image animation repeatedly play times. - * @param obj pointer to an animation image object - * @param count the number of times to repeat the animation - */ -void lv_animimg_set_repeat_count(lv_obj_t * obj, uint32_t count); - -/** - * Make the image animation to play back to when the forward direction is ready. - * @param obj pointer to an animation image object - * @param duration the duration of the playback image animation in milliseconds. 0: disable playback - */ -void lv_animimg_set_reverse_duration(lv_obj_t * obj, uint32_t duration); - -/** - * Make the image animation to play back to when the forward direction is ready. - * @param obj pointer to an animation image object - * @param duration delay in milliseconds before starting the playback image animation. - */ -void lv_animimg_set_reverse_delay(lv_obj_t * obj, uint32_t duration); - -/** - * Set a function call when the animation image really starts (considering `delay`) - * @param obj pointer to an animation image object - * @param start_cb a function call when the animation is start - */ -void lv_animimg_set_start_cb(lv_obj_t * obj, lv_anim_start_cb_t start_cb); - -/** - * Set a function call when the animation is completed - * @param obj pointer to an animation image object - * @param completed_cb a function call when the animation is completed - */ -void lv_animimg_set_completed_cb(lv_obj_t * obj, lv_anim_completed_cb_t completed_cb); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the image animation images source. - * @param obj pointer to an animation image object - * @return a pointer that will point to a series images - */ -const void ** lv_animimg_get_src(lv_obj_t * obj); - -/** - * Get the image animation images source. - * @param obj pointer to an animation image object - * @return the number of source images - */ -uint8_t lv_animimg_get_src_count(lv_obj_t * obj); - -/** - * Get the image animation duration time. unit:ms - * @param obj pointer to an animation image object - * @return the animation duration time - */ -uint32_t lv_animimg_get_duration(lv_obj_t * obj); - -/** - * Get the image animation repeat play times. - * @param obj pointer to an animation image object - * @return the repeat count - */ -uint32_t lv_animimg_get_repeat_count(lv_obj_t * obj); - -/** - * Get the image animation underlying animation. - * @param obj pointer to an animation image object - * @return the animation reference - */ -lv_anim_t * lv_animimg_get_anim(lv_obj_t * obj); - -#endif /*LV_USE_ANIMIMG*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_ANIMIMAGE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/animimage/lv_animimage_private.h b/src/widgets/animimage/lv_animimage_private.h index a5ef5ebbad..13df8a2f4f 100644 --- a/src/widgets/animimage/lv_animimage_private.h +++ b/src/widgets/animimage/lv_animimage_private.h @@ -16,9 +16,9 @@ extern "C" { #include "../image/lv_image_private.h" #include "../../misc/lv_anim_private.h" -#include "lv_animimage.h" +#include "../../lv_public_api.h" -#if LV_USE_ANIMIMG != 0 +#if LV_USE_ANIMIMG /********************* * DEFINES diff --git a/src/widgets/arc/lv_arc.c b/src/widgets/arc/lv_arc.c index 9714a0b909..252aa18449 100644 --- a/src/widgets/arc/lv_arc.c +++ b/src/widgets/arc/lv_arc.c @@ -6,18 +6,15 @@ /********************* * INCLUDES *********************/ + #include "lv_arc_private.h" + +#if LV_USE_ARC + #include "../../misc/lv_area_private.h" #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_event_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_ARC != 0 - -#include "../../core/lv_group.h" -#include "../../indev/lv_indev.h" -#include "../../misc/lv_assert.h" -#include "../../misc/lv_math.h" -#include "../../draw/lv_draw_arc.h" #include "../../core/lv_observer_private.h" /********************* diff --git a/src/widgets/arc/lv_arc.h b/src/widgets/arc/lv_arc.h index 4daf97a7af..5a9b43ffcd 100644 --- a/src/widgets/arc/lv_arc.h +++ b/src/widgets/arc/lv_arc.h @@ -1,301 +1,2 @@ -/** - * @file lv_arc.h - * - */ - -#ifndef LV_ARC_H -#define LV_ARC_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_ARC != 0 - -#include "../../core/lv_obj.h" -#include "../../core/lv_observer.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * In which direction the indicator should grow. - */ -typedef enum { - LV_ARC_MODE_NORMAL, /**< Clock-wise */ - LV_ARC_MODE_SYMMETRICAL, /**< Left/right from the midpoint */ - LV_ARC_MODE_REVERSE /**< Counterclock-wise */ -} lv_arc_mode_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_arc_id_t { - LV_PROPERTY_ID(ARC, START_ANGLE, LV_PROPERTY_TYPE_PRECISE, 0), - LV_PROPERTY_ID(ARC, END_ANGLE, LV_PROPERTY_TYPE_PRECISE, 1), - LV_PROPERTY_ID(ARC, BG_START_ANGLE, LV_PROPERTY_TYPE_PRECISE, 2), - LV_PROPERTY_ID(ARC, BG_END_ANGLE, LV_PROPERTY_TYPE_PRECISE, 3), - LV_PROPERTY_ID(ARC, ROTATION, LV_PROPERTY_TYPE_INT, 4), - LV_PROPERTY_ID(ARC, MODE, LV_PROPERTY_TYPE_INT, 5), - LV_PROPERTY_ID(ARC, VALUE, LV_PROPERTY_TYPE_INT, 6), - LV_PROPERTY_ID(ARC, MIN_VALUE, LV_PROPERTY_TYPE_INT, 7), - LV_PROPERTY_ID(ARC, MAX_VALUE, LV_PROPERTY_TYPE_INT, 8), - LV_PROPERTY_ID(ARC, CHANGE_RATE, LV_PROPERTY_TYPE_INT, 9), - LV_PROPERTY_ID(ARC, KNOB_OFFSET, LV_PROPERTY_TYPE_INT, 10), - LV_PROPERTY_ARC_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an arc object - * @param parent pointer to an object, it will be the parent of the new arc - * @return pointer to the created arc - */ -lv_obj_t * lv_arc_create(lv_obj_t * parent); - -/*====================== - * Add/remove functions - *=====================*/ - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the start angle of an arc. 0 deg: right, 90 bottom, etc. - * @param obj pointer to an arc object - * @param start the start angle. (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -void lv_arc_set_start_angle(lv_obj_t * obj, lv_value_precise_t start); - -/** - * Set the end angle of an arc. 0 deg: right, 90 bottom, etc. - * @param obj pointer to an arc object - * @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -void lv_arc_set_end_angle(lv_obj_t * obj, lv_value_precise_t end); - -/** - * Set the start and end angles - * @param obj pointer to an arc object - * @param start the start angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) - * @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -void lv_arc_set_angles(lv_obj_t * obj, lv_value_precise_t start, lv_value_precise_t end); - -/** - * Set the start angle of an arc background. 0 deg: right, 90 bottom, etc. - * @param obj pointer to an arc object - * @param start the start angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -void lv_arc_set_bg_start_angle(lv_obj_t * obj, lv_value_precise_t start); - -/** - * Set the start angle of an arc background. 0 deg: right, 90 bottom etc. - * @param obj pointer to an arc object - * @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -void lv_arc_set_bg_end_angle(lv_obj_t * obj, lv_value_precise_t end); - -/** - * Set the start and end angles of the arc background - * @param obj pointer to an arc object - * @param start the start angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) - * @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -void lv_arc_set_bg_angles(lv_obj_t * obj, lv_value_precise_t start, lv_value_precise_t end); - -/** - * Set the rotation for the whole arc - * @param obj pointer to an arc object - * @param rotation rotation angle - */ -void lv_arc_set_rotation(lv_obj_t * obj, int32_t rotation); - -/** - * Set in which direction the indicator should grow. - * @param obj pointer to arc object - * @param type arc's mode - */ -void lv_arc_set_mode(lv_obj_t * obj, lv_arc_mode_t type); - -/** - * Set a new value on the arc - * @param obj pointer to an arc object - * @param value new value - */ -void lv_arc_set_value(lv_obj_t * obj, int32_t value); - -/** - * Set minimum and the maximum values of an arc - * @param obj pointer to the arc object - * @param min minimum value - * @param max maximum value - */ -void lv_arc_set_range(lv_obj_t * obj, int32_t min, int32_t max); - -/** - * Set the minimum values of an arc - * @param obj pointer to the arc object - * @param min minimum value - */ -void lv_arc_set_min_value(lv_obj_t * obj, int32_t min); - -/** - * Set the maximum values of an arc - * @param obj pointer to the arc object - * @param max maximum value - */ -void lv_arc_set_max_value(lv_obj_t * obj, int32_t max); - -/** - * Set a change rate to limit the speed how fast the arc should reach the pressed point. - * @param obj pointer to an arc object - * @param rate the change rate - */ -void lv_arc_set_change_rate(lv_obj_t * obj, uint32_t rate); - -/** - * Set an offset angle for the knob - * @param obj pointer to an arc object - * @param offset knob offset from main arc in degrees - */ -void lv_arc_set_knob_offset(lv_obj_t * obj, int32_t offset); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the start angle of an arc. - * @param obj pointer to an arc object - * @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -lv_value_precise_t lv_arc_get_angle_start(lv_obj_t * obj); - -/** - * Get the end angle of an arc. - * @param obj pointer to an arc object - * @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -lv_value_precise_t lv_arc_get_angle_end(lv_obj_t * obj); - -/** - * Get the start angle of an arc background. - * @param obj pointer to an arc object - * @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -lv_value_precise_t lv_arc_get_bg_angle_start(lv_obj_t * obj); - -/** - * Get the end angle of an arc background. - * @param obj pointer to an arc object - * @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -lv_value_precise_t lv_arc_get_bg_angle_end(lv_obj_t * obj); - -/** - * Get the value of an arc - * @param obj pointer to an arc object - * @return the value of the arc - */ -int32_t lv_arc_get_value(const lv_obj_t * obj); - -/** - * Get the minimum value of an arc - * @param obj pointer to an arc object - * @return the minimum value of the arc - */ -int32_t lv_arc_get_min_value(const lv_obj_t * obj); - -/** - * Get the maximum value of an arc - * @param obj pointer to an arc object - * @return the maximum value of the arc - */ -int32_t lv_arc_get_max_value(const lv_obj_t * obj); - -/** - * Get whether the arc is type or not. - * @param obj pointer to an arc object - * @return arc's mode - */ -lv_arc_mode_t lv_arc_get_mode(const lv_obj_t * obj); - -/** - * Get the rotation for the whole arc - * @param obj pointer to an arc object - * @return arc's current rotation - */ -int32_t lv_arc_get_rotation(const lv_obj_t * obj); - -/** - * Get the current knob angle offset - * @param obj pointer to an arc object - * @return arc's current knob offset - */ -int32_t lv_arc_get_knob_offset(const lv_obj_t * obj); - -/** - * Get the change rate of an arc - * @param obj pointer to an arc object - * @return the change rate - */ -uint32_t lv_arc_get_change_rate(lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -#if LV_USE_OBSERVER -/** - * Bind an integer subject to an Arc's value. - * @param obj pointer to Arc - * @param subject pointer to Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_arc_bind_value(lv_obj_t * obj, lv_subject_t * subject); -#endif - - -/** - * Align an object to the current position of the arc (knob) - * @param obj pointer to an arc object - * @param obj_to_align pointer to an object to align - * @param r_offset consider the radius larger with this value (< 0: for smaller radius) - */ -void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, int32_t r_offset); - -/** - * Rotate an object to the current position of the arc (knob) - * @param obj pointer to an arc object - * @param obj_to_rotate pointer to an object to rotate - * @param r_offset consider the radius larger with this value (< 0: for smaller radius) - */ -void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, int32_t r_offset); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_ARC*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ARC_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/arc/lv_arc_private.h b/src/widgets/arc/lv_arc_private.h index 71f576a46a..5bb957cf6a 100644 --- a/src/widgets/arc/lv_arc_private.h +++ b/src/widgets/arc/lv_arc_private.h @@ -14,9 +14,9 @@ extern "C" { * INCLUDES *********************/ #include "../../core/lv_obj_private.h" -#include "lv_arc.h" +#include "../../lv_public_api.h" -#if LV_USE_ARC != 0 +#if LV_USE_ARC /********************* * DEFINES diff --git a/src/widgets/arclabel/lv_arclabel.c b/src/widgets/arclabel/lv_arclabel.c index 55ff2f50d9..6ab0d32d04 100644 --- a/src/widgets/arclabel/lv_arclabel.c +++ b/src/widgets/arclabel/lv_arclabel.c @@ -9,13 +9,12 @@ #include "lv_arclabel_private.h" -#if LV_USE_ARCLABEL != 0 +#if LV_USE_ARCLABEL #include "../../core/lv_obj_class_private.h" #include "../../core/lv_obj_event_private.h" #include "../../core/lv_obj_private.h" #include "../../misc/lv_area_private.h" -#include "../../misc/lv_assert.h" #include "../../misc/lv_text_private.h" #if LV_USE_FLOAT diff --git a/src/widgets/arclabel/lv_arclabel.h b/src/widgets/arclabel/lv_arclabel.h index dc7d5ec397..94b88beb58 100644 --- a/src/widgets/arclabel/lv_arclabel.h +++ b/src/widgets/arclabel/lv_arclabel.h @@ -1,301 +1,2 @@ -/** - * @file lv_arclabel.h - * - */ - -#ifndef LV_ARCLABEL_H -#define LV_ARCLABEL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_ARCLABEL != 0 - -/********************* - * DEFINES - *********************/ - -#define LV_ARCLABEL_DOT_NUM 3 -#if LV_WIDGETS_HAS_DEFAULT_VALUE -#define LV_ARCLABEL_DEFAULT_TEXT "Arced Text" -#else -#define LV_ARCLABEL_DEFAULT_TEXT "" -#endif - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_ARCLABEL_DIR_CLOCKWISE = 0, - LV_ARCLABEL_DIR_COUNTER_CLOCKWISE = 1 -} lv_arclabel_dir_t; - -typedef enum { - LV_ARCLABEL_TEXT_ALIGN_DEFAULT = 0, - LV_ARCLABEL_TEXT_ALIGN_LEADING = 1, - LV_ARCLABEL_TEXT_ALIGN_CENTER = 2, - LV_ARCLABEL_TEXT_ALIGN_TRAILING = 3, -} lv_arclabel_text_align_t; - -typedef enum { - LV_ARCLABEL_OVERFLOW_VISIBLE, /**< Show full text, may overflow object area */ - LV_ARCLABEL_OVERFLOW_ELLIPSIS, /**< Show ellipsis (...) when text overflows */ - LV_ARCLABEL_OVERFLOW_CLIP /**< Clip text at arc boundary */ -} lv_arclabel_overflow_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arclabel_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an arc label object - * @param parent pointer to an object, it will be the parent of the new arc label - * @return pointer to the created arc label - */ -lv_obj_t * lv_arclabel_create(lv_obj_t * parent); - -/*====================== - * Add/remove functions - *=====================*/ - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the text of the arc label. - * - * This function sets the text displayed by an arc label object. - * - * @param obj Pointer to the arc label object. - * @param text Pointer to a null-terminated string containing the new text for the label. - */ -void lv_arclabel_set_text(lv_obj_t * obj, const char * text); - -/** - * Set the formatted text of an arc label object. - * - * This function sets the text of an arc label object with support for - * variable arguments formatting, similar to `printf`. - * - * @param obj The arc label object to set the text for. - * @param fmt A format string that specifies how subsequent arguments are converted to text. - * @param ... Arguments following the format string that are used to replace format specifiers in the format string. - */ -void lv_arclabel_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); - -/** - * Sets a new static text for the arc label or refreshes it with the current text. - * The 'text' must remain valid in memory; the arc label does not manage its lifecycle. - * - * @param obj Pointer to the arc label object. - * @param text Pointer to the new text. If NULL, the label is refreshed with its current text. - */ -void lv_arclabel_set_text_static(lv_obj_t * obj, const char * text); - -/** - * Set the start angle of an arc. 0 deg: right, 90 bottom, etc. - * @param obj pointer to an arc label object - * @param start the start angle. (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -void lv_arclabel_set_angle_start(lv_obj_t * obj, lv_value_precise_t start); - -/** - * Set the end angle of an arc. 0 deg: right, 90 bottom, etc. - * @param obj pointer to an arc label object - * @param size the angle size (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -void lv_arclabel_set_angle_size(lv_obj_t * obj, lv_value_precise_t size); - -/** - * Set the rotation for the whole arc - * @param obj pointer to an arc label object - * @param offset rotation angle - */ -void lv_arclabel_set_offset(lv_obj_t * obj, int32_t offset); - -/** - * Set the type of arc. - * @param obj pointer to and arc label object - * @param dir arc label's direction - */ -void lv_arclabel_set_dir(lv_obj_t * obj, lv_arclabel_dir_t dir); - -/** - * Enable the recoloring by in-line commands - * @param obj pointer to an arc label object - * @param en true: enable recoloring, false: disable - * Example: "This is a #ff0000 red# word" - */ -void lv_arclabel_set_recolor(lv_obj_t * obj, bool en); - -/** - * Set the radius for an arc label object. - * - * @param obj pointer to the arc label object. - * @param radius The radius value to set for the label's curvature, in pixels. - */ -void lv_arclabel_set_radius(lv_obj_t * obj, uint32_t radius); - -/** - * Set the center offset x for an arc label object. - * @param obj pointer to an arc label object - * @param x the x offset - */ -void lv_arclabel_set_center_offset_x(lv_obj_t * obj, uint32_t x); - -/** - * Set the center offset y for an arc label object. - * @param obj pointer to an arc label object - * @param y the y offset - */ -void lv_arclabel_set_center_offset_y(lv_obj_t * obj, uint32_t y); - -/** - * Set the text vertical alignment for an arc label object. - * @param obj pointer to an arc label object - * @param align the vertical alignment - */ -void lv_arclabel_set_text_vertical_align(lv_obj_t * obj, lv_arclabel_text_align_t align); - -/** - * Set the text horizontal alignment for an arc label object. - * @param obj pointer to an arc label object - * @param align the horizontal alignment - */ -void lv_arclabel_set_text_horizontal_align(lv_obj_t * obj, lv_arclabel_text_align_t align); - -/** - * Set the overflow behavior for an arc label object. - * @param obj pointer to an arc label object - * @param overflow the overflow mode (visible, ellipsis, clip) - */ -void lv_arclabel_set_overflow(lv_obj_t * obj, lv_arclabel_overflow_t overflow); - -/** - * Set the end overlap behavior for an arc label object. - * This controls how text is handled when it would overlap at the end of a 360-degree arc. - * @param obj pointer to an arc label object - * @param overlap set the arc label's end overlap behavior - */ -void lv_arclabel_set_end_overlap(lv_obj_t * obj, bool overlap); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the start angle of an arc label. - * @param obj pointer to an arc label object - * @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -lv_value_precise_t lv_arclabel_get_angle_start(lv_obj_t * obj); - -/** - * Get the angle size of an arc label. - * @param obj pointer to an arc label object - * @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -lv_value_precise_t lv_arclabel_get_angle_size(lv_obj_t * obj); - -/** - * Get whether the arc label is type or not. - * @param obj pointer to an arc label object - * @return arc label's direction - */ -lv_arclabel_dir_t lv_arclabel_get_dir(const lv_obj_t * obj); - -/** - * Enable the recoloring by in-line commands - * - * @see lv_arclabel_set_recolor - * - * @param obj pointer to a label object - * @return true: enable recoloring, false: disable - */ -bool lv_arclabel_get_recolor(lv_obj_t * obj); - -/** - * Get the text of the arc label. - * @param obj pointer to an arc label object - * @return the radius of the arc label - */ -uint32_t lv_arclabel_get_radius(lv_obj_t * obj); - -/** - * Get the center offset x for an arc label object. - * @param obj pointer to an arc label object - * @return the x offset - */ -uint32_t lv_arclabel_get_center_offset_x(lv_obj_t * obj); - -/** - * Get the center offset y for an arc label object. - * @param obj pointer to an arc label object - * @return the y offset - */ -uint32_t lv_arclabel_get_center_offset_y(lv_obj_t * obj); - -/** - * Get the text vertical alignment for an arc label object. - * @param obj pointer to an arc label object - * @return the vertical alignment - */ -lv_arclabel_text_align_t lv_arclabel_get_text_vertical_align(lv_obj_t * obj); - -/** - * Get the text horizontal alignment for an arc label object. - * @param obj pointer to an arc label object - * @return the horizontal alignment - */ -lv_arclabel_text_align_t lv_arclabel_get_text_horizontal_align(lv_obj_t * obj); - -/** - * Get the overflow behavior for an arc label object. - * @param obj pointer to an arc label object - * @return the overflow mode - */ -lv_arclabel_overflow_t lv_arclabel_get_overflow(lv_obj_t * obj); - -/** - * Get the end overlap behavior for an arc label object. - * @param obj pointer to an arc label object - * @return the end overlap mode - */ -bool lv_arclabel_get_end_overlap(lv_obj_t * obj); - -/** - * Get the text angle for an arc label object. - * @note The text angle is calculated at runtime. You can get the updated value - * after the arclabel's size has been updated. - * Returns the real rendered text angle in degrees except in - * `LV_ARCLABEL_OVERFLOW_VISIBLE` mode. - * @param obj pointer to an arc label object - * @return the text angle (if `LV_USE_FLOAT` is enabled it can be fractional too.) - */ -lv_value_precise_t lv_arclabel_get_text_angle(lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_ARCLABEL*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ARCLABEL_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/arclabel/lv_arclabel_private.h b/src/widgets/arclabel/lv_arclabel_private.h index 060ae3fc9d..b5e384d148 100644 --- a/src/widgets/arclabel/lv_arclabel_private.h +++ b/src/widgets/arclabel/lv_arclabel_private.h @@ -13,10 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../core/lv_obj_private.h" -#if LV_USE_ARCLABEL != 0 -#include "lv_arclabel.h" +#include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" + +#if LV_USE_ARCLABEL /********************* * DEFINES diff --git a/src/widgets/bar/lv_bar.c b/src/widgets/bar/lv_bar.c index 540683d38a..f2ba604545 100644 --- a/src/widgets/bar/lv_bar.c +++ b/src/widgets/bar/lv_bar.c @@ -6,18 +6,16 @@ /********************* * INCLUDES *********************/ + #include "lv_bar_private.h" + +#if LV_USE_BAR + #include "../../misc/lv_area_private.h" -#include "../../draw/lv_draw_mask.h" #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_BAR != 0 - -#include "../../draw/lv_draw.h" -#include "../../core/lv_observer_private.h" -#include "../../misc/lv_assert.h" #include "../../misc/lv_anim_private.h" -#include "../../misc/lv_math.h" +#include "../../core/lv_observer_private.h" /********************* * DEFINES diff --git a/src/widgets/bar/lv_bar.h b/src/widgets/bar/lv_bar.h index 5b68198098..444ea15fa2 100644 --- a/src/widgets/bar/lv_bar.h +++ b/src/widgets/bar/lv_bar.h @@ -1,199 +1,2 @@ -/** - * @file lv_bar.h - * - */ - -#ifndef LV_BAR_H -#define LV_BAR_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_BAR != 0 - -#include "../../core/lv_obj.h" -#include "../../misc/lv_anim.h" -#include "../label/lv_label.h" -#include "../../core/lv_observer.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_BAR_MODE_NORMAL, - LV_BAR_MODE_SYMMETRICAL, - LV_BAR_MODE_RANGE -} lv_bar_mode_t; - -typedef enum { - LV_BAR_ORIENTATION_AUTO, - LV_BAR_ORIENTATION_HORIZONTAL, - LV_BAR_ORIENTATION_VERTICAL -} lv_bar_orientation_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_bar_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_bar_id_t { - LV_PROPERTY_ID(BAR, VALUE, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(BAR, START_VALUE, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(BAR, MIN_VALUE, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(BAR, MAX_VALUE, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_ID(BAR, MODE, LV_PROPERTY_TYPE_INT, 4), - LV_PROPERTY_ID(BAR, ORIENTATION, LV_PROPERTY_TYPE_INT, 5), - LV_PROPERTY_BAR_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a bar object - * @param parent pointer to an object, it will be the parent of the new bar - * @return pointer to the created bar - */ -lv_obj_t * lv_bar_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set a new value on the bar - * @param obj pointer to a bar object - * @param value new value - * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately - */ -void lv_bar_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); - -/** - * Set a new start value on the bar - * @param obj pointer to a bar object - * @param start_value new start value - * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately - */ -void lv_bar_set_start_value(lv_obj_t * obj, int32_t start_value, lv_anim_enable_t anim); - -/** - * Set minimum and the maximum values of a bar - * @param obj pointer to the bar object - * @param min minimum value - * @param max maximum value - * @note If min is greater than max, the drawing direction becomes to the opposite direction. - */ -void lv_bar_set_range(lv_obj_t * obj, int32_t min, int32_t max); - -/** - * Set minimum value of a bar - * @param obj pointer to the bar object - * @param min minimum value - */ -void lv_bar_set_min_value(lv_obj_t * obj, int32_t min); - -/** - * Set maximum value of a bar - * @param obj pointer to the bar object - * @param max maximum value - */ -void lv_bar_set_max_value(lv_obj_t * obj, int32_t max); - -/** - * Set the type of bar. - * @param obj pointer to bar object - * @param mode bar type from `lv_bar_mode_t` - */ -void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode); - -/** - * Set the orientation of bar. - * @param obj pointer to bar object - * @param orientation bar orientation from `lv_bar_orientation_t` - */ -void lv_bar_set_orientation(lv_obj_t * obj, lv_bar_orientation_t orientation); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the value of a bar - * @param obj pointer to a bar object - * @return the value of the bar - */ -int32_t lv_bar_get_value(const lv_obj_t * obj); - -/** - * Get the start value of a bar - * @param obj pointer to a bar object - * @return the start value of the bar - */ -int32_t lv_bar_get_start_value(const lv_obj_t * obj); - -/** - * Get the minimum value of a bar - * @param obj pointer to a bar object - * @return the minimum value of the bar - */ -int32_t lv_bar_get_min_value(const lv_obj_t * obj); - -/** - * Get the maximum value of a bar - * @param obj pointer to a bar object - * @return the maximum value of the bar - */ -int32_t lv_bar_get_max_value(const lv_obj_t * obj); - -/** - * Get the type of bar. - * @param obj pointer to bar object - * @return bar type from `lv_bar_mode_t` - */ -lv_bar_mode_t lv_bar_get_mode(lv_obj_t * obj); - -/** - * Get the orientation of bar. - * @param obj pointer to bar object - * @return bar orientation from `lv_bar_orientation_t` - */ -lv_bar_orientation_t lv_bar_get_orientation(lv_obj_t * obj); - -/** - * Give the bar is in symmetrical mode or not - * @param obj pointer to bar object - * @return true: in symmetrical mode false : not in -*/ -bool lv_bar_is_symmetrical(lv_obj_t * obj); - -#if LV_USE_OBSERVER -/** - * Bind an integer or float Subject to a Bar's value. - * @param obj pointer to Bar - * @param subject pointer to Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_bar_bind_value(lv_obj_t * obj, lv_subject_t * subject); -#endif - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_BAR*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_BAR_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/bar/lv_bar_private.h b/src/widgets/bar/lv_bar_private.h index c403805f7c..aecbde9688 100644 --- a/src/widgets/bar/lv_bar_private.h +++ b/src/widgets/bar/lv_bar_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_bar.h" +#include "../../lv_public_api.h" -#if LV_USE_BAR != 0 +#if LV_USE_BAR /********************* * DEFINES diff --git a/src/widgets/button/lv_button.c b/src/widgets/button/lv_button.c index 1b0c244327..497a34ce82 100644 --- a/src/widgets/button/lv_button.c +++ b/src/widgets/button/lv_button.c @@ -9,7 +9,8 @@ #include "lv_button_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_BUTTON != 0 + +#if LV_USE_BUTTON /********************* * DEFINES diff --git a/src/widgets/button/lv_button.h b/src/widgets/button/lv_button.h index eb7a0a57c0..669b7d154d 100644 --- a/src/widgets/button/lv_button.h +++ b/src/widgets/button/lv_button.h @@ -1,48 +1,2 @@ -/** - * @file lv_button.h - * - */ - -#ifndef LV_BUTTON_H -#define LV_BUTTON_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_BUTTON != 0 -#include "../../core/lv_obj.h" - -/********************* - * DEFINES - *********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_button_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a button object - * @param parent pointer to an object, it will be the parent of the new button - * @return pointer to the created button - */ -lv_obj_t * lv_button_create(lv_obj_t * parent); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_BUTTON*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_BUTTON_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/button/lv_button_private.h b/src/widgets/button/lv_button_private.h index c89c93aadf..ccb6d1a4aa 100644 --- a/src/widgets/button/lv_button_private.h +++ b/src/widgets/button/lv_button_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_button.h" +#include "../../lv_public_api.h" -#if LV_USE_BUTTON != 0 +#if LV_USE_BUTTON /********************* * DEFINES diff --git a/src/widgets/buttonmatrix/lv_buttonmatrix.c b/src/widgets/buttonmatrix/lv_buttonmatrix.c index 78d899d4dd..4f004bbe29 100644 --- a/src/widgets/buttonmatrix/lv_buttonmatrix.c +++ b/src/widgets/buttonmatrix/lv_buttonmatrix.c @@ -7,19 +7,13 @@ * INCLUDES *********************/ #include "lv_buttonmatrix_private.h" +#if LV_USE_BUTTONMATRIX + #include "../../misc/lv_area_private.h" #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_BUTTONMATRIX != 0 - -#include "../../misc/lv_assert.h" -#include "../../indev/lv_indev.h" -#include "../../core/lv_group.h" -#include "../../draw/lv_draw.h" -#include "../../core/lv_refr.h" #include "../../misc/lv_text_private.h" #include "../../misc/lv_text_ap.h" -#include "../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/widgets/buttonmatrix/lv_buttonmatrix.h b/src/widgets/buttonmatrix/lv_buttonmatrix.h index 771be506c4..dc474a6c0b 100644 --- a/src/widgets/buttonmatrix/lv_buttonmatrix.h +++ b/src/widgets/buttonmatrix/lv_buttonmatrix.h @@ -1,227 +1,2 @@ -/** - * @file lv_buttonmatrix.h - * - */ - -#ifndef LV_BUTTONMATRIX_H -#define LV_BUTTONMATRIX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_BUTTONMATRIX != 0 - -#include "../../core/lv_obj.h" -#include "../../core/lv_obj_property.h" - -/********************* - * DEFINES - *********************/ -#define LV_BUTTONMATRIX_BUTTON_NONE 0xFFFF -LV_EXPORT_CONST_INT(LV_BUTTONMATRIX_BUTTON_NONE); - -/********************** - * TYPEDEFS - **********************/ - -/** Type to store button control flags (disabled, hidden etc.) - * The least-significant 4 bits are used to store button-width proportions in range [1..15]. */ -typedef enum { - LV_BUTTONMATRIX_CTRL_NONE = 0x0000, /**< No extra control, use the default settings*/ - LV_BUTTONMATRIX_CTRL_WIDTH_1 = 0x0001, /**< Set the width to 1 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_2 = 0x0002, /**< Set the width to 2 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_3 = 0x0003, /**< Set the width to 3 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_4 = 0x0004, /**< Set the width to 4 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_5 = 0x0005, /**< Set the width to 5 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_6 = 0x0006, /**< Set the width to 6 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_7 = 0x0007, /**< Set the width to 7 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_8 = 0x0008, /**< Set the width to 8 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_9 = 0x0009, /**< Set the width to 9 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_10 = 0x000A, /**< Set the width to 10 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_11 = 0x000B, /**< Set the width to 11 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_12 = 0x000C, /**< Set the width to 12 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_13 = 0x000D, /**< Set the width to 13 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_14 = 0x000E, /**< Set the width to 14 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_WIDTH_15 = 0x000F, /**< Set the width to 15 relative to the other buttons in the same row */ - LV_BUTTONMATRIX_CTRL_HIDDEN = 0x0010, /**< Hides button; it continues to hold its space in layout. */ - LV_BUTTONMATRIX_CTRL_NO_REPEAT = 0x0020, /**< Do not emit LV_EVENT_LONG_PRESSED_REPEAT events while button is long-pressed. */ - LV_BUTTONMATRIX_CTRL_DISABLED = 0x0040, /**< Disables button like LV_STATE_DISABLED on normal Widgets. */ - LV_BUTTONMATRIX_CTRL_CHECKABLE = 0x0080, /**< Enable toggling of LV_STATE_CHECKED when clicked. */ - LV_BUTTONMATRIX_CTRL_CHECKED = 0x0100, /**< Make the button checked. It will use the :cpp:enumerator:`LV_STATE_CHECHKED` styles. */ - LV_BUTTONMATRIX_CTRL_CLICK_TRIG = 0x0200, /**< 1: Enables sending LV_EVENT_VALUE_CHANGE on CLICK, 0: sends LV_EVENT_VALUE_CHANGE on PRESS. */ - LV_BUTTONMATRIX_CTRL_POPOVER = 0x0400, /**< Show button text in a pop-over while being pressed. */ - LV_BUTTONMATRIX_CTRL_RECOLOR = 0x0800, /**< Enable text recoloring with `#color` */ - LV_BUTTONMATRIX_CTRL_RESERVED_1 = 0x1000, /**< Reserved for later use */ - LV_BUTTONMATRIX_CTRL_RESERVED_2 = 0x2000, /**< Reserved for later use */ - LV_BUTTONMATRIX_CTRL_CUSTOM_1 = 0x4000, /**< Custom free-to-use flag */ - LV_BUTTONMATRIX_CTRL_CUSTOM_2 = 0x8000, /**< Custom free-to-use flag */ -} lv_buttonmatrix_ctrl_t; - -typedef bool (*lv_buttonmatrix_button_draw_cb_t)(lv_obj_t * btnm, uint32_t btn_id, const lv_area_t * draw_area, - const lv_area_t * clip_area); - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_buttonmatrix_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_buttonmatrix_id_t { - LV_PROPERTY_ID(BUTTONMATRIX, SELECTED_BUTTON, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(BUTTONMATRIX, ONE_CHECKED, LV_PROPERTY_TYPE_BOOL, 1), - LV_PROPERTY_BUTTONMATRIX_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a button matrix object - * @param parent pointer to an object, it will be the parent of the new button matrix - * @return pointer to the created button matrix - */ -lv_obj_t * lv_buttonmatrix_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set a new map. Buttons will be created/deleted according to the map. The - * button matrix keeps a reference to the map and so the string array must not - * be deallocated during the life of the matrix. - * @param obj pointer to a button matrix object - * @param map pointer a string array. The last string has to be: "". Use "\n" to make a line break. - */ -void lv_buttonmatrix_set_map(lv_obj_t * obj, const char * const map[]); - -/** - * Set the button control map (hidden, disabled etc.) for a button matrix. - * The control map array will be copied and so may be deallocated after this - * function returns. - * @param obj pointer to a button matrix object - * @param ctrl_map pointer to an array of `lv_button_ctrl_t` control bytes. The - * length of the array and position of the elements must match - * the number and order of the individual buttons (i.e. excludes - * newline entries). - * An element of the map should look like e.g.: - * `ctrl_map[0] = width | LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_TGL_ENABLE` - */ -void lv_buttonmatrix_set_ctrl_map(lv_obj_t * obj, const lv_buttonmatrix_ctrl_t ctrl_map[]); - -/** - * Set the selected buttons - * @param obj pointer to button matrix object - * @param btn_id 0 based index of the button to modify. (Not counting new lines) - */ -void lv_buttonmatrix_set_selected_button(lv_obj_t * obj, uint32_t btn_id); - -/** - * Set the attributes of a button of the button matrix - * @param obj pointer to button matrix object - * @param btn_id 0 based index of the button to modify. (Not counting new lines) - * @param ctrl OR-ed attributes. E.g. `LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CHECKABLE` - */ -void lv_buttonmatrix_set_button_ctrl(lv_obj_t * obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl); - -/** - * Clear the attributes of a button of the button matrix - * @param obj pointer to button matrix object - * @param btn_id 0 based index of the button to modify. (Not counting new lines) - * @param ctrl OR-ed attributes. E.g. `LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CHECKABLE` - */ -void lv_buttonmatrix_clear_button_ctrl(lv_obj_t * obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl); - -/** - * Set attributes of all buttons of a button matrix - * @param obj pointer to a button matrix object - * @param ctrl attribute(s) to set from `lv_buttonmatrix_ctrl_t`. Values can be ORed. - */ -void lv_buttonmatrix_set_button_ctrl_all(lv_obj_t * obj, lv_buttonmatrix_ctrl_t ctrl); - -/** - * Clear the attributes of all buttons of a button matrix - * @param obj pointer to a button matrix object - * @param ctrl attribute(s) to set from `lv_buttonmatrix_ctrl_t`. Values can be ORed. - */ -void lv_buttonmatrix_clear_button_ctrl_all(lv_obj_t * obj, lv_buttonmatrix_ctrl_t ctrl); - -/** - * Set a single button's relative width. - * This method will cause the matrix be regenerated and is a relatively - * expensive operation. It is recommended that initial width be specified using - * `lv_buttonmatrix_set_ctrl_map` and this method only be used for dynamic changes. - * @param obj pointer to button matrix object - * @param btn_id 0 based index of the button to modify. - * @param width relative width compared to the buttons in the same row. [1..15] - */ -void lv_buttonmatrix_set_button_width(lv_obj_t * obj, uint32_t btn_id, uint32_t width); - -/** - * Make the button matrix like a selector widget (only one button may be checked at a time). - * `LV_BUTTONMATRIX_CTRL_CHECKABLE` must be enabled on the buttons to be selected using - * `lv_buttonmatrix_set_ctrl()` or `lv_buttonmatrix_set_button_ctrl_all()`. - * @param obj pointer to a button matrix object - * @param en whether "one check" mode is enabled - */ -void lv_buttonmatrix_set_one_checked(lv_obj_t * obj, bool en); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the current map of a button matrix - * @param obj pointer to a button matrix object - * @return the current map - */ -const char * const * lv_buttonmatrix_get_map(const lv_obj_t * obj); - -/** - * Get the index of the lastly "activated" button by the user (pressed, released, focused etc) - * Useful in the `event_cb` to get the text of the button, check if hidden etc. - * @param obj pointer to button matrix object - * @return index of the last released button (LV_BUTTONMATRIX_BUTTON_NONE: if unset) - */ -uint32_t lv_buttonmatrix_get_selected_button(const lv_obj_t * obj); - -/** - * Get the button's text - * @param obj pointer to button matrix object - * @param btn_id the index a button not counting new line characters. - * @return text of btn_index` button - */ -const char * lv_buttonmatrix_get_button_text(const lv_obj_t * obj, uint32_t btn_id); - -/** - * Get the whether a control value is enabled or disabled for button of a button matrix - * @param obj pointer to a button matrix object - * @param btn_id the index of a button not counting new line characters. - * @param ctrl control values to check (ORed value can be used) - * @return true: the control attribute is enabled false: disabled - */ -bool lv_buttonmatrix_has_button_ctrl(lv_obj_t * obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl); - -/** - * Tell whether "one check" mode is enabled or not. - * @param obj Button matrix object - * @return true: "one check" mode is enabled; false: disabled - */ -bool lv_buttonmatrix_get_one_checked(const lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_BUTTONMATRIX*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_BUTTONMATRIX_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/buttonmatrix/lv_buttonmatrix_private.h b/src/widgets/buttonmatrix/lv_buttonmatrix_private.h index 3f6b0fa539..1983968b89 100644 --- a/src/widgets/buttonmatrix/lv_buttonmatrix_private.h +++ b/src/widgets/buttonmatrix/lv_buttonmatrix_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_buttonmatrix.h" +#include "../../lv_public_api.h" -#if LV_USE_BUTTONMATRIX != 0 +#if LV_USE_BUTTONMATRIX /********************* * DEFINES diff --git a/src/widgets/calendar/lv_calendar.c b/src/widgets/calendar/lv_calendar.c index e01f36ebba..3344753195 100644 --- a/src/widgets/calendar/lv_calendar.c +++ b/src/widgets/calendar/lv_calendar.c @@ -6,13 +6,13 @@ /********************* * INCLUDES *********************/ + #include "lv_calendar_private.h" -#include "../../draw/lv_draw_private.h" -#include "../../core/lv_obj_class_private.h" -#include "../../../lvgl.h" + #if LV_USE_CALENDAR -#include "../../misc/lv_assert.h" +#include "../../draw/lv_draw_private.h" +#include "../../core/lv_obj_class_private.h" /********************* * DEFINES diff --git a/src/widgets/calendar/lv_calendar.h b/src/widgets/calendar/lv_calendar.h index d986ef0486..8bbf0e5758 100644 --- a/src/widgets/calendar/lv_calendar.h +++ b/src/widgets/calendar/lv_calendar.h @@ -1,195 +1,2 @@ -/** - * @file lv_calendar.h - * - */ - -#ifndef LV_CALENDAR_H -#define LV_CALENDAR_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../buttonmatrix/lv_buttonmatrix.h" - -#if LV_USE_CALENDAR - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** - * Represents a date on the calendar object (platform-agnostic). - */ -typedef struct { - uint16_t year; - uint8_t month; /**< 1..12 */ - uint8_t day; /**< 1..31 */ -} lv_calendar_date_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a calendar widget - * @param parent pointer to an object, it will be the parent of the new calendar - * @return pointer the created calendar - */ -lv_obj_t * lv_calendar_create(lv_obj_t * parent); - -/*====================== - * Add/remove functions - *=====================*/ - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the today's year, month and day at once - * @param obj pointer to a calendar object - * @param year today's year - * @param month today's month [1..12] - * @param day today's day [1..31] - */ -void lv_calendar_set_today_date(lv_obj_t * obj, uint32_t year, uint32_t month, uint32_t day); - -/** - * Set the today's year - * @param obj pointer to a calendar object - * @param year today's year - */ -void lv_calendar_set_today_year(lv_obj_t * obj, uint32_t year); - -/** - * Set the today's year - * @param obj pointer to a calendar object - * @param month today's month [1..12] - */ -void lv_calendar_set_today_month(lv_obj_t * obj, uint32_t month); - -/** - * Set the today's year - * @param obj pointer to a calendar object - * @param day today's day [1..31] - */ -void lv_calendar_set_today_day(lv_obj_t * obj, uint32_t day); - -/** - * Set the currently shown year and month at once - * @param obj pointer to a calendar object - * @param year shown year - * @param month shown month [1..12] - */ -void lv_calendar_set_month_shown(lv_obj_t * obj, uint32_t year, uint32_t month); - -/** - * Set the currently shown year - * @param obj pointer to a calendar object - * @param year shown year - */ -void lv_calendar_set_shown_year(lv_obj_t * obj, uint32_t year); - -/** - * Set the currently shown month - * @param obj pointer to a calendar object - * @param month shown month [1..12] - */ -void lv_calendar_set_shown_month(lv_obj_t * obj, uint32_t month); - -/** - * Set the highlighted dates - * @param obj pointer to a calendar object - * @param highlighted pointer to an `lv_calendar_date_t` array containing the dates. - * Only the pointer will be saved so this variable can't be local which will be destroyed later. - * @param date_num number of dates in the array - */ -void lv_calendar_set_highlighted_dates(lv_obj_t * obj, lv_calendar_date_t highlighted[], size_t date_num); - -/** - * Set the name of the days - * @param obj pointer to a calendar object - * @param day_names pointer to an array with the names. - * E.g. `const char * days[7] = {"Sun", "Mon", ...}` - * Only the pointer will be saved so this variable can't be local which will be destroyed later. - */ -void lv_calendar_set_day_names(lv_obj_t * obj, const char ** day_names); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the button matrix object of the calendar. - * It shows the dates and day names. - * @param obj pointer to a calendar object - * @return pointer to a the button matrix - */ -lv_obj_t * lv_calendar_get_btnmatrix(const lv_obj_t * obj); - -/** - * Get the today's date - * @param calendar pointer to a calendar object - * @return return pointer to an `lv_calendar_date_t` variable containing the date of today. - */ -const lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * calendar); - -/** - * Get the currently showed - * @param calendar pointer to a calendar object - * @return pointer to an `lv_calendar_date_t` variable containing the date is being shown. - */ -const lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar); - -/** - * Get the highlighted dates - * @param calendar pointer to a calendar object - * @return pointer to an `lv_calendar_date_t` array containing the dates. - */ -lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar); - -/** - * Get the number of the highlighted dates - * @param calendar pointer to a calendar object - * @return number of highlighted days - */ -size_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar); - -/** - * Get the currently pressed day - * @param calendar pointer to a calendar object - * @param date store the pressed date here - * @return LV_RESULT_OK: there is a valid pressed date - * LV_RESULT_INVALID: there is no pressed data - */ -lv_result_t lv_calendar_get_pressed_date(const lv_obj_t * calendar, lv_calendar_date_t * date); - -/*===================== - * Other functions - *====================*/ - -/********************** - * MACROS - **********************/ - -#include "lv_calendar_header_arrow.h" -#include "lv_calendar_header_dropdown.h" -#include "lv_calendar_chinese.h" - -#endif /*LV_USE_CALENDAR*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CALENDAR_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/calendar/lv_calendar_chinese.h b/src/widgets/calendar/lv_calendar_chinese.h index fb7a1bc0ee..c070f9ad2a 100644 --- a/src/widgets/calendar/lv_calendar_chinese.h +++ b/src/widgets/calendar/lv_calendar_chinese.h @@ -1,68 +1,2 @@ -/** - * @file lv_calendar_chinese.h - * - */ - -#ifndef LV_CALENDAR_CHINESE_H -#define LV_CALENDAR_CHINESE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" -#include "lv_calendar.h" -#if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_calendar_date_t today; - bool leep_month; -} lv_calendar_chinese_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Enable the chinese calendar. - * @param obj pointer to a calendar object. - * @param en true: enable chinese calendar; false: disable - */ -void lv_calendar_set_chinese_mode(lv_obj_t * obj, bool en); - -/** - * Get the name of the day - * @param gregorian to obtain the gregorian time for the name - * @return return the name of the day - */ -const char * lv_calendar_get_day_name(lv_calendar_date_t * gregorian); - -/** - * Get the chinese time of the gregorian time (reference: https://www.cnblogs.com/liyang31tg/p/4123171.html) - * @param gregorian_time need to convert to chinese time in gregorian time - * @param chinese_time the chinese time convert from gregorian time - */ -void lv_calendar_gregorian_to_chinese(lv_calendar_date_t * gregorian_time, lv_calendar_chinese_t * chinese_time); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_CALENDAR_CHINESE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CALENDAR_CHINESE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/calendar/lv_calendar_header_arrow.c b/src/widgets/calendar/lv_calendar_header_arrow.c index 144f11c7be..352d7d3c33 100644 --- a/src/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/widgets/calendar/lv_calendar_header_arrow.c @@ -6,15 +6,11 @@ /********************* * INCLUDES *********************/ + #include "../../core/lv_obj_class_private.h" -#include "lv_calendar_header_arrow.h" + #if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_ARROW -#include "lv_calendar.h" -#include "../button/lv_button.h" -#include "../label/lv_label.h" -#include "../../layouts/flex/lv_flex.h" -#include "../../misc/lv_assert.h" /********************* * DEFINES diff --git a/src/widgets/calendar/lv_calendar_header_arrow.h b/src/widgets/calendar/lv_calendar_header_arrow.h index 54f4fbed7b..2e86dda82a 100644 --- a/src/widgets/calendar/lv_calendar_header_arrow.h +++ b/src/widgets/calendar/lv_calendar_header_arrow.h @@ -1,49 +1,2 @@ -/** - * @file lv_calendar_header_arrow.h - * - */ - -#ifndef LV_CALENDAR_HEADER_ARROW_H -#define LV_CALENDAR_HEADER_ARROW_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" -#if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_ARROW - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_header_arrow_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a calendar header with drop-drowns to select the year and month - * @param parent pointer to a calendar object. - * @return the created header - */ -lv_obj_t * lv_calendar_add_header_arrow(lv_obj_t * parent); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_CALENDAR_HEADER_ARROW*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CALENDAR_HEADER_ARROW_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/calendar/lv_calendar_header_dropdown.c b/src/widgets/calendar/lv_calendar_header_dropdown.c index 9715588d8f..56ec75daf1 100644 --- a/src/widgets/calendar/lv_calendar_header_dropdown.c +++ b/src/widgets/calendar/lv_calendar_header_dropdown.c @@ -6,13 +6,12 @@ /********************* * INCLUDES *********************/ -#include "../../core/lv_obj_class_private.h" -#include "lv_calendar_header_dropdown.h" + +#include "lv_calendar_private.h" + #if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_DROPDOWN -#include "lv_calendar.h" -#include "../dropdown/lv_dropdown.h" -#include "../../layouts/flex/lv_flex.h" +#include "../../core/lv_obj_class_private.h" /********************* * DEFINES diff --git a/src/widgets/calendar/lv_calendar_header_dropdown.h b/src/widgets/calendar/lv_calendar_header_dropdown.h index 13b01304ef..dc025f5663 100644 --- a/src/widgets/calendar/lv_calendar_header_dropdown.h +++ b/src/widgets/calendar/lv_calendar_header_dropdown.h @@ -1,62 +1,2 @@ -/** - * @file lv_calendar_header_dropdown.h - * - */ - -#ifndef LV_CALENDAR_HEADER_DROPDOWN_H -#define LV_CALENDAR_HEADER_DROPDOWN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" -#if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_DROPDOWN - -#if LV_USE_DROPDOWN == 0 -#error "LV_USE_DROPDOWN needs to be enabled" -#endif - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_header_dropdown_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a calendar header with drop-drowns to select the year and month - * @param parent pointer to a calendar object. - * @return the created header - */ -lv_obj_t * lv_calendar_add_header_dropdown(lv_obj_t * parent); - -/** - * Sets a custom calendar year list - * @param parent pointer to a calendar object - * @param years_list pointer to an const char array with the years list, see lv_dropdown set_options for more information. - * E.g. `const char * years = "2023\n2022\n2021\n2020\n2019" - * Only the pointer will be saved so this variable can't be local which will be destroyed later. - */ -void lv_calendar_header_dropdown_set_year_list(lv_obj_t * parent, const char * years_list); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_CALENDAR_HEADER_ARROW*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CALENDAR_HEADER_DROPDOWN_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/calendar/lv_calendar_private.h b/src/widgets/calendar/lv_calendar_private.h index 0a5b8a2ef8..023502e6ff 100644 --- a/src/widgets/calendar/lv_calendar_private.h +++ b/src/widgets/calendar/lv_calendar_private.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_calendar.h" +#include "../../lv_public_api.h" #if LV_USE_CALENDAR diff --git a/src/widgets/canvas/lv_canvas.c b/src/widgets/canvas/lv_canvas.c index 757f95f389..24fd4ab312 100644 --- a/src/widgets/canvas/lv_canvas.c +++ b/src/widgets/canvas/lv_canvas.c @@ -10,15 +10,13 @@ /********************* * INCLUDES *********************/ + #include "lv_canvas_private.h" + +#if LV_USE_CANVAS + #include "../../core/lv_obj_class_private.h" -#if LV_USE_CANVAS != 0 -#include "../../misc/lv_assert.h" -#include "../../misc/lv_math.h" #include "../../draw/lv_draw_private.h" -#include "../../core/lv_refr.h" -#include "../../display/lv_display.h" -#include "../../stdlib/lv_string.h" #include "../../misc/cache/lv_cache.h" /********************* * DEFINES diff --git a/src/widgets/canvas/lv_canvas.h b/src/widgets/canvas/lv_canvas.h index 3bf70daaa0..aaa7a0430c 100644 --- a/src/widgets/canvas/lv_canvas.h +++ b/src/widgets/canvas/lv_canvas.h @@ -1,191 +1,2 @@ -/** - * @file lv_canvas.h - * - */ - -#ifndef LV_CANVAS_H -#define LV_CANVAS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_CANVAS != 0 - -#include "../image/lv_image.h" -#include "../../draw/lv_draw_image.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_canvas_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a canvas object - * @param parent pointer to an object, it will be the parent of the new canvas - * @return pointer to the created canvas - */ -lv_obj_t * lv_canvas_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set a buffer for the canvas. - * - * Use lv_canvas_set_draw_buf() instead if you need to set a buffer with alignment requirement. - * - * @param obj pointer to a canvas object - * @param buf buffer where content of canvas will be. - * The required size is (lv_image_color_format_get_px_size(cf) * w) / 8 * h) - * It can be allocated with `lv_malloc()` or - * it can be statically allocated array (e.g. static lv_color_t buf[100*50]) or - * it can be an address in RAM or external SRAM - * @param w width of canvas - * @param h height of canvas - * @param cf color format. `LV_COLOR_FORMAT...` - */ -void lv_canvas_set_buffer(lv_obj_t * obj, void * buf, int32_t w, int32_t h, lv_color_format_t cf); - -/** - * Set a draw buffer for the canvas. A draw buffer either can be allocated by `lv_draw_buf_create()` - * or defined statically by `LV_DRAW_BUF_DEFINE_STATIC`. When buffer start address and stride has alignment - * requirement, it's recommended to use `lv_draw_buf_create`. - * @param obj pointer to a canvas object - * @param draw_buf pointer to a draw buffer - */ -void lv_canvas_set_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf); - -/** - * Set a pixel's color and opacity - * @param obj pointer to a canvas - * @param x X coordinate of the pixel - * @param y Y coordinate of the pixel - * @param color the color - * @param opa the opacity - * @note The following color formats are supported - * LV_COLOR_FORMAT_I1/2/4/8, LV_COLOR_FORMAT_A8, - * LV_COLOR_FORMAT_RGB565, LV_COLOR_FORMAT_RGB888, - * LV_COLOR_FORMAT_XRGB8888, LV_COLOR_FORMAT_ARGB8888 - * @note this function invalidates the canvas object every time, - * for best performance, if you're changing a lot of pixels in a loop, - * call `lv_display_enable_invalidation` before the loop starts - * so the invalidation isn't done on every call - */ -void lv_canvas_set_px(lv_obj_t * obj, int32_t x, int32_t y, lv_color_t color, lv_opa_t opa); - -/** - * Set the palette color of a canvas for index format. Valid only for `LV_COLOR_FORMAT_I1/2/4/8` - * @param obj pointer to canvas object - * @param index the palette color to set: - * - for `LV_COLOR_FORMAT_I1`: 0..1 - * - for `LV_COLOR_FORMAT_I2`: 0..3 - * - for `LV_COLOR_FORMAT_I4`: 0..15 - * - for `LV_COLOR_FORMAT_I8`: 0..255 - * @param color the color to set - */ -void lv_canvas_set_palette(lv_obj_t * obj, uint8_t index, lv_color32_t color); - -/*===================== - * Getter functions - *====================*/ - -lv_draw_buf_t * lv_canvas_get_draw_buf(lv_obj_t * obj); - -/** - * Get a pixel's color and opacity - * @param obj pointer to a canvas - * @param x X coordinate of the pixel - * @param y Y coordinate of the pixel - * @return ARGB8888 color of the pixel - */ -lv_color32_t lv_canvas_get_px(lv_obj_t * obj, int32_t x, int32_t y); - -/** - * Get the image of the canvas as a pointer to an `lv_image_dsc_t` variable. - * @param canvas pointer to a canvas object - * @return pointer to the image descriptor. - */ -lv_image_dsc_t * lv_canvas_get_image(lv_obj_t * canvas); - -/** - * Return the pointer for the buffer. - * It's recommended to use this function instead of the buffer form the - * return value of lv_canvas_get_image() as is can be aligned - * @param canvas pointer to a canvas object - * @return pointer to the buffer - */ -const void * lv_canvas_get_buf(lv_obj_t * canvas); - -/*===================== - * Other functions - *====================*/ - -/** - * Copy a buffer to the canvas - * @param obj pointer to a canvas object - * @param canvas_area the area of the canvas to copy the new data to - * @param src_buf pointer to a buffer holding the source data - * @param src_area the area of the source buffer to copy from. If NULL, copy the whole buffer. - * @note canvas_area and src_area should be the same size. If canvas_area and the size of src_buf are the same, - * src_area can be left NULL. - */ -void lv_canvas_copy_buf(lv_obj_t * obj, const lv_area_t * canvas_area, lv_draw_buf_t * src_buf, - const lv_area_t * src_area); - -/** - * Fill the canvas with color - * @param obj pointer to a canvas - * @param color the background color - * @param opa the desired opacity - */ -void lv_canvas_fill_bg(lv_obj_t * obj, lv_color_t color, lv_opa_t opa); - -/** - * Initialize a layer to use LVGL's generic draw functions (lv_draw_rect/label/...) on the canvas. - * Needs to be usd in pair with `lv_canvas_finish_layer`. - * @param canvas pointer to a canvas - * @param layer pointer to a layer variable to initialize - */ -void lv_canvas_init_layer(lv_obj_t * canvas, lv_layer_t * layer); - -/** - * Wait until all the drawings are finished on layer. - * Needs to be usd in pair with `lv_canvas_init_layer`. - * @param canvas pointer to a canvas - * @param layer pointer to a layer to finalize - */ -void lv_canvas_finish_layer(lv_obj_t * canvas, lv_layer_t * layer); - -/********************** - * MACROS - **********************/ - -#define LV_CANVAS_BUF_SIZE(w, h, bpp, stride) (((((w * bpp + 7) >> 3) + stride - 1) & ~(stride - 1)) * h + LV_DRAW_BUF_ALIGN) - -/** - * Just a wrapper to `LV_CANVAS_BUF_SIZE` for bindings. - */ -uint32_t lv_canvas_buf_size(int32_t w, int32_t h, uint8_t bpp, uint8_t stride); - -#endif /*LV_USE_CANVAS*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CANVAS_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/canvas/lv_canvas_private.h b/src/widgets/canvas/lv_canvas_private.h index 55b3054773..84e909735c 100644 --- a/src/widgets/canvas/lv_canvas_private.h +++ b/src/widgets/canvas/lv_canvas_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../image/lv_image_private.h" -#include "lv_canvas.h" +#include "../../lv_public_api.h" -#if LV_USE_CANVAS != 0 +#if LV_USE_CANVAS /********************* * DEFINES diff --git a/src/widgets/chart/lv_chart.c b/src/widgets/chart/lv_chart.c index 059a07d295..d9b94008d9 100644 --- a/src/widgets/chart/lv_chart.c +++ b/src/widgets/chart/lv_chart.c @@ -6,8 +6,10 @@ /********************* * INCLUDES *********************/ + #include "lv_chart_private.h" -#if LV_USE_CHART != 0 + +#if LV_USE_CHART #include "../../misc/lv_area_private.h" #include "../../draw/lv_draw_private.h" @@ -15,7 +17,6 @@ #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_class_private.h" #include "../../core/lv_obj_draw_private.h" -#include "../../misc/lv_assert.h" /********************* * DEFINES diff --git a/src/widgets/chart/lv_chart.h b/src/widgets/chart/lv_chart.h index ba07f870e6..128db7ae27 100644 --- a/src/widgets/chart/lv_chart.h +++ b/src/widgets/chart/lv_chart.h @@ -1,466 +1,2 @@ -/** - * @file lv_chart.h - * - */ - -#ifndef LV_CHART_H -#define LV_CHART_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../core/lv_obj.h" - -#if LV_USE_CHART != 0 - -/********************* - * DEFINES - *********************/ - -/**Default value of points. Can be used to not draw a point*/ -#define LV_CHART_POINT_NONE (INT32_MAX) -LV_EXPORT_CONST_INT(LV_CHART_POINT_NONE); - -/********************** - * TYPEDEFS - **********************/ - -/** - * Chart types - */ -typedef enum { - LV_CHART_TYPE_NONE, /**< Don't draw the series*/ - LV_CHART_TYPE_LINE, /**< Connect the points with lines*/ - LV_CHART_TYPE_CURVE, /**< Connect the points with curves*/ - LV_CHART_TYPE_BAR, /**< Draw bars for each series*/ - LV_CHART_TYPE_STACKED, /**< Draw a single stacked bar for each data point. Supports only positive values*/ - LV_CHART_TYPE_SCATTER, /**< Draw points and lines in 2D (x,y coordinates)*/ -} lv_chart_type_t; - -/** - * Chart update mode for `lv_chart_set_next` - */ -typedef enum { - LV_CHART_UPDATE_MODE_SHIFT, /**< Shift old data to the left and add the new one the right*/ - LV_CHART_UPDATE_MODE_CIRCULAR, /**< Add the new data in a circular way*/ -} lv_chart_update_mode_t; - -/** - * Enumeration of the axis' - */ -typedef enum { - LV_CHART_AXIS_PRIMARY_Y = 0x00, - LV_CHART_AXIS_SECONDARY_Y = 0x01, - LV_CHART_AXIS_PRIMARY_X = 0x02, - LV_CHART_AXIS_SECONDARY_X = 0x04, - LV_CHART_AXIS_LAST -} lv_chart_axis_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_chart_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_chart_id_t { - LV_PROPERTY_ID(CHART, TYPE, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(CHART, POINT_COUNT, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(CHART, UPDATE_MODE, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(CHART, HOR_DIV_LINE_COUNT, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_ID(CHART, VER_DIV_LINE_COUNT, LV_PROPERTY_TYPE_INT, 4), - LV_PROPERTY_CHART_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a chart object - * @param parent pointer to an object, it will be the parent of the new chart - * @return pointer to the created chart - */ -lv_obj_t * lv_chart_create(lv_obj_t * parent); - -/** - * Set a new type for a chart - * @param obj pointer to a chart object - * @param type new type of the chart (from 'lv_chart_type_t' enum) - */ -void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type); -/** - * Set the number of points on a data line on a chart - * @param obj pointer to a chart object - * @param cnt new number of points on the data lines - */ -void lv_chart_set_point_count(lv_obj_t * obj, uint32_t cnt); - -/** - * Set the minimal and maximal y values on an axis - * @param obj pointer to a chart object - * @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y` - * @param min minimum value of the y axis - * @param max maximum value of the y axis - */ -void lv_chart_set_axis_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min, int32_t max); - -/** - * Set the minimal values on an axis - * @param obj pointer to a chart object - * @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y` - * @param min minimal value of the y axis - */ -void lv_chart_set_axis_min_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min); - -/** - * Set the maximal y values on an axis - * @param obj pointer to a chart object - * @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y` - * @param max maximum value of the y axis - */ -void lv_chart_set_axis_max_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t max); - - -/** - * Set update mode of the chart object. Affects - * @param obj pointer to a chart object - * @param update_mode the update mode - */ -void lv_chart_set_update_mode(lv_obj_t * obj, lv_chart_update_mode_t update_mode); - -/** - * Set the number of horizontal and vertical division lines - * @param obj pointer to a chart object - * @param hdiv number of horizontal division lines - * @param vdiv number of vertical division lines - */ -void lv_chart_set_div_line_count(lv_obj_t * obj, uint32_t hdiv, uint32_t vdiv); - -/** - * Set the number of horizontal division lines - * @param obj pointer to a chart object - * @param cnt number of horizontal division lines - */ -void lv_chart_set_hor_div_line_count(lv_obj_t * obj, uint32_t cnt); - -/** - * Set the number of vertical division lines - * @param obj pointer to a chart object - * @param cnt number of vertical division lines - */ -void lv_chart_set_ver_div_line_count(lv_obj_t * obj, uint32_t cnt); - -/** - * Get the type of a chart - * @param obj pointer to chart object - * @return type of the chart (from 'lv_chart_t' enum) - */ -lv_chart_type_t lv_chart_get_type(const lv_obj_t * obj); - -/** - * Get the data point number per data line on chart - * @param obj pointer to chart object - * @return point number on each data line - */ -uint32_t lv_chart_get_point_count(const lv_obj_t * obj); - -/** - * Get the update mode of a chart - * @param obj pointer to a chart object - * @return the update mode - */ -lv_chart_update_mode_t lv_chart_get_update_mode(const lv_obj_t * obj); - -/** - * Get the number of horizontal division lines - * @param obj pointer to a chart object - * @return the number of horizontal division lines - */ -uint32_t lv_chart_get_hor_div_line_count(const lv_obj_t * obj); - -/** - * Get the number of vertical division lines - * @param obj pointer to a chart object - * @return the number of vertical division lines - */ -uint32_t lv_chart_get_ver_div_line_count(const lv_obj_t * obj); - -/** - * Get the current index of the x-axis start point in the data array - * @param obj pointer to a chart object - * @param ser pointer to a data series on 'chart' - * @return the index of the current x start point in the data array - */ -uint32_t lv_chart_get_x_start_point(const lv_obj_t * obj, lv_chart_series_t * ser); - -/** - * Get the position of a point to the chart. - * @param obj pointer to a chart object - * @param ser pointer to series - * @param id the index. - * @param p_out store the result position here - */ -void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, lv_point_t * p_out); - -/** - * Refresh a chart if its data line has changed - * @param obj pointer to chart object - */ -void lv_chart_refresh(lv_obj_t * obj); - -/*====================== - * Series - *=====================*/ - -/** - * Allocate and add a data series to the chart - * @param obj pointer to a chart object - * @param color color of the data series - * @param axis the y axis to which the series should be attached (::LV_CHART_AXIS_PRIMARY_Y or ::LV_CHART_AXIS_SECONDARY_Y) - * @return pointer to the allocated data series or NULL on failure - */ -lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_chart_axis_t axis); - -/** - * Deallocate and remove a data series from a chart - * @param obj pointer to a chart object - * @param series pointer to a data series on 'chart' - */ -void lv_chart_remove_series(lv_obj_t * obj, lv_chart_series_t * series); - -/** - * Hide/Unhide a single series of a chart. - * @param chart pointer to a chart object. - * @param series pointer to a series object - * @param hide true: hide the series - */ -void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide); - -/** - * Change the color of a series - * @param chart pointer to a chart object. - * @param series pointer to a series object - * @param color the new color of the series - */ -void lv_chart_set_series_color(lv_obj_t * chart, lv_chart_series_t * series, lv_color_t color); - -/** - * Get the color of a series - * @param chart pointer to a chart object. - * @param series pointer to a series object - * @return the color of the series - */ -lv_color_t lv_chart_get_series_color(lv_obj_t * chart, const lv_chart_series_t * series); - -/** - * Set the index of the x-axis start point in the data array. - * This point will be considers the first (left) point and the other points will be drawn after it. - * @param obj pointer to a chart object - * @param ser pointer to a data series on 'chart' - * @param id the index of the x point in the data array - */ -void lv_chart_set_x_start_point(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id); - -/** - * Get the next series. - * @param chart pointer to a chart - * @param ser the previous series or NULL to get the first - * @return the next series or NULL if there is no more. - */ -lv_chart_series_t * lv_chart_get_series_next(const lv_obj_t * chart, const lv_chart_series_t * ser); - -/*===================== - * Cursor - *====================*/ - -/** - * Add a cursor with a given color - * @param obj pointer to chart object - * @param color color of the cursor - * @param dir direction of the cursor. `LV_DIR_RIGHT/LEFT/TOP/DOWN/HOR/VER/ALL`. OR-ed values are possible - * @return pointer to the created cursor - */ -lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * obj, lv_color_t color, lv_dir_t dir); - -/** - * Remove a cursor - * @param obj pointer to chart object - * @param cursor pointer to the cursor - */ -void lv_chart_remove_cursor(lv_obj_t * obj, lv_chart_cursor_t * cursor); - -/** - * Set the coordinate of the cursor with respect to the paddings - * @param chart pointer to a chart object - * @param cursor pointer to the cursor - * @param pos the new coordinate of cursor relative to the chart - */ -void lv_chart_set_cursor_pos(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * pos); - -/** - * Set the X coordinate of the cursor with respect to the paddings - * @param chart pointer to a chart object - * @param cursor pointer to the cursor - * @param x the new X coordinate of cursor relative to the chart - */ -void lv_chart_set_cursor_pos_x(lv_obj_t * chart, lv_chart_cursor_t * cursor, int32_t x); - -/** - * Set the coordinate of the cursor with respect to the paddings - * @param chart pointer to a chart object - * @param cursor pointer to the cursor - * @param y the new Y coordinate of cursor relative to the chart - */ -void lv_chart_set_cursor_pos_y(lv_obj_t * chart, lv_chart_cursor_t * cursor, int32_t y); - -/** - * Stick the cursor to a point - * @param chart pointer to a chart object - * @param cursor pointer to the cursor - * @param ser pointer to a series - * @param point_id the point's index or `LV_CHART_POINT_NONE` to not assign to any points. - */ -void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_chart_series_t * ser, - uint32_t point_id); - -/** - * Get the coordinate of the cursor with respect to the paddings - * @param chart pointer to a chart object - * @param cursor pointer to cursor - * @return coordinate of the cursor as lv_point_t - */ -lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor); - -/*===================== - * Set/Get value(s) - *====================*/ - -/** - * Initialize all data points of a series with a value - * @param obj pointer to chart object - * @param ser pointer to a data series on 'chart' - * @param value the new value for all points. `LV_CHART_POINT_NONE` can be used to hide the points. - */ -void lv_chart_set_all_values(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value); - -/** - * Set the next point's Y value according to the update mode policy. - * @param obj pointer to chart object - * @param ser pointer to a data series on 'chart' - * @param value the new value of the next data - */ -void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value); - -/** - * Set the next point's X and Y value according to the update mode policy. - * @param obj pointer to chart object - * @param ser pointer to a data series on 'chart' - * @param x_value the new X value of the next data - * @param y_value the new Y value of the next data - */ -void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, int32_t x_value, int32_t y_value); - -/** - * Same as `lv_chart_set_next_value` but set the values from an array - * @param obj pointer to chart object - * @param ser pointer to a data series on 'chart' - * @param values the new values to set - * @param values_cnt number of items in `values` - */ -void lv_chart_set_series_values(lv_obj_t * obj, lv_chart_series_t * ser, const int32_t values[], size_t values_cnt); - -/** - * Same as `lv_chart_set_next_value2` but set the values from an array - * @param obj pointer to chart object - * @param ser pointer to a data series on 'chart' - * @param x_values the new values to set on the X axis - * @param y_values the new values to set o nthe Y axis - * @param values_cnt number of items in `x_values` and `y_values` - */ -void lv_chart_set_series_values2(lv_obj_t * obj, lv_chart_series_t * ser, const int32_t x_values[], - const int32_t y_values[], size_t values_cnt); - -/** - * Set an individual point's y value of a chart's series directly based on its index - * @param obj pointer to a chart object - * @param ser pointer to a data series on 'chart' - * @param id the index of the x point in the array - * @param value value to assign to array point - */ -void lv_chart_set_series_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t value); - -/** - * Set an individual point's x and y value of a chart's series directly based on its index - * Can be used only with `LV_CHART_TYPE_SCATTER`. - * @param obj pointer to chart object - * @param ser pointer to a data series on 'chart' - * @param id the index of the x point in the array - * @param x_value the new X value of the next data - * @param y_value the new Y value of the next data - */ -void lv_chart_set_series_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t x_value, - int32_t y_value); - -/** - * Set an external array for the y data points to use for the chart - * NOTE: It is the users responsibility to make sure the `point_cnt` matches the external array size. - * @param obj pointer to a chart object - * @param ser pointer to a data series on 'chart' - * @param array external array of points for chart - */ -void lv_chart_set_series_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]); - -/** - * Set an external array for the x data points to use for the chart - * NOTE: It is the users responsibility to make sure the `point_cnt` matches the external array size. - * @param obj pointer to a chart object - * @param ser pointer to a data series on 'chart' - * @param array external array of points for chart - */ -void lv_chart_set_series_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]); - -/** - * Get the array of y values of a series - * @param obj pointer to a chart object - * @param ser pointer to a data series on 'chart' - * @return the array of values with 'point_count' elements - */ -int32_t * lv_chart_get_series_y_array(const lv_obj_t * obj, lv_chart_series_t * ser); - -/** - * Get the array of x values of a series - * @param obj pointer to a chart object - * @param ser pointer to a data series on 'chart' - * @return the array of values with 'point_count' elements - */ -int32_t * lv_chart_get_series_x_array(const lv_obj_t * obj, lv_chart_series_t * ser); - -/** - * Get the index of the currently pressed point. It's the same for every series. - * @param obj pointer to a chart object - * @return the index of the point [0 .. point count] or LV_CHART_POINT_ID_NONE if no point is being pressed - */ -uint32_t lv_chart_get_pressed_point(const lv_obj_t * obj); - -/** - * Get the overall offset from the chart's side to the center of the first point. - * In case of a bar chart it will be the center of the first column group - * @param obj pointer to a chart object - * @return the offset of the center - */ -int32_t lv_chart_get_first_point_center_offset(lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_CHART*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CHART_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/chart/lv_chart_private.h b/src/widgets/chart/lv_chart_private.h index b2f0bcc42a..cf1a0a51f6 100644 --- a/src/widgets/chart/lv_chart_private.h +++ b/src/widgets/chart/lv_chart_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_chart.h" +#include "../../lv_public_api.h" -#if LV_USE_CHART != 0 +#if LV_USE_CHART /********************* * DEFINES diff --git a/src/widgets/checkbox/lv_checkbox.c b/src/widgets/checkbox/lv_checkbox.c index df8de7289d..333b3585a0 100644 --- a/src/widgets/checkbox/lv_checkbox.c +++ b/src/widgets/checkbox/lv_checkbox.c @@ -6,17 +6,15 @@ /********************* * INCLUDES *********************/ + #include "lv_checkbox_private.h" + +#if LV_USE_CHECKBOX + #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_CHECKBOX != 0 - -#include "../../misc/lv_assert.h" #include "../../misc/lv_text_private.h" #include "../../misc/lv_text_ap.h" -#include "../../core/lv_group.h" -#include "../../draw/lv_draw.h" -#include "../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/widgets/checkbox/lv_checkbox.h b/src/widgets/checkbox/lv_checkbox.h index 0ca1fac069..268f9ea8b2 100644 --- a/src/widgets/checkbox/lv_checkbox.h +++ b/src/widgets/checkbox/lv_checkbox.h @@ -1,86 +1,2 @@ -/** - * @file lv_checkbox.h - * - */ - -#ifndef LV_CHECKBOX_H -#define LV_CHECKBOX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../core/lv_obj.h" - -#if LV_USE_CHECKBOX != 0 - -/********************* - * DEFINES - *********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_checkbox_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_checkbox_id_t { - LV_PROPERTY_ID(CHECKBOX, TEXT, LV_PROPERTY_TYPE_TEXT, 0), - LV_PROPERTY_CHECKBOX_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a check box object - * @param parent pointer to an object, it will be the parent of the new button - * @return pointer to the created check box - */ -lv_obj_t * lv_checkbox_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the text of a check box. `txt` will be copied and may be deallocated - * after this function returns. - * @param obj pointer to a check box - * @param txt the text of the check box. NULL to refresh with the current text. - */ -void lv_checkbox_set_text(lv_obj_t * obj, const char * txt); - -/** - * Set the text of a check box. `txt` must not be deallocated during the life - * of this checkbox. - * @param obj pointer to a check box - * @param txt the text of the check box. - */ -void lv_checkbox_set_text_static(lv_obj_t * obj, const char * txt); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the text of a check box - * @param obj pointer to check box object - * @return pointer to the text of the check box - */ -const char * lv_checkbox_get_text(const lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_CHECKBOX*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_CHECKBOX_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/checkbox/lv_checkbox_private.h b/src/widgets/checkbox/lv_checkbox_private.h index a7167c9dee..588a90b171 100644 --- a/src/widgets/checkbox/lv_checkbox_private.h +++ b/src/widgets/checkbox/lv_checkbox_private.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_checkbox.h" - -#if LV_USE_CHECKBOX != 0 #include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" + +#if LV_USE_CHECKBOX /********************* * DEFINES diff --git a/src/widgets/dropdown/lv_dropdown.c b/src/widgets/dropdown/lv_dropdown.c index ce23b4c319..2372383562 100644 --- a/src/widgets/dropdown/lv_dropdown.c +++ b/src/widgets/dropdown/lv_dropdown.c @@ -6,24 +6,17 @@ /********************* * INCLUDES *********************/ + #include "lv_dropdown_private.h" + +#if LV_USE_DROPDOWN + #include "../../misc/lv_area_private.h" #include "../../core/lv_obj_class_private.h" -#include "../../core/lv_obj.h" -#if LV_USE_DROPDOWN != 0 - -#include "../../misc/lv_assert.h" #include "../../draw/lv_draw_private.h" -#include "../../core/lv_group.h" -#include "../../indev/lv_indev.h" -#include "../../display/lv_display.h" -#include "../../font/lv_symbol_def.h" -#include "../../misc/lv_anim.h" -#include "../../misc/lv_math.h" #include "../../misc/lv_text_ap.h" #include "../../misc/lv_text_private.h" #include "../../core/lv_observer_private.h" -#include "../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/widgets/dropdown/lv_dropdown.h b/src/widgets/dropdown/lv_dropdown.h index 4803884434..7ca0b875a7 100644 --- a/src/widgets/dropdown/lv_dropdown.h +++ b/src/widgets/dropdown/lv_dropdown.h @@ -1,266 +1,2 @@ -/** - * @file lv_dropdown.h - * - */ - -#ifndef LV_DROPDOWN_H -#define LV_DROPDOWN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_DROPDOWN != 0 - -/*Testing of dependencies*/ - -#if LV_USE_LABEL == 0 -#error "lv_dropdown: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" -#endif - -#include "../label/lv_label.h" - -/********************* - * DEFINES - *********************/ -#define LV_DROPDOWN_POS_LAST 0xFFFF -LV_EXPORT_CONST_INT(LV_DROPDOWN_POS_LAST); - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_dropdown_id_t { - LV_PROPERTY_ID(DROPDOWN, TEXT, LV_PROPERTY_TYPE_TEXT, 0), - LV_PROPERTY_ID(DROPDOWN, OPTIONS, LV_PROPERTY_TYPE_TEXT, 1), - LV_PROPERTY_ID(DROPDOWN, OPTION_COUNT, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(DROPDOWN, SELECTED, LV_PROPERTY_TYPE_INT, 3), - // LV_PROPERTY_ID(DROPDOWN, SELECTED_STR, LV_PROPERTY_TYPE_TEXT, 4), - LV_PROPERTY_ID(DROPDOWN, DIR, LV_PROPERTY_TYPE_INT, 5), - LV_PROPERTY_ID(DROPDOWN, SYMBOL, LV_PROPERTY_TYPE_IMGSRC, 6), - LV_PROPERTY_ID(DROPDOWN, SELECTED_HIGHLIGHT, LV_PROPERTY_TYPE_INT, 7), - LV_PROPERTY_ID(DROPDOWN, LIST, LV_PROPERTY_TYPE_OBJ, 8), - LV_PROPERTY_ID(DROPDOWN, IS_OPEN, LV_PROPERTY_TYPE_BOOL, 9), - LV_PROPERTY_DROPDOWN_END, -}; -#endif - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_dropdown_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_dropdownlist_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a drop-down list object - * @param parent pointer to an object, it will be the parent of the new drop-down list - * @return pointer to the created drop-down list - */ -lv_obj_t * lv_dropdown_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set text of the drop-down list's button. - * If set to `NULL` the selected option's text will be displayed on the button. - * If set to a specific text then that text will be shown regardless of the selected option. - * @param obj pointer to a drop-down list object - * @param text the text as a string (Copy is saved) - */ -void lv_dropdown_set_text(lv_obj_t * obj, const char * text); - -/** - * Set text of the drop-down list's button. - * If set to `NULL` the selected option's text will be displayed on the button. - * If set to a specific text then that text will be shown regardless of the selected option. - * @param obj pointer to a drop-down list object - * @param text the text as a string (Only its pointer is saved) - */ -void lv_dropdown_set_text_static(lv_obj_t * obj, const char * text); - -/** - * Set the options in a drop-down list from a string. - * The options will be copied and saved in the object so the `options` can be destroyed after calling this function - * @param obj pointer to drop-down list object - * @param options a string with '\n' separated options. E.g. "One\nTwo\nThree" - */ -void lv_dropdown_set_options(lv_obj_t * obj, const char * options); - -/** - * Set the options in a drop-down list from a static string (global, static or dynamically allocated). - * Only the pointer of the option string will be saved. - * @param obj pointer to drop-down list object - * @param options a static string with '\n' separated options. E.g. "One\nTwo\nThree" - */ -void lv_dropdown_set_options_static(lv_obj_t * obj, const char * options); - -/** - * Add an options to a drop-down list from a string. Only works for non-static options. - * @param obj pointer to drop-down list object - * @param option a string without '\n'. E.g. "Four" - * @param pos the insert position, indexed from 0, LV_DROPDOWN_POS_LAST = end of string - */ -void lv_dropdown_add_option(lv_obj_t * obj, const char * option, uint32_t pos); - -/** - * Clear all options in a drop-down list. Works with both static and dynamic options. - * @param obj pointer to drop-down list object - */ -void lv_dropdown_clear_options(lv_obj_t * obj); - -/** - * Set the selected option - * @param obj pointer to drop-down list object - * @param sel_opt id of the selected option (0 ... number of option - 1); - */ -void lv_dropdown_set_selected(lv_obj_t * obj, uint32_t sel_opt); - -/** - * Set the direction of the a drop-down list - * @param obj pointer to a drop-down list object - * @param dir LV_DIR_LEFT/RIGHT/TOP/BOTTOM - */ -void lv_dropdown_set_dir(lv_obj_t * obj, lv_dir_t dir); - -/** - * Set an arrow or other symbol to display when on drop-down list's button. Typically a down caret or arrow. - * @param obj pointer to drop-down list object - * @param symbol a text like `LV_SYMBOL_DOWN`, an image (pointer or path) or NULL to not draw symbol icon - * @note angle and zoom transformation can be applied if the symbol is an image. - * E.g. when drop down is checked (opened) rotate the symbol by 180 degree - */ -void lv_dropdown_set_symbol(lv_obj_t * obj, const void * symbol); - -/** - * Set whether the selected option in the list should be highlighted or not - * @param obj pointer to drop-down list object - * @param en true: highlight enabled; false: disabled - */ -void lv_dropdown_set_selected_highlight(lv_obj_t * obj, bool en); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the list of a drop-down to allow styling or other modifications - * @param obj pointer to a drop-down list object - * @return pointer to the list of the drop-down - */ -lv_obj_t * lv_dropdown_get_list(lv_obj_t * obj); - -/** - * Get text of the drop-down list's button. - * @param obj pointer to a drop-down list object - * @return the text as string, `NULL` if no text - */ -const char * lv_dropdown_get_text(lv_obj_t * obj); - -/** - * Get the options of a drop-down list - * @param obj pointer to drop-down list object - * @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3") - */ -const char * lv_dropdown_get_options(const lv_obj_t * obj); - -/** - * Get the index of the selected option - * @param obj pointer to drop-down list object - * @return index of the selected option (0 ... number of option - 1); - */ -uint32_t lv_dropdown_get_selected(const lv_obj_t * obj); - -/** - * Get the total number of options - * @param obj pointer to drop-down list object - * @return the total number of options in the list - */ -uint32_t lv_dropdown_get_option_count(const lv_obj_t * obj); - -/** - * Get the current selected option as a string - * @param obj pointer to drop-down object - * @param buf pointer to an array to store the string - * @param buf_size size of `buf` in bytes. 0: to ignore it. - */ -void lv_dropdown_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size); - -/** - * Get the index of an option. - * @param obj pointer to drop-down object - * @param option an option as string - * @return index of `option` in the list of all options. -1 if not found. - */ -int32_t lv_dropdown_get_option_index(lv_obj_t * obj, const char * option); - -/** - * Get the symbol on the drop-down list. Typically a down caret or arrow. - * @param obj pointer to drop-down list object - * @return the symbol or NULL if not enabled - */ -const char * lv_dropdown_get_symbol(lv_obj_t * obj); - -/** - * Get whether the selected option in the list should be highlighted or not - * @param obj pointer to drop-down list object - * @return true: highlight enabled; false: disabled - */ -bool lv_dropdown_get_selected_highlight(lv_obj_t * obj); - -/** - * Get the direction of the drop-down list - * @param obj pointer to a drop-down list object - * @return LV_DIR_LEF/RIGHT/TOP/BOTTOM - */ -lv_dir_t lv_dropdown_get_dir(const lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -/** - * Open the drop.down list - * @param dropdown_obj pointer to drop-down list object - */ -void lv_dropdown_open(lv_obj_t * dropdown_obj); - -/** - * Close (Collapse) the drop-down list - * @param obj pointer to drop-down list object - */ -void lv_dropdown_close(lv_obj_t * obj); - -/** - * Tells whether the list is opened or not - * @param obj pointer to a drop-down list object - * @return true if the list os opened - */ -bool lv_dropdown_is_open(lv_obj_t * obj); - - -#if LV_USE_OBSERVER -/** - * Bind an integer Subject to a Dropdown's value. - * @param obj pointer to Dropdown - * @param subject pointer to Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_dropdown_bind_value(lv_obj_t * obj, lv_subject_t * subject); -#endif - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_DROPDOWN*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DROPDOWN_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/dropdown/lv_dropdown_private.h b/src/widgets/dropdown/lv_dropdown_private.h index b50883fc07..275144bd63 100644 --- a/src/widgets/dropdown/lv_dropdown_private.h +++ b/src/widgets/dropdown/lv_dropdown_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_dropdown.h" +#include "../../lv_public_api.h" -#if LV_USE_DROPDOWN != 0 +#if LV_USE_DROPDOWN /********************* * DEFINES diff --git a/src/widgets/gif/lv_gif.c b/src/widgets/gif/lv_gif.c index cdef1698f7..e16befff1a 100644 --- a/src/widgets/gif/lv_gif.c +++ b/src/widgets/gif/lv_gif.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_gif.h" +#include "../../lv_public_api.h" #if LV_USE_GIF #include "../../misc/lv_timer_private.h" diff --git a/src/widgets/gif/lv_gif.h b/src/widgets/gif/lv_gif.h index e1948cc12a..22d17d726d 100644 --- a/src/widgets/gif/lv_gif.h +++ b/src/widgets/gif/lv_gif.h @@ -1,138 +1,2 @@ -/** - * @file lv_gif.h - * - */ - -#ifndef LV_GIF_H -#define LV_GIF_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../lv_conf_internal.h" - -#if LV_USE_GIF - -#include "../../misc/lv_color.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_gif_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a gif object - * @param parent pointer to an object, it will be the parent of the new gif. - * @return pointer to the gif obj - */ -lv_obj_t * lv_gif_create(lv_obj_t * parent); - -/** - * Set the color format of the internally allocated framebuffer that the gif - * will be decoded to. The default is LV_COLOR_FORMAT_ARGB8888. - * Call this before `lv_gif_set_src` to avoid reallocating the framebuffer. - * @param obj pointer to a gif object - * @param color_format the color format of the gif framebuffer - */ -void lv_gif_set_color_format(lv_obj_t * obj, lv_color_format_t color_format); - -/** - * Set the gif data to display on the object - * @param obj pointer to a gif object - * @param src 1) pointer to an ::lv_image_dsc_t descriptor (which contains gif raw data) or - * 2) path to a gif file (e.g. "S:/dir/anim.gif") - */ -void lv_gif_set_src(lv_obj_t * obj, const void * src); - -/** - * Restart a gif animation. - * @param obj pointer to a gif obj - */ -void lv_gif_restart(lv_obj_t * obj); - -/** - * Pause a gif animation. - * @param obj pointer to a gif obj - */ -void lv_gif_pause(lv_obj_t * obj); - -/** - * Resume a gif animation. - * @param obj pointer to a gif obj - */ -void lv_gif_resume(lv_obj_t * obj); - -/** - * Checks if the GIF was loaded correctly. - * @param obj pointer to a gif obj - */ -bool lv_gif_is_loaded(lv_obj_t * obj); - -/** - * Get the loop count for the GIF. - * @param obj pointer to a gif obj - */ -int32_t lv_gif_get_loop_count(lv_obj_t * obj); - -/** - * Set the loop count for the GIF. - * @param obj pointer to a gif obj - * @param count the loop count to set - */ -void lv_gif_set_loop_count(lv_obj_t * obj, int32_t count); - -/** - * Set whether to decode invisible object. - * @param obj pointer to a gif object - * @param auto_pause true: auto pause when invisible, false: don't auto pause - */ -void lv_gif_set_auto_pause_invisible(lv_obj_t * obj, bool auto_pause); - -/** - * Get gif width & height - * @param src pointer to a gif file - * @param w pointer to store width - * @param h pointer to store height - * @return true: success; false: failed - */ -bool lv_gif_get_size(const char * src, uint16_t * w, uint16_t * h); - -/** - * Get frame count of the GIF. - * @param obj pointer to a gif object - * @return frame count of the GIF - */ -int32_t lv_gif_get_frame_count(lv_obj_t * obj); - -/** - * Get the current frame index of the GIF. - * @param obj pointer to a gif object - * @return current frame index of the GIF - */ -int32_t lv_gif_get_current_frame_index(lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GIF*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_GIF_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/image/lv_image.c b/src/widgets/image/lv_image.c index bb5ae693eb..9d28607a5d 100644 --- a/src/widgets/image/lv_image.c +++ b/src/widgets/image/lv_image.c @@ -7,6 +7,9 @@ * INCLUDES *********************/ #include "lv_image_private.h" + +#if LV_USE_IMAGE != 0 + #include "../../misc/lv_area_private.h" #include "../../misc/lv_text_private.h" #include "../../draw/lv_draw_image_private.h" @@ -17,10 +20,6 @@ #include "../../core/lv_obj_class_private.h" #include "../../core/lv_observer_private.h" -#if LV_USE_IMAGE != 0 - -#include "../../stdlib/lv_string.h" - /********************* * DEFINES *********************/ diff --git a/src/widgets/image/lv_image.h b/src/widgets/image/lv_image.h index a057aba512..d28147baf3 100644 --- a/src/widgets/image/lv_image.h +++ b/src/widgets/image/lv_image.h @@ -1,366 +1,2 @@ -/** - * @file lv_image.h - * - */ - -#ifndef LV_IMAGE_H -#define LV_IMAGE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_IMAGE != 0 - -/*Testing of dependencies*/ -#if LV_USE_LABEL == 0 -#error "lv_img: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" -#endif - -#include "../../core/lv_obj.h" -#include "../../misc/lv_fs.h" -#include "../../draw/lv_draw.h" -#include "../../core/lv_observer.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_image_class; - -/** - * Image size mode, when image size and object size is different - */ -typedef enum { - LV_IMAGE_ALIGN_DEFAULT = 0, - LV_IMAGE_ALIGN_TOP_LEFT, - LV_IMAGE_ALIGN_TOP_MID, - LV_IMAGE_ALIGN_TOP_RIGHT, - LV_IMAGE_ALIGN_BOTTOM_LEFT, - LV_IMAGE_ALIGN_BOTTOM_MID, - LV_IMAGE_ALIGN_BOTTOM_RIGHT, - LV_IMAGE_ALIGN_LEFT_MID, - LV_IMAGE_ALIGN_RIGHT_MID, - LV_IMAGE_ALIGN_CENTER, - _LV_IMAGE_ALIGN_AUTO_TRANSFORM, /**< Marks the start of modes that transform the image*/ - LV_IMAGE_ALIGN_STRETCH, /**< Set X and Y scale to fill the Widget's area. */ - LV_IMAGE_ALIGN_TILE, /**< Tile image to fill Widget's area. Offset is applied to shift the tiling. */ - LV_IMAGE_ALIGN_CONTAIN, /**< The image keeps its aspect ratio, but is resized to the maximum size that fits within the Widget's area. */ - LV_IMAGE_ALIGN_COVER, /**< The image keeps its aspect ratio and fills the Widget's area. */ -} lv_image_align_t; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_image_id_t { - LV_PROPERTY_ID(IMAGE, SRC, LV_PROPERTY_TYPE_IMGSRC, 0), - LV_PROPERTY_ID(IMAGE, OFFSET_X, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(IMAGE, OFFSET_Y, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(IMAGE, ROTATION, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_ID(IMAGE, PIVOT, LV_PROPERTY_TYPE_POINT, 4), - LV_PROPERTY_ID(IMAGE, SCALE, LV_PROPERTY_TYPE_INT, 5), - LV_PROPERTY_ID(IMAGE, SCALE_X, LV_PROPERTY_TYPE_INT, 6), - LV_PROPERTY_ID(IMAGE, SCALE_Y, LV_PROPERTY_TYPE_INT, 7), - LV_PROPERTY_ID(IMAGE, BLEND_MODE, LV_PROPERTY_TYPE_INT, 8), - LV_PROPERTY_ID(IMAGE, ANTIALIAS, LV_PROPERTY_TYPE_INT, 9), - LV_PROPERTY_ID(IMAGE, INNER_ALIGN, LV_PROPERTY_TYPE_INT, 10), - LV_PROPERTY_IMAGE_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an image object - * @param parent pointer to an object, it will be the parent of the new image - * @return pointer to the created image - */ -lv_obj_t * lv_image_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the image data to display on the object - * @param obj pointer to an image object - * @param src 1) pointer to an ::lv_image_dsc_t descriptor (converted by LVGL's image converter) (e.g. &my_img) or - * 2) path to an image file (e.g. "S:/dir/img.bin")or - * 3) a SYMBOL (e.g. LV_SYMBOL_OK) - */ -void lv_image_set_src(lv_obj_t * obj, const void * src); - -/** - * Set an offset for the source of an image so the image will be displayed from the new origin. - * @param obj pointer to an image - * @param x the new offset along x axis. - */ -void lv_image_set_offset_x(lv_obj_t * obj, int32_t x); - -/** - * Set an offset for the source of an image. - * so the image will be displayed from the new origin. - * @param obj pointer to an image - * @param y the new offset along y axis. - */ -void lv_image_set_offset_y(lv_obj_t * obj, int32_t y); - -/** - * Set the rotation angle of the image. - * The image will be rotated around the set pivot set by `lv_image_set_pivot()` - * Note that indexed and alpha only images can't be transformed. - * @param obj pointer to an image object - * @param angle rotation in degree with 0.1 degree resolution (0..3600: clock wise) - * @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT` - * rotation will be set to 0 automatically. - * - */ -void lv_image_set_rotation(lv_obj_t * obj, int32_t angle); - -/** - * Set the rotation center of the image. - * The image will be rotated around this point. - * x, y can be set with value of LV_PCT, lv_image_get_pivot will return the true pixel coordinate of pivot in this case. - * @param obj pointer to an image object - * @param x rotation center x of the image - * @param y rotation center y of the image - */ -void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y); - -/** - * Set the rotation horizontal center of the image. - * @param obj pointer to an image object - * @param x rotation center x of the image, or lv_pct() - */ -void lv_image_set_pivot_x(lv_obj_t * obj, int32_t x); - -/** - * Set the rotation vertical center of the image. - * @param obj pointer to an image object - * @param y rotation center y of the image, or lv_pct() - */ -void lv_image_set_pivot_y(lv_obj_t * obj, int32_t y); - -/** - * Set the zoom factor of the image. - * Note that indexed and alpha only images can't be transformed. - * @param obj pointer to an image object - * @param zoom the zoom factor. Example values: - * - 256 or LV_SCALE_NONE: no zoom - * - <256: scale down - * - >256: scale up - * - 128: half size - * - 512: double size - */ -void lv_image_set_scale(lv_obj_t * obj, uint32_t zoom); - -/** - * Set the horizontal zoom factor of the image. - * Note that indexed and alpha only images can't be transformed. - * @param obj pointer to an image object - * @param zoom the zoom factor. Example values: - * - 256 or LV_SCALE_NONE: no zoom - * - <256: scale down - * - >256: scale up - * - 128: half size - * - 512: double size - */ -void lv_image_set_scale_x(lv_obj_t * obj, uint32_t zoom); - -/** - * Set the vertical zoom factor of the image. - * Note that indexed and alpha only images can't be transformed. - * @param obj pointer to an image object - * @param zoom the zoom factor. Example values: - * - 256 or LV_SCALE_NONE: no zoom - * - <256: scale down - * - >256: scale up - * - 128: half size - * - 512: double size - */ -void lv_image_set_scale_y(lv_obj_t * obj, uint32_t zoom); - -/** - * Set the blend mode of an image. - * @param obj pointer to an image object - * @param blend_mode the new blend mode - */ -void lv_image_set_blend_mode(lv_obj_t * obj, lv_blend_mode_t blend_mode); - -/** - * Enable/disable anti-aliasing for the transformations (rotate, zoom) or not. - * The quality is better with anti-aliasing looks better but slower. - * @param obj pointer to an image object - * @param antialias true: anti-aliased; false: not anti-aliased - */ -void lv_image_set_antialias(lv_obj_t * obj, bool antialias); - -/** - * Set the image object size mode. - * @param obj pointer to an image object - * @param align the new align mode. - * @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT` - * rotation, scale and pivot will be overwritten and controlled internally. - */ -void lv_image_set_inner_align(lv_obj_t * obj, lv_image_align_t align); - -/** - * Set an A8 bitmap mask for the image. - * @param obj pointer to an image object - * @param src an lv_image_dsc_t bitmap mask source. - */ -void lv_image_set_bitmap_map_src(lv_obj_t * obj, const lv_image_dsc_t * src); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the source of the image - * @param obj pointer to an image object - * @return the image source (symbol, file name or ::lv-img_dsc_t for C arrays) - */ -const void * lv_image_get_src(lv_obj_t * obj); - -/** - * Get the offset's x attribute of the image object. - * @param obj pointer to an image - * @return offset X value. - */ -int32_t lv_image_get_offset_x(lv_obj_t * obj); - -/** - * Get the offset's y attribute of the image object. - * @param obj pointer to an image - * @return offset Y value. - */ -int32_t lv_image_get_offset_y(lv_obj_t * obj); - -/** - * Get the rotation of the image. - * @param obj pointer to an image object - * @return rotation in 0.1 degrees (0..3600) - * @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT` - * rotation will be set to 0 automatically. - */ -int32_t lv_image_get_rotation(lv_obj_t * obj); - -/** - * Get the pivot (rotation center) of the image. - * If pivot is set with LV_PCT, convert it to px before return. - * @param obj pointer to an image object - * @param pivot store the rotation center here - */ -void lv_image_get_pivot(lv_obj_t * obj, lv_point_t * pivot); - -/** - * Get the zoom factor of the image. - * @param obj pointer to an image object - * @return zoom factor (256: no zoom) - */ -int32_t lv_image_get_scale(lv_obj_t * obj); - -/** - * Get the horizontal zoom factor of the image. - * @param obj pointer to an image object - * @return zoom factor (256: no zoom) - */ -int32_t lv_image_get_scale_x(lv_obj_t * obj); - -/** - * Get the vertical zoom factor of the image. - * @param obj pointer to an image object - * @return zoom factor (256: no zoom) - */ -int32_t lv_image_get_scale_y(lv_obj_t * obj); - -/** - * Get the width of an image before any transformations. - * @param obj Pointer to an image object. - * @return The width of the image. - */ -int32_t lv_image_get_src_width(lv_obj_t * obj); - -/** - * Get the height of an image before any transformations. - * @param obj Pointer to an image object. - * @return The height of the image. - */ -int32_t lv_image_get_src_height(lv_obj_t * obj); - -/** - * Get the transformed width of an image object. - * @param obj Pointer to an image object. - * @return The transformed width of the image. - */ -int32_t lv_image_get_transformed_width(lv_obj_t * obj); - -/** - * Get the transformed height of an image object. - * @param obj Pointer to an image object. - * @return The transformed height of the image. - */ -int32_t lv_image_get_transformed_height(lv_obj_t * obj); - -/** - * Get the current blend mode of the image - * @param obj pointer to an image object - * @return the current blend mode - */ -lv_blend_mode_t lv_image_get_blend_mode(lv_obj_t * obj); - -/** - * Get whether the transformations (rotate, zoom) are anti-aliased or not - * @param obj pointer to an image object - * @return true: anti-aliased; false: not anti-aliased - */ -bool lv_image_get_antialias(lv_obj_t * obj); - -/** - * Get the size mode of the image - * @param obj pointer to an image object - * @return element of `lv_image_align_t` - */ -lv_image_align_t lv_image_get_inner_align(lv_obj_t * obj); - -/** - * Get the bitmap mask source. - * @param obj pointer to an image object - * @return an lv_image_dsc_t bitmap mask source. - */ -const lv_image_dsc_t * lv_image_get_bitmap_map_src(lv_obj_t * obj); - - -#if LV_USE_OBSERVER -/** - * Bind a pointer Subject to an Image's source. - * @param obj pointer to Image - * @param subject pointer to Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_image_bind_src(lv_obj_t * obj, lv_subject_t * subject); -#endif - -/********************** - * MACROS - **********************/ - -/** Use this macro to declare an image in a C file*/ -#define LV_IMAGE_DECLARE(var_name) extern const lv_image_dsc_t var_name - -#endif /*LV_USE_IMAGE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_IMAGE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/image/lv_image_private.h b/src/widgets/image/lv_image_private.h index 4ae9507248..f7a7c6d60f 100644 --- a/src/widgets/image/lv_image_private.h +++ b/src/widgets/image/lv_image_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_image.h" +#include "../../lv_public_api.h" -#if LV_USE_IMAGE != 0 +#if LV_USE_IMAGE /********************* * DEFINES diff --git a/src/widgets/imagebutton/lv_imagebutton.c b/src/widgets/imagebutton/lv_imagebutton.c index 9ac89fc3d0..f5c4e612aa 100644 --- a/src/widgets/imagebutton/lv_imagebutton.c +++ b/src/widgets/imagebutton/lv_imagebutton.c @@ -7,17 +7,15 @@ * INCLUDES *********************/ #include "lv_imagebutton_private.h" + +#if LV_USE_IMAGEBUTTON + #include "../../misc/lv_area_private.h" #include "../../draw/lv_draw_private.h" #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_event_private.h" #include "../../core/lv_obj_class_private.h" - -#if LV_USE_IMAGEBUTTON != 0 - -#include "../../stdlib/lv_string.h" - /********************* * DEFINES *********************/ diff --git a/src/widgets/imagebutton/lv_imagebutton.h b/src/widgets/imagebutton/lv_imagebutton.h index b3b877c15e..b25f312c28 100644 --- a/src/widgets/imagebutton/lv_imagebutton.h +++ b/src/widgets/imagebutton/lv_imagebutton.h @@ -1,148 +1,2 @@ -/** - * @file lv_imagebutton.h - * - */ - -#ifndef LV_IMAGEBUTTON_H -#define LV_IMAGEBUTTON_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" - -#if LV_USE_IMAGEBUTTON != 0 - -/********************* - * DEFINES - *********************/ -typedef enum { - LV_IMAGEBUTTON_STATE_RELEASED, - LV_IMAGEBUTTON_STATE_PRESSED, - LV_IMAGEBUTTON_STATE_DISABLED, - LV_IMAGEBUTTON_STATE_CHECKED_RELEASED, - LV_IMAGEBUTTON_STATE_CHECKED_PRESSED, - LV_IMAGEBUTTON_STATE_CHECKED_DISABLED, - LV_IMAGEBUTTON_STATE_NUM, -} lv_imagebutton_state_t; - -/********************** - * TYPEDEFS - **********************/ -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_imagebutton_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an image button object - * @param parent pointer to an object, it will be the parent of the new image button - * @return pointer to the created image button - */ -lv_obj_t * lv_imagebutton_create(lv_obj_t * parent); - -/*====================== - * Add/remove functions - *=====================*/ - -/*===================== - * Setter functions - *====================*/ - -/** - * Set images for a state of the image button - * @param obj pointer to an image button object - * @param state for which state set the new image - * @param src_left pointer to an image source for the left side of the button (a C array or path to - * a file) - * @param src_mid pointer to an image source for the middle of the button (ideally 1px wide) (a C - * array or path to a file) - * @param src_right pointer to an image source for the right side of the button (a C array or path - * to a file) - */ -void lv_imagebutton_set_src(lv_obj_t * obj, lv_imagebutton_state_t state, const void * src_left, - const void * src_mid, - const void * src_right); - -/** - * Set the left image for a state of the image button - * @param obj pointer to an image button object - * @param state for which state set the new image - * @param src_left pointer to an image source for the left side of the button - * (a C array or path to a file) - */ -void lv_imagebutton_set_src_left(lv_obj_t * obj, lv_imagebutton_state_t state, const void * src_left); - -/** - * Set the right image for a state of the image button - * @param obj pointer to an image button object - * @param state for which state set the new image - * @param src_right pointer to an image source for the right side of the button - * (a C array or path to a file) - */ -void lv_imagebutton_set_src_right(lv_obj_t * obj, lv_imagebutton_state_t state, const void * src_right); - -/** - * Set the middle image for a state of the image button - * @param obj pointer to an image button object - * @param state for which state set the new image - * @param src_mid pointer to an image source for the middle of the button - * (a C array or path to a file) - */ -void lv_imagebutton_set_src_mid(lv_obj_t * obj, lv_imagebutton_state_t state, const void * src_mid); - -/** - * Use this function instead of `lv_obj_add/remove_state` to set a state manually - * @param obj pointer to an image button object - * @param state the new state - */ -void lv_imagebutton_set_state(lv_obj_t * obj, lv_imagebutton_state_t state); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the left image in a given state - * @param obj pointer to an image button object - * @param state the state where to get the image (from `lv_button_state_t`) ` - * @return pointer to the left image source (a C array or path to a file) - */ -const void * lv_imagebutton_get_src_left(lv_obj_t * obj, lv_imagebutton_state_t state); - -/** - * Get the middle image in a given state - * @param obj pointer to an image button object - * @param state the state where to get the image (from `lv_button_state_t`) ` - * @return pointer to the middle image source (a C array or path to a file) - */ -const void * lv_imagebutton_get_src_middle(lv_obj_t * obj, lv_imagebutton_state_t state); - -/** - * Get the right image in a given state - * @param obj pointer to an image button object - * @param state the state where to get the image (from `lv_button_state_t`) ` - * @return pointer to the left image source (a C array or path to a file) - */ -const void * lv_imagebutton_get_src_right(lv_obj_t * obj, lv_imagebutton_state_t state); - -/*===================== - * Other functions - *====================*/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_IMAGEBUTTON*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_IMAGEBUTTON_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/imagebutton/lv_imagebutton_private.h b/src/widgets/imagebutton/lv_imagebutton_private.h index 107f49df37..df90f64f88 100644 --- a/src/widgets/imagebutton/lv_imagebutton_private.h +++ b/src/widgets/imagebutton/lv_imagebutton_private.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_imagebutton.h" +#include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" #if LV_USE_IMAGEBUTTON != 0 -#include "../../core/lv_obj_private.h" /********************* * DEFINES diff --git a/src/widgets/ime/lv_ime_pinyin.h b/src/widgets/ime/lv_ime_pinyin.h index 0509b21272..9598b05695 100644 --- a/src/widgets/ime/lv_ime_pinyin.h +++ b/src/widgets/ime/lv_ime_pinyin.h @@ -1,121 +1,2 @@ -/** - * @file lv_ime_pinyin.h - * - */ -#ifndef LV_IME_PINYIN_H -#define LV_IME_PINYIN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../core/lv_obj.h" - -#if LV_USE_IME_PINYIN != 0 - -/********************* - * DEFINES - *********************/ -#define LV_IME_PINYIN_K9_MAX_INPUT 7 - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_IME_PINYIN_MODE_K26, - LV_IME_PINYIN_MODE_K9, - LV_IME_PINYIN_MODE_K9_NUMBER, -} lv_ime_pinyin_mode_t; - -/*Data of pinyin_dict*/ -typedef struct { - const char * const py; - const char * const py_mb; -} lv_pinyin_dict_t; - -/*Data of 9-key input(k9) mode*/ -typedef struct { - char py_str[7]; -} ime_pinyin_k9_py_str_t; - -/*********************** - * GLOBAL VARIABLES - ***********************/ - -extern const lv_obj_class_t lv_ime_pinyin_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ -lv_obj_t * lv_ime_pinyin_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the keyboard of Pinyin input method. - * @param obj pointer to a Pinyin input method object - * @param kb pointer to a Pinyin input method keyboard - */ -void lv_ime_pinyin_set_keyboard(lv_obj_t * obj, lv_obj_t * kb); - -/** - * Set the dictionary of Pinyin input method. - * @param obj pointer to a Pinyin input method object - * @param dict pointer to a Pinyin input method dictionary - */ -void lv_ime_pinyin_set_dict(lv_obj_t * obj, lv_pinyin_dict_t * dict); - -/** - * Set mode, 26-key input(k26) or 9-key input(k9). - * @param obj pointer to a Pinyin input method object - * @param mode the mode from 'lv_ime_pinyin_mode_t' - */ -void lv_ime_pinyin_set_mode(lv_obj_t * obj, lv_ime_pinyin_mode_t mode); - -/*===================== - * Getter functions - *====================*/ - -/** - * Set the dictionary of Pinyin input method. - * @param obj pointer to a Pinyin IME object - * @return pointer to the Pinyin IME keyboard - */ -lv_obj_t * lv_ime_pinyin_get_kb(lv_obj_t * obj); - -/** - * Set the dictionary of Pinyin input method. - * @param obj pointer to a Pinyin input method object - * @return pointer to the Pinyin input method candidate panel - */ -lv_obj_t * lv_ime_pinyin_get_cand_panel(lv_obj_t * obj); - -/** - * Set the dictionary of Pinyin input method. - * @param obj pointer to a Pinyin input method object - * @return pointer to the Pinyin input method dictionary - */ -const lv_pinyin_dict_t * lv_ime_pinyin_get_dict(lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_IME_PINYIN*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_IME_PINYIN_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/ime/lv_ime_pinyin_private.h b/src/widgets/ime/lv_ime_pinyin_private.h index f422438e52..06007193e7 100644 --- a/src/widgets/ime/lv_ime_pinyin_private.h +++ b/src/widgets/ime/lv_ime_pinyin_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_ime_pinyin.h" +#include "../../lv_public_api.h" -#if LV_USE_IME_PINYIN != 0 +#if LV_USE_IME_PINYIN /********************* * DEFINES diff --git a/src/widgets/keyboard/lv_keyboard.c b/src/widgets/keyboard/lv_keyboard.c index a581828632..2f09b02603 100644 --- a/src/widgets/keyboard/lv_keyboard.c +++ b/src/widgets/keyboard/lv_keyboard.c @@ -8,12 +8,10 @@ * INCLUDES *********************/ #include "lv_keyboard_private.h" -#include "../../core/lv_obj_class_private.h" + #if LV_USE_KEYBOARD -#include "../textarea/lv_textarea.h" -#include "../../misc/lv_assert.h" -#include "../../stdlib/lv_string.h" +#include "../../core/lv_obj_class_private.h" /*Testing of dependencies*/ #if LV_USE_BUTTONMATRIX == 0 diff --git a/src/widgets/keyboard/lv_keyboard.h b/src/widgets/keyboard/lv_keyboard.h index 85c3532020..f81d6ea4ae 100644 --- a/src/widgets/keyboard/lv_keyboard.h +++ b/src/widgets/keyboard/lv_keyboard.h @@ -1,175 +1,2 @@ -/** - * @file lv_keyboard.h - * - */ - -#ifndef LV_KEYBOARD_H -#define LV_KEYBOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../buttonmatrix/lv_buttonmatrix.h" - -#if LV_USE_KEYBOARD - -/********************* - * DEFINES - *********************/ -#define LV_KEYBOARD_CTRL_BUTTON_FLAGS (LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CLICK_TRIG | LV_BUTTONMATRIX_CTRL_CHECKED) - -/********************** - * TYPEDEFS - **********************/ - -/** Current keyboard mode.*/ -typedef enum { - LV_KEYBOARD_MODE_TEXT_LOWER, - LV_KEYBOARD_MODE_TEXT_UPPER, - LV_KEYBOARD_MODE_SPECIAL, - LV_KEYBOARD_MODE_NUMBER, - LV_KEYBOARD_MODE_USER_1, - LV_KEYBOARD_MODE_USER_2, - LV_KEYBOARD_MODE_USER_3, - LV_KEYBOARD_MODE_USER_4, -#if LV_USE_ARABIC_PERSIAN_CHARS == 1 - LV_KEYBOARD_MODE_TEXT_ARABIC -#endif -} lv_keyboard_mode_t; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_keyboard_id_t { - LV_PROPERTY_ID(KEYBOARD, TEXTAREA, LV_PROPERTY_TYPE_OBJ, 0), - LV_PROPERTY_ID(KEYBOARD, MODE, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(KEYBOARD, POPOVERS, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(KEYBOARD, SELECTED_BUTTON, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_KEYBOARD_END, -}; -#endif - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_keyboard_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a Keyboard object - * @param parent pointer to an object, it will be the parent of the new keyboard - * @return pointer to the created keyboard object - */ -lv_obj_t * lv_keyboard_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Assign a text area to the keyboard. Pressed characters will be inserted there. - * @param kb pointer to a keyboard object - * @param ta pointer to a text area object to write into - */ -void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta); - -/** - * Set a new mode (e.g., text, number, special characters). - * @param kb pointer to a keyboard object - * @param mode the desired mode (see 'lv_keyboard_mode_t') - */ -void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode); - -/** - * Enable or disable popovers showing button titles on press. - * @param kb pointer to a keyboard object - * @param en true to enable popovers; false to disable - */ -void lv_keyboard_set_popovers(lv_obj_t * kb, bool en); - -/** - * Set a custom button map for the keyboard. - * @param kb pointer to a keyboard object - * @param mode the mode to assign the new map to (see 'lv_keyboard_mode_t') - * @param map pointer to a string array describing the button map - * see 'lv_buttonmatrix_set_map()' for more details - * @param ctrl_map pointer to the control map. See 'lv_buttonmatrix_set_ctrl_map()' - - */ -void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * const map[], - const lv_buttonmatrix_ctrl_t ctrl_map[]); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the text area currently assigned to the keyboard. - * @param kb pointer to a keyboard object - * @return pointer to the assigned text area object - */ -lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb); - -/** - * Get the current mode of the keyboard. - * @param kb pointer to a keyboard object - * @return the current mode (see 'lv_keyboard_mode_t') - */ -lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb); - -/** - * Check whether popovers are enabled on the keyboard. - * @param obj pointer to a keyboard object - * @return true if popovers are enabled; false otherwise - */ -bool lv_keyboard_get_popovers(const lv_obj_t * obj); - -/** - * Get the current button map of the keyboard. - * @param kb pointer to a keyboard object - * @return pointer to the map array - */ -const char * const * lv_keyboard_get_map_array(const lv_obj_t * kb); - -/** - * Get the index of the last selected button (pressed, released, focused, etc.). - * Useful in the `event_cb` to retrieve button text or properties. - * @param obj pointer to a keyboard object - * @return index of the last interacted button - * returns LV_BUTTONMATRIX_BUTTON_NONE if not set - */ -uint32_t lv_keyboard_get_selected_button(const lv_obj_t * obj); - -/** - * Get the text of a button by index. - * @param obj pointer to a keyboard object - * @param btn_id index of the button (excluding newline characters) - * @return pointer to the text of the button - */ -const char * lv_keyboard_get_button_text(const lv_obj_t * obj, uint32_t btn_id); - -/*===================== - * Other functions - *====================*/ - -/** - * Default keyboard event callback to handle button presses. - * Adds characters to the text area and switches map if needed. - * If a custom `event_cb` is used, this function can be called within it. - * @param e the triggering event - */ -void lv_keyboard_def_event_cb(lv_event_t * e); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_KEYBOARD*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_KEYBOARD_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/keyboard/lv_keyboard_private.h b/src/widgets/keyboard/lv_keyboard_private.h index 3de02734a3..af349634f1 100644 --- a/src/widgets/keyboard/lv_keyboard_private.h +++ b/src/widgets/keyboard/lv_keyboard_private.h @@ -14,11 +14,13 @@ extern "C" { * INCLUDES *********************/ -#include "../buttonmatrix/lv_buttonmatrix_private.h" -#include "lv_keyboard.h" +#include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" #if LV_USE_KEYBOARD +#include "../buttonmatrix/lv_buttonmatrix_private.h" + /********************* * DEFINES *********************/ diff --git a/src/widgets/label/lv_label.c b/src/widgets/label/lv_label.c index c8524d09de..5962b331e1 100644 --- a/src/widgets/label/lv_label.c +++ b/src/widgets/label/lv_label.c @@ -7,25 +7,18 @@ * INCLUDES *********************/ #include "lv_label_private.h" +#if LV_USE_LABEL + #include "../../misc/lv_area_private.h" #include "../../misc/lv_anim_private.h" #include "../../draw/lv_draw_label_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_LABEL != 0 #include "../../core/lv_obj_private.h" -#include "../../misc/lv_assert.h" -#include "../../core/lv_group.h" -#include "../../display/lv_display.h" #include "../../draw/lv_draw_private.h" -#include "../../misc/lv_color.h" -#include "../../misc/lv_math.h" #include "../../misc/lv_bidi_private.h" #include "../../misc/lv_text_ap.h" #include "../../misc/lv_text_private.h" -#include "../../stdlib/lv_sprintf.h" -#include "../../stdlib/lv_string.h" #include "../../core/lv_observer_private.h" -#include "../../others/translation/lv_translation.h" /********************* * DEFINES diff --git a/src/widgets/label/lv_label.h b/src/widgets/label/lv_label.h index 92f846ac73..42bba1d3cd 100644 --- a/src/widgets/label/lv_label.h +++ b/src/widgets/label/lv_label.h @@ -1,289 +1,2 @@ -/** - * @file lv_label.h - * - */ - -#ifndef LV_LABEL_H -#define LV_LABEL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_LABEL != 0 - -#include "../../misc/lv_types.h" -#include "../../core/lv_obj.h" -#include "../../font/lv_font.h" -#include "../../font/lv_symbol_def.h" -#include "../../misc/lv_text.h" -#include "../../draw/lv_draw.h" -#include "../../core/lv_observer.h" - -/********************* - * DEFINES - *********************/ -#define LV_LABEL_DOT_NUM 3 -#define LV_LABEL_POS_LAST 0xFFFF -#define LV_LABEL_TEXT_SELECTION_OFF LV_DRAW_LABEL_NO_TXT_SEL -#if LV_WIDGETS_HAS_DEFAULT_VALUE -#define LV_LABEL_DEFAULT_TEXT "Text" -#else -#define LV_LABEL_DEFAULT_TEXT "" -#endif - -LV_EXPORT_CONST_INT(LV_LABEL_DOT_NUM); -LV_EXPORT_CONST_INT(LV_LABEL_POS_LAST); -LV_EXPORT_CONST_INT(LV_LABEL_TEXT_SELECTION_OFF); - -/********************** - * TYPEDEFS - **********************/ - -/** Long mode behaviors. Used in 'lv_label_ext_t'*/ -typedef enum { - LV_LABEL_LONG_MODE_WRAP, /**< Keep the object width, wrap lines longer than object width and expand the object height*/ - LV_LABEL_LONG_MODE_DOTS, /**< Keep the size and write dots at the end if the text is too long*/ - LV_LABEL_LONG_MODE_SCROLL, /**< Keep the size and roll the text back and forth*/ - LV_LABEL_LONG_MODE_SCROLL_CIRCULAR, /**< Keep the size and roll the text circularly*/ - LV_LABEL_LONG_MODE_CLIP, /**< Keep the size and clip the text out of it*/ -} lv_label_long_mode_t; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_label_id_t { - LV_PROPERTY_ID(LABEL, TEXT, LV_PROPERTY_TYPE_TEXT, 0), - LV_PROPERTY_ID(LABEL, LONG_MODE, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(LABEL, TEXT_SELECTION_START, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(LABEL, TEXT_SELECTION_END, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_LABEL_END, -}; -#endif - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_label_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a label object - * @param parent pointer to an object, it will be the parent of the new label. - * @return pointer to the created button - */ -lv_obj_t * lv_label_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set a new text for a label. Memory will be allocated to store the text by the label. - * @param obj pointer to a label object - * @param text '\0' terminated character string. NULL to refresh with the current text. - * @note If `LV_USE_ARABIC_PERSIAN_CHARS` is enabled the text will be modified to have the correct Arabic - * characters in it. - */ -void lv_label_set_text(lv_obj_t * obj, const char * text); - -/** - * Set a new formatted text for a label. Memory will be allocated to store the text by the label. - * @param obj pointer to a label object - * @param fmt `printf`-like format string - * Example: - * @code - * lv_label_set_text_fmt(label1, "%d user", user_num); - * @endcode - * @note If `LV_USE_ARABIC_PERSIAN_CHARS` is enabled the text will be modified to have the correct Arabic characters in it. - */ -void lv_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); - -/** - * Set a new formatted text for a label. Memory will be allocated to store the text by the label. - * @param obj pointer to a label object - * @param fmt `printf`-like format string - * @param args variadic arguments list - * - * Example: - * @code - * va_list args; - * va_start(args, fmt); - * lv_label_set_text_vfmt(label1, fmt, args); - * va_end(args); - * @endcode - * @note It ignores `LV_USE_ARABIC_PERSIAN_CHARS` - */ -void lv_label_set_text_vfmt(lv_obj_t * obj, const char * fmt, va_list args); - -/** - * Set a static text. It will not be saved by the label so the 'text' variable - * has to be 'alive' while the label exists. - * @param obj pointer to a label object - * @param text pointer to a text. NULL to refresh with the current text. - * @note It ignores `LV_USE_ARABIC_PERSIAN_CHARS` - */ -void lv_label_set_text_static(lv_obj_t * obj, const char * text); - -/** - * Set the behavior of the label with text longer than the object size - * @param obj pointer to a label object - * @param long_mode the new mode from 'lv_label_long_mode' enum. - * In LV_LONG_WRAP/DOT/SCROLL/SCROLL_CIRC the size of the label should be set AFTER this function - */ -void lv_label_set_long_mode(lv_obj_t * obj, lv_label_long_mode_t long_mode); - -/** - * Set where text selection should start - * @param obj pointer to a label object - * @param index character index from where selection should start. `LV_LABEL_TEXT_SELECTION_OFF` for no selection - */ -void lv_label_set_text_selection_start(lv_obj_t * obj, uint32_t index); - -/** - * Set where text selection should end - * @param obj pointer to a label object - * @param index character index where selection should end. `LV_LABEL_TEXT_SELECTION_OFF` for no selection - */ -void lv_label_set_text_selection_end(lv_obj_t * obj, uint32_t index); - -/** - * Enable the recoloring by in-line commands - * @param obj pointer to a label object - * @param en true: enable recoloring, false: disable - * Example: "This is a #ff0000 red# word" - */ -void lv_label_set_recolor(lv_obj_t * obj, bool en); - -#if LV_USE_TRANSLATION - -/** - * Assign a translation tag for this label. Memory will be allocated to store the tag by the label. - * The label text will automatically update when the language is changed via `lv_translation_set_language`. - * @param obj pointer to a label object - * @param tag '\0' terminated character string. - */ -void lv_label_set_translation_tag(lv_obj_t * obj, const char * tag); - -#endif /*LV_USE_TRANSLATION*/ - - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the text of a label - * @param obj pointer to a label object - * @return the text of the label - */ -char * lv_label_get_text(const lv_obj_t * obj); - -/** - * Get the long mode of a label - * @param obj pointer to a label object - * @return the current long mode - */ -lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * obj); - -/** - * Get the relative x and y coordinates of a letter - * @param obj pointer to a label object - * @param char_id index of the character [0 ... text length - 1]. - * Expressed in character index, not byte index (different in UTF-8) - * @param pos store the result here (E.g. index = 0 gives 0;0 coordinates if the text if aligned to the left) - */ -void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t * pos); - -/** - * Get the index of letter on a relative point of a label. - * @param obj pointer to label object - * @param pos_in pointer to point with coordinates on a the label - * @param bidi whether to use bidi processed - * @return The index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter if aligned to the left) - * Expressed in character index and not byte index (different in UTF-8) - */ -uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in, bool bidi); - -/** - * Check if a character is drawn under a point. - * @param obj pointer to a label object - * @param pos Point to check for character under - * @return whether a character is drawn under the point - */ -bool lv_label_is_char_under_pos(const lv_obj_t * obj, lv_point_t * pos); - -/** - * @brief Get the selection start index. - * @param obj pointer to a label object. - * @return selection start index. `LV_LABEL_TEXT_SELECTION_OFF` if nothing is selected. - */ -uint32_t lv_label_get_text_selection_start(const lv_obj_t * obj); - -/** - * @brief Get the selection end index. - * @param obj pointer to a label object. - * @return selection end index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected. - */ -uint32_t lv_label_get_text_selection_end(const lv_obj_t * obj); - -/** - * @brief Get the recoloring attribute - * @param obj pointer to a label object. - * @return true: recoloring is enabled, false: recoloring is disabled - */ -bool lv_label_get_recolor(const lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -#if LV_USE_OBSERVER -/** - * Bind an integer, string, or pointer Subject to a Label. - * @param obj pointer to Label - * @param subject pointer to Subject - * @param fmt optional printf-like format string with 1 format specifier (e.g. "%d °C") - * or NULL to bind to the value directly. - * @return pointer to newly-created Observer - * @note If `fmt == NULL` strings and pointers (`\0` terminated string) will be shown - * as text as they are, integers as %d, floats as %0.1f - */ -lv_observer_t * lv_label_bind_text(lv_obj_t * obj, lv_subject_t * subject, const char * fmt); -#endif - - -/** - * Insert a text to a label. The label text cannot be static. - * @param obj pointer to a label object - * @param pos character index to insert. Expressed in character index and not byte index. - * 0: before first char. LV_LABEL_POS_LAST: after last char. - * @param txt pointer to the text to insert - */ -void lv_label_ins_text(lv_obj_t * obj, uint32_t pos, const char * txt); - -/** - * Delete characters from a label. The label text cannot be static. - * @param obj pointer to a label object - * @param pos character index from where to cut. Expressed in character index and not byte index. - * 0: start in front of the first character - * @param cnt number of characters to cut - */ -void lv_label_cut_text(lv_obj_t * obj, uint32_t pos, uint32_t cnt); - - - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_LABEL*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_LABEL_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/label/lv_label_private.h b/src/widgets/label/lv_label_private.h index 8681a22dba..50736d309c 100644 --- a/src/widgets/label/lv_label_private.h +++ b/src/widgets/label/lv_label_private.h @@ -16,9 +16,9 @@ extern "C" { #include "../../draw/lv_draw_label_private.h" #include "../../core/lv_obj_private.h" -#include "lv_label.h" +#include "../../lv_public_api.h" -#if LV_USE_LABEL != 0 +#if LV_USE_LABEL /********************* * DEFINES diff --git a/src/widgets/led/lv_led.c b/src/widgets/led/lv_led.c index e4c5def74f..dcf96719d4 100644 --- a/src/widgets/led/lv_led.c +++ b/src/widgets/led/lv_led.c @@ -6,15 +6,13 @@ /********************* * INCLUDES *********************/ + #include "lv_led_private.h" -#include "../../core/lv_obj_private.h" -#include "../../core/lv_obj_class_private.h" #if LV_USE_LED -#include "../../misc/lv_assert.h" -#include "../../themes/lv_theme.h" -#include "../../misc/lv_color.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" /********************* * DEFINES diff --git a/src/widgets/led/lv_led.h b/src/widgets/led/lv_led.h index 9f15d37258..8fbc5d2dd8 100644 --- a/src/widgets/led/lv_led.h +++ b/src/widgets/led/lv_led.h @@ -1,114 +1,2 @@ -/** - * @file lv_led.h - * - */ - -#ifndef LV_LED_H -#define LV_LED_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" - -#if LV_USE_LED - -/********************* - * DEFINES - *********************/ -/** Brightness when the LED if OFF */ -#ifndef LV_LED_BRIGHT_MIN -# define LV_LED_BRIGHT_MIN 80 -#endif - -/** Brightness when the LED if ON */ -#ifndef LV_LED_BRIGHT_MAX -# define LV_LED_BRIGHT_MAX 255 -#endif - -/********************** - * TYPEDEFS - **********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_led_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_led_id_t { - LV_PROPERTY_ID(LED, COLOR, LV_PROPERTY_TYPE_COLOR, 0), - LV_PROPERTY_ID(LED, BRIGHTNESS, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_LED_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a led object - * @param parent pointer to an object, it will be the parent of the new led - * @return pointer to the created led - */ -lv_obj_t * lv_led_create(lv_obj_t * parent); - -/** - * Set the color of the LED - * @param led pointer to a LED object - * @param color the color of the LED - */ -void lv_led_set_color(lv_obj_t * led, lv_color_t color); - -/** - * Set the brightness of a LED object - * @param led pointer to a LED object - * @param bright LV_LED_BRIGHT_MIN (max. dark) ... LV_LED_BRIGHT_MAX (max. light) - */ -void lv_led_set_brightness(lv_obj_t * led, uint8_t bright); - -/** - * Light on a LED - * @param led pointer to a LED object - */ -void lv_led_on(lv_obj_t * led); - -/** - * Light off a LED - * @param led pointer to a LED object - */ -void lv_led_off(lv_obj_t * led); - -/** - * Toggle the state of a LED - * @param led pointer to a LED object - */ -void lv_led_toggle(lv_obj_t * led); - -/** - * Get the brightness of a LED object - * @param obj pointer to LED object - * @return bright 0 (max. dark) ... 255 (max. light) - */ -uint8_t lv_led_get_brightness(const lv_obj_t * obj); - -/** - * Get the color of a LED object - * @param obj pointer to LED object - * @return color color of the LED - */ -lv_color_t lv_led_get_color(const lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_LED*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_LED_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/led/lv_led_private.h b/src/widgets/led/lv_led_private.h index 77b5490f70..b674d62fa3 100644 --- a/src/widgets/led/lv_led_private.h +++ b/src/widgets/led/lv_led_private.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_led.h" +#include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" #if LV_USE_LED -#include "../../core/lv_obj_private.h" /********************* * DEFINES diff --git a/src/widgets/line/lv_line.c b/src/widgets/line/lv_line.c index 37de8b4e72..8631403fd0 100644 --- a/src/widgets/line/lv_line.c +++ b/src/widgets/line/lv_line.c @@ -9,12 +9,7 @@ #include "lv_line_private.h" #include "../../core/lv_obj_class_private.h" - -#if LV_USE_LINE != 0 -#include "../../misc/lv_assert.h" -#include "../../misc/lv_math.h" -#include "../../misc/lv_types.h" -#include "../../draw/lv_draw.h" +#if LV_USE_LINE /********************* * DEFINES diff --git a/src/widgets/line/lv_line.h b/src/widgets/line/lv_line.h index 3a0b05c88d..974935b6c6 100644 --- a/src/widgets/line/lv_line.h +++ b/src/widgets/line/lv_line.h @@ -1,125 +1,2 @@ -/** - * @file lv_line.h - * - */ - -#ifndef LV_LINE_H -#define LV_LINE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" -#if LV_USE_LINE != 0 - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_line_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_line_id_t { - LV_PROPERTY_ID(LINE, Y_INVERT, LV_PROPERTY_TYPE_BOOL, 0), - LV_PROPERTY_LINE_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a line object - * @param parent pointer to an object, it will be the parent of the new line - * @return pointer to the created line - */ -lv_obj_t * lv_line_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set an array of points. The line object will connect these points. - * @param obj pointer to a line object - * @param points an array of points. Only the address is saved, so the array needs to be alive while the line exists - * @param point_num number of points in 'point_a' - */ -void lv_line_set_points(lv_obj_t * obj, const lv_point_precise_t points[], uint32_t point_num); - -/** - * 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`. - * @param obj pointer to a line object - * @param points a non-const array of points. Only the address is saved, so the array needs to be alive while the line exists. - * @param point_num number of points in 'point_a' - */ -void lv_line_set_points_mutable(lv_obj_t * obj, lv_point_precise_t points[], uint32_t point_num); - -/** - * 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. - * @param obj pointer to a line object - * @param en true: enable the y inversion, false:disable the y inversion - */ -void lv_line_set_y_invert(lv_obj_t * obj, bool en); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the pointer to the array of points. - * @param obj pointer to a line object - * @return const pointer to the array of points - */ -const lv_point_precise_t * lv_line_get_points(lv_obj_t * obj); - -/** - * Get the number of points in the array of points. - * @param obj pointer to a line object - * @return number of points in array of points - */ -uint32_t lv_line_get_point_count(lv_obj_t * obj); - -/** - * Check the mutability of the stored point array pointer. - * @param obj pointer to a line object - * @return true: the point array pointer is mutable, false: constant - */ -bool lv_line_is_point_array_mutable(lv_obj_t * obj); - -/** - * Get a pointer to the mutable array of points or NULL if it is not mutable - * @param obj pointer to a line object - * @return pointer to the array of points. NULL if not mutable. - */ -lv_point_precise_t * lv_line_get_points_mutable(lv_obj_t * obj); - -/** - * Get the y inversion attribute - * @param obj pointer to a line object - * @return true: y inversion is enabled, false: disabled - */ -bool lv_line_get_y_invert(const lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_LINE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_LINE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/line/lv_line_private.h b/src/widgets/line/lv_line_private.h index 4899392bce..cf9fc27af6 100644 --- a/src/widgets/line/lv_line_private.h +++ b/src/widgets/line/lv_line_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_line.h" +#include "../../lv_public_api.h" -#if LV_USE_LINE != 0 +#if LV_USE_LINE /********************* * DEFINES diff --git a/src/widgets/list/lv_list.c b/src/widgets/list/lv_list.c index 3da8be76b6..05563c3be0 100644 --- a/src/widgets/list/lv_list.c +++ b/src/widgets/list/lv_list.c @@ -6,16 +6,14 @@ /********************* * INCLUDES *********************/ -#include "../../core/lv_obj_class_private.h" -#include "lv_list.h" -#include "../../layouts/flex/lv_flex.h" -#include "../../display/lv_display.h" -#include "../label/lv_label.h" -#include "../image/lv_image.h" -#include "../button/lv_button.h" + + +#include "../../lv_public_api.h" #if LV_USE_LIST +#include "../../core/lv_obj_class_private.h" + /********************* * DEFINES *********************/ diff --git a/src/widgets/list/lv_list.h b/src/widgets/list/lv_list.h index 19de8945b9..fccfdecd10 100644 --- a/src/widgets/list/lv_list.h +++ b/src/widgets/list/lv_list.h @@ -1,118 +1,2 @@ -/** - * @file lv_list.h - * - */ - -#ifndef LV_LIST_H -#define LV_LIST_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" - -#if LV_USE_LIST - -#if LV_USE_FLEX == 0 -#error "lv_list: lv_flex is required. Enable it in lv_conf.h (LV_USE_FLEX 1)" -#endif - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_text_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_button_class; -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a list object - * @param parent pointer to an object, it will be the parent of the new list - * @return pointer to the created list - */ -lv_obj_t * lv_list_create(lv_obj_t * parent); - -/** - * Add text to a list - * @param list pointer to a list, it will be the parent of the new label - * @param txt text of the new label - * @return pointer to the created label - */ -lv_obj_t * lv_list_add_text(lv_obj_t * list, const char * txt); - -/** - * Add button to a list - * @param list pointer to a list, it will be the parent of the new button - * @param icon icon for the button, when NULL it will have no icon - * @param txt text of the new button, when NULL no text will be added - * @return pointer to the created button - */ -lv_obj_t * lv_list_add_button(lv_obj_t * list, const void * icon, const char * txt); - -/** - * Get text of a given list button - * @param list pointer to a list - * @param btn pointer to the button - * @return text of btn, if btn doesn't have text "" will be returned - */ -const char * lv_list_get_button_text(lv_obj_t * list, lv_obj_t * btn); - -/** - * Set text of a given list button - * @param list pointer to a list - * @param btn pointer to the button - * @param txt pointer to the text - */ -void lv_list_set_button_text(lv_obj_t * list, lv_obj_t * btn, const char * txt); - -#if LV_USE_TRANSLATION - -/** - * Add translation tag text to a list - * @param list pointer to a list, it will be the parent of the new label - * @param tag translation tag of the new label - * @return pointer to the created label - */ -lv_obj_t * lv_list_add_translation_tag(lv_obj_t * list, const char * tag); - -/** - * Add translation tag button to a list - * @param list pointer to a list, it will be the parent of the new button - * @param icon icon for the button, when NULL it will have no icon - * @param tag translation tag of the new button, when NULL no translation tag will be added - * @return pointer to the created button - */ -lv_obj_t * lv_list_add_button_translation_tag(lv_obj_t * list, const void * icon, const char * tag); - -/** - * Set translation tag text of a given list button - * @param list pointer to a list - * @param btn pointer to the button - * @param tag pointer to the translation tag - */ -void lv_list_set_button_translation_tag(lv_obj_t * list, lv_obj_t * btn, const char * tag); - -#endif - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_LIST*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_LIST_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/lottie/lv_lottie.c b/src/widgets/lottie/lv_lottie.c index f3b968afa7..774c79a6a6 100644 --- a/src/widgets/lottie/lv_lottie.c +++ b/src/widgets/lottie/lv_lottie.c @@ -6,8 +6,9 @@ /********************* * INCLUDES *********************/ + #include "lv_lottie_private.h" -#include "../../lv_conf_internal.h" + #if LV_USE_LOTTIE #if LV_USE_THORVG_EXTERNAL @@ -16,10 +17,18 @@ #include "../../libs/thorvg/thorvg_capi.h" #endif -#include "../../misc/lv_timer.h" #include "../../core/lv_obj_class_private.h" #include "../../misc/cache/lv_cache.h" +/*Check dependencies*/ +#if LV_USE_CANVAS == 0 + #error "lv_lottie: lv_canvas is required. Enable it in lv_conf.h (LV_USE_CANVAS 1)" +#endif + +#if LV_USE_THORVG == 0 + #error "lv_lottie: ThorVG is required. Enable it in lv_conf.h (LV_USE_THORVG_INTERNAL/EXTERNAL 1)" +#endif + /********************* * DEFINES *********************/ diff --git a/src/widgets/lottie/lv_lottie.h b/src/widgets/lottie/lv_lottie.h index 1ccfe164a5..71aa804a29 100644 --- a/src/widgets/lottie/lv_lottie.h +++ b/src/widgets/lottie/lv_lottie.h @@ -1,102 +1,2 @@ -/** - * @file lv_lottie.h - * - */ - -#ifndef LV_LOTTIE_H -#define LV_LOTTIE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../misc/lv_types.h" -#if LV_USE_LOTTIE - -/*Testing of dependencies*/ -#if LV_USE_CANVAS == 0 -#error "lv_lottie: lv_canvas is required. Enable it in lv_conf.h (LV_USE_CANVAS 1)" -#endif - -#if LV_USE_THORVG == 0 -#error "lv_lottie: ThorVG is required. Enable it in lv_conf.h (LV_USE_THORVG_INTERNAL/EXTERNAL 1)" -#endif - -#include "../../draw/lv_draw_buf.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a lottie animation - * @param parent pointer to the parent widget - * @return pointer to the created Lottie animation widget - */ -lv_obj_t * lv_lottie_create(lv_obj_t * parent); - -/** - * Set a buffer for the animation. It also defines the size of the animation - * @param obj pointer to a lottie widget - * @param w width of the animation and buffer - * @param h height of the animation and buffer - * @param buf a static buffer with `width x height x 4` byte size - */ -void lv_lottie_set_buffer(lv_obj_t * obj, int32_t w, int32_t h, void * buf); - -/** - * Set a draw buffer for the animation. It also defines the size of the animation - * @param obj pointer to a lottie widget - * @param draw_buf an initialized draw buffer with ARGB8888 color format - */ -void lv_lottie_set_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf); - -/** - * Set the source for the animation as an array - * @param obj pointer to a lottie widget - * @param src the lottie animation converted to an nul terminated array - * @param src_size size of the source array in bytes - */ -void lv_lottie_set_src_data(lv_obj_t * obj, const void * src, size_t src_size); - -/** - * Set the source for the animation as a path. - * Lottie doesn't use LVGL's File System API. - * @param obj pointer to a lottie widget - * @param src path to a json file, e.g. "path/to/file.json" - */ -void lv_lottie_set_src_file(lv_obj_t * obj, const char * src); - -/** - * Get the LVGL animation which controls the lottie animation - * @param obj pointer to a lottie widget - * @return the LVGL animation - */ -lv_anim_t * lv_lottie_get_anim(lv_obj_t * obj); - -/********************** - * GLOBAL VARIABLES - **********************/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_LOTTIE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_LOTTIE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/lottie/lv_lottie_private.h b/src/widgets/lottie/lv_lottie_private.h index 6362afb89b..d22e249318 100644 --- a/src/widgets/lottie/lv_lottie_private.h +++ b/src/widgets/lottie/lv_lottie_private.h @@ -14,10 +14,11 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" + #if LV_USE_LOTTIE -#include "lv_lottie.h" #include "../canvas/lv_canvas_private.h" /********************* diff --git a/src/widgets/menu/lv_menu.c b/src/widgets/menu/lv_menu.c index 1b3d461024..7e201b968e 100644 --- a/src/widgets/menu/lv_menu.c +++ b/src/widgets/menu/lv_menu.c @@ -7,7 +7,6 @@ * INCLUDES *********************/ #include "lv_menu_private.h" -#include "../../core/lv_obj_class_private.h" #if LV_USE_MENU @@ -16,12 +15,8 @@ *********************/ #define MY_CLASS (&lv_menu_class) +#include "../../core/lv_obj_class_private.h" #include "../../core/lv_obj_private.h" -#include "../../layouts/lv_layout.h" -#include "../../stdlib/lv_string.h" -#include "../label/lv_label.h" -#include "../button/lv_button.h" -#include "../image/lv_image.h" /********************** * TYPEDEFS diff --git a/src/widgets/menu/lv_menu.h b/src/widgets/menu/lv_menu.h index 1cfd9a1e6a..2ccca007de 100644 --- a/src/widgets/menu/lv_menu.h +++ b/src/widgets/menu/lv_menu.h @@ -1,241 +1,2 @@ -/** - * @file lv_menu.h - * - */ - -#ifndef LV_MENU_H -#define LV_MENU_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" -#include "../../core/lv_obj_property.h" - -#if LV_USE_MENU - -#if LV_USE_FLEX == 0 -#error "lv_menu: lv_flex is required. Enable it in lv_conf.h (LV_USE_FLEX 1)" -#endif - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_MENU_HEADER_TOP_FIXED, /**< Header is positioned at the top */ - LV_MENU_HEADER_TOP_UNFIXED, /**< Header is positioned at the top and can be scrolled out of view*/ - LV_MENU_HEADER_BOTTOM_FIXED /**< Header is positioned at the bottom */ -} lv_menu_mode_header_t; - -typedef enum { - LV_MENU_ROOT_BACK_BUTTON_DISABLED, - LV_MENU_ROOT_BACK_BUTTON_ENABLED -} lv_menu_mode_root_back_button_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_page_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_cont_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_section_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_separator_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_sidebar_cont_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_main_cont_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_sidebar_header_cont_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_main_header_cont_class; - -#if LV_USE_OBJ_PROPERTY -enum __lv_property_menu_id_t { - LV_PROPERTY_ID(MENU, MODE_HEADER, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(MENU, MODE_ROOT_BACK_BUTTON, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_MENU_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a menu object - * @param parent pointer to an object, it will be the parent of the new menu - * @return pointer to the created menu - */ -lv_obj_t * lv_menu_create(lv_obj_t * parent); - -/** - * Create a menu page object. - * - * This call inserts the new page under menu->storage as its parent, which is itself a - * child of the menu, so the resulting object hierarchy is: menu => storage => new_page - * where `storage` is a Base Widget. - * @param menu pointer to menu object. - * @param title pointer to text for title in header (NULL to not display title) - * @return pointer to the created menu page - */ -lv_obj_t * lv_menu_page_create(lv_obj_t * menu, char const * const title); - -/** - * Create a menu cont object - * @param parent pointer to a menu page or menu section object, it will be the parent of the new menu cont object - * @return pointer to the created menu cont - */ -lv_obj_t * lv_menu_cont_create(lv_obj_t * parent); - -/** - * Create a menu section object - * @param parent pointer to a menu page object, it will be the parent of the new menu section object - * @return pointer to the created menu section - */ -lv_obj_t * lv_menu_section_create(lv_obj_t * parent); - -/** - * Create a menu separator object - * @param parent pointer to a menu page object, it will be the parent of the new menu separator object - * @return pointer to the created menu separator - */ -lv_obj_t * lv_menu_separator_create(lv_obj_t * parent); -/*===================== - * Setter functions - *====================*/ -/** - * Set menu page to display in main - * @param obj pointer to the menu - * @param page pointer to the menu page to set (NULL to clear main and clear menu history) - */ -void lv_menu_set_page(lv_obj_t * obj, lv_obj_t * page); - -/** - * Set menu page title - * @param page pointer to the menu page - * @param title pointer to text for title in header (NULL to not display title) - */ -void lv_menu_set_page_title(lv_obj_t * page, char const * const title); - -/** - * Set menu page title with a static text. It will not be saved by the label so the 'text' variable - * has to be 'alive' while the page exists. - * @param page pointer to the menu page - * @param title pointer to text for title in header (NULL to not display title) - */ -void lv_menu_set_page_title_static(lv_obj_t * page, char const * const title); - -/** - * Set menu page to display in sidebar - * @param obj pointer to the menu - * @param page pointer to the menu page to set (NULL to clear sidebar) - */ -void lv_menu_set_sidebar_page(lv_obj_t * obj, lv_obj_t * page); - -/** - * Set the how the header should behave and its position - * @param obj pointer to a menu - * @param mode LV_MENU_HEADER_TOP_FIXED/TOP_UNFIXED/BOTTOM_FIXED - */ -void lv_menu_set_mode_header(lv_obj_t * obj, lv_menu_mode_header_t mode); - -/** - * Set whether back button should appear at root - * @param obj pointer to a menu - * @param mode LV_MENU_ROOT_BACK_BUTTON_DISABLED/ENABLED - */ -void lv_menu_set_mode_root_back_button(lv_obj_t * obj, lv_menu_mode_root_back_button_t mode); - -/** - * Add menu to the menu item - * @param menu pointer to the menu - * @param obj pointer to the obj - * @param page pointer to the page to load when obj is clicked - */ -void lv_menu_set_load_page_event(lv_obj_t * menu, lv_obj_t * obj, lv_obj_t * page); - -/*===================== - * Getter functions - *====================*/ -/** -* Get a pointer to menu page that is currently displayed in main -* @param obj pointer to the menu -* @return pointer to current page -*/ -lv_obj_t * lv_menu_get_cur_main_page(lv_obj_t * obj); - -/** -* Get a pointer to menu page that is currently displayed in sidebar -* @param obj pointer to the menu -* @return pointer to current page -*/ -lv_obj_t * lv_menu_get_cur_sidebar_page(lv_obj_t * obj); - -/** -* Get a pointer to main header obj -* @param obj pointer to the menu -* @return pointer to main header obj -*/ -lv_obj_t * lv_menu_get_main_header(lv_obj_t * obj); - -/** -* Get a pointer to main header back btn obj -* @param obj pointer to the menu -* @return pointer to main header back btn obj -*/ -lv_obj_t * lv_menu_get_main_header_back_button(lv_obj_t * obj); - -/** -* Get a pointer to sidebar header obj -* @param obj pointer to the menu -* @return pointer to sidebar header obj -*/ -lv_obj_t * lv_menu_get_sidebar_header(lv_obj_t * obj); - -/** -* Get a pointer to sidebar header obj -* @param obj pointer to the menu -* @return pointer to sidebar header back btn obj -*/ -lv_obj_t * lv_menu_get_sidebar_header_back_button(lv_obj_t * obj); - -/** - * Check if an obj is a root back btn - * @param menu pointer to the menu - * @param obj pointer to the back button - * @return true if it is a root back btn - */ -bool lv_menu_back_button_is_root(lv_obj_t * menu, lv_obj_t * obj); - -/** - * Get the header mode of the menu - * @param obj pointer to a menu - * @return LV_MENU_HEADER_TOP_FIXED/TOP_UNFIXED/BOTTOM_FIXED - */ -lv_menu_mode_header_t lv_menu_get_mode_header(lv_obj_t * obj); - -/** - * Get the root back button mode of the menu - * @param obj pointer to a menu - * @return LV_MENU_ROOT_BACK_BUTTON_DISABLED/ENABLED - */ -lv_menu_mode_root_back_button_t lv_menu_get_mode_root_back_button(lv_obj_t * obj); - -/** - * Clear menu history - * @param obj pointer to the menu - */ -void lv_menu_clear_history(lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_MENU*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_MENU_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/menu/lv_menu_private.h b/src/widgets/menu/lv_menu_private.h index 185d3e9c5a..ab46c17c61 100644 --- a/src/widgets/menu/lv_menu_private.h +++ b/src/widgets/menu/lv_menu_private.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_menu.h" +#include "../../lv_public_api.h" #if LV_USE_MENU diff --git a/src/widgets/msgbox/lv_msgbox.c b/src/widgets/msgbox/lv_msgbox.c index 0f72238f4e..ee8e62a0e7 100644 --- a/src/widgets/msgbox/lv_msgbox.c +++ b/src/widgets/msgbox/lv_msgbox.c @@ -6,18 +6,14 @@ /********************* * INCLUDES *********************/ + #include "lv_msgbox_private.h" -#include "../../core/lv_obj_private.h" -#include "../../core/lv_obj_class_private.h" + #if LV_USE_MSGBOX -#include "../label/lv_label.h" -#include "../image/lv_image.h" -#include "../../misc/lv_assert.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" #include "../../misc/lv_text_private.h" -#include "../../display/lv_display.h" -#include "../../layouts/flex/lv_flex.h" -#include "../../stdlib/lv_string.h" #if LV_USE_LABEL == 0 #error "lv_mbox: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) " diff --git a/src/widgets/msgbox/lv_msgbox.h b/src/widgets/msgbox/lv_msgbox.h index f35a2a9f3e..8f0bed5df8 100644 --- a/src/widgets/msgbox/lv_msgbox.h +++ b/src/widgets/msgbox/lv_msgbox.h @@ -1,140 +1,2 @@ -/** - * @file lv_msgbox.h - * - */ - -#ifndef LV_MSGBOX_H -#define LV_MSGBOX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" - -#if LV_USE_MSGBOX - -/********************* - * DEFINES - *********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_header_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_content_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_footer_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_header_button_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_footer_button_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_backdrop_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an empty message box - * @param parent the parent or NULL to create a modal msgbox - * @return the created message box - */ -lv_obj_t * lv_msgbox_create(lv_obj_t * parent); - -/** - * Add title to the message box. It also creates a header for the title. - * @param obj pointer to a message box - * @param title the text of the tile - * @return the created title label - */ -lv_obj_t * lv_msgbox_add_title(lv_obj_t * obj, const char * title); - -/** - * Add a button to the header of to the message box. It also creates a header. - * @param obj pointer to a message box - * @param icon the icon of the button - * @return the created button - */ -lv_obj_t * lv_msgbox_add_header_button(lv_obj_t * obj, const void * icon); - -/** - * Add a text to the content area of message box. Multiple texts will be created below each other. - * @param obj pointer to a message box - * @param text text to add - * @return the created label - */ -lv_obj_t * lv_msgbox_add_text(lv_obj_t * obj, const char * text); - -/** - * Add a formatted text to the content area of message box. Multiple texts will be created below each other. - * @param obj pointer to a message box - * @param fmt `printf`-like format string - * @return the created label - */ -lv_obj_t * lv_msgbox_add_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); - -/** - * Add a button to the footer of to the message box. It also creates a footer. - * @param obj pointer to a message box - * @param text the text of the button - * @return the created button - */ -lv_obj_t * lv_msgbox_add_footer_button(lv_obj_t * obj, const char * text); - -/** - * Add a close button to the message box. It also creates a header. - * @param obj pointer to a message box - * @return the created close button - */ -lv_obj_t * lv_msgbox_add_close_button(lv_obj_t * obj); - -/** - * Get the header widget - * @param obj pointer to a message box - * @return the header, or NULL if not exists - */ -lv_obj_t * lv_msgbox_get_header(lv_obj_t * obj); - -/** - * Get the footer widget - * @param obj pointer to a message box - * @return the footer, or NULL if not exists - */ -lv_obj_t * lv_msgbox_get_footer(lv_obj_t * obj); - -/** - * Get the content widget - * @param obj pointer to a message box - * @return the content - */ -lv_obj_t * lv_msgbox_get_content(lv_obj_t * obj); - -/** - * Get the title label - * @param obj pointer to a message box - * @return the title, or NULL if it does not exist - */ -lv_obj_t * lv_msgbox_get_title(lv_obj_t * obj); - -/** - * Close a message box - * @param mbox pointer to a message box - */ -void lv_msgbox_close(lv_obj_t * mbox); - -/** - * Close a message box in the next call of the message box - * @param mbox pointer to a message box - */ -void lv_msgbox_close_async(lv_obj_t * mbox); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_MSGBOX*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_MSGBOX_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/msgbox/lv_msgbox_private.h b/src/widgets/msgbox/lv_msgbox_private.h index 4799ea3c60..5b8f34d4f6 100644 --- a/src/widgets/msgbox/lv_msgbox_private.h +++ b/src/widgets/msgbox/lv_msgbox_private.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_msgbox.h" +#include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" #if LV_USE_MSGBOX -#include "../../core/lv_obj_private.h" /********************* * DEFINES diff --git a/src/widgets/objx_templ/lv_objx_templ.h b/src/widgets/objx_templ/lv_objx_templ.h index 8feaf7e9b0..974762003a 100644 --- a/src/widgets/objx_templ/lv_objx_templ.h +++ b/src/widgets/objx_templ/lv_objx_templ.h @@ -20,11 +20,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" -#if LV_USE_TEMPL != 0 +#include "../../lv_public_api.h" + +#if LV_USE_TEMPL -#include "../core/lv_obj.h" /********************* * DEFINES diff --git a/src/widgets/property/lv_animimage_properties.c b/src/widgets/property/lv_animimage_properties.c index 36e3e329d5..dc26508042 100644 --- a/src/widgets/property/lv_animimage_properties.c +++ b/src/widgets/property/lv_animimage_properties.c @@ -4,7 +4,7 @@ * @file lv_animimage_properties.c */ -#include "../animimage/lv_animimage.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_arc_properties.c b/src/widgets/property/lv_arc_properties.c index be642b0c74..ff45b9a672 100644 --- a/src/widgets/property/lv_arc_properties.c +++ b/src/widgets/property/lv_arc_properties.c @@ -4,7 +4,7 @@ * @file lv_arc_properties.c */ -#include "../arc/lv_arc.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_bar_properties.c b/src/widgets/property/lv_bar_properties.c index f7972bb35f..5aeaceddcc 100644 --- a/src/widgets/property/lv_bar_properties.c +++ b/src/widgets/property/lv_bar_properties.c @@ -4,7 +4,7 @@ * @file lv_bar_properties.c */ -#include "../bar/lv_bar.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_buttonmatrix_properties.c b/src/widgets/property/lv_buttonmatrix_properties.c index b56fd95b12..5806e466e2 100644 --- a/src/widgets/property/lv_buttonmatrix_properties.c +++ b/src/widgets/property/lv_buttonmatrix_properties.c @@ -4,7 +4,7 @@ * @file lv_buttonmatrix_properties.c */ -#include "../buttonmatrix/lv_buttonmatrix.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_chart_properties.c b/src/widgets/property/lv_chart_properties.c index a4bcaad3e3..161e5e2803 100644 --- a/src/widgets/property/lv_chart_properties.c +++ b/src/widgets/property/lv_chart_properties.c @@ -4,7 +4,7 @@ * @file lv_chart_properties.c */ -#include "../chart/lv_chart.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_checkbox_properties.c b/src/widgets/property/lv_checkbox_properties.c index ea711d293c..1216ab5648 100644 --- a/src/widgets/property/lv_checkbox_properties.c +++ b/src/widgets/property/lv_checkbox_properties.c @@ -4,7 +4,7 @@ * @file lv_checkbox_properties.c */ -#include "../checkbox/lv_checkbox.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_dropdown_properties.c b/src/widgets/property/lv_dropdown_properties.c index 9477ca3c83..c994b74b75 100644 --- a/src/widgets/property/lv_dropdown_properties.c +++ b/src/widgets/property/lv_dropdown_properties.c @@ -4,7 +4,7 @@ * @file lv_dropdown_properties.c */ -#include "../dropdown/lv_dropdown.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_image_properties.c b/src/widgets/property/lv_image_properties.c index fd7fd7d1b4..eff9a50c25 100644 --- a/src/widgets/property/lv_image_properties.c +++ b/src/widgets/property/lv_image_properties.c @@ -4,7 +4,7 @@ * @file lv_image_properties.c */ -#include "../image/lv_image.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_keyboard_properties.c b/src/widgets/property/lv_keyboard_properties.c index 90cfc3e268..d199c32e42 100644 --- a/src/widgets/property/lv_keyboard_properties.c +++ b/src/widgets/property/lv_keyboard_properties.c @@ -4,7 +4,7 @@ * @file lv_keyboard_properties.c */ -#include "../keyboard/lv_keyboard.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_label_properties.c b/src/widgets/property/lv_label_properties.c index 5fc6708b7c..118ca958b4 100644 --- a/src/widgets/property/lv_label_properties.c +++ b/src/widgets/property/lv_label_properties.c @@ -4,7 +4,7 @@ * @file lv_label_properties.c */ -#include "../label/lv_label.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_led_properties.c b/src/widgets/property/lv_led_properties.c index f9771f6b43..96bfae34ad 100644 --- a/src/widgets/property/lv_led_properties.c +++ b/src/widgets/property/lv_led_properties.c @@ -4,7 +4,7 @@ * @file lv_led_properties.c */ -#include "../led/lv_led.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_line_properties.c b/src/widgets/property/lv_line_properties.c index ac9cb66f34..661d4b6b3b 100644 --- a/src/widgets/property/lv_line_properties.c +++ b/src/widgets/property/lv_line_properties.c @@ -4,7 +4,7 @@ * @file lv_line_properties.c */ -#include "../line/lv_line.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_menu_properties.c b/src/widgets/property/lv_menu_properties.c index 4e3b313c3e..0f13a581e8 100644 --- a/src/widgets/property/lv_menu_properties.c +++ b/src/widgets/property/lv_menu_properties.c @@ -4,7 +4,7 @@ * @file lv_menu_properties.c */ -#include "../menu/lv_menu.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_obj_properties.c b/src/widgets/property/lv_obj_properties.c index 71d70db0d5..31c408931e 100644 --- a/src/widgets/property/lv_obj_properties.c +++ b/src/widgets/property/lv_obj_properties.c @@ -4,7 +4,7 @@ * @file lv_obj_properties.c */ -#include "../../core/lv_obj.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_obj_property_names.h b/src/widgets/property/lv_obj_property_names.h index fa8d6e5f4e..888c312de0 100644 --- a/src/widgets/property/lv_obj_property_names.h +++ b/src/widgets/property/lv_obj_property_names.h @@ -1,39 +1,2 @@ - -/** - * @file lv_obj_property_names.h - * GENERATED FILE, DO NOT EDIT IT! - */ -#ifndef LV_OBJ_PROPERTY_NAMES_H -#define LV_OBJ_PROPERTY_NAMES_H - -#include "../../misc/lv_types.h" - -#if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME - - extern const lv_property_name_t lv_animimage_property_names[4]; - extern const lv_property_name_t lv_arc_property_names[11]; - extern const lv_property_name_t lv_bar_property_names[6]; - extern const lv_property_name_t lv_buttonmatrix_property_names[2]; - extern const lv_property_name_t lv_chart_property_names[5]; - extern const lv_property_name_t lv_checkbox_property_names[1]; - extern const lv_property_name_t lv_dropdown_property_names[9]; - extern const lv_property_name_t lv_image_property_names[11]; - extern const lv_property_name_t lv_keyboard_property_names[4]; - extern const lv_property_name_t lv_label_property_names[4]; - extern const lv_property_name_t lv_led_property_names[2]; - extern const lv_property_name_t lv_line_property_names[1]; - extern const lv_property_name_t lv_menu_property_names[2]; - extern const lv_property_name_t lv_obj_property_names[76]; - extern const lv_property_name_t lv_roller_property_names[3]; - extern const lv_property_name_t lv_scale_property_names[8]; - extern const lv_property_name_t lv_slider_property_names[8]; - extern const lv_property_name_t lv_span_property_names[5]; - extern const lv_property_name_t lv_spinbox_property_names[8]; - extern const lv_property_name_t lv_spinner_property_names[2]; - extern const lv_property_name_t lv_style_property_names[131]; - extern const lv_property_name_t lv_switch_property_names[1]; - extern const lv_property_name_t lv_table_property_names[2]; - extern const lv_property_name_t lv_tabview_property_names[2]; - extern const lv_property_name_t lv_textarea_property_names[14]; -#endif -#endif +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/property/lv_roller_properties.c b/src/widgets/property/lv_roller_properties.c index 72aa01783a..25181c898b 100644 --- a/src/widgets/property/lv_roller_properties.c +++ b/src/widgets/property/lv_roller_properties.c @@ -4,7 +4,7 @@ * @file lv_roller_properties.c */ -#include "../roller/lv_roller.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_scale_properties.c b/src/widgets/property/lv_scale_properties.c index 71ebfd14a3..325bf458b7 100644 --- a/src/widgets/property/lv_scale_properties.c +++ b/src/widgets/property/lv_scale_properties.c @@ -4,7 +4,7 @@ * @file lv_scale_properties.c */ -#include "../scale/lv_scale.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_slider_properties.c b/src/widgets/property/lv_slider_properties.c index 0015011c81..49e981ddd4 100644 --- a/src/widgets/property/lv_slider_properties.c +++ b/src/widgets/property/lv_slider_properties.c @@ -4,7 +4,7 @@ * @file lv_slider_properties.c */ -#include "../slider/lv_slider.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_span_properties.c b/src/widgets/property/lv_span_properties.c index 7fd1402a44..6c715bf95a 100644 --- a/src/widgets/property/lv_span_properties.c +++ b/src/widgets/property/lv_span_properties.c @@ -4,7 +4,7 @@ * @file lv_span_properties.c */ -#include "../span/lv_span.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_spinbox_properties.c b/src/widgets/property/lv_spinbox_properties.c index def41582a2..25fee9af90 100644 --- a/src/widgets/property/lv_spinbox_properties.c +++ b/src/widgets/property/lv_spinbox_properties.c @@ -4,7 +4,7 @@ * @file lv_spinbox_properties.c */ -#include "../spinbox/lv_spinbox.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_spinner_properties.c b/src/widgets/property/lv_spinner_properties.c index f9ce4749e0..c032ee39bd 100644 --- a/src/widgets/property/lv_spinner_properties.c +++ b/src/widgets/property/lv_spinner_properties.c @@ -4,7 +4,7 @@ * @file lv_spinner_properties.c */ -#include "../spinner/lv_spinner.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_style_properties.c b/src/widgets/property/lv_style_properties.c index e03a232f47..872e71c9b0 100644 --- a/src/widgets/property/lv_style_properties.c +++ b/src/widgets/property/lv_style_properties.c @@ -4,7 +4,7 @@ * @file lv_style_properties.c */ -#include "lv_style_properties.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_style_properties.h b/src/widgets/property/lv_style_properties.h index 04b733ae54..3c69c42095 100644 --- a/src/widgets/property/lv_style_properties.h +++ b/src/widgets/property/lv_style_properties.h @@ -1,149 +1,2 @@ - -/** - * GENERATED FILE, DO NOT EDIT IT! - * @file lv_style_properties.h - */ -#ifndef LV_STYLE_PROPERTIES_H -#define LV_STYLE_PROPERTIES_H - -#include "../../core/lv_obj_property.h" -#if LV_USE_OBJ_PROPERTY - - -/* *INDENT-OFF* */ -enum _lv_property_style_id_t { - LV_PROPERTY_ID(STYLE, ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_ALIGN), - LV_PROPERTY_ID(STYLE, ANIM, LV_PROPERTY_TYPE_POINTER, LV_STYLE_ANIM), - LV_PROPERTY_ID(STYLE, ANIM_DURATION, LV_PROPERTY_TYPE_INT, LV_STYLE_ANIM_DURATION), - LV_PROPERTY_ID(STYLE, ARC_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_ARC_COLOR), - LV_PROPERTY_ID(STYLE, ARC_IMAGE_SRC, LV_PROPERTY_TYPE_IMGSRC, LV_STYLE_ARC_IMAGE_SRC), - LV_PROPERTY_ID(STYLE, ARC_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_OPA), - LV_PROPERTY_ID(STYLE, ARC_ROUNDED, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_ROUNDED), - LV_PROPERTY_ID(STYLE, ARC_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_WIDTH), - LV_PROPERTY_ID(STYLE, BASE_DIR, LV_PROPERTY_TYPE_INT, LV_STYLE_BASE_DIR), - LV_PROPERTY_ID(STYLE, BG_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BG_COLOR), - LV_PROPERTY_ID(STYLE, BG_GRAD, LV_PROPERTY_TYPE_POINTER, LV_STYLE_BG_GRAD), - LV_PROPERTY_ID(STYLE, BG_GRAD_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BG_GRAD_COLOR), - LV_PROPERTY_ID(STYLE, BG_GRAD_DIR, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD_DIR), - LV_PROPERTY_ID(STYLE, BG_GRAD_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD_OPA), - LV_PROPERTY_ID(STYLE, BG_GRAD_STOP, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD_STOP), - LV_PROPERTY_ID(STYLE, BG_IMAGE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_IMAGE_OPA), - LV_PROPERTY_ID(STYLE, BG_IMAGE_RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BG_IMAGE_RECOLOR), - LV_PROPERTY_ID(STYLE, BG_IMAGE_RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_IMAGE_RECOLOR_OPA), - LV_PROPERTY_ID(STYLE, BG_IMAGE_SRC, LV_PROPERTY_TYPE_IMGSRC, LV_STYLE_BG_IMAGE_SRC), - LV_PROPERTY_ID(STYLE, BG_IMAGE_TILED, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_IMAGE_TILED), - LV_PROPERTY_ID(STYLE, BG_MAIN_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_MAIN_OPA), - LV_PROPERTY_ID(STYLE, BG_MAIN_STOP, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_MAIN_STOP), - LV_PROPERTY_ID(STYLE, BG_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_OPA), - LV_PROPERTY_ID(STYLE, BITMAP_MASK_SRC, LV_PROPERTY_TYPE_POINTER, LV_STYLE_BITMAP_MASK_SRC), - LV_PROPERTY_ID(STYLE, BLEND_MODE, LV_PROPERTY_TYPE_INT, LV_STYLE_BLEND_MODE), - LV_PROPERTY_ID(STYLE, BLUR_BACKDROP, LV_PROPERTY_TYPE_INT, LV_STYLE_BLUR_BACKDROP), - LV_PROPERTY_ID(STYLE, BLUR_QUALITY, LV_PROPERTY_TYPE_INT, LV_STYLE_BLUR_QUALITY), - LV_PROPERTY_ID(STYLE, BLUR_RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_BLUR_RADIUS), - LV_PROPERTY_ID(STYLE, BORDER_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BORDER_COLOR), - LV_PROPERTY_ID(STYLE, BORDER_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_OPA), - LV_PROPERTY_ID(STYLE, BORDER_POST, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_POST), - LV_PROPERTY_ID(STYLE, BORDER_SIDE, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_SIDE), - LV_PROPERTY_ID(STYLE, BORDER_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_WIDTH), - LV_PROPERTY_ID(STYLE, CLIP_CORNER, LV_PROPERTY_TYPE_INT, LV_STYLE_CLIP_CORNER), - LV_PROPERTY_ID(STYLE, COLOR_FILTER_DSC, LV_PROPERTY_TYPE_POINTER, LV_STYLE_COLOR_FILTER_DSC), - LV_PROPERTY_ID(STYLE, COLOR_FILTER_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_COLOR_FILTER_OPA), - LV_PROPERTY_ID(STYLE, DROP_SHADOW_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_DROP_SHADOW_COLOR), - LV_PROPERTY_ID(STYLE, DROP_SHADOW_OFFSET_X, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_OFFSET_X), - LV_PROPERTY_ID(STYLE, DROP_SHADOW_OFFSET_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_OFFSET_Y), - LV_PROPERTY_ID(STYLE, DROP_SHADOW_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_OPA), - LV_PROPERTY_ID(STYLE, DROP_SHADOW_QUALITY, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_QUALITY), - LV_PROPERTY_ID(STYLE, DROP_SHADOW_RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_RADIUS), - LV_PROPERTY_ID(STYLE, FLEX_CROSS_PLACE, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_CROSS_PLACE), - LV_PROPERTY_ID(STYLE, FLEX_FLOW, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_FLOW), - LV_PROPERTY_ID(STYLE, FLEX_GROW, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_GROW), - LV_PROPERTY_ID(STYLE, FLEX_MAIN_PLACE, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_MAIN_PLACE), - LV_PROPERTY_ID(STYLE, FLEX_TRACK_PLACE, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_TRACK_PLACE), - LV_PROPERTY_ID(STYLE, GRID_CELL_COLUMN_POS, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_COLUMN_POS), - LV_PROPERTY_ID(STYLE, GRID_CELL_COLUMN_SPAN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_COLUMN_SPAN), - LV_PROPERTY_ID(STYLE, GRID_CELL_ROW_POS, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_ROW_POS), - LV_PROPERTY_ID(STYLE, GRID_CELL_ROW_SPAN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_ROW_SPAN), - LV_PROPERTY_ID(STYLE, GRID_CELL_X_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_X_ALIGN), - LV_PROPERTY_ID(STYLE, GRID_CELL_Y_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_Y_ALIGN), - LV_PROPERTY_ID(STYLE, GRID_COLUMN_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_COLUMN_ALIGN), - LV_PROPERTY_ID(STYLE, GRID_COLUMN_DSC_ARRAY, LV_PROPERTY_TYPE_POINTER, LV_STYLE_GRID_COLUMN_DSC_ARRAY), - LV_PROPERTY_ID(STYLE, GRID_ROW_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_ROW_ALIGN), - LV_PROPERTY_ID(STYLE, GRID_ROW_DSC_ARRAY, LV_PROPERTY_TYPE_POINTER, LV_STYLE_GRID_ROW_DSC_ARRAY), - LV_PROPERTY_ID(STYLE, HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_HEIGHT), - LV_PROPERTY_ID(STYLE, IMAGE_COLORKEY, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_COLORKEY), - LV_PROPERTY_ID(STYLE, IMAGE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_OPA), - LV_PROPERTY_ID(STYLE, IMAGE_RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_IMAGE_RECOLOR), - LV_PROPERTY_ID(STYLE, IMAGE_RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_RECOLOR_OPA), - LV_PROPERTY_ID(STYLE, LAST_BUILT_IN_PROP, LV_PROPERTY_TYPE_INVALID, LV_STYLE_LAST_BUILT_IN_PROP), - LV_PROPERTY_ID(STYLE, LAYOUT, LV_PROPERTY_TYPE_INT, LV_STYLE_LAYOUT), - LV_PROPERTY_ID(STYLE, LENGTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LENGTH), - LV_PROPERTY_ID(STYLE, LINE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_LINE_COLOR), - LV_PROPERTY_ID(STYLE, LINE_DASH_GAP, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_DASH_GAP), - LV_PROPERTY_ID(STYLE, LINE_DASH_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_DASH_WIDTH), - LV_PROPERTY_ID(STYLE, LINE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_OPA), - LV_PROPERTY_ID(STYLE, LINE_ROUNDED, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_ROUNDED), - LV_PROPERTY_ID(STYLE, LINE_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_WIDTH), - LV_PROPERTY_ID(STYLE, MARGIN_BOTTOM, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_BOTTOM), - LV_PROPERTY_ID(STYLE, MARGIN_LEFT, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_LEFT), - LV_PROPERTY_ID(STYLE, MARGIN_RIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_RIGHT), - LV_PROPERTY_ID(STYLE, MARGIN_TOP, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_TOP), - LV_PROPERTY_ID(STYLE, MAX_HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_MAX_HEIGHT), - LV_PROPERTY_ID(STYLE, MAX_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_MAX_WIDTH), - LV_PROPERTY_ID(STYLE, MIN_HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_MIN_HEIGHT), - LV_PROPERTY_ID(STYLE, MIN_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_MIN_WIDTH), - LV_PROPERTY_ID(STYLE, OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_OPA), - LV_PROPERTY_ID(STYLE, OPA_LAYERED, LV_PROPERTY_TYPE_INT, LV_STYLE_OPA_LAYERED), - LV_PROPERTY_ID(STYLE, OUTLINE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_OUTLINE_COLOR), - LV_PROPERTY_ID(STYLE, OUTLINE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_OUTLINE_OPA), - LV_PROPERTY_ID(STYLE, OUTLINE_PAD, LV_PROPERTY_TYPE_INT, LV_STYLE_OUTLINE_PAD), - LV_PROPERTY_ID(STYLE, OUTLINE_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_OUTLINE_WIDTH), - LV_PROPERTY_ID(STYLE, PAD_BOTTOM, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_BOTTOM), - LV_PROPERTY_ID(STYLE, PAD_COLUMN, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_COLUMN), - LV_PROPERTY_ID(STYLE, PAD_LEFT, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_LEFT), - LV_PROPERTY_ID(STYLE, PAD_RADIAL, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_RADIAL), - LV_PROPERTY_ID(STYLE, PAD_RIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_RIGHT), - LV_PROPERTY_ID(STYLE, PAD_ROW, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_ROW), - LV_PROPERTY_ID(STYLE, PAD_TOP, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_TOP), - LV_PROPERTY_ID(STYLE, PROP_INV, LV_PROPERTY_TYPE_INVALID, LV_STYLE_PROP_INV), - LV_PROPERTY_ID(STYLE, RADIAL_OFFSET, LV_PROPERTY_TYPE_INT, LV_STYLE_RADIAL_OFFSET), - LV_PROPERTY_ID(STYLE, RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_RADIUS), - LV_PROPERTY_ID(STYLE, RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_RECOLOR), - LV_PROPERTY_ID(STYLE, RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_RECOLOR_OPA), - LV_PROPERTY_ID(STYLE, ROTARY_SENSITIVITY, LV_PROPERTY_TYPE_INT, LV_STYLE_ROTARY_SENSITIVITY), - LV_PROPERTY_ID(STYLE, SHADOW_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_SHADOW_COLOR), - LV_PROPERTY_ID(STYLE, SHADOW_OFFSET_X, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_OFFSET_X), - LV_PROPERTY_ID(STYLE, SHADOW_OFFSET_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_OFFSET_Y), - LV_PROPERTY_ID(STYLE, SHADOW_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_OPA), - LV_PROPERTY_ID(STYLE, SHADOW_SPREAD, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_SPREAD), - LV_PROPERTY_ID(STYLE, SHADOW_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_WIDTH), - LV_PROPERTY_ID(STYLE, TEXT_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_ALIGN), - LV_PROPERTY_ID(STYLE, TEXT_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_TEXT_COLOR), - LV_PROPERTY_ID(STYLE, TEXT_DECOR, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_DECOR), - LV_PROPERTY_ID(STYLE, TEXT_FONT, LV_PROPERTY_TYPE_FONT, LV_STYLE_TEXT_FONT), - LV_PROPERTY_ID(STYLE, TEXT_LEADING_TRIM, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_LEADING_TRIM), - LV_PROPERTY_ID(STYLE, TEXT_LETTER_SPACE, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_LETTER_SPACE), - LV_PROPERTY_ID(STYLE, TEXT_LINE_SPACE, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_LINE_SPACE), - LV_PROPERTY_ID(STYLE, TEXT_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_OPA), - LV_PROPERTY_ID(STYLE, TEXT_OUTLINE_STROKE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_TEXT_OUTLINE_STROKE_COLOR), - LV_PROPERTY_ID(STYLE, TEXT_OUTLINE_STROKE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_OUTLINE_STROKE_OPA), - LV_PROPERTY_ID(STYLE, TEXT_OUTLINE_STROKE_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_OUTLINE_STROKE_WIDTH), - LV_PROPERTY_ID(STYLE, TRANSFORM_HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_HEIGHT), - LV_PROPERTY_ID(STYLE, TRANSFORM_PIVOT_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_PIVOT_X), - LV_PROPERTY_ID(STYLE, TRANSFORM_PIVOT_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_PIVOT_Y), - LV_PROPERTY_ID(STYLE, TRANSFORM_ROTATION, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_ROTATION), - LV_PROPERTY_ID(STYLE, TRANSFORM_SCALE_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SCALE_X), - LV_PROPERTY_ID(STYLE, TRANSFORM_SCALE_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SCALE_Y), - LV_PROPERTY_ID(STYLE, TRANSFORM_SKEW_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SKEW_X), - LV_PROPERTY_ID(STYLE, TRANSFORM_SKEW_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SKEW_Y), - LV_PROPERTY_ID(STYLE, TRANSFORM_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_WIDTH), - LV_PROPERTY_ID(STYLE, TRANSITION, LV_PROPERTY_TYPE_POINTER, LV_STYLE_TRANSITION), - LV_PROPERTY_ID(STYLE, TRANSLATE_RADIAL, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSLATE_RADIAL), - LV_PROPERTY_ID(STYLE, TRANSLATE_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSLATE_X), - LV_PROPERTY_ID(STYLE, TRANSLATE_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSLATE_Y), - LV_PROPERTY_ID(STYLE, WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_WIDTH), - LV_PROPERTY_ID(STYLE, X, LV_PROPERTY_TYPE_INT, LV_STYLE_X), - LV_PROPERTY_ID(STYLE, Y, LV_PROPERTY_TYPE_INT, LV_STYLE_Y), -}; - -#endif -#endif +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/property/lv_switch_properties.c b/src/widgets/property/lv_switch_properties.c index ecd590df11..6e26a39c65 100644 --- a/src/widgets/property/lv_switch_properties.c +++ b/src/widgets/property/lv_switch_properties.c @@ -4,7 +4,7 @@ * @file lv_switch_properties.c */ -#include "../switch/lv_switch.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_table_properties.c b/src/widgets/property/lv_table_properties.c index 5d7ec1679f..c65e133a7b 100644 --- a/src/widgets/property/lv_table_properties.c +++ b/src/widgets/property/lv_table_properties.c @@ -4,7 +4,7 @@ * @file lv_table_properties.c */ -#include "../table/lv_table.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_tabview_properties.c b/src/widgets/property/lv_tabview_properties.c index efdb3bf67f..6097b881d5 100644 --- a/src/widgets/property/lv_tabview_properties.c +++ b/src/widgets/property/lv_tabview_properties.c @@ -4,7 +4,7 @@ * @file lv_tabview_properties.c */ -#include "../tabview/lv_tabview.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/property/lv_textarea_properties.c b/src/widgets/property/lv_textarea_properties.c index 2da616487e..d37b4d1cf6 100644 --- a/src/widgets/property/lv_textarea_properties.c +++ b/src/widgets/property/lv_textarea_properties.c @@ -4,7 +4,7 @@ * @file lv_textarea_properties.c */ -#include "../textarea/lv_textarea.h" +#include "../../lv_public_api.h" #if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME diff --git a/src/widgets/roller/lv_roller.c b/src/widgets/roller/lv_roller.c index c4411668ce..d47791d32e 100644 --- a/src/widgets/roller/lv_roller.c +++ b/src/widgets/roller/lv_roller.c @@ -7,21 +7,17 @@ * INCLUDES *********************/ #include "lv_roller_private.h" +#if LV_USE_ROLLER != 0 + #include "../label/lv_label_private.h" #include "../../misc/lv_area_private.h" #include "../../misc/lv_anim_private.h" #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_ROLLER != 0 - -#include "../../misc/lv_assert.h" #include "../../misc/lv_text_private.h" #include "../../draw/lv_draw_private.h" -#include "../../core/lv_group.h" -#include "../../indev/lv_indev.h" #include "../../indev/lv_indev_scroll.h" #include "../../indev/lv_indev_private.h" -#include "../../stdlib/lv_string.h" #include "../../core/lv_observer_private.h" /********************* diff --git a/src/widgets/roller/lv_roller.h b/src/widgets/roller/lv_roller.h index b4f3089b70..5dbe365852 100644 --- a/src/widgets/roller/lv_roller.h +++ b/src/widgets/roller/lv_roller.h @@ -1,162 +1,2 @@ -/** - * @file lv_roller.h - * - */ - -#ifndef LV_ROLLER_H -#define LV_ROLLER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" - -#if LV_USE_ROLLER != 0 - -/*Testing of dependencies*/ -#if LV_USE_LABEL == 0 -#error "lv_roller: lv_label is required. Enable it in lv_conf.h (LV_USE_ROLLER 1)" -#endif - -#include "../label/lv_label.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/** Roller mode. */ -typedef enum { - LV_ROLLER_MODE_NORMAL, /**< Normal mode (roller ends at the end of the options). */ - LV_ROLLER_MODE_INFINITE, /**< Infinite mode (roller can be scrolled forever). */ -} lv_roller_mode_t; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_roller_id_t { - LV_PROPERTY_ID2(ROLLER, OPTIONS, LV_PROPERTY_TYPE_TEXT, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID2(ROLLER, SELECTED, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(ROLLER, VISIBLE_ROW_COUNT, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ROLLER_END, -}; -#endif - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_roller_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a roller object - * @param parent pointer to an object, it will be the parent of the new roller. - * @return pointer to the created roller - */ -lv_obj_t * lv_roller_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the options on a roller - * @param obj pointer to roller object - * @param options a string with '\n' separated options. E.g. "One\nTwo\nThree" - * @param mode `LV_ROLLER_MODE_NORMAL` or `LV_ROLLER_MODE_INFINITE` - */ -void lv_roller_set_options(lv_obj_t * obj, const char * options, lv_roller_mode_t mode); - -/** - * Set the selected option - * @param obj pointer to a roller object - * @param sel_opt index of the selected option (0 ... number of option - 1); - * @param anim LV_ANIM_ON: set with animation; LV_ANIM_OFF set immediately - */ -void lv_roller_set_selected(lv_obj_t * obj, uint32_t sel_opt, lv_anim_enable_t anim); - -/** - * Sets the given string as the selection on the roller. Does not alter the current selection on failure. - * @param obj pointer to roller object - * @param sel_opt pointer to the string you want to set as an option - * @param anim LV_ANIM_ON: set with animation; LV_ANIM_OFF set immediately - * @return `true` if set successfully and `false` if the given string does not exist as an option in the roller - */ -bool lv_roller_set_selected_str(lv_obj_t * obj, const char * sel_opt, lv_anim_enable_t anim); - -/** - * Set the height to show the given number of rows (options) - * @param obj pointer to a roller object - * @param row_cnt number of desired visible rows - */ -void lv_roller_set_visible_row_count(lv_obj_t * obj, uint32_t row_cnt); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the index of the selected option - * @param obj pointer to a roller object - * @return index of the selected option (0 ... number of option - 1); - */ -uint32_t lv_roller_get_selected(const lv_obj_t * obj); - -/** - * Get the current selected option as a string. - * @param obj pointer to roller object - * @param buf pointer to an array to store the string - * @param buf_size size of `buf` in bytes. 0: to ignore it. - */ -void lv_roller_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size); - -/** - * Get the options of a roller - * @param obj pointer to roller object - * @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3") - */ -const char * lv_roller_get_options(const lv_obj_t * obj); - -/** - * Get the total number of options - * @param obj pointer to a roller object - * @return the total number of options - */ -uint32_t lv_roller_get_option_count(const lv_obj_t * obj); - -/** - * Get an option as a string. - * @param obj pointer to roller object - * @param option index of chosen option - * @param buf pointer to an array to store the string - * @param buf_size size of `buf` in bytes. 0: to ignore it. - * @return LV_RESULT_OK if option found - */ -lv_result_t lv_roller_get_option_str(const lv_obj_t * obj, uint32_t option, char * buf, uint32_t buf_size); - -#if LV_USE_OBSERVER -/** - * Bind an integer Subject to a Roller's value. - * @param obj pointer to Roller - * @param subject pointer to Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_roller_bind_value(lv_obj_t * obj, lv_subject_t * subject); -#endif - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_ROLLER*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_ROLLER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/roller/lv_roller_private.h b/src/widgets/roller/lv_roller_private.h index 686c0d50f1..cf0fa954b8 100644 --- a/src/widgets/roller/lv_roller_private.h +++ b/src/widgets/roller/lv_roller_private.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_roller.h" - -#if LV_USE_ROLLER != 0 #include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" + +#if LV_USE_ROLLER /********************* * DEFINES diff --git a/src/widgets/scale/lv_scale.c b/src/widgets/scale/lv_scale.c index 015fe04146..8eb142eb64 100644 --- a/src/widgets/scale/lv_scale.c +++ b/src/widgets/scale/lv_scale.c @@ -6,17 +6,14 @@ /********************* * INCLUDES *********************/ -#include "lv_scale_private.h" -#include "../../core/lv_obj_private.h" -#include "../../core/lv_obj_class_private.h" -#if LV_USE_SCALE != 0 +#include "../../lv_public_api.h" -#include "../../core/lv_group.h" -#include "../../misc/lv_assert.h" -#include "../../misc/lv_math.h" +#if LV_USE_SCALE + +#include "lv_scale_private.h" #include "../../misc/lv_text_private.h" #include "../../core/lv_observer_private.h" -#include "../../draw/lv_draw_arc.h" +#include "../../core/lv_obj_class_private.h" /********************* * DEFINES diff --git a/src/widgets/scale/lv_scale.h b/src/widgets/scale/lv_scale.h index f754c0b117..f298f74c0e 100644 --- a/src/widgets/scale/lv_scale.h +++ b/src/widgets/scale/lv_scale.h @@ -1,418 +1,2 @@ -/** - * @file lv_scale.h - * - */ - -#ifndef LV_SCALE_H -#define LV_SCALE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_SCALE != 0 - -#include "../../core/lv_obj.h" -#include "../line/lv_line.h" -#include "../image/lv_image.h" -#include "../../core/lv_observer.h" - -/********************* - * DEFINES - *********************/ - -/**Default value of total minor ticks. */ -#define LV_SCALE_TOTAL_TICK_COUNT_DEFAULT (11U) -LV_EXPORT_CONST_INT(LV_SCALE_TOTAL_TICK_COUNT_DEFAULT); - -/**Default value of major tick every nth ticks. */ -#define LV_SCALE_MAJOR_TICK_EVERY_DEFAULT (5U) -LV_EXPORT_CONST_INT(LV_SCALE_MAJOR_TICK_EVERY_DEFAULT); - -/**Default value of scale label enabled. */ -#define LV_SCALE_LABEL_ENABLED_DEFAULT (1U) -LV_EXPORT_CONST_INT(LV_SCALE_LABEL_ENABLED_DEFAULT); - -/********************** - * TYPEDEFS - **********************/ - -/** - * Scale mode - */ -typedef enum { - LV_SCALE_MODE_HORIZONTAL_TOP = 0x00U, - LV_SCALE_MODE_HORIZONTAL_BOTTOM = 0x01U, - LV_SCALE_MODE_VERTICAL_LEFT = 0x02U, - LV_SCALE_MODE_VERTICAL_RIGHT = 0x04U, - LV_SCALE_MODE_ROUND_INNER = 0x08U, - LV_SCALE_MODE_ROUND_OUTER = 0x10U, - LV_SCALE_MODE_LAST -} lv_scale_mode_t; - -#define LV_SCALE_LABEL_ROTATE_MATCH_TICKS 0x100000 -LV_EXPORT_CONST_INT(LV_SCALE_LABEL_ROTATE_MATCH_TICKS); - -#define LV_SCALE_LABEL_ROTATE_KEEP_UPRIGHT 0x80000 -LV_EXPORT_CONST_INT(LV_SCALE_LABEL_ROTATE_KEEP_UPRIGHT); - -#define LV_SCALE_ROTATION_ANGLE_MASK 0x7FFFF -LV_EXPORT_CONST_INT(LV_SCALE_ROTATION_ANGLE_MASK); - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_scale_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_scale_id_t { - LV_PROPERTY_ID(SCALE, MODE, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(SCALE, TOTAL_TICK_COUNT, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(SCALE, MAJOR_TICK_EVERY, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(SCALE, LABEL_SHOW, LV_PROPERTY_TYPE_BOOL, 3), - LV_PROPERTY_ID(SCALE, ANGLE_RANGE, LV_PROPERTY_TYPE_INT, 4), - LV_PROPERTY_ID(SCALE, ROTATION, LV_PROPERTY_TYPE_INT, 5), - LV_PROPERTY_ID(SCALE, RANGE_MIN_VALUE, LV_PROPERTY_TYPE_INT, 6), - LV_PROPERTY_ID(SCALE, RANGE_MAX_VALUE, LV_PROPERTY_TYPE_INT, 7), - LV_PROPERTY_SCALE_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create an scale object - * @param parent pointer to an object, it will be the parent of the new scale - * @return pointer to created Scale Widget - */ -lv_obj_t * lv_scale_create(lv_obj_t * parent); - -/*====================== - * Add/remove functions - *=====================*/ - -/*===================== - * Setter functions - *====================*/ - -/** - * Set scale mode. See lv_scale_mode_t. - * @param obj pointer to Scale Widget - * @param mode the new scale mode - */ -void lv_scale_set_mode(lv_obj_t * obj, lv_scale_mode_t mode); - -/** - * Set scale total tick count (including minor and major ticks). - * @param obj pointer to Scale Widget - * @param total_tick_count New total tick count - */ -void lv_scale_set_total_tick_count(lv_obj_t * obj, uint32_t total_tick_count); - -/** - * Sets how often major ticks are drawn. - * @param obj pointer to Scale Widget - * @param major_tick_every the new count for major tick drawing - */ -void lv_scale_set_major_tick_every(lv_obj_t * obj, uint32_t major_tick_every); - -/** - * Sets label visibility. - * @param obj pointer to Scale Widget - * @param show_label true/false to enable tick label - */ -void lv_scale_set_label_show(lv_obj_t * obj, bool show_label); - -/** - * Set minimum and maximum values on Scale. - * @param obj pointer to Scale Widget - * @param min minimum value of Scale - * @param max maximum value of Scale - */ -void lv_scale_set_range(lv_obj_t * obj, int32_t min, int32_t max); - -/** - * Set minimum values on Scale. - * @param obj pointer to Scale Widget - * @param min minimum value of Scale - */ -void lv_scale_set_min_value(lv_obj_t * obj, int32_t min); - -/** - * Set maximum values on Scale. - * @param obj pointer to Scale Widget - * @param min minimum value of Scale - */ -void lv_scale_set_max_value(lv_obj_t * obj, int32_t max); - -/** - * Set angle between the low end and the high end of the Scale. - * (Applies only to round Scales.) - * @param obj pointer to Scale Widget - * @param max_angle angle in degrees from Scale minimum where top end of Scale will be drawn - */ -void lv_scale_set_angle_range(lv_obj_t * obj, uint32_t angle_range); - -/** - * Set angular offset from the 3-o'clock position of the low end of the Scale. - * (Applies only to round Scales.) - * @param obj pointer to Scale Widget - * @param rotation clockwise angular offset (in degrees) from the 3-o'clock position - * of the low end of the scale; negative and >360 values are first normalized - * to range [0..360]. - * Examples: - * - 0 = 3 o'clock (right side) - * - 30 = 4 o'clock - * - 60 = 5 o'clock - * - 90 = 6 o'clock - * - 135 = midway between 7 and 8 o'clock (default) - * - 180 = 9 o'clock - * - 270 = 12 o'clock - * - 300 = 1 o'clock - * - 330 = 2 o'clock - * - -30 = 2 o'clock - * - 390 = 4 o'clock - */ -void lv_scale_set_rotation(lv_obj_t * obj, int32_t rotation); - -/** - * Point line needle to specified value. - * @param obj pointer to Scale Widget - * @param needle_line needle_line of the Scale. The line points will be allocated and - * managed by the Scale unless the line point array was previously set - * using `lv_line_set_points_mutable`. - * @param needle_length length of the needle - * - needle_length>0: needle_length=needle_length; - * - needle_length<0: needle_length=radius-|needle_length|; - * @param value Scale value needle will point to - */ -void lv_scale_set_line_needle_value(lv_obj_t * obj, lv_obj_t * needle_line, int32_t needle_length, - int32_t value); - -/** - * Point image needle to specified value; - image must point to the right. E.g. -O------> - * @param obj pointer to Scale Widget - * @param needle_img pointer to needle's Image - * @param value Scale value needle will point to - */ -void lv_scale_set_image_needle_value(lv_obj_t * obj, lv_obj_t * needle_img, int32_t value); - -/** - * Set custom text source for major ticks labels. - * @param obj pointer to Scale Widget - * @param txt_src pointer to an array of strings which will be display at major ticks; - * last element must be a NULL pointer. - */ -void lv_scale_set_text_src(lv_obj_t * obj, const char * txt_src[]); - -/** - * Draw Scale after all its children are drawn. - * @param obj pointer to Scale Widget - * @param en true: enable post draw - */ -void lv_scale_set_post_draw(lv_obj_t * obj, bool en); - -/** - * Draw Scale ticks on top of all other parts. - * @param obj pointer to Scale Widget - * @param en true: enable draw ticks on top of all parts - */ -void lv_scale_set_draw_ticks_on_top(lv_obj_t * obj, bool en); - -/** - * Add a Section to specified Scale. Section will not be drawn until - * a valid range is set for it using `lv_scale_set_section_range()`. - * @param obj pointer to Scale Widget - * @return pointer to new Section - */ -lv_scale_section_t * lv_scale_add_section(lv_obj_t * obj); - -/** - * DEPRECATED, use lv_scale_set_section_range instead. - * Set range for specified Scale Section - * @param section pointer to Section - * @param range_min Section new minimum value - * @param range_max Section new maximum value - */ -void lv_scale_section_set_range(lv_scale_section_t * section, int32_t min, int32_t max); - -/** - * Set the range of a scale section - * @param scale pointer to scale - * @param section pointer to section - * @param range_min the section's new minimum value - * @param range_max the section's new maximum value - */ -void lv_scale_set_section_range(lv_obj_t * scale, lv_scale_section_t * section, int32_t min, int32_t max); - -/** - * Set the minimum value of a scale section - * @param scale pointer to scale - * @param section pointer to section - * @param min the section's new minimum value - */ -void lv_scale_set_section_min_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t min); - -/** - * Set the maximum value of a scale section - * @param scale pointer to scale - * @param section pointer to section - * @param max the section's new maximum value - */ -void lv_scale_set_section_max_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t max); - -/** - * DEPRECATED, use lv_scale_set_section_style_main/indicator/items instead. - * Set style for specified part of Section. - * @param section pointer to Section - * @param part the part of the Scale the style will apply to, e.g. LV_PART_INDICATOR - * @param section_part_style pointer to style to apply - */ -void lv_scale_section_set_style(lv_scale_section_t * section, lv_part_t part, lv_style_t * section_part_style); - -/** - * Set the style of the line on a section. - * @param scale pointer to scale - * @param section pointer to section - * @param style point to a style - */ -void lv_scale_set_section_style_main(lv_obj_t * scale, lv_scale_section_t * section, const lv_style_t * style); - -/** - * Set the style of the major ticks and label on a section. - * @param scale pointer to scale - * @param section pointer to section - * @param style point to a style - */ -void lv_scale_set_section_style_indicator(lv_obj_t * scale, lv_scale_section_t * section, const lv_style_t * style); - -/** - * Set the style of the minor ticks on a section. - * @param scale pointer to scale - * @param section pointer to section - * @param style point to a style - */ -void lv_scale_set_section_style_items(lv_obj_t * scale, lv_scale_section_t * section, const lv_style_t * style); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get scale mode. See lv_scale_mode_t - * @param obj pointer to Scale Widget - * @return Scale mode - */ -lv_scale_mode_t lv_scale_get_mode(lv_obj_t * obj); - -/** - * Get scale total tick count (including minor and major ticks) - * @param obj pointer to Scale Widget - * @return Scale total tick count - */ -int32_t lv_scale_get_total_tick_count(lv_obj_t * obj); - -/** - * Get how often the major tick will be drawn - * @param obj pointer to Scale Widget - * @return Scale major tick every count - */ -int32_t lv_scale_get_major_tick_every(lv_obj_t * obj); - -/** - * Get angular location of low end of Scale. - * @param obj pointer to Scale Widget - * @return Scale low end angular location - */ -int32_t lv_scale_get_rotation(lv_obj_t * obj); - -/** - * Gets label visibility - * @param obj pointer to Scale Widget - * @return true if tick label is enabled, false otherwise - */ -bool lv_scale_get_label_show(lv_obj_t * obj); - -/** - * Get Scale's range in degrees - * @param obj pointer to Scale Widget - * @return Scale's angle_range - */ -uint32_t lv_scale_get_angle_range(lv_obj_t * obj); - -/** - * Get minimum value for Scale - * @param obj pointer to Scale Widget - * @return Scale's minimum value - */ -int32_t lv_scale_get_range_min_value(lv_obj_t * obj); - -/** - * Get maximum value for Scale - * @param obj pointer to Scale Widget - * @return Scale's maximum value - */ -int32_t lv_scale_get_range_max_value(lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -#if LV_USE_OBSERVER - -/** - * Bind an integer subject to a scales section minimum value - * @param obj pointer to a Scale - * @param section pointer to a Scale section - * @param subject pointer to a Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_scale_bind_section_min_value(lv_obj_t * obj, lv_scale_section_t * section, lv_subject_t * subject); - -/** - * Bind an integer subject to a scales section maximum value - * @param obj pointer to an Scale - * @param section pointer to a Scale section - * @param subject pointer to a Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_scale_bind_section_max_value(lv_obj_t * obj, lv_scale_section_t * section, lv_subject_t * subject); - -/** - * Bind an integer subject to a scale's line needle value - * @param obj pointer to a Scale - * @param needle_line pointer to a line needle - * @param needle_length length of the needle - * @param subject pointer to a Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_scale_bind_line_needle_value(lv_obj_t * obj, lv_obj_t * needle_line, int32_t needle_length, - lv_subject_t * subject); - -/** - * Bind an integer subject to a scale's image needle value - * @param obj pointer to a Scale - * @param needle_img pointer to an image needle - * @param subject pointer to a Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_scale_bind_image_needle_value(lv_obj_t * obj, lv_obj_t * needle_img, lv_subject_t * subject); - -#endif - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SCALE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_SCALE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/scale/lv_scale_private.h b/src/widgets/scale/lv_scale_private.h index ba4ef9d837..49928534fd 100644 --- a/src/widgets/scale/lv_scale_private.h +++ b/src/widgets/scale/lv_scale_private.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_scale.h" - -#if LV_USE_SCALE != 0 #include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" + +#if LV_USE_SCALE /********************* * DEFINES diff --git a/src/widgets/slider/lv_slider.c b/src/widgets/slider/lv_slider.c index 8e8ade49d7..8070d82a3a 100644 --- a/src/widgets/slider/lv_slider.c +++ b/src/widgets/slider/lv_slider.c @@ -7,23 +7,21 @@ * INCLUDES *********************/ #include "lv_slider_private.h" + +#if LV_USE_SLIDER + #include "../../misc/lv_area_private.h" #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_event_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_SLIDER != 0 - -#include "../../misc/lv_assert.h" -#include "../../core/lv_group.h" -#include "../../indev/lv_indev.h" #include "../../indev/lv_indev_private.h" -#include "../../display/lv_display.h" -#include "../../draw/lv_draw.h" -#include "../../stdlib/lv_string.h" -#include "../../misc/lv_math.h" -#include "../image/lv_image.h" #include "../../core/lv_observer_private.h" +/*Check dependencies*/ +#if LV_USE_BAR == 0 + #error "lv_slider: lv_bar is required. Enable it in lv_conf.h (LV_USE_BAR 1)" +#endif + /********************* * DEFINES *********************/ diff --git a/src/widgets/slider/lv_slider.h b/src/widgets/slider/lv_slider.h index 5fb0120b0b..a243b452d0 100644 --- a/src/widgets/slider/lv_slider.h +++ b/src/widgets/slider/lv_slider.h @@ -1,207 +1,2 @@ -/** - * @file lv_slider.h - * - */ - -#ifndef LV_SLIDER_H -#define LV_SLIDER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../bar/lv_bar.h" - -#if LV_USE_SLIDER != 0 - -/*Testing of dependencies*/ -#if LV_USE_BAR == 0 -#error "lv_slider: lv_bar is required. Enable it in lv_conf.h (LV_USE_BAR 1)" -#endif - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_SLIDER_MODE_NORMAL = LV_BAR_MODE_NORMAL, - LV_SLIDER_MODE_SYMMETRICAL = LV_BAR_MODE_SYMMETRICAL, - LV_SLIDER_MODE_RANGE = LV_BAR_MODE_RANGE -} lv_slider_mode_t; - -typedef enum { - LV_SLIDER_ORIENTATION_AUTO = LV_BAR_ORIENTATION_AUTO, - LV_SLIDER_ORIENTATION_HORIZONTAL = LV_BAR_ORIENTATION_HORIZONTAL, - LV_SLIDER_ORIENTATION_VERTICAL = LV_BAR_ORIENTATION_VERTICAL -} lv_slider_orientation_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_slider_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_slider_id_t { - LV_PROPERTY_ID2(SLIDER, VALUE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_BOOL, 0), - LV_PROPERTY_ID2(SLIDER, LEFT_VALUE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_BOOL, 1), - LV_PROPERTY_ID2(SLIDER, RANGE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(SLIDER, MIN_VALUE, LV_PROPERTY_TYPE_INT, 4), - LV_PROPERTY_ID(SLIDER, MAX_VALUE, LV_PROPERTY_TYPE_INT, 5), - LV_PROPERTY_ID(SLIDER, MODE, LV_PROPERTY_TYPE_INT, 6), - LV_PROPERTY_ID(SLIDER, IS_DRAGGED, LV_PROPERTY_TYPE_BOOL, 7), - LV_PROPERTY_ID(SLIDER, IS_SYMMETRICAL, LV_PROPERTY_TYPE_BOOL, 8), - LV_PROPERTY_SLIDER_END, -}; -#endif -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a slider object - * @param parent pointer to an object, it will be the parent of the new slider. - * @return pointer to the created slider - */ -lv_obj_t * lv_slider_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set a new value on the slider - * @param obj pointer to a slider object - * @param value the new value - * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately - */ -void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); - -/** - * Set a new value for the left knob of a slider - * @param obj pointer to a slider object - * @param value new value - * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately - */ -void lv_slider_set_start_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); - -/** - * Set the minimum and the maximum values of a bar - * @param obj pointer to the slider object - * @param min minimum value - * @param max maximum value - */ -void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max); - -/** - * Set the minimum values of a bar - * @param obj pointer to the slider object - * @param min minimum value - */ -void lv_slider_set_min_value(lv_obj_t * obj, int32_t min); - -/** - * Set the maximum values of a bar - * @param obj pointer to the slider object - * @param max maximum value - */ -void lv_slider_set_max_value(lv_obj_t * obj, int32_t max); - -/** - * Set the mode of slider. - * @param obj pointer to a slider object - * @param mode the mode of the slider. See `lv_slider_mode_t` - */ -void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode); - -/** - * Set the orientation of slider. - * @param obj pointer to a slider object - * @param orientation slider orientation from `lv_slider_orientation_t` - */ -void lv_slider_set_orientation(lv_obj_t * obj, lv_slider_orientation_t orientation); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the value of the main knob of a slider - * @param obj pointer to a slider object - * @return the value of the main knob of the slider - */ -int32_t lv_slider_get_value(const lv_obj_t * obj); - -/** - * Get the value of the left knob of a slider - * @param obj pointer to a slider object - * @return the value of the left knob of the slider - */ -int32_t lv_slider_get_left_value(const lv_obj_t * obj); - -/** - * Get the minimum value of a slider - * @param obj pointer to a slider object - * @return the minimum value of the slider - */ -int32_t lv_slider_get_min_value(const lv_obj_t * obj); - -/** - * Get the maximum value of a slider - * @param obj pointer to a slider object - * @return the maximum value of the slider - */ -int32_t lv_slider_get_max_value(const lv_obj_t * obj); - -/** - * Give the slider is being dragged or not - * @param obj pointer to a slider object - * @return true: drag in progress false: not dragged - */ -bool lv_slider_is_dragged(const lv_obj_t * obj); - -/** - * Get the mode of the slider. - * @param slider pointer to a slider object - * @return see `lv_slider_mode_t` - */ -lv_slider_mode_t lv_slider_get_mode(lv_obj_t * slider); - -/** - * Get the orientation of slider. - * @param obj pointer to a slider object - * @return slider orientation from `lv_slider_orientation_t` - */ -lv_slider_orientation_t lv_slider_get_orientation(lv_obj_t * slider); - -/** - * Give the slider is in symmetrical mode or not - * @param obj pointer to slider object - * @return true: in symmetrical mode false : not in -*/ -bool lv_slider_is_symmetrical(lv_obj_t * obj); - - -#if LV_USE_OBSERVER -/** - * Bind an integer or float Subject to a Slider's value. - * @param obj pointer to Slider - * @param subject pointer to Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_slider_bind_value(lv_obj_t * obj, lv_subject_t * subject); -#endif - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SLIDER*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_SLIDER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/slider/lv_slider_private.h b/src/widgets/slider/lv_slider_private.h index 0b4464db68..46436d92bb 100644 --- a/src/widgets/slider/lv_slider_private.h +++ b/src/widgets/slider/lv_slider_private.h @@ -14,10 +14,12 @@ extern "C" { * INCLUDES *********************/ -#include "../bar/lv_bar_private.h" -#include "lv_slider.h" +#include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" -#if LV_USE_SLIDER != 0 +#if LV_USE_SLIDER + +#include "../bar/lv_bar_private.h" /********************* * DEFINES diff --git a/src/widgets/span/lv_span.c b/src/widgets/span/lv_span.c index cb0ccc6c7b..619aac4909 100644 --- a/src/widgets/span/lv_span.c +++ b/src/widgets/span/lv_span.c @@ -7,13 +7,12 @@ * INCLUDES *********************/ #include "lv_span_private.h" + +#if LV_USE_SPAN + #include "../../misc/lv_area_private.h" #include "../../draw/lv_draw_private.h" #include "../../core/lv_obj_class_private.h" - -#if LV_USE_SPAN != 0 - -#include "../../misc/lv_assert.h" #include "../../misc/lv_text_private.h" #include "../../misc/lv_bidi_private.h" #include "../../core/lv_observer_private.h" diff --git a/src/widgets/span/lv_span.h b/src/widgets/span/lv_span.h index 569e17f074..865c3a470d 100644 --- a/src/widgets/span/lv_span.h +++ b/src/widgets/span/lv_span.h @@ -1,377 +1,2 @@ -/** - * @file lv_span.h - * - */ - -#ifndef LV_SPAN_H -#define LV_SPAN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../core/lv_obj.h" -#include "../../core/lv_observer.h" -#include "../../core/lv_obj_property.h" - -#if LV_USE_SPAN != 0 - -/********************* - * DEFINES - *********************/ -#ifndef LV_SPAN_SNIPPET_STACK_SIZE -#define LV_SPAN_SNIPPET_STACK_SIZE 64 -#endif - -/********************** - * TYPEDEFS - **********************/ -typedef enum { - LV_SPAN_OVERFLOW_CLIP, - LV_SPAN_OVERFLOW_ELLIPSIS, - LV_SPAN_OVERFLOW_LAST, /**< Fence member*/ -} lv_span_overflow_t; - -typedef enum { - LV_SPAN_MODE_FIXED, /**< fixed the obj size */ - LV_SPAN_MODE_EXPAND, /**< Expand the object size to the text size */ - LV_SPAN_MODE_BREAK, /**< Keep width, break the too long lines and expand height */ - LV_SPAN_MODE_LAST /**< Fence member */ -} lv_span_mode_t; - -/** Coords of a span */ -typedef struct _lv_span_coords_t { - lv_area_t heading; - lv_area_t middle; - lv_area_t trailing; -} lv_span_coords_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spangroup_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_span_id_t { - LV_PROPERTY_ID(SPAN, ALIGN, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(SPAN, OVERFLOW, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_ID(SPAN, INDENT, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(SPAN, MODE, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_ID(SPAN, MAX_LINES, LV_PROPERTY_TYPE_INT, 4), - LV_PROPERTY_SPAN_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -void lv_span_stack_init(void); -void lv_span_stack_deinit(void); - -/** - * Create a spangroup object - * @param parent pointer to an object, it will be the parent of the new spangroup - * @return pointer to the created spangroup - */ -lv_obj_t * lv_spangroup_create(lv_obj_t * parent); - -/** - * Create a span string descriptor and add to spangroup. - * @param obj pointer to a spangroup object. - * @return pointer to the created span. - */ -lv_span_t * lv_spangroup_add_span(lv_obj_t * obj); - -/** - * Remove the span from the spangroup and free memory. - * @param obj pointer to a spangroup object. - * @param span pointer to a span. - * @note Note that before calling `lv_spangroup_delete_span` - * `lv_observer_remove` needs to be called manually as LVGL can't remove the - * binding automatically. - */ -void lv_spangroup_delete_span(lv_obj_t * obj, lv_span_t * span); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set a new text for a span. Memory will be allocated to store the text by the span. - * As the spangroup is not passed a redraw (invalidation) can't be triggered automatically. - * Therefore `lv_spangroup_refresh(spangroup)` needs to be called manually, - * @param span pointer to a span. - * @param text pointer to a text. - */ -void lv_span_set_text(lv_span_t * span, const char * text); - - -/** - * Set a new text for a span using a printf-like formatting string. - * Memory will be allocated to store the text by the span. - * As the spangroup is not passed a redraw (invalidation) can't be triggered automatically. - * Therefore `lv_spangroup_refresh(spangroup)` needs to be called manually, - * @param span pointer to a span. - * @param fmt `printf`-like format string - */ -void lv_span_set_text_fmt(lv_span_t * span, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); - -/** - * Set a static text. It will not be saved by the span so the 'text' variable - * has to be 'alive' while the span exist. - * As the spangroup is not passed a redraw (invalidation) can't be triggered automatically. - * Therefore `lv_spangroup_refresh(spangroup)` needs to be called manually, - * - * @param span pointer to a span. - * @param text pointer to a text. - */ -void lv_span_set_text_static(lv_span_t * span, const char * text); - -/** - * Set a new text for a span. Memory will be allocated to store the text by the span. - * @param obj pointer to a spangroup widget. - * @param span pointer to a span. - * @param text pointer to a text. - */ -void lv_spangroup_set_span_text(lv_obj_t * obj, lv_span_t * span, const char * text); - -/** - * Set a new text for a span. Memory will be allocated to store the text by the span. - * @param obj pointer to a spangroup widget. - * @param span pointer to a span. - * @param text pointer to a text. - */ -void lv_spangroup_set_span_text_static(lv_obj_t * obj, lv_span_t * span, const char * text); - -/** - * Set a new text for a span using a printf-like formatting string. - * Memory will be allocated to store the text by the span. - * @param obj pointer to a spangroup widget. - * @param span pointer to a span. - * @param fmt `printf`-like format string - */ -void lv_spangroup_set_span_text_fmt(lv_obj_t * obj, lv_span_t * span, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(3, 4); - -/** - * Set a static text. It will not be saved by the span so the 'text' variable - * has to be 'alive' while the span exist. - * @param span pointer to a span. - * @param text pointer to a text. - */ -void lv_span_set_text_static(lv_span_t * span, const char * text); - -/** - * Copy all style properties of style to the bbuilt-in static style of the span. - * @param obj pointer_to a spangroup - * @param span pointer to a span. - * @param style pointer to a style to copy into the span's built-in style - */ -void lv_spangroup_set_span_style(lv_obj_t * obj, lv_span_t * span, const lv_style_t * style); - -/** - * DEPRECATED. Use the text_align style property instead - * Set the align of the spangroup. - * @param obj pointer to a spangroup object. - * @param align see lv_text_align_t for details. - */ -void lv_spangroup_set_align(lv_obj_t * obj, lv_text_align_t align); - -/** - * Set the overflow of the spangroup. - * @param obj pointer to a spangroup object. - * @param overflow see lv_span_overflow_t for details. - */ -void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow); - -/** - * Set the indent of the spangroup. - * @param obj pointer to a spangroup object. - * @param indent the first line indentation - */ -void lv_spangroup_set_indent(lv_obj_t * obj, int32_t indent); - -/** - * DEPRECATED, set the width to LV_SIZE_CONTENT or fixed value to control expanding/wrapping" - * Set the mode of the spangroup. - * @param obj pointer to a spangroup object. - * @param mode see lv_span_mode_t for details. - */ -void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode); - -/** - * Set maximum lines of the spangroup. - * @param obj pointer to a spangroup object. - * @param lines max lines that can be displayed in LV_SPAN_MODE_BREAK mode. < 0 means no limit. - */ -void lv_spangroup_set_max_lines(lv_obj_t * obj, int32_t lines); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get a pointer to the style of a span's built-in style. - * Any lv_style_set_... functions can be applied on the returned style. - * @param span pointer to the span - * @return pointer to the style. (valid as long as the span is valid) - */ -lv_style_t * lv_span_get_style(lv_span_t * span); - -/** - * Get a pointer to the text of a span - * @param span pointer to the span - * @return pointer to the text -*/ -const char * lv_span_get_text(lv_span_t * span); - -/** - * Get a spangroup child by its index. - * - * @param obj The spangroup object - * @param id the index of the child. - * 0: the oldest (firstly created) child - * 1: the second oldest - * child count-1: the youngest - * -1: the youngest - * -2: the second youngest - * @return The child span at index `id`, or NULL if the ID does not exist - */ -lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id); - -/** - * Get number of spans - * @param obj the spangroup object to get the child count of. - * @return the span count of the spangroup. - */ -uint32_t lv_spangroup_get_span_count(const lv_obj_t * obj); - -/** - * Get the align of the spangroup. - * @param obj pointer to a spangroup object. - * @return the align value. - */ -lv_text_align_t lv_spangroup_get_align(lv_obj_t * obj); - -/** - * Get the overflow of the spangroup. - * @param obj pointer to a spangroup object. - * @return the overflow value. - */ -lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t * obj); - -/** - * Get the indent of the spangroup. - * @param obj pointer to a spangroup object. - * @return the indent value. - */ -int32_t lv_spangroup_get_indent(lv_obj_t * obj); - -/** - * Get the mode of the spangroup. - * @param obj pointer to a spangroup object. - */ -lv_span_mode_t lv_spangroup_get_mode(lv_obj_t * obj); - -/** - * Get maximum lines of the spangroup. - * @param obj pointer to a spangroup object. - * @return the max lines value. - */ -int32_t lv_spangroup_get_max_lines(lv_obj_t * obj); - -/** - * Get max line height of all span in the spangroup. - * @param obj pointer to a spangroup object. - */ -int32_t lv_spangroup_get_max_line_height(lv_obj_t * obj); - -/** - * Get the text content width when all span of spangroup on a line. - * @param obj pointer to a spangroup object. - * @param max_width if text content width >= max_width, return max_width - * to reduce computation, if max_width == 0, returns the text content width. - * @return text content width or max_width. - */ -uint32_t lv_spangroup_get_expand_width(lv_obj_t * obj, uint32_t max_width); - -/** - * Get the text content height with width fixed. - * @param obj pointer to a spangroup object. - * @param width the width of the span group. - - */ -int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width); - -/** - * Get the span's coords in the spangroup. - * @note Before calling this function, please make sure that the layout of span group has been updated. - * Like calling lv_obj_update_layout() like function. - * - * +--------+ - * |Heading +--->------------------+ - * | Pos | | Heading | - * +--------+---+------------------+ - * | | - * | | - * | | - * | Middle +--------+| - * | |Trailing|| - * | +-| Pos || - * | | +--------+| - * +-------------------v-----------+ - * | Trailing | - * +-------------------+ - * @param obj pointer to a spangroup object. - * @param span pointer to a span. - * @return the span's coords in the spangroup. - */ -lv_span_coords_t lv_spangroup_get_span_coords(lv_obj_t * obj, const lv_span_t * span); - -/** - * Get the span object by point. - * @param obj pointer to a spangroup object. - * @param point pointer to point containing absolute coordinates - * @return pointer to the span under the point or `NULL` if not found. - */ -lv_span_t * lv_spangroup_get_span_by_point(lv_obj_t * obj, const lv_point_t * point); - -/*===================== - * Other functions - *====================*/ - -/** - * Update the mode of the spangroup. - * @param obj pointer to a spangroup object. - */ -void lv_spangroup_refresh(lv_obj_t * obj); - -#if LV_USE_OBSERVER - -/** - * Bind an integer, string, or pointer Subject to a Spangroup's Span. - * @param obj pointer to Spangroup - * @param span pointer to Span - * @param subject pointer to Subject - * @param fmt optional printf-like format string with 1 format specifier (e.g. "%d °C") - * or NULL to bind to the value directly. - * @return pointer to newly-created Observer - * @note If `fmt == NULL` strings and pointers (`\0` terminated string) will be shown - * as text as they are, integers as %d, floats as %0.1f - */ -lv_observer_t * lv_spangroup_bind_span_text(lv_obj_t * obj, lv_span_t * span, lv_subject_t * subject, const char * fmt); - -#endif - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SPAN*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_SPAN_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/span/lv_span_private.h b/src/widgets/span/lv_span_private.h index 3a8201319b..a2b0c4ee13 100644 --- a/src/widgets/span/lv_span_private.h +++ b/src/widgets/span/lv_span_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_span.h" +#include "../../lv_public_api.h" -#if LV_USE_SPAN != 0 +#if LV_USE_SPAN /********************* * DEFINES diff --git a/src/widgets/spinbox/lv_spinbox.c b/src/widgets/spinbox/lv_spinbox.c index 57b29f1af5..e42ee7998b 100644 --- a/src/widgets/spinbox/lv_spinbox.c +++ b/src/widgets/spinbox/lv_spinbox.c @@ -6,15 +6,20 @@ /********************* * INCLUDES *********************/ + #include "lv_spinbox_private.h" -#include "../../core/lv_obj_class_private.h" + #if LV_USE_SPINBOX -#include "../../misc/lv_assert.h" -#include "../../indev/lv_indev.h" -#include "../../stdlib/lv_string.h" +#include "../../core/lv_obj_class_private.h" #include "../../core/lv_observer_private.h" +/*Check dependencies*/ +#if LV_USE_TEXTAREA == 0 + #error "lv_spinbox: lv_textarea is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) " +#endif + + /********************* * DEFINES *********************/ diff --git a/src/widgets/spinbox/lv_spinbox.h b/src/widgets/spinbox/lv_spinbox.h index f31b2d539b..67d26593cd 100644 --- a/src/widgets/spinbox/lv_spinbox.h +++ b/src/widgets/spinbox/lv_spinbox.h @@ -1,253 +1,2 @@ -/** - * @file lv_spinbox.h - * - */ - -#ifndef LV_SPINBOX_H -#define LV_SPINBOX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../textarea/lv_textarea.h" - -#if LV_USE_SPINBOX - -/*Testing of dependencies*/ -#if LV_USE_TEXTAREA == 0 -#error "lv_spinbox: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) " -#endif - -/********************* - * DEFINES - *********************/ -#define LV_SPINBOX_MAX_DIGIT_COUNT 10 - -/********************** - * TYPEDEFS - **********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spinbox_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_spinbox_id_t { - LV_PROPERTY_ID(SPINBOX, VALUE, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(SPINBOX, ROLLOVER, LV_PROPERTY_TYPE_BOOL, 1), - LV_PROPERTY_ID(SPINBOX, DIGIT_COUNT, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(SPINBOX, DEC_POINT_POS, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_ID(SPINBOX, STEP, LV_PROPERTY_TYPE_INT, 4), - LV_PROPERTY_ID(SPINBOX, MIN_VALUE, LV_PROPERTY_TYPE_INT, 5), - LV_PROPERTY_ID(SPINBOX, MAX_VALUE, LV_PROPERTY_TYPE_INT, 6), - LV_PROPERTY_ID(SPINBOX, DIGIT_STEP_DIRECTION, LV_PROPERTY_TYPE_INT, 7), - LV_PROPERTY_SPINBOX_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a spinbox object - * @param parent pointer to an object, it will be the parent of the new spinbox - * @return pointer to the created spinbox - */ -lv_obj_t * lv_spinbox_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set spinbox value - * @param obj pointer to spinbox - * @param v value to be set - */ -void lv_spinbox_set_value(lv_obj_t * obj, int32_t v); - -/** - * Set spinbox rollover function - * @param obj pointer to spinbox - * @param rollover true or false to enable or disable (default) - */ -void lv_spinbox_set_rollover(lv_obj_t * obj, bool rollover); - -/** - * Set spinbox digit format (digit count and decimal format) - * @param obj pointer to spinbox - * @param digit_count number of digit excluding the decimal separator and the sign - * @param sep_pos number of digit before the decimal point. If 0, decimal point is not - * shown - */ -void lv_spinbox_set_digit_format(lv_obj_t * obj, uint32_t digit_count, uint32_t sep_pos); - -/** - * Set the number of digits - * @param obj pointer to spinbox - * @param digit_count number of digits - */ -void lv_spinbox_set_digit_count(lv_obj_t * obj, uint32_t digit_count); - -/** - * Set the position of the decimal point - * @param obj pointer to spinbox - * @param dec_point_pos 0: there is no separator, 2: two integer digits - */ -void lv_spinbox_set_dec_point_pos(lv_obj_t * obj, uint32_t dec_point_pos); - -/** - * Set spinbox step - * @param obj pointer to spinbox - * @param step steps on increment/decrement. Can be 1, 10, 100, 1000, etc the digit that will change. - */ -void lv_spinbox_set_step(lv_obj_t * obj, uint32_t step); - -/** - * Set spinbox value range - * @param obj pointer to spinbox - * @param min_value minimum value, inclusive - * @param max_value maximum value, inclusive - */ -void lv_spinbox_set_range(lv_obj_t * obj, int32_t min_value, int32_t max_value); - -/** - * Set the minimum value - * @param obj pointer to spinbox - * @param min_value the minimum value - */ -void lv_spinbox_set_min_value(lv_obj_t * obj, int32_t min_value); - -/** - * Set the maximum value - * @param obj pointer to spinbox - * @param max_value the maximum value - */ -void lv_spinbox_set_max_value(lv_obj_t * obj, int32_t max_value); - -/** - * Set cursor position to a specific digit for edition - * @param obj pointer to spinbox - * @param pos selected position in spinbox - */ -void lv_spinbox_set_cursor_pos(lv_obj_t * obj, uint32_t pos); - -/** - * Set direction of digit step when clicking an encoder button while in editing mode - * @param obj pointer to spinbox - * @param direction the direction (LV_DIR_RIGHT or LV_DIR_LEFT) - */ -void lv_spinbox_set_digit_step_direction(lv_obj_t * obj, lv_dir_t direction); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get spinbox rollover function status - * @param obj pointer to spinbox - */ -bool lv_spinbox_get_rollover(lv_obj_t * obj); - -/** - * Get the spinbox numeral value (user has to convert to float according to its digit format) - * @param obj pointer to spinbox - * @return value integer value of the spinbox - */ -int32_t lv_spinbox_get_value(lv_obj_t * obj); - -/** - * Get the spinbox step value (user has to convert to float according to its digit format) - * @param obj pointer to spinbox - * @return value integer step value of the spinbox - */ -int32_t lv_spinbox_get_step(lv_obj_t * obj); - -/** - * Get the spinbox digit count - * @param obj pointer to spinbox - * @return number of digits - */ -uint32_t lv_spinbox_get_digit_count(lv_obj_t * obj); - -/** - * Get the decimal point position - * @param obj pointer to spinbox - * @return decimal point position - */ -uint32_t lv_spinbox_get_dec_point_pos(lv_obj_t * obj); - -/** - * Get the spinbox minimum value - * @param obj pointer to spinbox - * @return minimum value - */ -int32_t lv_spinbox_get_min_value(lv_obj_t * obj); - -/** - * Get the spinbox maximum value - * @param obj pointer to spinbox - * @return maximum value - */ -int32_t lv_spinbox_get_max_value(lv_obj_t * obj); - -/** - * Get the digit step direction - * @param obj pointer to spinbox - * @return direction (LV_DIR_RIGHT or LV_DIR_LEFT) - */ -lv_dir_t lv_spinbox_get_digit_step_direction(lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -/** - * Select next lower digit for edition by dividing the step by 10 - * @param obj pointer to spinbox - */ -void lv_spinbox_step_next(lv_obj_t * obj); - -/** - * Select next higher digit for edition by multiplying the step by 10 - * @param obj pointer to spinbox - */ -void lv_spinbox_step_prev(lv_obj_t * obj); - -/** - * Increment spinbox value by one step - * @param obj pointer to spinbox - */ -void lv_spinbox_increment(lv_obj_t * obj); - -/** - * Decrement spinbox value by one step - * @param obj pointer to spinbox - */ -void lv_spinbox_decrement(lv_obj_t * obj); - - - -#if LV_USE_OBSERVER -/** - * Bind an integer subject to a Spinbox's value. - * @param obj pointer to Spinbox - * @param subject pointer to Subject - * @return pointer to newly-created Observer - */ -lv_observer_t * lv_spinbox_bind_value(lv_obj_t * obj, lv_subject_t * subject); -#endif - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SPINBOX*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif -#endif /*LV_SPINBOX_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/spinbox/lv_spinbox_private.h b/src/widgets/spinbox/lv_spinbox_private.h index 333bd50611..414cc045e3 100644 --- a/src/widgets/spinbox/lv_spinbox_private.h +++ b/src/widgets/spinbox/lv_spinbox_private.h @@ -14,11 +14,13 @@ extern "C" { * INCLUDES *********************/ -#include "../textarea/lv_textarea_private.h" -#include "lv_spinbox.h" +#include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" #if LV_USE_SPINBOX +#include "../textarea/lv_textarea_private.h" + /********************* * DEFINES *********************/ diff --git a/src/widgets/spinner/lv_spinner.c b/src/widgets/spinner/lv_spinner.c index 23c3a74810..53d173a595 100644 --- a/src/widgets/spinner/lv_spinner.c +++ b/src/widgets/spinner/lv_spinner.c @@ -12,7 +12,16 @@ #include "../../misc/lv_anim_private.h" #include "../../core/lv_obj_class_private.h" -#include "../../core/lv_obj_property.h" + +/*Check dependencies*/ +#if LV_USE_ARC == 0 + #error "lv_spinner: lv_arc is required. Enable it in lv_conf.h (LV_USE_ARC 1) " +#endif + +/*Check dependencies*/ +#if LV_USE_ARC == 0 + #error "lv_spinner: lv_arc is required. Enable it in lv_conf.h (LV_USE_ARC 1) " +#endif /********************* * DEFINES diff --git a/src/widgets/spinner/lv_spinner.h b/src/widgets/spinner/lv_spinner.h index 4a3e5f5be0..0f123433f1 100644 --- a/src/widgets/spinner/lv_spinner.h +++ b/src/widgets/spinner/lv_spinner.h @@ -1,104 +1,2 @@ -/** - * @file lv_spinner.h - * - */ - -#ifndef LV_SPINNER_H -#define LV_SPINNER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_SPINNER - -#include "../../misc/lv_types.h" -#include "../../core/lv_obj_property.h" - -/*Testing of dependencies*/ -#if LV_USE_ARC == 0 -#error "lv_spinner: lv_arc is required. Enable it in lv_conf.h (LV_USE_ARC 1) " -#endif - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spinner_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_spinner_id_t { - LV_PROPERTY_ID(SPINNER, ANIM_DURATION, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(SPINNER, ARC_SWEEP, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_SPINNER_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a spinner widget - * @param parent pointer to an object, it will be the parent of the new spinner. - * @return the created spinner - */ -lv_obj_t * lv_spinner_create(lv_obj_t * parent); - -/** - * Set the animation time and arc length of the spinner - * The animation is suited for angle values between 180 and 360. - * @param obj pointer to a spinner - * @param t the animation time in milliseconds - * @param angle the angle of the arc in degrees - */ -void lv_spinner_set_anim_params(lv_obj_t * obj, uint32_t t, uint32_t angle); - -/** - * Set the animation time of the spinner - * @param obj pointer to a spinner - * @param t the animation time in milliseconds - */ -void lv_spinner_set_anim_duration(lv_obj_t * obj, uint32_t t); - -/** - * Set the animation arc length of the spinner. - * The animation is suited to values between 180 and 360. - * @param obj pointer to a spinner - * @param angle the angle of the arc in degrees - */ -void lv_spinner_set_arc_sweep(lv_obj_t * obj, uint32_t angle); - -/** - * Get the animation duration of the spinner - * @param obj pointer to a spinner - * @return the animation time in milliseconds - */ -uint32_t lv_spinner_get_anim_duration(lv_obj_t * obj); - -/** - * Get the animation arc length of the spinner - * @param obj pointer to a spinner - * @return the angle of the arc in degrees - */ -uint32_t lv_spinner_get_arc_sweep(lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SPINNER*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_SPINNER_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/spinner/lv_spinner_private.h b/src/widgets/spinner/lv_spinner_private.h index 579dcd4ce4..88de6b06f7 100644 --- a/src/widgets/spinner/lv_spinner_private.h +++ b/src/widgets/spinner/lv_spinner_private.h @@ -14,7 +14,9 @@ extern "C" { * INCLUDES *********************/ -#include "lv_spinner.h" +#include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" + #if LV_USE_SPINNER #include "../arc/lv_arc_private.h" diff --git a/src/widgets/switch/lv_switch.c b/src/widgets/switch/lv_switch.c index 0b1b14f2bc..8dd04c79a9 100644 --- a/src/widgets/switch/lv_switch.c +++ b/src/widgets/switch/lv_switch.c @@ -10,13 +10,9 @@ #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_SWITCH != 0 +#if LV_USE_SWITCH -#include "../../misc/lv_assert.h" -#include "../../misc/lv_math.h" #include "../../misc/lv_anim_private.h" -#include "../../indev/lv_indev.h" -#include "../../display/lv_display.h" /********************* * DEFINES diff --git a/src/widgets/switch/lv_switch.h b/src/widgets/switch/lv_switch.h index 25b0ed81a7..543ff472fb 100644 --- a/src/widgets/switch/lv_switch.h +++ b/src/widgets/switch/lv_switch.h @@ -1,91 +1,2 @@ -/** - * @file lv_switch.h - * - */ - -#ifndef LV_SWITCH_H -#define LV_SWITCH_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" - -#if LV_USE_SWITCH != 0 - -#include "../../core/lv_obj.h" - -/********************* - * DEFINES - *********************/ - -/** Switch knob extra area correction factor */ -#define LV_SWITCH_KNOB_EXT_AREA_CORRECTION 2 - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_switch_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_switch_id_t { - LV_PROPERTY_ID(SWITCH, ORIENTATION, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_SWITCH_END, -}; -#endif - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_SWITCH_ORIENTATION_AUTO, - LV_SWITCH_ORIENTATION_HORIZONTAL, - LV_SWITCH_ORIENTATION_VERTICAL -} lv_switch_orientation_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a switch object - * @param parent pointer to an object, it will be the parent of the new switch - * @return pointer to the created switch - */ -lv_obj_t * lv_switch_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the orientation of switch. - * @param obj pointer to switch object - * @param orientation switch orientation from `lv_switch_orientation_t` - */ -void lv_switch_set_orientation(lv_obj_t * obj, lv_switch_orientation_t orientation); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the orientation of switch. - * @param obj pointer to switch object - * @return switch orientation from ::lv_switch_orientation_t - */ -lv_switch_orientation_t lv_switch_get_orientation(lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_SWITCH*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_SWITCH_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/switch/lv_switch_private.h b/src/widgets/switch/lv_switch_private.h index 66e90d324d..8180731f11 100644 --- a/src/widgets/switch/lv_switch_private.h +++ b/src/widgets/switch/lv_switch_private.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_switch.h" - -#if LV_USE_SWITCH != 0 #include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" + +#if LV_USE_SWITCH /********************* * DEFINES diff --git a/src/widgets/table/lv_table.c b/src/widgets/table/lv_table.c index c4ff98fcc6..45e08ca794 100644 --- a/src/widgets/table/lv_table.c +++ b/src/widgets/table/lv_table.c @@ -6,20 +6,17 @@ /********************* * INCLUDES *********************/ + #include "lv_table_private.h" + +#if LV_USE_TABLE + #include "../../misc/lv_area_private.h" #include "../../core/lv_obj_private.h" #include "../../core/lv_obj_class_private.h" -#if LV_USE_TABLE != 0 - -#include "../../indev/lv_indev.h" -#include "../../misc/lv_assert.h" #include "../../misc/lv_text_private.h" #include "../../misc/lv_text_ap.h" -#include "../../misc/lv_math.h" -#include "../../stdlib/lv_sprintf.h" #include "../../draw/lv_draw_private.h" -#include "../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/widgets/table/lv_table.h b/src/widgets/table/lv_table.h index 7fdb7843da..7f81cf0b2a 100644 --- a/src/widgets/table/lv_table.h +++ b/src/widgets/table/lv_table.h @@ -1,224 +1,2 @@ -/** - * @file lv_table.h - * - */ - -#ifndef LV_TABLE_H -#define LV_TABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../label/lv_label.h" -#include "../../core/lv_obj_property.h" - -#if LV_USE_TABLE != 0 - -/*Testing of dependencies*/ -#if LV_USE_LABEL == 0 -#error "lv_table: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" -#endif - -/********************* - * DEFINES - *********************/ -#define LV_TABLE_CELL_NONE 0XFFFF -LV_EXPORT_CONST_INT(LV_TABLE_CELL_NONE); - -/********************** - * TYPEDEFS - **********************/ - -typedef enum { - LV_TABLE_CELL_CTRL_NONE = 0 << 0, - LV_TABLE_CELL_CTRL_MERGE_RIGHT = 1 << 0, - LV_TABLE_CELL_CTRL_TEXT_CROP = 1 << 1, - LV_TABLE_CELL_CTRL_CUSTOM_1 = 1 << 4, - LV_TABLE_CELL_CTRL_CUSTOM_2 = 1 << 5, - LV_TABLE_CELL_CTRL_CUSTOM_3 = 1 << 6, - LV_TABLE_CELL_CTRL_CUSTOM_4 = 1 << 7, -} lv_table_cell_ctrl_t; - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_table_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_table_id_t { - LV_PROPERTY_ID(TABLE, ROW_COUNT, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(TABLE, COLUMN_COUNT, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_TABLE_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a table object - * @param parent pointer to an object, it will be the parent of the new table - * @return pointer to the created table - */ -lv_obj_t * lv_table_create(lv_obj_t * parent); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the value of a cell. - * @param obj pointer to a Table object - * @param row id of the row [0 .. row_cnt -1] - * @param col id of the column [0 .. col_cnt -1] - * @param txt text to display in the cell. It will be copied and saved so this variable is not required after this function call. - * @note New roes/columns are added automatically if required - */ -void lv_table_set_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col, const char * txt); - -/** - * Set the value of a cell. Memory will be allocated to store the text by the table. - * @param obj pointer to a Table object - * @param row id of the row [0 .. row_cnt -1] - * @param col id of the column [0 .. col_cnt -1] - * @param fmt `printf`-like format - * @note New roes/columns are added automatically if required - */ -void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint32_t row, uint32_t col, const char * fmt, - ...) LV_FORMAT_ATTRIBUTE(4, 5); - -/** - * Set the number of rows - * @param obj table pointer to a Table object - * @param row_cnt number of rows - */ -void lv_table_set_row_count(lv_obj_t * obj, uint32_t row_cnt); - -/** - * Set the number of columns - * @param obj table pointer to a Table object - * @param col_cnt number of columns. - */ -void lv_table_set_column_count(lv_obj_t * obj, uint32_t col_cnt); - -/** - * Set the width of a column - * @param obj table pointer to a Table object - * @param col_id id of the column [0 .. LV_TABLE_COL_MAX -1] - * @param w width of the column - */ -void lv_table_set_column_width(lv_obj_t * obj, uint32_t col_id, int32_t w); - -/** - * Add control bits to the cell. - * @param obj pointer to a Table object - * @param row id of the row [0 .. row_cnt -1] - * @param col id of the column [0 .. col_cnt -1] - * @param ctrl OR-ed values from ::lv_table_cell_ctrl_t - */ -void lv_table_set_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl); - -/** - * Clear control bits of the cell. - * @param obj pointer to a Table object - * @param row id of the row [0 .. row_cnt -1] - * @param col id of the column [0 .. col_cnt -1] - * @param ctrl OR-ed values from ::lv_table_cell_ctrl_t - */ -void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl); - -/** - * Add custom user data to the cell. - * @param obj pointer to a Table object - * @param row id of the row [0 .. row_cnt -1] - * @param col id of the column [0 .. col_cnt -1] - * @param user_data pointer to the new user_data. - * Should be allocated by `lv_malloc`, - * and it will be freed automatically when the table is deleted or - * when the cell is dropped due to lower row or column count. - */ -void lv_table_set_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col, void * user_data); - -/** - * Set the selected cell - * @param obj pointer to a table object - * @param row id of the cell row to select - * @param col id of the cell column to select - */ -void lv_table_set_selected_cell(lv_obj_t * obj, uint16_t row, uint16_t col); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the value of a cell. - * @param obj pointer to a Table object - * @param row id of the row [0 .. row_cnt -1] - * @param col id of the column [0 .. col_cnt -1] - * @return text in the cell - */ -const char * lv_table_get_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col); - -/** - * Get the number of rows. - * @param obj table pointer to a Table object - * @return number of rows. - */ -uint32_t lv_table_get_row_count(lv_obj_t * obj); - -/** - * Get the number of columns. - * @param obj table pointer to a Table object - * @return number of columns. - */ -uint32_t lv_table_get_column_count(lv_obj_t * obj); - -/** - * Get the width of a column - * @param obj table pointer to a Table object - * @param col id of the column [0 .. LV_TABLE_COL_MAX -1] - * @return width of the column - */ -int32_t lv_table_get_column_width(lv_obj_t * obj, uint32_t col); - -/** - * Get whether a cell has the control bits - * @param obj pointer to a Table object - * @param row id of the row [0 .. row_cnt -1] - * @param col id of the column [0 .. col_cnt -1] - * @param ctrl OR-ed values from ::lv_table_cell_ctrl_t - * @return true: all control bits are set; false: not all control bits are set - */ -bool lv_table_has_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl); - -/** - * Get the selected cell (pressed and or focused) - * @param obj pointer to a table object - * @param row pointer to variable to store the selected row (LV_TABLE_CELL_NONE: if no cell selected) - * @param col pointer to variable to store the selected column (LV_TABLE_CELL_NONE: if no cell selected) - */ -void lv_table_get_selected_cell(lv_obj_t * obj, uint32_t * row, uint32_t * col); - -/** - * Get custom user data to the cell. - * @param obj pointer to a Table object - * @param row id of the row [0 .. row_cnt -1] - * @param col id of the column [0 .. col_cnt -1] - */ -void * lv_table_get_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TABLE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TABLE_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/table/lv_table_private.h b/src/widgets/table/lv_table_private.h index 816de1e701..9e53b67276 100644 --- a/src/widgets/table/lv_table_private.h +++ b/src/widgets/table/lv_table_private.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "lv_table.h" - -#if LV_USE_TABLE != 0 #include "../../core/lv_obj_private.h" +#include "../../lv_public_api.h" + +#if LV_USE_TABLE /********************* * DEFINES diff --git a/src/widgets/tabview/lv_tabview.c b/src/widgets/tabview/lv_tabview.c index 811ef14d5f..bc4c7d6ef3 100644 --- a/src/widgets/tabview/lv_tabview.c +++ b/src/widgets/tabview/lv_tabview.c @@ -7,12 +7,10 @@ * INCLUDES *********************/ #include "lv_tabview_private.h" -#include "../../core/lv_obj_class_private.h" -#include "../../lvgl.h" #if LV_USE_TABVIEW -#include "../../misc/lv_assert.h" +#include "../../core/lv_obj_class_private.h" #include "../../indev/lv_indev_private.h" /********************* diff --git a/src/widgets/tabview/lv_tabview.h b/src/widgets/tabview/lv_tabview.h index 9862e638c5..94cba4c9a6 100644 --- a/src/widgets/tabview/lv_tabview.h +++ b/src/widgets/tabview/lv_tabview.h @@ -1,152 +1,2 @@ -/** - * @file lv_tabview.h - * - */ - -#ifndef LV_TABVIEW_H -#define LV_TABVIEW_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../core/lv_obj.h" -#include "../../core/lv_obj_property.h" - -#if LV_USE_TABVIEW - -/********************* - * DEFINES - *********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tabview_class; - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_tabview_id_t { - LV_PROPERTY_ID(TABVIEW, TAB_ACTIVE, LV_PROPERTY_TYPE_INT, 0), - LV_PROPERTY_ID(TABVIEW, TAB_BAR_POSITION, LV_PROPERTY_TYPE_INT, 1), - LV_PROPERTY_TABVIEW_END, -}; -#endif - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a tabview widget - * @param parent pointer to a parent widget - * @return the created tabview - */ -lv_obj_t * lv_tabview_create(lv_obj_t * parent); - -/** - * Add a tab to the tabview - * @param obj pointer to a tabview widget - * @param name the name of the tab, it will be displayed on the tab bar - * @return the widget where the content of the tab can be created - */ -lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name); - -/** - * Change the name of the tab - * @param obj pointer to a tabview widget - * @param idx the index of the tab to rename - * @param new_name the new name as a string - */ -void lv_tabview_set_tab_text(lv_obj_t * obj, uint32_t idx, const char * new_name); - -#if LV_USE_TRANSLATION - -/** - * Add a tab with a translation tag to the tabview. - * @param obj pointer to a tabview widget - * @param tag translation key used for the tab label; will be displayed on the tab bar - * @return the widget where the content of the tab can be created - */ -lv_obj_t * lv_tabview_set_tab_translation_tag(lv_obj_t * obj, const char * tag); - -#endif - -/** - * Show a tab - * @param obj pointer to a tabview widget - * @param idx the index of the tab to show - * @param anim_en LV_ANIM_ON/OFF - */ -void lv_tabview_set_active(lv_obj_t * obj, uint32_t idx, lv_anim_enable_t anim_en); - -/** - * Set the position of the tab bar - * @param obj pointer to a tabview widget - * @param dir LV_DIR_TOP/BOTTOM/LEFT/RIGHT - */ -void lv_tabview_set_tab_bar_position(lv_obj_t * obj, lv_dir_t dir); - -/** - * Set the width or height of the tab bar - * @param obj pointer to tabview widget - * @param size size of the tab bar in pixels or percentage. - * will be used as width or height based on the position of the tab bar) - */ -void lv_tabview_set_tab_bar_size(lv_obj_t * obj, int32_t size); - -/** - * Get the number of tabs - * @param obj pointer to a tabview widget - * @return the number of tabs - */ -uint32_t lv_tabview_get_tab_count(lv_obj_t * obj); - -/** - * Get the current tab's index - * @param obj pointer to a tabview widget - * @return the zero based index of the current tab - */ -uint32_t lv_tabview_get_tab_active(lv_obj_t * obj); - -/** - * Get a given tab button by index - * @param obj pointer to a tabview widget - * @param idx zero based index of the tab button to get. - * < 0 means start counting tab button from the back (-1 is the last tab button) - * @return pointer to the tab button, or NULL if the index was out of range - */ -lv_obj_t * lv_tabview_get_tab_button(lv_obj_t * obj, int32_t idx); - -/** - * Get the widget where the container of each tab is created - * @param obj pointer to a tabview widget - * @return the main container widget - */ -lv_obj_t * lv_tabview_get_content(lv_obj_t * obj); - -/** - * Get the tab bar where the buttons are created - * @param obj pointer to a tabview widget - * @return the tab bar - */ -lv_obj_t * lv_tabview_get_tab_bar(lv_obj_t * obj); - -/** - * Get the position of the tab bar - * @param obj pointer to a tabview widget - * @return LV_DIR_TOP/BOTTOM/LEFT/RIGHT - */ -lv_dir_t lv_tabview_get_tab_bar_position(lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TABVIEW*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TABVIEW_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/tabview/lv_tabview_private.h b/src/widgets/tabview/lv_tabview_private.h index c7d3315735..69b0d0453d 100644 --- a/src/widgets/tabview/lv_tabview_private.h +++ b/src/widgets/tabview/lv_tabview_private.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_tabview.h" +#include "../../lv_public_api.h" #if LV_USE_TABVIEW diff --git a/src/widgets/textarea/lv_textarea.c b/src/widgets/textarea/lv_textarea.c index 6ee8aaeb8c..1bfe711240 100644 --- a/src/widgets/textarea/lv_textarea.c +++ b/src/widgets/textarea/lv_textarea.c @@ -8,19 +8,12 @@ *********************/ #include "lv_textarea_private.h" -#if LV_USE_TEXTAREA != 0 +#if LV_USE_TEXTAREA #include "../label/lv_label_private.h" #include "../../core/lv_obj_class_private.h" -#include "../../core/lv_group.h" -#include "../../core/lv_refr.h" -#include "../../indev/lv_indev.h" -#include "../../draw/lv_draw.h" -#include "../../misc/lv_assert.h" #include "../../misc/lv_anim_private.h" #include "../../misc/lv_text_private.h" -#include "../../misc/lv_math.h" -#include "../../stdlib/lv_string.h" /********************* * DEFINES diff --git a/src/widgets/textarea/lv_textarea.h b/src/widgets/textarea/lv_textarea.h index d9df59dc78..01258c4857 100644 --- a/src/widgets/textarea/lv_textarea.h +++ b/src/widgets/textarea/lv_textarea.h @@ -1,357 +1,2 @@ -/** - * @file lv_textarea.h - * - */ - -#ifndef LV_TEXTAREA_H -#define LV_TEXTAREA_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../label/lv_label.h" - -#if LV_USE_TEXTAREA != 0 - -/*Testing of dependencies*/ -#if LV_USE_LABEL == 0 -#error "lv_textarea: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" -#endif - -/********************* - * DEFINES - *********************/ -#define LV_TEXTAREA_CURSOR_LAST (0x7FFF) /*Put the cursor after the last character*/ -LV_EXPORT_CONST_INT(LV_TEXTAREA_CURSOR_LAST); - -#define LV_PART_TEXTAREA_PLACEHOLDER LV_PART_CUSTOM_FIRST -LV_EXPORT_CONST_INT(LV_PART_TEXTAREA_PLACEHOLDER); - -/********************** - * TYPEDEFS - **********************/ - -#if LV_USE_OBJ_PROPERTY -enum _lv_property_textarea_id_t { - LV_PROPERTY_ID(TEXTAREA, TEXT, LV_PROPERTY_TYPE_TEXT, 0), - LV_PROPERTY_ID(TEXTAREA, PLACEHOLDER_TEXT, LV_PROPERTY_TYPE_TEXT, 1), - LV_PROPERTY_ID(TEXTAREA, CURSOR_POS, LV_PROPERTY_TYPE_INT, 2), - LV_PROPERTY_ID(TEXTAREA, CURSOR_CLICK_POS, LV_PROPERTY_TYPE_INT, 3), - LV_PROPERTY_ID(TEXTAREA, PASSWORD_MODE, LV_PROPERTY_TYPE_INT, 4), - LV_PROPERTY_ID(TEXTAREA, PASSWORD_BULLET, LV_PROPERTY_TYPE_TEXT, 5), - LV_PROPERTY_ID(TEXTAREA, ONE_LINE, LV_PROPERTY_TYPE_BOOL, 6), - LV_PROPERTY_ID(TEXTAREA, ACCEPTED_CHARS, LV_PROPERTY_TYPE_TEXT, 7), - LV_PROPERTY_ID(TEXTAREA, MAX_LENGTH, LV_PROPERTY_TYPE_INT, 8), - LV_PROPERTY_ID(TEXTAREA, TEXT_SELECTION, LV_PROPERTY_TYPE_BOOL, 9), - LV_PROPERTY_ID(TEXTAREA, PASSWORD_SHOW_TIME, LV_PROPERTY_TYPE_INT, 10), - LV_PROPERTY_ID(TEXTAREA, LABEL, LV_PROPERTY_TYPE_OBJ, 11), - LV_PROPERTY_ID(TEXTAREA, TEXT_IS_SELECTED, LV_PROPERTY_TYPE_INT, 12), - LV_PROPERTY_ID(TEXTAREA, CURRENT_CHAR, LV_PROPERTY_TYPE_INT, 13), - LV_PROPERTY_TEXTAREA_END, -}; -#endif - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_textarea_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a text area object - * @param parent pointer to an object, it will be the parent of the new text area - * @return pointer to the created text area - */ -lv_obj_t * lv_textarea_create(lv_obj_t * parent); - -/*====================== - * Add/remove functions - *=====================*/ - -/** - * Insert a character to the current cursor position. - * To add a wide char, e.g. 'Á' use `lv_text_encoded_conv_wc('Á')` - * @param obj pointer to a text area object - * @param c a character (e.g. 'a') - */ -void lv_textarea_add_char(lv_obj_t * obj, uint32_t c); - -/** - * Insert a text to the current cursor position - * @param obj pointer to a text area object - * @param txt a '\0' terminated string to insert - */ -void lv_textarea_add_text(lv_obj_t * obj, const char * txt); - -/** - * Delete a the left character from the current cursor position - * @param obj pointer to a text area object - */ -void lv_textarea_delete_char(lv_obj_t * obj); - -/** - * Delete the right character from the current cursor position - * @param obj pointer to a text area object - */ -void lv_textarea_delete_char_forward(lv_obj_t * obj); - -/*===================== - * Setter functions - *====================*/ - -/** - * Set the text of a text area - * @param obj pointer to a text area object - * @param txt pointer to the text - */ -void lv_textarea_set_text(lv_obj_t * obj, const char * txt); - -/** - * Set the placeholder text of a text area - * @param obj pointer to a text area object - * @param txt pointer to the text - */ -void lv_textarea_set_placeholder_text(lv_obj_t * obj, const char * txt); - -/** - * Set the cursor position - * @param obj pointer to a text area object - * @param pos the new cursor position in character index - * < 0 : index from the end of the text - * LV_TEXTAREA_CURSOR_LAST: go after the last character - */ -void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos); - -/** - * Enable/Disable the positioning of the cursor by clicking the text on the text area. - * @param obj pointer to a text area object - * @param en true: enable click positions; false: disable - */ -void lv_textarea_set_cursor_click_pos(lv_obj_t * obj, bool en); - -/** - * Enable/Disable password mode - * @param obj pointer to a text area object - * @param en true: enable, false: disable - */ -void lv_textarea_set_password_mode(lv_obj_t * obj, bool en); - -/** - * Set the replacement characters to show in password mode - * @param obj pointer to a text area object - * @param bullet pointer to the replacement text - */ -void lv_textarea_set_password_bullet(lv_obj_t * obj, const char * bullet); - -/** - * Configure the text area to one line or back to normal - * @param obj pointer to a text area object - * @param en true: one line, false: normal - */ -void lv_textarea_set_one_line(lv_obj_t * obj, bool en); - -/** - * Set a list of characters. Only these characters will be accepted by the text area - * @param obj pointer to a text area object - * @param list list of characters. A copy is saved. Example: "+-.,0123456789" - */ -void lv_textarea_set_accepted_chars(lv_obj_t * obj, const char * list); - -/** - * Set a list of characters. Only these characters will be accepted by the text area - * @param obj pointer to a text area object - * @param list list of characters. Only the pointer is saved. Example: "+-.,0123456789" - */ -void lv_textarea_set_accepted_chars_static(lv_obj_t * obj, const char * list); - -/** - * Set max length of a Text Area. - * @param obj pointer to a text area object - * @param num the maximal number of characters can be added (`lv_textarea_set_text` ignores it) - */ -void lv_textarea_set_max_length(lv_obj_t * obj, uint32_t num); - -/** - * In `LV_EVENT_INSERT` the text which planned to be inserted can be replaced by another text. - * It can be used to add automatic formatting to the text area. - * @param obj pointer to a text area object - * @param txt pointer to a new string to insert. If `""` no text will be added. - * The variable must be live after the `event_cb` exists. (Should be `global` or `static`) - */ -void lv_textarea_set_insert_replace(lv_obj_t * obj, const char * txt); - -/** - * Enable/disable selection mode. - * @param obj pointer to a text area object - * @param en true or false to enable/disable selection mode - */ -void lv_textarea_set_text_selection(lv_obj_t * obj, bool en); - -/** - * Set how long show the password before changing it to '*' - * @param obj pointer to a text area object - * @param time show time in milliseconds. 0: hide immediately. - */ -void lv_textarea_set_password_show_time(lv_obj_t * obj, uint32_t time); - -/** - * @deprecated Use the normal text_align style property instead - * Set the label's alignment. - * It sets where the label is aligned (in one line mode it can be smaller than the text area) - * and how the lines of the area align in case of multiline text area - * @param obj pointer to a text area object - * @param align the align mode from ::lv_text_align_t - */ -void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align); - -/*===================== - * Getter functions - *====================*/ - -/** - * Get the text of a text area. In password mode it gives the real text (not '*'s). - * @param obj pointer to a text area object - * @return pointer to the text - */ -const char * lv_textarea_get_text(const lv_obj_t * obj); - -/** - * Get the placeholder text of a text area - * @param obj pointer to a text area object - * @return pointer to the text - */ -const char * lv_textarea_get_placeholder_text(lv_obj_t * obj); - -/** - * Get the label of a text area - * @param obj pointer to a text area object - * @return pointer to the label object - */ -lv_obj_t * lv_textarea_get_label(const lv_obj_t * obj); - -/** - * Get the current cursor position in character index - * @param obj pointer to a text area object - * @return the cursor position - */ -uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * obj); - -/** - * Get whether the cursor click positioning is enabled or not. - * @param obj pointer to a text area object - * @return true: enable click positions; false: disable - */ -bool lv_textarea_get_cursor_click_pos(lv_obj_t * obj); - -/** - * Get the password mode attribute - * @param obj pointer to a text area object - * @return true: password mode is enabled, false: disabled - */ -bool lv_textarea_get_password_mode(const lv_obj_t * obj); - -/** - * Get the replacement characters to show in password mode - * @param obj pointer to a text area object - * @return pointer to the replacement text - */ -const char * lv_textarea_get_password_bullet(lv_obj_t * obj); - -/** - * Get the one line configuration attribute - * @param obj pointer to a text area object - * @return true: one line configuration is enabled, false: disabled - */ -bool lv_textarea_get_one_line(const lv_obj_t * obj); - -/** - * Get a list of accepted characters. - * @param obj pointer to a text area object - * @return list of accented characters. - */ -const char * lv_textarea_get_accepted_chars(lv_obj_t * obj); - -/** - * Get max length of a Text Area. - * @param obj pointer to a text area object - * @return the maximal number of characters to be add - */ -uint32_t lv_textarea_get_max_length(lv_obj_t * obj); - -/** - * Find whether text is selected or not. - * @param obj pointer to a text area object - * @return whether text is selected or not - */ -bool lv_textarea_text_is_selected(const lv_obj_t * obj); - -/** - * Find whether selection mode is enabled. - * @param obj pointer to a text area object - * @return true: selection mode is enabled, false: disabled - */ -bool lv_textarea_get_text_selection(lv_obj_t * obj); - -/** - * Set how long show the password before changing it to '*' - * @param obj pointer to a text area object - * @return show time in milliseconds. 0: hide immediately. - */ -uint32_t lv_textarea_get_password_show_time(lv_obj_t * obj); - -/** - * Get a the character from the current cursor position - * @param obj pointer to a text area object - * @return a the character or 0 - */ -uint32_t lv_textarea_get_current_char(lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -/** - * Clear the selection on the text area. - * @param obj pointer to a text area object - */ -void lv_textarea_clear_selection(lv_obj_t * obj); - -/** - * Move the cursor one character right - * @param obj pointer to a text area object - */ -void lv_textarea_cursor_right(lv_obj_t * obj); - -/** - * Move the cursor one character left - * @param obj pointer to a text area object - */ -void lv_textarea_cursor_left(lv_obj_t * obj); - -/** - * Move the cursor one line down - * @param obj pointer to a text area object - */ -void lv_textarea_cursor_down(lv_obj_t * obj); - -/** - * Move the cursor one line up - * @param obj pointer to a text area object - */ -void lv_textarea_cursor_up(lv_obj_t * obj); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TEXTAREA_H*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TEXTAREA_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/textarea/lv_textarea_private.h b/src/widgets/textarea/lv_textarea_private.h index 31d7aa7394..c7db63d9e2 100644 --- a/src/widgets/textarea/lv_textarea_private.h +++ b/src/widgets/textarea/lv_textarea_private.h @@ -15,9 +15,9 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_textarea.h" +#include "../../lv_public_api.h" -#if LV_USE_TEXTAREA != 0 +#if LV_USE_TEXTAREA /********************* * DEFINES diff --git a/src/widgets/tileview/lv_tileview.c b/src/widgets/tileview/lv_tileview.c index fbec0b771c..c2dd2453d6 100644 --- a/src/widgets/tileview/lv_tileview.c +++ b/src/widgets/tileview/lv_tileview.c @@ -6,12 +6,14 @@ /********************* * INCLUDES *********************/ + #include "lv_tileview_private.h" -#include "../../core/lv_obj_class_private.h" -#include "../../indev/lv_indev.h" -#include "../../indev/lv_indev_private.h" + #if LV_USE_TILEVIEW +#include "../../core/lv_obj_class_private.h" +#include "../../indev/lv_indev_private.h" + /********************* * DEFINES *********************/ diff --git a/src/widgets/tileview/lv_tileview.h b/src/widgets/tileview/lv_tileview.h index 4058bb65d0..d109278005 100644 --- a/src/widgets/tileview/lv_tileview.h +++ b/src/widgets/tileview/lv_tileview.h @@ -1,86 +1,2 @@ -/** - * @file lv_tileview.h - * - */ - -#ifndef LV_TILEVIEW_H -#define LV_TILEVIEW_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../core/lv_obj.h" - -#if LV_USE_TILEVIEW - -/********************* - * DEFINES - *********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_class; -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_tile_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a tileview object - * @param parent pointer to an object, it will be the parent of the new tileview - * @return pointer to the created tileview - */ -lv_obj_t * lv_tileview_create(lv_obj_t * parent); - -/** - * Add a tile to the tileview - * @param tv pointer to the tileview object - * @param col_id column id of the tile - * @param row_id row id of the tile - * @param dir direction to move to the next tile - * @return pointer to the added tile object - */ -lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, lv_dir_t dir); - -/** - * Set the active tile in the tileview. - * @param parent pointer to the tileview object - * @param tile_obj pointer to the tile object to be set as active - * @param anim_en animation enable flag (LV_ANIM_ON or LV_ANIM_OFF) - */ -void lv_tileview_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_en); - -/** - * Set the active tile by index in the tileview - * @param tv pointer to the tileview object - * @param col_id column id of the tile to be set as active - * @param row_id row id of the tile to be set as active - * @param anim_en animation enable flag (LV_ANIM_ON or LV_ANIM_OFF) - */ -void lv_tileview_set_tile_by_index(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en); - -/** - * Get the currently active tile in the tileview - * @param obj pointer to the tileview object - * @return pointer to the currently active tile object - */ -lv_obj_t * lv_tileview_get_tile_active(lv_obj_t * obj); - -/*===================== - * Other functions - *====================*/ - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_TILEVIEW*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_TILEVIEW_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/tileview/lv_tileview_private.h b/src/widgets/tileview/lv_tileview_private.h index e343db0c5a..b5802e1214 100644 --- a/src/widgets/tileview/lv_tileview_private.h +++ b/src/widgets/tileview/lv_tileview_private.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_tileview.h" +#include "../../lv_public_api.h" #if LV_USE_TILEVIEW diff --git a/src/widgets/win/lv_win.h b/src/widgets/win/lv_win.h index 366a8b1b7a..148f61cce0 100644 --- a/src/widgets/win/lv_win.h +++ b/src/widgets/win/lv_win.h @@ -1,74 +1,2 @@ -/** - * @file lv_win.h - * - */ - -#ifndef LV_WIN_H -#define LV_WIN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../lv_conf_internal.h" -#include "../../core/lv_obj.h" -#if LV_USE_WIN -/********************* - * DEFINES - *********************/ - -LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_win_class; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Create a window widget - * @param parent pointer to a parent widget - * @return the created window - */ -lv_obj_t * lv_win_create(lv_obj_t * parent); - -/** - * Add a title to the window - * @param obj pointer to a window widget - * @param txt the text of the title - * @return the widget where the content of the title can be created - */ -lv_obj_t * lv_win_add_title(lv_obj_t * win, const char * txt); - -/** - * Add a button to the window - * @param obj pointer to a window widget - * @param icon an icon to be displayed on the button - * @param btn_w width of the button - * @return the widget where the content of the button can be created - */ -lv_obj_t * lv_win_add_button(lv_obj_t * win, const void * icon, int32_t btn_w); - -/** - * Get the header of the window - * @param win pointer to a window widget - * @return the header of the window - */ -lv_obj_t * lv_win_get_header(lv_obj_t * win); - -/** - * Get the content of the window - * @param win pointer to a window widget - * @return the content of the window - */ -lv_obj_t * lv_win_get_content(lv_obj_t * win); -/********************** - * MACROS - **********************/ -#endif /*LV_USE_WIN*/ -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_WIN_H*/ +#warning Include public headers from the `src` folder is deprecated. This file will be removed soon. To ensure your application keeps working, you can choose to include the new header in or include the main header file +#include "../../../include/lvgl/lvgl.h" diff --git a/src/widgets/win/lv_win_private.h b/src/widgets/win/lv_win_private.h index 25e40c594b..61b26a5a34 100644 --- a/src/widgets/win/lv_win_private.h +++ b/src/widgets/win/lv_win_private.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include "../../core/lv_obj_private.h" -#include "lv_win.h" +#include "../../lv_public_api.h" #if LV_USE_WIN diff --git a/tests/perf.py b/tests/perf.py index 93ea26aba9..47d1969969 100755 --- a/tests/perf.py +++ b/tests/perf.py @@ -520,6 +520,7 @@ def run_tests( test_src_dir = os.path.join(build_dir, "test_src") main_cmakelists = os.path.join(build_dir, "CMakeLists.txt") lvgl_src_dir = os.path.join(lvgl_test_dir, "..", "src") + lvgl_include_dir = os.path.join(lvgl_test_dir, "..", "include") lv_conf_path = os.path.join(lvgl_test_dir, "src", lv_conf_name) lvgl_h_path = os.path.join(lvgl_test_dir, "..", "lvgl.h") lvgl_private_h_path = os.path.join(lvgl_test_dir, "..", "lvgl_private.h") @@ -531,6 +532,7 @@ def run_tests( # It is also the reason we only support linux for now. volume("/dev", "/dev"), # Replace container's lvgl source and lv_conf + volume(lvgl_include_dir, so3_usr_lib("lvgl/include")), volume(lvgl_src_dir, so3_usr_lib("lvgl/src")), volume(lv_conf_path, so3_usr_lib("lv_conf.h")), volume(lvgl_h_path, so3_usr_lib("lvgl/lvgl.h")), diff --git a/tests/src/test_cases/draw/test_draw_svg.c b/tests/src/test_cases/draw/test_draw_svg.c index 9d2e5ce30f..e08989c089 100644 --- a/tests/src/test_cases/draw/test_draw_svg.c +++ b/tests/src/test_cases/draw/test_draw_svg.c @@ -1,6 +1,7 @@ #if LV_BUILD_TEST #include "../lvgl.h" #include "../src/misc/cache/lv_cache.h" +#include "../src/libs/svg/lv_svg_render.h" #include diff --git a/tests/src/test_cases/test_lcd.c b/tests/src/test_cases/test_lcd.c index 9102324026..591411a8c4 100644 --- a/tests/src/test_cases/test_lcd.c +++ b/tests/src/test_cases/test_lcd.c @@ -1,5 +1,6 @@ #if LV_BUILD_TEST #include "../lvgl.h" +#include "../lvgl_private.h" #include "unity/unity.h" #define TEST_LCD_WIDTH 64 diff --git a/tests/src/test_cases/test_ll.c b/tests/src/test_cases/test_ll.c index 4b15d325d9..8c46f883bd 100644 --- a/tests/src/test_cases/test_ll.c +++ b/tests/src/test_cases/test_ll.c @@ -1,8 +1,7 @@ - #if LV_BUILD_TEST #include "../lvgl.h" -#include "../../src/misc/lv_ll.h" #include "unity/unity.h" + /* Test fixture */ static lv_ll_t test_ll; diff --git a/tests/src/test_cases/test_palette.c b/tests/src/test_cases/test_palette.c index 2d3307813c..aeaabb6e00 100644 --- a/tests/src/test_cases/test_palette.c +++ b/tests/src/test_cases/test_palette.c @@ -1,5 +1,4 @@ #if LV_BUILD_TEST -#include "../../../src/misc/lv_palette.h" #include "../lvgl.h" #include "unity/unity.h" diff --git a/tests/src/test_cases/test_svg.c b/tests/src/test_cases/test_svg.c index 66f2b4a568..0e790d9555 100644 --- a/tests/src/test_cases/test_svg.c +++ b/tests/src/test_cases/test_svg.c @@ -1,5 +1,6 @@ #if LV_BUILD_TEST #include "../lvgl.h" +#include "../lvgl_private.h" #include "unity/unity.h" diff --git a/tests/src/test_cases/test_svg_anim.c b/tests/src/test_cases/test_svg_anim.c index 305b00d497..24fda05829 100644 --- a/tests/src/test_cases/test_svg_anim.c +++ b/tests/src/test_cases/test_svg_anim.c @@ -1,5 +1,6 @@ #if LV_BUILD_TEST #include "../lvgl.h" +#include "../lvgl_private.h" #include "unity/unity.h" diff --git a/tests/src/test_cases/test_svg_file.c b/tests/src/test_cases/test_svg_file.c index 9e3de075f5..08f057afb4 100644 --- a/tests/src/test_cases/test_svg_file.c +++ b/tests/src/test_cases/test_svg_file.c @@ -1,6 +1,6 @@ #if LV_BUILD_TEST #include "../lvgl.h" -#include "src/draw/lv_draw_vector.h" +#include "../lvgl_private.h" #include "unity/unity.h" diff --git a/tests/src/test_cases/test_utils.c b/tests/src/test_cases/test_utils.c index d79906a3ac..6a8b296a31 100644 --- a/tests/src/test_cases/test_utils.c +++ b/tests/src/test_cases/test_utils.c @@ -1,5 +1,6 @@ #if LV_BUILD_TEST #include "../lvgl.h" +#include "../lvgl_private.h" #include "unity/unity.h" #define TEST_DRAW_BUF_SAVE_PATH(path) "A:src/test_files/draw_buf_save_" path