1/* 2 * Copyright (C) 2024 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 ArkUI 19 */ 20 21/*** if arkts 1.2 */ 22import { Position, ResourceColor, Length, SizeOptions } from './arkui/component/units' 23/*** endif */ 24 25/** 26 * Interface for shape size properties. 27 * 28 * @interface ShapeSize 29 * @syscap SystemCapability.ArkUI.ArkUI.Full 30 * @crossplatform 31 * @form 32 * @atomicservice 33 * @since arkts {'1.1':'12','1.2':'20'} 34 * @arkts 1.1&1.2 35 */ 36export interface ShapeSize { 37 /** 38 * Defines the width of Shape. 39 * @type { ? (number | string) } 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @form 42 * @atomicservice 43 * @since arkts {'1.1':'12','1.2':'20'} 44 * @arkts 1.1&1.2 45 */ 46 width?: number | string; 47 48 /** 49 * Defines the height of Shape. 50 * @type { ? (number | string) } 51 * @syscap SystemCapability.ArkUI.ArkUI.Full 52 * @form 53 * @atomicservice 54 * @since arkts {'1.1':'12','1.2':'20'} 55 * @arkts 1.1&1.2 56 */ 57 height?: number | string; 58} 59 60/** 61 * Interface for RectShape constructor parameters. 62 * 63 * @extends ShapeSize 64 * @interface RectShapeOptions 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @crossplatform 67 * @form 68 * @atomicservice 69 * @since arkts {'1.1':'12','1.2':'20'} 70 * @arkts 1.1&1.2 71 */ 72export interface RectShapeOptions extends ShapeSize { 73 /** 74 * Defines the corner radius of the RectShape. 75 * @type { ? (number | string | Array<number | string>) } 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @form 78 * @atomicservice 79 * @since arkts {'1.1':'12','1.2':'20'} 80 * @arkts 1.1&1.2 81 */ 82 radius?: number | string | Array<number | string>; 83} 84 85/** 86 * Interface for RectShape constructor parameters with separate radius values. 87 * 88 * @extends ShapeSize 89 * @interface RoundRectShapeOptions 90 * @syscap SystemCapability.ArkUI.ArkUI.Full 91 * @crossplatform 92 * @form 93 * @atomicservice 94 * @since arkts {'1.1':'12','1.2':'20'} 95 * @arkts 1.1&1.2 96 */ 97export interface RoundRectShapeOptions extends ShapeSize { 98 /** 99 * Defines the width of the corner radius for RectShape. 100 * @type { ? (number | string) } 101 * @syscap SystemCapability.ArkUI.ArkUI.Full 102 * @form 103 * @atomicservice 104 * @since arkts {'1.1':'12','1.2':'20'} 105 * @arkts 1.1&1.2 106 */ 107 radiusWidth?: number | string; 108 109 /** 110 * Defines the height of the corner radius for RectShape. 111 * @type { ? (number | string) } 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @form 114 * @atomicservice 115 * @since arkts {'1.1':'12','1.2':'20'} 116 * @arkts 1.1&1.2 117 */ 118 radiusHeight?: number | string; 119} 120 121/** 122 * Interface for PathShape constructor parameters. 123 * 124 * @interface PathShapeOptions 125 * @syscap SystemCapability.ArkUI.ArkUI.Full 126 * @crossplatform 127 * @form 128 * @atomicservice 129 * @since arkts {'1.1':'12','1.2':'20'} 130 * @arkts 1.1&1.2 131 */ 132export interface PathShapeOptions { 133 /** 134 * Defines the commands for drawing the PathShape. 135 * @type { ?string } 136 * @syscap SystemCapability.ArkUI.ArkUI.Full 137 * @form 138 * @atomicservice 139 * @since arkts {'1.1':'12','1.2':'20'} 140 * @arkts 1.1&1.2 141 */ 142 commands?: string; 143} 144 145/** 146 * Common shape method class 147 * 148 * @syscap SystemCapability.ArkUI.ArkUI.Full 149 * @crossplatform 150 * @form 151 * @atomicservice 152 * @since arkts {'1.1':'12','1.2':'20'} 153 * @arkts 1.1&1.2 154 */ 155declare class CommonShapeMethod<T> { 156 /** 157 * Sets coordinate offset relative to the layout completion position. 158 * 159 * @param { Position } offset 160 * @returns { T } 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @crossplatform 163 * @form 164 * @atomicservice 165 * @since arkts {'1.1':'12','1.2':'20'} 166 * @arkts 1.1&1.2 167 */ 168 offset(offset: Position): T; 169 170 /** 171 * Sets the fill color of the shape. 172 * 173 * @param { ResourceColor } color 174 * @returns { T } 175 * @syscap SystemCapability.ArkUI.ArkUI.Full 176 * @crossplatform 177 * @form 178 * @atomicservice 179 * @since arkts {'1.1':'12','1.2':'20'} 180 * @arkts 1.1&1.2 181 */ 182 fill(color: ResourceColor): T; 183 184 /** 185 * Sets the position of the shape. 186 * 187 * @param { Position } position 188 * @returns { T } 189 * @syscap SystemCapability.ArkUI.ArkUI.Full 190 * @crossplatform 191 * @form 192 * @atomicservice 193 * @since arkts {'1.1':'12','1.2':'20'} 194 * @arkts 1.1&1.2 195 */ 196 position(position: Position): T; 197} 198 199/** 200 * Base shape class 201 * 202 * @extends CommonShapeMethod<T> 203 * @syscap SystemCapability.ArkUI.ArkUI.Full 204 * @crossplatform 205 * @form 206 * @atomicservice 207 * @since arkts {'1.1':'12','1.2':'20'} 208 * @arkts 1.1&1.2 209 */ 210declare class BaseShape<T> extends CommonShapeMethod<T> { 211 /** 212 * Sets the width of the shape. 213 * 214 * @param { Length } width 215 * @returns { T } 216 * @syscap SystemCapability.ArkUI.ArkUI.Full 217 * @crossplatform 218 * @form 219 * @atomicservice 220 * @since arkts {'1.1':'12','1.2':'20'} 221 * @arkts 1.1&1.2 222 */ 223 width(width: Length): T; 224 225 /** 226 * Sets the height of the shape. 227 * 228 * @param { Length } height 229 * @returns { T } 230 * @syscap SystemCapability.ArkUI.ArkUI.Full 231 * @crossplatform 232 * @form 233 * @atomicservice 234 * @since arkts {'1.1':'12','1.2':'20'} 235 * @arkts 1.1&1.2 236 */ 237 height(height: Length): T; 238 239 /** 240 * Sets the size of the shape. 241 * 242 * @param { SizeOptions } size 243 * @returns { T } 244 * @syscap SystemCapability.ArkUI.ArkUI.Full 245 * @crossplatform 246 * @form 247 * @atomicservice 248 * @since arkts {'1.1':'12','1.2':'20'} 249 * @arkts 1.1&1.2 250 */ 251 size(size: SizeOptions): T; 252} 253 254/** 255 * Defines a rect drawing class. 256 * 257 * @extends BaseShape<RectShape> 258 * @syscap SystemCapability.ArkUI.ArkUI.Full 259 * @crossplatform 260 * @form 261 * @atomicservice 262 * @since arkts {'1.1':'12','1.2':'20'} 263 * @arkts 1.1&1.2 264 */ 265export declare class RectShape extends BaseShape<RectShape> { 266 /** 267 * Constructor. 268 * 269 * @param { RectShapeOptions | RoundRectShapeOptions } options 270 * @syscap SystemCapability.ArkUI.ArkUI.Full 271 * @crossplatform 272 * @form 273 * @atomicservice 274 * @since arkts {'1.1':'12','1.2':'20'} 275 * @arkts 1.1&1.2 276 */ 277 constructor(options?: RectShapeOptions | RoundRectShapeOptions); 278 279 /** 280 * Sets the width of the corner radius for RectShape. 281 * 282 * @param { number | string } rWidth 283 * @returns { RectShape } 284 * @syscap SystemCapability.ArkUI.ArkUI.Full 285 * @crossplatform 286 * @form 287 * @atomicservice 288 * @since arkts {'1.1':'12','1.2':'20'} 289 * @arkts 1.1&1.2 290 */ 291 radiusWidth(rWidth: number | string): RectShape; 292 293 /** 294 * Sets the height of the corner radius for RectShape. 295 * 296 * @param { number | string } rHeight 297 * @returns { RectShape } 298 * @syscap SystemCapability.ArkUI.ArkUI.Full 299 * @crossplatform 300 * @form 301 * @atomicservice 302 * @since arkts {'1.1':'12','1.2':'20'} 303 * @arkts 1.1&1.2 304 */ 305 radiusHeight(rHeight: number | string): RectShape; 306 307 /** 308 * Sets the corner radius for RectShape. 309 * 310 * @param { number | string | Array<number | string> } radius 311 * @returns { RectShape } 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @crossplatform 314 * @form 315 * @atomicservice 316 * @since arkts {'1.1':'12','1.2':'20'} 317 * @arkts 1.1&1.2 318 */ 319 radius(radius: number | string | Array<number | string>): RectShape; 320} 321 322/** 323 * Defines a circle drawing class. 324 * 325 * @extends BaseShape<CircleShape> 326 * @syscap SystemCapability.ArkUI.ArkUI.Full 327 * @crossplatform 328 * @form 329 * @atomicservice 330 * @since arkts {'1.1':'12','1.2':'20'} 331 * @arkts 1.1&1.2 332 */ 333export declare class CircleShape extends BaseShape<CircleShape> { 334 /** 335 * Constructor. 336 * 337 * @param { ShapeSize } options 338 * @syscap SystemCapability.ArkUI.ArkUI.Full 339 * @crossplatform 340 * @form 341 * @atomicservice 342 * @since arkts {'1.1':'12','1.2':'20'} 343 * @arkts 1.1&1.2 344 */ 345 constructor(options?: ShapeSize); 346} 347 348/** 349 * Defines an ellipse drawing class. 350 * 351 * @extends BaseShape<EllipseShape> 352 * @syscap SystemCapability.ArkUI.ArkUI.Full 353 * @crossplatform 354 * @form 355 * @atomicservice 356 * @since arkts {'1.1':'12','1.2':'20'} 357 * @arkts 1.1&1.2 358 */ 359export declare class EllipseShape extends BaseShape<EllipseShape> { 360 /** 361 * Constructor. 362 * 363 * @param { ShapeSize } options 364 * @syscap SystemCapability.ArkUI.ArkUI.Full 365 * @crossplatform 366 * @form 367 * @atomicservice 368 * @since arkts {'1.1':'12','1.2':'20'} 369 * @arkts 1.1&1.2 370 */ 371 constructor(options?: ShapeSize); 372} 373 374/** 375 * Defines a path drawing class. 376 * 377 * @extends CommonShapeMethod<PathShape> 378 * @syscap SystemCapability.ArkUI.ArkUI.Full 379 * @crossplatform 380 * @form 381 * @atomicservice 382 * @since arkts {'1.1':'12','1.2':'20'} 383 * @arkts 1.1&1.2 384 */ 385export declare class PathShape extends CommonShapeMethod<PathShape> { 386 /** 387 * Constructor. 388 * 389 * @param { PathShapeOptions } options 390 * @syscap SystemCapability.ArkUI.ArkUI.Full 391 * @crossplatform 392 * @form 393 * @atomicservice 394 * @since arkts {'1.1':'12','1.2':'20'} 395 * @arkts 1.1&1.2 396 */ 397 constructor(options?: PathShapeOptions); 398 399 /** 400 * Sets the commands for drawing the PathShape. 401 * 402 * @param { string } commands 403 * @returns { PathShape } 404 * @syscap SystemCapability.ArkUI.ArkUI.Full 405 * @crossplatform 406 * @form 407 * @atomicservice 408 * @since arkts {'1.1':'12','1.2':'20'} 409 * @arkts 1.1&1.2 410 */ 411 commands(commands: string): PathShape; 412}