• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (C) 2022-2023 Huawei Device Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15
16import { AsyncCallback } from './@ohos.base';
17
18/**
19 * Color space manager.
20 *
21 * @namespace colorSpaceManager
22 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
23 * @since 9
24 */
25declare namespace colorSpaceManager {
26  /**
27   * Enumerates color space types.
28   * @enum { number } ColorSpace
29   * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
30   * @since 9
31   */
32  enum ColorSpace {
33    /**
34     * Indicates an unknown color space.
35     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
36     * @since 9
37     */
38    UNKNOWN = 0,
39
40    /**
41     * Indicates the color space based on Adobe RGB (1998).
42     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
43     * @since 9
44     */
45    ADOBE_RGB_1998 = 1,
46
47    /**
48     * Indicates the color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999.
49     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
50     * @since 9
51     */
52    DCI_P3 = 2,
53
54    /**
55     * Indicates the color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999.
56     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
57     * @since 9
58     */
59    DISPLAY_P3 = 3,
60
61    /**
62     * Indicates the standard red green blue (SRGB) color space based on IEC 61966-2.1:1999.
63     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
64     * @since 9
65     */
66    SRGB = 4,
67
68    /**
69     * Indicates a customized color space.
70     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
71     * @since 9
72     */
73    CUSTOM = 5,
74  }
75
76  /**
77   * Describes the primary colors red, green, blue and white point coordinated as (x, y)
78   * in color space, in terms of real world chromaticities.
79   * @typedef ColorSpacePrimaries
80   * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
81   * @since 9
82   */
83  interface ColorSpacePrimaries {
84    /**
85     * Coordinate value x of red color
86     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
87     * @since 9
88     */
89    redX: number;
90
91    /**
92     * Coordinate value y of red color
93     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
94     * @since 9
95     */
96    redY: number;
97
98    /**
99     * Coordinate value x of green color
100     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
101     * @since 9
102     */
103    greenX: number;
104
105    /**
106     * Coordinate value y of green color
107     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
108     * @since 9
109     */
110    greenY: number;
111
112    /**
113     * Coordinate value x of blue color
114     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
115     * @since 9
116     */
117    blueX: number;
118
119    /**
120     * Coordinate value y of blue color
121     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
122     * @since 9
123     */
124    blueY: number;
125
126    /**
127     * Coordinate value x of white point
128     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
129     * @since 9
130     */
131    whitePointX: number;
132
133    /**
134     * Coordinate value y of white point
135     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
136     * @since 9
137     */
138    whitePointY: number;
139  }
140
141  /**
142   * Defines a color space object and manages its key information
143   * @interface ColorSpaceManager
144   * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
145   * @since 9
146   */
147  interface ColorSpaceManager {
148    /**
149     * Get the name of color space type.
150     * @returns { ColorSpace } Returns the name of color space type.
151     * @throws { BusinessError } 18600001 - Parameter value is abnormal.
152     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
153     * @since 9
154     */
155    getColorSpaceName(): ColorSpace;
156
157    /**
158     * Get white point(x, y) of color space.
159     * @returns { Array<number> } Returns the white point value of color space.
160     * @throws { BusinessError } 18600001 - Parameter value is abnormal.
161     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
162     * @since 9
163     */
164    getWhitePoint(): Array<number>;
165
166    /**
167     * Get gamma value of color space.
168     * @returns { number } Returns the gamma value of color space.
169     * @throws { BusinessError } 18600001 - Parameter value is abnormal.
170     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
171     * @since 9
172     */
173    getGamma(): number;
174  }
175
176  /**
177   * Create a color space manager by provided color space type.
178   * @param { ColorSpace } colorSpaceName - Indicates the type of color space
179   * @returns { ColorSpaceManager } Returns a color space manager object created by provided type.
180   * @throws { BusinessError } 401 - Parameter error.
181   * @throws { BusinessError } 18600001 - Parameter value is abnormal.
182   * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
183   * @since 9
184   */
185  function create(colorSpaceName: ColorSpace): ColorSpaceManager;
186
187  /**
188   * Create a customized color space manager by its color primaries and gamma value
189   * @param { ColorSpacePrimaries } primaries - Indicates the customized color primaries
190   * @param { number } gamma - Indicates display gamma value
191   * @returns { ColorSpaceManager } Returns a color space manager object created by customized parameters.
192   * @throws { BusinessError } 401 - Parameter error.
193   * @throws { BusinessError } 18600001 - Parameter value is abnormal.
194   * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
195   * @since 9
196   */
197  function create(primaries: ColorSpacePrimaries, gamma: number): ColorSpaceManager;
198}
199
200export default colorSpaceManager;