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()

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(const OESystem::OEColor &bg, const OESystem::OEColor &fg,
      unsigned int fill=OEFill::Off, double linewidth=1.0)

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(const OEPen &rhs)

Copy constructor.

operator=

OEPen &operator=(const OEPen &rhs)

Assignment operator.

operator!=

bool operator!=(const OEPen &) const

Determines whether two OEPen objects are different. Two OEPen objects are considered different, if any of their properties (such as line width, background color, etc.) are different.

operator==

bool operator==(const OEPen &) const

Determines whether two OEPen objects are equal. Two OEPen objects are considered equivalent only if all of their properties (such as line width, background color, etc.) are identical.

GetBackColor

const OESystem::OEColor &GetBackColor() const

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

See also

GetFill

unsigned int GetFill() const

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

const OESystem::OEColor &GetForeColor() const

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

unsigned int GetLineCap() const

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

unsigned int GetLineJoin() const

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

unsigned short GetLineStipple() const

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

double GetLineWidth() const

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

unsigned short GetStippleFactor() const

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

void SetBackColor(const OESystem::OEColor &col)

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

Example (Figure: Example of using the SetBackColor method)

OEPen pen = new OEPen();
pen.SetFill(OEFill.On);
pen.SetBackColor(oechem.getOEBlueTint());
../../_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

void SetFill(unsigned int fill)

Sets the fill property of the OEPen object.

fill

This value has to be from the OEFill namespace.

See also

SetForeColor

void SetForeColor(const OESystem::OEColor &col)

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)

OEPen pen = new OEPen();
pen.SetForeColor(oechem.getOERed());
../../_images/OEPen_SetForeColor.png

Example of using the SetForeColor method

See also

SetLineCap

void SetLineCap(unsigned int cap)

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)

OEPen pen = new OEPen();
pen.SetLineWidth(4);
pen.SetLineCap(OELineCap.Square);
../../_images/OEPen_SetLineCap.png

Example of using the SetLineCap method

See also

SetLineJoin

void SetLineJoin(unsigned int join)

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)

OEPen pen = new OEPen();
pen.SetLineWidth(4);
pen.SetLineJoin(OELineJoin.Miter);
../../_images/OEPen_SetLineJoin.png

Example of using the SetLineJoin method

See also

SetLineStipple

void SetLineStipple(unsigned short pattern)

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)

OEPen pen = new OEPen();
pen.SetLineStipple(OEStipple.ShortDash);
../../_images/OEPen_SetLineStipple.png

Example of using the SetLineStipple method

See also

SetLineWidth

void SetLineWidth(double width)

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)

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

Example of using the SetLineWidth method

See also

SetStippleFactor

void SetStippleFactor(unsigned short factor)

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)

OEPen pen = new OEPen();
pen.SetLineStipple(OEStipple.ShortDash);
pen.SetStippleFactor(2);
../../_images/OEPen_SetStippleFactor.png

Example of using the SetStippleFactor method