• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 * Provides interfaces for drawing components.
18 * @since 7
19 */
20interface ShapeInterface {
21  /**
22   * Use the new function to create Shape.
23   * @since 7
24   */
25  new (value?: PixelMap): ShapeAttribute;
26
27  /**
28   * Called when a component is drawn.
29   * @since 7
30   */
31  (value?: PixelMap): ShapeAttribute;
32}
33
34/**
35 * @since 7
36 */
37declare class ShapeAttribute extends CommonMethod<ShapeAttribute> {
38  /**
39   * Viewport of shape
40   * @since 7
41   */
42  viewPort(value: { x?: number | string; y?: number | string; width?: number | string; height?: number | string }): ShapeAttribute;
43
44  /**
45   * Called when the border color is set.
46   * @since 7
47   */
48  stroke(value: ResourceColor): ShapeAttribute;
49
50  /**
51   * Called when the fill color is set.
52   * @since 7
53   */
54  fill(value: ResourceColor): ShapeAttribute;
55
56  /**
57   * Called when the offset of the starting point of border drawing is set.
58   * @since 7
59   */
60  strokeDashOffset(value: number | string): ShapeAttribute;
61
62  /**
63   * Called when the gap of the border is set.
64   * @since 7
65   */
66  strokeDashArray(value: Array<any>): ShapeAttribute;
67
68  /**
69   * Called when the path endpoint drawing style is set.
70   * @since 7
71   */
72  strokeLineCap(value: LineCapStyle): ShapeAttribute;
73
74  /**
75   * Called when the border corner drawing style is set.
76   * @since 7
77   */
78  strokeLineJoin(value: LineJoinStyle): ShapeAttribute;
79
80  /**
81   * Called when the limit value for drawing acute angles as oblique angles is set.
82   * @since 7
83   */
84  strokeMiterLimit(value: number | string): ShapeAttribute;
85
86  /**
87   * Called when the opacity of the border is set.
88   * @since 7
89   */
90  strokeOpacity(value: number | string | Resource): ShapeAttribute;
91
92  /**
93   * Called when the transparency of the border is set.
94   * @since 7
95   */
96  fillOpacity(value: number | string | Resource): ShapeAttribute;
97
98  /**
99   * Called when the width of the border is set.
100   * @since 7
101   */
102  strokeWidth(value: number | string): ShapeAttribute;
103
104  /**
105   * Called when setting whether anti aliasing is on.
106   * @since 7
107   */
108  antiAlias(value: boolean): ShapeAttribute;
109
110  /**
111   * Called when shape mesh.
112   * @since 8
113   */
114  mesh(value: Array<any>, column: number, row: number): ShapeAttribute;
115}
116
117declare const Shape: ShapeInterface;
118declare const ShapeInstance: ShapeAttribute;
119