lv_draw_vector.h

Typedefs

typedef void (*vector_draw_task_cb)(void *ctx, const lv_vector_path_t *path, const lv_vector_draw_dsc_t *dsc)

Enums

enum lv_vector_fill_t

Values:

enumerator LV_VECTOR_FILL_NONZERO
enumerator LV_VECTOR_FILL_EVENODD
enum lv_vector_stroke_cap_t

Values:

enumerator LV_VECTOR_STROKE_CAP_BUTT
enumerator LV_VECTOR_STROKE_CAP_SQUARE
enumerator LV_VECTOR_STROKE_CAP_ROUND
enum lv_vector_stroke_join_t

Values:

enumerator LV_VECTOR_STROKE_JOIN_MITER
enumerator LV_VECTOR_STROKE_JOIN_BEVEL
enumerator LV_VECTOR_STROKE_JOIN_ROUND
enum lv_vector_path_quality_t

Values:

enumerator LV_VECTOR_PATH_QUALITY_MEDIUM
enumerator LV_VECTOR_PATH_QUALITY_HIGH
enumerator LV_VECTOR_PATH_QUALITY_LOW
enum lv_vector_blend_t

Values:

enumerator LV_VECTOR_BLEND_SRC_OVER
enumerator LV_VECTOR_BLEND_SRC_IN
enumerator LV_VECTOR_BLEND_DST_OVER
enumerator LV_VECTOR_BLEND_DST_IN
enumerator LV_VECTOR_BLEND_SCREEN
enumerator LV_VECTOR_BLEND_MULTIPLY
enumerator LV_VECTOR_BLEND_NONE
enumerator LV_VECTOR_BLEND_ADDITIVE
enumerator LV_VECTOR_BLEND_SUBTRACTIVE
enum lv_vector_path_op_t

Values:

enumerator LV_VECTOR_PATH_OP_MOVE_TO
enumerator LV_VECTOR_PATH_OP_LINE_TO
enumerator LV_VECTOR_PATH_OP_QUAD_TO
enumerator LV_VECTOR_PATH_OP_CUBIC_TO
enumerator LV_VECTOR_PATH_OP_CLOSE
enum lv_vector_draw_style_t

Values:

enumerator LV_VECTOR_DRAW_STYLE_SOLID
enumerator LV_VECTOR_DRAW_STYLE_PATTERN
enumerator LV_VECTOR_DRAW_STYLE_GRADIENT
enum lv_vector_gradient_spread_t

Values:

enumerator LV_VECTOR_GRADIENT_SPREAD_PAD
enumerator LV_VECTOR_GRADIENT_SPREAD_REPEAT
enumerator LV_VECTOR_GRADIENT_SPREAD_REFLECT
enum lv_vector_gradient_style_t

Values:

enumerator LV_VECTOR_GRADIENT_STYLE_LINEAR
enumerator LV_VECTOR_GRADIENT_STYLE_RADIAL

Functions

void lv_matrix_transform_point(const lv_matrix_t *matrix, lv_fpoint_t *point)

Transform the coordinates of a point using given matrix

参数:
  • matrix -- pointer to a matrix

  • point -- pointer to a point

void lv_matrix_transform_path(const lv_matrix_t *matrix, lv_vector_path_t *path)

Transform all the coordinates of a path using given matrix

参数:
  • matrix -- pointer to a matrix

  • path -- pointer to a path

lv_vector_path_t *lv_vector_path_create(lv_vector_path_quality_t quality)

Create a vector graphic path object

参数:

quality -- the quality hint of path

返回:

pointer to the created path object

void lv_vector_path_copy(lv_vector_path_t *target_path, const lv_vector_path_t *path)

Copy a path data to another

参数:
  • target_path -- pointer to a path

  • path -- pointer to source path

void lv_vector_path_clear(lv_vector_path_t *path)

Clear path data

参数:

path -- pointer to a path

void lv_vector_path_delete(lv_vector_path_t *path)

Delete the graphic path object

参数:

path -- pointer to a path

void lv_vector_path_move_to(lv_vector_path_t *path, const lv_fpoint_t *p)

Begin a new sub path and set a point to path

参数:
  • path -- pointer to a path

  • p -- pointer to a lv_fpoint_t variable

void lv_vector_path_line_to(lv_vector_path_t *path, const lv_fpoint_t *p)

Add a line to the path from last point to the point

参数:
  • path -- pointer to a path

  • p -- pointer to a lv_fpoint_t variable

void lv_vector_path_quad_to(lv_vector_path_t *path, const lv_fpoint_t *p1, const lv_fpoint_t *p2)

Add a quadratic bezier line to the path from last point to the point

参数:
  • path -- pointer to a path

  • p1 -- pointer to a lv_fpoint_t variable for control point

  • p2 -- pointer to a lv_fpoint_t variable for end point

void lv_vector_path_cubic_to(lv_vector_path_t *path, const lv_fpoint_t *p1, const lv_fpoint_t *p2, const lv_fpoint_t *p3)

Add a cubic bezier line to the path from last point to the point

参数:
  • path -- pointer to a path

  • p1 -- pointer to a lv_fpoint_t variable for first control point

  • p2 -- pointer to a lv_fpoint_t variable for second control point

  • p3 -- pointer to a lv_fpoint_t variable for end point

void lv_vector_path_close(lv_vector_path_t *path)

Close the sub path

参数:

path -- pointer to a path

void lv_vector_path_get_bounding(const lv_vector_path_t *path, lv_area_t *area)

Get the bounding box of a path

参数:
  • path -- pointer to a path

  • area -- pointer to a lv_area_t variable for bounding box

void lv_vector_path_append_rect(lv_vector_path_t *path, const lv_area_t *rect, float rx, float ry)

Add a rectangle to the path

参数:
  • path -- pointer to a path

  • rect -- pointer to a lv_area_t variable

  • rx -- the horizontal radius for rounded rectangle

  • ry -- the vertical radius for rounded rectangle

void lv_vector_path_append_circle(lv_vector_path_t *path, const lv_fpoint_t *c, float rx, float ry)

Add a circle to the path

参数:
  • path -- pointer to a path

  • c -- pointer to a lv_fpoint_t variable for center of the circle

  • rx -- the horizontal radius for circle

  • ry -- the vertical radius for circle

void lv_vector_path_append_arc(lv_vector_path_t *path, const lv_fpoint_t *c, float radius, float start_angle, float sweep, bool pie)

Add a arc to the path

参数:
  • path -- pointer to a path

  • c -- pointer to a lv_fpoint_t variable for center of the circle

  • radius -- the radius for arc

  • start_angle -- the start angle for arc

  • sweep -- the sweep angle for arc, could be negative

  • pie -- true: draw a pie, false: draw a arc

void lv_vector_path_append_path(lv_vector_path_t *path, const lv_vector_path_t *subpath)

Add an sub path to the path

参数:
  • path -- pointer to a path

  • subpath -- pointer to another path which will be added

lv_vector_dsc_t *lv_vector_dsc_create(lv_layer_t *layer)

Create a vector graphic descriptor

参数:

layer -- pointer to a layer

返回:

pointer to the created descriptor

void lv_vector_dsc_delete(lv_vector_dsc_t *dsc)

Delete the vector graphic descriptor

参数:

dsc -- pointer to a vector graphic descriptor

void lv_vector_dsc_set_transform(lv_vector_dsc_t *dsc, const lv_matrix_t *matrix)

Set a matrix to current transformation matrix

参数:
  • dsc -- pointer to a vector graphic descriptor

  • matrix -- pointer to a matrix

void lv_vector_dsc_set_blend_mode(lv_vector_dsc_t *dsc, lv_vector_blend_t blend)

Set blend mode for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • blend -- the blend mode to be set in lv_vector_blend_t

void lv_vector_dsc_set_fill_color32(lv_vector_dsc_t *dsc, lv_color32_t color)

Set fill color for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • color -- the color to be set in lv_color32_t format

void lv_vector_dsc_set_fill_color(lv_vector_dsc_t *dsc, lv_color_t color)

Set fill color for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • color -- the color to be set in lv_color_t format

void lv_vector_dsc_set_fill_opa(lv_vector_dsc_t *dsc, lv_opa_t opa)

Set fill opacity for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • opa -- the opacity to be set in lv_opa_t format

void lv_vector_dsc_set_fill_rule(lv_vector_dsc_t *dsc, lv_vector_fill_t rule)

Set fill rule for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • rule -- the fill rule to be set in lv_vector_fill_t format

void lv_vector_dsc_set_fill_image(lv_vector_dsc_t *dsc, const lv_draw_image_dsc_t *img_dsc)

Set fill image for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • img_dsc -- pointer to a lv_draw_image_dsc_t variable

void lv_vector_dsc_set_fill_linear_gradient(lv_vector_dsc_t *dsc, float x1, float y1, float x2, float y2)

Set fill linear gradient for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • x1 -- the x for start point

  • y1 -- the y for start point

  • x2 -- the x for end point

  • y2 -- the y for end point

void lv_vector_dsc_set_fill_radial_gradient(lv_vector_dsc_t *dsc, float cx, float cy, float radius)

Set fill radial gradient radius for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • cx -- the x for center of the circle

  • cy -- the y for center of the circle

  • radius -- the radius for circle

void lv_vector_dsc_set_fill_gradient_spread(lv_vector_dsc_t *dsc, lv_vector_gradient_spread_t spread)

Set fill radial gradient spread for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • spread -- the gradient spread to be set in lv_vector_gradient_spread_t format

void lv_vector_dsc_set_fill_gradient_color_stops(lv_vector_dsc_t *dsc, const lv_gradient_stop_t *stops, uint16_t count)

Set fill gradient color stops for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • stops -- an array of lv_gradient_stop_t variables

  • count -- the number of stops in the array, range: 0..LV_GRADIENT_MAX_STOPS

void lv_vector_dsc_set_fill_transform(lv_vector_dsc_t *dsc, const lv_matrix_t *matrix)

Set a matrix to current fill transformation matrix

参数:
  • dsc -- pointer to a vector graphic descriptor

  • matrix -- pointer to a matrix

void lv_vector_dsc_set_stroke_color32(lv_vector_dsc_t *dsc, lv_color32_t color)

Set stroke color for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • color -- the color to be set in lv_color32_t format

void lv_vector_dsc_set_stroke_color(lv_vector_dsc_t *dsc, lv_color_t color)

Set stroke color for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • color -- the color to be set in lv_color_t format

void lv_vector_dsc_set_stroke_opa(lv_vector_dsc_t *dsc, lv_opa_t opa)

Set stroke opacity for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • opa -- the opacity to be set in lv_opa_t format

void lv_vector_dsc_set_stroke_width(lv_vector_dsc_t *dsc, float width)

Set stroke line width for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • width -- the stroke line width

void lv_vector_dsc_set_stroke_dash(lv_vector_dsc_t *dsc, float *dash_pattern, uint16_t dash_count)

Set stroke line dash pattern for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • dash_pattern -- an array of values that specify the segments of dash line

  • dash_count -- the length of dash pattern array

void lv_vector_dsc_set_stroke_cap(lv_vector_dsc_t *dsc, lv_vector_stroke_cap_t cap)

Set stroke line cap style for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • cap -- the line cap to be set in lv_vector_stroke_cap_t format

void lv_vector_dsc_set_stroke_join(lv_vector_dsc_t *dsc, lv_vector_stroke_join_t join)

Set stroke line join style for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • join -- the line join to be set in lv_vector_stroke_join_t format

void lv_vector_dsc_set_stroke_miter_limit(lv_vector_dsc_t *dsc, uint16_t miter_limit)

Set stroke miter limit for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • miter_limit -- the stroke miter_limit

void lv_vector_dsc_set_stroke_linear_gradient(lv_vector_dsc_t *dsc, float x1, float y1, float x2, float y2)

Set stroke linear gradient for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • x1 -- the x for start point

  • y1 -- the y for start point

  • x2 -- the x for end point

  • y2 -- the y for end point

void lv_vector_dsc_set_stroke_radial_gradient(lv_vector_dsc_t *dsc, float cx, float cy, float radius)

Set stroke radial gradient for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • cx -- the x for center of the circle

  • cy -- the y for center of the circle

  • radius -- the radius for circle

void lv_vector_dsc_set_stroke_gradient_spread(lv_vector_dsc_t *dsc, lv_vector_gradient_spread_t spread)

Set stroke color stops for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • spread -- the gradient spread to be set in lv_vector_gradient_spread_t format

void lv_vector_dsc_set_stroke_gradient_color_stops(lv_vector_dsc_t *dsc, const lv_gradient_stop_t *stops, uint16_t count)

Set stroke color stops for descriptor

参数:
  • dsc -- pointer to a vector graphic descriptor

  • stops -- an array of lv_gradient_stop_t variables

  • count -- the number of stops in the array

void lv_vector_dsc_set_stroke_transform(lv_vector_dsc_t *dsc, const lv_matrix_t *matrix)

Set a matrix to current stroke transformation matrix

参数:
  • dsc -- pointer to a vector graphic descriptor

  • matrix -- pointer to a matrix

void lv_vector_dsc_identity(lv_vector_dsc_t *dsc)

Set current transformation matrix to identity matrix

参数:

dsc -- pointer to a vector graphic descriptor

void lv_vector_dsc_scale(lv_vector_dsc_t *dsc, float scale_x, float scale_y)

Change the scale factor of current transformation matrix

参数:
  • dsc -- pointer to a vector graphic descriptor

  • scale_x -- the scale factor for the X direction

  • scale_y -- the scale factor for the Y direction

void lv_vector_dsc_rotate(lv_vector_dsc_t *dsc, float degree)

Rotate current transformation matrix with origin

参数:
  • dsc -- pointer to a vector graphic descriptor

  • degree -- angle to rotate

void lv_vector_dsc_translate(lv_vector_dsc_t *dsc, float tx, float ty)

Translate current transformation matrix to new position

参数:
  • dsc -- pointer to a vector graphic descriptor

  • tx -- the amount of translate in x direction

  • tx -- the amount of translate in y direction

void lv_vector_dsc_skew(lv_vector_dsc_t *dsc, float skew_x, float skew_y)

Change the skew factor of current transformation matrix

参数:
  • dsc -- pointer to a vector graphic descriptor

  • skew_x -- the skew factor for x direction

  • skew_y -- the skew factor for y direction

void lv_vector_dsc_add_path(lv_vector_dsc_t *dsc, const lv_vector_path_t *path)

Add a graphic path to the draw list

参数:
  • dsc -- pointer to a vector graphic descriptor

  • path -- pointer to a path

void lv_vector_clear_area(lv_vector_dsc_t *dsc, const lv_area_t *rect)

Clear a rectangle area use current fill color

参数:
  • dsc -- pointer to a vector graphic descriptor

  • rect -- the area to clear in the buffer

void lv_draw_vector(lv_vector_dsc_t *dsc)

Draw all the vector graphic paths

参数:

dsc -- pointer to a vector graphic descriptor

struct lv_fpoint_t

Public Members

float x
float y