1/* 2 * Copyright (c) 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 * @file 18 * @kit ArkUI 19 */ 20 21/** 22 * 2D transformation matrix, supporting rotation, translation, and scaling of the X-axis and Y-axis 23 * 24 * @syscap SystemCapability.ArkUI.ArkUI.Full 25 * @since 8 26 */ 27/** 28 * 2D transformation matrix, supporting rotation, translation, and scaling of the X-axis and Y-axis 29 * 30 * @syscap SystemCapability.ArkUI.ArkUI.Full 31 * @form 32 * @since 9 33 */ 34/** 35 * 2D transformation matrix, supporting rotation, translation, and scaling of the X-axis and Y-axis 36 * 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @crossplatform 39 * @form 40 * @since 10 41 */ 42/** 43 * 2D transformation matrix, supporting rotation, translation, and scaling of the X-axis and Y-axis 44 * 45 * @syscap SystemCapability.ArkUI.ArkUI.Full 46 * @crossplatform 47 * @form 48 * @atomicservice 49 * @since 11 50 */ 51declare class Matrix2D { 52 /** 53 * Horizontal Zoom 54 * 55 * @type { ?number } 56 * @syscap SystemCapability.ArkUI.ArkUI.Full 57 * @since 8 58 */ 59 /** 60 * Horizontal Zoom 61 * 62 * @type { ?number } 63 * @syscap SystemCapability.ArkUI.ArkUI.Full 64 * @form 65 * @since 9 66 */ 67 /** 68 * Horizontal Zoom 69 * 70 * @type { ?number } 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @crossplatform 73 * @form 74 * @since 10 75 */ 76 /** 77 * Horizontal Zoom 78 * 79 * @type { ?number } 80 * @syscap SystemCapability.ArkUI.ArkUI.Full 81 * @crossplatform 82 * @form 83 * @atomicservice 84 * @since 11 85 */ 86 scaleX?: number; 87 88 /** 89 * Vertical Tilt 90 * 91 * @type { ?number } 92 * @syscap SystemCapability.ArkUI.ArkUI.Full 93 * @since 8 94 */ 95 /** 96 * Vertical Tilt 97 * 98 * @type { ?number } 99 * @syscap SystemCapability.ArkUI.ArkUI.Full 100 * @form 101 * @since 9 102 */ 103 /** 104 * Vertical Tilt 105 * 106 * @type { ?number } 107 * @syscap SystemCapability.ArkUI.ArkUI.Full 108 * @crossplatform 109 * @form 110 * @since 10 111 */ 112 /** 113 * Vertical Tilt 114 * 115 * @type { ?number } 116 * @syscap SystemCapability.ArkUI.ArkUI.Full 117 * @crossplatform 118 * @form 119 * @atomicservice 120 * @since 11 121 */ 122 rotateY?: number; 123 124 /** 125 * Horizontal Tilt 126 * 127 * @type { ?number } 128 * @syscap SystemCapability.ArkUI.ArkUI.Full 129 * @since 8 130 */ 131 /** 132 * Horizontal Tilt 133 * 134 * @type { ?number } 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @form 137 * @since 9 138 */ 139 /** 140 * Horizontal Tilt 141 * 142 * @type { ?number } 143 * @syscap SystemCapability.ArkUI.ArkUI.Full 144 * @crossplatform 145 * @form 146 * @since 10 147 */ 148 /** 149 * Horizontal Tilt 150 * 151 * @type { ?number } 152 * @syscap SystemCapability.ArkUI.ArkUI.Full 153 * @crossplatform 154 * @form 155 * @atomicservice 156 * @since 11 157 */ 158 rotateX?: number; 159 160 /** 161 * Vertical Zoom 162 * 163 * @type { ?number } 164 * @syscap SystemCapability.ArkUI.ArkUI.Full 165 * @since 8 166 */ 167 /** 168 * Vertical Zoom 169 * 170 * @type { ?number } 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @form 173 * @since 9 174 */ 175 /** 176 * Vertical Zoom 177 * 178 * @type { ?number } 179 * @syscap SystemCapability.ArkUI.ArkUI.Full 180 * @crossplatform 181 * @form 182 * @since 10 183 */ 184 /** 185 * Vertical Zoom 186 * 187 * @type { ?number } 188 * @syscap SystemCapability.ArkUI.ArkUI.Full 189 * @crossplatform 190 * @form 191 * @atomicservice 192 * @since 11 193 */ 194 scaleY?: number; 195 196 /** 197 * Horizontal movement 198 * 199 * @type { ?number } 200 * @syscap SystemCapability.ArkUI.ArkUI.Full 201 * @since 8 202 */ 203 /** 204 * Horizontal movement 205 * 206 * @type { ?number } 207 * @syscap SystemCapability.ArkUI.ArkUI.Full 208 * @form 209 * @since 9 210 */ 211 /** 212 * Horizontal movement 213 * 214 * @type { ?number } 215 * @syscap SystemCapability.ArkUI.ArkUI.Full 216 * @crossplatform 217 * @form 218 * @since 10 219 */ 220 /** 221 * Horizontal movement 222 * 223 * @type { ?number } 224 * @syscap SystemCapability.ArkUI.ArkUI.Full 225 * @crossplatform 226 * @form 227 * @atomicservice 228 * @since 11 229 */ 230 translateX?: number; 231 232 /** 233 * Vertical movement 234 * 235 * @type { ?number } 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @since 8 238 */ 239 /** 240 * Vertical movement 241 * 242 * @type { ?number } 243 * @syscap SystemCapability.ArkUI.ArkUI.Full 244 * @form 245 * @since 9 246 */ 247 /** 248 * Vertical movement 249 * 250 * @type { ?number } 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @crossplatform 253 * @form 254 * @since 10 255 */ 256 /** 257 * Vertical movement 258 * 259 * @type { ?number } 260 * @syscap SystemCapability.ArkUI.ArkUI.Full 261 * @crossplatform 262 * @form 263 * @atomicservice 264 * @since 11 265 */ 266 translateY?: number; 267 268 /** 269 * Transforms the current 2D matrix back to the identity matrix (i.e., without any rotational 270 * translation scaling effect) 271 * 272 * @returns { Matrix2D } 273 * @syscap SystemCapability.ArkUI.ArkUI.Full 274 * @since 8 275 */ 276 /** 277 * Transforms the current 2D matrix back to the identity matrix (i.e., without any rotational 278 * translation scaling effect) 279 * 280 * @returns { Matrix2D } 281 * @syscap SystemCapability.ArkUI.ArkUI.Full 282 * @form 283 * @since 9 284 */ 285 /** 286 * Transforms the current 2D matrix back to the identity matrix (i.e., without any rotational 287 * translation scaling effect) 288 * 289 * @returns { Matrix2D } 290 * @syscap SystemCapability.ArkUI.ArkUI.Full 291 * @crossplatform 292 * @form 293 * @since 10 294 */ 295 /** 296 * Transforms the current 2D matrix back to the identity matrix (i.e., without any rotational 297 * translation scaling effect) 298 * 299 * @returns { Matrix2D } 300 * @syscap SystemCapability.ArkUI.ArkUI.Full 301 * @crossplatform 302 * @form 303 * @atomicservice 304 * @since 11 305 */ 306 identity(): Matrix2D; 307 308 /** 309 * Transform the current 2D matrix into an inverse matrix (that is, the transformation effect 310 * is the opposite effect of the original) 311 * 312 * @returns { Matrix2D } 313 * @syscap SystemCapability.ArkUI.ArkUI.Full 314 * @since 8 315 */ 316 /** 317 * Transform the current 2D matrix into an inverse matrix (that is, the transformation effect 318 * is the opposite effect of the original) 319 * 320 * @returns { Matrix2D } 321 * @syscap SystemCapability.ArkUI.ArkUI.Full 322 * @form 323 * @since 9 324 */ 325 /** 326 * Transform the current 2D matrix into an inverse matrix (that is, the transformation effect 327 * is the opposite effect of the original) 328 * 329 * @returns { Matrix2D } 330 * @syscap SystemCapability.ArkUI.ArkUI.Full 331 * @crossplatform 332 * @form 333 * @since 10 334 */ 335 /** 336 * Transform the current 2D matrix into an inverse matrix (that is, the transformation effect 337 * is the opposite effect of the original) 338 * 339 * @returns { Matrix2D } 340 * @syscap SystemCapability.ArkUI.ArkUI.Full 341 * @crossplatform 342 * @form 343 * @atomicservice 344 * @since 11 345 */ 346 invert(): Matrix2D; 347 348 /** 349 * The matrix is superimposed in right multiplication mode. When the input parameter is empty, 350 * the matrix is superimposed. 351 * 352 * @param { Matrix2D } other - Matrix to be superimposed 353 * @returns { Matrix2D } 354 * @syscap SystemCapability.ArkUI.ArkUI.Full 355 * @since 8 356 */ 357 /** 358 * The matrix is superimposed in right multiplication mode. When the input parameter is empty, 359 * the matrix is superimposed. 360 * 361 * @param { Matrix2D } other - Matrix to be superimposed 362 * @returns { Matrix2D } 363 * @syscap SystemCapability.ArkUI.ArkUI.Full 364 * @form 365 * @since 9 366 * @deprecated since 10 367 */ 368 multiply(other?: Matrix2D): Matrix2D; 369 370 /** 371 * Adds the rotation effect of the X and Y axes to the current matrix. 372 * 373 * @param { number } rx - Rotation effect of the X-axis 374 * @param { number } ry - Rotation effect of the Y-axis 375 * @returns { Matrix2D } 376 * @syscap SystemCapability.ArkUI.ArkUI.Full 377 * @since 8 378 */ 379 /** 380 * Adds the rotation effect of the X and Y axes to the current matrix. 381 * 382 * @param { number } rx - Rotation effect of the X-axis 383 * @param { number } ry - Rotation effect of the Y-axis 384 * @returns { Matrix2D } 385 * @syscap SystemCapability.ArkUI.ArkUI.Full 386 * @form 387 * @since 9 388 * @deprecated since 10 389 * @useinstead rotate 390 */ 391 rotate(rx?: number, ry?: number): Matrix2D; 392 393 /** 394 * Adds the rotation effect of the X and Y axes to the current matrix. 395 * 396 * @param { number } degree - The rotation angle, clockwise in radians. 397 * @param { number } rx - Rotation effect of the X-axis 398 * @param { number } ry - Rotation effect of the Y-axis 399 * @returns { Matrix2D } 400 * @syscap SystemCapability.ArkUI.ArkUI.Full 401 * @crossplatform 402 * @form 403 * @since 10 404 */ 405 /** 406 * Adds the rotation effect of the X and Y axes to the current matrix. 407 * 408 * @param { number } degree - The rotation angle, clockwise in radians. 409 * @param { number } rx - Rotation effect of the X-axis 410 * @param { number } ry - Rotation effect of the Y-axis 411 * @returns { Matrix2D } 412 * @syscap SystemCapability.ArkUI.ArkUI.Full 413 * @crossplatform 414 * @form 415 * @atomicservice 416 * @since 11 417 */ 418 rotate(degree: number, rx?: number, ry?: number): Matrix2D; 419 420 /** 421 * Adds the translation effect of the X and Y axes to the current matrix. 422 * 423 * @param { number } tx - X-axis translation effect 424 * @param { number } ty - Y-axis translation effect 425 * @returns { Matrix2D } 426 * @syscap SystemCapability.ArkUI.ArkUI.Full 427 * @since 8 428 */ 429 /** 430 * Adds the translation effect of the X and Y axes to the current matrix. 431 * 432 * @param { number } tx - X-axis translation effect 433 * @param { number } ty - Y-axis translation effect 434 * @returns { Matrix2D } 435 * @syscap SystemCapability.ArkUI.ArkUI.Full 436 * @form 437 * @since 9 438 */ 439 /** 440 * Adds the translation effect of the X and Y axes to the current matrix. 441 * 442 * @param { number } tx - X-axis translation effect 443 * @param { number } ty - Y-axis translation effect 444 * @returns { Matrix2D } 445 * @syscap SystemCapability.ArkUI.ArkUI.Full 446 * @crossplatform 447 * @form 448 * @since 10 449 */ 450 /** 451 * Adds the translation effect of the X and Y axes to the current matrix. 452 * 453 * @param { number } tx - X-axis translation effect 454 * @param { number } ty - Y-axis translation effect 455 * @returns { Matrix2D } 456 * @syscap SystemCapability.ArkUI.ArkUI.Full 457 * @crossplatform 458 * @form 459 * @atomicservice 460 * @since 11 461 */ 462 translate(tx?: number, ty?: number): Matrix2D; 463 464 /** 465 * Adds the scaling effect of the X and Y axes to the current matrix. 466 * 467 * @param { number } sx - X-axis scaling effect 468 * @param { number } sy - Y-axis scaling effect 469 * @returns { Matrix2D } 470 * @syscap SystemCapability.ArkUI.ArkUI.Full 471 * @since 8 472 */ 473 /** 474 * Adds the scaling effect of the X and Y axes to the current matrix. 475 * 476 * @param { number } sx - X-axis scaling effect 477 * @param { number } sy - Y-axis scaling effect 478 * @returns { Matrix2D } 479 * @syscap SystemCapability.ArkUI.ArkUI.Full 480 * @form 481 * @since 9 482 */ 483 /** 484 * Adds the scaling effect of the X and Y axes to the current matrix. 485 * 486 * @param { number } sx - X-axis scaling effect 487 * @param { number } sy - Y-axis scaling effect 488 * @returns { Matrix2D } 489 * @syscap SystemCapability.ArkUI.ArkUI.Full 490 * @crossplatform 491 * @form 492 * @since 10 493 */ 494 /** 495 * Adds the scaling effect of the X and Y axes to the current matrix. 496 * 497 * @param { number } sx - X-axis scaling effect 498 * @param { number } sy - Y-axis scaling effect 499 * @returns { Matrix2D } 500 * @syscap SystemCapability.ArkUI.ArkUI.Full 501 * @crossplatform 502 * @form 503 * @atomicservice 504 * @since 11 505 */ 506 scale(sx?: number, sy?: number): Matrix2D; 507 508 /** 509 * Constructs a 2D change matrix object. The default value is the unit matrix. 510 * 511 * @syscap SystemCapability.ArkUI.ArkUI.Full 512 * @crossplatform 513 * @form 514 * @since 10 515 */ 516 /** 517 * Constructs a 2D change matrix object. The default value is the unit matrix. 518 * 519 * @syscap SystemCapability.ArkUI.ArkUI.Full 520 * @crossplatform 521 * @form 522 * @atomicservice 523 * @since 11 524 */ 525 constructor(); 526 527 /** 528 * Constructs a 2D change matrix object. The default value is the unit matrix. 529 * 530 * @param { LengthMetricsUnit } [unit] - the unit mode 531 * @syscap SystemCapability.ArkUI.ArkUI.Full 532 * @crossplatform 533 * @form 534 * @atomicservice 535 * @since 12 536 */ 537 constructor(unit: LengthMetricsUnit); 538} 539