1/* 2 * Copyright (c) 2023-2024 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 21import image from './@ohos.multimedia.image'; 22 23/** 24 * Use the DrawableDescriptor class to get drawable image. 25 * 26 * @syscap SystemCapability.ArkUI.ArkUI.Full 27 * @since 10 28 */ 29/** 30 * Use the DrawableDescriptor class to get drawable image. 31 * 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @atomicservice 34 * @since 11 35 */ 36/** 37 * Use the DrawableDescriptor class to get drawable image. 38 * 39 * @syscap SystemCapability.ArkUI.ArkUI.Full 40 * @crossplatform 41 * @atomicservice 42 * @since 12 43 */ 44export class DrawableDescriptor { 45 /** 46 * Creates a new DrawableDescriptor. 47 * 48 * @syscap SystemCapability.ArkUI.ArkUI.Full 49 * @systemapi Hide this for inner system use. 50 * @since 10 51 */ 52 constructor(); 53 54 /** 55 * Get pixelMap of drawable image. 56 * 57 * @returns { image.PixelMap } Return the PixelMap of the calling DrawableDescriptor object. 58 * @syscap SystemCapability.ArkUI.ArkUI.Full 59 * @since 10 60 */ 61 /** 62 * Get pixelMap of drawable image. 63 * 64 * @returns { image.PixelMap } Return the PixelMap of the calling DrawableDescriptor object. 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @atomicservice 67 * @since 11 68 */ 69 /** 70 * Get pixelMap of drawable image. 71 * 72 * @returns { image.PixelMap } Return the PixelMap of the calling DrawableDescriptor object. 73 * @syscap SystemCapability.ArkUI.ArkUI.Full 74 * @crossplatform 75 * @atomicservice 76 * @since 12 77 */ 78 getPixelMap(): image.PixelMap; 79} 80 81/** 82 * Use the LayeredDrawableDescriptor class to get the foreground, the background and the mask DrawableDescriptor. 83 * 84 * @extends DrawableDescriptor 85 * @syscap SystemCapability.ArkUI.ArkUI.Full 86 * @since 10 87 */ 88/** 89 * Use the LayeredDrawableDescriptor class to get the foreground, the background and the mask DrawableDescriptor. 90 * 91 * @extends DrawableDescriptor 92 * @syscap SystemCapability.ArkUI.ArkUI.Full 93 * @atomicservice 94 * @since 11 95 */ 96/** 97 * Use the LayeredDrawableDescriptor class to get the foreground, the background and the mask DrawableDescriptor. 98 * 99 * @extends DrawableDescriptor 100 * @syscap SystemCapability.ArkUI.ArkUI.Full 101 * @crossplatform 102 * @atomicservice 103 * @since 12 104 */ 105export class LayeredDrawableDescriptor extends DrawableDescriptor { 106 /** 107 * Creates a new LayeredDrawableDescriptor. 108 * 109 * @param { DrawableDescriptor } [foreground] - Indicates the foreground option to create LayeredDrawableDescriptor. 110 * @param { DrawableDescriptor } [background] - Indicates the background option to create LayeredDrawableDescriptor. 111 * @param { DrawableDescriptor } [mask] - Indicates the mask option to create LayeredDrawableDescriptor. 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @atomicservice 114 * @since 12 115 */ 116 constructor( 117 foreground?: DrawableDescriptor, 118 background?: DrawableDescriptor, 119 mask?: DrawableDescriptor 120 ); 121 122 /** 123 * Get DrawableDescriptor for the foreground. 124 * 125 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of foreground. 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @since 10 128 */ 129 /** 130 * Get DrawableDescriptor for the foreground. 131 * 132 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of foreground. 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @atomicservice 135 * @since 11 136 */ 137 /** 138 * Get DrawableDescriptor for the foreground. 139 * 140 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of foreground. 141 * @syscap SystemCapability.ArkUI.ArkUI.Full 142 * @crossplatform 143 * @atomicservice 144 * @since 12 145 */ 146 getForeground(): DrawableDescriptor; 147 148 /** 149 * Get DrawableDescriptor for the background. 150 * 151 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of background. 152 * @syscap SystemCapability.ArkUI.ArkUI.Full 153 * @since 10 154 */ 155 /** 156 * Get DrawableDescriptor for the background. 157 * 158 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of background. 159 * @syscap SystemCapability.ArkUI.ArkUI.Full 160 * @atomicservice 161 * @since 11 162 */ 163 /** 164 * Get DrawableDescriptor for the background. 165 * 166 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of background. 167 * @syscap SystemCapability.ArkUI.ArkUI.Full 168 * @crossplatform 169 * @atomicservice 170 * @since 12 171 */ 172 getBackground(): DrawableDescriptor; 173 174 /** 175 * Get DrawableDescriptor for the mask. 176 * 177 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of mask. 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @since 10 180 */ 181 /** 182 * Get DrawableDescriptor for the mask. 183 * 184 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of mask. 185 * @syscap SystemCapability.ArkUI.ArkUI.Full 186 * @atomicservice 187 * @since 11 188 */ 189 /** 190 * Get DrawableDescriptor for the mask. 191 * 192 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of mask. 193 * @syscap SystemCapability.ArkUI.ArkUI.Full 194 * @crossplatform 195 * @atomicservice 196 * @since 12 197 */ 198 getMask(): DrawableDescriptor; 199 200 201 /** 202 * Get the clip path info of the adaptive icon mask. 203 * 204 * @returns { string } Return the clip path info of mask. 205 * @syscap SystemCapability.ArkUI.ArkUI.Full 206 * @since 10 207 */ 208 /** 209 * Get the clip path info of the adaptive icon mask. 210 * 211 * @returns { string } Return the clip path info of mask. 212 * @syscap SystemCapability.ArkUI.ArkUI.Full 213 * @atomicservice 214 * @since 11 215 */ 216 /** 217 * Get the clip path info of the adaptive icon mask. 218 * 219 * @returns { string } Return the clip path info of mask. 220 * @syscap SystemCapability.ArkUI.ArkUI.Full 221 * @crossplatform 222 * @atomicservice 223 * @since 12 224 */ 225 static getMaskClipPath(): string; 226} 227 228/** 229 * Use the PixelMapDrawableDescriptor class to get the resource of pixelmap or resource descriptor information. 230 * 231 * @extends DrawableDescriptor 232 * @syscap SystemCapability.ArkUI.ArkUI.Full 233 * @atomicservice 234 * @since 12 235 */ 236export class PixelMapDrawableDescriptor extends DrawableDescriptor { 237 /** 238 * Creates a new PixelMapDrawableDescriptor. 239 * @param { image.PixelMap } src - Indicates the resource to create PixelMapDrawableDescriptor. 240 * @syscap SystemCapability.ArkUI.ArkUI.Full 241 * @atomicservice 242 * @since 12 243 */ 244 constructor(src?: image.PixelMap); 245} 246 247/** 248 * Animation control options 249 * 250 * @interface AnimationOptions 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @crossplatform 253 * @atomicservice 254 * @since 12 255 */ 256declare interface AnimationOptions { 257 /** 258 * The duration of animation playback once. 259 * 260 * @type { ?number } 261 * @syscap SystemCapability.ArkUI.ArkUI.Full 262 * @crossplatform 263 * @atomicservice 264 * @since 12 265 */ 266 duration?: number; 267 /** 268 * Animation playback times. 269 * 270 * @type { ?number } 271 * @syscap SystemCapability.ArkUI.ArkUI.Full 272 * @crossplatform 273 * @atomicservice 274 * @since 12 275 */ 276 iterations?: number; 277} 278 279/** 280 * Define the data structure for PixelMap animations. 281 * 282 * @extends DrawableDescriptor 283 * @syscap SystemCapability.ArkUI.ArkUI.Full 284 * @crossplatform 285 * @atomicservice 286 * @since 12 287 */ 288export class AnimatedDrawableDescriptor extends DrawableDescriptor { 289 /** 290 * Creates a new AnimatedDrawableDescriptor. 291 * 292 * @param { Array<image.PixelMap> } pixelMaps - PixelMap List. 293 * @param { AnimationOptions } [options] - Animation control options. 294 * @syscap SystemCapability.ArkUI.ArkUI.Full 295 * @crossplatform 296 * @atomicservice 297 * @since 12 298 */ 299 constructor(pixelMaps: Array<image.PixelMap>, options?: AnimationOptions); 300} 301