latest version v1.9 - last update 10 Apr 2010 |
Line pattern class. More...
#include <ltiGraphicsPattern.h>
Public Member Functions | |
linePattern () | |
linePattern (const ivector &d, int o) | |
linePattern (const linePattern &o) | |
virtual | ~linePattern () |
virtual rectangle | getBoundingBox () const |
bool | isSet (int i) const |
void | getDash (ivector &d, int &o) const |
linePattern & | copy (const linePattern &other) |
linePattern & | operator= (const linePattern &other) |
virtual object * | clone () const |
virtual void | clear () |
virtual bool | write (ioHandler &handler, const bool complete=true) const |
virtual bool | read (ioHandler &handler, const bool complete=true) |
Static Public Member Functions | |
static linePattern * | createDashed (int d) |
Line pattern class.
A line pattern is simply an array of T, encoding "on" and "off", and an offset, which determines the start. Example:
int p1[4]={2,3,1,2}; ivector p(4,p1); int offset=0; linePattern<int> pat(p,offset);
Then applying this pattern to a line drawing will result in the following line:
** * ** * ** * ** ...
lti::linePattern::linePattern | ( | ) |
Default constructor.
Creates a pattern for a continous line.
lti::linePattern::linePattern | ( | const ivector & | d, | |
int | o | |||
) |
Constructor.
Constructs a line pattern with the given dash intervals and the given offset.
d | vector containing the dash definition | |
o | the dash offset |
lti::linePattern::linePattern | ( | const linePattern & | o | ) |
Copy constructor.
virtual lti::linePattern::~linePattern | ( | ) | [virtual] |
Destructor.
virtual void lti::linePattern::clear | ( | ) | [virtual] |
Resets this pattern to its default state.
Implements lti::graphicsPattern.
virtual object* lti::linePattern::clone | ( | ) | const [virtual] |
create a clone of this pointList
Implements lti::graphicsPattern.
linePattern& lti::linePattern::copy | ( | const linePattern & | other | ) |
assigment operator.
copy the contents of other
in this object.
other | the source pointList to be copied. |
Reimplemented from lti::graphicsPattern.
Referenced by operator=().
static linePattern* lti::linePattern::createDashed | ( | int | d | ) | [static] |
This method returns a line pattern suitable for dashed lines.
d | the width of the intervals. |
virtual rectangle lti::linePattern::getBoundingBox | ( | ) | const [virtual] |
Returns the bounding box of this pattern.
This is not really useful except that the returned rectangle's width gives the length of one pattern.
Implements lti::graphicsPattern.
void lti::linePattern::getDash | ( | ivector & | d, | |
int & | o | |||
) | const [inline] |
Vector-oriented draw functors can use this method to obtain the dash definition.
d | here the dash definition is returned | |
o | will receive the offset of the pattern |
bool lti::linePattern::isSet | ( | int | i | ) | const [inline] |
This is the main application function for pixel-base draw functors.
The method should be called with an argument denoting the number of pixel that is supposed to be drawn. The method then returns true if the pixel is permitted by the pattern, or not.
i | the index of the pixel to be drawn. |
References lti::genericVector< T >::at().
linePattern& lti::linePattern::operator= | ( | const linePattern & | other | ) | [inline] |
assigment operator (alias for copy(other)).
other | the pointList to be copied |
Reimplemented from lti::graphicsPattern.
References copy().
virtual bool lti::linePattern::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
read the pattern from the given ioHandler
Reimplemented from lti::graphicsPattern.
virtual bool lti::linePattern::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
write the pattern to the given ioHandler
Reimplemented from lti::graphicsPattern.