1/* 2 * Copyright (c) 2020 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 * @import import Matrix4 from '@ohos.matrix4' 19 * @syscap SystemCapability.ArkUI.ArkUI.Full 20 * @since 7 21 */ 22declare namespace matrix4 { 23 /** 24 * Set translation parameters 25 * @since 7 26 */ 27 interface TranslateOption { 28 /** 29 * Indicates the translation distance of the x-axis, in px. 30 * @since 7 31 */ 32 x?: number; 33 34 /** 35 * Indicates the translation distance of the y-axis, in px. 36 * @since 7 37 */ 38 y?: number; 39 40 /** 41 * Indicates the translation distance of the z-axis, in px. 42 * @since 7 43 */ 44 z?: number; 45 } 46 47 /** 48 * Set scaling parameters 49 * @since 7 50 */ 51 interface ScaleOption { 52 /** 53 * Zoom factor of the x-axis. 54 * @since 7 55 */ 56 x?: number; 57 58 /** 59 * Zoom factor of the y-axis. 60 * @since 7 61 */ 62 y?: number; 63 64 /** 65 * Zoom factor of the z-axis. 66 * @since 7 67 */ 68 z?: number; 69 70 /** 71 * Transform the x-axis coordinate of the center point. 72 * @since 7 73 */ 74 centerX?: number; 75 76 /** 77 * Transform the y-axis coordinate of the center point. 78 * @since 7 79 */ 80 centerY?: number; 81 } 82 83 /** 84 * Set Rotation Parameters. 85 * @since 7 86 */ 87 interface RotateOption { 88 /** 89 * Axis of rotation vector x coordinate. 90 * @since 7 91 */ 92 x?: number; 93 94 /** 95 * Axis of rotation vector y coordinate. 96 * @since 7 97 */ 98 y?: number; 99 100 /** 101 * Axis of rotation vector z coordinate. 102 * @since 7 103 */ 104 z?: number; 105 106 /** 107 * Transform the x-axis coordinate of the center point. 108 * @since 7 109 */ 110 centerX?: number; 111 112 /** 113 * Transform the y-axis coordinate of the center point. 114 * @since 7 115 */ 116 centerY?: number; 117 118 /** 119 * Rotation angle. 120 * @since 7 121 */ 122 angle?: number; 123 } 124 125 /** 126 * Matrix4Transit. 127 * @since 7 128 */ 129 interface Matrix4Transit { 130 /** 131 * Copy function of Matrix, which can copy a copy of the current matrix object. 132 * @since 7 133 * @return Return to Matrix4Transit 134 */ 135 copy(): Matrix4Transit; 136 137 /** 138 * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. 139 * @since 7 140 * @return Return to Matrix4Transit 141 */ 142 invert(): Matrix4Transit; 143 144 /** 145 * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. 146 * @since 7 147 * @return Return to Matrix4Transit 148 */ 149 combine(options: Matrix4Transit): Matrix4Transit; 150 151 /** 152 * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. 153 * @since 7 154 * @return Return to Matrix4Transit 155 */ 156 translate(options: TranslateOption): Matrix4Transit; 157 158 /** 159 * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. 160 * @since 7 161 * @return Return to Matrix4Transit 162 */ 163 scale(options: ScaleOption): Matrix4Transit; 164 165 /** 166 * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. 167 * @since 7 168 * @return Return to Matrix4Transit 169 */ 170 rotate(options: RotateOption): Matrix4Transit; 171 172 /** 173 * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. 174 * @since 7 175 * @return Return to Matrix4Transit 176 */ 177 transformPoint(options: [number, number]): [number, number]; 178 } 179 180 /** 181 * Constructor of Matrix, which can create a fourth-order matrix based on the input parameters. The matrix is column-first. 182 * @since 7 183 * @return Return to Matrix4Transit 184 */ 185 function init( 186 options: [ 187 number, 188 number, 189 number, 190 number, 191 number, 192 number, 193 number, 194 number, 195 number, 196 number, 197 number, 198 number, 199 number, 200 number, 201 number, 202 number, 203 ], 204 ): Matrix4Transit; 205 206 /** 207 * Matrix initialization function, which can return an identity matrix object. 208 * @since 7 209 * @return Return to Matrix4Transit 210 */ 211 function identity(): Matrix4Transit; 212 213 /** 214 * Copy function of Matrix, which can copy a copy of the current matrix object. 215 * @since 7 216 * @return Return to Matrix4Transit 217 */ 218 function copy(): Matrix4Transit; 219 220 /** 221 * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. 222 * @since 7 223 * @return Return to Matrix4Transit 224 */ 225 function invert(): Matrix4Transit; 226 227 /** 228 * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. 229 * @since 7 230 * @return Return to Matrix4Transit 231 */ 232 function combine(options: Matrix4Transit): Matrix4Transit; 233 234 /** 235 * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. 236 * @since 7 237 * @return Return to Matrix4Transit 238 */ 239 function translate(options: TranslateOption): Matrix4Transit; 240 241 /** 242 * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. 243 * @since 7 244 * @return Return to Matrix4Transit 245 */ 246 function scale(options: ScaleOption): Matrix4Transit; 247 248 /** 249 * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. 250 * @since 7 251 * @return Return to Matrix4Transit 252 */ 253 function rotate(options: RotateOption): Matrix4Transit; 254 255 /** 256 * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. 257 * @since 7 258 * @return Return to Matrix4Transit 259 */ 260 function transformPoint(options: [number, number]): [number, number]; 261} 262 263export default matrix4; 264