• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-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 * Describes an opaque object of a template, which is created using the createPattern() method.
18 *
19 * @interface CanvasPattern
20 * @syscap SystemCapability.ArkUI.ArkUI.Full
21 * @since 8
22 */
23/**
24 * Describes an opaque object of a template, which is created using the createPattern() method.
25 *
26 * @interface CanvasPattern
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @since 9
29 * @form
30 */
31export interface CanvasPattern {
32  /**
33   * Adds the matrix transformation effect to the current template.
34   *
35   * @param { Matrix2D } [transform] - transformation matrix
36   * @syscap SystemCapability.ArkUI.ArkUI.Full
37   * @since 8
38   */
39  /**
40   * Adds the matrix transformation effect to the current template.
41   *
42   * @param { Matrix2D } [transform] - transformation matrix
43   * @syscap SystemCapability.ArkUI.ArkUI.Full
44   * @since 9
45   * @form
46   */
47  setTransform(transform?: Matrix2D): void;
48}
49
50/**
51 * 2D transformation matrix, supporting rotation, translation, and scaling of the X-axis and Y-axis
52 *
53 * @syscap SystemCapability.ArkUI.ArkUI.Full
54 * @since 8
55 */
56/**
57 * 2D transformation matrix, supporting rotation, translation, and scaling of the X-axis and Y-axis
58 *
59 * @syscap SystemCapability.ArkUI.ArkUI.Full
60 * @since 9
61 * @form
62 */
63export class Matrix2D {
64  /**
65   * Horizontal Zoom
66   *
67   * @type { ?number }
68   * @syscap SystemCapability.ArkUI.ArkUI.Full
69   * @since 8
70   */
71  /**
72   * Horizontal Zoom
73   *
74   * @type { ?number }
75   * @syscap SystemCapability.ArkUI.ArkUI.Full
76   * @since 9
77   * @form
78   */
79  scaleX?: number;
80
81  /**
82   * Vertical Tilt
83   *
84   * @type { ?number }
85   * @syscap SystemCapability.ArkUI.ArkUI.Full
86   * @since 8
87   */
88  /**
89   * Vertical Tilt
90   *
91   * @type { ?number }
92   * @syscap SystemCapability.ArkUI.ArkUI.Full
93   * @since 9
94   * @form
95   */
96  rotateY?: number;
97
98  /**
99   * Horizontal Tilt
100   *
101   * @type { ?number }
102   * @syscap SystemCapability.ArkUI.ArkUI.Full
103   * @since 8
104   */
105  /**
106   * Horizontal Tilt
107   *
108   * @type { ?number }
109   * @syscap SystemCapability.ArkUI.ArkUI.Full
110   * @since 9
111   * @form
112   */
113  rotateX?: number;
114
115  /**
116   * Vertical Zoom
117   *
118   * @type { ?number }
119   * @syscap SystemCapability.ArkUI.ArkUI.Full
120   * @since 8
121   */
122  /**
123   * Vertical Zoom
124   *
125   * @type { ?number }
126   * @syscap SystemCapability.ArkUI.ArkUI.Full
127   * @since 9
128   * @form
129   */
130  scaleY?: number;
131
132  /**
133   * Horizontal movement
134   *
135   * @type { ?number }
136   * @syscap SystemCapability.ArkUI.ArkUI.Full
137   * @since 8
138   */
139  /**
140   * Horizontal movement
141   *
142   * @type { ?number }
143   * @syscap SystemCapability.ArkUI.ArkUI.Full
144   * @since 9
145   * @form
146   */
147  translateX?: number;
148
149  /**
150   * Vertical movement
151   *
152   * @type { ?number }
153   * @syscap SystemCapability.ArkUI.ArkUI.Full
154   * @since 8
155   */
156  /**
157   * Vertical movement
158   *
159   * @type { ?number }
160   * @syscap SystemCapability.ArkUI.ArkUI.Full
161   * @since 9
162   * @form
163   */
164  translateY?: number;
165
166  /**
167   * Transforms the current 2D matrix back to the identity matrix (i.e., without any rotational
168   * translation scaling effect)
169   *
170   * @returns { Matrix2D }
171   * @syscap SystemCapability.ArkUI.ArkUI.Full
172   * @since 8
173   */
174  /**
175   * Transforms the current 2D matrix back to the identity matrix (i.e., without any rotational
176   * translation scaling effect)
177   *
178   * @returns { Matrix2D }
179   * @syscap SystemCapability.ArkUI.ArkUI.Full
180   * @since 9
181   * @form
182   */
183  identity(): Matrix2D;
184
185  /**
186   * Transform the current 2D matrix into an inverse matrix (that is, the transformation effect
187   * is the opposite effect of the original)
188   *
189   * @returns { Matrix2D }
190   * @syscap SystemCapability.ArkUI.ArkUI.Full
191   * @since 8
192   */
193  /**
194   * Transform the current 2D matrix into an inverse matrix (that is, the transformation effect
195   * is the opposite effect of the original)
196   *
197   * @returns { Matrix2D }
198   * @syscap SystemCapability.ArkUI.ArkUI.Full
199   * @since 9
200   * @form
201   */
202  invert(): Matrix2D;
203
204  /**
205   * The matrix is superimposed in right multiplication mode. When the input parameter is empty,
206   * the matrix is superimposed.
207   *
208   * @param { Matrix2D } [other] - Matrix to be superimposed
209   * @returns { Matrix2D }
210   * @syscap SystemCapability.ArkUI.ArkUI.Full
211   * @since 8
212   */
213  /**
214   * The matrix is superimposed in right multiplication mode. When the input parameter is empty,
215   * the matrix is superimposed.
216   *
217   * @param { Matrix2D } [other] - Matrix to be superimposed
218   * @returns { Matrix2D }
219   * @syscap SystemCapability.ArkUI.ArkUI.Full
220   * @since 9
221   * @form
222   */
223  multiply(other?: Matrix2D): Matrix2D;
224
225  /**
226   * Adds the rotation effect of the X and Y axes to the current matrix.
227   *
228   * @param { number } [rx] - Rotation effect of the X axis
229   * @param { number } [ry] - Rotation effect of the Y-axis
230   * @returns { Matrix2D }
231   * @syscap SystemCapability.ArkUI.ArkUI.Full
232   * @since 8
233   */
234  /**
235   * Adds the rotation effect of the X and Y axes to the current matrix.
236   *
237   * @param { number } [rx] - Rotation effect of the X axis
238   * @param { number } [ry] - Rotation effect of the Y-axis
239   * @returns { Matrix2D }
240   * @syscap SystemCapability.ArkUI.ArkUI.Full
241   * @since 9
242   * @form
243   */
244  rotate(rx?: number, ry?: number): Matrix2D;
245
246  /**
247   * Adds the translation effect of the X and Y axes to the current matrix.
248   *
249   * @param { number } [tx] - X-axis translation effect
250   * @param { number } [ty] - Y-axis translation effect
251   * @returns { Matrix2D }
252   * @syscap SystemCapability.ArkUI.ArkUI.Full
253   * @since 8
254   */
255  /**
256   * Adds the translation effect of the X and Y axes to the current matrix.
257   *
258   * @param { number } [tx] - X-axis translation effect
259   * @param { number } [ty] - Y-axis translation effect
260   * @returns { Matrix2D }
261   * @syscap SystemCapability.ArkUI.ArkUI.Full
262   * @since 9
263   * @form
264   */
265  translate(tx?: number, ty?: number): Matrix2D;
266
267  /**
268   * Adds the scaling effect of the X and Y axes to the current matrix.
269   *
270   * @param { number } [sx] - X-axis scaling effect
271   * @param { number } [sy] - Y-axis scaling effect
272   * @returns { Matrix2D }
273   * @syscap SystemCapability.ArkUI.ArkUI.Full
274   * @since 8
275   */
276  /**
277   * Adds the scaling effect of the X and Y axes to the current matrix.
278   *
279   * @param { number } [sx] - X-axis scaling effect
280   * @param { number } [sy] - Y-axis scaling effect
281   * @returns { Matrix2D }
282   * @syscap SystemCapability.ArkUI.ArkUI.Full
283   * @since 9
284   * @form
285   */
286  scale(sx?: number, sy?: number): Matrix2D;
287
288  /**
289   * Constructs a 2D change matrix object. The default value is the unit matrix.
290   *
291   * @syscap SystemCapability.ArkUI.ArkUI.Full
292   * @since 8
293   */
294  /**
295   * Constructs a 2D change matrix object. The default value is the unit matrix.
296   *
297   * @syscap SystemCapability.ArkUI.ArkUI.Full
298   * @since 9
299   * @form
300   */
301  constructor();
302}
303