Export (0) Print
Expand All

Pen Functions

Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly. For more information on using these wrapper methods, see GDI+ Flat API.

The following flat API functions are wrapped by the Pen C++ class.

Pen Functions and Corresponding Wrapper Methods

Flat functionWrapper methodRemarks

GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit, GpPen **pen)

Pen::Pen(IN const Color& color, IN REAL width = 1.0f)

Creates a Pen object that uses a specified color and width.

The unit parameter of the flat function is a member of the Unit enumeration that specifies the unit of measure for the width of the pen.

GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, GpPen **pen)

Pen::Pen(IN const Brush* brush, IN REAL width = 1.0f)

Creates a Pen object that uses the attributes of a brush and a real number to set the width of this Pen object.

The unit parameter of the flat function is a member of the Unit enumeration that specifies the unit of measure for the width of the pen.

GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)

Pen* Pen::Clone() const

Copies a Pen object.

GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)

Pen::~Pen()

Releases resources used by the Pen object.

GpStatus WINGDIPAPI GdipSetPenWidth(GpPen *pen, REAL width)

Status Pen::SetWidth(IN REAL width)

Sets the width for this Pen object.

GpStatus WINGDIPAPI GdipGetPenWidth(GpPen *pen, REAL *width)

REAL Pen::GetWidth() const

Gets the width currently set for this Pen object.

GpStatus WINGDIPAPI GdipSetPenUnit(GpPen *pen, GpUnit unit)

Not called by wrapper methods.

This function sets the unit of measure for the pen specified by the pen parameter to the value specified by the unit parameter. The unit parameter is a member of the Unit enumeration that specifies the unit of measure for the width of the pen.

GpStatus WINGDIPAPI GdipGetPenUnit(GpPen *pen, GpUnit *unit)

Not called by wrapper methods.

This function gets the unit of measure for the pen specified by the pen parameter. The unit parameter receives a member of the Unit enumeration that indicates the unit of measure for the width of the pen.

GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen *pen, GpLineCap startCap, GpLineCap endCap, GpDashCap dashCap)

Status Pen::SetLineCap(IN LineCap startCap, IN LineCap endCap, IN DashCap dashCap)

Sets the cap styles for the start, end, and dashes in a line drawn with this pen.

GpStatus WINGDIPAPI GdipSetPenStartCap(GpPen *pen, GpLineCap startCap)

Status Pen::SetStartCap(IN LineCap startCap)

Sets the start cap for this Pen object.

GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap endCap)

Status Pen::SetEndCap(IN LineCap endCap)

Sets the end cap for this Pen object.

GpStatus WINGDIPAPI GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap)

Status Pen::SetDashCap(IN DashCap dashCap)

Sets the dash cap style for this Pen object.

GpStatus WINGDIPAPI GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap)

LineCap Pen::GetStartCap()const

Gets the start cap currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap)

LineCap Pen::GetEndCap()const

Gets the end cap currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap)

DashCap Pen::GetDashCap() const

Gets the dash cap style currently set for this Pen object.

GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen *pen, GpLineJoin lineJoin)

Status Pen::SetLineJoin(IN LineJoin lineJoin)

Sets the line join for this Pen object.

GpStatus WINGDIPAPI GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin)

LineJoin Pen::GetLineJoin() const

Gets the line join for this Pen object.

GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* customCap)

Status Pen::SetCustomStartCap(IN const CustomLineCap* customCap)

Sets the custom start cap for this Pen object.

GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** customCap)

Pen::GetCustomStartCap(OUT CustomLineCap* customCap) const

Gets the custom start cap for this Pen object.

GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap)

Status Pen::SetCustomEndCap(IN const CustomLineCap* customCap)

Sets the custom end cap currently set for this Pen object

GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customCap)

Status Pen::GetCustomEndCap(OUT CustomLineCap* customCap) const

Gets the custom end cap currently set for this Pen object

GpStatus WINGDIPAPI GdipSetPenMiterLimit(GpPen *pen, REAL miterLimit)

Status Pen::SetMiterLimit(IN REAL miterLimit)

Sets the miter length currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit)

REAL Pen::GetMiterLimit() const

Gets the miter length currently set for this Pen object.

GpStatus WINGDIPAPI GdipSetPenMode(GpPen *pen, GpPenAlignment penMode)

Status Pen::SetAlignment(IN PenAlignment penAlignment)

Sets the alignment currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenMode(GpPen *pen, GpPenAlignment *penMode)

PenAlignment Pen::GetAlignment() const

Sets the alignment currently set for this Pen object.

GpStatus WINGDIPAPI GdipSetPenTransform(GpPen *pen, GpMatrix *matrix)

Status Pen::SetTransform(IN const Matrix* matrix)

Sets the world transformation matrix currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenTransform(GpPen *pen, GpMatrix *matrix)

Pen::GetTransform(OUT Matrix* matrix) const

Gets the world transformation matrix currently set for this Pen object.

GpStatus WINGDIPAPI GdipResetPenTransform(GpPen *pen)

Status Pen::ResetTransform()

Sets the world transformation matrix of this Pen object to the identity matrix.

GpStatus WINGDIPAPI GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)

Status Pen::MultiplyTransform(IN const Matrix* matrix, IN MatrixOrder order = MatrixOrderPrepend)

Updates the world transformation matrix of this Pen object with the product of itself and another matrix.

GpStatus WINGDIPAPI GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, GpMatrixOrder order)

Not called by wrapper methods.

GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order)

Status Pen::ScaleTransform(IN REAL sx, IN REAL sy, IN MatrixOrder order = MatrixOrderPrepend)

Sets the Pen object's world transformation matrix equal to the product of itself and a scaling matrix.

GpStatus WINGDIPAPI GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order)

Status Pen::RotateTransform(IN REAL angle, IN MatrixOrder order = MatrixOrderPrepend)

Updates the world transformation matrix of this Pen object with the product of itself and a rotation matrix.

GpStatus WINGDIPAPI GdipSetPenColor(GpPen *pen, ARGB argb)

Status Pen::SetColor(IN const Color& color)

Sets the color for this Pen object.

GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)

Status Pen::GetColor(OUT Color* color) const

Gets the color for this Pen object.

GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush)

Status Pen::SetBrush(IN const Brush* brush)

Sets the Brush object that a pen uses to fill a line.

GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen *pen, GpBrush **brush)

Brush* Pen::GetBrush() const

Gets the Brush object that a pen uses to fill a line.

GpStatus WINGDIPAPI GdipGetPenFillType(GpPen *pen, GpPenType* type)

PenType Pen::GetPenType() const

Gets the type currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dashstyle)

DashStyle Pen::GetDashStyle() const

Gets the dash style currently set for this Pen object.

GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dashstyle)

Status Pen::SetDashStyle(IN DashStyle dashStyle)

Sets the dash style currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenDashOffset(GpPen *pen, REAL *offset)

REAL Pen::GetDashOffset() const

Gets the distance from the start of the line to the start of the first space in a dashed line.

GpStatus WINGDIPAPI GdipSetPenDashOffset(GpPen *pen, REAL offset)

Status Pen::SetDashOffset(IN REAL dashOffset)

Sets the distance from the start of the line to the start of the first space in a dashed line.

GpStatus WINGDIPAPI GdipGetPenDashCount(GpPen *pen, INT *count)

INT Pen::GetDashPatternCount() const

Gets the number of elements in a dash pattern array.

GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash, INT count)

Status Pen::SetDashPattern(IN const REAL* dashArray, IN INT count)

Sets an array of custom dashes and spaces currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count)

Status Pen::GetDashPattern(OUT REAL* dashArray, IN INT count) const

Gets an array of custom dashes and spaces currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenCompoundCount(GpPen *pen, INT *count)

INT Pen::GetCompoundArrayCount() const

Gets the number of elements in a compound array.

GpStatus WINGDIPAPI GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash, INT count)

Status Pen::SetCompoundArray(IN const REAL* compoundArray, IN INT count)

Sets the compound array currently set for this Pen object.

GpStatus WINGDIPAPI GdipGetPenCompoundArray(GpPen *pen, REAL *dash, INT count)

Status Pen::GetCompoundArray(OUT REAL* compoundArray, IN INT count) const

Gets the compound array currently set for this Pen object.

 

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2014 Microsoft