/* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Use the DrawableDescriptor class to get drawable image. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ declare type DrawableDescriptor = import ('../api/@ohos.arkui.drawableDescriptor').DrawableDescriptor; /** * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ declare enum ImageRenderMode { /** * Render according to the original image, including colors. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Render according to the original image, including colors. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Render according to the original image, including colors. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ Original, /** * Render the image as a template image, ignoring the color information of the image. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Render the image as a template image, ignoring the color information of the image. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Render the image as a template image, ignoring the color information of the image. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ Template, } /** * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ declare enum ImageInterpolation { /** * Do not use interpolated image data. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Do not use interpolated image data. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Do not use interpolated image data. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ None, /** * Low usage of interpolated image data. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Low usage of interpolated image data. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Low usage of interpolated image data. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ Low, /** * Interpolated image data is used moderately. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Interpolated image data is used moderately. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Interpolated image data is used moderately. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ Medium, /** * High usage of interpolated image data may affect the speed of image rendering. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * High usage of interpolated image data may affect the speed of image rendering. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * High usage of interpolated image data may affect the speed of image rendering. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ High, } /** * @interface ImageInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * @interface ImageInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * @interface ImageInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ interface ImageInterface { /** * Set src to obtain images. * * @param { PixelMap | ResourceStr | DrawableDescriptor } src * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Set src to obtain images * * @param { PixelMap | ResourceStr | DrawableDescriptor } src * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Set src to obtain images * * @param { PixelMap | ResourceStr | DrawableDescriptor } src * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ (src: PixelMap | ResourceStr | DrawableDescriptor): ImageAttribute; } /** * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ declare class ImageAttribute extends CommonMethod { /** * Placeholder displayed on load * * @param { string | Resource } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Placeholder displayed on load * * @param { string | Resource } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Placeholder displayed on load * * @param { string | Resource } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ alt(value: string | Resource): ImageAttribute; /** * match Text Direction * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * match Text Direction * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * match Text Direction * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ matchTextDirection(value: boolean): ImageAttribute; /** * Indicates whether the image follows the text direction. * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Indicates whether the image follows the text direction. * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Indicates whether the image follows the text direction. * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ fitOriginalSize(value: boolean): ImageAttribute; /** * fill Color * * @param { ResourceColor } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * fill Color * * @param { ResourceColor } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * fill Color * * @param { ResourceColor } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ fillColor(value: ResourceColor): ImageAttribute; /** * Sets the zoom type of an image. * * @param { ImageFit } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Sets the zoom type of an image. * * @param { ImageFit } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Sets the zoom type of an image. * * @param { ImageFit } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ objectFit(value: ImageFit): ImageAttribute; /** * Set the repeat style of the picture * * @param { ImageRepeat } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Set the repeat style of the picture * * @param { ImageRepeat } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Set the repeat style of the picture * * @param { ImageRepeat } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ objectRepeat(value: ImageRepeat): ImageAttribute; /** * Set the auto style of the picture * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Set the auto style of the picture * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Set the auto style of the picture * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ autoResize(value: boolean): ImageAttribute; /** * Sets the image rendering mode. * * @param { ImageRenderMode } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Sets the image rendering mode. * * @param { ImageRenderMode } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Sets the image rendering mode. * * @param { ImageRenderMode } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ renderMode(value: ImageRenderMode): ImageAttribute; /** * Sets the interpolation effect of an image. The interpolation effect is only magnified for the image. * * @param { ImageInterpolation } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Sets the interpolation effect of an image. The interpolation effect is only magnified for the image. * * @param { ImageInterpolation } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Sets the interpolation effect of an image. The interpolation effect is only magnified for the image. * * @param { ImageInterpolation } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ interpolation(value: ImageInterpolation): ImageAttribute; /** * Specifies the picture decoding size. * The original picture is decoded into a picture of a specified size. The unit of the number type is px. * * @param { object } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Specifies the picture decoding size. * The original picture is decoded into a picture of a specified size. The unit of the number type is px. * * @param { object } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Specifies the picture decoding size. * The original picture is decoded into a picture of a specified size. The unit of the number type is px. * * @param { object } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ sourceSize(value: { width: number; height: number }): ImageAttribute; /** * Sets the synchronous or asynchronous mode for image loading. * The default parameter type is bool, and the default value is false. * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Sets the synchronous or asynchronous mode for image loading. * The default parameter type is bool, and the default value is false. * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Sets the synchronous or asynchronous mode for image loading. * The default parameter type is bool, and the default value is false. * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ syncLoad(value: boolean): ImageAttribute; /** * Sets the color filter effect on the image. * * @param { ColorFilter } value ColorFilter object. * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Sets the color filter effect on the image. * * @param { ColorFilter } value ColorFilter object. * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ colorFilter(value: ColorFilter): ImageAttribute; /** * Allow replication. * * @param { CopyOptions } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Allow replication. * * @param { CopyOptions } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ copyOption(value: CopyOptions): ImageAttribute; /** * Enable image dragging. * Default value is false. * * @param { boolean } value * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ draggable(value: boolean): ImageAttribute; /** * This callback is triggered when an image is successfully loaded. * The size of the image source that is successfully loaded is returned, in pixels. * * @param { function } callback * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * This callback is triggered when an image is successfully loaded. * The size of the image source that is successfully loaded is returned, in pixels. * * @param { function } callback * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * This callback is triggered when an image is successfully loaded. * The size of the image source that is successfully loaded is returned, in pixels. * * @param { function } callback * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ onComplete( callback: (event?: { width: number; height: number; componentWidth: number; componentHeight: number; loadingStatus: number; contentWidth: number; contentHeight: number; contentOffsetX: number; contentOffsetY: number; }) => void, ): ImageAttribute; /** * This callback is triggered when an exception occurs during image loading. * * @param { function } callback * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * This callback is triggered when an exception occurs during image loading. * * @param { function } callback * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * This callback is triggered when an exception occurs during image loading. * * @param { function } callback * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ onError(callback: (event: { /** * Component width. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ componentWidth: number; /** * Component height. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ componentHeight: number }) => void): ImageAttribute; /** * This callback is triggered when an exception occurs during image loading. * The field of "message" carries the detailed information of failed image loading. * * @param { function } callback * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * This callback is triggered when an exception occurs during image loading. * The field of "message" carries the detailed information of failed image loading. * * @param { function } callback * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ onError(callback: (event: { /** * Component width. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ componentWidth: number; /** * Component height. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ componentHeight: number; /** * Message. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ message: string }) => void): ImageAttribute; /** * When the loaded source file is a svg image, this callback is triggered when the playback of the svg image is complete. * If the svg image is a wireless loop image, this callback is not triggered. * * @param { function } event * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * When the loaded source file is a svg image, this callback is triggered when the playback of the svg image is complete. * If the svg image is a wireless loop image, this callback is not triggered. * * @param { function } event * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * When the loaded source file is a svg image, this callback is triggered when the playback of the svg image is complete. * If the svg image is a wireless loop image, this callback is not triggered. * * @param { function } event * @returns { ImageAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ onFinish(event: () => void): ImageAttribute; } /** * Defines Image Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines Image Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Defines Image Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ declare const Image: ImageInterface; /** * Defines Image Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines Image Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @form */ /** * Defines Image Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 * @form */ declare const ImageInstance: ImageAttribute;