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