diff --git a/interfaces/kits/js/@ohos.multimedia.image.d.ts b/interfaces/kits/js/@ohos.multimedia.image.d.ts index 74bd1969d3bb361b7354dca916f1c1cf959246e4..ee59c56381bd805b421e23dc380e43c373c62f43 100644 --- a/interfaces/kits/js/@ohos.multimedia.image.d.ts +++ b/interfaces/kits/js/@ohos.multimedia.image.d.ts @@ -324,6 +324,12 @@ declare namespace image { * @syscap SystemCapability.Multimedia.Image.Core */ size: Size; + + /** + * Indicates image defalt density. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + */ density: number; } @@ -426,6 +432,11 @@ declare namespace image { */ desiredPixelFormat?: PixelMapFormat; + /** + * The density for image pixel map. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.ImageSource + */ fitDensity?: number; } @@ -506,9 +517,20 @@ declare namespace image { scaleMode?: ScaleMode; } + /** + * Initialization options for ImageSource. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + */ interface SourceOptions { + /** + * The density for ImageSource. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + */ sourceDensity: number; } + /** * Create pixelmap by data buffer. * @since 8 @@ -528,6 +550,7 @@ declare namespace image { * @since 6 * @syscap SystemCapability.Multimedia.Image.ImageSource * @param uri Image source URI. + * @param options The config of Image source. * @return Returns the ImageSource instance if the operation is successful; returns null otherwise. */ function createImageSource(uri: string, options?: SourceOptions): ImageSource; @@ -537,6 +560,7 @@ declare namespace image { * @since 7 * @syscap SystemCapability.Multimedia.Image.ImageSource * @param fd ID of a file descriptor. + * @param options The config of Image source. * @return Returns the ImageSource instance if the operation is successful; returns null otherwise. */ function createImageSource(fd: number, options?: SourceOptions): ImageSource; @@ -546,6 +570,7 @@ declare namespace image { * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageSource * @param buf The buffer of the iamge. + * @param options The config of Image source. * @return Returns the ImageSource instance if the operation is successful; returns null otherwise. */ function createImageSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource; @@ -555,6 +580,7 @@ declare namespace image { * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageSource * @param buf The buffer of the iamge. + * @param options The config of source. * @return Returns the ImageSource instance if the operation is successful; returns null otherwise. */ function CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource; @@ -703,8 +729,143 @@ declare namespace image { */ getPixelBytesNumber(): number; + /** + * Obtains the density of the image pixel map. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @return The number of density. + */ getDensity():number; - setDensity(density: number); + + /** + * Set the transparent rate of pixel map. This method uses a callback to return the operation result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param rate The value of transparent rate. + * @param callback Callback used to return the operation result. If the operation fails, an error message is returned. + */ + setAlphaRate(rate: number, callback: AsyncCallback): void; + + /** + * Set the transparent rate of pixel map. This method uses a promise to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param rate The value of transparent rate. + * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned. + */ + setAlphaRate(rate: number): Promise; + + /** + * Obtains new pixel map with allpha information. This method uses a promise to return the information. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @return A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. + */ + createAlphaPixelmap(): Promise; + + /** + * Obtains new pixel map with allpha information. This method uses a callback to return the information. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. + */ + createAlphaPixelmap(callback: AsyncCallback): void; + + /** + * Image zoom in width and height. This method uses a callback to return the operation result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param x The zoom value of width. + * @param y The zoom value of height. + * @param callback Callback used to return the operation result. If the operation fails, an error message is returned. + */ + scale(x: number, y: number, callback: AsyncCallback): void; + + /** + * Image zoom in width and height. This method uses a promise to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param x The zoom value of width. + * @param y The zoom value of height. + * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned. + */ + scale(x: number, y: number): Promise; + + /** + * Image position transformation. This method uses a callback to return the operation result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param x The position value of width. + * @param y The position value of height. + * @param callback Callback used to return the operation result. If the operation fails, an error message is returned. + */ + translate(x: number, y: number, callback: AsyncCallback): void; + + /** + * Image position transformation. This method uses a promise to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param x The position value of width. + * @param y The position value of height. + * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned. + */ + translate(x: number, y: number): Promise; + + /** + * Image rotation. This method uses a callback to return the operation result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param angle The rotation angle. + * @param callback Callback used to return the operation result. If the operation fails, an error message is returned. + */ + rotate(angle: number, callback: AsyncCallback): void; + + /** + * Image rotation. This method uses a promise to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param angle The rotation angle. + * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned. + */ + rotate(angle: number): Promise; + + /** + * Image flipping. This method uses a callback to return the operation result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param horizontal Is flip in horizontal. + * @param vertical Is flip in vertical. + * @param callback Callback used to return the operation result. If the operation fails, an error message is returned. + */ + flip(horizontal: boolean, vertical: boolean, callback: AsyncCallback): void; + + /** + * Image flipping. This method uses a promise to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param horizontal Is flip in horizontal. + * @param vertical Is flip in vertical. + * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned. + */ + flip(horizontal: boolean, vertical: boolean): Promise; + + /** + * Crop the image. This method uses a callback to return the operation result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param region The region to crop. + * @param callback Callback used to return the operation result. If the operation fails, an error message is returned. + */ + crop(region: Region callback: AsyncCallback): void; + + /** + * Crop the image. This method uses a promise to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Image.Core + * @param region The region to crop. + * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned. + */ + crop(region: Region): Promise; /** * Releases this PixelMap object. This method uses a callback to return the result.