• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2020-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 * Used to do matrix operations
18 *
19 * @namespace matrix4
20 * @syscap SystemCapability.ArkUI.ArkUI.Full
21 * @since 7
22 */
23/**
24 * Used to do matrix operations
25 *
26 * @namespace matrix4
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @crossplatform
29 * @since 10
30 */
31declare namespace matrix4 {
32  /**
33   * Set translation parameters
34   *
35   * @interface TranslateOption
36   * @syscap SystemCapability.ArkUI.ArkUI.Full
37   * @since 7
38   */
39  /**
40   * Set translation parameters
41   *
42   * @interface TranslateOption
43   * @syscap SystemCapability.ArkUI.ArkUI.Full
44   * @crossplatform
45   * @since 10
46   */
47  interface TranslateOption {
48    /**
49     * Indicates the translation distance of the x-axis, in px.
50     *
51     * @type { ?number }
52     * @syscap SystemCapability.ArkUI.ArkUI.Full
53     * @since 7
54     */
55    /**
56     * Indicates the translation distance of the x-axis, in px.
57     *
58     * @type { ?number }
59     * @syscap SystemCapability.ArkUI.ArkUI.Full
60     * @crossplatform
61     * @since 10
62     */
63    x?: number;
64
65    /**
66     * Indicates the translation distance of the y-axis, in px.
67     *
68     * @type { ?number }
69     * @syscap SystemCapability.ArkUI.ArkUI.Full
70     * @since 7
71     */
72    /**
73     * Indicates the translation distance of the y-axis, in px.
74     *
75     * @type { ?number }
76     * @syscap SystemCapability.ArkUI.ArkUI.Full
77     * @crossplatform
78     * @since 10
79     */
80    y?: number;
81
82    /**
83     * Indicates the translation distance of the z-axis, in px.
84     *
85     * @type { ?number }
86     * @syscap SystemCapability.ArkUI.ArkUI.Full
87     * @since 7
88     */
89    /**
90     * Indicates the translation distance of the z-axis, in px.
91     *
92     * @type { ?number }
93     * @syscap SystemCapability.ArkUI.ArkUI.Full
94     * @crossplatform
95     * @since 10
96     */
97    z?: number;
98  }
99
100  /**
101   * Set scaling parameters
102   *
103   * @interface ScaleOption
104   * @syscap SystemCapability.ArkUI.ArkUI.Full
105   * @since 7
106   */
107  /**
108   * Set scaling parameters
109   *
110   * @interface ScaleOption
111   * @syscap SystemCapability.ArkUI.ArkUI.Full
112   * @crossplatform
113   * @since 10
114   */
115  interface ScaleOption {
116    /**
117     * Zoom factor of the x-axis.
118     *
119     * @type { ?number }
120     * @syscap SystemCapability.ArkUI.ArkUI.Full
121     * @since 7
122     */
123    /**
124     * Zoom factor of the x-axis.
125     *
126     * @type { ?number }
127     * @syscap SystemCapability.ArkUI.ArkUI.Full
128     * @crossplatform
129     * @since 10
130     */
131    x?: number;
132
133    /**
134     * Zoom factor of the y-axis.
135     *
136     * @type { ?number }
137     * @syscap SystemCapability.ArkUI.ArkUI.Full
138     * @since 7
139     */
140    /**
141     * Zoom factor of the y-axis.
142     *
143     * @type { ?number }
144     * @syscap SystemCapability.ArkUI.ArkUI.Full
145     * @crossplatform
146     * @since 10
147     */
148    y?: number;
149
150    /**
151     * Zoom factor of the z-axis.
152     *
153     * @type { ?number }
154     * @syscap SystemCapability.ArkUI.ArkUI.Full
155     * @since 7
156     */
157    /**
158     * Zoom factor of the z-axis.
159     *
160     * @type { ?number }
161     * @syscap SystemCapability.ArkUI.ArkUI.Full
162     * @crossplatform
163     * @since 10
164     */
165    z?: number;
166
167    /**
168     * Transform the x-axis coordinate of the center point.
169     *
170     * @type { ?number }
171     * @syscap SystemCapability.ArkUI.ArkUI.Full
172     * @since 7
173     */
174    /**
175     * Transform the x-axis coordinate of the center point.
176     *
177     * @type { ?number }
178     * @syscap SystemCapability.ArkUI.ArkUI.Full
179     * @crossplatform
180     * @since 10
181     */
182    centerX?: number;
183
184    /**
185     * Transform the y-axis coordinate of the center point.
186     *
187     * @type { ?number }
188     * @syscap SystemCapability.ArkUI.ArkUI.Full
189     * @since 7
190     */
191    /**
192     * Transform the y-axis coordinate of the center point.
193     *
194     * @type { ?number }
195     * @syscap SystemCapability.ArkUI.ArkUI.Full
196     * @crossplatform
197     * @since 10
198     */
199    centerY?: number;
200  }
201
202  /**
203   * Set Rotation Parameters.
204   *
205   * @interface RotateOption
206   * @syscap SystemCapability.ArkUI.ArkUI.Full
207   * @since 7
208   */
209  /**
210   * Set Rotation Parameters.
211   *
212   * @interface RotateOption
213   * @syscap SystemCapability.ArkUI.ArkUI.Full
214   * @crossplatform
215   * @since 10
216   */
217  interface RotateOption {
218    /**
219     * Axis of rotation vector x coordinate.
220     *
221     * @type { ?number }
222     * @syscap SystemCapability.ArkUI.ArkUI.Full
223     * @since 7
224     */
225    /**
226     * Axis of rotation vector x coordinate.
227     *
228     * @type { ?number }
229     * @syscap SystemCapability.ArkUI.ArkUI.Full
230     * @crossplatform
231     * @since 10
232     */
233    x?: number;
234
235    /**
236     * Axis of rotation vector y coordinate.
237     *
238     * @type { ?number }
239     * @syscap SystemCapability.ArkUI.ArkUI.Full
240     * @since 7
241     */
242    /**
243     * Axis of rotation vector y coordinate.
244     *
245     * @type { ?number }
246     * @syscap SystemCapability.ArkUI.ArkUI.Full
247     * @crossplatform
248     * @since 10
249     */
250    y?: number;
251
252    /**
253     * Axis of rotation vector z coordinate.
254     *
255     * @type { ?number }
256     * @syscap SystemCapability.ArkUI.ArkUI.Full
257     * @since 7
258     */
259    /**
260     * Axis of rotation vector z coordinate.
261     *
262     * @type { ?number }
263     * @syscap SystemCapability.ArkUI.ArkUI.Full
264     * @crossplatform
265     * @since 10
266     */
267    z?: number;
268
269    /**
270     * Transform the x-axis coordinate of the center point.
271     *
272     * @type { ?number }
273     * @syscap SystemCapability.ArkUI.ArkUI.Full
274     * @since 7
275     */
276    /**
277     * Transform the x-axis coordinate of the center point.
278     *
279     * @type { ?number }
280     * @syscap SystemCapability.ArkUI.ArkUI.Full
281     * @crossplatform
282     * @since 10
283     */
284    centerX?: number;
285
286    /**
287     * Transform the y-axis coordinate of the center point.
288     *
289     * @type { ?number }
290     * @syscap SystemCapability.ArkUI.ArkUI.Full
291     * @since 7
292     */
293    /**
294     * Transform the y-axis coordinate of the center point.
295     *
296     * @type { ?number }
297     * @syscap SystemCapability.ArkUI.ArkUI.Full
298     * @crossplatform
299     * @since 10
300     */
301    centerY?: number;
302
303    /**
304     * Rotation angle.
305     *
306     * @type { ?number }
307     * @syscap SystemCapability.ArkUI.ArkUI.Full
308     * @since 7
309     */
310    /**
311     * Rotation angle.
312     *
313     * @type { ?number }
314     * @syscap SystemCapability.ArkUI.ArkUI.Full
315     * @crossplatform
316     * @since 10
317     */
318    angle?: number;
319  }
320
321  /**
322   * Matrix4Transit.
323   *
324   * @interface Matrix4Transit
325   * @syscap SystemCapability.ArkUI.ArkUI.Full
326   * @since 7
327   */
328  /**
329   * Matrix4Transit.
330   *
331   * @interface Matrix4Transit
332   * @syscap SystemCapability.ArkUI.ArkUI.Full
333   * @crossplatform
334   * @since 10
335   */
336  interface Matrix4Transit {
337    /**
338     * Copy function of Matrix, which can copy a copy of the current matrix object.
339     *
340     * @returns { Matrix4Transit } Return to Matrix4Transit
341     * @syscap SystemCapability.ArkUI.ArkUI.Full
342     * @since 7
343     */
344    /**
345     * Copy function of Matrix, which can copy a copy of the current matrix object.
346     *
347     * @returns { Matrix4Transit } Return to Matrix4Transit
348     * @syscap SystemCapability.ArkUI.ArkUI.Full
349     * @crossplatform
350     * @since 10
351     */
352    copy(): Matrix4Transit;
353
354    /**
355     * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite.
356     *
357     * @returns { Matrix4Transit } Return to Matrix4Transit
358     * @syscap SystemCapability.ArkUI.ArkUI.Full
359     * @since 7
360     */
361    /**
362     * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite.
363     *
364     * @returns { Matrix4Transit } Return to Matrix4Transit
365     * @syscap SystemCapability.ArkUI.ArkUI.Full
366     * @crossplatform
367     * @since 10
368     */
369    invert(): Matrix4Transit;
370
371    /**
372     * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object.
373     *
374     * @param { Matrix4Transit } options
375     * @returns { Matrix4Transit } Return to Matrix4Transit
376     * @syscap SystemCapability.ArkUI.ArkUI.Full
377     * @since 7
378     */
379    /**
380     * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object.
381     *
382     * @param { Matrix4Transit } options
383     * @returns { Matrix4Transit } Return to Matrix4Transit
384     * @syscap SystemCapability.ArkUI.ArkUI.Full
385     * @crossplatform
386     * @since 10
387     */
388    combine(options: Matrix4Transit): Matrix4Transit;
389
390    /**
391     * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix.
392     *
393     * @param { TranslateOption } options
394     * @returns { Matrix4Transit } Return to Matrix4Transit
395     * @syscap SystemCapability.ArkUI.ArkUI.Full
396     * @since 7
397     */
398    /**
399     * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix.
400     *
401     * @param { TranslateOption } options
402     * @returns { Matrix4Transit } Return to Matrix4Transit
403     * @syscap SystemCapability.ArkUI.ArkUI.Full
404     * @crossplatform
405     * @since 10
406     */
407    translate(options: TranslateOption): Matrix4Transit;
408
409    /**
410     * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix.
411     *
412     * @param { ScaleOption } options
413     * @returns { Matrix4Transit } Return to Matrix4Transit
414     * @syscap SystemCapability.ArkUI.ArkUI.Full
415     * @since 7
416     */
417    /**
418     * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix.
419     *
420     * @param { ScaleOption } options
421     * @returns { Matrix4Transit } Return to Matrix4Transit
422     * @syscap SystemCapability.ArkUI.ArkUI.Full
423     * @crossplatform
424     * @since 10
425     */
426    scale(options: ScaleOption): Matrix4Transit;
427
428    /**
429     * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix.
430     *
431     * @param { RotateOption } options
432     * @returns { Matrix4Transit } Return to Matrix4Transit
433     * @syscap SystemCapability.ArkUI.ArkUI.Full
434     * @since 7
435     */
436    /**
437     * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix.
438     *
439     * @param { RotateOption } options
440     * @returns { Matrix4Transit } Return to Matrix4Transit
441     * @syscap SystemCapability.ArkUI.ArkUI.Full
442     * @crossplatform
443     * @since 10
444     */
445    rotate(options: RotateOption): Matrix4Transit;
446
447    /**
448     * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point.
449     *
450     * @param { [number, number] } options
451     * @returns { [number, number] } Return to Matrix4Transit
452     * @syscap SystemCapability.ArkUI.ArkUI.Full
453     * @since 7
454     */
455    /**
456     * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point.
457     *
458     * @param { [number, number] } options
459     * @returns { [number, number] } Return to Matrix4Transit
460     * @syscap SystemCapability.ArkUI.ArkUI.Full
461     * @crossplatform
462     * @since 10
463     */
464    transformPoint(options: [number, number]): [number, number];
465  }
466
467  /**
468   * Constructor of Matrix, which can create a fourth-order matrix based on the input parameters. The matrix is column-first.
469   *
470   * @param { [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number] } options
471   * options indicates a fourth-order matrix
472   * @returns { Matrix4Transit } Return to Matrix4Transit
473   * @syscap SystemCapability.ArkUI.ArkUI.Full
474   * @since 7
475   */
476  /**
477   * Constructor of Matrix, which can create a fourth-order matrix based on the input parameters. The matrix is column-first.
478   *
479   * @param { [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number] } options
480   * options indicates a fourth-order matrix
481   * @returns { Matrix4Transit } Return to Matrix4Transit
482   * @syscap SystemCapability.ArkUI.ArkUI.Full
483   * @crossplatform
484   * @since 10
485   */
486  function init(
487    options: [
488      number,
489      number,
490      number,
491      number,
492      number,
493      number,
494      number,
495      number,
496      number,
497      number,
498      number,
499      number,
500      number,
501      number,
502      number,
503      number
504    ]
505  ): Matrix4Transit;
506
507  /**
508   * Matrix initialization function, which can return an identity matrix object.
509   *
510   * @returns { Matrix4Transit } Return to Matrix4Transit
511   * @syscap SystemCapability.ArkUI.ArkUI.Full
512   * @since 7
513   */
514  /**
515   * Matrix initialization function, which can return an identity matrix object.
516   *
517   * @returns { Matrix4Transit } Return to Matrix4Transit
518   * @syscap SystemCapability.ArkUI.ArkUI.Full
519   * @crossplatform
520   * @since 10
521   */
522  function identity(): Matrix4Transit;
523
524  /**
525   * Copy function of Matrix, which can copy a copy of the current matrix object.
526   *
527   * @returns { Matrix4Transit } Return to Matrix4Transit
528   * @syscap SystemCapability.ArkUI.ArkUI.Full
529   * @since 7
530   * @deprecated since 10
531   */
532  function copy(): Matrix4Transit;
533
534  /**
535   * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite.
536   *
537   * @returns { Matrix4Transit } Return to Matrix4Transit
538   * @syscap SystemCapability.ArkUI.ArkUI.Full
539   * @since 7
540   * @deprecated since 10
541   */
542  function invert(): Matrix4Transit;
543
544  /**
545   * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object.
546   *
547   * @param { Matrix4Transit } options
548   * @returns { Matrix4Transit } Return to Matrix4Transit
549   * @syscap SystemCapability.ArkUI.ArkUI.Full
550   * @since 7
551   * @deprecated since 10
552   */
553  function combine(options: Matrix4Transit): Matrix4Transit;
554
555  /**
556   * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix.
557   *
558   * @param { TranslateOption } options
559   * @returns { Matrix4Transit } Return to Matrix4Transit
560   * @syscap SystemCapability.ArkUI.ArkUI.Full
561   * @since 7
562   * @deprecated since 10
563   */
564  function translate(options: TranslateOption): Matrix4Transit;
565
566  /**
567   * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix.
568   *
569   * @param { ScaleOption } options
570   * @returns { Matrix4Transit } Return to Matrix4Transit
571   * @syscap SystemCapability.ArkUI.ArkUI.Full
572   * @since 7
573   * @deprecated since 10
574   */
575  function scale(options: ScaleOption): Matrix4Transit;
576
577  /**
578   * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix.
579   *
580   * @param { RotateOption } options
581   * @returns { Matrix4Transit } Return to Matrix4Transit
582   * @syscap SystemCapability.ArkUI.ArkUI.Full
583   * @since 7
584   * @deprecated since 10
585   */
586  function rotate(options: RotateOption): Matrix4Transit;
587
588  /**
589   * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point.
590   *
591   * @param { [number, number] } options
592   * @returns { [number, number] } Return to Matrix4Transit
593   * @syscap SystemCapability.ArkUI.ArkUI.Full
594   * @since 7
595   * @deprecated since 10
596   */
597  function transformPoint(options: [number, number]): [number, number];
598}
599
600export default matrix4;
601