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