Loading...
Searching...
No Matches
OBPainter Class Referenceabstract

`#include <openbabel/depict/painter.h>`

Inheritance diagram for OBPainter:
[legend]

## Public Member Functions

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

## Detailed Description

Abstract painter base class used by OBDepict.

Since
  version 2.3

## Constructor & Destructor Documentation

## ~OBPainter()

virtual ~OBPainter | ( |  | ) |

inline virtual

Virtual destructor to be inhereted by subclasses

## Member Function Documentation

## NewCanvas()

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

pure 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.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## IsGood()

virtual bool IsGood | ( |  | ) | const

pure 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.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## SetFontFamily()

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

pure virtual

Set the painter's font family.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## SetFontSize()

virtual void SetFontSize | ( | int | pointSize | ) |

pure virtual

Set the painter's font point size.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## SetFillColor()

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

pure virtual

Set the painter's fill color.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## SetFillRadial()

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

pure virtual

Set the painter's fill as a radial gradient.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## SetPenColor()

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

pure virtual

Set the painter's pen color.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## SetPenWidth()

virtual void SetPenWidth | ( | double | width | ) |

pure virtual

Set the painter's pen width.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

Referenced by OBDepict::SetPenWidth().

## GetPenWidth()

virtual double GetPenWidth | ( |  | ) |

pure virtual

Get the painter's pen width.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## DrawLine()

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

pure virtual

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

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## DrawCircle()

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

pure virtual

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## DrawPolygon()

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

pure 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.

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## DrawBall()

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

pure virtual

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

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## DrawText()

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

pure virtual

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

## GetFontMetrics()

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

pure virtual

Implemented in ASCIIPainter, CairoPainter, and CommandPainter.

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

- painter.h