bpp-core3  3.0.0
GraphicDevice.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_GRAPHICS_GRAPHICDEVICE_H
6 #define BPP_GRAPHICS_GRAPHICDEVICE_H
7 
8 
9 #include "Font/Font.h"
10 #include "RgbColor.h"
11 
12 namespace bpp
13 {
14 class UnvalidFlagException : public virtual Exception
15 {
16 public:
17  UnvalidFlagException(const std::string& text) : Exception(text) {}
18 };
19 
20 
27 {
28 public:
30  virtual ~GraphicDevice() {}
31 
32 public:
36  virtual void begin() = 0;
37 
45  virtual void end() = 0;
46 
50  virtual void setXUnit(double xu) = 0;
51 
55  virtual void setYUnit(double yu) = 0;
56 
60  virtual double getXUnit() const = 0;
61 
65  virtual double getYUnit() const = 0;
66 
67  virtual void setCurrentForegroundColor(const RGBColor& color) = 0;
68  virtual void setCurrentBackgroundColor(const RGBColor& color) = 0;
69  virtual void setCurrentFont(const Font& font) = 0;
70  virtual void setCurrentPointSize(unsigned int size) = 0;
71  virtual void setCurrentLineType(short type) = 0;
72  virtual void setCurrentLayer(int layerIndex) = 0;
73 
74  virtual const RGBColor& getCurrentForegroundColor() const = 0;
75  virtual const RGBColor& getCurrentBackgroundColor() const = 0;
76  virtual const Font& getCurrentFont() const = 0;
77  virtual unsigned int getCurrentPointSize() const = 0;
78  virtual short getCurrentLineType() const = 0;
79  virtual int getCurrentLayer() const = 0;
80 
81 
92  virtual void drawLine(double x1, double y1, double x2, double y2) = 0;
93 
106  virtual void drawRect(double x, double y, double width, double height, short fill = FILL_EMPTY) = 0;
107 
119  virtual void drawCircle(double x, double y, double radius, short fill = FILL_EMPTY) = 0;
120 
133  virtual void drawText(double x, double y, const std::string& text, short hpos = TEXT_HORIZONTAL_LEFT, short vpos = TEXT_VERTICAL_BOTTOM, double angle = 0) = 0;
134 
140  virtual void comment(const std::string& comment) = 0;
141 
142 public:
144  static short TEXT_HORIZONTAL_LEFT;
145  static short TEXT_HORIZONTAL_RIGHT;
146  static short TEXT_VERTICAL_CENTER;
147  static short TEXT_VERTICAL_BOTTOM;
148  static short TEXT_VERTICAL_TOP;
149 
150  static short FILL_EMPTY;
151  static short FILL_FILLED;
152  static short FILL_PATTERN;
153 
154  static short LINE_SOLID;
155  static short LINE_DASHED;
156  static short LINE_DOTTED;
157 };
158 } // end of namespace bpp.
159 #endif // BPP_GRAPHICS_GRAPHICDEVICE_H
Data structure for fonts.
Definition: Font.h:21
static short TEXT_VERTICAL_TOP
static short LINE_SOLID
Describe a color according to its red, green and blue componants.
Definition: RgbColor.h:21
static short LINE_DOTTED
static short TEXT_HORIZONTAL_RIGHT
static short FILL_PATTERN
UnvalidFlagException(const std::string &text)
Definition: GraphicDevice.h:17
Interface for all plotting devices.
Definition: GraphicDevice.h:26
static short LINE_DASHED
static short FILL_EMPTY
static short TEXT_HORIZONTAL_CENTER
static short FILL_FILLED
virtual ~GraphicDevice()
Definition: GraphicDevice.h:30
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
Definition: Exceptions.h:20
static short TEXT_VERTICAL_BOTTOM
static short TEXT_VERTICAL_CENTER
static short TEXT_HORIZONTAL_LEFT