diff --git a/graphic/graphic_2d/native_drawing/drawing_canvas.h b/graphic/graphic_2d/native_drawing/drawing_canvas.h index 8b423b99999d14d6a76ff6f1d2d9922e2bf48bb7..baebc08e998517c2174a7c20b73ada0a38a87872 100644 --- a/graphic/graphic_2d/native_drawing/drawing_canvas.h +++ b/graphic/graphic_2d/native_drawing/drawing_canvas.h @@ -164,6 +164,77 @@ void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, */ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); +/** + * @brief Draws a bitmap. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param left Indicates the left position of the OH_Drawing_Bitmap. + * @param top Indicates the top position of the OH_Drawing_Bitmap. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); + +/** + * @brief Enumerates clip op. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** + * Clip with difference. + */ + DIFFERENCE, + /** + * Clip with intersection. + */ + INTERSECT, +} OH_Drawing_CanvasClipOp; + +/** + * @brief Clip a rect. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param left Indicates the left position of the rect. + * @param top Indicates the top position of the rect. + * @param right Indicates the right position of the rect. + * @param bottom Indicates the bottom position of the rect. + * @param clipOp Indicates the operation to apply to clip. + * @param doAntiAlias Indicates whether clip operation requires anti-aliased. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, float left, float top, float right, float bottom, + OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); + +/** + * @brief Translates by dx along the x-axis and dy along the y-axis. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param dx Indicates the distance to translate on x-axis. + * @param dy Indicates the distance to translate on y-axis. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); + +/** + * @brief Scales by sx on the x-axis and sy on the y-axis. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param sx Indicates the amount to scale on x-axis. + * @param sy Indicates the amount to scale on y-axis. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); + /** * @brief Clears a canvas by using a specified color. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 44c3452f8b5f4a8c66cb058dfbce1e6790cba9c0..4763442825d8000235cbdb1c36c611c649f1216a 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -22,6 +22,10 @@ { "name": "OH_Drawing_CanvasRestore" }, { "name": "OH_Drawing_CanvasDrawLine" }, { "name": "OH_Drawing_CanvasDrawPath" }, + { "name": "OH_Drawing_CanvasDrawBitmap" }, + { "name": "OH_Drawing_CanvasClipRect" }, + { "name": "OH_Drawing_CanvasTranslate" }, + { "name": "OH_Drawing_CanvasScale" }, { "name": "OH_Drawing_CanvasClear" }, { "name": "OH_Drawing_PathCreate" }, { "name": "OH_Drawing_PathDestroy" },