Go to the documentation of this file.00001 #ifndef OB_CAIROPAINTER_H
00002 #define OB_CAIROPAINTER_H
00003
00004 #include <openbabel/depict/painter.h>
00005 #include <cairo.h>
00006
00007 namespace OpenBabel
00008 {
00009 class CairoPainter : public OBPainter
00010 {
00011 public:
00012 CairoPainter();
00013 ~CairoPainter();
00015
00016 void NewCanvas(double width, double height);
00017 bool IsGood() const;
00018 void SetFontFamily(const std::string &fontFamily) {}
00019 void SetFontSize(int pointSize);
00020 void SetFillColor(const OBColor &color);
00021 void SetPenColor(const OBColor &color);
00022 void SetPenWidth(double width);
00023 void DrawLine(double x1, double y1, double x2, double y2);
00024 void DrawPolygon(const std::vector<std::pair<double,double> > &points);
00025 void DrawCircle(double x, double y, double r);
00026 void DrawText(double x, double y, const std::string &text);
00027 OBFontMetrics GetFontMetrics(const std::string &text);
00029
00031
00032 void WriteImage(const std::string &filename);
00033 void WriteImage(std::ostream& ofs, int newWidth=300, int newHeight=300);
00035
00036 private:
00037 cairo_surface_t *m_surface;
00038 cairo_t *m_cairo;
00039 int m_fontPointSize;
00040 };
00041
00042 }
00043
00044 #endif