diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn
index 35a37961937cb91ad9e352fea4d09163a04ef754..f4ba43a3231d40be0e78cba1dd72e539284520fe 100644
--- a/graphic/graphic_2d/native_drawing/BUILD.gn
+++ b/graphic/graphic_2d/native_drawing/BUILD.gn
@@ -29,6 +29,7 @@ ohos_ndk_headers("native_drawing_header") {
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_font_mgr.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_gpu_context.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_image.h",
+ "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_image_filter.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_mask_filter.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_matrix.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_memory_stream.h",
@@ -83,6 +84,7 @@ ohos_ndk_library("libnative_drawing_ndk") {
"native_drawing/drawing_register_font.h",
"native_drawing/drawing_round_rect.h",
"native_drawing/drawing_image.h",
+ "native_drawing/drawing_image_filter.h",
"native_drawing/drawing_sampling_options.h",
"native_drawing/drawing_shader_effect.h",
"native_drawing/drawing_shadow_layer.h",
diff --git a/graphic/graphic_2d/native_drawing/drawing_brush.h b/graphic/graphic_2d/native_drawing/drawing_brush.h
index 98a50756b87b1e9572fecf919a5eb5e50630b55d..853c669a3f6ebc519002ba0e3763f6265dbf5d92 100644
--- a/graphic/graphic_2d/native_drawing/drawing_brush.h
+++ b/graphic/graphic_2d/native_drawing/drawing_brush.h
@@ -53,6 +53,19 @@ extern "C" {
*/
OH_Drawing_Brush* OH_Drawing_BrushCreate(void);
+/**
+ * @brief Creates an OH_Drawing_Brush copy object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object.
+ * @return Returns the pointer to the OH_Drawing_Brush 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 is passed.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Brush* OH_Drawing_BrushCopy(OH_Drawing_Brush*);
+
/**
* @brief Destroys an OH_Drawing_Brush object and reclaims the memory occupied by the object.
*
diff --git a/graphic/graphic_2d/native_drawing/drawing_filter.h b/graphic/graphic_2d/native_drawing/drawing_filter.h
index 556c19d85ca81f103cb50f3ba1cd85e37cd80941..57eac2fa6d16252fd815966602d05de554570a01 100644
--- a/graphic/graphic_2d/native_drawing/drawing_filter.h
+++ b/graphic/graphic_2d/native_drawing/drawing_filter.h
@@ -53,6 +53,17 @@ extern "C" {
*/
OH_Drawing_Filter* OH_Drawing_FilterCreate(void);
+/**
+ * @brief Sets an OH_Drawing_ImageFilter object for an OH_Drawing_Filter object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object.
+ * @param OH_Drawing_ImageFilter Indicates the pointer to an OH_Drawing_ImageFilter object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FilterSetImageFilter(OH_Drawing_Filter*, OH_Drawing_ImageFilter*);
+
/**
* @brief Sets an OH_Drawing_MaskFilter object for an OH_Drawing_Filter object.
*
diff --git a/graphic/graphic_2d/native_drawing/drawing_image_filter.h b/graphic/graphic_2d/native_drawing/drawing_image_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..3db6e90d018d6b3743ed660138859331557c27cd
--- /dev/null
+++ b/graphic/graphic_2d/native_drawing/drawing_image_filter.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2024 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_IMAGE_FILTER_H
+#define C_INCLUDE_DRAWING_IMAGE_FILTER_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_image_filter.h
+ *
+ * @brief Declares functions related to the imageFilter object in the drawing module.
+ *
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_shader_effect.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @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 OH_Drawing_TileMode Indicates the tile mode applied at edges.
+ * @param OH_Drawing_ImageFilter Indicates the input filter that is blurred, uses 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 12
+ * @version 1.0
+ */
+OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sigmaY, OH_Drawing_TileMode,
+ OH_Drawing_ImageFilter*);
+
+/**
+ * @brief Creates an OH_Drawing_ImageFilter object that applies the color filter to the input.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_ColorFilter Indicates the color filter that transforms the input image.
+ * @param OH_Drawing_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 or
+ * a nullptr OH_Drawing_ColorFilter is passed.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter(OH_Drawing_ColorFilter*, OH_Drawing_ImageFilter*);
+
+/**
+ * @brief Destroys an OH_Drawing_ImageFilter object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_ImageFilter Indicates the pointer to an OH_Drawing_ImageFilter object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_ImageFilterDestroy(OH_Drawing_ImageFilter*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
\ No newline at end of file
diff --git a/graphic/graphic_2d/native_drawing/drawing_matrix.h b/graphic/graphic_2d/native_drawing/drawing_matrix.h
index a2ae15adb71f0f23aa0520788fac83f85cbae2a8..e26f2fb4937f2f7554e9f7c48de3b05da9006b8b 100644
--- a/graphic/graphic_2d/native_drawing/drawing_matrix.h
+++ b/graphic/graphic_2d/native_drawing/drawing_matrix.h
@@ -434,6 +434,33 @@ bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix*, OH_Drawing_Matrix* inverse);
bool OH_Drawing_MatrixSetPolyToPoly(OH_Drawing_Matrix*, const OH_Drawing_Point2D* src,
const OH_Drawing_Point2D* dst, uint32_t count);
+/**
+ * @brief Maps the src point array to the dst point array by matrix transformation.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object.
+ * @param src Points to map from.
+ * @param dst Points to map to.
+ * @param count Number of point in src and dst.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixMapPoints(const OH_Drawing_Matrix*, const OH_Drawing_Point2D* src,
+ OH_Drawing_Point2D* dst, int count);
+
+/**
+ * @brief Sets dst to bounds of src corners mapped by matrix transformation.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object.
+ * @param src Rect to map from.
+ * @param dst Rect to map to.
+ * @return Returns true if the mapped src is equal to the dst; returns false is not equal.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_MatrixMapRect(const OH_Drawing_Matrix*, const OH_Drawing_Rect* src, OH_Drawing_Rect* dst);
+
/**
* @brief Returns true if the first matrix equals the second matrix.
*
diff --git a/graphic/graphic_2d/native_drawing/drawing_path.h b/graphic/graphic_2d/native_drawing/drawing_path.h
index d82a70df860cc5b61f39d9495791b9af6ba2ac5d..c33bea8c844a2838c403aca31cc24932c3439bd4 100644
--- a/graphic/graphic_2d/native_drawing/drawing_path.h
+++ b/graphic/graphic_2d/native_drawing/drawing_path.h
@@ -86,6 +86,56 @@ typedef enum {
PATH_ADD_MODE_EXTEND,
} OH_Drawing_PathAddMode;
+/**
+ * @brief Operations when two paths are combined.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum {
+ /**
+ * Difference operation.
+ */
+ PATH_OP_MODE_DIFFERENCE,
+ /**
+ * Intersect operation.
+ */
+ PATH_OP_MODE_INTERSECT,
+ /**
+ * Union operation.
+ */
+ PATH_OP_MODE_UNION,
+ /**
+ * Xor operation.
+ */
+ PATH_OP_MODE_XOR,
+ /**
+ * Reverse difference operation.
+ */
+ PATH_OP_MODE_REVERSE_DIFFERENCE,
+} OH_Drawing_PathOpMode;
+
+/**
+ * @brief Enumerates the matrix information corresponding to the path measurements.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum {
+ /**
+ * Gets position.
+ */
+ GET_POSITION_MATRIX,
+ /**
+ * Gets tangent.
+ */
+ GET_TANGENT_MATRIX,
+ /**
+ * Gets both position and tangent.
+ */
+ GET_POSITION_AND_TANGENT_MATRIX,
+} OH_Drawing_PathMeasureMatrixFlags;
+
/**
* @brief Creates an OH_Drawing_Path object.
*
@@ -420,6 +470,45 @@ void OH_Drawing_PathAddPathWithMode(OH_Drawing_Path* path, const OH_Drawing_Path
void OH_Drawing_PathAddPathWithOffsetAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy,
OH_Drawing_PathAddMode);
+/**
+ * @brief Adds contour created from point array, adding (count - 1) line segments.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @param points Indicates the point array.
+ * @param count Indicates the size of point array.
+ * @param isClosed Indicates Whether to add lines that connect the end and start.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddPolygon(OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed);
+
+/**
+ * @brief Adds a circle to the path, and wound in the specified direction.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @param x Indicates the x coordinate of the center of the circle.
+ * @param y Indicates the y coordinate of the center of the circle.
+ * @param radius Indicates the radius of the circle.
+ * @param OH_Drawing_PathDirection Indicates the path direction.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddCircle(OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection);
+
+/**
+ * @brief Parses the svg path from the string.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @param str Indicates the string of the SVG path.
+ * @return Returns true if build path is successful, returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathBuildFromSvgString(OH_Drawing_Path* path, const char* str);
+
/**
* @brief Return the status that point (x, y) is contained by path.
*
@@ -483,6 +572,17 @@ void OH_Drawing_PathSetFillType(OH_Drawing_Path*, OH_Drawing_PathFillType);
*/
float OH_Drawing_PathGetLength(OH_Drawing_Path*, bool forceClosed);
+/**
+ * @brief Gets the smallest bounding box that contains the path.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
+ * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathGetBounds(OH_Drawing_Path*, OH_Drawing_Rect*);
+
/**
* @brief Closes a path. A line segment from the start point to the last point of the path is added.
*
@@ -516,6 +616,64 @@ void OH_Drawing_PathOffset(OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx
*/
void OH_Drawing_PathReset(OH_Drawing_Path*);
+/**
+ * @brief Determines whether the path current contour is closed.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @param forceClosed Whether to close the Path.
+ * @return Returns true if the path current contour is closed; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathIsClosed(OH_Drawing_Path* path, bool forceClosed);
+
+/**
+ * @brief Gets the position and tangent of the distance from the starting position of the Path.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @param forceClosed Whether to close the Path.
+ * @param distance The distance from the start of the Path.
+ * @param position Sets to the position of distance from the starting position of the Path.
+ * @param tangent Sets to the tangent of distance from the starting position of the Path.
+ * @return Returns true if succeeded; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathGetPositionTangent(OH_Drawing_Path* path, bool forceClosed,
+ float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent);
+
+/**
+ * @brief Combines two paths.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @param srcPath Indicates the pointer to an OH_Drawing_Path object.
+ * @param op Indicates the operation to apply to combine.
+ * @return Returns true if constructed path is not empty; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathOp(OH_Drawing_Path* path, const OH_Drawing_Path* srcPath, OH_Drawing_PathOpMode op);
+
+/**
+ * @brief Computes the corresponding matrix at the specified distance.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @param forceClosed Whether to close the Path.
+ * @param distance The distance from the start of the Path.
+ * @param matrix Indicates the pointer to an OH_Drawing_Matrix object.
+ * @param flag Indicates what should be returned in the matrix.
+ * @return Returns false if path is nullptr or zero-length;
+ returns true if path is not nullptr and not zero-length.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathGetMatrix(OH_Drawing_Path* path, bool forceClosed,
+ float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag);
+
#ifdef __cplusplus
}
#endif
diff --git a/graphic/graphic_2d/native_drawing/drawing_pen.h b/graphic/graphic_2d/native_drawing/drawing_pen.h
index 8d7f38726b951ade72a0c9adaec9d56acebd02ad..f191ae91f6bd634021954728c84a00c89ae7c5f0 100644
--- a/graphic/graphic_2d/native_drawing/drawing_pen.h
+++ b/graphic/graphic_2d/native_drawing/drawing_pen.h
@@ -53,6 +53,19 @@ extern "C" {
*/
OH_Drawing_Pen* OH_Drawing_PenCreate(void);
+/**
+ * @brief Creates an OH_Drawing_Pen copy object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @return Returns the pointer to the OH_Drawing_Pen 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 is passed.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Pen* OH_Drawing_PenCopy(OH_Drawing_Pen*);
+
/**
* @brief Destroys an OH_Drawing_Pen object and reclaims the memory occupied by the object.
*
@@ -335,6 +348,24 @@ void OH_Drawing_PenGetFilter(OH_Drawing_Pen*, OH_Drawing_Filter*);
*/
void OH_Drawing_PenSetBlendMode(OH_Drawing_Pen*, OH_Drawing_BlendMode);
+/**
+ * @brief Gets the filled equivalent of the src path.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @param src Indicates the Path read to create a filled version.
+ * @param dst Indicates the resulting Path.
+ * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object that limits the PathEffect area if
+ Pen has PathEffect.
+ * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object that tranfomation applied to
+ PathEffect if Pen has PathEffect.
+ * @return Returns true if get successes; false if get fails.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PenGetFillPath(OH_Drawing_Pen*, const OH_Drawing_Path* src, OH_Drawing_Path* dst,
+ const OH_Drawing_Rect*, const OH_Drawing_Matrix*);
+
/**
* @brief Resets all pen contents to their initial values.
*
diff --git a/graphic/graphic_2d/native_drawing/drawing_pixel_map.h b/graphic/graphic_2d/native_drawing/drawing_pixel_map.h
index 2203d9fd23694d89a2bbe86414ddb2a92cbb8e76..512c515a3ad46794aac2c3db624d28024f9198e0 100644
--- a/graphic/graphic_2d/native_drawing/drawing_pixel_map.h
+++ b/graphic/graphic_2d/native_drawing/drawing_pixel_map.h
@@ -50,6 +50,13 @@ extern "C" {
*/
struct NativePixelMap_;
+/**
+ * @brief Introduces the native pixel map information defined by image framework.
+ * @since 12
+ * @version 1.0
+ */
+struct OH_PixelmapNative;
+
/**
* @brief Gets an OH_Drawing_PixelMap object.
*
@@ -61,6 +68,30 @@ struct NativePixelMap_;
*/
OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap(NativePixelMap_*);
+/**
+ * @brief Gets an OH_Drawing_PixelMap object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_PixelmapNative Indicates a pointer to the OH_PixelmapNative object supported by image framework.
+ * @return Returns the pointer to the OH_Drawing_PixelMap object.
+ * If nullptr is returned, the get operation fails.
+ * The possible cause of the failure is that a nullptr is passed.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative(OH_PixelmapNative*);
+
+/**
+ * @brief Dissolves the relationship between OH_Drawing_PixelMap object and NativePixelMap_ or
+ OH_PixelmapNative which is build by 'GetFrom' function.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_PixelMap Indicates a pointer to the OH_Drawing_PixelMap.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PixelMapDissolve(OH_Drawing_PixelMap*);
+
#ifdef __cplusplus
}
#endif
diff --git a/graphic/graphic_2d/native_drawing/drawing_rect.h b/graphic/graphic_2d/native_drawing/drawing_rect.h
index 49a7a75303eef9c4a5a44b0a5fe093260a72b97e..da4195aa1a35b1f2881fcd5f39363359c071b674 100644
--- a/graphic/graphic_2d/native_drawing/drawing_rect.h
+++ b/graphic/graphic_2d/native_drawing/drawing_rect.h
@@ -69,6 +69,19 @@ OH_Drawing_Rect* OH_Drawing_RectCreate(float left, float top, float right, float
*/
bool OH_Drawing_RectIntersect(OH_Drawing_Rect* rect, const OH_Drawing_Rect* other);
+/**
+ * @brief Sets rect to the union of rect and other.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rect Indicates the pointer to an OH_Drawing_Rect object.
+ * @param other Indicates the pointer to an OH_Drawing_Rect object.
+ * @return Returns true if rect and other are not nullptr, and other is not empty;
+ * false if rect or other is nullptr, or other is empty.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RectJoin(OH_Drawing_Rect* rect, const OH_Drawing_Rect* other);
+
/**
* @brief Set the left position of the rect.
*
diff --git a/graphic/graphic_2d/native_drawing/drawing_region.h b/graphic/graphic_2d/native_drawing/drawing_region.h
index b145f999e085bd16ea5919ab203ea43e17c8de15..572625aa7432e6c7e48635ff4b2a5334ebb4dafa 100644
--- a/graphic/graphic_2d/native_drawing/drawing_region.h
+++ b/graphic/graphic_2d/native_drawing/drawing_region.h
@@ -43,6 +43,39 @@
extern "C" {
#endif
+/**
+ * @brief Operations when two regions are combined.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum {
+ /**
+ * Difference operation.
+ */
+ REGION_OP_MODE_DIFFERENCE,
+ /**
+ * Intersect operation.
+ */
+ REGION_OP_MODE_INTERSECT,
+ /**
+ * Union operation.
+ */
+ REGION_OP_MODE_UNION,
+ /**
+ * Xor operation.
+ */
+ REGION_OP_MODE_XOR,
+ /**
+ * Reverse difference operation.
+ */
+ REGION_OP_MODE_REVERSE_DIFFERENCE,
+ /**
+ * Replace operation.
+ */
+ REGION_OP_MODE_REPLACE,
+} OH_Drawing_RegionOpMode;
+
/**
* @brief Creates an OH_Drawing_Region object.
*
@@ -53,6 +86,32 @@ extern "C" {
*/
OH_Drawing_Region* OH_Drawing_RegionCreate(void);
+/**
+ * @brief Determines whether the region contains the specified coordinates.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param region Indicates the pointer to an OH_Drawing_Region object.
+ * @param int32_t x-coordinate.
+ * @param int32_t y-coordinate.
+ * @return Returns true if (x, y) is inside region; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RegionContains(OH_Drawing_Region* region, int32_t x, int32_t y);
+
+/**
+ * @brief Combines two regions.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param region Indicates the pointer to an OH_Drawing_Region object.
+ * @param dst Indicates the pointer to an OH_Drawing_Region object.
+ * @param op Indicates the operation to apply to combine.
+ * @return Returns true if constructed Region is not empty; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RegionOp(OH_Drawing_Region* region, const OH_Drawing_Region* dst, OH_Drawing_RegionOpMode op);
+
/**
* @brief Destroys an OH_Drawing_Region object and reclaims the memory occupied by the object.
*
@@ -65,6 +124,19 @@ OH_Drawing_Region* OH_Drawing_RegionCreate(void);
*/
bool OH_Drawing_RegionSetRect(OH_Drawing_Region* region, const OH_Drawing_Rect* rect);
+/**
+ * @brief Constructs region that matchs outline of path within clip.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param region Indicates the pointer to an OH_Drawing_Region object.
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @param clip Indicates the pointer to an OH_Drawing_Region object.
+ * @return Returns true if constructed Region is not empty; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RegionSetPath(OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip);
+
/**
* @brief Destroys an OH_Drawing_Region 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 3bd2368d2639045f2cf4c2f346fa6edba69ee865..8cf8e8802b8df08dc27ba0040f5c8a1187cf148a 100644
--- a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h
+++ b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h
@@ -69,6 +69,19 @@ typedef enum {
DECAL,
} OH_Drawing_TileMode;
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect that generates a shader with single color.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param color Indicates the color used by the shader.
+ * @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.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader(const uint32_t color);
+
/**
* @brief Creates an OH_Drawing_ShaderEffect that generates a linear gradient between the two specified points.
*
@@ -86,6 +99,30 @@ typedef enum {
OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradient(const OH_Drawing_Point* startPt,
const OH_Drawing_Point* endPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode);
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect that generates a linear gradient between the two specified points.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param startPt Indicates the start point for the gradient.
+ * @param endPt Indicates the end point 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.
+ * If pos is nullptr, the colors are evenly distributed between the start and end point.
+ * @param size Indicates the number of colors and pos(if pos is not nullptr).
+ * @param OH_Drawing_TileMode Indicates the tile mode.
+ * @param OH_Drawing_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.
+ * If nullptr is returned, the creation fails.
+ * The possible cause of the failure is any of startPt, endPt, colors and pos is nullptr.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix(
+ const OH_Drawing_Point2D* startPt, const OH_Drawing_Point2D* endPt, const uint32_t* colors, const float* pos,
+ uint32_t size, OH_Drawing_TileMode, const OH_Drawing_Matrix*);
+
/**
* @brief Creates an OH_Drawing_ShaderEffect that generates a radial gradient given the center and radius.
*
@@ -103,6 +140,29 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradient(const OH_Dr
OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradient(const OH_Drawing_Point* centerPt, float radius,
const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode);
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect that generates a radial gradient given the center and radius.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param centerPt Indicates the center of the circle for the gradient.
+ * @param radius Indicates the radius of the circle for this 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 OH_Drawing_TileMode Indicates the tile mode.
+ * @param OH_Drawing_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.
+ * If nullptr is returned, the creation fails.
+ * The possible cause of the failure is any of centerPt, colors and pos is nullptr.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix(
+ const OH_Drawing_Point2D* centerPt, float radius, const uint32_t* colors, const float* pos, uint32_t size,
+ OH_Drawing_TileMode, const OH_Drawing_Matrix*);
+
/**
* @brief Creates an OH_Drawing_ShaderEffect that generates a sweep gradient given a center.
*
diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h
index 870a910b4936912b7bbbdc342f1f17ddea26fd31..1f1a94aeee303a26a6a5cca863e95660ec4c0e5b 100644
--- a/graphic/graphic_2d/native_drawing/drawing_types.h
+++ b/graphic/graphic_2d/native_drawing/drawing_types.h
@@ -197,7 +197,7 @@ typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect;
typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer;
/**
- * @brief Defines a filter, which is used to store maskFilter and colorFilter.
+ * @brief Defines a filter, which is used to store maskFilter, colorFilter and imageFilter.
*
* @since 11
* @version 1.0
@@ -261,6 +261,14 @@ typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob;
*/
typedef struct OH_Drawing_Image OH_Drawing_Image;
+/**
+ * @brief Defines a image filter, which is used to operate on all the color bits of pixels that make up an image.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_ImageFilter OH_Drawing_ImageFilter;
+
/**
* @brief Defines a sampling options, which is used to describe the sampling mode.
*
diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
index e41daf79704162c2bff6fbd9146f76e5dbfc9cd9..64230020e53b93dd3a4dc14217e14e84094d803f 100644
--- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
+++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
@@ -23,6 +23,10 @@
"name": "OH_Drawing_BitmapReadPixels"
},
{ "name": "OH_Drawing_BrushCreate" },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_BrushCopy"
+ },
{ "name": "OH_Drawing_BrushDestroy" },
{ "name": "OH_Drawing_BrushGetAlpha" },
{ "name": "OH_Drawing_BrushSetAlpha" },
@@ -134,6 +138,10 @@
"first_introduced": "12",
"name": "OH_Drawing_FilterGetColorFilter"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FilterSetImageFilter"
+ },
{ "name": "OH_Drawing_FilterSetMaskFilter" },
{ "name": "OH_Drawing_FilterDestroy" },
{ "name": "OH_Drawing_FontCreate" },
@@ -234,12 +242,32 @@
"first_introduced": "12",
"name": "OH_Drawing_GpuContextDestroy"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_ImageFilterCreateBlur"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_ImageFilterCreateFromColorFilter"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_ImageFilterDestroy"
+ },
{ "name": "OH_Drawing_MaskFilterCreateBlur" },
{ "name": "OH_Drawing_MaskFilterDestroy" },
{ "name": "OH_Drawing_MatrixCreate" },
{ "name": "OH_Drawing_MatrixCreateRotation" },
{ "name": "OH_Drawing_MatrixCreateScale" },
{ "name": "OH_Drawing_MatrixCreateTranslation" },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_MatrixMapPoints"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_MatrixMapRect"
+ },
{ "name": "OH_Drawing_MatrixSetMatrix" },
{
"first_introduced": "12",
@@ -286,6 +314,10 @@
{ "name": "OH_Drawing_MatrixIsEqual" },
{ "name": "OH_Drawing_MatrixIsIdentity" },
{ "name": "OH_Drawing_MatrixDestroy" },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PathBuildFromSvgString"
+ },
{ "name": "OH_Drawing_PathCreate" },
{ "name": "OH_Drawing_PathCopy" },
{ "name": "OH_Drawing_PathDestroy" },
@@ -318,6 +350,10 @@
"first_introduced": "12",
"name": "OH_Drawing_PathRCubicTo"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PathAddCircle"
+ },
{ "name": "OH_Drawing_PathAddRect" },
{
"first_introduced": "12",
@@ -342,6 +378,14 @@
"first_introduced": "12",
"name": "OH_Drawing_PathAddPathWithOffsetAndMode"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PathAddPolygon"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PathGetBounds"
+ },
{
"first_introduced": "12",
"name": "OH_Drawing_PathGetLength"
@@ -363,6 +407,26 @@
"name": "OH_Drawing_PathOffset"
},
{ "name": "OH_Drawing_PathReset" },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PathIsClosed"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PathGetPositionTangent"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PathOp"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PathGetMatrix"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PenCopy"
+ },
{ "name": "OH_Drawing_PenCreate" },
{ "name": "OH_Drawing_PenDestroy" },
{ "name": "OH_Drawing_PenGetAlpha" },
@@ -380,6 +444,10 @@
{ "name": "OH_Drawing_PenSetCap" },
{ "name": "OH_Drawing_PenGetJoin" },
{ "name": "OH_Drawing_PenSetJoin" },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PenGetFillPath"
+ },
{ "name": "OH_Drawing_PenSetFilter" },
{
"first_introduced": "12",
@@ -427,6 +495,10 @@
"first_introduced": "12",
"name": "OH_Drawing_RectIntersect"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_RectJoin"
+ },
{
"first_introduced": "12",
"name": "OH_Drawing_RectSetLeft"
@@ -492,8 +564,20 @@
{ "name": "OH_Drawing_SetTextStyleFontFamilies" },
{ "name": "OH_Drawing_SetTextStyleFontStyle" },
{ "name": "OH_Drawing_SetTextStyleLocale" },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_ShaderEffectCreateColorShader"
+ },
{ "name": "OH_Drawing_ShaderEffectCreateLinearGradient" },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix"
+ },
{ "name": "OH_Drawing_ShaderEffectCreateRadialGradient" },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix"
+ },
{ "name": "OH_Drawing_ShaderEffectCreateSweepGradient" },
{
"first_introduced": "12",
@@ -559,6 +643,14 @@
"first_introduced": "12",
"name": "OH_Drawing_PixelMapGetFromNativePixelMap"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PixelMapGetFromOhPixelMapNative"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_PixelMapDissolve"
+ },
{ "name": "OH_Drawing_ImageCreate" },
{ "name": "OH_Drawing_ImageDestroy" },
{ "name": "OH_Drawing_ImageBuildFromBitmap" },
@@ -926,6 +1018,18 @@
"first_introduced": "12",
"name": "OH_Drawing_RegionCreate"
},
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_RegionContains"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_RegionOp"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_RegionSetPath"
+ },
{
"first_introduced": "12",
"name": "OH_Drawing_RegionDestroy"