diff --git a/graphic/graphic_2d/native_drawing/drawing_bitmap.h b/graphic/graphic_2d/native_drawing/drawing_bitmap.h index beb238c745ad6aa4cf8c2a30c8c00c1e2655ca5a..2d4d2e4a6cd52649f7b26ed437da6e581c69535c 100644 --- a/graphic/graphic_2d/native_drawing/drawing_bitmap.h +++ b/graphic/graphic_2d/native_drawing/drawing_bitmap.h @@ -56,6 +56,25 @@ typedef struct { OH_Drawing_AlphaFormat alphaFormat; } OH_Drawing_BitmapFormat; +/** + * @brief Enumerations bitmap color space type. + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** No color space type */ + NO_TYPE, + /** SRGB color space type */ + SRGB, + /** SRGB color space types with linear properties */ + SRGB_LINEAR, + /** The spatial type of the reference image */ + REF_IMAGE, + /** RGB color space */ + RGB, +} OH_Drawing_ColorSpaceType; + /** * @brief Creates an OH_Drawing_Bitmap object. * @@ -189,6 +208,91 @@ void OH_Drawing_BitmapGetImageInfo(OH_Drawing_Bitmap*, OH_Drawing_Image_Info*); */ bool OH_Drawing_BitmapReadPixels(OH_Drawing_Bitmap*, const OH_Drawing_Image_Info* dstInfo, void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY); + +/** + * @brief Baseds on the information provided by OH_Drawing_Image_Info, create a OH_Drawing_Bitmap object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image_Info Indicates the pointer to an OH_Drawing_Image_Info object. + * @param OH_Drawing_ColorSpace Indicates the pointer to an OH_Drawing_ColorSpace object. + * @param rowBytes Indicates the row bytes of the OH_Drawing_Bitmap object. + * @return Returns a OH_Drawing_Bitmap object. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromImageInfo(const OH_Drawing_Image_Info*, OH_Drawing_ColorSpace*, + int32_t rowBytes); + +/** + * @brief Gets the row bytes of the OH_Drawing_Bitmap bject. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @return Returns the row bytes of the OH_Drawing_Bitmap bject. + * @since 12 + * @version 1.0 + */ +uint32_t OH_Drawing_BitmapGetRowBytes(const OH_Drawing_Bitmap*); + +/** + * @brief Gets the color space type of the OH_Drawing_Bitmap object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @return Returns bitmap color space type. + * @since 12 + * @version 1.0 + */ +OH_Drawing_ColorSpaceType OH_Drawing_BitmapGetColorSpaceType(OH_Drawing_Bitmap*); + +/** + * @brief Gets a subset of this bitmap. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param dstBitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @return Returns true if the subset was retrieved, false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_BitmapExtractSubset(const OH_Drawing_Bitmap* bitmap, const OH_Drawing_Bitmap* dstBitmap, + const OH_Drawing_Rect* subset); + +/** + * @brief Gets whether the content of the OH_Drawing_Bitmap object is immutable. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @return Returns true if it is immutable, false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_BitmapIsImmutable(const OH_Drawing_Bitmap*); + +/** + * @brief Sets the OH_Drawing_Bitmap object as immutable. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_BitmapSetImmutable(OH_Drawing_Bitmap*); + +/** + * @brief Allocates the memory for the OH_Drawing_Bitmap object using the specified + * OH_Drawing_Image_Info object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param OH_Drawing_Image_Info Indicates the pointer to an OH_Drawing_Image_Info object. + * @return Returns true if the allocation was successful, false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_BitmapTryAllocPixels(OH_Drawing_Bitmap*, const OH_Drawing_Image_Info*); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_brush.h b/graphic/graphic_2d/native_drawing/drawing_brush.h index 853c669a3f6ebc519002ba0e3763f6265dbf5d92..5dbbc1a50de8d21a2cbab19d3f5210981e841139 100644 --- a/graphic/graphic_2d/native_drawing/drawing_brush.h +++ b/graphic/graphic_2d/native_drawing/drawing_brush.h @@ -156,6 +156,17 @@ void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha); */ void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*); +/** + * @brief Gets the shaderEffect from a brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param OH_Drawing_ShaderEffect Indicates the pointer to an OH_Drawing_ShaderEffect object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_BrushGetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*); + /** * @brief Sets the shadowLayer for a brush. * diff --git a/graphic/graphic_2d/native_drawing/drawing_canvas.h b/graphic/graphic_2d/native_drawing/drawing_canvas.h index 9535f48c5a0aa3f14bc11a81b3a9a8f6193edefe..ba6bb6a1c9041777f28a6a475e4424240f2dac15 100644 --- a/graphic/graphic_2d/native_drawing/drawing_canvas.h +++ b/graphic/graphic_2d/native_drawing/drawing_canvas.h @@ -731,6 +731,52 @@ 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 Gets whether clip is empty. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @return Returns true if clip is empty; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_CanvasIsClipEmpty(OH_Drawing_Canvas*); + +/** + * @brief Gets whether clip is Rect and not empty. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @return Returns true if clip is rect and not empty; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_CanvasIsClipRect(OH_Drawing_Canvas*); + +/** + * @brief Gets imageInfo of canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Image_Info Indicates the pointer to an OH_Drawing_Image_Info object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasGetImageInfo(OH_Drawing_Canvas*, OH_Drawing_Image_Info*); + +/** + * @brief Replaces the clipping area with the intersection or difference of the + * current clipping area and region, and use a clipping edge that is aliased or anti-aliased. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Region Indicates the pointer to an OH_Drawing_Region object. + * @param OH_Drawing_CanvasClipOp To apply to clip, the default value is ClipOp::INTERSECT. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasClipRegion(OH_Drawing_Canvas*, const OH_Drawing_Region*, OH_Drawing_CanvasClipOp); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_color_filter.h b/graphic/graphic_2d/native_drawing/drawing_color_filter.h index 67eefc7e520510af4f8a85f53c48598c3a44173a..091894196fb7c4dfe1c71ce06497a3b65ae9fed3 100644 --- a/graphic/graphic_2d/native_drawing/drawing_color_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_color_filter.h @@ -43,6 +43,16 @@ extern "C" { #endif +/** + * @brief Creates an OH_Drawing_ColorFilter object and no filter type. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_ColorFilter object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreate(); + /** * @brief Creates an OH_Drawing_ColorFilter with a blend mode. * diff --git a/graphic/graphic_2d/native_drawing/drawing_font.h b/graphic/graphic_2d/native_drawing/drawing_font.h index 28fec472377c8b6f99daa131f89cf144b253811b..ee6deef67d525e4b54f1e529ac2c2e7e0279ac6e 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font.h +++ b/graphic/graphic_2d/native_drawing/drawing_font.h @@ -393,6 +393,20 @@ void OH_Drawing_FontSetEdging(OH_Drawing_Font*, OH_Drawing_FontEdging); */ OH_Drawing_FontEdging OH_Drawing_FontGetEdging(const OH_Drawing_Font*); +/** + * @brief Calculates width of glyphs represented by text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param text Indicates the character storage encoded with text encoding. + * @param byteLength Indicates the text length in bytes. + * @param OH_Drawing_TextEncoding Indicates the text encoding. + * @return Returns the width of the glyphs represented by text. + * @since 12 + * @version 1.0 + */ +float OH_Drawing_FontMeasureText(OH_Drawing_Font*, const void* text, size_t byteLength, OH_Drawing_TextEncoding); + /** * @brief Destroys an OH_Drawing_Font object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_image.h b/graphic/graphic_2d/native_drawing/drawing_image.h index ed2f1f4914cc0deb31957b99d3f4697ab851c061..07dfc1334c10f9553f8b5ab14aed9efb0375cf67 100644 --- a/graphic/graphic_2d/native_drawing/drawing_image.h +++ b/graphic/graphic_2d/native_drawing/drawing_image.h @@ -108,6 +108,54 @@ int32_t OH_Drawing_ImageGetHeight(OH_Drawing_Image*); */ void OH_Drawing_ImageGetImageInfo(OH_Drawing_Image*, OH_Drawing_Image_Info*); +/** + * @brief Gets an OH_Drawing_ColorSpace object from an OH_Drawing_Image object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @return Returns the pointer to an OH_Drawing_ColorSpace object. + * @since 12 + * @version 1.0 + */ +OH_Drawing_ColorSpace* OH_Drawing_ImageGetColorSpace(const OH_Drawing_Image*); + +/** + * @brief Gets the unique id of image. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @return Returns the unique id of image. + * @since 12 + * @version 1.0 + */ +uint32_t OH_Drawing_ImageGetUniqueID(const OH_Drawing_Image*); + +/** + * @brief Gets whether the image is opaque. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @return Returns true if the image is opaque; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_ImageIsOpaque(const OH_Drawing_Image*); + +/** + * @brief Gets whether the image is scaled to fit the bitmap. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param OH_Drawing_SamplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. + * @param isAllowCachingHint Indicates whether the image will be cached locally. + * @return Returns true if the image is scaled to fit the bitmap; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_ImageScalePixels(const OH_Drawing_Image*, const OH_Drawing_Bitmap*, const OH_Drawing_SamplingOptions*, + bool isAllowCachingHint); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_image_filter.h b/graphic/graphic_2d/native_drawing/drawing_image_filter.h index 3db6e90d018d6b3743ed660138859331557c27cd..9f9e03bb8e456eb94fbda2014e1dce0157cf1001 100644 --- a/graphic/graphic_2d/native_drawing/drawing_image_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_image_filter.h @@ -61,6 +61,19 @@ extern "C" { OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sigmaY, OH_Drawing_TileMode, OH_Drawing_ImageFilter*); +/** + * @brief Creates an OH_Drawing_ImageFilter object that composes them. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param ImageFilterOne Indicates the pointer to an OH_Drawing_ImageFilter object. + * @param ImageFilterTwo Indicates the pointer to an OH_Drawing_ImageFilter object. + * @return Returns the shared pointer to the OH_Drawing_ImageFilter object that its type is compose. + * @since 12 + * @version 1.0 + */ +OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateComposeImageFilter( + OH_Drawing_ImageFilter* ImageFilterOne, OH_Drawing_ImageFilter* ImageFilterTwo); + /** * @brief Creates an OH_Drawing_ImageFilter object that applies the color filter to the input. * @@ -76,6 +89,19 @@ OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sig */ OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter(OH_Drawing_ColorFilter*, OH_Drawing_ImageFilter*); +/** + * @brief Creates an OH_Drawing_ImageFilter object that composes them. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param ImageFilterOne Indicates the pointer to an OH_Drawing_ImageFilter object. + * @param ImageFilterTwo Indicates the pointer to an OH_Drawing_ImageFilter object. + * @return Returns the shared pointer to the OH_Drawing_ImageFilter object that it's type is compose. + * @since 12 + * @version 1.0 + */ +OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateComposeImageFilter(OH_Drawing_ImageFilter* ImageFilterOne, + OH_Drawing_ImageFilter* ImageFilterTwo); + /** * @brief Destroys an OH_Drawing_ImageFilter object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_matrix.h b/graphic/graphic_2d/native_drawing/drawing_matrix.h index 103788eba0cdac9e76dfc9f96f00f2074b3547ab..ae00e03e457168f6eb42854c43d506e43cb27a74 100644 --- a/graphic/graphic_2d/native_drawing/drawing_matrix.h +++ b/graphic/graphic_2d/native_drawing/drawing_matrix.h @@ -498,6 +498,17 @@ bool OH_Drawing_MatrixIsIdentity(OH_Drawing_Matrix*); */ void OH_Drawing_MatrixDestroy(OH_Drawing_Matrix*); +/** + * @brief Copies nine scalar values contained by matrix into array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param value Storages for nine scalar values. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixGetAll(OH_Drawing_Matrix*, float value[9]); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_path_effect.h b/graphic/graphic_2d/native_drawing/drawing_path_effect.h index 90aee6f3ac2a3087ea0fa2b94a91c8fb4cf7c3cd..6407ebab1849af3bc8588df6a4761bc7fc390c73 100644 --- a/graphic/graphic_2d/native_drawing/drawing_path_effect.h +++ b/graphic/graphic_2d/native_drawing/drawing_path_effect.h @@ -56,6 +56,80 @@ extern "C" { */ OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect(float* intervals, int count, float phase); +typedef enum { + /** Translates the path dashed style */ + PATH_DASH_STYLE_TRANSLATE, + /** Rotates the path dashed style */ + PATH_DASH_STYLE_ROTATE, + /** Morphs the path dashed style */ + PATH_DASH_STYLE_MORPH, +} OH_Drawing_PathDashStyle; + +/** + * @brief Creates a path dash effect OH_Drawing_PathEffect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the path to use. + * @param advance Indicates the spacing or progress of each path graph. + * @param phase Indicates the offset into intervals array. + * @param OH_Drawing_PathDashStyle Indicates the style of the path graph. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreatePathDashEffect(const OH_Drawing_Path* path, + float advance, float phase, OH_Drawing_PathDashStyle); + +/** + * @brief Creates a corner path effect OH_Drawing_PathEffect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param radius Indicates the distance from each corner and greater than 0. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateCornerPathEffect(float radius); + +/** + * @brief Creates a discrete path effect OH_Drawing_PathEffect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param segLength Indicates the length of each discrete segment in the path effect. + * @param dev Indicates the offset of each discrete segment. + * @param seedAssist Indicates the caller-supplied seedAssist. If not supplied it defaults to 0. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateDiscretePathEffect(float segLength, float dev, uint32_t seedAssist); + +/** + * @brief Creates a sum path effect OH_Drawing_PathEffect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param cPathEffectOne Indicates the first pathEffect. + * @param cPathEffectTwo Indicates the second pathEffect. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateSumPathEffect(OH_Drawing_PathEffect* cPathEffectOne, + OH_Drawing_PathEffect* cPathEffectTwo); + +/** + * @brief Creates a compose path effect OH_Drawing_PathEffect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param cPathEffectOne Indicates the first pathEffect. + * @param cPathEffectTwo Indicates the second pathEffect. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateComposePathEffect(OH_Drawing_PathEffect* cPathEffectOne, + OH_Drawing_PathEffect* cPathEffectTwo); + /** * @brief Destroys an OH_Drawing_PathEffect object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_pen.h b/graphic/graphic_2d/native_drawing/drawing_pen.h index f191ae91f6bd634021954728c84a00c89ae7c5f0..1ae0b211e41982ee7ef9fd43e67503f048818f68 100644 --- a/graphic/graphic_2d/native_drawing/drawing_pen.h +++ b/graphic/graphic_2d/native_drawing/drawing_pen.h @@ -293,6 +293,17 @@ void OH_Drawing_PenSetJoin(OH_Drawing_Pen*, OH_Drawing_PenLineJoinStyle); */ void OH_Drawing_PenSetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*); +/** + * @brief Gets the shaderEffect from a pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param OH_Drawing_ShaderEffect Indicates the pointer to an OH_Drawing_ShaderEffect object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PenGetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*); + /** * @brief Sets the shadowLayer for a pen. * diff --git a/graphic/graphic_2d/native_drawing/drawing_point.h b/graphic/graphic_2d/native_drawing/drawing_point.h index f63faf78d885ee6a432dfb677b524e3f1934fdb1..8a4619b255336314caad5510da080ab5a5bd0355 100644 --- a/graphic/graphic_2d/native_drawing/drawing_point.h +++ b/graphic/graphic_2d/native_drawing/drawing_point.h @@ -65,6 +65,40 @@ OH_Drawing_Point* OH_Drawing_PointCreate(float x, float y); */ void OH_Drawing_PointDestroy(OH_Drawing_Point*); +/** + * @brief Gets the x-axis coordinates of the point. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Point Indicates the pointer to an OH_Drawing_Point object. + * @return Returns the x-axis coordinates of the pointer. + * @since 12 + * @version 1.0 + */ +float OH_Drawing_PointGetX(const OH_Drawing_Point*); + +/** + * @brief Gets the y-axis coordinates of the point. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Point Indicates the pointer to an OH_Drawing_Point object. + * @return Returns the y-axis coordinates of the pointer. + * @since 12 + * @version 1.0 + */ +float OH_Drawing_PointGetY(const OH_Drawing_Point*); + +/** + * @brief Sets the x-axis and y-axis coordinates of the point. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Point Indicates the pointer to an OH_Drawing_Point object. + * @param x Indicates the x-axis coordinates of the point. + * @param y Indicates the y-axis coordinates of the point. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PointSet(OH_Drawing_Point*, float x, float y); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_region.h b/graphic/graphic_2d/native_drawing/drawing_region.h index d671444a3a42c3b2e4b6bea5083cf6c4af16d84d..0123b40aead36ba5b7935e9a0185c8b63acc798e 100644 --- a/graphic/graphic_2d/native_drawing/drawing_region.h +++ b/graphic/graphic_2d/native_drawing/drawing_region.h @@ -137,6 +137,18 @@ bool OH_Drawing_RegionSetRect(OH_Drawing_Region* region, const OH_Drawing_Rect* */ bool OH_Drawing_RegionSetPath(OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip); +/** + * @brief Gets whether other region is in the OH_Drawing_Region object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param region Indicates the pointer to an OH_Drawing_Region object. + * @param other Indicates the pointer to an OH_Drawing_Region object. + * @return Returns true if other region is completely inside the region object; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_RegionIsRegionContained(const OH_Drawing_Region* region, const OH_Drawing_Region* other); + /** * @brief Destroys an OH_Drawing_Region object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_round_rect.h b/graphic/graphic_2d/native_drawing/drawing_round_rect.h index a31773a5ced7045d8b78e8ce11edc64688f1e5de..cb45916b2554d695aba1cb498f0147d877ea9b14 100644 --- a/graphic/graphic_2d/native_drawing/drawing_round_rect.h +++ b/graphic/graphic_2d/native_drawing/drawing_round_rect.h @@ -115,6 +115,18 @@ OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner(OH_Drawing_RoundRect*, OH_ */ void OH_Drawing_RoundRectDestroy(OH_Drawing_RoundRect*); +/** + * @brief Translates RoundRect by (dx, dy). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_RoundRect Indicates the pointer to an OH_Drawing_RoundRect object. + * @param dx Offsets added to rect left and rect right. + * @param dy Offsets added to rect top and rect bottom. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_RoundRectOffset(OH_Drawing_RoundRect*, float dx, float dy); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h index 1af5ad345630c9ebec5030ec8468059c5cd49eeb..8efb8ba5a9d62804c84e86b89d99561edd2ab522 100644 --- a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h +++ b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h @@ -69,6 +69,15 @@ typedef enum { DECAL, } OH_Drawing_TileMode; +/** + * @brief Creates an OH_Drawing_ShaderEffect that generates a extend shader. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @since 12 + * @version 1.0 + */ +OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreate(); + /** * @brief Creates an OH_Drawing_ShaderEffect that generates a shader with single color. * @@ -196,6 +205,22 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient(const OH_Dra OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader(OH_Drawing_Image*, OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions*, const OH_Drawing_Matrix*); +/** + * @brief Creates an OH_Drawing_ShaderEffect that generates a extend shader. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PixelMap Indicates the pointer to an OH_Drawing_PixelMap object. + * @param tileX Indicates the tileX. + * @param tileY Indicates the tileY. + * @param OH_Drawing_SamplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreatePixelMapShader(OH_Drawing_PixelMap*, OH_Drawing_TileMode tileX, + OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions*, const OH_Drawing_Matrix*); + /** * @brief Creates an OH_Drawing_ShaderEffect that generates a conical gradient given two circles. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 0e408966ed57f5af59f6971a44aa67fa93861ac2..ff2964c2679950ada6f5f160edcf46564426ddc6 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -2,7 +2,15 @@ { "name": "OH_Drawing_BitmapCreate" }, { "name": "OH_Drawing_BitmapDestroy" }, { "name": "OH_Drawing_BitmapBuild" }, + { + "first_introduced": "12", + "name": "OH_Drawing_BitmapCreateFromImageInfo" + }, { "name": "OH_Drawing_BitmapCreateFromPixels" }, + { + "first_introduced": "12", + "name": "OH_Drawing_BitmapExtractSubset" + }, { "name": "OH_Drawing_BitmapGetWidth" }, { "name": "OH_Drawing_BitmapGetHeight" }, { @@ -13,11 +21,23 @@ "first_introduced": "12", "name": "OH_Drawing_BitmapGetAlphaFormat" }, + { + "first_introduced": "12", + "name": "OH_Drawing_BitmapGetRowBytes" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_BitmapGetColorSpaceType" + }, { "first_introduced": "12", "name": "OH_Drawing_BitmapGetImageInfo" }, { "name": "OH_Drawing_BitmapGetPixels" }, + { + "first_introduced": "12", + "name": "OH_Drawing_BitmapIsImmutable" + }, { "first_introduced": "12", "name": "OH_Drawing_BitmapReadPixels" @@ -45,10 +65,22 @@ "first_introduced": "12", "name": "OH_Drawing_BrushSetShadowLayer" }, + { + "first_introduced": "12", + "name": "OH_Drawing_BrushGetShaderEffect" + }, { "first_introduced": "12", "name": "OH_Drawing_BrushReset" }, + { + "first_introduced": "12", + "name": "OH_Drawing_BitmapSetImmutable" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_BitmapTryAllocPixels" + }, { "name": "OH_Drawing_CanvasCreate" }, { "name": "OH_Drawing_CanvasDestroy" }, { "name": "OH_Drawing_CanvasBind" }, @@ -122,9 +154,53 @@ { "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_CanvasIsClipRect" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CanvasGetImageInfo" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CanvasClipRegion" + }, { "name": "OH_Drawing_CreateDashPathEffect" }, + { + "first_introduced": "12", + "name": "OH_Drawing_CreatePathDashEffect" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CreateCornerPathEffect" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CreateDiscretePathEffect" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CreateSumPathEffect" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CreateComposePathEffect" + }, { "name": "OH_Drawing_PathEffectDestroy" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ColorFilterCreate" + }, { "name": "OH_Drawing_ColorFilterCreateBlendMode" }, { "name": "OH_Drawing_ColorFilterCreateCompose" }, { "name": "OH_Drawing_ColorFilterCreateLinearToSrgbGamma" }, @@ -198,6 +274,10 @@ "first_introduced": "12", "name": "OH_Drawing_FontIsSubpixel" }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontMeasureText" + }, { "first_introduced": "12", "name": "OH_Drawing_FontSetBaselineSnap" @@ -250,10 +330,18 @@ "first_introduced": "12", "name": "OH_Drawing_ImageFilterCreateBlur" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ImageFilterCreateComposeImageFilter" + }, { "first_introduced": "12", "name": "OH_Drawing_ImageFilterCreateFromColorFilter" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ImageFilterCreateComposeImageFilter" + }, { "first_introduced": "12", "name": "OH_Drawing_ImageFilterDestroy" @@ -466,12 +554,28 @@ "first_introduced": "12", "name": "OH_Drawing_PenSetPathEffect" }, + { + "first_introduced": "12", + "name": "OH_Drawing_PenGetShaderEffect" + }, { "first_introduced": "12", "name": "OH_Drawing_PenReset" }, { "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 +662,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" }, @@ -568,6 +676,10 @@ { "name": "OH_Drawing_SetTextStyleFontFamilies" }, { "name": "OH_Drawing_SetTextStyleFontStyle" }, { "name": "OH_Drawing_SetTextStyleLocale" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ShaderEffectCreate" + }, { "first_introduced": "12", "name": "OH_Drawing_ShaderEffectCreateColorShader" @@ -587,6 +699,10 @@ "first_introduced": "12", "name": "OH_Drawing_ShaderEffectCreateImageShader" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ShaderEffectCreatePixelMapShader" + }, { "first_introduced": "12", "name": "OH_Drawing_ShaderEffectCreateTwoPointConicalGradient" @@ -668,6 +784,22 @@ { "name": "OH_Drawing_ImageBuildFromBitmap" }, { "name": "OH_Drawing_ImageGetWidth" }, { "name": "OH_Drawing_ImageGetHeight" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ImageGetColorSpace" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_ImageGetUniqueID" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_ImageIsOpaque" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_ImageScalePixels" + }, { "first_introduced": "12", "name": "OH_Drawing_TextStyleGetShadowWithIndex" @@ -1050,6 +1182,10 @@ "first_introduced": "12", "name": "OH_Drawing_RegionSetRect" }, + { + "first_introduced": "12", + "name": "OH_Drawing_RegionIsRegionContained" + }, { "first_introduced": "12", "name": "OH_Drawing_SetTypographyTextFontFamily"