Home COM GDI+ WebBrowser Data Access 

Pen Functions (GDI+)

 

 

A Pen object is a Microsoft Windows GDI+ object used to draw lines and curves.

 

Return Values

If the function succeeds, it returns Ok, which is an element of the Status enumeration.

 

If the function fails, it returns one of the other elements of the Status enumeration.

 

GdiClonePen

 

Description

Copies a Pen object.

Syntax

GpStatus WINGDIPAPI GdipClonePen(

    GpPen *pen,

    GpPen **clonepen

);

PowerBASIC Syntax

DECLARE FUNCTION GdipClonePen ( _

    BYVAL pen AS DWORD, _

    BYREF clonepen AS DWORD _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

clonepen

[out] Pointer to a variable that receives a pointer to the new Pen object.

 

GdipCreatePen1

 

Description

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

Syntax

GpStatus WINGDIPAPI GdipCreatePen1(

    ARGB color,

    REAL width,

    GpUnit unit,

    GpPen **pen

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreatePen1 ( _

    BYVAL pColor AS DWORD, _

    BYVAL nWidth AS SINGLE, _

    BYVAL unit AS LONG, _

    BYREF pen AS DWORD _

) AS LONG

Parameters

 

color

[in] ARGB color that specifies the color for this Pen object.

width

[in] Single precision value that specifies the width of this pen's stroke. The default value is 1.0.

unit

[in] Unit measure. The default unit of measure is UnitPixel, which is an element of the Unit enumeration.

pen

[out] Pointer to a variable that receives a pointer to the new created Pen object.

 

GdipCreatePen2

 

Description

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

Syntax

GpStatus WINGDIPAPI GdipCreatePen2(

    GpBrush *brush,

    REAL width,

    GpUnit unit,

    GpPen **pen

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreatePen2 ( _

    BYVAL brush AS DWORD, _

    BYVAL nWidth AS SINGLE, _

    BYVAL unit AS LONG, _

    BYREF pen AS DWORD _

) AS LONG

Parameters

 

brush

[in] Pointer to a brush to base this pen on.

width

[in] Single precision value that specifies the width of this pen's stroke. The default value is 1.0.

unit

[in] Unit measure. The default unit of measure is UnitPixel, which is an element of the Unit enumeration.

pen

[out] Pointer to a variable that receives a pointer to the new created Pen object.

 

GdipDeletePen

 

Description

Deletes a Pen object.

Syntax

GpStatus WINGDIPAPI GdipDeletePen(

    GpPen *pen

);

PowerBASIC Syntax

DECLARE FUNCTION GdipDeletePen ( _

    BYVAL pen AS DWORD _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

 

GdipGetPenBrushFill

 

Description

Gets the Brush object that is currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenBrushFill(

    GpPen *pen,

    GpBrush **brush

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenBrushFill ( _

    BYVAL pen AS DWORD, _

    BYREF brush AS DWORD _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

brush

[out] Pointer to a variable that receives a pointer to the Brush object that is currently used to fill a line.

 

GdipGetPenColor

 

Description

Gets the color currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenColor(

    GpPen *pen,

    ARGB *argb

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenColor ( _

    BYVAL pen AS DWORD, _

    BYREF pargb AS DWORD _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

argb

[out] Pointer to a variable that receives the color of this Pen object.

 

GdipGetPenCompoundArray

 

Description

Gets the compound array currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenCompoundArray(

    GpPen *pen,

    REAL *dash,

    INT count

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenCompoundArray ( _

    BYVAL pen AS DWORD, _

    BYREF dash AS SINGLE, _

    BYVAL count AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

dash

[out] Pointer to an array that receives the compound array.

count

[in] Long integer value that specifies the number of elements in the dash array.

 

GdipGetPenCompoundCount

 

Description

Gets the number of elements in a compound array.

Syntax

GpStatus WINGDIPAPI GdipGetPenCompoundCount(

    GpPen *pen,

    INT *count

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenCompoundCount ( _

    BYVAL pen AS DWORD, _

    BYREF count AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

count

[out] Pointer to a variable that receives the number of elements in the compound array.

Remarks

Suppose that a compound array contains the values 0.0, 0.2, 0.7, and 1.0 and that the pen has a width of 100. When you use the pen to draw, you get two parallel lines. The first line has a width of 20, the space between the two lines has a width of 50, and the second line has a width of 30.

 

For a more complex example, suppose that a compound array contains the values 0.0, 0.2, 0.3, 0.6, 0.85, and 1.0 and that the pen has a width of 100. When you use the pen to draw, you get three parallel lines. The widths of the three lines are 20, 30, and 15 respectively. The widths of the two spaces between the lines are 10 and 15 respectively.

 

GdipGetPenCustomEndCap

 

Description

Gets the custom end cap currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenCustomEndCap(

    GpPen *pen,

    GpCustomLineCap** customCap

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenCustomEndCap ( _

    BYVAL pen AS DWORD, _

    BYREF customCap AS DWORD _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

customCap

[out] Pointer to a variable that receives the custom end cap of this Pen object.

 

GdipGetPenCustomStartCap

 

Description

Gets the custom start cap currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenCustomStartCap(

    GpPen *pen,

    GpCustomLineCap** customCap

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenCustomStartCap ( _

    BYVAL pen AS DWORD, _

    BYREF customCap AS DWORD _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

customCap

[out] Pointer to a variable that receives a pointer to the start cap of this Pen object.

 

GdipGetPenDashArray

 

Description

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

Syntax

GpStatus WINGDIPAPI GdipGetPenDashArray(

    GpPen *pen,

    REAL *dash,

    INT count

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenDashArray ( _

    BYVAL pen AS DWORD, _

    BYREF dash AS SINGLE, _

    BYVAL count AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

dash

[out] Pointer to an array that receives the length of the dashes and spaces in a custom dashed line.

count

[in] Long integer value that specifies the number of elements in the dash array.

Remarks

The elements in the dash array set the length of each dash and space in the dash pattern. The first element sets the length of a dash, the second element sets the length of a space, the third element sets the length of a dash, and so forth.

 

The length of each dash and space in the dash pattern is the product of each element in the array and the width of the Pen object.

 

GdipGetPenDashCap197819

 

Description

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

Syntax

GpStatus WINGDIPAPI GdipGetPenDashCap197819(

    GpPen *pen,

    GpDashCap *dashCap

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenDashCap197819 ( _

    BYVAL pen AS DWORD, _

    BYREF dashCap AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

dashCap

[out] Pointer to a variable that receives an element of the DashCap enumeration that indicates the dash cap style currently set for this Pen object.

 

GdipGetPenDashCount

 

Description

Gets the number of elements in a dash pattern array.

Syntax

GpStatus WINGDIPAPI GdipGetPenDashCount(

    GpPen *pen,

    INT *count

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenDashCount ( _

    BYVAL pen AS DWORD, _

    BYREF count AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

count

[out] Pointer to a variable that receives the number of elements in the dash pattern array.

 

GdipGetPenDashOffset

 

Description

Gets the number of elements in a dash pattern array.

Syntax

GpStatus WINGDIPAPI GdipGetPenDashOffset(

    GpPen *pen,

    REAL *offset

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenDashOffset ( _

    BYVAL pen AS DWORD, _

    BYREF offset AS SINGLE _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

offset

[out] Pointer to a variable that receives the number of elements in the dash pattern array.

 

GdipGetPenDashStyle

 

Description

Gets the number of elements in a dash pattern array.

Syntax

GpStatus WINGDIPAPI GdipGetPenDashStyle(

   GpPen *pen,

   GpDashStyle *dashstyle

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenDashStyle ( _

    BYVAL pen AS DWORD, _

    BYREF dashStyle AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

dashStyle

[out] Pointer to a variable that receives the number of elements in the dash pattern array.

 

GdipGetPenEndCap

 

Description

Gets the end cap currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenEndCap(

    GpPen *pen,

    GpLineCap *endCap

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenEndCap ( _

    BYVAL pen AS DWORD, _

    BYREF endCap AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

endCap

[out] Pointer to a variable that receives an element of the LineCap enumeration that indicates the end cap for this Pen object.

 

GdipGetPenFillType

 

Description

Gets the type currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenFillType(

    GpPen *pen,

    GpPenType* type

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenFillType ( _

    BYVAL pen AS DWORD, _

    BYREF pType AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

type

[out] Pointer to a variable that receives an element of the PenType enumeration that indicates the style of pen currently set for this Pen object.

 

GdipGetPenLineJoin

 

Description

Gets the line join style currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenLineJoin(

    GpPen *pen,

    GpLineJoin *lineJoin

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenLineJoin ( _

    BYVAL pen AS DWORD, _

    BYREF lineJoin AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

lineJoin

[out] Pointer to a variable that receives an element of the LineJoin enumeration that indicates the style used at the point where line segments join.

 

GdipGetPenMiterLimit

 

Description

Gets the miter length currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenMiterLimit(

    GpPen *pen,

    REAL *miterLimit

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenMiterLimit ( _

    BYVAL pen AS DWORD, _

    BYREF miterLimit AS SINGLE _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

miterLimit

[out] The miter limit of this Pen object.

 

GdipGetPenMode

 

Description

Gets the alignment currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenMode(

    GpPen *pen,

    GpPenAlignment *penMode

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenMode ( _

    BYVAL pen AS DWORD, _

    BYREF penMode AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

penMode

[out] Pointer to a variable that receives an element of the PenAlignment enumeration that indicates the current alignment setting for this Pen object.

 

GdipGetPenStartCap

 

Description

Gets the start cap currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenStartCap(

    GpPen *pen,

    GpLineCap *startCap

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenStartCap ( _

    BYVAL pen AS DWORD, _

    BYREF startCap AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

startCap

[out] Pointer to a variable that receives an element of the LineCap enumeration that specifies the start cap for this Pen object.

 

GdipGetPenTransform

 

Description

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

Syntax

GpStatus WINGDIPAPI GdipGetPenTransform(

    GpPen *pen,

    GpMatrix *matrix

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenTransform ( _

    BYVAL pen AS DWORD, _

    BYVAL matrix AS DWORD _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

matrix

[out] Pointer to a variable that receives the transformation matrix.

 

GdipGetPenUnit

 

Description

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

Syntax

GpStatus WINGDIPAPI GdipGetPenUnit(

    GpPen *pen,

    GpUnit *unit

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenUnit ( _

    BYVAL pen AS DWORD, _

    BYREF unit AS LONG _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

unit

[out] Pointer to a variable that receives a member of the Unit enumeration that indicates the unit of measure for the width of the pen.

 

GdipGetPenWidth

 

Description

Gets the width currently set for this Pen object.

Syntax

GpStatus WINGDIPAPI GdipGetPenWidth(

    GpPen *pen,

    REAL *width

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetPenWidth ( _

    BYVAL pen AS DWORD, _

    BYREF nWidth AS SINGLE _

) AS LONG

Parameters

 

pen

[in] Pointer to the Pen object.

width

[out] Pointer to a variable that receives the width of this Pen object.

 

GdipMultiplyPenTransform

 

Description

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

Syntax

GpStatus WINGDIPAPI GdipMultiplyPenTransform(

    GpPen *pen,

    GDIPCONST GpMatrix *matrix,

    GpMatrixOrder order

);

PowerBASIC Syntax

DECLARE FUNCTION GdipMultiplyPenTransform ( _

    BYVAL pen AS DWORD, _

    BYVAL matrix AS DWORD, _

    BYVAL order AS LONG _