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 16interface RectShapeOptions extends ShapeSize { 17 radius?: number | string | Array<number | string>; 18} 19 20interface RoundRectShapeOptions extends ShapeSize { 21 radiusWidth?: number | string; 22 radiusHeight?: number | string; 23} 24 25declare class __RectShape__<T> { 26 constructor(options: RectShapeOptions | RoundRectShapeOptions); 27 width(width: string | number): T; 28 height(height: string | number): T; 29 size(size: SizeOptions): T; 30 offset(offset: Position): T; 31 fill(color: number | string): T; 32 position(position: Position): T; 33 radiusWidth(rWidth: number | string): T; 34 radiusHeight(rHeight: number | string): T; 35 radius(radius: number | string | Array<number | string>): T; 36} 37 38class RectShape extends __RectShape__<RectShape> { 39 constructor(options: RectShapeOptions | RoundRectShapeOptions) { 40 super(options); 41 } 42 43 width(width: string | number): RectShape { 44 return super.width(width); 45 } 46 47 height(height: string | number): RectShape { 48 return super.height(height); 49 } 50 51 size(size: SizeOptions): RectShape { 52 return super.size(size); 53 } 54 55 offset(offset: Position): RectShape { 56 return super.offset(offset); 57 } 58 59 fill(width: string | number): RectShape { 60 return super.fill(width); 61 } 62 63 position(position: Position): RectShape { 64 return super.position(position); 65 } 66 67 radiusWidth(rWidth: number | string): RectShape { 68 return super.radiusWidth(rWidth); 69 } 70 71 radiusHeight(rHeight: number | string): RectShape { 72 return super.radiusHeight(rHeight); 73 } 74 75 radius(radius: number | string | Array<number | string>): RectShape { 76 return super.radius(radius); 77 } 78} 79 80 81