harmony 鸿蒙drawing_matrix.h

  • 2025-06-12
  • 浏览 (3)

drawing_matrix.h

Overview

The drawing_matrix.h file declares the functions related to the matrix in the drawing module.

File to include: <native_drawing/drawing_matrix.h>

Library: libnative_drawing.so

Since: 11

Related module: Drawing

Summary

Types

Name Description
typedef enum OH_Drawing_ScaleToFit OH_Drawing_ScaleToFit Defines an enum for the matrix scaling modes.

Enums

Name Description
OH_Drawing_ScaleToFit { SCALE_TO_FIT_FILL, SCALE_TO_FIT_START, SCALE_TO_FIT_CENTER, SCALE_TO_FIT_END } Enumerates the matrix scaling modes.

Functions

Name Description
OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll (OH_Drawing_Matrix *matrix, float value[9]) Obtains all element values of a matrix.
OH_Drawing_Matrix * OH_Drawing_MatrixCreate (void) Creates an OH_Drawing_Matrix object.
OH_Drawing_Matrix * OH_Drawing_MatrixCreateRotation (float deg, float x, float y) Creates an OH_Drawing_Matrix with the rotation attribute. The matrix is obtained by rotating an identity matrix by a given degree around the rotation point (x, y).
OH_Drawing_Matrix * OH_Drawing_MatrixCreateScale (float sx, float sy, float px, float py) Creates an OH_Drawing_Matrix with the scale attribute. The matrix is obtained by scaling an identity matrix with the factor (sx, sy) at the rotation point (px, py).
OH_Drawing_Matrix * OH_Drawing_MatrixCreateTranslation (float dx, float dy) Creates an OH_Drawing_Matrix with the translation attribute. The matrix is obtained by translating the identity matrix by the distance (dx, dy).
void OH_Drawing_MatrixSetMatrix (OH_Drawing_Matrix *, float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2) Sets matrix parameters for an OH_Drawing_Matrix object.
bool OH_Drawing_MatrixSetRectToRect (OH_Drawing_Matrix *, const OH_Drawing_Rect *src, const OH_Drawing_Rect *dst, OH_Drawing_ScaleToFit stf) Scales a matrix to map a source rectangle to a destination rectangle.
void OH_Drawing_MatrixPreRotate (OH_Drawing_Matrix *, float degree, float px, float py) Premultiplies a matrix by an identity matrix that rotates by a given degree around the rotation point (px, py).
void OH_Drawing_MatrixPreScale (OH_Drawing_Matrix *, float sx, float sy, float px, float py) Premultiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py).
void OH_Drawing_MatrixPreTranslate (OH_Drawing_Matrix *, float dx, float dy) Premultiplies a matrix by an identity matrix that translates by a given distance (dx, dy).
void OH_Drawing_MatrixPostRotate (OH_Drawing_Matrix *, float degree, float px, float py) Post multiplies a matrix by an identity matrix that rotates a given degree around the rotation point (px, py).
void OH_Drawing_MatrixPostScale (OH_Drawing_Matrix *, float sx, float sy, float px, float py) Post multiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py).
void OH_Drawing_MatrixPostTranslate (OH_Drawing_Matrix *, float dx, float dy) Post multiplies a matrix by an identity matrix that translates by a given distance (dx, dy).
void OH_Drawing_MatrixReset (OH_Drawing_Matrix *) Resets a matrix to an identity matrix.
void OH_Drawing_MatrixConcat (OH_Drawing_Matrix *total, const OH_Drawing_Matrix *a, const OH_Drawing_Matrix *b) Multiplies two matrices to produce a new matrix.
float OH_Drawing_MatrixGetValue (OH_Drawing_Matrix *, int index) Obtains a matrix value of a given index. The index ranges from 0 to 8.
void OH_Drawing_MatrixRotate (OH_Drawing_Matrix *, float degree, float px, float py) Sets a matrix as an identity matrix and rotates it by a given degree around the rotation point (px, py).
void OH_Drawing_MatrixTranslate (OH_Drawing_Matrix *, float dx, float dy) Sets a matrix as an identity matrix and translates it by a given distance (dx, dy).
void OH_Drawing_MatrixScale (OH_Drawing_Matrix *, float sx, float sy, float px, float py) Sets a matrix as an identity matrix and scales it with the factor (sx, sy) at the rotation point (px, py).
bool OH_Drawing_MatrixInvert (OH_Drawing_Matrix *, OH_Drawing_Matrix *inverse) Inverts a matrix and returns the result.
bool OH_Drawing_MatrixSetPolyToPoly (OH_Drawing_Matrix *, const OH_Drawing_Point2D *src, const OH_Drawing_Point2D *dst, uint32_t count) Generates a transform matrix by setting source points and destination points. Both the number of source points and that of destination points must be in the range [0, 4].
void OH_Drawing_MatrixMapPoints (const OH_Drawing_Matrix *, const OH_Drawing_Point2D *src, OH_Drawing_Point2D *dst, int count) Maps a source point array to a destination point array by means of matrix transformation.
bool OH_Drawing_MatrixMapRect (const OH_Drawing_Matrix *, const OH_Drawing_Rect *src, OH_Drawing_Rect *dst) Maps a rectangle to the smallest rectangle that can enclose the vertices to which the four source vertices are mapped by means of matrix transformation.
bool OH_Drawing_MatrixIsEqual (OH_Drawing_Matrix *, OH_Drawing_Matrix *other) Checks whether two OH_Drawing_Matrix objects are equal.
bool OH_Drawing_MatrixIsIdentity (OH_Drawing_Matrix *) Checks whether an OH_Drawing_Matrix object is an identity matrix.
void OH_Drawing_MatrixDestroy (OH_Drawing_Matrix *) Destroys an OH_Drawing_Matrix object and reclaims the memory occupied by the object.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkGraphics 2D

harmony 鸿蒙BufferHandle

harmony 鸿蒙ColorSpacePrimaries

harmony 鸿蒙DisplaySoloist_ExpectedRateRange

harmony 鸿蒙_drawing

harmony 鸿蒙NativeColorSpaceManager

harmony 鸿蒙NativeDisplaySoloist

harmony 鸿蒙NativeVsync

harmony 鸿蒙NativeWindow

harmony 鸿蒙OH_Drawing_BitmapFormat

0  赞