harmony 鸿蒙drawing_rect.h

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

drawing_rect.h

Overview

The drawing_rect.h file declares the functions related to the rectangle in the drawing module.

File to include:

Library: libnative_drawing.so

Since: 11

Related module: Drawing

Summary

Functions

Name Description
OH_Drawing_Rect * OH_Drawing_RectCreate (float left, float top, float right, float bottom) Creates an OH_Drawing_Rect object, without sorting the coordinates passed in. This means that the coordinates of the upper left corner of the rectangle can be greater than those of the lower right corner.
float OH_Drawing_RectGetHeight (OH_Drawing_Rect *) Obtains the height of a rectangle. The height is calculated by using the Y coordinate of the lower right corner of the rectangle minus the Y coordinate of the upper left corner.
float OH_Drawing_RectGetWidth (OH_Drawing_Rect *) Obtains the width of a rectangle. The width is calculated by using the X coordinate of the lower right corner of the rectangle minus the X coordinate of the upper left corner.
float OH_Drawing_RectGetLeft (OH_Drawing_Rect *) Obtains the X coordinate of the upper left corner of a rectangle.
float OH_Drawing_RectGetTop (OH_Drawing_Rect *) Obtains the Y coordinate of the upper left corner of a rectangle.
float OH_Drawing_RectGetRight (OH_Drawing_Rect *) Obtains the X coordinate of the lower right corner of a rectangle.
float OH_Drawing_RectGetBottom (OH_Drawing_Rect *) Obtains the Y coordinate of the lower right corner of a rectangle.
bool OH_Drawing_RectIntersect (OH_Drawing_Rect *rect, const OH_Drawing_Rect *other) Checks whether two rectangles intersect and if yes, sets rect to the area of intersection.
bool OH_Drawing_RectJoin (OH_Drawing_Rect *rect, const OH_Drawing_Rect *other) Obtains the union of two rectangles.
void OH_Drawing_RectSetLeft (OH_Drawing_Rect *rect, float left) Sets the X coordinate of the upper left corner of a rectangle.
void OH_Drawing_RectSetTop (OH_Drawing_Rect *rect, float top) Sets the Y coordinate of the upper left corner of a rectangle.
void OH_Drawing_RectSetRight (OH_Drawing_Rect *rect, float right) Sets the X coordinate of the lower right corner of a rectangle.
void OH_Drawing_RectSetBottom (OH_Drawing_Rect *rect, float bottom) Sets the Y coordinate of the lower right corner of a rectangle.
void OH_Drawing_RectCopy (OH_Drawing_Rect *sRect, OH_Drawing_Rect *dRect) Copies a source rectangle to create a new one.
void OH_Drawing_RectDestroy (OH_Drawing_Rect *) Destroys an OH_Drawing_Rect object and reclaims the memory occupied by the object.
OH_Drawing_Array * OH_Drawing_RectCreateArray (size_t size) Creates a rectangle array object to store multiple rectangle objects. When OH_Drawing_Array is no longer required, call OH_Drawing_RectDestroyArray to release the pointer to the object.
OH_Drawing_ErrorCode OH_Drawing_RectGetArraySize (OH_Drawing_Array *rectArray, size_t *pSize) Obtains the size of a rectangle array, which is an OH_Drawing_Array object.
OH_Drawing_ErrorCode OH_Drawing_RectGetArrayElement (OH_Drawing_Array *rectArray, size_t index, OH_Drawing_Rect **rect) Obtains the rectangle with the specified index in a rectangle array.
OH_Drawing_ErrorCode OH_Drawing_RectDestroyArray (OH_Drawing_Array *rectArray) Destroys an OH_Drawing_Array 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  赞