bpp-core  2.1.0
GraphicDevice.h
Go to the documentation of this file.
00001 //
00002 // File: GraphicDevice.h
00003 // Created by: Julien Dutheil
00004 // Created on: Mon Mar 03 2008
00005 //
00006 
00007 /*
00008 Copyright or © or Copr. Bio++ Development Team, (November 16, 2006)
00009 
00010 This software is a computer program whose purpose is to provide utilitary
00011 classes. This file belongs to the Bio++ Project.
00012 
00013 This software is governed by the CeCILL  license under French law and
00014 abiding by the rules of distribution of free software.  You can  use, 
00015 modify and/ or redistribute the software under the terms of the CeCILL
00016 license as circulated by CEA, CNRS and INRIA at the following URL
00017 "http://www.cecill.info". 
00018 
00019 As a counterpart to the access to the source code and  rights to copy,
00020 modify and redistribute granted by the license, users are provided only
00021 with a limited warranty  and the software's author,  the holder of the
00022 economic rights,  and the successive licensors  have only  limited
00023 liability. 
00024 
00025 In this respect, the user's attention is drawn to the risks associated
00026 with loading,  using,  modifying and/or developing or reproducing the
00027 software by the user in light of its specific status of free software,
00028 that may mean  that it is complicated to manipulate,  and  that  also
00029 therefore means  that it is reserved for developers  and  experienced
00030 professionals having in-depth computer knowledge. Users are therefore
00031 encouraged to load and test the software's suitability as regards their
00032 requirements in conditions enabling the security of their systems and/or 
00033 data to be ensured and,  more generally, to use and operate it in the 
00034 same conditions as regards security. 
00035 
00036 The fact that you are presently reading this means that you have had
00037 knowledge of the CeCILL license and that you accept its terms.
00038 */
00039 
00040 #ifndef _GRAPHICDEVICE_H_
00041 #define _GRAPHICDEVICE_H_
00042 
00043 #include "RgbColor.h"
00044 #include "Font/Font.h"
00045 
00046 namespace bpp
00047 {
00048 
00049   class UnvalidFlagException: public virtual Exception
00050   {
00051     public:
00052       UnvalidFlagException(const std::string& message): Exception(message) {}
00053   };
00054 
00055 
00056 
00062   class GraphicDevice
00063   {
00064     public:
00065       GraphicDevice() {}
00066       virtual ~GraphicDevice() {}
00067 
00068     public:
00072       virtual void begin() = 0;
00073 
00081       virtual void end() = 0;
00082 
00086       virtual void setXUnit(double xu) = 0;
00087 
00091       virtual void setYUnit(double yu) = 0;
00092 
00096       virtual double getXUnit() const = 0;
00097 
00101       virtual double getYUnit() const = 0;
00102 
00103       virtual void setCurrentForegroundColor(const RGBColor& color) = 0;
00104       virtual void setCurrentBackgroundColor(const RGBColor& color) = 0;
00105       virtual void setCurrentFont(const Font& font) = 0;
00106       virtual void setCurrentPointSize(unsigned int size) = 0;
00107       virtual void setCurrentLineType(short type) = 0;
00108       virtual void setCurrentLayer(int layerIndex) = 0;
00109 
00110       virtual const RGBColor& getCurrentForegroundColor() const = 0;
00111       virtual const RGBColor& getCurrentBackgroundColor() const = 0;
00112       virtual const Font& getCurrentFont() const = 0;
00113       virtual unsigned int getCurrentPointSize() const = 0;
00114       virtual short getCurrentLineType() const = 0;
00115       virtual int getCurrentLayer() const = 0;
00116 
00117 
00128       virtual void drawLine(double x1, double y1, double x2, double y2) = 0;
00129 
00142       virtual void drawRect(double x, double y, double width, double height, short fill = FILL_EMPTY) = 0;
00143 
00155       virtual void drawCircle(double x, double y, double radius, short fill = FILL_EMPTY) = 0;
00156 
00169       virtual void drawText(double x, double y, const std::string& text, short hpos = TEXT_HORIZONTAL_LEFT, short vpos = TEXT_VERTICAL_BOTTOM, double angle = 0) throw (UnvalidFlagException) = 0;
00170 
00176       virtual void comment(const std::string & comment) = 0;
00177 
00178     public:
00179       static short TEXT_HORIZONTAL_CENTER;
00180       static short TEXT_HORIZONTAL_LEFT;
00181       static short TEXT_HORIZONTAL_RIGHT;
00182       static short TEXT_VERTICAL_CENTER;
00183       static short TEXT_VERTICAL_BOTTOM;
00184       static short TEXT_VERTICAL_TOP;
00185 
00186       static short FILL_EMPTY;
00187       static short FILL_FILLED;
00188       static short FILL_PATTERN;
00189 
00190       static short LINE_SOLID;
00191       static short LINE_DASHED;
00192       static short LINE_DOTTED;
00193   };
00194 
00195 } // end of namespace bpp.
00196 
00197 #endif //_GRAPHICDEVICE_H_
00198 
00199 
 All Classes Namespaces Files Functions Variables Typedefs Friends