harmony 鸿蒙drawing_pen.h

  • 2025-06-12
  • 浏览 (5)

drawing_pen.h

Overview

The drawing_pen.h file declares functions related to the pen in the drawing module.

File to include: <native_drawing/drawing_pen.h>

Library: libnative_drawing.so

Since: 8

Related module: Drawing

Summary

Types

Name Description
typedef enum OH_Drawing_PenLineCapStyle OH_Drawing_PenLineCapStyle Defines an enum for line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen.
typedef enum OH_Drawing_PenLineJoinStyle OH_Drawing_PenLineJoinStyle Defines an enum for line join styles of a pen. The line join style defines the shape of the joints of a polyline segment drawn by the pen.

Enums

Name Description
OH_Drawing_PenLineCapStyle { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } Enumerates the line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen.
OH_Drawing_PenLineJoinStyle { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } Enumerates the line join styles of a pen. The line join style defines the shape of the joints of a polyline segment drawn by the pen.

Functions

Name Description
OH_Drawing_Pen * OH_Drawing_PenCreate (void) Creates an OH_Drawing_Path object.
OH_Drawing_Pen * OH_Drawing_PenCopy (OH_Drawing_Pen *pen) Copies an existing OH_Drawing_Pen object to create a new one.
void OH_Drawing_PenDestroy (OH_Drawing_Pen *) Destroys an OH_Drawing_Path object and reclaims the memory occupied by the object.
bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen *) Checks whether anti-aliasing is enabled for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent.
void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen *, bool) Enables or disables anti-aliasing for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent.
uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen *) Obtains the color of a pen. The color is used by the pen to outline a shape.
void OH_Drawing_PenSetColor (OH_Drawing_Pen *, uint32_t color) Sets the color for a pen. The color is used by the pen to outline a shape.
uint8_t OH_Drawing_PenGetAlpha (const OH_Drawing_Pen *) Obtains the alpha value of a pen. This value is used by the alpha channel when the pen outlines a shape.
void OH_Drawing_PenSetAlpha (OH_Drawing_Pen *, uint8_t alpha) Sets the alpha value for a pen. This value is used by the alpha channel when the pen outlines a shape.
float OH_Drawing_PenGetWidth (const OH_Drawing_Pen *) Obtains the width of a pen. The width describes the thickness of the outline of a shape.
void OH_Drawing_PenSetWidth (OH_Drawing_Pen *, float width) Sets the width for a pen. The value 0 is treated as an unusually thin width. During drawing, the width of 0 is always drawn as 1 pixel wide, regardless of any scaling applied to the canvas. Negative values are also regarded as the value 0 during the drawing process.
float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen *) Obtains the stroke miter limit of a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.
void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen *, float miter) Sets the stroke miter limit for a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.
OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen *) Obtains the line cap style of a pen.
void OH_Drawing_PenSetCap (OH_Drawing_Pen *, OH_Drawing_PenLineCapStyle) Sets the line cap style for a pen.
OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen *) Obtains the line join style of a pen.
void OH_Drawing_PenSetJoin (OH_Drawing_Pen *, OH_Drawing_PenLineJoinStyle) Sets the line join style for a pen.
void OH_Drawing_PenSetShaderEffect (OH_Drawing_Pen *, OH_Drawing_ShaderEffect *) Sets the shader effect for a pen.
void OH_Drawing_PenSetShadowLayer (OH_Drawing_Pen *, OH_Drawing_ShadowLayer *) Sets the shadow layer for a pen. The shadow layer effect takes effect only when text is drawn.
void OH_Drawing_PenSetPathEffect (OH_Drawing_Pen *, OH_Drawing_PathEffect *) Sets the path effect for a pen.
void OH_Drawing_PenSetFilter (OH_Drawing_Pen *, OH_Drawing_Filter *) Sets a filter for a pen.
void OH_Drawing_PenGetFilter (OH_Drawing_Pen *, OH_Drawing_Filter *) Obtains the filter of a pen. The filter is a container that holds a mask filter and color filter.
void OH_Drawing_PenSetBlendMode (OH_Drawing_Pen *, OH_Drawing_BlendMode) Sets a blender for a pen. The blender implements the specified blend mode.
bool OH_Drawing_PenGetFillPath (OH_Drawing_Pen *, const OH_Drawing_Path *src, OH_Drawing_Path *dst, const OH_Drawing_Rect *, const OH_Drawing_Matrix *) Obtains the source path outline drawn using a pen and represents it using a destination path.
void OH_Drawing_PenReset (OH_Drawing_Pen *) Resets a pen to the initial value.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkGraphics 2D

harmony 鸿蒙BufferHandle

harmony 鸿蒙ColorSpacePrimaries

harmony 鸿蒙DisplaySoloist_ExpectedRateRange

harmony 鸿蒙_drawing

harmony 鸿蒙NativeColorSpaceManager

harmony 鸿蒙NativeDisplaySoloist

harmony 鸿蒙NativeVsync

harmony 鸿蒙NativeWindow

harmony 鸿蒙OH_Drawing_BitmapFormat

0  赞