Open Babel: svgpainter.h Source File

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# svgpainter.h

Go to the documentation of this file.

    00001 /**********************************************************************
    00002 svgpainter.h - Rendering in SVG
    00003
    00004 Copyright (C) 2009 by Chris Morley
    00005
    00006 This file is part of the Open Babel project.
    00007 For more information, see <http://openbabel.org/>
    00008
    00009 This program is free software; you can redistribute it and/or modify
    00010 it under the terms of the GNU General Public License as published by
    00011 the Free Software Foundation version 2 of the License.
    00012
    00013 This program is distributed in the hope that it will be useful,
    00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
    00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00016 GNU General Public License for more details.
    00017 ***********************************************************************/
    00018 #ifndef OB_SVGPAINTER_H
    00019 #define OB_SVGPAINTER_H
    00020
    00021 #include <openbabel/babelconfig.h>
    00022 #include <iostream>
    00023 #include <openbabel/depict/painter.h>
    00024
    00025 namespace OpenBabel
    00026 {
    00027   class OBDEPICT SVGPainter : public OBPainter
    00028   {
    00029     public:
    00030       SVGPainter();
    00031       SVGPainter(std::ostream& ofs, bool withViewBox=false,
    00032         double width=0.0, double height=0.0, double x=0.0, double y=0.0);
    00033       ~SVGPainter();
    00035
    00036       void NewCanvas(double width, double height);
    00037       bool IsGood() const;
    00038       void SetFontFamily(const std::string &fontFamily);
    00039       void SetFontSize(int pointSize);
    00040       void SetFillColor(const OBColor &color);
    00041       void SetPenColor(const OBColor &color);
    00042       void SetPenWidth(double width);
    00043       void DrawLine(double x1, double y1, double x2, double y2);
    00044       void DrawPolygon(const std::vector<std::pair<double,double> > &points);
    00045       void DrawCircle(double x, double y, double r);
    00046       void DrawText(double x, double y, const std::string &text);
    00047       OBFontMetrics GetFontMetrics(const std::string &text);
    00049
    00051
    00052       void WriteImage(const std::string &filename);
    00054     private:
    00055       std::string MakeRGB(OBColor color);
    00056
    00057     private:
    00058       std::ostream& m_ofs;
    00059       bool m_withViewBox;
    00060       double m_width, m_height, m_x, m_y;
    00061       OBColor m_Pencolor;
    00062       OBColor m_OrigBondcolor;
    00063       OBColor m_Fillcolor;
    00064       double m_PenWidth;
    00065       int m_fontPointSize;
    00066       std::string m_fontFamily;
    00067   };
    00068
    00069 }
    00070
    00071 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

This file is part of the documentation for Open Babel, version 2.3.

Documentation copyright © 1998-2007, the Open Babel Developers.
Open Babel is hosted by:
Generated on Fri Oct 22 2010 14:36:02 by 1.7.2.