openharmony 鸿蒙 js-apis-graphics-common2D

2025-06-12 浏览 (1)

@ohos.graphics.common2D (Common Data Types of 2D Graphics)

The common2D module defines some common data types in the 2D graphics field.

NOTE

The initial APIs of this module are supported since API version 11. Newly added APIs will be marked with a superscript to indicate their earliest API version.

Modules to Import

import { common2D } from '@kit.ArkGraphics2D';

Color

Describes a color in ARGB format.

System capability: SystemCapability.Graphics.Drawing

NameTypeReadableWritableDescription
alphanumberYesYesAlpha component of the color. The value is an integer ranging from 0 to 255.
rednumberYesYesRed component of the color. The value is an integer ranging from 0 to 255.
greennumberYesYesGreen component of the color. The value is an integer ranging from 0 to 255.
bluenumberYesYesBlue component of the color. The value is an integer ranging from 0 to 255.

Rect

Describes a rectangle, which can be defined by two coordinate points: upper left corner point and lower right corner point.

System capability: SystemCapability.Graphics.Drawing

NameTypeReadableWritableDescription
leftnumberYesYesX coordinate of the upper left corner of the rectangle. The value is a floating point number.
topnumberYesYesY coordinate of the upper left corner of the rectangle. The value is a floating point number.
rightnumberYesYesX coordinate of the lower right corner of the rectangle. The value is a floating point number.
bottomnumberYesYesY coordinate of the lower right corner of the rectangle. The value is a floating point number.

Point12+

Describes a coordinate point.

System capability: SystemCapability.Graphics.Drawing

NameTypeReadableWritableDescription
xnumberYesYesHorizontal coordinate. The value is a floating point number.
ynumberYesYesVertical coordinate. The value is a floating point number.

Point3d12+

Describes a 3D coordinate point. It inherits from Point.

System capability: SystemCapability.Graphics.Drawing

NameTypeReadableWritableDescription
znumberYesYesZ-axis coordinate. The value is a floating point number.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkGraphics 2D

harmony 鸿蒙BufferHandle

harmony 鸿蒙ColorSpacePrimaries

harmony 鸿蒙DisplaySoloist_ExpectedRateRange

harmony 鸿蒙_drawing

harmony 鸿蒙NativeColorSpaceManager

harmony 鸿蒙NativeDisplaySoloist

harmony 鸿蒙NativeVsync

harmony 鸿蒙NativeWindow

harmony 鸿蒙OH_Drawing_BitmapFormat

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/f32NZL