Pen

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.ms.System.IDisposable

public class Pen implements System.IDisposable

Defines an object used to draw lines and curves.

Constructors

ConstructorDescription
Pen(Color color)Initializes a new instance of the Pen class with the specified Color(.getColor/.setColor(Color)).
Pen(Brush brush, float width)Initializes a new instance of the Pen class with the specified Brush and Width.
Pen(Brush brush)Initializes a new instance of the Pen class with the specified Brush(.getBrush/.setBrush(Brush)).
Pen(Color color, float width)Initializes a new instance of the Pen class with the specified Color and Width properties.

Methods

MethodDescription
getColor()Gets or sets the color of this Pen.
setColor(Color value)Gets or sets the color of this Pen.
getBrush()Gets or sets the Brush that determines attributes of this Pen.
setBrush(Brush value)Gets or sets the Brush that determines attributes of this Pen.
getCompoundArray()Gets or sets an array of values that specifies a compound pen.
setCompoundArray(float[] value)Gets or sets an array of values that specifies a compound pen.
getWidth()Gets or sets the width of this Pen, in units of the Graphics object used for drawing.
setWidth(float value)Gets or sets the width of this Pen, in units of the Graphics object used for drawing.
getStartCap()Gets or sets the cap style used at the beginning of lines drawn with this Pen.
setStartCap(int value)Gets or sets the cap style used at the beginning of lines drawn with this Pen.
getEndCap()Gets or sets the cap style used at the end of lines drawn with this Pen.
setEndCap(int value)Gets or sets the cap style used at the end of lines drawn with this Pen.
getLineJoin()Gets or sets the join style for the ends of two consecutive lines drawn with this Pen.
setLineJoin(int value)Gets or sets the join style for the ends of two consecutive lines drawn with this Pen.
getMiterLimit()Gets or sets the limit of the thickness of the join on a mitered corner.
setMiterLimit(float value)Gets or sets the limit of the thickness of the join on a mitered corner.
getAlignment()Gets or sets the alignment for this Pen.
setAlignment(int value)Gets or sets the alignment for this Pen.
getTransform()Gets or sets a copy of the geometric transformation for this Pen.
setTransform(Matrix value)Gets or sets a copy of the geometric transformation for this Pen.
getCustomStartCap()Gets or sets a custom cap to use at the beginning of lines drawn with this Pen.
setCustomStartCap(CustomLineCap value)Gets or sets a custom cap to use at the beginning of lines drawn with this Pen.
getCustomEndCap()Gets or sets a custom cap to use at the end of lines drawn with this Pen.
setCustomEndCap(CustomLineCap value)Gets or sets a custom cap to use at the end of lines drawn with this Pen.
getDashCap()Gets or sets the cap style used at the end of the dashes that make up dashed lines drawn with this Pen.
setDashCap(int value)Gets or sets the cap style used at the end of the dashes that make up dashed lines drawn with this Pen.
getDashOffset()Gets or sets the distance from the start of a line to the beginning of a dash pattern.
setDashOffset(float value)Gets or sets the distance from the start of a line to the beginning of a dash pattern.
getDashPattern()Gets or sets an array of custom dashes and spaces.
setDashPattern(float[] value)Gets or sets an array of custom dashes and spaces.
getDashStyle()Gets or sets the style used for dashed lines drawn with this Pen.
setDashStyle(int value)Gets or sets the style used for dashed lines drawn with this Pen.
getPenType()Gets the style of lines drawn with this Pen.
dispose()Releases all resources used by this Pen.
deepClone()Creates an exact copy of this Pen.
setLineCap(int startCap, int endCap, int dashCap)Sets the values that determine the style of cap used to end lines drawn by this Pen.
scaleTransform(float sx, float sy)Scales the local geometric transformation by the specified factors.
scaleTransform(float sx, float sy, int order)Scales the local geometric transformation by the specified factors in the specified order.
translateTransform(float dx, float dy)Translates the local geometric transformation by the specified dimensions.
translateTransform(float dx, float dy, int order)Translates the local geometric transformation by the specified dimensions in the specified order.
rotateTransform(float angle)Rotates the local geometric transformation by the specified angle.
rotateTransform(float angle, int order)Rotates the local geometric transformation by the specified angle in the specified order.
resetTransform()Resets the geometric transformation matrix for this Pen to identity.
multiplyTransform(Matrix matrix)Multiplies the transformation matrix for this Pen by the specified Matrix.
multiplyTransform(Matrix matrix, int order)Multiplies the transformation matrix for this Pen by the specified Matrix in the specified order.

Pen(Color color)

public Pen(Color color)

Initializes a new instance of the Pen class with the specified Color(.getColor/.setColor(Color)).

Parameters:

ParameterTypeDescription
colorColorA Color(.getColor/.setColor(Color)) that determines the fill properties of this Pen.

Pen(Brush brush, float width)

public Pen(Brush brush, float width)

Initializes a new instance of the Pen class with the specified Brush and Width.

Parameters:

ParameterTypeDescription
brushBrushA Brush that determines the characteristics of this Pen.
widthfloatThe width of the new Pen.

Pen(Brush brush)

public Pen(Brush brush)

Initializes a new instance of the Pen class with the specified Brush(.getBrush/.setBrush(Brush)).

Parameters:

ParameterTypeDescription
brushBrushA Brush(.getBrush/.setBrush(Brush)) that determines the fill properties of this Pen.

Pen(Color color, float width)

public Pen(Color color, float width)

Initializes a new instance of the Pen class with the specified Color and Width properties.

Parameters:

ParameterTypeDescription
colorColorA Color structure that indicates the color of this Pen.
widthfloatA value indicating the width of this Pen.

getColor()

public final Color getColor()

Gets or sets the color of this Pen.

Value: A Color(.getColor/.setColor(Color)) structure that represents the color of this Pen.

Returns: Color

setColor(Color value)

public final void setColor(Color value)

Gets or sets the color of this Pen.

Value: A Color(.getColor/.setColor(Color)) structure that represents the color of this Pen.

Parameters:

ParameterTypeDescription
valueColor

getBrush()

public final Brush getBrush()

Gets or sets the Brush that determines attributes of this Pen.

Returns: Brush

setBrush(Brush value)

public final void setBrush(Brush value)

Gets or sets the Brush that determines attributes of this Pen.

Parameters:

ParameterTypeDescription
valueBrush

getCompoundArray()

public final float[] getCompoundArray()

Gets or sets an array of values that specifies a compound pen. A compound pen draws a compound line made up of parallel lines and spaces.

Returns: float[] - An array of real numbers that specifies the compound array. The elements in the array must be in increasing order, not less than 0, and not greater than 1.

setCompoundArray(float[] value)

public final void setCompoundArray(float[] value)

Gets or sets an array of values that specifies a compound pen. A compound pen draws a compound line made up of parallel lines and spaces.

Parameters:

ParameterTypeDescription
valuefloat[]

getWidth()

public final float getWidth()

Gets or sets the width of this Pen, in units of the Graphics object used for drawing.

Returns: float

setWidth(float value)

public final void setWidth(float value)

Gets or sets the width of this Pen, in units of the Graphics object used for drawing.

Parameters:

ParameterTypeDescription
valuefloat

getStartCap()

public final int getStartCap()

Gets or sets the cap style used at the beginning of lines drawn with this Pen.

Returns: int

setStartCap(int value)

public final void setStartCap(int value)

Gets or sets the cap style used at the beginning of lines drawn with this Pen.

Parameters:

ParameterTypeDescription
valueint

getEndCap()

public final int getEndCap()

Gets or sets the cap style used at the end of lines drawn with this Pen.

Returns: int

setEndCap(int value)

public final void setEndCap(int value)

Gets or sets the cap style used at the end of lines drawn with this Pen.

Parameters:

ParameterTypeDescription
valueint

getLineJoin()

public final int getLineJoin()

Gets or sets the join style for the ends of two consecutive lines drawn with this Pen.


At the moment Miter join actually works as MiterClipped.

Returns: int

setLineJoin(int value)

public final void setLineJoin(int value)

Gets or sets the join style for the ends of two consecutive lines drawn with this Pen.


At the moment Miter join actually works as MiterClipped.

Parameters:

ParameterTypeDescription
valueint

getMiterLimit()

public final float getMiterLimit()

Gets or sets the limit of the thickness of the join on a mitered corner.

Returns: float

setMiterLimit(float value)

public final void setMiterLimit(float value)

Gets or sets the limit of the thickness of the join on a mitered corner.

Parameters:

ParameterTypeDescription
valuefloat

getAlignment()

public final int getAlignment()

Gets or sets the alignment for this Pen.

Returns: int - A PenAlignment that represents the alignment for this Pen.

setAlignment(int value)

public final void setAlignment(int value)

Gets or sets the alignment for this Pen.

Parameters:

ParameterTypeDescription
valueint

getTransform()

public final Matrix getTransform()

Gets or sets a copy of the geometric transformation for this Pen.

Value: A copy of the Matrix that represents the geometric transformation for this Pen.

Returns: Matrix

setTransform(Matrix value)

public final void setTransform(Matrix value)

Gets or sets a copy of the geometric transformation for this Pen.

Value: A copy of the Matrix that represents the geometric transformation for this Pen.

Parameters:

ParameterTypeDescription
valueMatrix

getCustomStartCap()

public final CustomLineCap getCustomStartCap()

Gets or sets a custom cap to use at the beginning of lines drawn with this Pen.

Returns: CustomLineCap - A CustomLineCap that represents the cap used at the beginning of lines drawn with this Pen.

setCustomStartCap(CustomLineCap value)

public final void setCustomStartCap(CustomLineCap value)

Gets or sets a custom cap to use at the beginning of lines drawn with this Pen.

Parameters:

ParameterTypeDescription
valueCustomLineCap

getCustomEndCap()

public final CustomLineCap getCustomEndCap()

Gets or sets a custom cap to use at the end of lines drawn with this Pen.

Returns: CustomLineCap - A CustomLineCap that represents the cap used at the end of lines drawn with this Pen.

setCustomEndCap(CustomLineCap value)

public final void setCustomEndCap(CustomLineCap value)

Gets or sets a custom cap to use at the end of lines drawn with this Pen.

Parameters:

ParameterTypeDescription
valueCustomLineCap

getDashCap()

public final int getDashCap()

Gets or sets the cap style used at the end of the dashes that make up dashed lines drawn with this Pen.

Returns: int - One of the DashCap(.getDashCap/.setDashCap(int)) values that represents the cap style used at the beginning and end of the dashes that make up dashed lines drawn with this Pen.

setDashCap(int value)

public final void setDashCap(int value)

Gets or sets the cap style used at the end of the dashes that make up dashed lines drawn with this Pen.

Parameters:

ParameterTypeDescription
valueint

getDashOffset()

public final float getDashOffset()

Gets or sets the distance from the start of a line to the beginning of a dash pattern.

Returns: float - The distance from the start of a line to the beginning of a dash pattern.

setDashOffset(float value)

public final void setDashOffset(float value)

Gets or sets the distance from the start of a line to the beginning of a dash pattern.

Parameters:

ParameterTypeDescription
valuefloat

getDashPattern()

public final float[] getDashPattern()

Gets or sets an array of custom dashes and spaces.

Returns: float[] - An array of real numbers that specifies the lengths of alternating dashes and spaces in dashed lines.

setDashPattern(float[] value)

public final void setDashPattern(float[] value)

Gets or sets an array of custom dashes and spaces.

Parameters:

ParameterTypeDescription
valuefloat[]

getDashStyle()

public final int getDashStyle()

Gets or sets the style used for dashed lines drawn with this Pen.

Returns: int - A DashStyle(.getDashStyle/.setDashStyle(int)) that represents the style used for dashed lines drawn with this Pen.

setDashStyle(int value)

public final void setDashStyle(int value)

Gets or sets the style used for dashed lines drawn with this Pen.

Parameters:

ParameterTypeDescription
valueint

getPenType()

public final int getPenType()

Gets the style of lines drawn with this Pen.

Value: A PenType(.getPenType) enumeration that specifies the style of lines drawn with this Pen.

Returns: int

dispose()

public final void dispose()

Releases all resources used by this Pen.


This method actually does nothing. It’s just for compatibility with System.Drawing API.

deepClone()

public final Object deepClone()

Creates an exact copy of this Pen.

Returns: java.lang.Object - An Object that can be cast to a Pen.

setLineCap(int startCap, int endCap, int dashCap)

public final void setLineCap(int startCap, int endCap, int dashCap)

Sets the values that determine the style of cap used to end lines drawn by this Pen.

Parameters:

ParameterTypeDescription
startCapintA LineCap that represents the cap style to use at the beginning of lines drawn with this Pen.
endCapintA LineCap that represents the cap style to use at the end of lines drawn with this Pen.
dashCapintA LineCap that represents the cap style to use at the beginning or end of dashed lines drawn with this Pen.

scaleTransform(float sx, float sy)

public final void scaleTransform(float sx, float sy)

Scales the local geometric transformation by the specified factors. This method prepends the scaling matrix to the transformation.

Parameters:

ParameterTypeDescription
sxfloatThe factor by which to scale the transformation in the x-axis direction.
syfloatThe factor by which to scale the transformation in the y-axis direction.

scaleTransform(float sx, float sy, int order)

public final void scaleTransform(float sx, float sy, int order)

Scales the local geometric transformation by the specified factors in the specified order.

Parameters:

ParameterTypeDescription
sxfloatThe factor by which to scale the transformation in the x-axis direction.
syfloatThe factor by which to scale the transformation in the y-axis direction.
orderintA MatrixOrder that specifies whether to append or prepend the scaling matrix.

translateTransform(float dx, float dy)

public final void translateTransform(float dx, float dy)

Translates the local geometric transformation by the specified dimensions. This method prepends the translation to the transformation.

Parameters:

ParameterTypeDescription
dxfloatThe value of the translation in x.
dyfloatThe value of the translation in y.

translateTransform(float dx, float dy, int order)

public final void translateTransform(float dx, float dy, int order)

Translates the local geometric transformation by the specified dimensions in the specified order.

Parameters:

ParameterTypeDescription
dxfloatThe value of the translation in x.
dyfloatThe value of the translation in y.
orderintThe order (prepend or append) in which to apply the translation.

rotateTransform(float angle)

public final void rotateTransform(float angle)

Rotates the local geometric transformation by the specified angle. This method prepends the rotation to the transformation.

Parameters:

ParameterTypeDescription
anglefloatThe angle of rotation.

rotateTransform(float angle, int order)

public final void rotateTransform(float angle, int order)

Rotates the local geometric transformation by the specified angle in the specified order.

Parameters:

ParameterTypeDescription
anglefloatThe angle of rotation.
orderintA MatrixOrder that specifies whether to append or prepend the rotation matrix.

resetTransform()

public final void resetTransform()

Resets the geometric transformation matrix for this Pen to identity.

multiplyTransform(Matrix matrix)

public final void multiplyTransform(Matrix matrix)

Multiplies the transformation matrix for this Pen by the specified Matrix.

Parameters:

ParameterTypeDescription
matrixMatrixThe Matrix object by which to multiply the transformation matrix.

multiplyTransform(Matrix matrix, int order)

public final void multiplyTransform(Matrix matrix, int order)

Multiplies the transformation matrix for this Pen by the specified Matrix in the specified order.

Parameters:

ParameterTypeDescription
matrixMatrixThe java.awt.geom.AffineTransform by which to multiply the transformation matrix.
orderintThe order in which to perform the multiplication operation.