OEPen

class OEPen

The OEPen class encapsulates properties that determine the way various lines, curves and shapes are drawn.

Currently the OEPen class stores the following properties:

Property

Get method

Set method

Corresponding namespace/class

background color

OEPen.GetBackColor

OEPen.SetBackColor

OEColor

foreground color

OEPen.GetForeColor

OEPen.SetForeColor

OEColor

fill

OEPen.GetFill

OEPen.SetFill

OEFill

line join

OEPen.GetLineJoin

OEPen.SetLineJoin

OELineJoin

line cap

OEPen.GetLineCap

OEPen.SetLineCap

OELineCap

line width

OEPen.GetLineWidth

OEPen.SetLineWidth

none

line stipple

OEPen.SetLineStipple

OEPen.GetLineStipple

OEStipple

stipple factor

OEPen.SetStippleFactor

OEPen.GetStippleFactor

none

Constructors

OEPen() -> OEPen

Default constructor that initializes an OEPen object with the following properties:

Default parameters of OEPen

Property

Default value

background color

OEWhite = OEColor(255,255,255)

foreground color

OEBlack = OEColor(0,0,0)

fill

OEFill_Default

line join

OELineJoin_Default

line cap

OELineCap_Default

line width

1.0

line stipple

OEStipple_Default

stipple factor

1

OEPen(bg: OEColor, fg: OEColor, fill: int, linewidth: float = 1.0,
      stipple: short) -> OEPen

Creates and initializes an OEPen object with the given parameters. The other properties of the pen are set to the default values (see table above).

bg, fg

The background and foreground color of the pen.

fill

The fill property of the pen.

linewidth

The line width property of the pen.

OEPen(arg2: OEPen) -> OEPen

Copy constructor.

GetBackColor

GetBackColor() -> OEColor

Returns the background color of the OEPen object that is used to fill shapes.

See also

GetFill

GetFill() -> int

If the returned value is OEFill_On, than shapes drawn with the OEPen object are filled with the background color of the pen. If the returned value is OEFill_Off, than shapes drawn with the OEPen object are left “empty” i.e. only their outlines are drawn using the foreground color of the pen.

See also

GetForeColor

GetForeColor() -> OEColor

Returns the foreground color of the OEPen object that controls the color of the strokes when drawing lines, curves and outlines of shapes.

See also

GetLineCap

GetLineCap() -> int

Returns the line cap property of the OEPen object that controls how the endpoints of lines are drawn. The return value is taken from the OELineCap namespace.

See also

GetLineJoin

GetLineJoin() -> int

Returns the line join property of the OEPen object that controls how lines connect at corners when drawing outlines. The return value is taken from the OELineJoin namespace.

See also

GetLineStipple

GetLineStipple() -> short

Returns the line stipple property of the OEPen object that controls the pattern of dashes and gaps used to draw lines and outlines. The return value is taken from the OEStipple namespace.

See also

GetLineWidth

GetLineWidth() -> float

Returns the line width of the OEPen object that controls the width of strokes used when drawing lines, curves and outlines of shapes.

See also

GetStippleFactor

GetStippleFactor() -> short

Returns the stipple factor of the OEPen object. The stipple factor is a multiplier that is used when drawing stipple patterns. For example, if the factor is three, then the stipple pattern is stretched to three times of its original size.

SetBackColor

SetBackColor(col: OEColor) -> None

Sets the background color of the OEPen object that is used to fill shapes.

Example (Figure: Example of using the SetBackColor method)

pen = oedepict.OEPen()
pen.SetFill(oedepict.OEFill_On)
pen.SetBackColor(oechem.OEBlueTint)
../../_images/OEPen_SetBackColor.png

Example of using the SetBackColor method

Note

In order to fill a shape using the background color, the fill property of the OEPen has to be turned on (OEFill_On). (See OEPen.SetFill method and OEFill namespace)

See also

SetFill

SetFill(f: int) -> None

Sets the fill property of the OEPen object.

fill

This value has to be from the OEFill namespace.

See also

SetForeColor

SetForeColor(col: OEColor) -> None

Sets the foreground color of the OEPen object that controls the color of the stroke when drawing lines, curves and outlines of shapes.

Example (Figure: Example of using the SetForeColor method)

pen = oedepict.OEPen()
pen.SetForeColor(oechem.OERed)
../../_images/OEPen_SetForeColor.png

Example of using the SetForeColor method

See also

SetLineCap

SetLineCap(cap: int) -> None

Sets the line cap property of the OEPen object that controls how the endpoints of lines are drawn.

cap

This value has to be from the OELineCap namespace.

Example (Figure: Example of using the SetLineCap method)

pen = oedepict.OEPen()
pen.SetLineWidth(4)
pen.SetLineCap(oedepict.OELineCap_Square)
../../_images/OEPen_SetLineCap.png

Example of using the SetLineCap method

See also

SetLineJoin

SetLineJoin(join: int) -> None

Sets the line join property of the OEPen object that controls how lines connect at corners when drawing outlines.

join

This value has to be from the OELineJoin namespace.

Example (Figure: Example of using the SetLineJoin method)

pen = oedepict.OEPen()
pen.SetLineWidth(4)
pen.SetLineJoin(oedepict.OELineJoin_Miter)
../../_images/OEPen_SetLineJoin.png

Example of using the SetLineJoin method

See also

SetLineStipple

SetLineStipple(p: short) -> None

Sets the line stipple property of the OEPen object that controls the pattern of dashes and gaps used to draw lines and outlines.

pattern

This value has to be from the OEStipple namespace.

Example (Figure: Example of using the SetLineStipple method)

pen = oedepict.OEPen()
pen.SetLineStipple(oedepict.OEStipple_ShortDash)
../../_images/OEPen_SetLineStipple.png

Example of using the SetLineStipple method

See also

SetLineWidth

SetLineWidth(w: float) -> None

Sets the line width of the OEPen object that controls the width of strokes used when drawing lines, curves and outlines of shapes.

width

This value has to be a positive number.

Example (Figure: Example of using the SetLineWidth method)

pen = oedepict.OEPen()
pen.SetLineWidth(5.0)
../../_images/OEPen_SetLineWidth.png

Example of using the SetLineWidth method

See also

SetStippleFactor

SetStippleFactor(f: short) -> None

Sets the stipple factor of the OEPen object. The stipple factor is a multiplier that is used when drawing stipple patterns.

Example (Figure: Example of using the SetStippleFactor method)

pen = oedepict.OEPen()
pen.SetLineStipple(oedepict.OEStipple_ShortDash)
pen.SetStippleFactor(2)
../../_images/OEPen_SetStippleFactor.png

Example of using the SetStippleFactor method