161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkUI 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ci/** 2261847f8eSopenharmony_ci * Provide image decoration in the text component. 2361847f8eSopenharmony_ci * 2461847f8eSopenharmony_ci * @interface ImageSpanInterface 2561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 2661847f8eSopenharmony_ci * @crossplatform 2761847f8eSopenharmony_ci * @since 10 2861847f8eSopenharmony_ci */ 2961847f8eSopenharmony_ci/** 3061847f8eSopenharmony_ci * Provide image decoration in the text component. 3161847f8eSopenharmony_ci * 3261847f8eSopenharmony_ci * @interface ImageSpanInterface 3361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3461847f8eSopenharmony_ci * @crossplatform 3561847f8eSopenharmony_ci * @atomicservice 3661847f8eSopenharmony_ci * @since 11 3761847f8eSopenharmony_ci */ 3861847f8eSopenharmony_ciinterface ImageSpanInterface { 3961847f8eSopenharmony_ci /** 4061847f8eSopenharmony_ci * Called when image is entered in span. 4161847f8eSopenharmony_ci * 4261847f8eSopenharmony_ci * @param { ResourceStr | PixelMap } value - The image resource. 4361847f8eSopenharmony_ci * @returns { ImageSpanAttribute } The attribute of the image span. 4461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 4561847f8eSopenharmony_ci * @crossplatform 4661847f8eSopenharmony_ci * @since 10 4761847f8eSopenharmony_ci */ 4861847f8eSopenharmony_ci /** 4961847f8eSopenharmony_ci * Called when image is entered in span. 5061847f8eSopenharmony_ci * 5161847f8eSopenharmony_ci * @param { ResourceStr | PixelMap } value - The image resource. 5261847f8eSopenharmony_ci * @returns { ImageSpanAttribute } The attribute of the image span. 5361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 5461847f8eSopenharmony_ci * @crossplatform 5561847f8eSopenharmony_ci * @atomicservice 5661847f8eSopenharmony_ci * @since 11 5761847f8eSopenharmony_ci */ 5861847f8eSopenharmony_ci (value: ResourceStr | PixelMap): ImageSpanAttribute; 5961847f8eSopenharmony_ci} 6061847f8eSopenharmony_ci 6161847f8eSopenharmony_ci/** 6261847f8eSopenharmony_ci * Define the ImageSpan attribute functions. 6361847f8eSopenharmony_ci * 6461847f8eSopenharmony_ci * @extends CommonMethod<ImageSpanAttribute> 6561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 6661847f8eSopenharmony_ci * @crossplatform 6761847f8eSopenharmony_ci * @since 10 6861847f8eSopenharmony_ci */ 6961847f8eSopenharmony_ci/** 7061847f8eSopenharmony_ci * Define the ImageSpan attribute functions. 7161847f8eSopenharmony_ci * 7261847f8eSopenharmony_ci * @extends BaseSpan<ImageSpanAttribute> 7361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 7461847f8eSopenharmony_ci * @crossplatform 7561847f8eSopenharmony_ci * @atomicservice 7661847f8eSopenharmony_ci * @since 11 7761847f8eSopenharmony_ci */ 7861847f8eSopenharmony_cideclare class ImageSpanAttribute extends BaseSpan<ImageSpanAttribute> { 7961847f8eSopenharmony_ci /** 8061847f8eSopenharmony_ci * Called when the alignment of image span is set. 8161847f8eSopenharmony_ci * 8261847f8eSopenharmony_ci * @param { ImageSpanAlignment } value - The alignment type of image span. 8361847f8eSopenharmony_ci * @returns { ImageSpanAttribute } The attribute of the image span. 8461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 8561847f8eSopenharmony_ci * @crossplatform 8661847f8eSopenharmony_ci * @since 10 8761847f8eSopenharmony_ci */ 8861847f8eSopenharmony_ci /** 8961847f8eSopenharmony_ci * Called when the alignment of image span is set. 9061847f8eSopenharmony_ci * 9161847f8eSopenharmony_ci * @param { ImageSpanAlignment } value - The alignment type of image span. 9261847f8eSopenharmony_ci * @returns { ImageSpanAttribute } The attribute of the image span. 9361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 9461847f8eSopenharmony_ci * @crossplatform 9561847f8eSopenharmony_ci * @atomicservice 9661847f8eSopenharmony_ci * @since 11 9761847f8eSopenharmony_ci */ 9861847f8eSopenharmony_ci verticalAlign(value: ImageSpanAlignment): ImageSpanAttribute; 9961847f8eSopenharmony_ci 10061847f8eSopenharmony_ci /** 10161847f8eSopenharmony_ci * Sets the color filter effect on the image span. 10261847f8eSopenharmony_ci * 10361847f8eSopenharmony_ci * @param { ColorFilter | DrawingColorFilter } filter ColorFilter object. 10461847f8eSopenharmony_ci * @returns { ImageSpanAttribute } The attribute of the image span. 10561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 10661847f8eSopenharmony_ci * @crossplatform 10761847f8eSopenharmony_ci * @atomicservice 10861847f8eSopenharmony_ci * @since 13 10961847f8eSopenharmony_ci */ 11061847f8eSopenharmony_ci colorFilter(filter: ColorFilter | DrawingColorFilter): ImageSpanAttribute; 11161847f8eSopenharmony_ci 11261847f8eSopenharmony_ci /** 11361847f8eSopenharmony_ci * Sets the zoom type of an image. 11461847f8eSopenharmony_ci * 11561847f8eSopenharmony_ci * @param { ImageFit } value - Image display mode. 11661847f8eSopenharmony_ci * @returns { ImageSpanAttribute } The attribute of the image span. 11761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 11861847f8eSopenharmony_ci * @crossplatform 11961847f8eSopenharmony_ci * @since 10 12061847f8eSopenharmony_ci */ 12161847f8eSopenharmony_ci /** 12261847f8eSopenharmony_ci * Sets the zoom type of an image. 12361847f8eSopenharmony_ci * 12461847f8eSopenharmony_ci * @param { ImageFit } value - Image display mode. 12561847f8eSopenharmony_ci * @returns { ImageSpanAttribute } The attribute of the image span. 12661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 12761847f8eSopenharmony_ci * @crossplatform 12861847f8eSopenharmony_ci * @atomicservice 12961847f8eSopenharmony_ci * @since 11 13061847f8eSopenharmony_ci */ 13161847f8eSopenharmony_ci objectFit(value: ImageFit): ImageSpanAttribute; 13261847f8eSopenharmony_ci 13361847f8eSopenharmony_ci /** 13461847f8eSopenharmony_ci * Sets a callback which is triggered when the image is successfully loaded. 13561847f8eSopenharmony_ci * The size of the image source that is successfully loaded is returned, in pixels. 13661847f8eSopenharmony_ci * 13761847f8eSopenharmony_ci * @param { ImageCompleteCallback } callback - Triggered when the image is successfully loaded. 13861847f8eSopenharmony_ci * @returns { ImageSpanAttribute } The attribute of the image span. 13961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 14061847f8eSopenharmony_ci * @crossplatform 14161847f8eSopenharmony_ci * @atomicservice 14261847f8eSopenharmony_ci * @since 12 14361847f8eSopenharmony_ci */ 14461847f8eSopenharmony_ci onComplete(callback: ImageCompleteCallback): ImageSpanAttribute; 14561847f8eSopenharmony_ci 14661847f8eSopenharmony_ci /** 14761847f8eSopenharmony_ci * Sets a callback which is triggered when an exception occurs during image loading. 14861847f8eSopenharmony_ci * The field of "message" returned in the callback carries the detailed information of failed image loading. 14961847f8eSopenharmony_ci * 15061847f8eSopenharmony_ci * @param { ImageErrorCallback } callback - Triggered when an exception occurs during image loading. 15161847f8eSopenharmony_ci * @returns { ImageSpanAttribute } The attribute of the image span. 15261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 15361847f8eSopenharmony_ci * @crossplatform 15461847f8eSopenharmony_ci * @atomicservice 15561847f8eSopenharmony_ci * @since 12 15661847f8eSopenharmony_ci */ 15761847f8eSopenharmony_ci onError(callback: ImageErrorCallback): ImageSpanAttribute; 15861847f8eSopenharmony_ci 15961847f8eSopenharmony_ci /** 16061847f8eSopenharmony_ci * Placeholder displayed on load 16161847f8eSopenharmony_ci * 16261847f8eSopenharmony_ci * @param { PixelMap } value 16361847f8eSopenharmony_ci * @returns { ImageSpanAttribute } 16461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 16561847f8eSopenharmony_ci * @atomicservice 16661847f8eSopenharmony_ci * @since 12 16761847f8eSopenharmony_ci */ 16861847f8eSopenharmony_ci alt(value: PixelMap): ImageSpanAttribute; 16961847f8eSopenharmony_ci} 17061847f8eSopenharmony_ci 17161847f8eSopenharmony_ci/** 17261847f8eSopenharmony_ci * Defines ImageSpan Component instance. 17361847f8eSopenharmony_ci * 17461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 17561847f8eSopenharmony_ci * @crossplatform 17661847f8eSopenharmony_ci * @since 10 17761847f8eSopenharmony_ci */ 17861847f8eSopenharmony_ci/** 17961847f8eSopenharmony_ci * Defines ImageSpan Component instance. 18061847f8eSopenharmony_ci * 18161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 18261847f8eSopenharmony_ci * @crossplatform 18361847f8eSopenharmony_ci * @atomicservice 18461847f8eSopenharmony_ci * @since 11 18561847f8eSopenharmony_ci */ 18661847f8eSopenharmony_cideclare const ImageSpan: ImageSpanInterface; 18761847f8eSopenharmony_ci 18861847f8eSopenharmony_ci/** 18961847f8eSopenharmony_ci * Defines ImageSpan Component. 19061847f8eSopenharmony_ci * 19161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 19261847f8eSopenharmony_ci * @crossplatform 19361847f8eSopenharmony_ci * @since 10 19461847f8eSopenharmony_ci */ 19561847f8eSopenharmony_ci/** 19661847f8eSopenharmony_ci * Defines ImageSpan Component. 19761847f8eSopenharmony_ci * 19861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 19961847f8eSopenharmony_ci * @crossplatform 20061847f8eSopenharmony_ci * @atomicservice 20161847f8eSopenharmony_ci * @since 11 20261847f8eSopenharmony_ci */ 20361847f8eSopenharmony_cideclare const ImageSpanInstance: ImageSpanAttribute; 20461847f8eSopenharmony_ci 20561847f8eSopenharmony_ci/** 20661847f8eSopenharmony_ci * Callback function triggered when the image is successfully loaded. 20761847f8eSopenharmony_ci * 20861847f8eSopenharmony_ci * @typedef { function } ImageCompleteCallback 20961847f8eSopenharmony_ci * @param { ImageLoadResult } result - the information about the successfully loaded image. 21061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 21161847f8eSopenharmony_ci * @crossplatform 21261847f8eSopenharmony_ci * @atomicservice 21361847f8eSopenharmony_ci * @since 12 21461847f8eSopenharmony_ci */ 21561847f8eSopenharmony_citype ImageCompleteCallback = (result: ImageLoadResult) => void; 21661847f8eSopenharmony_ci 21761847f8eSopenharmony_ci/** 21861847f8eSopenharmony_ci * The information about the successfully loaded image. 21961847f8eSopenharmony_ci * 22061847f8eSopenharmony_ci * @interface ImageLoadResult 22161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 22261847f8eSopenharmony_ci * @crossplatform 22361847f8eSopenharmony_ci * @atomicservice 22461847f8eSopenharmony_ci * @since 12 22561847f8eSopenharmony_ci */ 22661847f8eSopenharmony_cideclare interface ImageLoadResult { 22761847f8eSopenharmony_ci /** 22861847f8eSopenharmony_ci * The width of the image source. 22961847f8eSopenharmony_ci * 23061847f8eSopenharmony_ci * @type { number } 23161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 23261847f8eSopenharmony_ci * @crossplatform 23361847f8eSopenharmony_ci * @atomicservice 23461847f8eSopenharmony_ci * @since 12 23561847f8eSopenharmony_ci */ 23661847f8eSopenharmony_ci width: number; 23761847f8eSopenharmony_ci /** 23861847f8eSopenharmony_ci * The height of the image source. 23961847f8eSopenharmony_ci * 24061847f8eSopenharmony_ci * @type { number } 24161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 24261847f8eSopenharmony_ci * @crossplatform 24361847f8eSopenharmony_ci * @atomicservice 24461847f8eSopenharmony_ci * @since 12 24561847f8eSopenharmony_ci */ 24661847f8eSopenharmony_ci height: number; 24761847f8eSopenharmony_ci /** 24861847f8eSopenharmony_ci * The width of the component source. 24961847f8eSopenharmony_ci * 25061847f8eSopenharmony_ci * @type { number } 25161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 25261847f8eSopenharmony_ci * @crossplatform 25361847f8eSopenharmony_ci * @atomicservice 25461847f8eSopenharmony_ci * @since 12 25561847f8eSopenharmony_ci */ 25661847f8eSopenharmony_ci componentWidth: number; 25761847f8eSopenharmony_ci /** 25861847f8eSopenharmony_ci * The height of the component source. 25961847f8eSopenharmony_ci * 26061847f8eSopenharmony_ci * @type { number } 26161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 26261847f8eSopenharmony_ci * @crossplatform 26361847f8eSopenharmony_ci * @atomicservice 26461847f8eSopenharmony_ci * @since 12 26561847f8eSopenharmony_ci */ 26661847f8eSopenharmony_ci componentHeight: number; 26761847f8eSopenharmony_ci /** 26861847f8eSopenharmony_ci * The value of the status of the image being loaded successfully. 26961847f8eSopenharmony_ci * If the returned status value is 0, the image data is successfully loaded. 27061847f8eSopenharmony_ci * If the returned status value is 1, the image is successfully decoded. 27161847f8eSopenharmony_ci * 27261847f8eSopenharmony_ci * @type { number } 27361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 27461847f8eSopenharmony_ci * @crossplatform 27561847f8eSopenharmony_ci * @atomicservice 27661847f8eSopenharmony_ci * @since 12 27761847f8eSopenharmony_ci */ 27861847f8eSopenharmony_ci loadingStatus: number; 27961847f8eSopenharmony_ci /** 28061847f8eSopenharmony_ci * The width of the picture that is actually drawn. 28161847f8eSopenharmony_ci * 28261847f8eSopenharmony_ci * @type { number } 28361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 28461847f8eSopenharmony_ci * @crossplatform 28561847f8eSopenharmony_ci * @atomicservice 28661847f8eSopenharmony_ci * @since 12 28761847f8eSopenharmony_ci */ 28861847f8eSopenharmony_ci contentWidth: number; 28961847f8eSopenharmony_ci /** 29061847f8eSopenharmony_ci * The height of the picture that is actually drawn. 29161847f8eSopenharmony_ci * 29261847f8eSopenharmony_ci * @type { number } 29361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 29461847f8eSopenharmony_ci * @crossplatform 29561847f8eSopenharmony_ci * @atomicservice 29661847f8eSopenharmony_ci * @since 12 29761847f8eSopenharmony_ci */ 29861847f8eSopenharmony_ci contentHeight: number; 29961847f8eSopenharmony_ci /** 30061847f8eSopenharmony_ci * The offset between image content and image component on the X-axis. 30161847f8eSopenharmony_ci * 30261847f8eSopenharmony_ci * @type { number } 30361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 30461847f8eSopenharmony_ci * @crossplatform 30561847f8eSopenharmony_ci * @atomicservice 30661847f8eSopenharmony_ci * @since 12 30761847f8eSopenharmony_ci */ 30861847f8eSopenharmony_ci contentOffsetX: number; 30961847f8eSopenharmony_ci /** 31061847f8eSopenharmony_ci * The offset between image content and image component on the Y-axis. 31161847f8eSopenharmony_ci * 31261847f8eSopenharmony_ci * @type { number } 31361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 31461847f8eSopenharmony_ci * @crossplatform 31561847f8eSopenharmony_ci * @atomicservice 31661847f8eSopenharmony_ci * @since 12 31761847f8eSopenharmony_ci */ 31861847f8eSopenharmony_ci contentOffsetY: number; 31961847f8eSopenharmony_ci} 320