1/* 2 * Copyright (c) 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 16/** 17 * @file 18 * @kit ArkGraphics2D 19 */ 20/** 21 * The date structure that provides the basis for graphics. 22 * 23 * @namespace common2D 24 * @syscap SystemCapability.Graphics.Drawing 25 * @since 11 26 */ 27/** 28 * The date structure that provides the basis for graphics. 29 * 30 * @namespace common2D 31 * @syscap SystemCapability.Graphics.Drawing 32 * @crossplatform 33 * @since 20 34 * @arkts 1.1&1.2 35 */ 36declare namespace common2D { 37 /** 38 * Describes a color in ARGB format. 39 * @typedef Color 40 * @syscap SystemCapability.Graphics.Drawing 41 * @since 11 42 */ 43 /** 44 * Describes a color in ARGB format. 45 * @typedef Color 46 * @syscap SystemCapability.Graphics.Drawing 47 * @crossplatform 48 * @since 20 49 * @arkts 1.1&1.2 50 */ 51 interface Color { 52 /** 53 * Alpha component of the color. The value is an integer ranging from 0 to 255. 54 * @type { number } 55 * @syscap SystemCapability.Graphics.Drawing 56 * @since 11 57 */ 58 /** 59 * Alpha component of the color. The value is an integer ranging from 0 to 255. 60 * @type { number } 61 * @syscap SystemCapability.Graphics.Drawing 62 * @crossplatform 63 * @since 20 64 * @arkts 1.1&1.2 65 */ 66 alpha: number; 67 /** 68 * Red component of the color. The value is an integer ranging from 0 to 255. 69 * @type { number } 70 * @syscap SystemCapability.Graphics.Drawing 71 * @since 11 72 */ 73 /** 74 * Red component of the color. The value is an integer ranging from 0 to 255. 75 * @type { number } 76 * @syscap SystemCapability.Graphics.Drawing 77 * @crossplatform 78 * @since 20 79 * @arkts 1.1&1.2 80 */ 81 red: number; 82 /** 83 * Green component of the color. The value is an integer ranging from 0 to 255. 84 * @type { number } 85 * @syscap SystemCapability.Graphics.Drawing 86 * @since 11 87 */ 88 /** 89 * Green component of the color. The value is an integer ranging from 0 to 255. 90 * @type { number } 91 * @syscap SystemCapability.Graphics.Drawing 92 * @crossplatform 93 * @since 20 94 * @arkts 1.1&1.2 95 */ 96 green: number; 97 /** 98 * Blue component of the color. The value is an integer ranging from 0 to 255. 99 * @type { number } 100 * @syscap SystemCapability.Graphics.Drawing 101 * @since 11 102 */ 103 /** 104 * Blue component of the color. The value is an integer ranging from 0 to 255. 105 * @type { number } 106 * @syscap SystemCapability.Graphics.Drawing 107 * @crossplatform 108 * @since 20 109 * @arkts 1.1&1.2 110 */ 111 blue: number; 112 } 113 114 /** 115 * Describes a rectangle, which can be defined by two coordinate points: upper left corner point and lower right corner point. 116 * @typedef Rect 117 * @syscap SystemCapability.Graphics.Drawing 118 * @since 11 119 */ 120 /** 121 * Describes a rectangle, which can be defined by two coordinate points: upper left corner point and lower right corner point. 122 * @typedef Rect 123 * @syscap SystemCapability.Graphics.Drawing 124 * @crossplatform 125 * @since 20 126 * @arkts 1.1&1.2 127 */ 128 interface Rect { 129 /** 130 * X coordinate of the upper left corner of the rectangle. The value is a floating point number. 131 * @type { number } 132 * @syscap SystemCapability.Graphics.Drawing 133 * @since 11 134 */ 135 /** 136 * X coordinate of the upper left corner of the rectangle. The value is a floating point number. 137 * @type { number } 138 * @syscap SystemCapability.Graphics.Drawing 139 * @crossplatform 140 * @since 20 141 * @arkts 1.1&1.2 142 */ 143 left: number; 144 /** 145 * Y coordinate of the upper left corner of the rectangle. The value is a floating point number. 146 * @type { number } 147 * @syscap SystemCapability.Graphics.Drawing 148 * @since 11 149 */ 150 /** 151 * Y coordinate of the upper left corner of the rectangle. The value is a floating point number. 152 * @type { number } 153 * @syscap SystemCapability.Graphics.Drawing 154 * @crossplatform 155 * @since 20 156 * @arkts 1.1&1.2 157 */ 158 top: number; 159 /** 160 * X coordinate of the lower right corner of the rectangle. The value is a floating point number. 161 * @type { number } 162 * @syscap SystemCapability.Graphics.Drawing 163 * @since 11 164 */ 165 /** 166 * X coordinate of the lower right corner of the rectangle. The value is a floating point number. 167 * @type { number } 168 * @syscap SystemCapability.Graphics.Drawing 169 * @crossplatform 170 * @since 20 171 * @arkts 1.1&1.2 172 */ 173 right: number; 174 /** 175 * Y coordinate of the lower right corner of the rectangle. The value is a floating point number. 176 * @type { number } 177 * @syscap SystemCapability.Graphics.Drawing 178 * @since 11 179 */ 180 /** 181 * Y coordinate of the lower right corner of the rectangle. The value is a floating point number. 182 * @type { number } 183 * @syscap SystemCapability.Graphics.Drawing 184 * @crossplatform 185 * @since 20 186 * @arkts 1.1&1.2 187 */ 188 bottom: number; 189 } 190 191 /** 192 * Describes a coordinate point. 193 * @typedef Point 194 * @syscap SystemCapability.Graphics.Drawing 195 * @since 12 196 */ 197 /** 198 * Describes a coordinate point. 199 * @typedef Point 200 * @syscap SystemCapability.Graphics.Drawing 201 * @crossplatform 202 * @since 20 203 * @arkts 1.1&1.2 204 */ 205 interface Point { 206 /** 207 * Horizontal coordinate. The value is a floating point number. 208 * @type { number } 209 * @syscap SystemCapability.Graphics.Drawing 210 * @since 12 211 */ 212 /** 213 * Horizontal coordinate. The value is a floating point number. 214 * @type { number } 215 * @syscap SystemCapability.Graphics.Drawing 216 * @crossplatform 217 * @since 20 218 * @arkts 1.1&1.2 219 */ 220 x: number; 221 222 /** 223 * Vertical coordinate. The value is a floating point number. 224 * @type { number } 225 * @syscap SystemCapability.Graphics.Drawing 226 * @since 12 227 */ 228 /** 229 * Vertical coordinate. The value is a floating point number. 230 * @type { number } 231 * @syscap SystemCapability.Graphics.Drawing 232 * @crossplatform 233 * @since 20 234 * @arkts 1.1&1.2 235 */ 236 y: number; 237 } 238 239 /** 240 * Describes a 3D coordinate point. 241 * 242 * @typedef Point3d 243 * @extends Point 244 * @syscap SystemCapability.Graphics.Drawing 245 * @since 12 246 */ 247 /** 248 * Describes a 3D coordinate point. 249 * 250 * @typedef Point3d 251 * @extends Point 252 * @syscap SystemCapability.Graphics.Drawing 253 * @crossplatform 254 * @since 20 255 */ 256 interface Point3d extends Point { 257 /** 258 * Z-axis coordinate. The value is a floating point number. 259 * @type { number } 260 * @syscap SystemCapability.Graphics.Drawing 261 * @since 12 262 */ 263 /** 264 * Z-axis coordinate. The value is a floating point number. 265 * @type { number } 266 * @syscap SystemCapability.Graphics.Drawing 267 * @crossplatform 268 * @since 20 269 */ 270 z: number; 271 } 272 273 /** 274 * Provide a color with an ARGB structure described by floating point numbers. 275 * @typedef Color4f 276 * @syscap SystemCapability.Graphics.Drawing 277 * @crossplatform 278 * @since 20 279 * @arkts 1.1&1.2 280 */ 281 interface Color4f { 282 /** 283 * Alpha component of color, represented as a floating point number between 0 and 1. 284 * @type { number } 285 * @syscap SystemCapability.Graphics.Drawing 286 * @crossplatform 287 * @since 20 288 * @arkts 1.1&1.2 289 */ 290 alpha: number; 291 /** 292 * Red component of color, represented as a floating point number between 0 and 1. 293 * @type { number } 294 * @syscap SystemCapability.Graphics.Drawing 295 * @crossplatform 296 * @since 20 297 * @arkts 1.1&1.2 298 */ 299 red: number; 300 /** 301 * Green component of color, represented as a floating point number between 0 and 1. 302 * @type { number } 303 * @syscap SystemCapability.Graphics.Drawing 304 * @crossplatform 305 * @since 20 306 * @arkts 1.1&1.2 307 */ 308 green: number; 309 /** 310 * Blue component of color, represented as a floating point number between 0 and 1. 311 * @type { number } 312 * @syscap SystemCapability.Graphics.Drawing 313 * @crossplatform 314 * @since 20 315 * @arkts 1.1&1.2 316 */ 317 blue: number; 318 } 319} 320 321export default common2D;