lv_draw_image.h
Typedefs
-
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)
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
Functions
-
void lv_draw_image_dsc_init(lv_draw_image_dsc_t *dsc)
Initialize an image draw descriptor.
- Parameters:
dsc – pointer to a draw descriptor
-
lv_draw_image_dsc_t *lv_draw_task_get_image_dsc(lv_draw_task_t *task)
Try to get an image draw descriptor from a draw task.
- Parameters:
task – draw task
- Returns:
the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_IMAGE
-
void lv_draw_image(lv_layer_t *layer, const lv_draw_image_dsc_t *dsc, const lv_area_t *coords)
Create an image draw task
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). .- Parameters:
layer – pointer to a layer
dsc – pointer to an initialized draw descriptor
coords – the coordinates of the image
-
void lv_draw_layer(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
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)- Parameters:
layer – pointer to a layer
dsc – pointer to an initialized draw descriptor.
src
must be set to the layer to blendcoords – the coordinates of the layer.
-
lv_image_src_t lv_image_src_get_type(const void *src)
Get the type of an image source
- Parameters:
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)
- Returns:
type of the image source LV_IMAGE_SRC_VARIABLE/FILE/SYMBOL/UNKNOWN
-
struct _lv_draw_image_dsc_t
Public Members
-
lv_draw_dsc_base_t base
-
const void *src
The image source: pointer to
lv_image_dsc_t
or a path to a file
-
lv_image_header_t header
The header of the image. Initialized internally in
lv_draw_image
-
int32_t clip_radius
Clip the corner of the image with this radius. Use
LV_RADIUS_CIRCLE
for max. radius
-
int32_t rotation
The rotation of the image in 0.1 degree unit. E.g. 234 means 23.4°
-
int32_t scale_x
Horizontal scale (zoom) of the image. 256 (LV_SCALE_NONE): means no zoom, 512 double size, 128 half size.
-
int32_t scale_y
Same as
scale_y
but vertically
-
int32_t skew_x
Parallelogram like transformation of the image horizontally in 0.1 degree unit. E.g. 456 means 45.6°.
-
int32_t skew_y
Same as
skew_x
but vertically
-
lv_point_t pivot
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_color_t recolor
Mix this color to the images. In case of
LV_COLOR_FORMAT_A8
it will be the color of the visible pixels
-
lv_opa_t recolor_opa
The intensity of recoloring. 0 means, no recolor, 255 means full cover (transparent pixels remain transparent)
-
lv_opa_t opa
Opacity in 0...255 range. LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well
-
lv_blend_mode_t blend_mode
Describes how to blend the pixels of the image to the background. See
lv_blend_mode_t
for more details.
-
uint16_t antialias
1: perform the transformation with anti-alaising
-
uint16_t tile
If the image is smaller than the
image_area
field oflv_draw_image_dsc_t
tile the image (repeat is both horizontally and vertically) to fill theimage_area
area
-
lv_draw_image_sup_t *sup
Used internally to store some information about the palette or the color of A8 images
-
lv_area_t image_area
Used to indicate the entire original, non-clipped area where the image is to be drawn. This is important for:
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.Tiled images, where the target draw area is larger than the image to be tiled.
-
const lv_image_dsc_t *bitmap_mask_src
Pointer to an A8 or L8 image descriptor to mask the image with. The mask is always center aligned.
-
lv_draw_dsc_base_t base