refactor: replace lv_coord_t with int32_t
This commit is contained in:
@@ -256,10 +256,10 @@ the following functions:
|
||||
|
||||
.. code:: c
|
||||
|
||||
lv_coord_t w = lv_obj_get_width(obj);
|
||||
lv_coord_t h = lv_obj_get_height(obj);
|
||||
lv_coord_t content_w = lv_obj_get_content_width(obj);
|
||||
lv_coord_t content_h = lv_obj_get_content_height(obj);
|
||||
int32_t w = lv_obj_get_width(obj);
|
||||
int32_t h = lv_obj_get_height(obj);
|
||||
int32_t content_w = lv_obj_get_content_width(obj);
|
||||
int32_t content_h = lv_obj_get_content_height(obj);
|
||||
|
||||
Using styles
|
||||
************
|
||||
|
||||
@@ -73,7 +73,7 @@ draw the button under the text and it's not necessary to redraw the
|
||||
display under the rest of the button too.
|
||||
|
||||
The difference between buffering modes regarding the drawing mechanism
|
||||
is the following:
|
||||
is the following:
|
||||
|
||||
1. **One buffer** - LVGL needs to wait for :cpp:func:`lv_disp_flush_ready` (called from ``flush_cb``) before starting to redraw the next part.
|
||||
2. **Two buffers** - LVGL can immediately draw to the second buffer when the first is sent to ``flush_cb`` because the
|
||||
@@ -128,14 +128,14 @@ applied real-time:
|
||||
- :cpp:enumerator:`LV_DRAW_MASK_TYPE_MAP`: The mask is stored in a bitmap array and the
|
||||
necessary parts are applied
|
||||
|
||||
Masks are used to create almost every basic primitive:
|
||||
Masks are used to create almost every basic primitive:
|
||||
|
||||
- **letters**: Create a mask from the letter and draw a rectangle with the letter's color using the mask.
|
||||
- **line**: Created from four "line masks" to mask out the left, right, top and bottom part of the line to get a perfectly perpendicular perimeter.
|
||||
- **rounded rectangle**: A mask is created real-time to add a radius to the corners.
|
||||
- **clip corner**: To clip overflowing content (usually children) on rounded corners, a rounded rectangle mask is also applied.
|
||||
- **rectangle border**: Same as a rounded rectangle but the inner part is masked out too.
|
||||
- **arc drawing**: A circular border is drawn but an arc mask is applied too.
|
||||
- **line**: Created from four "line masks" to mask out the left, right, top and bottom part of the line to get a perfectly perpendicular perimeter.
|
||||
- **rounded rectangle**: A mask is created real-time to add a radius to the corners.
|
||||
- **clip corner**: To clip overflowing content (usually children) on rounded corners, a rounded rectangle mask is also applied.
|
||||
- **rectangle border**: Same as a rounded rectangle but the inner part is masked out too.
|
||||
- **arc drawing**: A circular border is drawn but an arc mask is applied too.
|
||||
- **ARGB images**: The alpha channel is separated into a mask and the image is drawn as a normal RGB image.
|
||||
|
||||
Using masks
|
||||
@@ -287,7 +287,7 @@ documentation.
|
||||
uint32_t text_length; /**< Size of the text buffer containing null-terminated text string calculated during drawing.*/
|
||||
uint32_t part; /**< The current part for which the event is sent*/
|
||||
uint32_t id; /**< The index of the part. E.g. a button's index on button matrix or table cell index.*/
|
||||
lv_coord_t radius; /**< E.g. the radius of an arc (not the corner radius).*/
|
||||
int32_t radius; /**< E.g. the radius of an arc (not the corner radius).*/
|
||||
int32_t value; /**< A value calculated during drawing. E.g. Chart's tick line value.*/
|
||||
const void * sub_part_ptr; /**< A pointer the identifies something in the part. E.g. chart series. */
|
||||
} lv_obj_draw_part_dsc_t;
|
||||
|
||||
@@ -107,7 +107,7 @@ Drawing events
|
||||
--------------
|
||||
|
||||
- :cpp:enumerator:`LV_EVENT_COVER_CHECK`: Check if an object fully covers an area. The event parameter is :cpp:struct:`lv_cover_check_info_t` ``*``.
|
||||
- :cpp:enumerator:`LV_EVENT_REFR_EXT_DRAW_SIZE`: Get the required extra draw area around an object (e.g. for a shadow). The event parameter is :cpp:type:`lv_coord_t` ``*`` to store the size. Only overwrite it with a larger value.
|
||||
- :cpp:enumerator:`LV_EVENT_REFR_EXT_DRAW_SIZE`: Get the required extra draw area around an object (e.g. for a shadow). The event parameter is :cpp:type:`int32_t` ``*`` to store the size. Only overwrite it with a larger value.
|
||||
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN_BEGIN`: Starting the main drawing phase.
|
||||
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN`: Perform the main drawing
|
||||
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN_END`: Finishing the main drawing phase
|
||||
|
||||
@@ -354,12 +354,12 @@ to open is an animation.
|
||||
Image post-processing
|
||||
---------------------
|
||||
|
||||
Considering that some hardware has special requirements for image formats,
|
||||
such as alpha premultiplication and stride alignment, most image decoders (such as PNG decoders)
|
||||
may not directly output image data that meets hardware requirements.
|
||||
Considering that some hardware has special requirements for image formats,
|
||||
such as alpha premultiplication and stride alignment, most image decoders (such as PNG decoders)
|
||||
may not directly output image data that meets hardware requirements.
|
||||
|
||||
For this reason, LVGL provides a solution for image post-processing.
|
||||
First, call a custom post-processing function after ``lv_image_decoder_open`` to adjust the data in the image cache,
|
||||
For this reason, LVGL provides a solution for image post-processing.
|
||||
First, call a custom post-processing function after ``lv_image_decoder_open`` to adjust the data in the image cache,
|
||||
and then mark the processing status in ``cache_entry->process_state`` (to avoid repeated post-processing).
|
||||
|
||||
See the detailed code below:
|
||||
@@ -402,8 +402,8 @@ See the detailed code below:
|
||||
}
|
||||
|
||||
if(!(entry->process_state & IMAGE_PROCESS_STATE_STRIDE_ALIGNED)) {
|
||||
lv_coord_t image_w = dsc->header.w;
|
||||
lv_coord_t image_h = dsc->header.h;
|
||||
int32_t image_w = dsc->header.w;
|
||||
int32_t image_h = dsc->header.h;
|
||||
uint32_t width_byte = image_w * lv_color_format_get_size(color_format);
|
||||
uint32_t stride = lv_draw_buf_width_to_stride(image_w, color_format);
|
||||
|
||||
@@ -426,7 +426,7 @@ See the detailed code below:
|
||||
|
||||
/* Copy image data */
|
||||
const uint8_t * cur = ori_image;
|
||||
for(lv_coord_t y = 0; y < image_h; y++) {
|
||||
for(int32_t y = 0; y < image_h; y++) {
|
||||
lv_memcpy(new_image, cur, width_byte);
|
||||
new_image += stride;
|
||||
cur += width_byte;
|
||||
|
||||
Reference in New Issue
Block a user