diff --git a/frameworks/kits/taihe/idl/ohos.multimedia.image.image.taihe b/frameworks/kits/taihe/idl/ohos.multimedia.image.image.taihe index b2944a68c7f44ece2f65320bf0521de45fb720b0..e72197ec191de2b099bf33b13bb2d73b8fe7e234 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 2bc829fd574407890d20799e456939752ea615a5..10113edfe1e2a4b3d135a3c783053905c654fcbb 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; }