lv_draw_buf.h
Typedefs
-
typedef void *(*lv_draw_buf_malloc_cb)(size_t size, lv_color_format_t color_format)
-
typedef void (*lv_draw_buf_free_cb)(void *draw_buf)
-
typedef void *(*lv_draw_buf_align_cb)(void *buf, lv_color_format_t color_format)
-
typedef void (*lv_draw_buf_invalidate_cache_cb)(void *buf, uint32_t stride, lv_color_format_t color_format, const lv_area_t *area)
-
typedef uint32_t (*lv_draw_buf_width_to_stride_cb)(uint32_t w, lv_color_format_t color_format)
-
typedef void *(*lv_draw_buf_go_to_xy_cb)(const void *buf, uint32_t stride, lv_color_format_t color_format, lv_coord_t x, lv_coord_t y)
-
typedef void (*lv_draw_buf_clear_cb)(void *buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t *a)
-
typedef void (*lv_draw_buf_copy_cb)(void *dest_buf, uint32_t dest_w, uint32_t dest_h, const lv_area_t *dest_area_to_copy, void *src_buf, uint32_t src_w, uint32_t src_h, const lv_area_t *src_area_to_copy, lv_color_format_t color_format)
Functions
-
void _lv_draw_buf_init_handlers(void)
Called internally to initialize the draw_buf_handlers in lv_global
-
lv_draw_buf_handlers_t *lv_draw_buf_get_handlers(void)
Get the struct which holds the callbacks for draw buf management. Custom callback can be set on the returned value
- Returns:
pointer to the struct of handlers
-
void *lv_draw_buf_malloc(size_t size_bytes, lv_color_format_t color_format)
Allocate a buffer with the given size. It might allocate slightly larger buffer to fulfill the alignment requirements.
Note
The returned value can be saved in draw_buf->buf
Note
lv_draw_buf_align can be sued the align the returned pointer
- Parameters:
size -- the size to allocate in bytes
color_format -- the color format of the buffer to allocate
- Returns:
the allocated buffer.
-
void lv_draw_buf_free(void *buf)
Free a buffer allocated by lv_draw_buf_malloc
- Parameters:
buf -- pointer to a buffer
-
void *lv_draw_buf_align(void *buf, lv_color_format_t color_format)
Align the address of a buffer. The buffer needs to be large enough for the real data after alignment
- Parameters:
buf -- the data to align
color_format -- the color format of the buffer
- Returns:
the aligned buffer
-
void lv_draw_buf_invalidate_cache(void *buf, uint32_t stride, lv_color_format_t color_format, const lv_area_t *area)
Invalidate the cache of the buffer
- Parameters:
buf -- a memory address to invalidate
stride -- stride of the buffer
color_format -- color format of the buffer
area -- the area to invalidate in the buffer
-
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
- Parameters:
w -- the width in pixels
color_format -- the color format
- Returns:
the stride in bytes
-
void *lv_draw_buf_go_to_xy(const void *buf, uint32_t stride, lv_color_format_t color_format, lv_coord_t x, lv_coord_t y)
Got to a pixel at X and Y coordinate in a buffer
- Parameters:
buf -- pointer to a buffer
stride -- stride of the buffer
color_format -- color format of the buffer
x -- the target X coordinate
y -- the target X coordinate
- Returns:
buf
offset to point to the given X and Y coordinate
-
void lv_draw_buf_clear(void *buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t *a)
Clear an area on the buffer
- Parameters:
draw_buf -- pointer to draw buffer
w -- width of the buffer
h -- height of the buffer
color_format -- color format of the buffer
a -- the area to clear, or NULL to clear the whole buffer
-
void lv_draw_buf_copy(void *dest_buf, uint32_t dest_w, uint32_t dest_h, const lv_area_t *dest_area_to_copy, void *src_buf, uint32_t src_w, uint32_t src_h, const lv_area_t *src_area_to_copy, lv_color_format_t color_format)
Copy an area from a buffer to an other
Note
dest_area_to_copy
andsrc_area_to_copy
should have the same width and height- Parameters:
dest_buf -- pointer to the destination buffer)
dest_w -- width of the destination buffer in pixels
dest_h -- height of the destination buffer in pixels
dest_area_to_copy -- the area to copy from the destination buffer
src_buf -- pointer to the source buffer
src_w -- width of the source buffer in pixels
src_h -- height of the source buffer in pixels
src_area_to_copy -- the area to copy from the destination buffer
color_format -- the color format, should be the same for both buffers
-
struct lv_draw_buf_handlers_t
Public Members
-
lv_draw_buf_malloc_cb buf_malloc_cb
-
lv_draw_buf_free_cb buf_free_cb
-
lv_draw_buf_align_cb align_pointer_cb
-
lv_draw_buf_invalidate_cache_cb invalidate_cache_cb
-
lv_draw_buf_width_to_stride_cb width_to_stride_cb
-
lv_draw_buf_go_to_xy_cb go_to_xy_cb
-
lv_draw_buf_clear_cb buf_clear_cb
-
lv_draw_buf_copy_cb buf_copy_cb
-
lv_draw_buf_malloc_cb buf_malloc_cb