lv_matrix.h

Functions

void lv_matrix_identity(lv_matrix_t *matrix)

Set matrix to identity matrix

Parameters:

matrix – pointer to a matrix

void lv_matrix_translate(lv_matrix_t *matrix, float tx, float ty)

Translate the matrix to new position

Parameters:
  • matrix – pointer to a matrix

  • tx – the amount of translate in x direction

  • tx – the amount of translate in y direction

void lv_matrix_scale(lv_matrix_t *matrix, float scale_x, float scale_y)

Change the scale factor of the matrix

Parameters:
  • matrix – pointer to a matrix

  • scale_x – the scale factor for the X direction

  • scale_y – the scale factor for the Y direction

void lv_matrix_rotate(lv_matrix_t *matrix, float degree)

Rotate the matrix with origin

Parameters:
  • matrix – pointer to a matrix

  • degree – angle to rotate

void lv_matrix_skew(lv_matrix_t *matrix, float skew_x, float skew_y)

Change the skew factor of the matrix

Parameters:
  • matrix – pointer to a matrix

  • skew_x – the skew factor for x direction

  • skew_y – the skew factor for y direction

void lv_matrix_multiply(lv_matrix_t *matrix, const lv_matrix_t *mul)

Multiply two matrix and store the result to the first one

Parameters:
  • matrix – pointer to a matrix

  • matrix2 – pointer to another matrix

bool lv_matrix_inverse(lv_matrix_t *matrix, const lv_matrix_t *m)

Invert the matrix

Parameters:
  • matrix – pointer to a matrix

  • m – pointer to another matrix (optional)

Returns:

true: the matrix is invertible, false: the matrix is singular and cannot be inverted

lv_point_precise_t lv_matrix_transform_precise_point(const lv_matrix_t *matrix, const lv_point_precise_t *point)

Transform a point by a matrix

Parameters:
  • matrix – pointer to a matrix

  • point – pointer to a point

Returns:

the transformed point

lv_area_t lv_matrix_transform_area(const lv_matrix_t *matrix, const lv_area_t *area)

Transform an area by a matrix

Parameters:
  • matrix – pointer to a matrix

  • area – pointer to an area

Returns:

the transformed area

bool lv_matrix_is_identity_or_translation(const lv_matrix_t *matrix)

Check if the matrix is identity or translation matrix

Parameters:

matrix – pointer to a matrix

Returns:

true: the matrix is identity or translation matrix, false: the matrix is not identity or translation matrix

struct _lv_matrix_t

Public Members

float m[3][3]