• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (C) 2022 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 * colorSpaceManager
20 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
21 */
22declare namespace colorSpaceManager {
23  /**
24   * Enumerates color space types.
25   * @since 9
26   * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
27   */
28  enum ColorSpace {
29    /**
30     * Indicates an unknown color space.
31     * @since 9
32     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
33     */
34    UNKNOWN = 0,
35
36    /**
37     * Indicates the color space based on Adobe RGB (1998).
38     * @since 9
39     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
40     */
41    ADOBE_RGB_1998 = 1,
42
43    /**
44     * Indicates the color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999.
45     * @since 9
46     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
47     */
48    DCI_P3 = 2,
49
50    /**
51     * Indicates the color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999.
52     * @since 9
53     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
54     */
55    DISPLAY_P3 = 3,
56
57    /**
58     * Indicates the standard red green blue (SRGB) color space based on IEC 61966-2.1:1999.
59     * @since 9
60     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
61     */
62    SRGB = 4,
63
64    /**
65     * Indicates a customized color space.
66     * @since 9
67     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
68     */
69    CUSTOM = 5,
70  }
71
72  /**
73   * Describes the primary colors red, green, blue and white point coordinated as (x, y)
74   * in color space, in terms of real world chromaticities.
75   * @since 9
76   * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
77   */
78  interface ColorSpacePrimaries {
79    /**
80     * Coordinate value x of red color
81     * @since 9
82     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
83     */
84    redX: number;
85
86    /**
87     * Coordinate value y of red color
88     * @since 9
89     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
90     */
91    redY: number;
92
93    /**
94     * Coordinate value x of green color
95     * @since 9
96     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
97     */
98    greenX: number;
99
100    /**
101     * Coordinate value y of green color
102     * @since 9
103     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
104     */
105    greenY: number;
106
107    /**
108     * Coordinate value x of blue color
109     * @since 9
110     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
111     */
112    blueX: number;
113
114    /**
115     * Coordinate value y of blue color
116     * @since 9
117     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
118     */
119    blueY: number;
120
121    /**
122     * Coordinate value x of white point
123     * @since 9
124     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
125     */
126    whitePointX: number;
127
128    /**
129     * Coordinate value y of white point
130     * @since 9
131     * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
132     */
133    whitePointY: number;
134  }
135
136  /**
137   * Defines a color space object and manages its key information
138   * @since 9
139   * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
140   */
141  interface ColorSpaceManager {
142    /**
143     * Get the name of color space type.
144     * @since 9
145     * @throws {BusinessError} 18600001 - If param value is abnormal
146     */
147    getColorSpaceName(): ColorSpace;
148
149    /**
150     * Get white point(x, y) of color space.
151     * @since 9
152     * @throws {BusinessError} 18600001 - If param value is abnormal
153     */
154    getWhitePoint(): Array<number>;
155
156    /**
157     * Get gamma value of color space.
158     * @since 9
159     * @throws {BusinessError} 18600001 - If param value is abnormal
160     */
161    getGamma(): number;
162  }
163
164  /**
165   * Create a color space manager by provided color space type.
166   * @param colorSpaceName Indicates the type of color space
167   * @since 9
168   * @throws {BusinessError} 401 - If param is invalid
169   * @throws {BusinessError} 18600001 - If param value is abnormal
170   */
171  function create(colorSpaceName: ColorSpace): ColorSpaceManager;
172
173  /**
174   * Create a customized color space manager by its color primaries and gamma value
175   * @param primaries Indicates the customized color primaries
176   * @param gamma Indicates display gamma value
177   * @since 9
178   * @throws {BusinessError} 401 - If param is invalid
179   * @throws {BusinessError} 18600001 - If param value is abnormal
180   */
181  function create(primaries: ColorSpacePrimaries, gamma: number): ColorSpaceManager;
182}
183
184export default colorSpaceManager;