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