From df3cefb391b1c6f6651c6a30c1a1b9f96e3117f6 Mon Sep 17 00:00:00 2001 From: lw19901203 Date: Wed, 12 Jun 2024 14:49:14 +0800 Subject: [PATCH 1/3] drawing interface final 0530 upload Signed-off-by: lw19901203 --- .../native_drawing/drawing_bitmap.h | 103 ++++++++++++++++++ .../graphic_2d/native_drawing/drawing_brush.h | 11 ++ .../native_drawing/drawing_canvas.h | 14 +++ .../native_drawing/drawing_color_filter.h | 10 ++ .../graphic_2d/native_drawing/drawing_image.h | 47 ++++++++ .../native_drawing/drawing_image_filter.h | 13 +++ .../native_drawing/drawing_path_effect.h | 74 +++++++++++++ .../graphic_2d/native_drawing/drawing_pen.h | 11 ++ .../native_drawing/drawing_region.h | 12 ++ .../native_drawing/drawing_shader_effect.h | 25 +++++ .../native_drawing/libnative_drawing.ndk.json | 96 ++++++++++++++++ 11 files changed, 416 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_bitmap.h b/graphic/graphic_2d/native_drawing/drawing_bitmap.h index beb238c74..1377b1c07 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,90 @@ 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 853c669a3..5dbbc1a50 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 81accebd6..b6e7e7135 100644 --- a/graphic/graphic_2d/native_drawing/drawing_canvas.h +++ b/graphic/graphic_2d/native_drawing/drawing_canvas.h @@ -792,6 +792,20 @@ bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas*, OH_Drawing_Bitmap*, */ OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty(OH_Drawing_Canvas* canvas, bool* isClipEmpty); +/** + * @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. + * @param isClipRect Indicates if drawable area is a rect and not 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 isClipRect is nullptr. + * @since 12 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipRect(OH_Drawing_Canvas*, bool* isClipRect); + /** * @brief Gets image info of canvas. * diff --git a/graphic/graphic_2d/native_drawing/drawing_color_filter.h b/graphic/graphic_2d/native_drawing/drawing_color_filter.h index 67eefc7e5..091894196 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_image.h b/graphic/graphic_2d/native_drawing/drawing_image.h index ed2f1f491..f425e1780 100644 --- a/graphic/graphic_2d/native_drawing/drawing_image.h +++ b/graphic/graphic_2d/native_drawing/drawing_image.h @@ -108,6 +108,53 @@ 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 3db6e90d0..12949e821 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. * diff --git a/graphic/graphic_2d/native_drawing/drawing_path_effect.h b/graphic/graphic_2d/native_drawing/drawing_path_effect.h index 90aee6f3a..6407ebab1 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 f191ae91f..1ae0b211e 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_region.h b/graphic/graphic_2d/native_drawing/drawing_region.h index d671444a3..0123b40ae 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_shader_effect.h b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h index 1af5ad345..8efb8ba5a 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 e8b3db274..975161572 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" }, @@ -139,6 +171,10 @@ "first_introduced": "12", "name": "OH_Drawing_CanvasIsClipEmpty" }, + { + "first_introduced": "12", + "name": "OH_Drawing_CanvasIsClipRect" + }, { "first_introduced": "12", "name": "OH_Drawing_CanvasClipRegion" @@ -148,7 +184,31 @@ "name": "OH_Drawing_CanvasGetImageInfo" }, { "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" }, @@ -278,6 +338,10 @@ "first_introduced": "12", "name": "OH_Drawing_ImageFilterCreateBlur" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ImageFilterCreateComposeImageFilter" + }, { "first_introduced": "12", "name": "OH_Drawing_ImageFilterCreateFromColorFilter" @@ -494,6 +558,10 @@ "first_introduced": "12", "name": "OH_Drawing_PenSetPathEffect" }, + { + "first_introduced": "12", + "name": "OH_Drawing_PenGetShaderEffect" + }, { "first_introduced": "12", "name": "OH_Drawing_PenReset" @@ -612,6 +680,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" @@ -631,6 +703,10 @@ "first_introduced": "12", "name": "OH_Drawing_ShaderEffectCreateImageShader" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ShaderEffectCreatePixelMapShader" + }, { "first_introduced": "12", "name": "OH_Drawing_ShaderEffectCreateTwoPointConicalGradient" @@ -712,6 +788,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" @@ -1094,6 +1186,10 @@ "first_introduced": "12", "name": "OH_Drawing_RegionSetRect" }, + { + "first_introduced": "12", + "name": "OH_Drawing_RegionIsRegionContained" + }, { "first_introduced": "12", "name": "OH_Drawing_SetTypographyTextFontFamily" -- Gitee From 34bf321f749d9b8dc16dcecde95f990d46e43a6f Mon Sep 17 00:00:00 2001 From: zhanglin00 Date: Mon, 8 Jul 2024 16:37:43 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=E5=A4=B4=E6=96=87=E4=BB=B6=E4=BB=93?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanglin00 --- graphic/graphic_2d/native_drawing/drawing_brush.h | 6 +++++- graphic/graphic_2d/native_drawing/drawing_canvas.h | 4 ++-- graphic/graphic_2d/native_drawing/drawing_pen.h | 6 +++++- graphic/graphic_2d/native_drawing/drawing_region.h | 14 ++++++++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_brush.h b/graphic/graphic_2d/native_drawing/drawing_brush.h index 5dbbc1a50..5b8293335 100644 --- a/graphic/graphic_2d/native_drawing/drawing_brush.h +++ b/graphic/graphic_2d/native_drawing/drawing_brush.h @@ -37,6 +37,7 @@ * @version 1.0 */ +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -162,10 +163,13 @@ void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect* * @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. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if cBrush or cShaderEffect is nullptr. * @since 12 * @version 1.0 */ -void OH_Drawing_BrushGetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*); +OH_Drawing_ErrorCode OH_Drawing_BrushGetShaderEffect(OH_Drawing_Brush* cBrush, OH_Drawing_ShaderEffect* cShaderEffect); /** * @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 b6e7e7135..11b1f3c30 100644 --- a/graphic/graphic_2d/native_drawing/drawing_canvas.h +++ b/graphic/graphic_2d/native_drawing/drawing_canvas.h @@ -800,11 +800,11 @@ OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty(OH_Drawing_Canvas* canvas, boo * @param isClipRect Indicates if drawable area is a rect and not 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 isClipRect is nullptr. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if cCanvas or isClipRect is nullptr. * @since 12 * @version 1.0 */ -OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipRect(OH_Drawing_Canvas*, bool* isClipRect); +OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipRect(OH_Drawing_Canvas* cCanvas, bool* isClipRect); /** * @brief Gets image info of canvas. diff --git a/graphic/graphic_2d/native_drawing/drawing_pen.h b/graphic/graphic_2d/native_drawing/drawing_pen.h index 1ae0b211e..280469063 100644 --- a/graphic/graphic_2d/native_drawing/drawing_pen.h +++ b/graphic/graphic_2d/native_drawing/drawing_pen.h @@ -37,6 +37,7 @@ * @version 1.0 */ +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -299,10 +300,13 @@ void OH_Drawing_PenSetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*); * @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. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if cPen or cShaderEffect is nullptr. * @since 12 * @version 1.0 */ -void OH_Drawing_PenGetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*); +OH_Drawing_ErrorCode OH_Drawing_PenGetShaderEffect(OH_Drawing_Pen* cPen, OH_Drawing_ShaderEffect* cShaderEffect); /** * @brief Sets the shadowLayer for a pen. diff --git a/graphic/graphic_2d/native_drawing/drawing_region.h b/graphic/graphic_2d/native_drawing/drawing_region.h index 0123b40ae..69a30ff15 100644 --- a/graphic/graphic_2d/native_drawing/drawing_region.h +++ b/graphic/graphic_2d/native_drawing/drawing_region.h @@ -37,6 +37,7 @@ * @version 1.0 */ +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -141,13 +142,18 @@ bool OH_Drawing_RegionSetPath(OH_Drawing_Region* region, const OH_Drawing_Path* * @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. + * @param cRegion Indicates the pointer to an OH_Drawing_Region object. + * @param cOther Indicates the pointer to an OH_Drawing_Region object. + * @param cIsRegionContainded Indicates if other region is completely inside the region object. + * @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 cRegion, cOther + * and cIsRegionContainded is nullptr. * @since 12 * @version 1.0 */ -bool OH_Drawing_RegionIsRegionContained(const OH_Drawing_Region* region, const OH_Drawing_Region* other); +OH_Drawing_ErrorCode OH_Drawing_RegionIsRegionContained(const OH_Drawing_Region* cRegion, + const OH_Drawing_Region* cOther, bool* cIsRegionContainded); /** * @brief Destroys an OH_Drawing_Region object and reclaims the memory occupied by the object. -- Gitee From a66253e2c14d1642e55e065182c98cc23f50ac1f Mon Sep 17 00:00:00 2001 From: zhanglin00 Date: Fri, 19 Jul 2024 16:43:10 +0800 Subject: [PATCH 3/3] =?UTF-8?q?image=E5=A4=B4=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../graphic_2d/native_drawing/drawing_image.h | 20 +++++++++++++------ .../native_drawing/drawing_shader_effect.h | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_image.h b/graphic/graphic_2d/native_drawing/drawing_image.h index f425e1780..092771d90 100644 --- a/graphic/graphic_2d/native_drawing/drawing_image.h +++ b/graphic/graphic_2d/native_drawing/drawing_image.h @@ -37,6 +37,7 @@ * @version 1.0 */ +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -123,12 +124,15 @@ 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. + * @param cImage Indicates the pointer to an OH_Drawing_Image object. + * @param cUnique Indicates the unique id of image. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if cImage or cUnique is nullptr. * @since 12 * @version 1.0 */ -uint32_t OH_Drawing_ImageGetUniqueID(const OH_Drawing_Image*); +OH_Drawing_ErrorCode OH_Drawing_ImageGetUniqueID(const OH_Drawing_Image* cImage, uint32_t* cUnique); /** * @brief Gets whether the image is opaque. @@ -149,12 +153,16 @@ bool OH_Drawing_ImageIsOpaque(const OH_Drawing_Image*); * @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. + * @param isScaled Indicates whether the image is scaled to fit the bitmap. + * @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 cImage, cBitmap, + * cSampling or isScaled is nullptr. * @since 12 * @version 1.0 */ -bool OH_Drawing_ImageScalePixels(const OH_Drawing_Image*, const OH_Drawing_Bitmap*, const OH_Drawing_SamplingOptions*, - bool isAllowCachingHint); +OH_Drawing_ErrorCode OH_Drawing_ImageScalePixels(const OH_Drawing_Image* cImage, const OH_Drawing_Bitmap* cBitmap, + const OH_Drawing_SamplingOptions* cSampling, bool isAllowCachingHint, bool* isScaled); #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 8efb8ba5a..95197e0b8 100644 --- a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h +++ b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h @@ -73,6 +73,7 @@ typedef enum { * @brief Creates an OH_Drawing_ShaderEffect that generates a extend shader. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. * @since 12 * @version 1.0 */ -- Gitee