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