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 |
|||
foreground color |
|||
fill |
|||
line join |
|||
line cap |
|||
line width |
none |
||
line stipple |
|||
stipple factor |
none |
Constructors¶
OEPen()
Default constructor that initializes an OEPen object with the following properties:
Property |
Default value |
---|---|
background color |
|
foreground color |
|
fill |
|
line join |
|
line cap |
|
line width |
1.0 |
line stipple |
|
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!=¶
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
OEPen.SetBackColor
methodOEPen.SetFill
methodOEColor class
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
OEPen.SetFill
methodOEPen.SetBackColor
methodOEFill
namespace
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
OEPen.SetForeColor
methodOEColor class
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
OEPen.SetLineCap
methodOELineCap
namespace
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
OEPen.SetLineJoin
methodOELineJoin
namespace
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
OEPen.SetLineStipple
methodOEPen.SetStippleFactor
methodOEStipple
namespace
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
OEPen.SetLineWidth
method
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.
See also
OEPen.SetStippleFactor
methodOEPen.SetLineStipple
method
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());
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
OEPen.GetBackColor
methodOEPen.GetFill
methodOEColor class
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
OEPen.GetFill
methodOEPen.GetBackColor
methodOEFill
namespace
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());
See also
OEPen.GetForeColor
methodOEColor class
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);
See also
OEPen.GetLineCap
methodOELineCap
namespace
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);
See also
OEPen.GetLineJoin
methodOELineJoin
namespace
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);
See also
OEPen.SetLineStipple
methodOEPen.SetStippleFactor
methodOEStipple
namespace
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);
See also
OEPen.GetLineWidth
method
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);
See also
OEPen.GetStippleFactor
methodOEPen.GetLineStipple
method