Rose
Public Types | Public Member Functions | Protected Attributes | List of all members
rose::AntiAliasedDrawing Class Reference
Collaboration diagram for rose::AntiAliasedDrawing:
Collaboration graph
[legend]

Public Types

enum  DrawingType { SimpleLine, AntiAliased }
 The drawing style used by the drawing engine. More...
 

Public Member Functions

 AntiAliasedDrawing (gm::Context &context, DrawingType drawingType)
 Create an anti-aliased drawing context with a given width and colour. More...
 
void setWidthColor (gm::Context &context, int width, color::RGBA rgba, Size &widgetSize)
 Set the width and colour of a line to be drawn. More...
 
void setColor (gm::Context &context, color::RGBA rgba, Size &widgetSize)
 Set the colour of the line to be drawn. More...
 
void drawLine (gm::Context &context, Position< float > p0, Position< float > p1, int interiorWidth=0)
 Implement a modified Xiaolin Wu anti aliasing algorithm. More...
 
template<typename T >
bool renderLine (gm::Context &context, Position< T > p0, Position< T > p1)
 Draw an anti-aliased line. More...
 

Protected Attributes

DrawingType mDrawingType {SimpleLine}
 
color::RGBA mColor {color::RGBA::OpaqueBlack}
 
int mWidth {1}
 
gm::Texture mTexture {}
 
Size mWidgetSize {}
 

Member Enumeration Documentation

◆ DrawingType

The drawing style used by the drawing engine.

Enumerator
SimpleLine 

Simple lines, no anti-aliasing.

AntiAliased 

Modified Wu's algorithm anti-aliaseing.

Constructor & Destructor Documentation

◆ AntiAliasedDrawing()

rose::AntiAliasedDrawing::AntiAliasedDrawing ( gm::Context context,
DrawingType  drawingType 
)

Create an anti-aliased drawing context with a given width and colour.

Parameters
contextThe graphics context to use.
widthThe width of the line in pixels.
rgbaThe line colour RGBA.

Member Function Documentation

◆ drawLine()

void rose::AntiAliasedDrawing::drawLine ( gm::Context context,
Position< float >  p0,
Position< float >  p1,
int  interiorWidth = 0 
)

Implement a modified Xiaolin Wu anti aliasing algorithm.

Implements the Xiaolin Wu anti aliased line algorithm but inserts interiorWidth stuffing pixels between the two controlled brightness pixes. When interiorWidth is 0 the normal Wu algorithm is used.

Parameters
contextThe Graphics Context used to draw.
p0The starting point for the line.
p1The ending point for the line.
interiorWidthStuffing width of the line.

◆ renderLine()

template<typename T >
bool rose::AntiAliasedDrawing::renderLine ( gm::Context context,
Position< T >  p0,
Position< T >  p1 
)
inline

Draw an anti-aliased line.

Parameters
contextThe graphics context to use.
p0The start point.
p1The end point.
Returns
True if the rendering operation returned success.

◆ setColor()

void rose::AntiAliasedDrawing::setColor ( gm::Context context,
color::RGBA  rgba,
Size widgetSize 
)
inline

Set the colour of the line to be drawn.

Parameters
contextThe graphics context to use.
rgbaThe line colour RGBA.

◆ setWidthColor()

void rose::AntiAliasedDrawing::setWidthColor ( gm::Context context,
int  width,
color::RGBA  rgba,
Size widgetSize 
)

Set the width and colour of a line to be drawn.

Parameters
contextThe graphics context to use.
widthThe width of the line in pixels.
rgbaThe line colour RGBA.

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