tbx  0.7.5
Public Types | Public Member Functions | Friends | List of all members
tbx::DrawCapAndJoin Class Reference

Class to set the cap and joins style for lines that are greater than a single pixel wide. More...

#include <drawpath.h>

Public Types

enum  JoinStyle { MITRED_JOINS, ROUND_JOINS, BEVELLED_JOINS }
 
enum  CapStyle { BUTT_CAPS, ROUND_CAPS, SQUARE_CAPS, TRIANGULAR_CAPS }
 

Public Member Functions

 DrawCapAndJoin ()
 Construct with ROUND_JOINS and ROUND_CAPS at both ends.
 
void join (JoinStyle style)
 Set the join style. More...
 
JoinStyle join () const
 Get the join style. More...
 
void mitre_limit (const Fixed16 &limit)
 Sets the mitre limit. More...
 
int mitre_limit () const
 Get the mitre limit. More...
 
void leading_cap (CapStyle cap_style)
 Set the leading cap style. More...
 
CapStyle leading_cap () const
 Get the leading cap style. More...
 
void trailing_cap (CapStyle cap_style)
 Set the trailing cap style. More...
 
CapStyle trailing_cap () const
 Get the trailing cap style. More...
 
void leading_cap_width (short width)
 Leading triangular cap width on each side. More...
 
short leading_cap_width () const
 Get the leading cap width. More...
 
void leading_cap_length (short length)
 Leading triangular cap length away from the line. More...
 
short leading_cap_length () const
 Get the leading cap length. More...
 
void trailing_cap_width (short width)
 Trailing triangular cap width on each side. More...
 
short trailing_cap_width () const
 Get the trailing cap width. More...
 
void trailing_cap_length (short length)
 Trailing triangular cap length away from the line. More...
 
short trailing_cap_length () const
 Get the trailing cap length. More...
 

Friends

class DrawPath
 

Detailed Description

Class to set the cap and joins style for lines that are greater than a single pixel wide.

Member Function Documentation

◆ join() [1/2]

void tbx::DrawCapAndJoin::join ( JoinStyle  style)
inline

Set the join style.

If the style is set to MITRED_JOINS the mitre must be set as well.

Parameters
stylethe new join style

◆ join() [2/2]

JoinStyle tbx::DrawCapAndJoin::join ( ) const
inline

Get the join style.

Returns
the join style

◆ leading_cap() [1/2]

void tbx::DrawCapAndJoin::leading_cap ( CapStyle  cap_style)
inline

Set the leading cap style.

If TRIANGULAR_CAPS is set, the leading cap width and length should also be set.

Parameters
cap_stylenew leading cap style

◆ leading_cap() [2/2]

CapStyle tbx::DrawCapAndJoin::leading_cap ( ) const
inline

Get the leading cap style.

Returns
CapStyle with leading cap style

◆ leading_cap_length() [1/2]

void tbx::DrawCapAndJoin::leading_cap_length ( short  length)
inline

Leading triangular cap length away from the line.

Set this if the leading cap style is TRIANGULAR_CAPS

Parameters
lengthcap length (in 256ths of line widths, so 0x100 is 1 linewidth)

◆ leading_cap_length() [2/2]

short tbx::DrawCapAndJoin::leading_cap_length ( ) const
inline

Get the leading cap length.

Returns
the leading caps length in 256ths of a line width

◆ leading_cap_width() [1/2]

void tbx::DrawCapAndJoin::leading_cap_width ( short  width)
inline

Leading triangular cap width on each side.

Set this if the leading cap style is TRIANGULAR_CAPS

Parameters
widthcap width (in 256ths of line widths, so 0x100 is 1 linewidth)

◆ leading_cap_width() [2/2]

short tbx::DrawCapAndJoin::leading_cap_width ( ) const
inline

Get the leading cap width.

Returns
the leading caps width in 256ths of a line width

◆ mitre_limit() [1/2]

void tbx::DrawCapAndJoin::mitre_limit ( const Fixed16 limit)
inline

Sets the mitre limit.

The mitre limit must be set if the join style is set to MITRED_JOINS.

At any given corner, the mitre length is the distance from the point at which the inner edges of the stroke meet, to the point where the outer edges of the stroke meet. This distance increases as the angle between the lines decreases. If the ratio of the mitre length to the line width exceeds the mitre limit, stroke treats the corner with a bevel join instead of a mitre join.

Parameters
limitnew mitre limit

◆ mitre_limit() [2/2]

int tbx::DrawCapAndJoin::mitre_limit ( ) const
inline

Get the mitre limit.

Returns
mitre limit

◆ trailing_cap() [1/2]

void tbx::DrawCapAndJoin::trailing_cap ( CapStyle  cap_style)
inline

Set the trailing cap style.

If TRIANGULAR_CAPS is set, the trailing cap width and length should also be set.

Parameters
cap_stylenew trailing cap style

◆ trailing_cap() [2/2]

CapStyle tbx::DrawCapAndJoin::trailing_cap ( ) const
inline

Get the trailing cap style.

Returns
CapStyle with trailing cap style

◆ trailing_cap_length() [1/2]

void tbx::DrawCapAndJoin::trailing_cap_length ( short  length)
inline

Trailing triangular cap length away from the line.

Set this if the trailing cap style is TRIANGULAR_CAPS

Parameters
lengthcap length (in 256ths of line widths, so 0x100 is 1 linewidth)

◆ trailing_cap_length() [2/2]

short tbx::DrawCapAndJoin::trailing_cap_length ( ) const
inline

Get the trailing cap length.

Returns
the trailing caps length in 256ths of a line width

◆ trailing_cap_width() [1/2]

void tbx::DrawCapAndJoin::trailing_cap_width ( short  width)
inline

Trailing triangular cap width on each side.

Set this if the trailing cap style is TRIANGULAR_CAPS

Parameters
widthcap width (in 256ths of line widths, so 0x100 is 1 linewidth)

◆ trailing_cap_width() [2/2]

short tbx::DrawCapAndJoin::trailing_cap_width ( ) const
inline

Get the trailing cap width.

Returns
the trailing caps width in 256ths of a line width

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