lv_area.h

Defines

LV_COORD_TYPE_SHIFT
LV_COORD_TYPE_MASK
LV_COORD_TYPE(x)
LV_COORD_PLAIN(x)
LV_COORD_TYPE_PX
LV_COORD_TYPE_SPEC
LV_COORD_TYPE_PX_NEG
LV_COORD_IS_PX(x)
LV_COORD_IS_SPEC(x)
LV_COORD_SET_SPEC(x)
LV_COORD_MAX

Max coordinate value

LV_COORD_MIN
LV_SIZE_CONTENT
LV_PCT_STORED_MAX
LV_PCT_POS_MAX
LV_PCT(x)
LV_COORD_IS_PCT(x)
LV_COORD_GET_PCT(x)

Enums

enum lv_align_t

Alignments

Values:

enumerator LV_ALIGN_DEFAULT
enumerator LV_ALIGN_TOP_LEFT
enumerator LV_ALIGN_TOP_MID
enumerator LV_ALIGN_TOP_RIGHT
enumerator LV_ALIGN_BOTTOM_LEFT
enumerator LV_ALIGN_BOTTOM_MID
enumerator LV_ALIGN_BOTTOM_RIGHT
enumerator LV_ALIGN_LEFT_MID
enumerator LV_ALIGN_RIGHT_MID
enumerator LV_ALIGN_CENTER
enumerator LV_ALIGN_OUT_TOP_LEFT
enumerator LV_ALIGN_OUT_TOP_MID
enumerator LV_ALIGN_OUT_TOP_RIGHT
enumerator LV_ALIGN_OUT_BOTTOM_LEFT
enumerator LV_ALIGN_OUT_BOTTOM_MID
enumerator LV_ALIGN_OUT_BOTTOM_RIGHT
enumerator LV_ALIGN_OUT_LEFT_TOP
enumerator LV_ALIGN_OUT_LEFT_MID
enumerator LV_ALIGN_OUT_LEFT_BOTTOM
enumerator LV_ALIGN_OUT_RIGHT_TOP
enumerator LV_ALIGN_OUT_RIGHT_MID
enumerator LV_ALIGN_OUT_RIGHT_BOTTOM
enum lv_dir_t

Values:

enumerator LV_DIR_NONE
enumerator LV_DIR_LEFT
enumerator LV_DIR_RIGHT
enumerator LV_DIR_TOP
enumerator LV_DIR_BOTTOM
enumerator LV_DIR_HOR
enumerator LV_DIR_VER
enumerator LV_DIR_ALL

Functions

void lv_area_set(lv_area_t *area_p, int32_t x1, int32_t y1, int32_t x2, int32_t y2)

Initialize an area

Parameters:
  • area_p – pointer to an area

  • x1 – left coordinate of the area

  • y1 – top coordinate of the area

  • x2 – right coordinate of the area

  • y2 – bottom coordinate of the area

static inline void lv_area_copy(lv_area_t *dest, const lv_area_t *src)

Copy an area

Parameters:
  • dest – pointer to the destination area

  • src – pointer to the source area

int32_t lv_area_get_width(const lv_area_t *area_p)

Get the width of an area

Parameters:

area_p – pointer to an area

Returns:

the width of the area (if x1 == x2 -> width = 1)

int32_t lv_area_get_height(const lv_area_t *area_p)

Get the height of an area

Parameters:

area_p – pointer to an area

Returns:

the height of the area (if y1 == y2 -> height = 1)

void lv_area_set_width(lv_area_t *area_p, int32_t w)

Set the width of an area

Parameters:
  • area_p – pointer to an area

  • w – the new width of the area (w == 1 makes x1 == x2)

void lv_area_set_height(lv_area_t *area_p, int32_t h)

Set the height of an area

Parameters:
  • area_p – pointer to an area

  • h – the new height of the area (h == 1 makes y1 == y2)

uint32_t lv_area_get_size(const lv_area_t *area_p)

Return with area of an area (x * y)

Parameters:

area_p – pointer to an area

Returns:

size of area

void lv_area_increase(lv_area_t *area, int32_t w_extra, int32_t h_extra)
void lv_area_move(lv_area_t *area, int32_t x_ofs, int32_t y_ofs)
void lv_area_align(const lv_area_t *base, lv_area_t *to_align, lv_align_t align, int32_t ofs_x, int32_t ofs_y)

Align an area to another

Parameters:
  • base – an area where the other will be aligned

  • to_align – the area to align

  • alignLV_ALIGN_...

  • ofs_x – X offset

  • ofs_y – Y offset

void lv_point_transform(lv_point_t *point, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t *pivot, bool zoom_first)

Transform a point

Parameters:
  • point – pointer to a point

  • angle – angle with 0.1 resolutions (123 means 12.3°)

  • scale_x – horizontal zoom, 256 means 100%

  • scale_y – vertical zoom, 256 means 100%

  • pivot – pointer to the pivot point of the transformation

  • zoom_first – true: zoom first and rotate after that; else: opposite order

void lv_point_array_transform(lv_point_t *points, size_t count, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t *pivot, bool zoom_first)

Transform an array of points

Parameters:
  • points – pointer to an array of points

  • count – number of points in the array

  • angle – angle with 0.1 resolutions (123 means 12.3°)

  • scale_x – horizontal zoom, 256 means 100%

  • scale_y – vertical zoom, 256 means 100%

  • pivot – pointer to the pivot point of the transformation

  • zoom_first – true: zoom first and rotate after that; else: opposite order

lv_point_t lv_point_from_precise(const lv_point_precise_t *p)
lv_point_precise_t lv_point_to_precise(const lv_point_t *p)
void lv_point_set(lv_point_t *p, int32_t x, int32_t y)
void lv_point_precise_set(lv_point_precise_t *p, lv_value_precise_t x, lv_value_precise_t y)
void lv_point_swap(lv_point_t *p1, lv_point_t *p2)
void lv_point_precise_swap(lv_point_precise_t *p1, lv_point_precise_t *p2)
int32_t lv_pct(int32_t x)

Convert a percentage value to int32_t. Percentage values are stored in special range

Parameters:

x – the percentage (0..1000)

Returns:

a coordinate that stores the percentage

int32_t lv_pct_to_px(int32_t v, int32_t base)
struct lv_point_t
#include <lv_area.h>

Represents a point on the screen.

Public Members

int32_t x
int32_t y
struct lv_point_precise_t
struct lv_area_t
#include <lv_area.h>

Represents an area of the screen.

Public Members

int32_t x1
int32_t y1
int32_t x2
int32_t y2