chore(arc_label): rename arc_label to arclabel
@@ -1090,7 +1090,7 @@ menu "LVGL configuration"
|
||||
config LV_USE_ARC
|
||||
bool "Arc"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_ARC_LABEL
|
||||
config LV_USE_ARCLABEL
|
||||
bool "Arc Label"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_BAR
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
.. _lv_arc_label:
|
||||
|
||||
========================
|
||||
Arc Label (lv_arc_label)
|
||||
========================
|
||||
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
The Arc Label is a specialized widget designed to display text along an arc. It allows for flexible text placement and styling, making it suitable for applications where text needs to follow a curved path, such as in gauges, dials, or custom interfaces. The widget supports various configurations, including text alignment, direction, radius adjustment, and color customization.
|
||||
|
||||
.. _lv_arc_label_parts_and_styles:
|
||||
|
||||
Parts and Styles
|
||||
****************
|
||||
|
||||
- :cpp:enumerator:`LV_PART_MAIN` Represents the main part of the Arc Label, including the arc path and the text rendered along it. The appearance of the text and the arc can be customized using typical text and background style properties.
|
||||
|
||||
.. _lv_arc_label_usage:
|
||||
|
||||
Usage
|
||||
*****
|
||||
|
||||
Text Management
|
||||
---------------
|
||||
|
||||
- Text can be set using :cpp:expr:`lv_arc_label_set_text(arc_label, "Your text")`.
|
||||
- For formatted text, use :cpp:expr:`lv_arc_label_set_text_fmt(arc_label, "Formatted %s", "text")`.
|
||||
- Static text can be set with :cpp:expr:`lv_arc_label_set_text_static(arc_label, static_text)`, which avoids dynamic memory allocation.
|
||||
|
||||
Angle Configuration
|
||||
-------------------
|
||||
|
||||
- Set the starting angle of the arc with :cpp:expr:`lv_arc_label_set_angle_start(arc_label, angle)`.
|
||||
- Define the arc size (angular span) using :cpp:expr:`lv_arc_label_set_angle_size(arc_label, size)`.
|
||||
- Angles are measured in degrees, starting from the positive x-axis (3 o'clock position) and increasing clockwise.
|
||||
|
||||
Direction
|
||||
---------
|
||||
|
||||
Specify the text direction along the arc using :cpp:expr:`lv_arc_label_set_dir(arc_label, LV_ARC_LABEL_DIR_CLOCKWISE)` or :cpp:expr:`lv_arc_label_set_dir(arc_label, LV_ARC_LABEL_DIR_COUNTERCLOCKWISE)`.
|
||||
|
||||
- :cpp:enumerator:`LV_ARC_LABEL_DIR_CLOCKWISE` Text flows in a clockwise direction along the arc.
|
||||
- :cpp:enumerator:`LV_ARC_LABEL_DIR_COUNTERCLOCKWISE` Text flows in a counter-clockwise direction along the arc.
|
||||
|
||||
Alignment
|
||||
---------
|
||||
|
||||
Adjust vertical text alignment with :cpp:expr:`lv_arc_label_set_text_vertical_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_CENTER)`.
|
||||
Set horizontal alignment using :cpp:expr:`lv_arc_label_set_text_horizontal_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_CENTER)`.
|
||||
|
||||
Both vertical and horizontal use the same logic.
|
||||
|
||||
- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_DEFAULT` Uses the default alignment.
|
||||
- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_LEADING` Aligns text to the leading edge of the arc.
|
||||
- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_CENTER` Centers text along the arc.
|
||||
- :cpp:enumerator:`LV_ARC_LABEL_TEXT_ALIGN_TRAILING` Aligns text to the trailing edge of the arc.
|
||||
|
||||
Radius and Center Offset
|
||||
------------------------
|
||||
|
||||
- Set the radius of the arc with :cpp:expr:`lv_arc_label_set_radius(arc_label, radius)`.
|
||||
- Adjust the center offset of the arc using :cpp:expr:`lv_arc_label_set_center_offset_x(arc_label, x)` and :cpp:expr:`lv_arc_label_set_center_offset_y(arc_label, y)`.
|
||||
|
||||
Color and Recoloring
|
||||
--------------------
|
||||
|
||||
Enable text recoloring with :cpp:expr:`lv_arc_label_set_recolor(arc_label, true)`. This allows parts of the text to be colored differently using color commands embedded in the text string.
|
||||
|
||||
Interactive Behavior
|
||||
--------------------
|
||||
|
||||
By default, Arc Label is not clickable. To make it interactive, you would need to add custom event handling, as it does not inherit clickability by default.
|
||||
|
||||
.. _lv_arc_label_events:
|
||||
|
||||
Events
|
||||
******
|
||||
|
||||
The Arc Label primarily inherits events from the base object class. It does not define specific events beyond those common to all widgets. You can attach custom event handlers to respond to interactions if needed.
|
||||
|
||||
.. _lv_arc_label_keys:
|
||||
|
||||
Keys
|
||||
****
|
||||
|
||||
The Arc Label does not define specific key bindings beyond those inherited from the base object class. Keyboard navigation and interaction would require additional implementation.
|
||||
|
||||
.. _lv_arc_label_example:
|
||||
|
||||
Example
|
||||
*******
|
||||
|
||||
.. include:: ../../examples/widgets/arc_label/index.rst
|
||||
|
||||
.. _lv_arc_label_api:
|
||||
|
||||
API
|
||||
***
|
||||
@@ -0,0 +1,100 @@
|
||||
.. _lv_arclabel:
|
||||
|
||||
========================
|
||||
Arc Label (lv_arclabel)
|
||||
========================
|
||||
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
The Arc Label is a specialized widget designed to display text along an arc. It allows for flexible text placement and styling, making it suitable for applications where text needs to follow a curved path, such as in gauges, dials, or custom interfaces. The widget supports various configurations, including text alignment, direction, radius adjustment, and color customization.
|
||||
|
||||
.. _lv_arclabel_parts_and_styles:
|
||||
|
||||
Parts and Styles
|
||||
****************
|
||||
|
||||
- :cpp:enumerator:`LV_PART_MAIN` Represents the main part of the Arc Label, including the arc path and the text rendered along it. The appearance of the text and the arc can be customized using typical text and background style properties.
|
||||
|
||||
.. _lv_arclabel_usage:
|
||||
|
||||
Usage
|
||||
*****
|
||||
|
||||
Text Management
|
||||
---------------
|
||||
|
||||
- Text can be set using :cpp:expr:`lv_arclabel_set_text(arclabel, "Your text")`.
|
||||
- For formatted text, use :cpp:expr:`lv_arclabel_set_text_fmt(arclabel, "Formatted %s", "text")`.
|
||||
- Static text can be set with :cpp:expr:`lv_arclabel_set_text_static(arclabel, static_text)`, which avoids dynamic memory allocation.
|
||||
|
||||
Angle Configuration
|
||||
-------------------
|
||||
|
||||
- Set the starting angle of the arc with :cpp:expr:`lv_arclabel_set_angle_start(arclabel, angle)`.
|
||||
- Define the arc size (angular span) using :cpp:expr:`lv_arclabel_set_angle_size(arclabel, size)`.
|
||||
- Angles are measured in degrees, starting from the positive x-axis (3 o'clock position) and increasing clockwise.
|
||||
|
||||
Direction
|
||||
---------
|
||||
|
||||
Specify the text direction along the arc using :cpp:expr:`lv_arclabel_set_dir(arclabel, LV_ARCLABEL_DIR_CLOCKWISE)` or :cpp:expr:`lv_arclabel_set_dir(arclabel, LV_ARCLABEL_DIR_COUNTERCLOCKWISE)`.
|
||||
|
||||
- :cpp:enumerator:`LV_ARCLABEL_DIR_CLOCKWISE` Text flows in a clockwise direction along the arc.
|
||||
- :cpp:enumerator:`LV_ARCLABEL_DIR_COUNTERCLOCKWISE` Text flows in a counter-clockwise direction along the arc.
|
||||
|
||||
Alignment
|
||||
---------
|
||||
|
||||
Adjust vertical text alignment with :cpp:expr:`lv_arclabel_set_text_vertical_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER)`.
|
||||
Set horizontal alignment using :cpp:expr:`lv_arclabel_set_text_horizontal_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER)`.
|
||||
|
||||
Both vertical and horizontal use the same logic.
|
||||
|
||||
- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_DEFAULT` Uses the default alignment.
|
||||
- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_LEADING` Aligns text to the leading edge of the arc.
|
||||
- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_CENTER` Centers text along the arc.
|
||||
- :cpp:enumerator:`LV_ARCLABEL_TEXT_ALIGN_TRAILING` Aligns text to the trailing edge of the arc.
|
||||
|
||||
Radius and Center Offset
|
||||
------------------------
|
||||
|
||||
- Set the radius of the arc with :cpp:expr:`lv_arclabel_set_radius(arclabel, radius)`.
|
||||
- Adjust the center offset of the arc using :cpp:expr:`lv_arclabel_set_center_offset_x(arclabel, x)` and :cpp:expr:`lv_arclabel_set_center_offset_y(arclabel, y)`.
|
||||
|
||||
Color and Recoloring
|
||||
--------------------
|
||||
|
||||
Enable text recoloring with :cpp:expr:`lv_arclabel_set_recolor(arclabel, true)`. This allows parts of the text to be colored differently using color commands embedded in the text string.
|
||||
|
||||
Interactive Behavior
|
||||
--------------------
|
||||
|
||||
By default, Arc Label is not clickable. To make it interactive, you would need to add custom event handling, as it does not inherit clickability by default.
|
||||
|
||||
.. _lv_arclabel_events:
|
||||
|
||||
Events
|
||||
******
|
||||
|
||||
The Arc Label primarily inherits events from the base object class. It does not define specific events beyond those common to all widgets. You can attach custom event handlers to respond to interactions if needed.
|
||||
|
||||
.. _lv_arclabel_keys:
|
||||
|
||||
Keys
|
||||
****
|
||||
|
||||
The Arc Label does not define specific key bindings beyond those inherited from the base object class. Keyboard navigation and interaction would require additional implementation.
|
||||
|
||||
.. _lv_arclabel_example:
|
||||
|
||||
Example
|
||||
*******
|
||||
|
||||
.. include:: ../../examples/widgets/arclabel/index.rst
|
||||
|
||||
.. _lv_arclabel_api:
|
||||
|
||||
API
|
||||
***
|
||||
@@ -17,7 +17,7 @@ All Widgets
|
||||
3dtexture
|
||||
animimg
|
||||
arc
|
||||
arc_label
|
||||
arclabel
|
||||
bar
|
||||
button
|
||||
buttonmatrix
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
#include "../../lv_examples.h"
|
||||
|
||||
#if LV_USE_ARC_LABEL && LV_BUILD_EXAMPLES
|
||||
|
||||
static const char * ARC_LABEL_TEXT =
|
||||
"I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# feature!\n";
|
||||
|
||||
void lv_example_arc_label_1(void)
|
||||
{
|
||||
lv_obj_t * arc_label_inner = NULL;
|
||||
lv_obj_t * arc_label_outer = NULL;
|
||||
lv_obj_t * arc_label_slogan_1 = NULL;
|
||||
lv_obj_t * arc_label_slogan_2 = NULL;
|
||||
|
||||
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_black(), LV_PART_MAIN);
|
||||
|
||||
arc_label_inner = lv_arc_label_create(lv_screen_active());
|
||||
lv_obj_set_size(arc_label_inner, 200, 200);
|
||||
lv_obj_set_style_text_color(arc_label_inner, lv_color_white(), LV_PART_MAIN);
|
||||
lv_arc_label_set_text_static(arc_label_inner, ARC_LABEL_TEXT);
|
||||
lv_arc_label_set_angle_start(arc_label_inner, 180);
|
||||
lv_arc_label_set_radius(arc_label_inner, LV_PCT(80));
|
||||
lv_arc_label_set_recolor(arc_label_inner, true);
|
||||
lv_arc_label_set_text_vertical_align(arc_label_inner, LV_ARC_LABEL_TEXT_ALIGN_TRAILING);
|
||||
lv_arc_label_set_dir(arc_label_inner, LV_ARC_LABEL_DIR_COUNTER_CLOCKWISE);
|
||||
lv_arc_label_set_text_horizontal_align(arc_label_inner, LV_ARC_LABEL_TEXT_ALIGN_CENTER);
|
||||
lv_obj_center(arc_label_inner);
|
||||
|
||||
arc_label_outer = lv_arc_label_create(lv_screen_active());
|
||||
lv_obj_set_size(arc_label_outer, 200, 200);
|
||||
lv_obj_set_style_text_letter_space(arc_label_outer, 2, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(arc_label_outer, lv_color_hex(0x888888), LV_PART_MAIN);
|
||||
lv_arc_label_set_angle_start(arc_label_outer, -180);
|
||||
lv_arc_label_set_text_static(arc_label_outer, ARC_LABEL_TEXT);
|
||||
lv_arc_label_set_radius(arc_label_outer, LV_PCT(100));
|
||||
lv_arc_label_set_recolor(arc_label_outer, true);
|
||||
lv_arc_label_set_text_vertical_align(arc_label_outer, LV_ARC_LABEL_TEXT_ALIGN_LEADING);
|
||||
lv_arc_label_set_dir(arc_label_outer, LV_ARC_LABEL_DIR_CLOCKWISE);
|
||||
lv_arc_label_set_text_horizontal_align(arc_label_outer, LV_ARC_LABEL_TEXT_ALIGN_CENTER);
|
||||
lv_obj_center(arc_label_outer);
|
||||
|
||||
arc_label_slogan_1 = lv_arc_label_create(lv_screen_active());
|
||||
lv_obj_set_size(arc_label_slogan_1, 300, 200);
|
||||
lv_obj_set_style_text_letter_space(arc_label_slogan_1, 2, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(arc_label_slogan_1, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN);
|
||||
lv_arc_label_set_text_static(arc_label_slogan_1, "STAY HUNGRY");
|
||||
lv_arc_label_set_offset(arc_label_slogan_1, 30);
|
||||
lv_arc_label_set_radius(arc_label_slogan_1, 150);
|
||||
lv_arc_label_set_recolor(arc_label_slogan_1, true);
|
||||
lv_arc_label_set_text_vertical_align(arc_label_slogan_1, LV_ARC_LABEL_TEXT_ALIGN_TRAILING);
|
||||
lv_arc_label_set_text_horizontal_align(arc_label_slogan_1, LV_ARC_LABEL_TEXT_ALIGN_CENTER);
|
||||
lv_arc_label_set_dir(arc_label_slogan_1, LV_ARC_LABEL_DIR_COUNTER_CLOCKWISE);
|
||||
lv_obj_center(arc_label_slogan_1);
|
||||
|
||||
arc_label_slogan_2 = lv_arc_label_create(lv_screen_active());
|
||||
lv_obj_set_size(arc_label_slogan_2, 300, 200);
|
||||
lv_obj_set_style_text_letter_space(arc_label_slogan_2, 2, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(arc_label_slogan_2, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN);
|
||||
lv_arc_label_set_text_static(arc_label_slogan_2, "STAY FOOLISH");
|
||||
lv_arc_label_set_offset(arc_label_slogan_2, 30);
|
||||
lv_arc_label_set_radius(arc_label_slogan_2, 150);
|
||||
lv_arc_label_set_angle_start(arc_label_slogan_2, 180);
|
||||
lv_arc_label_set_recolor(arc_label_slogan_2, true);
|
||||
lv_arc_label_set_text_vertical_align(arc_label_slogan_2, LV_ARC_LABEL_TEXT_ALIGN_TRAILING);
|
||||
lv_arc_label_set_text_horizontal_align(arc_label_slogan_2, LV_ARC_LABEL_TEXT_ALIGN_CENTER);
|
||||
lv_arc_label_set_dir(arc_label_slogan_2, LV_ARC_LABEL_DIR_COUNTER_CLOCKWISE);
|
||||
lv_obj_center(arc_label_slogan_2);
|
||||
|
||||
|
||||
#if LV_FONT_MONTSERRAT_18
|
||||
lv_obj_set_style_text_font(arc_label_inner, &lv_font_montserrat_18, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_font(arc_label_outer, &lv_font_montserrat_18, LV_PART_MAIN);
|
||||
#endif
|
||||
#if LV_FONT_MONTSERRAT_24
|
||||
lv_obj_set_style_text_font(arc_label_slogan_1, &lv_font_montserrat_24, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_font(arc_label_slogan_2, &lv_font_montserrat_24, LV_PART_MAIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
Simple Arc Label
|
||||
----------------
|
||||
|
||||
.. lv_example:: widgets/arc_label/lv_example_arc_label_1
|
||||
.. lv_example:: widgets/arclabel/lv_example_arclabel_1
|
||||
:language: c
|
||||
:description: A simple example to demonstrate the use of an arc label.
|
||||
@@ -0,0 +1,80 @@
|
||||
#include "../../lv_examples.h"
|
||||
|
||||
#if LV_USE_ARCLABEL && LV_BUILD_EXAMPLES
|
||||
|
||||
static const char * ARCLABEL_TEXT =
|
||||
"I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# feature!\n";
|
||||
|
||||
void lv_example_arclabel_1(void)
|
||||
{
|
||||
lv_obj_t * arclabel_inner = NULL;
|
||||
lv_obj_t * arclabel_outer = NULL;
|
||||
lv_obj_t * arclabel_slogan_1 = NULL;
|
||||
lv_obj_t * arclabel_slogan_2 = NULL;
|
||||
|
||||
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_black(), LV_PART_MAIN);
|
||||
|
||||
arclabel_inner = lv_arclabel_create(lv_screen_active());
|
||||
lv_obj_set_size(arclabel_inner, 200, 200);
|
||||
lv_obj_set_style_text_color(arclabel_inner, lv_color_white(), LV_PART_MAIN);
|
||||
lv_arclabel_set_text_static(arclabel_inner, ARCLABEL_TEXT);
|
||||
lv_arclabel_set_angle_start(arclabel_inner, 180);
|
||||
lv_arclabel_set_radius(arclabel_inner, LV_PCT(80));
|
||||
lv_arclabel_set_recolor(arclabel_inner, true);
|
||||
lv_arclabel_set_text_vertical_align(arclabel_inner, LV_ARCLABEL_TEXT_ALIGN_TRAILING);
|
||||
lv_arclabel_set_dir(arclabel_inner, LV_ARCLABEL_DIR_COUNTER_CLOCKWISE);
|
||||
lv_arclabel_set_text_horizontal_align(arclabel_inner, LV_ARCLABEL_TEXT_ALIGN_CENTER);
|
||||
lv_obj_center(arclabel_inner);
|
||||
|
||||
arclabel_outer = lv_arclabel_create(lv_screen_active());
|
||||
lv_obj_set_size(arclabel_outer, 200, 200);
|
||||
lv_obj_set_style_text_letter_space(arclabel_outer, 2, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(arclabel_outer, lv_color_hex(0x888888), LV_PART_MAIN);
|
||||
lv_arclabel_set_angle_start(arclabel_outer, -180);
|
||||
lv_arclabel_set_text_static(arclabel_outer, ARCLABEL_TEXT);
|
||||
lv_arclabel_set_radius(arclabel_outer, LV_PCT(100));
|
||||
lv_arclabel_set_recolor(arclabel_outer, true);
|
||||
lv_arclabel_set_text_vertical_align(arclabel_outer, LV_ARCLABEL_TEXT_ALIGN_LEADING);
|
||||
lv_arclabel_set_dir(arclabel_outer, LV_ARCLABEL_DIR_CLOCKWISE);
|
||||
lv_arclabel_set_text_horizontal_align(arclabel_outer, LV_ARCLABEL_TEXT_ALIGN_CENTER);
|
||||
lv_obj_center(arclabel_outer);
|
||||
|
||||
arclabel_slogan_1 = lv_arclabel_create(lv_screen_active());
|
||||
lv_obj_set_size(arclabel_slogan_1, 300, 200);
|
||||
lv_obj_set_style_text_letter_space(arclabel_slogan_1, 2, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(arclabel_slogan_1, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN);
|
||||
lv_arclabel_set_text_static(arclabel_slogan_1, "STAY HUNGRY");
|
||||
lv_arclabel_set_offset(arclabel_slogan_1, 30);
|
||||
lv_arclabel_set_radius(arclabel_slogan_1, 150);
|
||||
lv_arclabel_set_recolor(arclabel_slogan_1, true);
|
||||
lv_arclabel_set_text_vertical_align(arclabel_slogan_1, LV_ARCLABEL_TEXT_ALIGN_TRAILING);
|
||||
lv_arclabel_set_text_horizontal_align(arclabel_slogan_1, LV_ARCLABEL_TEXT_ALIGN_CENTER);
|
||||
lv_arclabel_set_dir(arclabel_slogan_1, LV_ARCLABEL_DIR_COUNTER_CLOCKWISE);
|
||||
lv_obj_center(arclabel_slogan_1);
|
||||
|
||||
arclabel_slogan_2 = lv_arclabel_create(lv_screen_active());
|
||||
lv_obj_set_size(arclabel_slogan_2, 300, 200);
|
||||
lv_obj_set_style_text_letter_space(arclabel_slogan_2, 2, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(arclabel_slogan_2, lv_palette_main(LV_PALETTE_AMBER), LV_PART_MAIN);
|
||||
lv_arclabel_set_text_static(arclabel_slogan_2, "STAY FOOLISH");
|
||||
lv_arclabel_set_offset(arclabel_slogan_2, 30);
|
||||
lv_arclabel_set_radius(arclabel_slogan_2, 150);
|
||||
lv_arclabel_set_angle_start(arclabel_slogan_2, 180);
|
||||
lv_arclabel_set_recolor(arclabel_slogan_2, true);
|
||||
lv_arclabel_set_text_vertical_align(arclabel_slogan_2, LV_ARCLABEL_TEXT_ALIGN_TRAILING);
|
||||
lv_arclabel_set_text_horizontal_align(arclabel_slogan_2, LV_ARCLABEL_TEXT_ALIGN_CENTER);
|
||||
lv_arclabel_set_dir(arclabel_slogan_2, LV_ARCLABEL_DIR_COUNTER_CLOCKWISE);
|
||||
lv_obj_center(arclabel_slogan_2);
|
||||
|
||||
|
||||
#if LV_FONT_MONTSERRAT_18
|
||||
lv_obj_set_style_text_font(arclabel_inner, &lv_font_montserrat_18, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_font(arclabel_outer, &lv_font_montserrat_18, LV_PART_MAIN);
|
||||
#endif
|
||||
#if LV_FONT_MONTSERRAT_24
|
||||
lv_obj_set_style_text_font(arclabel_slogan_1, &lv_font_montserrat_24, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_font(arclabel_slogan_2, &lv_font_montserrat_24, LV_PART_MAIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -31,7 +31,7 @@ void lv_example_arc_1(void);
|
||||
void lv_example_arc_2(void);
|
||||
void lv_example_arc_3(void);
|
||||
|
||||
void lv_example_arc_label_1(void);
|
||||
void lv_example_arclabel_1(void);
|
||||
|
||||
void lv_example_bar_1(void);
|
||||
void lv_example_bar_2(void);
|
||||
|
||||
@@ -699,7 +699,7 @@
|
||||
* - 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_arc_label_t : Text set to "Arced Text", else empty string.
|
||||
* - lv_arclabel_t : Text set to "Arced Text", else empty string.
|
||||
* */
|
||||
#define LV_WIDGETS_HAS_DEFAULT_VALUE 1
|
||||
|
||||
@@ -707,7 +707,7 @@
|
||||
|
||||
#define LV_USE_ARC 1
|
||||
|
||||
#define LV_USE_ARC_LABEL 1
|
||||
#define LV_USE_ARCLABEL 1
|
||||
|
||||
#define LV_USE_BAR 1
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
|
||||
#include "src/widgets/animimage/lv_animimage.h"
|
||||
#include "src/widgets/arc/lv_arc.h"
|
||||
#include "src/widgets/arc_label/lv_arc_label.h"
|
||||
#include "src/widgets/arclabel/lv_arclabel.h"
|
||||
#include "src/widgets/bar/lv_bar.h"
|
||||
#include "src/widgets/button/lv_button.h"
|
||||
#include "src/widgets/buttonmatrix/lv_buttonmatrix.h"
|
||||
|
||||
@@ -2030,7 +2030,7 @@
|
||||
* - 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_arc_label_t : Text set to "Arced 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
|
||||
@@ -2068,15 +2068,15 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LV_USE_ARC_LABEL
|
||||
#ifndef LV_USE_ARCLABEL
|
||||
#ifdef LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_USE_ARC_LABEL
|
||||
#define LV_USE_ARC_LABEL CONFIG_LV_USE_ARC_LABEL
|
||||
#ifdef CONFIG_LV_USE_ARCLABEL
|
||||
#define LV_USE_ARCLABEL CONFIG_LV_USE_ARCLABEL
|
||||
#else
|
||||
#define LV_USE_ARC_LABEL 0
|
||||
#define LV_USE_ARCLABEL 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_USE_ARC_LABEL 1
|
||||
#define LV_USE_ARCLABEL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ typedef struct _lv_animimg_t lv_animimg_t;
|
||||
|
||||
typedef struct _lv_arc_t lv_arc_t;
|
||||
|
||||
typedef struct _lv_arc_label_t lv_arc_label_t;
|
||||
typedef struct _lv_arclabel_t lv_arclabel_t;
|
||||
|
||||
typedef struct _lv_label_t lv_label_t;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* @file lv_arc_label.h
|
||||
* @file lv_arclabel.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_ARC_LABEL_H
|
||||
#define LV_ARC_LABEL_H
|
||||
#ifndef LV_ARCLABEL_H
|
||||
#define LV_ARCLABEL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -15,17 +15,17 @@ extern "C" {
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_ARC_LABEL != 0
|
||||
#if LV_USE_ARCLABEL != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_ARC_LABEL_DOT_NUM 3
|
||||
#define LV_ARCLABEL_DOT_NUM 3
|
||||
#if LV_WIDGETS_HAS_DEFAULT_VALUE
|
||||
#define LV_ARC_LABEL_DEFAULT_TEXT "Arced Text"
|
||||
#define LV_ARCLABEL_DEFAULT_TEXT "Arced Text"
|
||||
#else
|
||||
#define LV_ARC_LABEL_DEFAULT_TEXT ""
|
||||
#define LV_ARCLABEL_DEFAULT_TEXT ""
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@@ -33,18 +33,18 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
typedef enum {
|
||||
LV_ARC_LABEL_DIR_CLOCKWISE = 0,
|
||||
LV_ARC_LABEL_DIR_COUNTER_CLOCKWISE = 1
|
||||
} lv_arc_label_dir_t;
|
||||
LV_ARCLABEL_DIR_CLOCKWISE = 0,
|
||||
LV_ARCLABEL_DIR_COUNTER_CLOCKWISE = 1
|
||||
} lv_arclabel_dir_t;
|
||||
|
||||
typedef enum {
|
||||
LV_ARC_LABEL_TEXT_ALIGN_DEFAULT = 0,
|
||||
LV_ARC_LABEL_TEXT_ALIGN_LEADING = 1,
|
||||
LV_ARC_LABEL_TEXT_ALIGN_CENTER = 2,
|
||||
LV_ARC_LABEL_TEXT_ALIGN_TRAILING = 3,
|
||||
} lv_arc_label_text_align_t;
|
||||
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;
|
||||
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_label_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arclabel_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@@ -55,7 +55,7 @@ LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_label_class;
|
||||
* @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_arc_label_create(lv_obj_t * parent);
|
||||
lv_obj_t * lv_arclabel_create(lv_obj_t * parent);
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
@@ -73,7 +73,7 @@ lv_obj_t * lv_arc_label_create(lv_obj_t * parent);
|
||||
* @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_arc_label_set_text(lv_obj_t * obj, const char * text);
|
||||
void lv_arclabel_set_text(lv_obj_t * obj, const char * text);
|
||||
|
||||
/**
|
||||
* Set the formatted text of an arc label object.
|
||||
@@ -85,7 +85,7 @@ void lv_arc_label_set_text(lv_obj_t * obj, const char * text);
|
||||
* @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_arc_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3);
|
||||
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.
|
||||
@@ -94,35 +94,35 @@ void lv_arc_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_
|
||||
* @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_arc_label_set_text_static(lv_obj_t * obj, const char * 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_arc_label_set_angle_start(lv_obj_t * obj, lv_value_precise_t start);
|
||||
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_arc_label_set_angle_size(lv_obj_t * obj, lv_value_precise_t size);
|
||||
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_arc_label_set_offset(lv_obj_t * obj, int32_t offset);
|
||||
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_arc_label_set_dir(lv_obj_t * obj, lv_arc_label_dir_t dir);
|
||||
void lv_arclabel_set_dir(lv_obj_t * obj, lv_arclabel_dir_t dir);
|
||||
|
||||
/**
|
||||
* Enable the recoloring by in-line commands
|
||||
@@ -130,7 +130,7 @@ void lv_arc_label_set_dir(lv_obj_t * obj, lv_arc_label_dir_t dir);
|
||||
* @param en true: enable recoloring, false: disable
|
||||
* Example: "This is a #ff0000 red# word"
|
||||
*/
|
||||
void lv_arc_label_set_recolor(lv_obj_t * obj, bool en);
|
||||
void lv_arclabel_set_recolor(lv_obj_t * obj, bool en);
|
||||
|
||||
/**
|
||||
* Set the radius for an arc label object.
|
||||
@@ -138,35 +138,35 @@ void lv_arc_label_set_recolor(lv_obj_t * obj, bool en);
|
||||
* @param obj pointer to the arc label object.
|
||||
* @param radius The radius value to set for the label's curvature, in pixels.
|
||||
*/
|
||||
void lv_arc_label_set_radius(lv_obj_t * obj, uint32_t radius);
|
||||
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_arc_label_set_center_offset_x(lv_obj_t * obj, uint32_t x);
|
||||
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_arc_label_set_center_offset_y(lv_obj_t * obj, uint32_t y);
|
||||
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_arc_label_set_text_vertical_align(lv_obj_t * obj, lv_arc_label_text_align_t align);
|
||||
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_arc_label_set_text_horizontal_align(lv_obj_t * obj, lv_arc_label_text_align_t align);
|
||||
void lv_arclabel_set_text_horizontal_align(lv_obj_t * obj, lv_arclabel_text_align_t align);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
@@ -177,66 +177,66 @@ void lv_arc_label_set_text_horizontal_align(lv_obj_t * obj, lv_arc_label_text_al
|
||||
* @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_arc_label_get_angle_start(lv_obj_t * obj);
|
||||
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_arc_label_get_angle_size(lv_obj_t * obj);
|
||||
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_arc_label_dir_t lv_arc_label_get_dir(const lv_obj_t * obj);
|
||||
lv_arclabel_dir_t lv_arclabel_get_dir(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Enable the recoloring by in-line commands
|
||||
*
|
||||
* @see lv_arc_label_set_recolor
|
||||
* @see lv_arclabel_set_recolor
|
||||
*
|
||||
* @param obj pointer to a label object
|
||||
* @return true: enable recoloring, false: disable
|
||||
*/
|
||||
bool lv_arc_label_get_recolor(lv_obj_t * obj);
|
||||
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_arc_label_get_radius(lv_obj_t * obj);
|
||||
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_arc_label_get_center_offset_x(lv_obj_t * obj);
|
||||
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_arc_label_get_center_offset_y(lv_obj_t * obj);
|
||||
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_arc_label_text_align_t lv_arc_label_get_text_vertical_align(lv_obj_t * obj);
|
||||
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_arc_label_text_align_t lv_arc_label_get_text_horizontal_align(lv_obj_t * obj);
|
||||
lv_arclabel_text_align_t lv_arclabel_get_text_horizontal_align(lv_obj_t * obj);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
@@ -246,10 +246,10 @@ lv_arc_label_text_align_t lv_arc_label_get_text_horizontal_align(lv_obj_t * obj)
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_ARC_LABEL*/
|
||||
#endif /*LV_USE_ARCLABEL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_ARC_LABEL_H*/
|
||||
#endif /*LV_ARCLABEL_H*/
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* @file lv_arc_label_private.h
|
||||
* @file lv_arclabel_private.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_ARC_LABEL_PRIVATE_H
|
||||
#define LV_ARC_LABEL_PRIVATE_H
|
||||
#ifndef LV_ARCLABEL_PRIVATE_H
|
||||
#define LV_ARCLABEL_PRIVATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -15,8 +15,8 @@ extern "C" {
|
||||
*********************/
|
||||
#include "../../core/lv_obj_private.h"
|
||||
|
||||
#if LV_USE_ARC_LABEL != 0
|
||||
#include "lv_arc_label.h"
|
||||
#if LV_USE_ARCLABEL != 0
|
||||
#include "lv_arclabel.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -26,11 +26,11 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_arc_label_t {
|
||||
struct _lv_arclabel_t {
|
||||
lv_obj_t obj;
|
||||
|
||||
char * text;
|
||||
char dot[LV_ARC_LABEL_DOT_NUM + 1]; /**< Bytes that have been replaced with dots */
|
||||
char dot[LV_ARCLABEL_DOT_NUM + 1]; /**< Bytes that have been replaced with dots */
|
||||
uint32_t dot_begin; /**< Offset where bytes have been replaced with dots */
|
||||
|
||||
/**
|
||||
@@ -53,9 +53,9 @@ struct _lv_arc_label_t {
|
||||
uint32_t offset;
|
||||
uint32_t radius;
|
||||
lv_point_t center_offset;
|
||||
lv_arc_label_dir_t dir;
|
||||
lv_arc_label_text_align_t text_align_v; /**< Vertical text alignment */
|
||||
lv_arc_label_text_align_t text_align_h; /**< Horizontal text alignment */
|
||||
lv_arclabel_dir_t dir;
|
||||
lv_arclabel_text_align_t text_align_v; /**< Vertical text alignment */
|
||||
lv_arclabel_text_align_t text_align_h; /**< Horizontal text alignment */
|
||||
uint8_t static_txt : 1; /**< Flag to indicate the text is static */
|
||||
uint8_t recolor : 1; /**< Enable in-line letter re-coloring */
|
||||
};
|
||||
@@ -68,10 +68,10 @@ struct _lv_arc_label_t {
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /* LV_USE_ARC_LABEL != 0 */
|
||||
#endif /* LV_USE_ARCLABEL != 0 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_ARC_LABEL_PRIVATE_H*/
|
||||
#endif /*LV_ARCLABEL_PRIVATE_H*/
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -1,72 +0,0 @@
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
#include "../../lvgl_private.h"
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
#if LV_USE_VG_LITE_THORVG
|
||||
#define FREETYPE_FONT_TYPE LV_FREETYPE_FONT_RENDER_MODE_OUTLINE
|
||||
#else
|
||||
#define FREETYPE_FONT_TYPE LV_FREETYPE_FONT_RENDER_MODE_BITMAP
|
||||
#endif
|
||||
|
||||
#ifndef NON_AMD64_BUILD
|
||||
#define EXT_NAME ".lp64.png"
|
||||
#else
|
||||
#define EXT_NAME ".lp32.png"
|
||||
#endif
|
||||
|
||||
static const char * ARC_LABEL_TEXT =
|
||||
"I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# 特性! \n";
|
||||
|
||||
static lv_font_t * font;
|
||||
static lv_obj_t * active_screen = NULL;
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
active_screen = lv_screen_active();
|
||||
font = lv_freetype_font_create("src/test_files/fonts/noto/NotoSansSC-Regular.ttf", FREETYPE_FONT_TYPE, 18,
|
||||
LV_FREETYPE_FONT_STYLE_NORMAL);
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
lv_obj_clean(active_screen);
|
||||
lv_obj_set_style_layout(active_screen, LV_LAYOUT_NONE, 0);
|
||||
|
||||
if(font) {
|
||||
lv_freetype_font_delete(font);
|
||||
}
|
||||
}
|
||||
|
||||
void test_arc_label_simple(void)
|
||||
{
|
||||
if(!font) {
|
||||
LV_LOG_ERROR("freetype font create failed.");
|
||||
TEST_FAIL();
|
||||
}
|
||||
|
||||
lv_obj_t * arc_label = lv_arc_label_create(active_screen);
|
||||
lv_obj_set_style_text_font(arc_label, font, LV_PART_MAIN);
|
||||
lv_obj_set_size(arc_label, 200, 200);
|
||||
lv_obj_set_style_text_letter_space(arc_label, 2, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(arc_label, lv_color_hex(0x888888), LV_PART_MAIN);
|
||||
lv_arc_label_set_angle_start(arc_label, -180);
|
||||
lv_arc_label_set_text_static(arc_label, ARC_LABEL_TEXT);
|
||||
lv_arc_label_set_radius(arc_label, LV_PCT(100));
|
||||
lv_arc_label_set_recolor(arc_label, true);
|
||||
lv_arc_label_set_text_vertical_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_LEADING);
|
||||
lv_arc_label_set_dir(arc_label, LV_ARC_LABEL_DIR_CLOCKWISE);
|
||||
lv_arc_label_set_text_horizontal_align(arc_label, LV_ARC_LABEL_TEXT_ALIGN_CENTER);
|
||||
lv_obj_center(arc_label);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arc_label_0" EXT_NAME);
|
||||
|
||||
lv_obj_set_size(arc_label, 300, 300);
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arc_label_1" EXT_NAME);
|
||||
|
||||
lv_arc_label_set_recolor(arc_label, false);
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arc_label_2" EXT_NAME);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
#include "../../lvgl_private.h"
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
#if LV_USE_VG_LITE_THORVG
|
||||
#define FREETYPE_FONT_TYPE LV_FREETYPE_FONT_RENDER_MODE_OUTLINE
|
||||
#else
|
||||
#define FREETYPE_FONT_TYPE LV_FREETYPE_FONT_RENDER_MODE_BITMAP
|
||||
#endif
|
||||
|
||||
#ifndef NON_AMD64_BUILD
|
||||
#define EXT_NAME ".lp64.png"
|
||||
#else
|
||||
#define EXT_NAME ".lp32.png"
|
||||
#endif
|
||||
|
||||
static const char * ARCLABEL_TEXT =
|
||||
"I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# 特性! \n";
|
||||
|
||||
static lv_font_t * font;
|
||||
static lv_obj_t * active_screen = NULL;
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
active_screen = lv_screen_active();
|
||||
font = lv_freetype_font_create("src/test_files/fonts/noto/NotoSansSC-Regular.ttf", FREETYPE_FONT_TYPE, 18,
|
||||
LV_FREETYPE_FONT_STYLE_NORMAL);
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
lv_obj_clean(active_screen);
|
||||
lv_obj_set_style_layout(active_screen, LV_LAYOUT_NONE, 0);
|
||||
|
||||
if(font) {
|
||||
lv_freetype_font_delete(font);
|
||||
}
|
||||
}
|
||||
|
||||
void test_arclabel_simple(void)
|
||||
{
|
||||
if(!font) {
|
||||
LV_LOG_ERROR("freetype font create failed.");
|
||||
TEST_FAIL();
|
||||
}
|
||||
|
||||
lv_obj_t * arclabel = lv_arclabel_create(active_screen);
|
||||
lv_obj_set_style_text_font(arclabel, font, LV_PART_MAIN);
|
||||
lv_obj_set_size(arclabel, 200, 200);
|
||||
lv_obj_set_style_text_letter_space(arclabel, 2, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(arclabel, lv_color_hex(0x888888), LV_PART_MAIN);
|
||||
lv_arclabel_set_angle_start(arclabel, -180);
|
||||
lv_arclabel_set_text_static(arclabel, ARCLABEL_TEXT);
|
||||
lv_arclabel_set_radius(arclabel, LV_PCT(100));
|
||||
lv_arclabel_set_recolor(arclabel, true);
|
||||
lv_arclabel_set_text_vertical_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_LEADING);
|
||||
lv_arclabel_set_dir(arclabel, LV_ARCLABEL_DIR_CLOCKWISE);
|
||||
lv_arclabel_set_text_horizontal_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER);
|
||||
lv_obj_center(arclabel);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arclabel_0" EXT_NAME);
|
||||
|
||||
lv_obj_set_size(arclabel, 300, 300);
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arclabel_1" EXT_NAME);
|
||||
|
||||
lv_arclabel_set_recolor(arclabel, false);
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/arclabel_2" EXT_NAME);
|
||||
}
|
||||
|
||||
#endif
|
||||