From a330bc32d5f1077858e1e20c98a2b5dd646bf07d Mon Sep 17 00:00:00 2001 From: lw19901203 Date: Mon, 28 Oct 2024 16:03:39 +0800 Subject: [PATCH] update colorfilter and maskfilter sdk c interface Signed-off-by: lw19901203 Change-Id: I0accec5dad7d404dbfd861de60343dc850050e4c --- .../native_drawing/drawing_color_filter.h | 13 +++++++ .../native_drawing/drawing_mask_filter.h | 38 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 16 ++++++++ 3 files changed, 67 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_color_filter.h b/graphic/graphic_2d/native_drawing/drawing_color_filter.h index 98907ba17..3b37b5573 100644 --- a/graphic/graphic_2d/native_drawing/drawing_color_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_color_filter.h @@ -113,6 +113,19 @@ OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear(void); */ OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma(void); +/** + * @brief Creates an OH_Drawing_ColorFilter with the given mutColor used to multiply source color and addColor + * used to add to source color. The Alpha channel will not be affected. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param mulColor Indicates the color, which is a 32-bit (ARGB) variable. + * @param addColor Indicates the color, which is a 32-bit (ARGB) variable. + * @return Returns the pointer to the OH_Drawing_ColorFilter object created. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLighting(uint32_t mulColor, uint32_t addColor); + /** * @brief Destroys an OH_Drawing_ColorFilter object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_mask_filter.h b/graphic/graphic_2d/native_drawing/drawing_mask_filter.h index 86f487bfe..d13ba9c89 100644 --- a/graphic/graphic_2d/native_drawing/drawing_mask_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_mask_filter.h @@ -84,6 +84,44 @@ typedef enum { */ OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur(OH_Drawing_BlurType blurType, float sigma, bool respectCTM); +/** + * @brief Creates an OH_Drawing_MaskFilter with a table effect. + * + * This API generates an error code, you can view the value of the error code by using {@link OH_Drawing_ErrorCodeGet}. + * Returns OH_DRAWING_SUCCESS when the execution is successful; + * When table is null, OH_DRAWING_ERROR_INVALID_PARAMETER is returned. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param table Indicates a lookup table is applied to each alpha value in the mask. table.length must be = 256. + * @return Returns the pointer to the OH_Drawing_MaskFilter object created. + * @since 14 + * @version 1.0 + */ +OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateTable(uint8_t table[256]); + +/** + * @brief Creates an OH_Drawing_MaskFilter with a clip table effect. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param min Indicates the minimum value used for comparison with the clipping table. + * @param max Indicates the maximum value used for comparison with the clipping table. + * @return Returns the pointer to the OH_Drawing_MaskFilter object created. + * @since 14 + * @version 1.0 + */ +OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateClipTable(uint8_t min, uint8_t max); + +/** + * @brief Creates an OH_Drawing_MaskFilter with a gamma table effect. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param gamma Indicates the gamma value used for comparison with the gamma table. + * @return Returns the pointer to the OH_Drawing_MaskFilter object created. + * @since 14 + * @version 1.0 + */ +OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateGammaTable(float gamma); + /** * @brief Destroys an OH_Drawing_MaskFilter 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 353ce3f53..e4b660431 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -157,6 +157,10 @@ { "name": "OH_Drawing_ColorFilterCreateCompose" }, { "name": "OH_Drawing_ColorFilterCreateLinearToSrgbGamma" }, { "name": "OH_Drawing_ColorFilterCreateLuma" }, + { + "first_introduced": "14", + "name": "OH_Drawing_ColorFilterCreateLighting" + }, { "name": "OH_Drawing_ColorFilterCreateMatrix" }, { "name": "OH_Drawing_ColorFilterCreateSrgbGammaToLinear" }, { "name": "OH_Drawing_ColorFilterDestroy" }, @@ -307,6 +311,18 @@ "name": "OH_Drawing_ImageFilterDestroy" }, { "name": "OH_Drawing_MaskFilterCreateBlur" }, + { + "first_introduced": "14", + "name": "OH_Drawing_MaskFilterCreateTable" + }, + { + "first_introduced": "14", + "name": "OH_Drawing_MaskFilterCreateClipTable" + }, + { + "first_introduced": "14", + "name": "OH_Drawing_MaskFilterCreateGammaTable" + }, { "name": "OH_Drawing_MaskFilterDestroy" }, { "name": "OH_Drawing_MatrixCreate" }, { "name": "OH_Drawing_MatrixCreateRotation" }, -- Gitee