新增SaveLayer、Path、Matrix、文字相关Drawing C 接口

Signed-off-by: li-kiao <lixiang284@huawei.com>
Change-Id: I875f87153cf86c832cf7663ee2510b8d19ffa26d
This commit is contained in:
li-kiao
2024-01-19 14:00:58 +00:00
parent ce0a7b6e79
commit afe8093f76
10 changed files with 520 additions and 0 deletions
@@ -27,6 +27,7 @@ ohos_ndk_headers("native_drawing_header") {
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_font_collection.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",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_path.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_pen.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_point.h",
@@ -58,6 +59,7 @@ ohos_ndk_library("libnative_drawing_ndk") {
"native_drawing/drawing_font_collection.h",
"native_drawing/drawing_mask_filter.h",
"native_drawing/drawing_matrix.h",
"native_drawing/drawing_memory_stream.h",
"native_drawing/drawing_path.h",
"native_drawing/drawing_pen.h",
"native_drawing/drawing_point.h",
@@ -129,6 +129,19 @@ void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*);
*/
void OH_Drawing_CanvasSave(OH_Drawing_Canvas*);
/**
* @brief Saves matrix and clip, and allocates a bitmap for subsequent drawing.
* Calling restore discards changes to matrix and clip, and draws the bitmap.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
* @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
* @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_CanvasSaveLayer(OH_Drawing_Canvas*, const OH_Drawing_Rect*, const OH_Drawing_Brush*);
/**
* @brief Restores the canvas status (canvas matrix) saved on the top of the stack.
*
@@ -64,6 +64,28 @@ OH_Drawing_Font* OH_Drawing_FontCreate(void);
*/
void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*);
/**
* @brief Gets an <b>OH_Drawing_Typeface</b> object from the <b>OH_Drawing_Typeface</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Font Indicates the pointer to an <b>OH_Drawing_Font</b> object.
* @return OH_Drawing_Typeface Indicates the pointer to an <b>OH_Drawing_Typeface</b> object.
* @since 12
* @version 1.0
*/
OH_Drawing_Typeface* OH_Drawing_FontGetTypeface(OH_Drawing_Font*);
/**
* @brief Set Font and glyph metrics should ignore hinting and rounding.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Font Indicates the pointer to an <b>OH_Drawing_Font</b> object.
* @param bool Should ignore hinting and rounding.
* @since 12
* @version 1.0
*/
void OH_Drawing_FontSetLinearMetrics(OH_Drawing_Font*, bool);
/**
* @brief Sets text size for an <b>OH_Drawing_Font</b> object.
*
@@ -53,6 +53,49 @@ extern "C" {
*/
OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void);
/**
* @brief Creates an <b>OH_Drawing_Matrix</b> object with rotation. Sets matrix to
* rotate by degrees about a pivot point at (px, py).
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @param deg angle of axes relative to upright axes
* @param x pivot on x-axis.
* @param y pivot on y-axis.
* @since 12
* @version 1.0
*/
OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation(float deg, float x, float y);
/**
* @brief Creates an <b>OH_Drawing_Matrix</b> object with scale. Sets matrix to scale
* by sx and sy, about a pivot point at (px, py).
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @param sx horizontal scale factor.
* @param sy vertical scale factor.
* @param px pivot on x-axis.
* @param py pivot on y-axis.
* @return Returns the pointer to the <b>OH_Drawing_Matrix</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale(float sx, float sy, float px, float py);
/**
* @brief Creates an <b>OH_Drawing_Matrix</b> object with translation.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @param dx horizontal translation.
* @param dy vertical translation.
* @return Returns the pointer to the <b>OH_Drawing_Matrix</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation(float dx, float dy);
/**
* @brief Sets the params for a matrix.
*
@@ -73,6 +116,103 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void);
void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, float transX,
float skewY, float scaleY, float transY, float persp0, float persp1, float persp2);
/**
* @brief Sets matrix to matrix multiplied by matrix other.
* Given:
* | A B C | | J K L |
* Matrix = | D E F |, other = | M N O |
* | G H I | | P Q R |
* sets Matrix to:
*
* | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR |
* Matrix * other = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
* | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR |
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @param other Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_MatrixPreConcat(OH_Drawing_Matrix*, OH_Drawing_Matrix* other);
/**
* @brief Sets matrix to rotate by degrees about a pivot point at (px, py). The pivot point is unchanged
* when mapped with matrix. Positive degrees rotates clockwise.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @param degree Indicates the angle of axes relative to upright axes.
* @param px Indicates the pivot on x-axis.
* @param py Indicates the pivot on y-axis.
* @since 12
* @version 1.0
*/
void OH_Drawing_MatrixRotate(OH_Drawing_Matrix*, float degree, float px, float py);
/**
* @brief Sets matrix to translate by (dx, dy)
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @param dx Indicates the horizontal translation.
* @param dy Indicates the vertical translation.
* @since 12
* @version 1.0
*/
void OH_Drawing_MatrixTranslate(OH_Drawing_Matrix*, float dx, float dy);
/**
* @brief Sets matrix to scale by sx and sy, about a pivot point at (px, py).
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @param sx Indicates the horizontal scale factor.
* @param sy Indicates the vertical scale factor.
* @param px Indicates the pivot on x-axis.
* @param py Indicates the pivot on y-axis.
* @since 12
* @version 1.0
*/
void OH_Drawing_MatrixScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py);
/**
* @brief Sets inverse to reciprocal matrix, returning true if matrix can be inverted.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @param inverse Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @return Returns true if matrix can be inverted, or flase.
* @since 12
* @version 1.0
*/
bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix*, OH_Drawing_Matrix* inverse);
/**
* @brief Returns true if the first matrix equals the second matrix.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @param other Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @return Returns true if the two matrices are equal, or flase.
* @since 12
* @version 1.0
*/
bool OH_Drawing_MatrixIsEqual(OH_Drawing_Matrix*, OH_Drawing_Matrix* other);
/**
* @brief Returns true if matrix is identity.
* Identity matrix is : | 1 0 0 |
* | 0 1 0 |
* | 0 0 1 |
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @return Returns true if matrix is identity, or flase.
* @since 12
* @version 1.0
*/
bool OH_Drawing_MatrixIsIdentity(OH_Drawing_Matrix*);
/**
* @brief Destroys an <b>OH_Drawing_Matrix</b> object and reclaims the memory occupied by the object.
*
@@ -0,0 +1,73 @@
/*
* Copyright (c) 2023 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_MEMORY_STREAM_H
#define C_INCLUDE_DRAWING_MEMORY_STREAM_H
/**
* @addtogroup Drawing
* @{
*
* @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 12
* @version 1.0
*/
/**
* @file drawing_memory_stream.h
*
* @brief Declares functions related to the <b>memoryStream</b> object in the drawing module.
*
* @since 12
* @version 1.0
*/
#include "drawing_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Creates a <b>OH_Drawing_MemoryStream</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @return Returns the pointer to the <b>OH_Drawing_MemoryStream</b> object created.
* @param data file path.
* @param length Data length.
* @param copyData Copy data or not.
* @since 12
* @version 1.0
*/
OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate(const void* data, size_t length, bool copyData);
/**
* @brief Destroys an <b>OH_Drawing_MemoryStream</b> object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_MemoryStream Indicates the pointer to an <b>OH_Drawing_MemoryStream</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_MemoryStreamDestroy(OH_Drawing_MemoryStream*);
#ifdef __cplusplus
}
#endif
/** @} */
#endif
@@ -43,6 +43,36 @@
extern "C" {
#endif
/**
* @brief Direction for adding closed contours.
*
* @since 11
* @version 1.0
*/
typedef enum {
/** clockwise direction for adding closed contours */
PATH_DIRECTION_CW,
/** counter-clockwise direction for adding closed contours */
PATH_DIRECTION_CCW,
} OH_Drawing_PathDirection;
/**
* @brief FillType of path
*
* @since 11
* @version 1.0
*/
typedef enum {
/** Specifies that "inside" is computed by a non-zero sum of signed edge crossings */
PATH_FILL_TYPE_WINDING,
/** Specifies that "inside" is computed by an odd number of edge crossings */
PATH_FILL_TYPE_EVEN_ODD,
/** Same as Winding, but draws outside of the path, rather than inside */
PATH_FILL_TYPE_INVERSE_WINDING,
/** Same as EvenOdd, but draws outside of the path, rather than inside */
PATH_FILL_TYPE_INVERSE_EVEN_ODD,
} OH_Drawing_PathFillType;
/**
* @brief Creates an <b>OH_Drawing_Path</b> object.
*
@@ -53,6 +83,17 @@ extern "C" {
*/
OH_Drawing_Path* OH_Drawing_PathCreate(void);
/**
* @brief Creates an <b>OH_Drawing_Path</b> copy object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
* @return Returns the pointer to the <b>OH_Drawing_Path</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path*);
/**
* @brief Destroys an <b>OH_Drawing_Path</b> object and reclaims the memory occupied by the object.
*
@@ -139,6 +180,99 @@ void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float end
void OH_Drawing_PathCubicTo(
OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY);
/**
* @brief Adds a new contour to the path, defined by the rect, and wound in the specified direction.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
* @param left Indicates the left coordinate of the upper left corner of the rectangle.
* @param top Indicates the top coordinate of the upper top corner of the rectangle.
* @param right Indicates the right coordinate of the lower right corner of the rectangle.
* @param bottom Indicates the bottom coordinate of the lower bottom corner of the rectangle.
* @param OH_Drawing_PathDirection Indicates the path direction.
* @since 12
* @version 1.0
*/
void OH_Drawing_PathAddRect(OH_Drawing_Path*, float left, float top, float right, float bottom, OH_Drawing_PathDirection);
/**
* @brief Adds a new contour to the path, defined by the round rect, and wound in the specified direction.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
* @param OH_Drawing_RoundRect Indicates the pointer to an <b>OH_Drawing_RoundRect</b> object.
* @param OH_Drawing_PathDirection Indicates the path direction.
* @since 12
* @version 1.0
*/
void OH_Drawing_PathAddRoundRect(OH_Drawing_Path*, const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection);
/**
* @brief Appends arc to path, as the start of new contour.Arc added is part of ellipse bounded by oval,
* from startAngle through sweepAngle. Both startAngle and sweepAngle are measured in degrees, where zero degrees
* is aligned with the positive x-axis, and positive sweeps extends arc clockwise.If sweepAngle <= -360, or
* sweepAngle >= 360; and startAngle modulo 90 is nearly zero, append oval instead of arc. Otherwise, sweepAngle
* values are treated modulo 360, and arc may or may not draw depending on numeric rounding.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
* @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
* @param startAngle Indicates the starting angle of arc in degrees.
* @param sweepAngle Indicates the sweep, in degrees. Positive is clockwise.
* @since 12
* @version 1.0
*/
void OH_Drawing_PathAddArc(OH_Drawing_Path*, const OH_Drawing_Rect*, float startAngle, float sweepAngle);
/**
* @brief Appends src path to path, transformed by matrix. Transformed curves may have different verbs,
* point, and conic weights.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
* @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object.
* @param OH_Drawing_Matrix Indicates the length of the <b>OH_Drawing_Matrix</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_PathAddPath(OH_Drawing_Path*, const OH_Drawing_Path* src, const OH_Drawing_Matrix*);
/**
* @brief Return the status that point (x, y) is contained by path.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
* @param x Indicates the x-axis value of containment test.
* @param y Indicates the y-axis value of containment test.
* @return Returns true if the point (x, y) is contained by path.
* @since 12
* @version 1.0
*/
bool OH_Drawing_PathContains(OH_Drawing_Path*, float x, float y);
/**
* @brief Transforms verb array, point array, and weight by matrix. transform may change verbs
* and increase their number. path is replaced by transformed data.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
* @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_PathTransform(OH_Drawing_Path*, const OH_Drawing_Matrix*);
/**
* @brief Sets FillType, the rule used to fill path.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
* @param OH_Drawing_PathFillType Indicates the add path's fill type.
* @since 12
* @version 1.0
*/
void OH_Drawing_SetFillStyle(OH_Drawing_Path*, OH_Drawing_PathFillType);
/**
* @brief Closes a path. A line segment from the start point to the last point of the path is added.
*
@@ -43,6 +43,22 @@
extern "C" {
#endif
/**
* @brief Enumerates text encoding.
* @since 12
* @version 1.0
*/
typedef enum {
/** uses bytes to represent UTF-8 or ASCII */
TEXT_ENCODING_UTF8,
/** uses two byte words to represent most of Unicode */
TEXT_ENCODING_UTF16,
/** uses four byte words to represent all of Unicode */
TEXT_ENCODING_UTF32,
/** uses two byte words to represent glyph indices */
TEXT_ENCODING_GLYPH_ID,
} OH_Drawing_TextEncoding;
/**
* @brief Creates an <b>OH_Drawing_TextBlobBuilder</b> object.
*
@@ -53,6 +69,62 @@ extern "C" {
*/
OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate(void);
/**
* @brief Creates an <b>OH_Drawing_TextBlob</b> object from text.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param text Indicates the the pointer to text.
* @param byteLength Indicates the text length.
* @param OH_Drawing_Font Indicates the pointer to an <b>OH_Drawing_Font</b> object.
* @param OH_Drawing_TextEncoding Indicates the pointer to an <b>OH_Drawing_TextEncoding</b> object.
* @return Returns the pointer to the <b>OH_Drawing_TextBlob</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText(const void* text, size_t byteLength,
const OH_Drawing_Font*, OH_Drawing_TextEncoding);
/**
* @brief Creates an <b>OH_Drawing_TextBlob</b> object from pos text.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param text Indicates the the pointer to text.
* @param byteLength Indicates the text length.
* @param OH_Drawing_Point Indicates the points.
* @param OH_Drawing_Font Indicates the pointer to an <b>OH_Drawing_Font</b> object.
* @param OH_Drawing_TextEncoding Indicates the pointer to an <b>OH_Drawing_TextEncoding</b> object.
* @return Returns the pointer to the <b>OH_Drawing_TextBlob</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText(const void* text, size_t byteLength,
OH_Drawing_Point* points, const OH_Drawing_Font*, OH_Drawing_TextEncoding);
/**
* @brief Creates an <b>OH_Drawing_TextBlob</b> object from pos text.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param str Indicates the the pointer to text.
* @param OH_Drawing_Font Indicates the pointer to an <b>OH_Drawing_Font</b> object.
* @param OH_Drawing_TextEncoding Indicates the pointer to an <b>OH_Drawing_TextEncoding</b> object.
* @return Returns the pointer to the <b>OH_Drawing_TextBlob</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString(const char* str,
const OH_Drawing_Font*, OH_Drawing_TextEncoding);
/**
* @brief Gets the bounds of textblob, assigned to the pointer to an <b>OH_Drawing_Rect</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextBlob Indicates the pointer to an <b>OH_Drawing_TextBlob</b> object.
* @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob*, OH_Drawing_Rect*);
/**
* @brief Defines a run, supplies storage for glyphs and positions.
*
@@ -53,6 +53,32 @@ extern "C" {
*/
OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void);
/**
* @brief Creates a <b>OH_Drawing_Typeface</b> object by file.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param path file path.
* @param index file index.
* @return Returns the pointer to the <b>OH_Drawing_Typeface</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile(const char* path, int index);
/**
* @brief Creates a <b>OH_Drawing_Typeface</b> object by given a stream. If the stream is not a valid
* font file, returns nullptr. Ownership of the stream is transferred, so the caller must not reference
* it or free it again.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_MemoryStream Indicates the pointer to an <b>OH_Drawing_MemoryStream</b> object.
* @param index memory stream index.
* @return Returns the pointer to the <b>OH_Drawing_Typeface</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream(OH_Drawing_MemoryStream*, int32_t index);
/**
* @brief Destroys an <b>OH_Drawing_Typeface</b> object and reclaims the memory occupied by the object.
*
@@ -38,6 +38,7 @@
*/
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
@@ -156,6 +157,14 @@ typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter;
*/
typedef struct OH_Drawing_Font OH_Drawing_Font;
/**
* @brief Defines a memoryStream, which is used to describe the memory stream.
*
* @since 12
* @version 1.0
*/
typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream;
/**
* @brief Defines a typeface, which is used to describe the typeface.
*
@@ -23,6 +23,7 @@
{ "name": "OH_Drawing_CanvasAttachBrush" },
{ "name": "OH_Drawing_CanvasDetachBrush" },
{ "name": "OH_Drawing_CanvasSave" },
{ "name": "OH_Drawing_CanvasSaveLayer" },
{ "name": "OH_Drawing_CanvasRestore" },
{ "name": "OH_Drawing_CanvasGetSaveCount" },
{ "name": "OH_Drawing_CanvasRestoreToCount" },
@@ -59,18 +60,38 @@
{ "name": "OH_Drawing_FontSetTextSize" },
{ "name": "OH_Drawing_FontSetTextSkewX" },
{ "name": "OH_Drawing_FontSetTypeface" },
{ "name": "OH_Drawing_FontGetTypeface" },
{ "name": "OH_Drawing_FontSetLinearMetrics" },
{ "name": "OH_Drawing_MaskFilterCreateBlur" },
{ "name": "OH_Drawing_MaskFilterDestroy" },
{ "name": "OH_Drawing_MatrixCreate" },
{ "name": "OH_Drawing_MatrixCreateRotation" },
{ "name": "OH_Drawing_MatrixCreateScale" },
{ "name": "OH_Drawing_MatrixCreateTranslation" },
{ "name": "OH_Drawing_MatrixSetMatrix" },
{ "name": "OH_Drawing_MatrixPreConcat" },
{ "name": "OH_Drawing_MatrixRotate" },
{ "name": "OH_Drawing_MatrixTranslate" },
{ "name": "OH_Drawing_MatrixScale" },
{ "name": "OH_Drawing_MatrixInvert" },
{ "name": "OH_Drawing_MatrixIsEqual" },
{ "name": "OH_Drawing_MatrixIsIdentity" },
{ "name": "OH_Drawing_MatrixDestroy" },
{ "name": "OH_Drawing_PathCreate" },
{ "name": "OH_Drawing_PathCopy" },
{ "name": "OH_Drawing_PathDestroy" },
{ "name": "OH_Drawing_PathMoveTo" },
{ "name": "OH_Drawing_PathLineTo" },
{ "name": "OH_Drawing_PathArcTo" },
{ "name": "OH_Drawing_PathQuadTo" },
{ "name": "OH_Drawing_PathCubicTo" },
{ "name": "OH_Drawing_PathAddRect" },
{ "name": "OH_Drawing_PathAddRoundRect" },
{ "name": "OH_Drawing_PathAddArc" },
{ "name": "OH_Drawing_PathAddPath" },
{ "name": "OH_Drawing_PathContains" },
{ "name": "OH_Drawing_PathTransform" },
{ "name": "OH_Drawing_SetFillStyle" },
{ "name": "OH_Drawing_PathClose" },
{ "name": "OH_Drawing_PathReset" },
{ "name": "OH_Drawing_PenCreate" },
@@ -121,12 +142,20 @@
{ "name": "OH_Drawing_ShaderEffectCreateRadialGradient" },
{ "name": "OH_Drawing_ShaderEffectCreateSweepGradient" },
{ "name": "OH_Drawing_ShaderEffectDestroy" },
{ "name": "OH_Drawing_TextBlobCreateFromText" },
{ "name": "OH_Drawing_TextBlobCreateFromPosText" },
{ "name": "OH_Drawing_TextBlobCreateFromString" },
{ "name": "OH_Drawing_TextBlobGetBounds" },
{ "name": "OH_Drawing_TextBlobBuilderAllocRunPos" },
{ "name": "OH_Drawing_TextBlobBuilderCreate" },
{ "name": "OH_Drawing_TextBlobBuilderDestroy" },
{ "name": "OH_Drawing_TextBlobBuilderMake" },
{ "name": "OH_Drawing_TextBlobDestroy" },
{ "name": "OH_Drawing_MemoryStreamCreate" },
{ "name": "OH_Drawing_MemoryStreamDestroy" },
{ "name": "OH_Drawing_TypefaceCreateDefault" },
{ "name": "OH_Drawing_TypefaceCreateFromFile" },
{ "name": "OH_Drawing_TypefaceCreateFromStream" },
{ "name": "OH_Drawing_TypefaceDestroy" },
{ "name": "OH_Drawing_CreateTypographyHandler" },
{ "name": "OH_Drawing_DestroyTypographyHandler" },