diff --git a/graphic/graphic_2d/native_drawing/drawing_color_filter.h b/graphic/graphic_2d/native_drawing/drawing_color_filter.h index 051ef91bd0c699c01083266df27b1d2df252f4b0..bfad30b6bd6d1a01dd277e728ec29d9a87e0f3ce 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 20 + * @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_image_filter.h b/graphic/graphic_2d/native_drawing/drawing_image_filter.h index 3fde3b7248d2225700aa8043aee6bfd5497c4028..90d1f21f286c1664c2045fa8d0d4191a31c5d608 100644 --- a/graphic/graphic_2d/native_drawing/drawing_image_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_image_filter.h @@ -79,6 +79,35 @@ OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sig OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter(OH_Drawing_ColorFilter* colorFilter, OH_Drawing_ImageFilter* imageFilter); +/** + * @brief Creates an OH_Drawing_ImageFilter object with the provided x and y offset. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param x Indicates the x offset. + * @param y Indicates the y offset. + * @param imageFilter Indicates the input filter, or uses the source bitmap if this is null. + * @return Returns the pointer to the OH_Drawing_ImageFilter object created. + * If nullptr is returned, the creation fails. + * The possible cause of the failure is that the available memory is empty. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateOffset(float x, float y, OH_Drawing_ImageFilter* imageFilter); + +/** + * @brief Creates an OH_Drawing_ImageFilter object that applies the shader to the input. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param shaderEffct Indicates the shader effect to be applied to the image. + * @return Returns the pointer to the OH_Drawing_ImageFilter object created. + * If nullptr is returned, the creation fails. + * The possible cause of the failure is that the available memory is empty or + * a nullptr OH_Drawing_ShaderEffect is passed. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromShaderEffect(OH_Drawing_ShaderEffect* shaderEffct); + /** * @brief Destroys an OH_Drawing_ImageFilter object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h index b42156a5fcde2a861d16cb6ea73164452a1059fb..b7ec8b28c17dc7e8f83276902e16e58a7f4faf2a 100644 --- a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h +++ b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h @@ -167,6 +167,26 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMat const OH_Drawing_Point2D* centerPt, float radius, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode tileMode, const OH_Drawing_Matrix* matrix); +/** + * @brief Creates an OH_Drawing_ShaderEffect that generates a sweep gradient given a center. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param centerPt Indicates the center of the circle for the gradient. + * @param colors Indicates the colors to be distributed between the two points. + * @param pos Indicates the relative position of each corresponding color in the colors array. + * @param size Indicates the number of colors and pos. + * @param tileMode Indicates the tile mode. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object, + which represents the local matrix of the created OH_Drawing_ShaderEffect object. + If matrix is nullptr, defaults to the identity matrix. + * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradientWithLocalMatrix( + const OH_Drawing_Point* centerPt, const uint32_t* colors, const float* pos, uint32_t size, + OH_Drawing_TileMode tileMode, const OH_Drawing_Matrix* matrix); + /** * @brief Creates an OH_Drawing_ShaderEffect that generates a sweep gradient given a center. * @@ -226,6 +246,22 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateTwoPointConicalGradient(co float startRadius, const OH_Drawing_Point2D* endPt, float endRadius, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode tileMode, const OH_Drawing_Matrix* matrix); +/** + * @brief Creates an OH_Drawing_ShaderEffect that generates by two shaders.. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param dst Indicates the destination ShaderEffect pointer. + * @param src Indicates the source ShaderEffect pointer. + * @param mode Indicates the blend mode. + * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. + * If nullptr is returned, the creation fails. + * The possible cause of the failure is that the available memory is empty or any of dst and src is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateCompose(OH_Drawing_ShaderEffect* dst, + OH_Drawing_ShaderEffect* src, OH_Drawing_BlendMode mode); + /** * @brief Destroys an OH_Drawing_ShaderEffect 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 e13687d429e5ac4b5fe5f166a49471ba61797534..44153abe06ace7572b76caf3ca6450713d6b9ba1 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -177,6 +177,10 @@ { "name": "OH_Drawing_ColorFilterCreateCompose" }, { "name": "OH_Drawing_ColorFilterCreateLinearToSrgbGamma" }, { "name": "OH_Drawing_ColorFilterCreateLuma" }, + { + "first_introduced": "20", + "name": "OH_Drawing_ColorFilterCreateLighting" + }, { "name": "OH_Drawing_ColorFilterCreateMatrix" }, { "name": "OH_Drawing_ColorFilterCreateSrgbGammaToLinear" }, { "name": "OH_Drawing_ColorFilterDestroy" }, @@ -338,6 +342,14 @@ "first_introduced": "12", "name": "OH_Drawing_ImageFilterCreateFromColorFilter" }, + { + "first_introduced": "20", + "name": "OH_Drawing_ImageFilterCreateOffset" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_ImageFilterCreateFromShaderEffect" + }, { "first_introduced": "12", "name": "OH_Drawing_ImageFilterDestroy" @@ -694,6 +706,10 @@ "first_introduced": "12", "name": "OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix" }, + { + "first_introduced": "20", + "name": "OH_Drawing_ShaderEffectCreateSweepGradientWithLocalMatrix" + }, { "name": "OH_Drawing_ShaderEffectCreateSweepGradient" }, { "first_introduced": "12", @@ -703,6 +719,10 @@ "first_introduced": "12", "name": "OH_Drawing_ShaderEffectCreateTwoPointConicalGradient" }, + { + "first_introduced": "20", + "name": "OH_Drawing_ShaderEffectCreateCompose" + }, { "name": "OH_Drawing_ShaderEffectDestroy" }, { "first_introduced": "12",