Loading...
Searching...
No Matches
cairopainter.h
Go to the documentation of this file.
#ifndef OB_CAIROPAINTER_H
#define OB_CAIROPAINTER_H
#include <openbabel/depict/painter.h>
#include "cairo.h"
namespace OpenBabel
{
class CairoPainter : public OBPainter
{
public:
CairoPainter();
~CairoPainter();
void NewCanvas(double width, double height);
bool IsGood() const;
void SetFontFamily(const std::string &fontFamily) {} // FIXME
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);
void DrawText(double x, double y, const std::string &text);
OBFontMetrics GetFontMetrics(const std::string &text);
void WriteImage(const std::string &filename);
void WriteImage(std::ostream& ofs);
void SetWidth(int width) {m_width=width;}
void SetHeight(int height) {m_height=height;}
void SetTitle(std::string title) {m_title=title;}
void SetIndex(int index) {m_index=index;}
void SetTableSize(int nrows, int ncols) {m_nrows=nrows; m_ncols=ncols;}
void SetBackground(std::string color) {m_fillcolor=color;}
void SetBondColor(std::string color) {m_bondcolor=color;}
void SetTransparent(bool tr) {m_transparent=tr;}
void SetCropping(bool cr) {m_cropping=cr;}
private:
cairo_surface_t *m_surface;
cairo_t *m_cairo;
int m_fontPointSize;
int m_width;
int m_height;
double m_pen_width;
std::string m_title;
int m_index; // Index of current molecule in a table
int m_ncols, m_nrows; // number of rows and columns
std::string m_fillcolor, m_bondcolor;
bool m_transparent, m_cropping;
};
}
#endif
OpenBabel::CairoPainter::SetBondColor
void SetBondColor(std::string color)
Definition cairopainter.h:43
OpenBabel::CairoPainter::SetHeight
void SetHeight(int height)
Definition cairopainter.h:38
OpenBabel::CairoPainter::IsGood
bool IsGood() const
Definition cairopainter.cpp:82
OpenBabel::CairoPainter::GetPenWidth
double GetPenWidth()
Definition cairopainter.cpp:117
OpenBabel::CairoPainter::GetFontMetrics
OBFontMetrics GetFontMetrics(const std::string &text)
Definition cairopainter.cpp:154
OpenBabel::CairoPainter::DrawBall
void DrawBall(double x, double y, double r, double opacity)
Definition cairopainter.cpp:186
OpenBabel::CairoPainter::WriteImage
void WriteImage(const std::string &filename)
Definition cairopainter.cpp:170
OpenBabel::CairoPainter::SetTableSize
void SetTableSize(int nrows, int ncols)
Definition cairopainter.h:41
OpenBabel::CairoPainter::SetFillRadial
void SetFillRadial(const OBColor &start, const OBColor &end)
Definition cairopainter.cpp:102
OpenBabel::CairoPainter::SetPenWidth
void SetPenWidth(double width)
Definition cairopainter.cpp:112
OpenBabel::CairoPainter::NewCanvas
void NewCanvas(double width, double height)
Definition cairopainter.cpp:25
OpenBabel::CairoPainter::SetFontSize
void SetFontSize(int pointSize)
Definition cairopainter.cpp:91
OpenBabel::CairoPainter::DrawText
void DrawText(double x, double y, const std::string &text)
Definition cairopainter.cpp:148
OpenBabel::CairoPainter::SetWidth
void SetWidth(int width)
Definition cairopainter.h:37
OpenBabel::CairoPainter::SetFontFamily
void SetFontFamily(const std::string &fontFamily)
Definition cairopainter.h:18
OpenBabel::CairoPainter::SetTitle
void SetTitle(std::string title)
Definition cairopainter.h:39
OpenBabel::CairoPainter::SetFillColor
void SetFillColor(const OBColor &color)
Definition cairopainter.cpp:97
OpenBabel::CairoPainter::SetBackground
void SetBackground(std::string color)
Definition cairopainter.h:42
OpenBabel::CairoPainter::SetPenColor
void SetPenColor(const OBColor &color)
Definition cairopainter.cpp:107
OpenBabel::CairoPainter::CairoPainter
CairoPainter()
Definition cairopainter.cpp:11
OpenBabel::CairoPainter::~CairoPainter
~CairoPainter()
Definition cairopainter.cpp:17
OpenBabel::CairoPainter::SetIndex
void SetIndex(int index)
Definition cairopainter.h:40
OpenBabel::CairoPainter::DrawLine
void DrawLine(double x1, double y1, double x2, double y2, const std::vector< double > &dashes=std::vector< double >())
Definition cairopainter.cpp:122
OpenBabel::CairoPainter::DrawPolygon
void DrawPolygon(const std::vector< std::pair< double, double > > &points)
Definition cairopainter.cpp:132
OpenBabel::CairoPainter::SetCropping
void SetCropping(bool cr)
Definition cairopainter.h:45
OpenBabel::CairoPainter::DrawCircle
void DrawCircle(double x, double y, double r)
Definition cairopainter.cpp:142
OpenBabel::CairoPainter::SetTransparent
void SetTransparent(bool tr)
Definition cairopainter.h:44
OpenBabel::OBPainter
Abstract painter base class used by OBDepict.
Definition painter.h:129
OpenBabel
Global namespace for all Open Babel code.
Definition alias.h:23
painter.h
Base class for graphical 2D depiction classes (e.g., "paint" to SVG).
OpenBabel::OBColor
Color class used by OBDepict.
Definition painter.h:38
OpenBabel::OBFontMetrics
Font metrics class used by OBDepict.
Definition painter.h:117