tbx  0.7.3
Public Member Functions | Friends | List of all members
tbx::DrawDashPattern Class Reference

Class to represent a dash pattern for lines. More...

#include <drawpath.h>

Public Member Functions

 DrawDashPattern (int start, int *dashes, int count)
 Construct a dash pattern from an array of dashes. More...
 
 DrawDashPattern (int start, int dash=1, int count=2)
 Construct a dash pattern initialised to equal sized dashes. More...
 
void start (int value)
 Set the distance into the dash pattern of start. More...
 
int start () const
 Get the distance into the dash pattern of start. More...
 
int count () const
 Get the number of elements in the dash pattern.
 
int & operator[] (int index)
 Get reference to a dash element. More...
 
int operator[] (int index) const
 Get value of a dash element. More...
 

Friends

class DrawPath
 

Detailed Description

Class to represent a dash pattern for lines.

Each element specifies a distance to draw in the present state. The pattern starts with the draw on, and alternates off and on for each successive element. If it reaches the end of the pattern while drawing the line, then it will restart at the beginning.

If the number of elements is odd, then the elements will alternate on or off with each pass through the pattern: so the first element will be on the first pass, off the second pass, on the third pass, and so on.

Constructor & Destructor Documentation

tbx::DrawDashPattern::DrawDashPattern ( int  start,
int *  dashes,
int  count 
)
inline

Construct a dash pattern from an array of dashes.

Parameters
startdistance into dash pattern to start in user coordinates
dashesarray of integers specify the length of each on/off.
countnumber of elements in the dash pattern
tbx::DrawDashPattern::DrawDashPattern ( int  start,
int  dash = 1,
int  count = 2 
)
inline

Construct a dash pattern initialised to equal sized dashes.

Parameters
startdistance into dash pattern to start in user coordinates
dashinteger specifying the length of each on/off. Default 1.
countnumber of elements in the dash pattern. Default 2.

Member Function Documentation

int& tbx::DrawDashPattern::operator[] ( int  index)
inline

Get reference to a dash element.

Parameters
index0 based index of dash element
Returns
reference to a dash element
int tbx::DrawDashPattern::operator[] ( int  index) const
inline

Get value of a dash element.

Parameters
index0 based index of dash element
Returns
dash element size
void tbx::DrawDashPattern::start ( int  value)
inline

Set the distance into the dash pattern of start.

Parameters
valuedistance into the dash pattern of the start in user units
int tbx::DrawDashPattern::start ( ) const
inline

Get the distance into the dash pattern of start.

Returns
distance into the dash pattern of the start in user units

The documentation for this class was generated from the following file: