Loading...
Searching...
No Matches
CommandPainter Class Reference

`#include <commandpainter.h>`

Inheritance diagram for CommandPainter:
[legend]

## Public Member Functions

| CommandPainter (std::ostream &ofs)
| ~CommandPainter ()
OBPainter methods
void | NewCanvas (double width, double height)
bool | IsGood () const
void | SetFontFamily (const std::string &fontFamily)
void | SetFontSize (int pointSize)
void | SetFillColor (const OBColor &color)
void | SetFillRadial (const OBColor &start, const OBColor &end)
void | SetPenColor (const OBColor &color)
void | SetPenWidth (double width)
double | GetPenWidth ()
void | DrawLine (double x1, double y1, double x2, double y2, const std::vector< double > &dashes=std::vector< double >())
void | DrawPolygon (const std::vector< std::pair< double, double > > &points)
void | DrawCircle (double x, double y, double r)
void | DrawBall (double x, double y, double r, double opacity=1.0)
void | DrawText (double x, double y, const std::string &text)
OBFontMetrics | GetFontMetrics (const std::string &text)

## Constructor & Destructor Documentation

## CommandPainter()

CommandPainter | ( | std::ostream & | ofs | ) |

## ~CommandPainter()

~CommandPainter | ( |  | ) |

## Member Function Documentation

## NewCanvas()

void NewCanvas | ( | double | width,
|  | double | height )

virtual

Create a new canvas to paint on with size `width` x `height`. OBDepict will always call NewCanvas before performing any drawing operations. Painters that are capable of drawing on a previously unspecified area don't need to implement this.

Implements OBPainter.

## IsGood()

bool IsGood | ( |  | ) | const

virtual

Before OBDepict performes any drawing operation, this method is called to check if the painter is ready to start drawing. If this method returns false, drawing is aborted.

Implements OBPainter.

## SetFontFamily()

void SetFontFamily | ( | const std::string & | fontFamily | ) |

inline virtual

Set the painter's font family.

Implements OBPainter.

## SetFontSize()

void SetFontSize | ( | int | pointSize | ) |

virtual

Set the painter's font point size.

Implements OBPainter.

## SetFillColor()

void SetFillColor | ( | const OBColor & | color | ) |

virtual

Set the painter's fill color.

Implements OBPainter.

## SetFillRadial()

void SetFillRadial | ( | const OBColor & | start,
|  | const OBColor & | end )

virtual

Set the painter's fill as a radial gradient.

Implements OBPainter.

## SetPenColor()

void SetPenColor | ( | const OBColor & | color | ) |

virtual

Set the painter's pen color.

Implements OBPainter.

## SetPenWidth()

void SetPenWidth | ( | double | width | ) |

virtual

Set the painter's pen width.

Implements OBPainter.

## GetPenWidth()

double GetPenWidth | ( |  | ) |

virtual

Get the painter's pen width.

Implements OBPainter.

## DrawLine()

void DrawLine | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2,
|  | const std::vector< double > & | dashes = std::vector< double >() )

virtual

Draw a line from `x1`, `y1` to `x2`, `y2`. The line is drawn using the current pen color and width.

Implements OBPainter.

## DrawPolygon()

void DrawPolygon | ( | const std::vector< std::pair< double, double > > & | points | ) |

virtual

Draw a polygon by connecting consecutive points. The last point will be connected to the first one. The lines are drawn using the current pen color and width. The area inside the polygon is filled with the current fill color.

Implements OBPainter.

## DrawCircle()

void DrawCircle | ( | double | x,
|  | double | y,
|  | double | r )

virtual

Implements OBPainter.

## DrawBall()

void DrawBall | ( | double | x,
|  | double | y,
|  | double | r,
|  | double | opacity = 1.0 )

virtual

Draw a pseudo 3D ball, centered on (`x`,`y`) of radius `r` filled with the current Fill color or gradient

Implements OBPainter.

## DrawText()

void DrawText | ( | double | x,
|  | double | y,
|  | const std::string & | text )

virtual

Implements OBPainter.

## GetFontMetrics()

OBFontMetrics GetFontMetrics | ( | const std::string & | text | ) |

virtual

Implements OBPainter.

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

- commandpainter.h
- commandpainter.cpp