mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-27 08:51:29 +00:00
!750 drawing interface sdk_c 0530
Merge pull request !750 from 刘伟/drawing_sdkc_zhx0530
This commit is contained in:
commit
18a4de3166
@ -37,6 +37,7 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "drawing_error_code.h"
|
||||
#include "drawing_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -275,6 +276,20 @@ typedef enum {
|
||||
POINT_MODE_POLYGON,
|
||||
} OH_Drawing_PointMode;
|
||||
|
||||
/**
|
||||
* @brief Draws a point.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
|
||||
* @param point Indicates the pointer to an <b>OH_Drawing_Point</b> object.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or point is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint(OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point);
|
||||
|
||||
/**
|
||||
* @brief Draws point array as separate point, line segment or open polygon according to given point mode.
|
||||
*
|
||||
@ -340,6 +355,22 @@ void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*);
|
||||
*/
|
||||
void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, float radius);
|
||||
|
||||
/**
|
||||
* @brief Fills the entire canvas with the specified color and blend mode.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
|
||||
* @param color Indicates the color, which is a 32-bit variable.
|
||||
* @param blendMode Indicates the blend mode.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor(OH_Drawing_Canvas* canvas, uint32_t color,
|
||||
OH_Drawing_BlendMode blendMode);
|
||||
|
||||
/**
|
||||
* @brief Draws an oval.
|
||||
*
|
||||
@ -447,6 +478,22 @@ void OH_Drawing_CanvasClipRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRe
|
||||
void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*,
|
||||
OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias);
|
||||
|
||||
/**
|
||||
* @brief Clips a region.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
|
||||
* @param region Indicates the pointer to an <b>OH_Drawing_Region</b> object.
|
||||
* @param clipOp To apply to clip.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or region is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion(OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region,
|
||||
OH_Drawing_CanvasClipOp clipOp);
|
||||
|
||||
/**
|
||||
* @brief Rotates by degrees. Positive degrees rotates clockwise.
|
||||
*
|
||||
@ -731,6 +778,34 @@ bool OH_Drawing_CanvasReadPixels(OH_Drawing_Canvas*, OH_Drawing_Image_Info*,
|
||||
*/
|
||||
bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas*, OH_Drawing_Bitmap*, int32_t srcX, int32_t srcY);
|
||||
|
||||
/**
|
||||
* @brief Checks whether the drawable area is empty.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
|
||||
* @param isClipEmpty Indicates if drawable area is empty.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or isClipEmpty is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty(OH_Drawing_Canvas* canvas, bool* isClipEmpty);
|
||||
|
||||
/**
|
||||
* @brief Gets image info of canvas.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
|
||||
* @param imageInfo Indicates the pointer to an <b>OH_Drawing_Image_Info</b> object.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or imageInfo is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo(OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -37,6 +37,7 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "drawing_error_code.h"
|
||||
#include "drawing_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -239,6 +240,26 @@ uint32_t OH_Drawing_FontTextToGlyphs(const OH_Drawing_Font*, const void* text, u
|
||||
*/
|
||||
void OH_Drawing_FontGetWidths(const OH_Drawing_Font*, const uint16_t* glyphs, int count, float* widths);
|
||||
|
||||
/**
|
||||
* @brief Measures the width of text.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param font Indicates the pointer to an <b>OH_Drawing_Font</b> object.
|
||||
* @param text Indicates the character storage encoded with text encoding.
|
||||
* @param byteLength Indicates the text length in bytes.
|
||||
* @param encoding Indicates the text encoding.
|
||||
* @param bounds Gets the bounding box relative to (0, 0) if not nullptr.
|
||||
* @param textWidth Indicates the width of text.
|
||||
* @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 font, text
|
||||
* and textWidth is nullptr or byteLength is 0.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_FontMeasureText(const OH_Drawing_Font* font, const void* text, size_t byteLength,
|
||||
OH_Drawing_TextEncoding encoding, OH_Drawing_Rect* bounds, float* textWidth);
|
||||
|
||||
/**
|
||||
* @brief Enables or disables linearly scalable font for an <b>OH_Drawing_Font</b> object.
|
||||
*
|
||||
|
@ -37,6 +37,7 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "drawing_error_code.h"
|
||||
#include "drawing_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -355,6 +356,20 @@ void OH_Drawing_MatrixReset(OH_Drawing_Matrix*);
|
||||
void OH_Drawing_MatrixConcat(OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a,
|
||||
const OH_Drawing_Matrix* b);
|
||||
|
||||
/**
|
||||
* @brief Gets nine matrix values contained by matrix into array.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
|
||||
* @param value Storages for nine matrix values.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if matrix or value is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll(OH_Drawing_Matrix* matrix, float value[9]);
|
||||
|
||||
/**
|
||||
* @brief Get one matrix value. Index is between the range of 0-8.
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
|
@ -37,6 +37,7 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "drawing_error_code.h"
|
||||
#include "drawing_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -55,6 +56,49 @@ extern "C" {
|
||||
*/
|
||||
OH_Drawing_Point* OH_Drawing_PointCreate(float x, float y);
|
||||
|
||||
/**
|
||||
* @brief Gets the x-axis coordinate of the point.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param point Indicates the pointer to an <b>OH_Drawing_Point</b> object.
|
||||
* @param x Indicates the x-axis coordinate of the point.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if point or x is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_PointGetX(const OH_Drawing_Point* point, float* x);
|
||||
|
||||
/**
|
||||
* @brief Gets the y-axis coordinate of the point.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param point Indicates the pointer to an <b>OH_Drawing_Point</b> object.
|
||||
* @param y Indicates the y-axis coordinate of the point.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if point or y is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_PointGetY(const OH_Drawing_Point* point, float* y);
|
||||
|
||||
/**
|
||||
* @brief Sets the x-axis and y-axis coordinates of the point.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param point Indicates the pointer to an <b>OH_Drawing_Point</b> object.
|
||||
* @param x Indicates the x-axis coordinate of the point.
|
||||
* @param y Indicates the y-axis coordinate of the point.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if point is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_PointSet(OH_Drawing_Point* point, float x, float y);
|
||||
|
||||
/**
|
||||
* @brief Destroys an <b>OH_Drawing_Point</b> object and reclaims the memory occupied by the object.
|
||||
*
|
||||
|
@ -37,6 +37,7 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "drawing_error_code.h"
|
||||
#include "drawing_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -115,6 +116,20 @@ OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner(OH_Drawing_RoundRect*, OH_
|
||||
*/
|
||||
void OH_Drawing_RoundRectDestroy(OH_Drawing_RoundRect*);
|
||||
|
||||
/**
|
||||
* @brief Translates round rect by (dx, dy).
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param roundRect Indicates the pointer to an <b>OH_Drawing_RoundRect</b> object.
|
||||
* @param dx Indicates the offsets added to rect left and rect right.
|
||||
* @param dy Indicates the offsets added to rect top and rect bottom.
|
||||
* @return Returns the error code.
|
||||
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
|
||||
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if roundRect is nullptr.
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
OH_Drawing_ErrorCode OH_Drawing_RoundRectOffset(OH_Drawing_RoundRect* roundRect, float dx, float dy);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -76,6 +76,14 @@
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_CanvasDrawPoints"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_CanvasDrawColor"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_CanvasDrawPoint"
|
||||
},
|
||||
{ "name": "OH_Drawing_CanvasDrawRect" },
|
||||
{ "name": "OH_Drawing_CanvasDrawRoundRect" },
|
||||
{ "name": "OH_Drawing_CanvasDrawTextBlob" },
|
||||
@ -122,7 +130,23 @@
|
||||
{ "name": "OH_Drawing_CanvasGetLocalClipBounds" },
|
||||
{ "name": "OH_Drawing_CanvasGetTotalMatrix" },
|
||||
{ "name": "OH_Drawing_CanvasConcatMatrix" },
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_MatrixGetAll"
|
||||
},
|
||||
{ "name": "OH_Drawing_CanvasDrawShadow" },
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_CanvasIsClipEmpty"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_CanvasClipRegion"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_CanvasGetImageInfo"
|
||||
},
|
||||
{ "name": "OH_Drawing_CreateDashPathEffect" },
|
||||
{ "name": "OH_Drawing_PathEffectDestroy" },
|
||||
{ "name": "OH_Drawing_ColorFilterCreateBlendMode" },
|
||||
@ -198,6 +222,10 @@
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_FontIsSubpixel"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_FontMeasureText"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_FontSetBaselineSnap"
|
||||
@ -472,6 +500,18 @@
|
||||
},
|
||||
{ "name": "OH_Drawing_PointCreate" },
|
||||
{ "name": "OH_Drawing_PointDestroy" },
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_PointGetX"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_PointGetY"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_PointSet"
|
||||
},
|
||||
{ "name": "OH_Drawing_ColorSetArgb" },
|
||||
{
|
||||
"first_introduced": "12",
|
||||
@ -558,6 +598,10 @@
|
||||
"name": "OH_Drawing_RoundRectSetCorner"
|
||||
},
|
||||
{ "name": "OH_Drawing_RoundRectDestroy" },
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Drawing_RoundRectOffset"
|
||||
},
|
||||
{ "name": "OH_Drawing_SetTextStyleColor" },
|
||||
{ "name": "OH_Drawing_SetTextStyleFontSize" },
|
||||
{ "name": "OH_Drawing_SetTextStyleFontWeight" },
|
||||
|
Loading…
Reference in New Issue
Block a user