• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 # @ohos.graphics.common2D (Common Data Types of 2D Graphics)
2 
3 The common2D module defines some common data types in the 2D graphics field.
4 
5 > **NOTE**
6 >
7 > 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.
8 
9 ## Modules to Import
10 
11 ```ts
12 import common2D from '@ohos.graphics.common2D';
13 ```
14 
15 ## Color
16 
17 Describes a color in ARGB format.
18 
19 **System capability**: SystemCapability.Graphics.Drawing
20 
21 | Name | Type  | Readable| Writable| Description                                    |
22 | ----- | ------ | ---- | ---- | ---------------------------------------- |
23 | alpha | number | Yes  | Yes  | Alpha component of the color. The value is an integer ranging from 0 to 255.|
24 | red   | number | Yes  | Yes  | Red component of the color. The value is an integer ranging from 0 to 255.|
25 | green | number | Yes  | Yes  | Green component of the color. The value is an integer ranging from 0 to 255.|
26 | blue  | number | Yes  | Yes  | Blue component of the color. The value is an integer ranging from 0 to 255.|
27 
28 ## Rect
29 
30 Describes a rectangle, which can be defined by two coordinate points: upper left corner point and lower right corner point.
31 
32 **System capability**: SystemCapability.Graphics.Drawing
33 
34 | Name  | Type  | Readable| Writable| Description                          |
35 | ------ | ------ | ---- | ---- | ------------------------------ |
36 | left   | number | Yes  | Yes  | X coordinate of the upper left corner of the rectangle. The value is a floating point number.|
37 | top    | number | Yes  | Yes  | Y coordinate of the upper left corner of the rectangle. The value is a floating point number.|
38 | right  | number | Yes  | Yes  | X coordinate of the lower right corner of the rectangle. The value is a floating point number.|
39 | bottom | number | Yes  | Yes  | Y coordinate of the lower right corner of the rectangle. The value is a floating point number.|
40