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=
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
OEPen.SetBackColormethodOEPen.SetFillmethodOEColor 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.SetFillmethodOEPen.SetBackColormethodOEFillnamespace
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.SetForeColormethodOEColor 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.SetLineCapmethodOELineCapnamespace
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.SetLineJoinmethodOELineJoinnamespace
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.SetLineStipplemethodOEPen.SetStippleFactormethodOEStipplenamespace
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.SetLineWidthmethod
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.SetStippleFactormethodOEPen.SetLineStipplemethod
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.OEBlueTint);
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
OEPen.GetBackColormethodOEPen.GetFillmethodOEColor class
SetFill
void SetFill(unsigned int fill)
Sets the fill property of the OEPen object.
- fill
This value has to be from the
OEFillnamespace.
See also
OEPen.GetFillmethodOEPen.GetBackColormethodOEFillnamespace
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.OERed);
Example of using the SetForeColor method
See also
OEPen.GetForeColormethodOEColor 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
OELineCapnamespace.
Example (Figure: Example of using the SetLineCap method)
OEPen pen = new OEPen();
pen.SetLineWidth(4);
pen.SetLineCap(OELineCap.Square);
Example of using the SetLineCap method
See also
OEPen.GetLineCapmethodOELineCapnamespace
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
OELineJoinnamespace.
Example (Figure: Example of using the SetLineJoin method)
OEPen pen = new OEPen();
pen.SetLineWidth(4);
pen.SetLineJoin(OELineJoin.Miter);
Example of using the SetLineJoin method
See also
OEPen.GetLineJoinmethodOELineJoinnamespace
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
OEStipplenamespace.
Example (Figure: Example of using the SetLineStipple method)
OEPen pen = new OEPen();
pen.SetLineStipple(OEStipple.ShortDash);
Example of using the SetLineStipple method
See also
OEPen.SetLineStipplemethodOEPen.SetStippleFactormethodOEStipplenamespace
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);
Example of using the SetLineWidth method
See also
OEPen.GetLineWidthmethod
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);
Example of using the SetStippleFactor method
See also
OEPen.GetStippleFactormethodOEPen.GetLineStipplemethod