Image Component Library (ICL)
GLPaintEngine.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLQt/src/ICLQt/GLPaintEngine.h **
10 ** Module : ICLQt **
11 ** Authors: Christof Elbrechter, Robert Haschke **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #define NOMINMAX // needed for Win32 in order to not define min, max as macros
34 
35 #include <ICLUtils/CompatMacros.h>
36 #include <ICLQt/PaintEngine.h>
37 #include <QFont>
38 #include <QtOpenGL/QGLWidget>
39 
40 namespace icl{
41  namespace qt{
42 
44 
57  public:
58 
59  GLPaintEngine(QGLWidget *widget);
60  virtual ~GLPaintEngine();
61 
62  virtual void color(float r, float g, float b, float a=255);
63  virtual void fill(float r, float g, float b, float a=255);
64  virtual void fontsize(float size);
65  virtual void font(std::string name,
66  float size = -1,
69 
70  virtual void linewidth(float w);
71  virtual void pointsize(float s);
72 
73  virtual void line(const utils::Point32f &a, const utils::Point32f &b);
74  virtual void point(const utils::Point32f &p);
75  virtual void image(const utils::Rect32f &r,core::ImgBase *image,
78  virtual void image(const utils::Rect32f &r,const QImage &image,
81  virtual void rect(const utils::Rect32f &r);
82  virtual void triangle(const utils::Point32f &a, const utils::Point32f &b, const utils::Point32f &c);
83  virtual void quad(const utils::Point32f &a, const utils::Point32f &b, const utils::Point32f &c, const utils::Point32f &d);
84  virtual void ellipse(const utils::Rect32f &r);
85  virtual void text(const utils::Rect32f &r, const std::string text, PaintEngine::AlignMode mode = PaintEngine::Centered, float angle=0);
86 
88  virtual void bci(float brightness=0, float contrast=0, float intensity=0);
89  virtual void bciAuto();
90 
91  virtual void getColor(float *piColor);
92  virtual void getFill(float *piColor);
93 
94  virtual float getFontSize() const{
95  return m_font.pointSize();
96  }
97  virtual float getLineWidth() const {
98  return m_linewidth;
99  }
100  virtual float getPointSize() const {
101  return m_pointsize;
102  }
104  return icl::utils::Size(m_widget->width(),m_widget->height());
105  }
106 
107  // estimates the size of a given text
108  utils::Size estimateTextBounds(const std::string &text) const;
109 
110 
111  protected:
112  void setupRasterEngine(const utils::Rect32f& r, const utils::Size32f &s, PaintEngine::AlignMode mode);
113  void setPackAlignment(core::depth d, int linewidth);
114  void setupPixelTransfer(core::depth d, float brightness, float contrast, float intensity);
115 
116  QGLWidget *m_widget;
117 
118  float m_linewidth;
119  float m_pointsize;
120  float m_linecolor[4];
121  float m_fillcolor[4];
122  float m_bci[3];
123  bool m_bciauto;
124 
125  QFont m_font;
126 
127  private:
129  };
130  } // namespace qt
131 }// namespace
Definition: PaintEngine.h:53
bool m_bciauto
Definition: GLPaintEngine.h:123
Definition: PaintEngine.h:54
virtual float getLineWidth() const
Definition: GLPaintEngine.h:97
undocument this line if you encounter any issues!
Definition: Any.h:37
ICLQt_API void triangle(ImgQ &image, int x1, int y1, int x2, int y2, int x3, int y3)
draws a triangle into an image
TextWeight
Definition: PaintEngine.h:53
ICLQt_API void fontsize(int size)
sets up current fontsize (only available with Qt-Support)
float m_linewidth
Definition: GLPaintEngine.h:118
float m_pointsize
Definition: GLPaintEngine.h:119
virtual float getPointSize() const
Definition: GLPaintEngine.h:100
virtual float getFontSize() const
Definition: GLPaintEngine.h:94
ICLQt_API void text(ImgQ &image, int x, int y, const string &text)
renders a text into an image (only available with Qt-Support)
ICLQt_API void line(ImgQ &image, int x1, int y1, int x2, int y2)
draws a line into an image
virtual icl::utils::Size getSize()
Definition: GLPaintEngine.h:103
ICLQt_API void font(int size, const string &family="Arial")
sets up the current font (only available with Qt-Support)
Floating point precision implementation of the Rect class.
Definition: Rect32f.h:45
ICLQt_API void fill(float r, float g=-1, float b=-1, float alpha=255)
sets the current fill color to given r,g,b,alpha value
Size class of the ICL.
Definition: Size.h:61
Definition: PaintEngine.h:52
scalemode
for scaling of Img images theses functions are provided
Definition: Types.h:84
depth
determines the pixel type of an image (8Bit-int or 32Bit-float)
Definition: Types.h:60
Single precission 3D Vectors Point class of the ICL.
Definition: Point32f.h:41
#define ICLQt_API
Definition: CompatMacros.h:178
core::ImgBase * m_incompDepthBuf
Definition: GLPaintEngine.h:128
ICLQt_API void color(float r, float g=-1, float b=-1, float alpha=255)
sets the current color to given r,g,b,alpha value
QFont m_font
Definition: GLPaintEngine.h:125
pure virtual Paint engine interface
Definition: PaintEngine.h:49
Definition: PaintEngine.h:52
Paint engine to be used in QGLWigets for a high performance image visualization.
Definition: GLPaintEngine.h:56
Definition: Types.h:85
ICLQt_API void rect(ImgQ &image, int x, int y, int w, int h, int rounding=0)
draws a rect into an image
Size32f class of the ICL (float valued)
Definition: Size32f.h:40
TextStyle
Definition: PaintEngine.h:54
AlignMode
Definition: PaintEngine.h:52
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
QGLWidget * m_widget
Definition: GLPaintEngine.h:116