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 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 */ 36export class DrawableDescriptor { 37 /** 38 * Creates a new DrawableDescriptor. 39 * 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @systemapi Hide this for inner system use. 42 * @since 10 43 */ 44 constructor(); 45 46 /** 47 * Get pixelMap of drawable image. 48 * 49 * @returns { image.PixelMap } Return the PixelMap of the calling DrawableDescriptor object. 50 * @syscap SystemCapability.ArkUI.ArkUI.Full 51 * @since 10 52 */ 53 /** 54 * Get pixelMap of drawable image. 55 * 56 * @returns { image.PixelMap } Return the PixelMap of the calling DrawableDescriptor object. 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @atomicservice 59 * @since 11 60 */ 61 getPixelMap(): image.PixelMap; 62} 63 64/** 65 * Use the LayeredDrawableDescriptor class to get the foreground, the background and the mask DrawableDescriptor. 66 * 67 * @extends DrawableDescriptor 68 * @syscap SystemCapability.ArkUI.ArkUI.Full 69 * @since 10 70 */ 71/** 72 * Use the LayeredDrawableDescriptor class to get the foreground, the background and the mask DrawableDescriptor. 73 * 74 * @extends DrawableDescriptor 75 * @syscap SystemCapability.ArkUI.ArkUI.Full 76 * @atomicservice 77 * @since 11 78 */ 79export class LayeredDrawableDescriptor extends DrawableDescriptor { 80 /** 81 * Creates a new LayeredDrawableDescriptor. 82 * 83 * @param { DrawableDescriptor } [foreground] - Indicates the foreground option to create LayeredDrawableDescriptor. 84 * @param { DrawableDescriptor } [background] - Indicates the background option to create LayeredDrawableDescriptor. 85 * @param { DrawableDescriptor } [mask] - Indicates the mask option to create LayeredDrawableDescriptor. 86 * @syscap SystemCapability.ArkUI.ArkUI.Full 87 * @since 12 88 */ 89 constructor( 90 foreground?: DrawableDescriptor, 91 background?: DrawableDescriptor, 92 mask?: DrawableDescriptor 93 ); 94 95 /** 96 * Get DrawableDescriptor for the foreground. 97 * 98 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of foreground. 99 * @syscap SystemCapability.ArkUI.ArkUI.Full 100 * @since 10 101 */ 102 /** 103 * Get DrawableDescriptor for the foreground. 104 * 105 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of foreground. 106 * @syscap SystemCapability.ArkUI.ArkUI.Full 107 * @atomicservice 108 * @since 11 109 */ 110 getForeground(): DrawableDescriptor; 111 112 /** 113 * Get DrawableDescriptor for the background. 114 * 115 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of background. 116 * @syscap SystemCapability.ArkUI.ArkUI.Full 117 * @since 10 118 */ 119 /** 120 * Get DrawableDescriptor for the background. 121 * 122 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of background. 123 * @syscap SystemCapability.ArkUI.ArkUI.Full 124 * @atomicservice 125 * @since 11 126 */ 127 getBackground(): DrawableDescriptor; 128 129 /** 130 * Get DrawableDescriptor for the mask. 131 * 132 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of mask. 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @since 10 135 */ 136 /** 137 * Get DrawableDescriptor for the mask. 138 * 139 * @returns { DrawableDescriptor } Return the DrawableDescriptor object of mask. 140 * @syscap SystemCapability.ArkUI.ArkUI.Full 141 * @atomicservice 142 * @since 11 143 */ 144 getMask(): DrawableDescriptor; 145 146 147 /** 148 * Get the clip path info of the adaptive icon mask. 149 * 150 * @returns { string } Return the clip path info of mask. 151 * @syscap SystemCapability.ArkUI.ArkUI.Full 152 * @since 10 153 */ 154 /** 155 * Get the clip path info of the adaptive icon mask. 156 * 157 * @returns { string } Return the clip path info of mask. 158 * @syscap SystemCapability.ArkUI.ArkUI.Full 159 * @atomicservice 160 * @since 11 161 */ 162 static getMaskClipPath(): string; 163} 164 165/** 166 * Use the PixelMapDrawableDescriptor class to get the resource of pixelmap or resource descriptor information. 167 * 168 * @extends DrawableDescriptor 169 * @syscap SystemCapability.ArkUI.ArkUI.Full 170 * @since 12 171 */ 172export class PixelMapDrawableDescriptor extends DrawableDescriptor { 173 /** 174 * Creates a new PixelMapDrawableDescriptor. 175 * @param { image.PixelMap } src - Indicates the resource to create PixelMapDrawableDescriptor. 176 * @syscap SystemCapability.ArkUI.ArkUI.Full 177 * @since 12 178 */ 179 constructor(src?: image.PixelMap); 180} 181 182/** 183 * Animation control options 184 * 185 * @interface AnimationOptions 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @crossplatform 188 * @since 12 189 */ 190declare interface AnimationOptions { 191 /** 192 * The duration of animation playback once. 193 * 194 * @type { ?number } 195 * @syscap SystemCapability.ArkUI.ArkUI.Full 196 * @crossplatform 197 * @since 12 198 */ 199 duration?: number; 200 /** 201 * Animation playback times. 202 * 203 * @type { ?number } 204 * @syscap SystemCapability.ArkUI.ArkUI.Full 205 * @crossplatform 206 * @since 12 207 */ 208 iterations?: number; 209} 210 211/** 212 * Define the data structure for PixelMap animations. 213 * 214 * @extends DrawableDescriptor 215 * @syscap SystemCapability.ArkUI.ArkUI.Full 216 * @crossplatform 217 * @since 12 218 */ 219export class AnimatedDrawableDescriptor extends DrawableDescriptor { 220 /** 221 * Creates a new AnimatedDrawableDescriptor. 222 * 223 * @param { Array<image.PixelMap> } pixelMaps - PixelMap List. 224 * @param { AnimationOptions } [options] - Animation control options. 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @crossplatform 227 * @since 12 228 */ 229 constructor(pixelMaps: Array<image.PixelMap>, options?: AnimationOptions); 230} 231