lv_grad.h

API reference for lv_grad.h

Report on GitHub

Functions

lv_grad_radial_set_focal

Set focal (starting) circle of a radial gradient

 
void lv_grad_radial_set_focal(lv_grad_dsc_t *dsc, int32_t center_x, int32_t center_y, int32_t radius)
Parameters
NameTypeDescription
dsclv_grad_dsc_t *gradient descriptor
center_xint32_tcenter x position: can be a coordinate or an lv_pct() value predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well
center_yint32_tcenter y position
radiusint32_tradius of the starting circle (NOTE: this must be a scalar number, not percentage)

Enums

lv_grad_dir_t

The direction of the gradient.

NameDescription
LV_GRAD_DIR_NONENo gradient (the grad_color property is ignored)
LV_GRAD_DIR_VERSimple vertical (top to bottom) gradient
LV_GRAD_DIR_HORSimple horizontal (left to right) gradient
LV_GRAD_DIR_LINEARLinear gradient defined by start and end points. Can be at any angle.
LV_GRAD_DIR_RADIALRadial gradient defined by start and end circles
LV_GRAD_DIR_CONICALConical gradient defined by center point, start and end angles
Used by 2 functions
  • lv_obj_set_style_bg_grad_dir — param value
  • lv_style_set_bg_grad_dir — param value

lv_grad_extend_t

Gradient behavior outside the defined range.

NameDescription
LV_GRAD_EXTEND_PADRepeat the same color
LV_GRAD_EXTEND_REPEATRepeat the pattern
LV_GRAD_EXTEND_REFLECTRepeat the pattern mirrored
Used by 3 functions
  • lv_grad_linear_init — param extend
  • lv_grad_radial_init — param extend
  • lv_grad_conical_init — param extend

Structs

struct

lv_grad_stop_t

A gradient stop definition. This matches a color and a position in a virtual 0-255 scale.

MemberTypeDescription
colorlv_color_tThe stop color
opalv_opa_tThe opacity of the color
fracuint8_tThe stop position in 1/255 unit
Used by 2 functions
  • lv_draw_vector_dsc_set_fill_gradient_color_stops — param stops
  • lv_draw_vector_dsc_set_stroke_gradient_color_stops — param stops
struct

lv_grad_dsc_t

A descriptor of a gradient.

MemberTypeDescription
stopslv_grad_stop_t[2]A gradient stop array
stops_countuint8_tThe number of used stops in the array
dirlv_grad_dir_tThe gradient direction. Any of LV_GRAD_DIR_NONE, LV_GRAD_DIR_VER, LV_GRAD_DIR_HOR, LV_GRAD_TYPE_LINEAR, LV_GRAD_TYPE_RADIAL, LV_GRAD_TYPE_CONICAL
extendlv_grad_extend_tBehaviour outside the defined range. LV_GRAD_EXTEND_NONE, LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT, LV_GRAD_EXTEND_REFLECT
startlv_point_tLinear gradient vector start point
endlv_point_tLinear gradient vector end point

Center of the ending circle in local coordinates
linearstruct lv_grad_dsc_t
focallv_point_tCenter of the focal (starting) circle in local coordinates
focal_extentlv_point_tPoint on the circle (can be the same as the center)
end_extentlv_point_tPoint on the circle determining the radius of the gradient
radialstruct lv_grad_dsc_t
centerlv_point_tConical gradient center point
start_angleint16_tStart angle 0..3600
end_angleint16_tEnd angle 0..3600
conicalstruct lv_grad_dsc_t
paramsunion lv_grad_dsc_t
statevoid *
Used by 23 functions
  • lv_obj_set_style_bg_grad — param value
  • lv_nanovg_draw_grad_helper — param grad_dsc
  • lv_nemagfx_grad_set — param lv_grad
  • lv_draw_sw_grad_color_calculate — param dsc
  • lv_draw_sw_grad_get — param gradient
  • lv_draw_sw_grad_linear_setup — param dsc
  • lv_draw_sw_grad_linear_cleanup — param dsc
  • lv_draw_sw_grad_linear_get_line — param dsc
  • lv_draw_sw_grad_radial_setup — param dsc
  • lv_draw_sw_grad_radial_cleanup — param dsc
  • lv_draw_sw_grad_radial_get_line — param dsc
  • lv_draw_sw_grad_conical_setup — param dsc
  • lv_draw_sw_grad_conical_cleanup — param dsc
  • lv_draw_sw_grad_conical_get_line — param dsc
  • lv_vg_lite_draw_grad_helper — param grad_dsc
  • lv_grad_init_stops — param grad
  • lv_grad_horizontal_init — param dsc
  • lv_grad_vertical_init — param dsc
  • lv_grad_linear_init — param dsc
  • lv_grad_radial_init — param dsc
  • lv_grad_radial_set_focal — param dsc
  • lv_grad_conical_init — param dsc
  • lv_style_set_bg_grad — param value

Dependencies

How is this guide?

Last updated on

On this page