diff --git a/graphic/graphic_2d/native_drawing/drawing_canvas.h b/graphic/graphic_2d/native_drawing/drawing_canvas.h index 8f515031b2516c872b14e812a500cd1920a451ce..e3d4cfa4d7be6d25626f9f1c6f80168787a3717e 100644 --- a/graphic/graphic_2d/native_drawing/drawing_canvas.h +++ b/graphic/graphic_2d/native_drawing/drawing_canvas.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -271,6 +271,27 @@ OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPixelMapNine(OH_Drawing_Canvas* canvas void OH_Drawing_CanvasDrawPixelMapRect(OH_Drawing_Canvas* canvas, OH_Drawing_PixelMap* pixelMap, const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* samplingOptions); +/** + * @brief Draw the specified area of the Media::PixelMap to the specified area of the canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param pixelMap Indicates the pointer to an OH_Drawing_PixelMap object. + * @param src the area of source pixelmap. + * @param dst the area of destination canvas. + * @param samplingOptions the sampling mode. + * @param srcRectConstraint Constraint type. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of canvas, pixelMap + * and dst is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPixelMapRectConstraint(OH_Drawing_Canvas* canvas, + OH_Drawing_PixelMap* pixelMap, const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, + const OH_Drawing_SamplingOptions* samplingOptions, OH_Drawing_SrcRectConstraint srcRectConstraint); + /** * @brief Fills clipped canvas area with brush. * diff --git a/graphic/graphic_2d/native_drawing/drawing_image_filter.h b/graphic/graphic_2d/native_drawing/drawing_image_filter.h index 44c566b90f015fdcb8a8a6cf2935619fd35f31a1..c36537dd19aa4d829640c47667a37dbf7061b729 100644 --- a/graphic/graphic_2d/native_drawing/drawing_image_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_image_filter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -63,6 +63,22 @@ extern "C" { OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sigmaY, OH_Drawing_TileMode tileMode, OH_Drawing_ImageFilter* imageFilter); +/** + * @brief Creates an OH_Drawing_ImageFilter object that blurs its input by the separate x and y sigmas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param sigmaX Indicates the Gaussian sigma value for blurring along the x axis. + * @param sigmaY Indicates the Gaussian sigma value for blurring along the y axis. + * @param tileMode Indicates the tile mode applied at edges. + * @param imageFilter Indicates the input filter that is blurred, uses source bitmap if this is null. + * @param cropRect Indicates optional rectangle that crops the input and output. + * @return Returns the pointer to the OH_Drawing_ImageFilter object created. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlurWithCrop(float sigmaX, float sigmaY, OH_Drawing_TileMode tileMode, + OH_Drawing_ImageFilter* imageFilter, const OH_Drawing_Rect* cropRect); + /** * @brief Creates an OH_Drawing_ImageFilter object that applies the color filter to the input. * diff --git a/graphic/graphic_2d/native_drawing/drawing_sampling_options.h b/graphic/graphic_2d/native_drawing/drawing_sampling_options.h index 12a90a087976fd9ac76ee607786ac032dc9b9d44..e198d6ed14b387734e19036a0a8e604a0fc1011f 100644 --- a/graphic/graphic_2d/native_drawing/drawing_sampling_options.h +++ b/graphic/graphic_2d/native_drawing/drawing_sampling_options.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -87,6 +87,17 @@ typedef enum { OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode filterMode, OH_Drawing_MipmapMode mipmapMode); +/** + * @brief Creates an OH_Drawing_SamplingOptions copy object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param samplingOptions sIndicates the pointer to an OH_Drawing_SamplingOptions object. + * @return Returns the pointer to the OH_Drawing_SamplingOptions object created. + * @since 20 + * @version 1.0 + */ +OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCopy(OH_Drawing_SamplingOptions* samplingOptions); + /** * @brief Destroys an OH_Drawing_SamplingOptions object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 2ea2b4a7e2959ecffa87ed866cb7d542313c53f7..de99a1f44c0254d675454044751df90f4dbd13cf 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -96,6 +96,10 @@ "first_introduced": "12", "name": "OH_Drawing_CanvasDrawPixelMapRect" }, + { + "first_introduced": "20", + "name": "OH_Drawing_CanvasDrawPixelMapRectConstraint" + }, { "first_introduced": "12", "name": "OH_Drawing_CanvasDrawPoints" @@ -378,6 +382,10 @@ "first_introduced": "12", "name": "OH_Drawing_ImageFilterCreateBlur" }, + { + "first_introduced": "20", + "name": "OH_Drawing_ImageFilterCreateBlurWithCrop" + }, { "first_introduced": "12", "name": "OH_Drawing_ImageFilterCreateFromColorFilter" @@ -921,6 +929,10 @@ "name": "OH_Drawing_ImageGetImageInfo" }, { "name": "OH_Drawing_SamplingOptionsCreate" }, + { + "first_introduced": "20", + "name": "OH_Drawing_SamplingOptionsCopy" + }, { "name": "OH_Drawing_SamplingOptionsDestroy" }, { "first_introduced": "12",