diff --git a/multimedia/image_framework/include/image/pixelmap_native.h b/multimedia/image_framework/include/image/pixelmap_native.h
index bf16c2ef5b1054d5f7a29ad9ac9451214db0aa26..5f8be7c783e9671e7fd411d5ab276e6d0bd05a63 100644
--- a/multimedia/image_framework/include/image/pixelmap_native.h
+++ b/multimedia/image_framework/include/image/pixelmap_native.h
@@ -114,6 +114,30 @@ typedef enum {
PIXEL_FORMAT_NV12 = 9,
} PIXEL_FORMAT;
+/**
+ * @brief Defines the anti-aliasing level.
+ *
+ * @since 12
+ */
+typedef enum {
+ /**
+ * Nearest-neighbor interpolation algorithm
+ */
+ OH_PixelmapNative_AntiAliasing_NONE = 0,
+ /**
+ * Bilinear interpolation algorithm
+ */
+ OH_PixelmapNative_AntiAliasing_LOW = 1,
+ /**
+ * Bilinear interpolation algorithm with mipmap linear filtering
+ */
+ OH_PixelmapNative_AntiAliasing_MEDIUM = 2,
+ /**
+ * Cubic interpolation algorithm
+ */
+ OH_PixelmapNative_AntiAliasing_HIGH = 3,
+} OH_PixelmapNative_AntiAliasingLevel;
+
/**
* @brief Enumerates the HDR metadata types that need to be stored in Pixelmap.
*
@@ -399,6 +423,32 @@ Image_ErrorCode OH_PixelmapInitializationOptions_GetSrcPixelFormat(OH_Pixelmap_I
Image_ErrorCode OH_PixelmapInitializationOptions_SetSrcPixelFormat(OH_Pixelmap_InitializationOptions *options,
int32_t srcpixelFormat);
+/**
+ * @brief Get rowStride for InitializationOptions struct.
+ *
+ * @param options The InitializationOptions pointer will be operated.
+ * @param rowStride the rowStride of image buffer.
+ * @return Returns {@link Image_ErrorCode} IMAGE_SUCCESS - if the operation is successful.
+ * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - if rowStride is null.
+ * returns {@link Image_ErrorCode} IMAGE_UNKNOWN_ERROR - inner unknown error, maybe options is released.
+ * @since 12
+ */
+Image_ErrorCode OH_PixelmapInitializationOptions_GetRowStride(OH_Pixelmap_InitializationOptions *options,
+ int32_t *rowStride);
+
+/**
+ * @brief Set rowStride number for InitializationOptions struct.
+ *
+ * @param options The InitializationOptions pointer will be operated.
+ * @param rowStride the rowStride of image buffer.
+ * @return Returns {@link Image_ErrorCode} IMAGE_SUCCESS - if the operation is successful.
+ * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - if rowStride does not match width.
+ * returns {@link Image_ErrorCode} IMAGE_UNKNOWN_ERROR - inner unknown error, maybe options is released.
+ * @since 12
+ */
+Image_ErrorCode OH_PixelmapInitializationOptions_SetRowStride(OH_Pixelmap_InitializationOptions *options,
+ int32_t rowStride);
+
/**
* @brief Get alphaType number for InitializationOtions struct.
*
@@ -623,6 +673,24 @@ Image_ErrorCode OH_PixelmapNative_Opacity(OH_PixelmapNative *pixelmap, float rat
*/
Image_ErrorCode OH_PixelmapNative_Scale(OH_PixelmapNative *pixelmap, float scaleX, float scaleY);
+/**
+ * @brief Scales this image based on the input width and height with anti-aliasing.
+ *
+ * @param pixelmap The Pixelmap pointer will be operated.
+ * @param scaleX Scaling ratio of the width.
+ * @param scaleY Scaling ratio of the height.
+ * @param level The anti-aliasing algorithm to be used.
+ * @return Returns {@link Image_ErrorCode} IMAGE_SUCCESS - if the operation is successful.
+ * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - if invalid parameter, x and y are incorrect.
+ * returns {@link Image_ErrorCode} IMAGE_TOO_LARGE - if image is too large.
+ * returns {@link Image_ErrorCode} IMAGE_ALLOC_FAILED - if device has no memory.
+ * returns {@link Image_ErrorCode} IMAGE_UNKNOWN_ERROR - inner unknown error, maybe source pixelmap is released.
+ * @see OH_PixelmapNative
+ * @since 12
+ */
+Image_ErrorCode OH_PixelmapNative_ScaleWithAntiAliasing(OH_PixelmapNative *pixelmap, float scaleX, float scaleY,
+ OH_PixelmapNative_AntiAliasingLevel level);
+
/**
* @brief Translates this image based on the input coordinates.
*
diff --git a/multimedia/image_framework/include/image_pixel_map_mdk.h b/multimedia/image_framework/include/image_pixel_map_mdk.h
index 26d28e3bd479de89efd6d987f292306986fad8e4..b05dc9ca782afa1d6ffa898d34dabdd9c8ef52d1 100644
--- a/multimedia/image_framework/include/image_pixel_map_mdk.h
+++ b/multimedia/image_framework/include/image_pixel_map_mdk.h
@@ -118,6 +118,31 @@ enum {
OHOS_PIXEL_MAP_EDITABLE = 1,
};
+/**
+ * @brief Enumerates the anti-aliasing level.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum {
+ /**
+ * Nearest-neighbor interpolation.
+ */
+ OH_PixelMap_AntiAliasing_NONE = 0,
+ /**
+ * Bilinear interpolation, without mipmap linear filtering.
+ */
+ OH_PixelMap_AntiAliasing_LOW = 1,
+ /**
+ * Bilinear interpolation, with mipmap linear filtering.
+ */
+ OH_PixelMap_AntiAliasing_MEDIUM = 2,
+ /**
+ * Cubic interpolation.
+ */
+ OH_PixelMap_AntiAliasing_HIGH = 3,
+} OH_PixelMap_AntiAliasingLevel;
+
/**
* @brief Defines the options used for creating a pixel map.
*
@@ -183,6 +208,31 @@ struct OhosPixelMapCreateOps {
int32_t OH_PixelMap_CreatePixelMap(napi_env env, OhosPixelMapCreateOps info,
void* buf, size_t len, napi_value* res);
+/**
+ * @brief Creates a PixelMap object with stride, whose memory is default as DMA.
+ *
+ * @param env Indicates the NAPI environment pointer.
+ * @param info Indicates the options for setting the PixelMap object.
+ * @param buf Indicates the pointer to the buffer of the image.
+ * @param len Indicates the image size.
+ * @param rowStride Indicates the stride of the image buffer.
+ * @param res Indicates the pointer to the PixelMap object at the application layer.
+ * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if info, len and rowStride do not match.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
+ * @see OH_PixelMap_CreatePixelMapWithStride
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_PixelMap_CreatePixelMapWithStride(napi_env env, OhosPixelMapCreateOps info,
+ void* buf, size_t len, int32_t rowStride, napi_value* res);
+
/**
* @brief Creates a PixelMap object that contains only alpha channel information.
*
@@ -388,6 +438,30 @@ int32_t OH_PixelMap_SetOpacity(const NativePixelMap* native, float opacity);
*/
int32_t OH_PixelMap_Scale(const NativePixelMap* native, float x, float y);
+
+/**
+ * @brief Scales a PixelMap object with anti-aliasing.
+ *
+ * @param native Indicates the pointer to a NativePixelMap object.
+ * @param x Indicates the scaling ratio of the width.
+ * @param y Indicates the scaling ratio of the height.
+ * @param level Indicates the anti-aliasing algorithm to be used.
+ * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter, x and y are incorrect.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error.
+ * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
+ * @see Scale
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_PixelMap_ScaleWithAntiAliasing(const NativePixelMap* native, float x, float y,
+ OH_PixelMap_AntiAliasingLevel level);
+
/**
* @brief Translates a PixelMap object.
*
diff --git a/multimedia/image_framework/libimage_pixelmap_napi.ndk.json b/multimedia/image_framework/libimage_pixelmap_napi.ndk.json
index 64800fe826282f2c62c68ee354f432af18ea4fed..0476d801e395562946bdfb0513ba7e65515f6bc2 100644
--- a/multimedia/image_framework/libimage_pixelmap_napi.ndk.json
+++ b/multimedia/image_framework/libimage_pixelmap_napi.ndk.json
@@ -12,6 +12,10 @@
{
"name": "OH_PixelMap_CreatePixelMap"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_PixelMap_CreatePixelMapWithStride"
+ },
{
"name": "OH_PixelMap_CreateAlphaPixelMap"
},
@@ -42,6 +46,10 @@
{
"name": "OH_PixelMap_Scale"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_PixelMap_ScaleWithAntiAliasing"
+ },
{
"name": "OH_PixelMap_Translate"
},
diff --git a/multimedia/image_framework/libpixelmap.ndk.json b/multimedia/image_framework/libpixelmap.ndk.json
index b2439b1761ee6f2b9f2ef0847a72c9cb48220ab0..f06f6b1866994fabc7112dc3877870b99a9d044d 100644
--- a/multimedia/image_framework/libpixelmap.ndk.json
+++ b/multimedia/image_framework/libpixelmap.ndk.json
@@ -43,6 +43,14 @@
"first_introduced": "12",
"name": "OH_PixelmapInitializationOptions_SetAlphaType"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_PixelmapInitializationOptions_GetRowStride"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_PixelmapInitializationOptions_SetRowStride"
+ },
{
"first_introduced": "12",
"name": "OH_PixelmapInitializationOptions_Release"
@@ -107,6 +115,10 @@
"first_introduced": "12",
"name": "OH_PixelmapNative_Scale"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_PixelmapNative_ScaleWithAntiAliasing"
+ },
{
"first_introduced": "12",
"name": "OH_PixelmapNative_Translate"