LittlevGL  3.20.00.19
Functions
lv_draw_img.h File Reference
#include "lv_draw.h"
#include "lv_img_decoder.h"
Include dependency graph for lv_draw_img.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void lv_draw_img (const lv_area_t *coords, const lv_area_t *mask, const void *src, const lv_style_t *style, lv_opa_t opa_scale)
 
lv_img_src_t lv_img_src_get_type (const void *src)
 
lv_color_t lv_img_buf_get_px_color (lv_img_dsc_t *dsc, lv_coord_t x, lv_coord_t y, const lv_style_t *style)
 
lv_opa_t lv_img_buf_get_px_alpha (lv_img_dsc_t *dsc, lv_coord_t x, lv_coord_t y)
 
void lv_img_buf_set_px_color (lv_img_dsc_t *dsc, lv_coord_t x, lv_coord_t y, lv_color_t c)
 
void lv_img_buf_set_px_alpha (lv_img_dsc_t *dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa)
 
void lv_img_buf_set_palette (lv_img_dsc_t *dsc, uint8_t id, lv_color_t c)
 
uint8_t lv_img_color_format_get_px_size (lv_img_cf_t cf)
 
bool lv_img_color_format_is_chroma_keyed (lv_img_cf_t cf)
 
bool lv_img_color_format_has_alpha (lv_img_cf_t cf)
 

Function Documentation

§ lv_draw_img()

void lv_draw_img ( const lv_area_t coords,
const lv_area_t mask,
const void *  src,
const lv_style_t style,
lv_opa_t  opa_scale 
)

Draw an image

Parameters
coordsthe coordinates of the image
maskthe image will be drawn only in this area
srcpointer to a lv_color_t array which contains the pixels of the image
stylestyle of the image
opa_scalescale down all opacities by the factor

§ lv_img_src_get_type()

lv_img_src_t lv_img_src_get_type ( const void *  src)

Get the type of an image source

Parameters
srcpointer to an image source:
  • pointer to an 'lv_img_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_IMG_SRC_VARIABLE/FILE/SYMBOL/UNKNOWN

§ lv_img_buf_get_px_color()

lv_color_t lv_img_buf_get_px_color ( lv_img_dsc_t dsc,
lv_coord_t  x,
lv_coord_t  y,
const lv_style_t style 
)

Get the color of an image's pixel

Parameters
dscan image descriptor
xx coordinate of the point to get
yx coordinate of the point to get
stylestyle of the image. In case of LV_IMG_CF_ALPHA_1/2/4/8 style->image.color shows the color. Can be NULL but for ALPHA images black will be returned. In other cases it is not used.
Returns
color of the point

§ lv_img_buf_get_px_alpha()

lv_opa_t lv_img_buf_get_px_alpha ( lv_img_dsc_t dsc,
lv_coord_t  x,
lv_coord_t  y 
)

Get the alpha value of an image's pixel

Parameters
dscpointer to an image descriptor
xx coordinate of the point to set
yx coordinate of the point to set
Returns
alpha value of the point

§ lv_img_buf_set_px_color()

void lv_img_buf_set_px_color ( lv_img_dsc_t dsc,
lv_coord_t  x,
lv_coord_t  y,
lv_color_t  c 
)

Set the color of a pixel of an image. The alpha channel won't be affected.

Parameters
dscpointer to an image descriptor
xx coordinate of the point to set
yx coordinate of the point to set
ccolor of the point

§ lv_img_buf_set_px_alpha()

void lv_img_buf_set_px_alpha ( lv_img_dsc_t dsc,
lv_coord_t  x,
lv_coord_t  y,
lv_opa_t  opa 
)

Set the alpha value of a pixel of an image. The color won't be affected

Parameters
dscpointer to an image descriptor
xx coordinate of the point to set
yx coordinate of the point to set
opathe desired opacity

§ lv_img_buf_set_palette()

void lv_img_buf_set_palette ( lv_img_dsc_t dsc,
uint8_t  id,
lv_color_t  c 
)

Set the palette color of an indexed image. Valid only for LV_IMG_CF_INDEXED1/2/4/8

Parameters
dscpointer to an image descriptor
idthe palette color to set:
  • for LV_IMG_CF_INDEXED1: 0..1
  • for LV_IMG_CF_INDEXED2: 0..3
  • for LV_IMG_CF_INDEXED4: 0..15
  • for LV_IMG_CF_INDEXED8: 0..255
cthe color to set

§ lv_img_color_format_get_px_size()

uint8_t lv_img_color_format_get_px_size ( lv_img_cf_t  cf)

Get the pixel size of a color format in bits

Parameters
cfa color format (LV_IMG_CF_...)
Returns
the pixel size in bits

§ lv_img_color_format_is_chroma_keyed()

bool lv_img_color_format_is_chroma_keyed ( lv_img_cf_t  cf)

Check if a color format is chroma keyed or not

Parameters
cfa color format (LV_IMG_CF_...)
Returns
true: chroma keyed; false: not chroma keyed

§ lv_img_color_format_has_alpha()

bool lv_img_color_format_has_alpha ( lv_img_cf_t  cf)

Check if a color format has alpha channel or not

Parameters
cfa color format (LV_IMG_CF_...)
Returns
true: has alpha channel; false: doesn't have alpha channel
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale