From ccc484dcb20330ebab90eff5c1da6186ed8edf4f Mon Sep 17 00:00:00 2001 From: zhaona45 Date: Wed, 4 Jun 2025 15:48:03 +0800 Subject: [PATCH] Temporary change int -> number Signed-off-by: zhaona45 Change-Id: Ice13827d48aef12e34aa4b986c78c8ab1de7cd5d --- .../idl/ohos.multimedia.image.image.taihe | 34 +++++++++---------- frameworks/kits/taihe/src/image_taihe.cpp | 6 +++- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/frameworks/kits/taihe/idl/ohos.multimedia.image.image.taihe b/frameworks/kits/taihe/idl/ohos.multimedia.image.image.taihe index b2944a68c..e72197ec1 100644 --- a/frameworks/kits/taihe/idl/ohos.multimedia.image.image.taihe +++ b/frameworks/kits/taihe/idl/ohos.multimedia.image.image.taihe @@ -43,8 +43,8 @@ enum ResolutionQuality: i32 { } struct Size { - width: i32; - height: i32; + width: f64; + height: f64; } enum PropertyKey: String { @@ -280,8 +280,8 @@ enum AllocatorType: i32 { struct Region { size: Size; - x: i32; - y: i32; + x: f64; + y: f64; } // Can't use struct because struct is copied instead of referenced, so data changes to "pixels" in C++ will not be reflected in ArkTS @@ -298,8 +298,8 @@ interface PositionArea { struct ImageInfo { size: Size; - density: i32; - stride: i32; + density: f64; + stride: f64; pixelFormat: PixelMapFormat; alphaType: AlphaType; mimeType: String; @@ -313,8 +313,8 @@ enum CropAndScaleStrategy: i32 { struct PackingOption { format: String; - quality: i32; - bufferSize: Optional; + quality: f64; + bufferSize: Optional; desiredDynamicRange: Optional; needsPackProperties: Optional; } @@ -325,15 +325,15 @@ struct ImagePropertyOptions { } struct DecodingOptions { - index: Optional; - sampleSize: Optional; - rotate: Optional; + index: Optional; + sampleSize: Optional; + rotate: Optional; editable: Optional; desiredSize: Optional; desiredRegion: Optional; desiredPixelFormat: Optional; photoDesiredPixelFormat: Optional; // not exposed to the user - fitDensity: Optional; + fitDensity: Optional; fillColor: Optional; // not exposed to the user SVGResize: Optional; // not exposed to the user desiredColorSpace: Optional<@sts_type("colorSpaceManager.ColorSpaceManager") Opaque>; @@ -474,14 +474,14 @@ interface ImageSource { GetImplPtr(): i64; @gen_async("getImageInfo") @gen_promise("getImageInfoPromiseWithIndex") - GetImageInfoSyncWithIndex(index: u32): ImageInfo; + GetImageInfoSyncWithIndex(index: f64): ImageInfo; @gen_async("getImageInfo") @gen_promise("getImageInfoPromise") GetImageInfoSync(): ImageInfo; - @!sts_inject_into_interface("getImageInfoSync(index: int | undefined): ImageInfo;") - @!sts_inject_into_class("""getImageInfoSync(index: int | undefined): ImageInfo { + @!sts_inject_into_interface("getImageInfoSync(index: double | undefined): ImageInfo;") + @!sts_inject_into_class("""getImageInfoSync(index: double | undefined): ImageInfo { if (index === undefined) { return this.getImageInfoSync(); } else { @@ -490,8 +490,8 @@ interface ImageSource { } """) - @!sts_inject_into_interface("getImageInfo(index: int | undefined): Promise;") - @!sts_inject_into_class("""getImageInfo(index: int | undefined): Promise { + @!sts_inject_into_interface("getImageInfo(index: double | undefined): Promise;") + @!sts_inject_into_class("""getImageInfo(index: double | undefined): Promise { if (index === undefined) { return this.getImageInfoPromise(); } else { diff --git a/frameworks/kits/taihe/src/image_taihe.cpp b/frameworks/kits/taihe/src/image_taihe.cpp index 2bc829fd5..10113edfe 100644 --- a/frameworks/kits/taihe/src/image_taihe.cpp +++ b/frameworks/kits/taihe/src/image_taihe.cpp @@ -89,9 +89,13 @@ Size ImageImpl::GetSize() return result; } - if (nativeImage_->GetSize(result.width, result.height) != OHOS::Media::SUCCESS) { + int32_t width = NUM0; + int32_t height = NUM0; + if (nativeImage_->GetSize(width, height) != OHOS::Media::SUCCESS) { IMAGE_LOGE("Image native get size failed"); } + result.width = static_cast(width); + result.height = static_cast(height); return result; } -- Gitee