1# @ohos.graphics.sendableColorSpaceManager (Sendable Color Space Management)
2
3The **sendableColorSpaceManager** module provides APIs for creating and managing sendable color space objects and obtaining basic attributes of sendable color spaces.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9## Modules to Import
10
11```ts
12import { sendableColorSpaceManager } from '@kit.ArkGraphics2D';
13```
14
15## ISendable
16type ISendable = lang.ISendable
17
18**ISendable** is the parent type of all sendable types except null and undefined. It does not have any necessary methods or properties.
19
20**System capability**: SystemCapability.Utils.Lang
21
22| Type               | Description                    |
23| ------------------ | ------------------------ |
24| [lang.ISendable](../apis-arkts/js-apis-arkts-lang.md#langisendable)  | Parent type of all sendable types.              |
25
26## sendableColorSpaceManager.create
27
28create(colorSpaceName: colorSpaceManager.ColorSpace): ColorSpaceManager
29
30Creates a standard color space object that is sendable.
31
32**System capability**: SystemCapability.Graphic.Graphic2D.ColorManager.Core
33
34**Parameters**
35
36| Name          | Type                    | Mandatory| Description                         |
37| --------------- | ------------------------ | ---- | -----------------------------|
38| colorSpaceName  | [colorSpaceManager.ColorSpace](js-apis-colorSpaceManager.md#colorspace)| Yes  | Type of the color space.<br>**UNKNOWN** and **CUSTOM** cannot be used when creating standard color space objects.      |
39
40**Return value**
41
42| Type               | Description                    |
43| ------------------ | ------------------------ |
44| [ColorSpaceManager](#colorspacemanager)  | Sendable color space object created.<br>This instance inherits from **ISendable** and can be passed by reference between concurrent ArkTS instances (including the main thread and the worker threads of TaskPool or Worker). For details, see [Using Sendable Objects](../../arkts-utils/sendable-guide.md).                |
45
46**Error codes**
47
48For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [colorSpaceManager Error Codes](errorcode-colorspace-manager.md).
49
50| ID| Error Message|
51| ------- | ----------------------- |
52| 401 | Parameter error. Possible cause: 1.Incorrect parameter type. 2.Parameter verification failed.|
53| 18600001 | The parameter value is abnormal. |
54
55**Example**
56
57```ts
58import { colorSpaceManager } from '@kit.ArkGraphics2D';
59let colorSpace: sendableColorSpaceManager.ColorSpaceManager;
60colorSpace = sendableColorSpaceManager.create(colorSpaceManager.ColorSpace.SRGB);
61```
62
63## sendableColorSpaceManager.create
64
65create(primaries: colorSpaceManager.ColorSpacePrimaries, gamma: number): ColorSpaceManager
66
67Creates a custom color space object that is sendable.
68
69**System capability**: SystemCapability.Graphic.Graphic2D.ColorManager.Core
70
71**Parameters**
72
73| Name          | Type                                      | Mandatory| Description                         |
74| --------------- | ------------------------------------------ | ---- | -----------------------------|
75| primaries       | [colorSpaceManager.ColorSpacePrimaries](js-apis-colorSpaceManager.md#colorspaceprimaries)| Yes  | Primaries of the color space.              |
76| gamma           | number                                     | Yes  | Gamma of the color space.                |
77
78**Return value**
79
80| Type               | Description                    |
81| ------------------ | ------------------------ |
82| [ColorSpaceManager](#colorspacemanager)  | Sendable color space object created.<br>The color space type is **CUSTOM**, which is one of the enumerated values of [colorSpaceManager.ColorSpace](js-apis-colorSpaceManager.md#colorspace).<br>This instance inherits from **ISendable** and can be passed by reference between concurrent ArkTS instances (including the main thread and the worker threads of TaskPool or Worker). For details, see [Using Sendable Objects](../../arkts-utils/sendable-guide.md).|
83
84**Error codes**
85
86For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [colorSpaceManager Error Codes](errorcode-colorspace-manager.md).
87
88| ID| Error Message|
89| ------- | ----------------------- |
90| 401 | Parameter error. Possible cause: 1.Incorrect parameter type. 2.Parameter verification failed.|
91| 18600001 | The parameter value is abnormal. |
92
93**Example**
94
95```ts
96import { colorSpaceManager } from '@kit.ArkGraphics2D';
97let colorSpace: sendableColorSpaceManager.ColorSpaceManager;
98let primaries: colorSpaceManager.ColorSpacePrimaries = {
99  redX: 0.1,
100  redY: 0.1,
101  greenX: 0.2,
102  greenY: 0.2,
103  blueX: 0.3,
104  blueY: 0.3,
105  whitePointX: 0.4,
106  whitePointY: 0.4
107};
108let gamma: number = 2.2;
109colorSpace = sendableColorSpaceManager.create(primaries, gamma);
110```
111
112## ColorSpaceManager
113
114Implements management of color space objects.
115
116Before calling any of the following APIs, you must use [create()](#sendablecolorspacemanagercreate) to create a color space manager.
117
118### getColorSpaceName
119
120getColorSpaceName(): colorSpaceManager.ColorSpace
121
122Obtains the color space type.
123
124**System capability**: SystemCapability.Graphic.Graphic2D.ColorManager.Core
125
126**Return value**
127
128| Type               | Description                    |
129| ------------------ | ------------------------ |
130| [colorSpaceManager.ColorSpace](js-apis-colorSpaceManager.md#colorspace)  | Color space type.|
131
132**Error codes**
133
134For details about the error codes, see [colorSpaceManager Error Codes](errorcode-colorspace-manager.md).
135
136| ID| Error Message|
137| ------- | ----------------------- |
138| 18600001 | The parameter value is abnormal. |
139
140**Example**
141
142```ts
143let spaceName: colorSpaceManager.ColorSpace = colorSpace.getColorSpaceName();
144```
145
146### getWhitePoint
147
148getWhitePoint(): collections.Array\<number\>
149
150Obtains the coordinates of the white point in the color space.
151
152**System capability**: SystemCapability.Graphic.Graphic2D.ColorManager.Core
153
154**Return value**
155
156| Type               | Description                    |
157| ------------------ | ------------------------ |
158| [collections.Array\<number\>](../apis-arkts/js-apis-arkts-collections.md#collectionsarray)  | Coordinates [x, y] of the white point.|
159
160**Error codes**
161
162For details about the error codes, see [colorSpaceManager Error Codes](errorcode-colorspace-manager.md).
163
164| ID| Error Message|
165| ------- | ----------------------- |
166| 18600001 | The parameter value is abnormal. |
167
168**Example**
169
170```ts
171import { collections } from '@kit.ArkTS';
172let point: collections.Array<number> = colorSpace.getWhitePoint();
173```
174
175### getGamma
176
177getGamma(): number
178
179Obtains the gamma of the color space.
180
181**System capability**: SystemCapability.Graphic.Graphic2D.ColorManager.Core
182
183**Return value**
184
185| Type               | Description                    |
186| ------------------ | ------------------------ |
187| number  | Gamma of the color space.|
188
189**Error codes**
190
191For details about the error codes, see [colorSpaceManager Error Codes](errorcode-colorspace-manager.md).
192
193| ID| Error Message|
194| ------- | ----------------------- |
195| 18600001 | The parameter value is abnormal. |
196
197**Example**
198
199```ts
200let gamma: number = colorSpace.getGamma();
201```
202