161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (C) 2024 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 ImageKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport { AsyncCallback } from './@ohos.base';
2261847f8eSopenharmony_ciimport type colorSpaceManager from './@ohos.graphics.colorSpaceManager';
2361847f8eSopenharmony_ciimport type image from './@ohos.multimedia.image';
2461847f8eSopenharmony_ciimport type resourceManager from './@ohos.resourceManager';
2561847f8eSopenharmony_ciimport type rpc from './@ohos.rpc';
2661847f8eSopenharmony_ciimport lang from '../arkts/@arkts.lang';
2761847f8eSopenharmony_ciimport collections from '../arkts/@arkts.collections';
2861847f8eSopenharmony_ci /**
2961847f8eSopenharmony_ci * This module provides the capability of image codec and access
3061847f8eSopenharmony_ci * @namespace sendableImage
3161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.Image.Core
3261847f8eSopenharmony_ci * @crossplatform
3361847f8eSopenharmony_ci * @atomicservice
3461847f8eSopenharmony_ci * @since 12
3561847f8eSopenharmony_ci */
3661847f8eSopenharmony_cideclare namespace sendableImage {
3761847f8eSopenharmony_ci
3861847f8eSopenharmony_ci /**
3961847f8eSopenharmony_ci   * Describes the size of an image.
4061847f8eSopenharmony_ci   *
4161847f8eSopenharmony_ci   * @typedef Size
4261847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
4361847f8eSopenharmony_ci   * @crossplatform
4461847f8eSopenharmony_ci   * @form
4561847f8eSopenharmony_ci   * @atomicservice
4661847f8eSopenharmony_ci   * @since 12
4761847f8eSopenharmony_ci   */
4861847f8eSopenharmony_ci interface Size extends lang.ISendable {
4961847f8eSopenharmony_ci  /**
5061847f8eSopenharmony_ci   * Height
5161847f8eSopenharmony_ci   *
5261847f8eSopenharmony_ci   * @type { number }
5361847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
5461847f8eSopenharmony_ci   * @crossplatform
5561847f8eSopenharmony_ci   * @form
5661847f8eSopenharmony_ci   * @atomicservice
5761847f8eSopenharmony_ci   * @since 12
5861847f8eSopenharmony_ci   */
5961847f8eSopenharmony_ci  height: number;
6061847f8eSopenharmony_ci
6161847f8eSopenharmony_ci  /**
6261847f8eSopenharmony_ci   * Width
6361847f8eSopenharmony_ci   *
6461847f8eSopenharmony_ci   * @type { number }
6561847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
6661847f8eSopenharmony_ci   * @crossplatform
6761847f8eSopenharmony_ci   * @form
6861847f8eSopenharmony_ci   * @atomicservice
6961847f8eSopenharmony_ci   * @since 12
7061847f8eSopenharmony_ci   */
7161847f8eSopenharmony_ci  width: number;
7261847f8eSopenharmony_ci}
7361847f8eSopenharmony_ci
7461847f8eSopenharmony_ci/**
7561847f8eSopenharmony_ci * Describes region information.
7661847f8eSopenharmony_ci *
7761847f8eSopenharmony_ci * @typedef Region
7861847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.Image.Core
7961847f8eSopenharmony_ci * @crossplatform
8061847f8eSopenharmony_ci * @form
8161847f8eSopenharmony_ci * @atomicservice
8261847f8eSopenharmony_ci * @since 12
8361847f8eSopenharmony_ci */
8461847f8eSopenharmony_ciinterface Region extends lang.ISendable {
8561847f8eSopenharmony_ci  /**
8661847f8eSopenharmony_ci   * Image size.
8761847f8eSopenharmony_ci   *
8861847f8eSopenharmony_ci   * @type { Size }
8961847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
9061847f8eSopenharmony_ci   * @crossplatform
9161847f8eSopenharmony_ci   * @form
9261847f8eSopenharmony_ci   * @atomicservice
9361847f8eSopenharmony_ci   * @since 12
9461847f8eSopenharmony_ci   */
9561847f8eSopenharmony_ci  size: Size;
9661847f8eSopenharmony_ci
9761847f8eSopenharmony_ci  /**
9861847f8eSopenharmony_ci   * x-coordinate at the upper left corner of the image.
9961847f8eSopenharmony_ci   *
10061847f8eSopenharmony_ci   * @type { number }
10161847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
10261847f8eSopenharmony_ci   * @crossplatform
10361847f8eSopenharmony_ci   * @form
10461847f8eSopenharmony_ci   * @atomicservice
10561847f8eSopenharmony_ci   * @since 12
10661847f8eSopenharmony_ci   */
10761847f8eSopenharmony_ci  x: number;
10861847f8eSopenharmony_ci
10961847f8eSopenharmony_ci  /**
11061847f8eSopenharmony_ci   * y-coordinate at the upper left corner of the image.
11161847f8eSopenharmony_ci   *
11261847f8eSopenharmony_ci   * @type { number }
11361847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
11461847f8eSopenharmony_ci   * @crossplatform
11561847f8eSopenharmony_ci   * @form
11661847f8eSopenharmony_ci   * @atomicservice
11761847f8eSopenharmony_ci   * @since 12
11861847f8eSopenharmony_ci   */
11961847f8eSopenharmony_ci  y: number;
12061847f8eSopenharmony_ci}
12161847f8eSopenharmony_ci
12261847f8eSopenharmony_ci  /**
12361847f8eSopenharmony_ci   * Creates an ImageSource instance based on the URI.
12461847f8eSopenharmony_ci   *
12561847f8eSopenharmony_ci   * @param { string } uri Image source URI.
12661847f8eSopenharmony_ci   * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise.
12761847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.ImageSource
12861847f8eSopenharmony_ci   * @crossplatform
12961847f8eSopenharmony_ci   * @atomicservice
13061847f8eSopenharmony_ci   * @since 12
13161847f8eSopenharmony_ci   */
13261847f8eSopenharmony_ci  function createImageSource(uri: string): ImageSource;
13361847f8eSopenharmony_ci
13461847f8eSopenharmony_ci  /**
13561847f8eSopenharmony_ci   * Creates an ImageSource instance based on the file descriptor.
13661847f8eSopenharmony_ci   *
13761847f8eSopenharmony_ci   * @param { number } fd ID of a file descriptor.
13861847f8eSopenharmony_ci   * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise.
13961847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.ImageSource
14061847f8eSopenharmony_ci   * @crossplatform
14161847f8eSopenharmony_ci   * @atomicservice
14261847f8eSopenharmony_ci   * @since 12
14361847f8eSopenharmony_ci   */
14461847f8eSopenharmony_ci  function createImageSource(fd: number): ImageSource;
14561847f8eSopenharmony_ci
14661847f8eSopenharmony_ci  /**
14761847f8eSopenharmony_ci   * Creates an ImageSource instance based on the buffer.
14861847f8eSopenharmony_ci   *
14961847f8eSopenharmony_ci   * @param { ArrayBuffer } buf The buffer of the image.
15061847f8eSopenharmony_ci   * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise.
15161847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.ImageSource
15261847f8eSopenharmony_ci   * @crossplatform
15361847f8eSopenharmony_ci   * @form
15461847f8eSopenharmony_ci   * @atomicservice
15561847f8eSopenharmony_ci   * @since 12
15661847f8eSopenharmony_ci   */
15761847f8eSopenharmony_ci  function createImageSource(buf: ArrayBuffer): ImageSource;
15861847f8eSopenharmony_ci
15961847f8eSopenharmony_ci  /**
16061847f8eSopenharmony_ci   * Creates an ImageReceiver instance.
16161847f8eSopenharmony_ci   *
16261847f8eSopenharmony_ci   * @param { Size } size - The default {@link Size} in pixels of the Images that this receiver will produce.
16361847f8eSopenharmony_ci   * @param { ImageFormat } format - The format of the Image that this receiver will produce. This must be one of the
16461847f8eSopenharmony_ci   *            {@link ImageFormat} constants.
16561847f8eSopenharmony_ci   * @param { number } capacity - The maximum number of images the user will want to access simultaneously.
16661847f8eSopenharmony_ci   * @returns { ImageReceiver } Returns the ImageReceiver instance if the operation is successful; returns null otherwise.
16761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - The parameter check failed.
16861847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.ImageReceiver
16961847f8eSopenharmony_ci   * @since 12
17061847f8eSopenharmony_ci   */
17161847f8eSopenharmony_ci  function createImageReceiver(size: image.Size, format: image.ImageFormat, capacity: number): ImageReceiver; 
17261847f8eSopenharmony_ci
17361847f8eSopenharmony_ci  type ISendable = lang.ISendable;
17461847f8eSopenharmony_ci
17561847f8eSopenharmony_ci  /**
17661847f8eSopenharmony_ci   * Create PixelMap by data buffer.
17761847f8eSopenharmony_ci   *
17861847f8eSopenharmony_ci   * @param { ArrayBuffer } colors The image color buffer.
17961847f8eSopenharmony_ci   * @param { InitializationOptions } options Initialization options for PixelMap.
18061847f8eSopenharmony_ci   * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object.
18161847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
18261847f8eSopenharmony_ci   * @crossplatform
18361847f8eSopenharmony_ci   * @since 12
18461847f8eSopenharmony_ci   */
18561847f8eSopenharmony_ci  function createPixelMap(colors: ArrayBuffer, options: image.InitializationOptions): Promise<PixelMap>;
18661847f8eSopenharmony_ci
18761847f8eSopenharmony_ci  /**
18861847f8eSopenharmony_ci   * Create PixelMap by data buffer.
18961847f8eSopenharmony_ci   *
19061847f8eSopenharmony_ci   * @param { ArrayBuffer } colors The image color buffer.
19161847f8eSopenharmony_ci   * @param { InitializationOptions } options Initialization options for PixelMap.
19261847f8eSopenharmony_ci   * @returns { PixelMap } Returns the instance if the operation is successful;Otherwise, return undefined.
19361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
19461847f8eSopenharmony_ci   * 2.Incorrect parameter types. 3.Parameter verification failed.
19561847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
19661847f8eSopenharmony_ci   * @crossplatform
19761847f8eSopenharmony_ci   * @since 12
19861847f8eSopenharmony_ci   */
19961847f8eSopenharmony_ci  function createPixelMapSync(colors: ArrayBuffer, options: image.InitializationOptions): PixelMap;
20061847f8eSopenharmony_ci
20161847f8eSopenharmony_ci  /**
20261847f8eSopenharmony_ci   * Creates a PixelMap object based on MessageSequence parameter.
20361847f8eSopenharmony_ci   *
20461847f8eSopenharmony_ci   * @param { rpc.MessageSequence } sequence - rpc.MessageSequence parameter.
20561847f8eSopenharmony_ci   * @returns { PixelMap } Returns the instance if the operation is successful.
20661847f8eSopenharmony_ci   * Otherwise, an exception will be thrown.
20761847f8eSopenharmony_ci   * @throws { BusinessError } 62980096 - Operation failed.
20861847f8eSopenharmony_ci   * @throws { BusinessError } 62980097 - IPC error.
20961847f8eSopenharmony_ci   * @throws { BusinessError } 62980115 - Invalid input parameter.
21061847f8eSopenharmony_ci   * @throws { BusinessError } 62980105 - Failed to get the data.
21161847f8eSopenharmony_ci   * @throws { BusinessError } 62980177 - Abnormal API environment.
21261847f8eSopenharmony_ci   * @throws { BusinessError } 62980178 - Failed to create the PixelMap.
21361847f8eSopenharmony_ci   * @throws { BusinessError } 62980179 - Abnormal buffer size.
21461847f8eSopenharmony_ci   * @throws { BusinessError } 62980180 - FD mapping failed.
21561847f8eSopenharmony_ci   * @throws { BusinessError } 62980246 - Failed to read the PixelMap.
21661847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
21761847f8eSopenharmony_ci   * @since 12
21861847f8eSopenharmony_ci   */
21961847f8eSopenharmony_ci  function createPixelMapFromParcel(sequence: rpc.MessageSequence): PixelMap;
22061847f8eSopenharmony_ci
22161847f8eSopenharmony_ci  /**
22261847f8eSopenharmony_ci   * Creates a PixelMap object from surface id.
22361847f8eSopenharmony_ci   *
22461847f8eSopenharmony_ci   * @param { string } surfaceId - surface id.
22561847f8eSopenharmony_ci   * @param { Region } region - The region to surface.
22661847f8eSopenharmony_ci   * @returns { Promise<PixelMap> } Returns the instance if the operation is successful.
22761847f8eSopenharmony_ci   * Otherwise, an exception will be thrown.
22861847f8eSopenharmony_ci   * @throws { BusinessError } 62980115 - If the image parameter invalid.
22961847f8eSopenharmony_ci   * @throws { BusinessError } 62980105 - Failed to get the data.
23061847f8eSopenharmony_ci   * @throws { BusinessError } 62980178 - Failed to create the PixelMap.
23161847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
23261847f8eSopenharmony_ci   * @since 12
23361847f8eSopenharmony_ci   */
23461847f8eSopenharmony_ci  function createPixelMapFromSurface(surfaceId: string, region: image.Region): Promise<PixelMap>;
23561847f8eSopenharmony_ci
23661847f8eSopenharmony_ci  /**
23761847f8eSopenharmony_ci   * Creates a sendable image PixelMap from image PixelMap.
23861847f8eSopenharmony_ci   *
23961847f8eSopenharmony_ci   * @param { image.PixelMap } pixelmap - the src pixelmap.
24061847f8eSopenharmony_ci   * @returns { PixelMap } Returns the instance if the operation is successful.
24161847f8eSopenharmony_ci   * Otherwise, an exception will be thrown.
24261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - If the image parameter invalid. Possible causes:
24361847f8eSopenharmony_ci   * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 3.Parameter verification failed.
24461847f8eSopenharmony_ci   * @throws { BusinessError } 62980104 - Failed to initialize the internal object.
24561847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
24661847f8eSopenharmony_ci   * @since 12
24761847f8eSopenharmony_ci   */
24861847f8eSopenharmony_ci  function convertFromPixelMap(pixelmap: image.PixelMap): PixelMap;
24961847f8eSopenharmony_ci
25061847f8eSopenharmony_ci  /**
25161847f8eSopenharmony_ci   * Creates a image PixelMap from sendable image PixelMap.
25261847f8eSopenharmony_ci   *
25361847f8eSopenharmony_ci   * @param { PixelMap } pixelmap - the src pixelmap.
25461847f8eSopenharmony_ci   * @returns { image.PixelMap } Returns the instance if the operation is successful.
25561847f8eSopenharmony_ci   * Otherwise, an exception will be thrown.
25661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - If the image parameter invalid. Possible causes:
25761847f8eSopenharmony_ci   * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 3.Parameter verification failed.
25861847f8eSopenharmony_ci   * @throws { BusinessError } 62980104 - Failed to initialize the internal object.
25961847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
26061847f8eSopenharmony_ci   * @since 12
26161847f8eSopenharmony_ci   */
26261847f8eSopenharmony_ci  function convertToPixelMap(pixelmap: PixelMap): image.PixelMap;
26361847f8eSopenharmony_ci
26461847f8eSopenharmony_ci  /**
26561847f8eSopenharmony_ci   * Sendable PixelMap instance.
26661847f8eSopenharmony_ci   *
26761847f8eSopenharmony_ci   * @typedef PixelMap
26861847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
26961847f8eSopenharmony_ci   * @crossplatform
27061847f8eSopenharmony_ci   * @atomicservice
27161847f8eSopenharmony_ci   * @since 12
27261847f8eSopenharmony_ci   */
27361847f8eSopenharmony_ci  interface PixelMap extends ISendable {
27461847f8eSopenharmony_ci    /**
27561847f8eSopenharmony_ci     * Whether the image pixelmap can be edited.
27661847f8eSopenharmony_ci     *
27761847f8eSopenharmony_ci     * @type { boolean }
27861847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
27961847f8eSopenharmony_ci     * @crossplatform
28061847f8eSopenharmony_ci     * @atomicservice
28161847f8eSopenharmony_ci     * @since 12
28261847f8eSopenharmony_ci     */
28361847f8eSopenharmony_ci    readonly isEditable: boolean;
28461847f8eSopenharmony_ci
28561847f8eSopenharmony_ci    /**
28661847f8eSopenharmony_ci     * Reads image pixelmap data and writes the data to an ArrayBuffer. This method uses
28761847f8eSopenharmony_ci     * a promise to return the result.
28861847f8eSopenharmony_ci     *
28961847f8eSopenharmony_ci     * @param { ArrayBuffer } dst A buffer to which the image pixelmap data will be written.
29061847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
29161847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
29261847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
29361847f8eSopenharmony_ci     * @crossplatform
29461847f8eSopenharmony_ci     * @atomicservice
29561847f8eSopenharmony_ci     * @since 12
29661847f8eSopenharmony_ci     */
29761847f8eSopenharmony_ci    readPixelsToBuffer(dst: ArrayBuffer): Promise<void>;
29861847f8eSopenharmony_ci
29961847f8eSopenharmony_ci    /**
30061847f8eSopenharmony_ci     * Reads image pixelmap data and writes the data to an ArrayBuffer.
30161847f8eSopenharmony_ci     *
30261847f8eSopenharmony_ci     * @param { ArrayBuffer } dst A buffer to which the image pixelmap data will be written.
30361847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
30461847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
30561847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
30661847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
30761847f8eSopenharmony_ci     * @crossplatform
30861847f8eSopenharmony_ci     * @atomicservice
30961847f8eSopenharmony_ci     * @since 12
31061847f8eSopenharmony_ci     */
31161847f8eSopenharmony_ci    readPixelsToBufferSync(dst: ArrayBuffer): void;
31261847f8eSopenharmony_ci
31361847f8eSopenharmony_ci    /**
31461847f8eSopenharmony_ci     * Reads image pixelmap data in an area. This method uses a promise to return the data read.
31561847f8eSopenharmony_ci     *
31661847f8eSopenharmony_ci     * @param { PositionArea } area Area from which the image pixelmap data will be read.
31761847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
31861847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
31961847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
32061847f8eSopenharmony_ci     * @crossplatform
32161847f8eSopenharmony_ci     * @atomicservice
32261847f8eSopenharmony_ci     * @since 12
32361847f8eSopenharmony_ci     */
32461847f8eSopenharmony_ci    readPixels(area: image.PositionArea): Promise<void>;
32561847f8eSopenharmony_ci
32661847f8eSopenharmony_ci    /**
32761847f8eSopenharmony_ci     * Reads image pixelmap data in an area.
32861847f8eSopenharmony_ci     *
32961847f8eSopenharmony_ci     * @param { PositionArea } area Area from which the image pixelmap data will be read.
33061847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
33161847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
33261847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
33361847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
33461847f8eSopenharmony_ci     * @crossplatform
33561847f8eSopenharmony_ci     * @atomicservice
33661847f8eSopenharmony_ci     * @since 12
33761847f8eSopenharmony_ci     */
33861847f8eSopenharmony_ci    readPixelsSync(area: image.PositionArea): void;
33961847f8eSopenharmony_ci
34061847f8eSopenharmony_ci    /**
34161847f8eSopenharmony_ci     * Writes image pixelmap data to the specified area. This method uses a promise to return
34261847f8eSopenharmony_ci     * the operation result.
34361847f8eSopenharmony_ci     *
34461847f8eSopenharmony_ci     * @param { PositionArea } area Area to which the image pixelmap data will be written.
34561847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
34661847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
34761847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
34861847f8eSopenharmony_ci     * @crossplatform
34961847f8eSopenharmony_ci     * @atomicservice
35061847f8eSopenharmony_ci     * @since 12
35161847f8eSopenharmony_ci     */
35261847f8eSopenharmony_ci    writePixels(area: image.PositionArea): Promise<void>;
35361847f8eSopenharmony_ci
35461847f8eSopenharmony_ci    /**
35561847f8eSopenharmony_ci     * Writes image pixelmap data to the specified area.
35661847f8eSopenharmony_ci     *
35761847f8eSopenharmony_ci     * @param { PositionArea } area Area to which the image pixelmap data will be written.
35861847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
35961847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
36061847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
36161847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
36261847f8eSopenharmony_ci     * @crossplatform
36361847f8eSopenharmony_ci     * @atomicservice
36461847f8eSopenharmony_ci     * @since 12
36561847f8eSopenharmony_ci     */
36661847f8eSopenharmony_ci    writePixelsSync(area: image.PositionArea): void;
36761847f8eSopenharmony_ci
36861847f8eSopenharmony_ci    /**
36961847f8eSopenharmony_ci     * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method
37061847f8eSopenharmony_ci     * uses a promise to return the result.
37161847f8eSopenharmony_ci     *
37261847f8eSopenharmony_ci     * @param { ArrayBuffer } src A buffer from which the image data will be read.
37361847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
37461847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
37561847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
37661847f8eSopenharmony_ci     * @crossplatform
37761847f8eSopenharmony_ci     * @atomicservice
37861847f8eSopenharmony_ci     * @since 12
37961847f8eSopenharmony_ci     */
38061847f8eSopenharmony_ci    writeBufferToPixels(src: ArrayBuffer): Promise<void>;
38161847f8eSopenharmony_ci
38261847f8eSopenharmony_ci    /**
38361847f8eSopenharmony_ci     * Reads image data in an ArrayBuffer and writes the data to a PixelMap object.
38461847f8eSopenharmony_ci     *
38561847f8eSopenharmony_ci     * @param { ArrayBuffer } src A buffer from which the image data will be read.
38661847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
38761847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
38861847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
38961847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
39061847f8eSopenharmony_ci     * @crossplatform
39161847f8eSopenharmony_ci     * @atomicservice
39261847f8eSopenharmony_ci     * @since 12
39361847f8eSopenharmony_ci     */
39461847f8eSopenharmony_ci    writeBufferToPixelsSync(src: ArrayBuffer): void;
39561847f8eSopenharmony_ci
39661847f8eSopenharmony_ci    /**
39761847f8eSopenharmony_ci     * Obtains pixelmap information about this image. This method uses a promise to return the information.
39861847f8eSopenharmony_ci     *
39961847f8eSopenharmony_ci     * @returns { Promise<ImageInfo> } A Promise instance used to return the image pixelmap information.
40061847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
40161847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
40261847f8eSopenharmony_ci     * @crossplatform
40361847f8eSopenharmony_ci     * @atomicservice
40461847f8eSopenharmony_ci     * @since 12
40561847f8eSopenharmony_ci     */
40661847f8eSopenharmony_ci    getImageInfo(): Promise<image.ImageInfo>;
40761847f8eSopenharmony_ci
40861847f8eSopenharmony_ci    /**
40961847f8eSopenharmony_ci     * Get image information from image source.
41061847f8eSopenharmony_ci     *
41161847f8eSopenharmony_ci     * @returns { ImageInfo } the image information.
41261847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
41361847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageSource
41461847f8eSopenharmony_ci     * @crossplatform
41561847f8eSopenharmony_ci     * @atomicservice
41661847f8eSopenharmony_ci     * @since 12
41761847f8eSopenharmony_ci     */
41861847f8eSopenharmony_ci    getImageInfoSync(): image.ImageInfo;
41961847f8eSopenharmony_ci
42061847f8eSopenharmony_ci    /**
42161847f8eSopenharmony_ci     * Obtains the number of bytes in each line of the image pixelmap.
42261847f8eSopenharmony_ci     *
42361847f8eSopenharmony_ci     * @returns { number } Number of bytes in each line.
42461847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
42561847f8eSopenharmony_ci     * @crossplatform
42661847f8eSopenharmony_ci     * @atomicservice
42761847f8eSopenharmony_ci     * @since 12
42861847f8eSopenharmony_ci     */
42961847f8eSopenharmony_ci    getBytesNumberPerRow(): number;
43061847f8eSopenharmony_ci
43161847f8eSopenharmony_ci    /**
43261847f8eSopenharmony_ci     * Obtains the total number of bytes of the image pixelmap.
43361847f8eSopenharmony_ci     *
43461847f8eSopenharmony_ci     * @returns { number } Total number of bytes.
43561847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
43661847f8eSopenharmony_ci     * @crossplatform
43761847f8eSopenharmony_ci     * @atomicservice
43861847f8eSopenharmony_ci     * @since 12
43961847f8eSopenharmony_ci     */
44061847f8eSopenharmony_ci    getPixelBytesNumber(): number;
44161847f8eSopenharmony_ci
44261847f8eSopenharmony_ci    /**
44361847f8eSopenharmony_ci     * Obtains the density of the image pixelmap.
44461847f8eSopenharmony_ci     *
44561847f8eSopenharmony_ci     * @returns { number } The number of density.
44661847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
44761847f8eSopenharmony_ci     * @crossplatform
44861847f8eSopenharmony_ci     * @atomicservice
44961847f8eSopenharmony_ci     * @since 12
45061847f8eSopenharmony_ci     */
45161847f8eSopenharmony_ci    getDensity(): number;
45261847f8eSopenharmony_ci
45361847f8eSopenharmony_ci    /**
45461847f8eSopenharmony_ci     * Set the transparent rate of pixelmap. This method uses a promise to return the result.
45561847f8eSopenharmony_ci     *
45661847f8eSopenharmony_ci     * @param { number } rate The value of transparent rate.
45761847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
45861847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
45961847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
46061847f8eSopenharmony_ci     * @crossplatform
46161847f8eSopenharmony_ci     * @atomicservice
46261847f8eSopenharmony_ci     * @since 12
46361847f8eSopenharmony_ci     */
46461847f8eSopenharmony_ci    opacity(rate: number): Promise<void>;
46561847f8eSopenharmony_ci
46661847f8eSopenharmony_ci    /**
46761847f8eSopenharmony_ci     * Set the transparent rate of pixelmap.
46861847f8eSopenharmony_ci     *
46961847f8eSopenharmony_ci     * @param { number } rate The value of transparent rate.
47061847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
47161847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
47261847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
47361847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
47461847f8eSopenharmony_ci     * @crossplatform
47561847f8eSopenharmony_ci     * @atomicservice
47661847f8eSopenharmony_ci     * @since 12
47761847f8eSopenharmony_ci     */
47861847f8eSopenharmony_ci    opacitySync(rate: number): void;
47961847f8eSopenharmony_ci
48061847f8eSopenharmony_ci    /**
48161847f8eSopenharmony_ci     * Obtains new pixelmap with alpha information. This method uses a promise to return the information.
48261847f8eSopenharmony_ci     *
48361847f8eSopenharmony_ci     * @returns { Promise<PixelMap> } A Promise instance used to return the new image pixelmap.
48461847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
48561847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
48661847f8eSopenharmony_ci     * @crossplatform
48761847f8eSopenharmony_ci     * @atomicservice
48861847f8eSopenharmony_ci     * @since 12
48961847f8eSopenharmony_ci     */
49061847f8eSopenharmony_ci    createAlphaPixelmap(): Promise<PixelMap>;
49161847f8eSopenharmony_ci
49261847f8eSopenharmony_ci    /**
49361847f8eSopenharmony_ci     * Obtains new pixelmap with alpha information.
49461847f8eSopenharmony_ci     *
49561847f8eSopenharmony_ci     * @returns { PixelMap } return the new image pixelmap. 
49661847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
49761847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Parameter verification failed.
49861847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
49961847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
50061847f8eSopenharmony_ci     * @crossplatform
50161847f8eSopenharmony_ci     * @atomicservice
50261847f8eSopenharmony_ci     * @since 12
50361847f8eSopenharmony_ci     */
50461847f8eSopenharmony_ci    createAlphaPixelmapSync(): PixelMap;
50561847f8eSopenharmony_ci
50661847f8eSopenharmony_ci    /**
50761847f8eSopenharmony_ci     * Image zoom in width and height. This method uses a promise to return the result.
50861847f8eSopenharmony_ci     *
50961847f8eSopenharmony_ci     * @param { number } x The zoom value of width.
51061847f8eSopenharmony_ci     * @param { number } y The zoom value of height.
51161847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
51261847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
51361847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
51461847f8eSopenharmony_ci     * @crossplatform
51561847f8eSopenharmony_ci     * @atomicservice
51661847f8eSopenharmony_ci     * @since 12
51761847f8eSopenharmony_ci     */
51861847f8eSopenharmony_ci    scale(x: number, y: number): Promise<void>;
51961847f8eSopenharmony_ci
52061847f8eSopenharmony_ci    /**
52161847f8eSopenharmony_ci     * Image zoom in width and height.
52261847f8eSopenharmony_ci     *
52361847f8eSopenharmony_ci     * @param { number } x The zoom value of width.
52461847f8eSopenharmony_ci     * @param { number } y The zoom value of height.
52561847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
52661847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
52761847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
52861847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
52961847f8eSopenharmony_ci     * @crossplatform
53061847f8eSopenharmony_ci     * @atomicservice
53161847f8eSopenharmony_ci     * @since 12
53261847f8eSopenharmony_ci     */
53361847f8eSopenharmony_ci    scaleSync(x: number, y: number): void;
53461847f8eSopenharmony_ci
53561847f8eSopenharmony_ci    /**
53661847f8eSopenharmony_ci     * Image position transformation. This method uses a promise to return the result.
53761847f8eSopenharmony_ci     *
53861847f8eSopenharmony_ci     * @param { number } x The position value of width.
53961847f8eSopenharmony_ci     * @param { number } y The position value of height.
54061847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
54161847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
54261847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
54361847f8eSopenharmony_ci     * @crossplatform
54461847f8eSopenharmony_ci     * @atomicservice
54561847f8eSopenharmony_ci     * @since 12
54661847f8eSopenharmony_ci     */
54761847f8eSopenharmony_ci    translate(x: number, y: number): Promise<void>;
54861847f8eSopenharmony_ci
54961847f8eSopenharmony_ci    /**
55061847f8eSopenharmony_ci     * Image position transformation.
55161847f8eSopenharmony_ci     *
55261847f8eSopenharmony_ci     * @param { number } x The position value of width.
55361847f8eSopenharmony_ci     * @param { number } y The position value of height.
55461847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
55561847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
55661847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
55761847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
55861847f8eSopenharmony_ci     * @crossplatform
55961847f8eSopenharmony_ci     * @atomicservice
56061847f8eSopenharmony_ci     * @since 12
56161847f8eSopenharmony_ci     */
56261847f8eSopenharmony_ci    translateSync(x: number, y: number): void;
56361847f8eSopenharmony_ci
56461847f8eSopenharmony_ci    /**
56561847f8eSopenharmony_ci     * Image rotation. This method uses a promise to return the result.
56661847f8eSopenharmony_ci     *
56761847f8eSopenharmony_ci     * @param { number } angle The rotation angle.
56861847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
56961847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
57061847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
57161847f8eSopenharmony_ci     * @crossplatform
57261847f8eSopenharmony_ci     * @atomicservice
57361847f8eSopenharmony_ci     * @since 12
57461847f8eSopenharmony_ci     */
57561847f8eSopenharmony_ci    rotate(angle: number): Promise<void>;
57661847f8eSopenharmony_ci
57761847f8eSopenharmony_ci    /**
57861847f8eSopenharmony_ci     * Image rotation.
57961847f8eSopenharmony_ci     *
58061847f8eSopenharmony_ci     * @param { number } angle The rotation angle.
58161847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
58261847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
58361847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
58461847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
58561847f8eSopenharmony_ci     * @crossplatform
58661847f8eSopenharmony_ci     * @atomicservice
58761847f8eSopenharmony_ci     * @since 12
58861847f8eSopenharmony_ci     */
58961847f8eSopenharmony_ci    rotateSync(angle: number): void;
59061847f8eSopenharmony_ci
59161847f8eSopenharmony_ci    /**
59261847f8eSopenharmony_ci     * Image flipping. This method uses a promise to return the result.
59361847f8eSopenharmony_ci     *
59461847f8eSopenharmony_ci     * @param { boolean } horizontal Is flip in horizontal.
59561847f8eSopenharmony_ci     * @param { boolean } vertical Is flip in vertical.
59661847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
59761847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
59861847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
59961847f8eSopenharmony_ci     * @crossplatform
60061847f8eSopenharmony_ci     * @atomicservice
60161847f8eSopenharmony_ci     * @since 12
60261847f8eSopenharmony_ci     */
60361847f8eSopenharmony_ci    flip(horizontal: boolean, vertical: boolean): Promise<void>;
60461847f8eSopenharmony_ci
60561847f8eSopenharmony_ci    /**
60661847f8eSopenharmony_ci     * Image flipping.
60761847f8eSopenharmony_ci     *
60861847f8eSopenharmony_ci     * @param { boolean } horizontal Is flip in horizontal.
60961847f8eSopenharmony_ci     * @param { boolean } vertical Is flip in vertical.
61061847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
61161847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
61261847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
61361847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
61461847f8eSopenharmony_ci     * @crossplatform
61561847f8eSopenharmony_ci     * @atomicservice
61661847f8eSopenharmony_ci     * @since 12
61761847f8eSopenharmony_ci     */
61861847f8eSopenharmony_ci    flipSync(horizontal: boolean, vertical: boolean): void;
61961847f8eSopenharmony_ci
62061847f8eSopenharmony_ci    /**
62161847f8eSopenharmony_ci     * Crop the image. This method uses a promise to return the result.
62261847f8eSopenharmony_ci     *
62361847f8eSopenharmony_ci     * @param { Region } region The region to crop.
62461847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
62561847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
62661847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
62761847f8eSopenharmony_ci     * @crossplatform
62861847f8eSopenharmony_ci     * @atomicservice
62961847f8eSopenharmony_ci     * @since 12
63061847f8eSopenharmony_ci     */
63161847f8eSopenharmony_ci    crop(region: image.Region): Promise<void>;
63261847f8eSopenharmony_ci
63361847f8eSopenharmony_ci    /**
63461847f8eSopenharmony_ci     * Crop the image.
63561847f8eSopenharmony_ci     *
63661847f8eSopenharmony_ci     * @param { Region } region The region to crop.
63761847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
63861847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
63961847f8eSopenharmony_ci     * @throws { BusinessError } 501 - Resource Unavailable.
64061847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
64161847f8eSopenharmony_ci     * @crossplatform
64261847f8eSopenharmony_ci     * @atomicservice
64361847f8eSopenharmony_ci     * @since 12
64461847f8eSopenharmony_ci     */
64561847f8eSopenharmony_ci    cropSync(region: image.Region): void;
64661847f8eSopenharmony_ci
64761847f8eSopenharmony_ci    /**
64861847f8eSopenharmony_ci     * Get color space of pixelmap.
64961847f8eSopenharmony_ci     *
65061847f8eSopenharmony_ci     * @returns { colorSpaceManager.ColorSpaceManager } If the operation fails, an error message is returned.
65161847f8eSopenharmony_ci     * @throws { BusinessError } 62980101 - If the image data abnormal.
65261847f8eSopenharmony_ci     * @throws { BusinessError } 62980103 - If the image data unsupport.
65361847f8eSopenharmony_ci     * @throws { BusinessError } 62980115 - If the image parameter invalid.
65461847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
65561847f8eSopenharmony_ci     * @crossplatform  
65661847f8eSopenharmony_ci     * @since 12
65761847f8eSopenharmony_ci     */
65861847f8eSopenharmony_ci    getColorSpace(): colorSpaceManager.ColorSpaceManager;
65961847f8eSopenharmony_ci
66061847f8eSopenharmony_ci    /**
66161847f8eSopenharmony_ci     * Set color space of pixelmap.
66261847f8eSopenharmony_ci     * 
66361847f8eSopenharmony_ci     * This method is only used to set the colorspace property of PixelMap,
66461847f8eSopenharmony_ci     * while all pixel data remains the same after calling this method.
66561847f8eSopenharmony_ci     * If you want to change colorspace for all pixels, use method
66661847f8eSopenharmony_ci     * {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager)}.
66761847f8eSopenharmony_ci     *
66861847f8eSopenharmony_ci     * @param { colorSpaceManager.ColorSpaceManager } colorSpace The color space for pixelmap.
66961847f8eSopenharmony_ci     * @throws { BusinessError } 62980111 - If the operation invalid.
67061847f8eSopenharmony_ci     * @throws { BusinessError } 62980115 - If the image parameter invalid.
67161847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
67261847f8eSopenharmony_ci     * @crossplatform 
67361847f8eSopenharmony_ci     * @since 12
67461847f8eSopenharmony_ci     */
67561847f8eSopenharmony_ci    setColorSpace(colorSpace: colorSpaceManager.ColorSpaceManager): void;
67661847f8eSopenharmony_ci
67761847f8eSopenharmony_ci    /**
67861847f8eSopenharmony_ci     * Is it stride Alignment
67961847f8eSopenharmony_ci     *
68061847f8eSopenharmony_ci     * @type { boolean }
68161847f8eSopenharmony_ci     * @readonly
68261847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
68361847f8eSopenharmony_ci     * @since 12
68461847f8eSopenharmony_ci     */
68561847f8eSopenharmony_ci    readonly isStrideAlignment: boolean;
68661847f8eSopenharmony_ci
68761847f8eSopenharmony_ci    /**
68861847f8eSopenharmony_ci     * Apply color space of pixelmap, the pixels will be changed by input color space.
68961847f8eSopenharmony_ci     * This method uses a promise to return the result.
69061847f8eSopenharmony_ci     * 
69161847f8eSopenharmony_ci     * This method is used to change color space of PixelMap.
69261847f8eSopenharmony_ci     * Pixel data will be changed by calling this method.
69361847f8eSopenharmony_ci     * If you want to set the colorspace property of PixelMap only,
69461847f8eSopenharmony_ci     * use method {@Link #setColorSpace(colorSpaceManager.ColorSpaceManager)}.
69561847f8eSopenharmony_ci     *
69661847f8eSopenharmony_ci     * @param { colorSpaceManager.ColorSpaceManager } targetColorSpace - The color space for pixelmap.
69761847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result. 
69861847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
69961847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
70061847f8eSopenharmony_ci     * 2.Incorrect parameter types. 3.Parameter verification failed.
70161847f8eSopenharmony_ci     * @throws { BusinessError } 62980104 - Failed to initialize the internal object.
70261847f8eSopenharmony_ci     * @throws { BusinessError } 62980108 - Failed to convert the color space.
70361847f8eSopenharmony_ci     * @throws { BusinessError } 62980115 - Invalid image parameter.
70461847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
70561847f8eSopenharmony_ci     * @crossplatform
70661847f8eSopenharmony_ci     * @since 12
70761847f8eSopenharmony_ci     */
70861847f8eSopenharmony_ci    applyColorSpace(targetColorSpace: colorSpaceManager.ColorSpaceManager): Promise<void>;
70961847f8eSopenharmony_ci
71061847f8eSopenharmony_ci    /**
71161847f8eSopenharmony_ci     * Releases this PixelMap object. This method uses a promise to return the result.
71261847f8eSopenharmony_ci     *
71361847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the instance release result. 
71461847f8eSopenharmony_ci     * If the operation fails, an error message is returned.
71561847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
71661847f8eSopenharmony_ci     * @crossplatform
71761847f8eSopenharmony_ci     * @atomicservice
71861847f8eSopenharmony_ci     * @since 12
71961847f8eSopenharmony_ci     */
72061847f8eSopenharmony_ci    release(): Promise<void>;
72161847f8eSopenharmony_ci
72261847f8eSopenharmony_ci    /**
72361847f8eSopenharmony_ci     * Marshalling PixelMap and write into MessageSequence.
72461847f8eSopenharmony_ci     *
72561847f8eSopenharmony_ci     * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter.
72661847f8eSopenharmony_ci     * @throws { BusinessError } 62980115 - Invalid image parameter.
72761847f8eSopenharmony_ci     * @throws { BusinessError } 62980097 - IPC error.
72861847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
72961847f8eSopenharmony_ci     * @since 12
73061847f8eSopenharmony_ci     */
73161847f8eSopenharmony_ci    marshalling(sequence: rpc.MessageSequence): void;
73261847f8eSopenharmony_ci
73361847f8eSopenharmony_ci    /**
73461847f8eSopenharmony_ci     * Creates a PixelMap object based on MessageSequence parameter.
73561847f8eSopenharmony_ci     *
73661847f8eSopenharmony_ci     * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter.
73761847f8eSopenharmony_ci     * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object.
73861847f8eSopenharmony_ci     * @throws { BusinessError } 62980115 - Invalid image parameter.
73961847f8eSopenharmony_ci     * @throws { BusinessError } 62980097 - IPC error.
74061847f8eSopenharmony_ci     * @throws { BusinessError } 62980096 - The operation failed.
74161847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
74261847f8eSopenharmony_ci     * @since 12
74361847f8eSopenharmony_ci     */
74461847f8eSopenharmony_ci    unmarshalling(sequence: rpc.MessageSequence): Promise<PixelMap>;
74561847f8eSopenharmony_ci  }
74661847f8eSopenharmony_ci
74761847f8eSopenharmony_ci  /**
74861847f8eSopenharmony_ci   * ImageSource instance.
74961847f8eSopenharmony_ci   *
75061847f8eSopenharmony_ci   * @typedef ImageSource
75161847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.ImageSource
75261847f8eSopenharmony_ci   * @crossplatform
75361847f8eSopenharmony_ci   * @form
75461847f8eSopenharmony_ci   * @atomicservice
75561847f8eSopenharmony_ci   * @since 12
75661847f8eSopenharmony_ci   */
75761847f8eSopenharmony_ci  interface ImageSource {
75861847f8eSopenharmony_ci    /**
75961847f8eSopenharmony_ci     * Creates a PixelMap object based on image decoding parameters. This method uses a promise to
76061847f8eSopenharmony_ci     * return the object.
76161847f8eSopenharmony_ci     *
76261847f8eSopenharmony_ci     * @param { DecodingOptions } options Image decoding parameters.
76361847f8eSopenharmony_ci     * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object.
76461847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageSource
76561847f8eSopenharmony_ci     * @crossplatform
76661847f8eSopenharmony_ci     * @form
76761847f8eSopenharmony_ci     * @atomicservice
76861847f8eSopenharmony_ci     * @since 12
76961847f8eSopenharmony_ci     */
77061847f8eSopenharmony_ci    createPixelMap(options?: image.DecodingOptions): Promise<PixelMap>;
77161847f8eSopenharmony_ci
77261847f8eSopenharmony_ci    /**
77361847f8eSopenharmony_ci     * Releases an ImageSource instance and uses a promise to return the result.
77461847f8eSopenharmony_ci     *
77561847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
77661847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageSource
77761847f8eSopenharmony_ci     * @crossplatform
77861847f8eSopenharmony_ci     * @since 12
77961847f8eSopenharmony_ci     */
78061847f8eSopenharmony_ci    release(): Promise<void>;
78161847f8eSopenharmony_ci  }
78261847f8eSopenharmony_ci
78361847f8eSopenharmony_ci  /**
78461847f8eSopenharmony_ci   * Provides basic image operations, including obtaining image information, and reading and writing image data.
78561847f8eSopenharmony_ci   *
78661847f8eSopenharmony_ci   * @typedef Image
78761847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.Core
78861847f8eSopenharmony_ci   * @since 12
78961847f8eSopenharmony_ci   */
79061847f8eSopenharmony_ci  interface Image extends lang.ISendable {
79161847f8eSopenharmony_ci    /**
79261847f8eSopenharmony_ci     * Sets or gets the image area to crop, default is size.
79361847f8eSopenharmony_ci     *
79461847f8eSopenharmony_ci     * @type { Region }
79561847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
79661847f8eSopenharmony_ci     * @since 12
79761847f8eSopenharmony_ci     */
79861847f8eSopenharmony_ci    clipRect: Region;
79961847f8eSopenharmony_ci
80061847f8eSopenharmony_ci    /**
80161847f8eSopenharmony_ci     * Image size.
80261847f8eSopenharmony_ci     *
80361847f8eSopenharmony_ci     * @type { Size }
80461847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
80561847f8eSopenharmony_ci     * @since 12
80661847f8eSopenharmony_ci     */
80761847f8eSopenharmony_ci    readonly size: Size;
80861847f8eSopenharmony_ci
80961847f8eSopenharmony_ci    /**
81061847f8eSopenharmony_ci     * Image format.
81161847f8eSopenharmony_ci     *
81261847f8eSopenharmony_ci     * @type { number }
81361847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
81461847f8eSopenharmony_ci     * @since 12
81561847f8eSopenharmony_ci     */
81661847f8eSopenharmony_ci    readonly format: number;
81761847f8eSopenharmony_ci
81861847f8eSopenharmony_ci    /**
81961847f8eSopenharmony_ci     * Image timestamp.
82061847f8eSopenharmony_ci     *
82161847f8eSopenharmony_ci     * @type { number }
82261847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
82361847f8eSopenharmony_ci     * @since 12
82461847f8eSopenharmony_ci     */
82561847f8eSopenharmony_ci    readonly timestamp: number;
82661847f8eSopenharmony_ci
82761847f8eSopenharmony_ci    /**
82861847f8eSopenharmony_ci     * Get component buffer from image and uses a promise to return the result.
82961847f8eSopenharmony_ci     *
83061847f8eSopenharmony_ci     * @param { ComponentType } componentType The component type of image.
83161847f8eSopenharmony_ci     * @returns { Promise<Component> } A Promise instance used to return the component buffer.
83261847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
83361847f8eSopenharmony_ci     * @since 12
83461847f8eSopenharmony_ci     */
83561847f8eSopenharmony_ci    getComponent(componentType: image.ComponentType): Promise<image.Component>;
83661847f8eSopenharmony_ci
83761847f8eSopenharmony_ci    /**
83861847f8eSopenharmony_ci     * Release current image to receive another and uses a promise to return the result.
83961847f8eSopenharmony_ci     *
84061847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
84161847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.Core
84261847f8eSopenharmony_ci     * @since 12
84361847f8eSopenharmony_ci     */
84461847f8eSopenharmony_ci    release(): Promise<void>;
84561847f8eSopenharmony_ci  }
84661847f8eSopenharmony_ci
84761847f8eSopenharmony_ci  /**
84861847f8eSopenharmony_ci   * Image receiver object.
84961847f8eSopenharmony_ci   *
85061847f8eSopenharmony_ci   * @typedef ImageReceiver
85161847f8eSopenharmony_ci   * @syscap SystemCapability.Multimedia.Image.ImageReceiver
85261847f8eSopenharmony_ci   * @since 12
85361847f8eSopenharmony_ci   */
85461847f8eSopenharmony_ci  interface ImageReceiver {
85561847f8eSopenharmony_ci    /**
85661847f8eSopenharmony_ci     * Image size.
85761847f8eSopenharmony_ci     *
85861847f8eSopenharmony_ci     * @type { Size }
85961847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
86061847f8eSopenharmony_ci     * @since 12
86161847f8eSopenharmony_ci     */
86261847f8eSopenharmony_ci    readonly size: image.Size;
86361847f8eSopenharmony_ci
86461847f8eSopenharmony_ci    /**
86561847f8eSopenharmony_ci     * Image capacity.
86661847f8eSopenharmony_ci     *
86761847f8eSopenharmony_ci     * @type { number }
86861847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
86961847f8eSopenharmony_ci     * @since 12
87061847f8eSopenharmony_ci     */
87161847f8eSopenharmony_ci    readonly capacity: number;
87261847f8eSopenharmony_ci
87361847f8eSopenharmony_ci    /**
87461847f8eSopenharmony_ci     * Image format.
87561847f8eSopenharmony_ci     *
87661847f8eSopenharmony_ci     * @type { ImageFormat }
87761847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
87861847f8eSopenharmony_ci     * @since 12
87961847f8eSopenharmony_ci     */
88061847f8eSopenharmony_ci    readonly format: image.ImageFormat;
88161847f8eSopenharmony_ci
88261847f8eSopenharmony_ci    /**
88361847f8eSopenharmony_ci     * Get an id which indicates a surface and can be used to set to Camera or other component can receive a surface
88461847f8eSopenharmony_ci     * and uses a promise to return the result.
88561847f8eSopenharmony_ci     *
88661847f8eSopenharmony_ci     * @returns { Promise<string> } A Promise instance used to return the surface id.
88761847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
88861847f8eSopenharmony_ci     * @since 12
88961847f8eSopenharmony_ci     */
89061847f8eSopenharmony_ci    getReceivingSurfaceId(): Promise<string>;
89161847f8eSopenharmony_ci
89261847f8eSopenharmony_ci    /**
89361847f8eSopenharmony_ci     * Get lasted image from receiver and uses a promise to return the result.
89461847f8eSopenharmony_ci     *
89561847f8eSopenharmony_ci     * @returns { Promise<Image> } A Promise instance used to return the latest image.
89661847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
89761847f8eSopenharmony_ci     * @since 12
89861847f8eSopenharmony_ci     */
89961847f8eSopenharmony_ci    readLatestImage(): Promise<Image>;
90061847f8eSopenharmony_ci
90161847f8eSopenharmony_ci    /**
90261847f8eSopenharmony_ci     * Get next image from receiver and uses a promise to return the result.
90361847f8eSopenharmony_ci     *
90461847f8eSopenharmony_ci     * @returns { Promise<Image> } A Promise instance used to return the next image.
90561847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
90661847f8eSopenharmony_ci     * @since 12
90761847f8eSopenharmony_ci     */
90861847f8eSopenharmony_ci    readNextImage(): Promise<Image>;
90961847f8eSopenharmony_ci
91061847f8eSopenharmony_ci    /**
91161847f8eSopenharmony_ci     * Subscribe callback when receiving an image
91261847f8eSopenharmony_ci     *
91361847f8eSopenharmony_ci     * @param { 'imageArrival' } type Callback used to return the next image.
91461847f8eSopenharmony_ci     * @param { AsyncCallback<void> } callback Callback used to return image.
91561847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
91661847f8eSopenharmony_ci     * @since 12
91761847f8eSopenharmony_ci     */
91861847f8eSopenharmony_ci    on(type: 'imageArrival', callback: AsyncCallback<void>): void;
91961847f8eSopenharmony_ci
92061847f8eSopenharmony_ci    /**
92161847f8eSopenharmony_ci     * Release image receiver instance and uses a promise to return the result.
92261847f8eSopenharmony_ci     *
92361847f8eSopenharmony_ci     * @returns { Promise<void> } A Promise instance used to return the operation result.
92461847f8eSopenharmony_ci     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
92561847f8eSopenharmony_ci     * @since 12
92661847f8eSopenharmony_ci     */
92761847f8eSopenharmony_ci    release(): Promise<void>;
92861847f8eSopenharmony_ci  }
92961847f8eSopenharmony_ci
93061847f8eSopenharmony_ci}
93161847f8eSopenharmony_ci
93261847f8eSopenharmony_ciexport default sendableImage;