VTK
vtkOpenGLContextDevice2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLContextDevice2D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
32 #ifndef __vtkOpenGLContextDevice2D_h
33 #define __vtkOpenGLContextDevice2D_h
34 
35 #include "vtkContextDevice2D.h"
36 
37 class vtkWindow;
38 class vtkViewport;
39 class vtkRenderer;
40 class vtkStringToImage;
41 class vtkOpenGLRenderWindow;
42 class vtkOpenGLExtensionManager;
43 
45 {
46 public:
48  virtual void PrintSelf(ostream &os, vtkIndent indent);
49 
51  static vtkOpenGLContextDevice2D *New();
52 
54 
57  virtual void DrawPoly(float *f, int n, unsigned char *colors = 0,
58  int nc_comps = 0);
60 
62 
65  virtual void DrawPoints(float *points, int n, unsigned char* colors = 0,
66  int nc_comps = 0);
68 
70 
75  virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n,
76  unsigned char* colors = 0, int nc_comps = 0);
78 
80  virtual void DrawQuad(float *points, int n);
81 
83  virtual void DrawQuadStrip(float *points, int n);
84 
86  virtual void DrawPolygon(float *, int);
87 
89 
95  virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy,
96  float inRx, float inRy, float startAngle,
97  float stopAngle);
99 
101 
104  virtual void DrawEllipticArc(float x, float y, float rX, float rY,
105  float startAngle, float stopAngle);
107 
108 
110  virtual void DrawString(float *point, const vtkStdString &string);
111 
113 
118  virtual void ComputeStringBounds(const vtkStdString &string,
119  float bounds[4]);
121 
123  virtual void DrawString(float *point, const vtkUnicodeString &string);
124 
126 
131  virtual void ComputeStringBounds(const vtkUnicodeString &string,
132  float bounds[4]);
134 
137  virtual void DrawImage(float p[2], float scale, vtkImageData *image);
138 
142  void DrawImage(const vtkRectf& pos, vtkImageData *image);
143 
145  virtual void SetColor4(unsigned char color[4]);
146 
148  virtual void SetColor(unsigned char color[3]);
149 
151  virtual void SetTexture(vtkImageData* image, int properties = 0);
152 
154  virtual void SetPointSize(float size);
155 
157  virtual void SetLineWidth(float width);
158 
160  virtual void SetLineType(int type);
161 
163  virtual void MultiplyMatrix(vtkMatrix3x3 *m);
164 
166  virtual void SetMatrix(vtkMatrix3x3 *m);
167 
169  virtual void GetMatrix(vtkMatrix3x3 *m);
170 
172  virtual void PushMatrix();
173 
175  virtual void PopMatrix();
176 
179  virtual void SetClipping(int *x);
180 
182  virtual void DisableClipping();
183 
185  virtual void Begin(vtkViewport* viewport);
186 
188  virtual void End();
189 
193  virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId);
194 
199  virtual void BufferIdModeEnd();
200 
204  bool SetStringRendererToFreeType();
205 
208  bool SetStringRendererToQt();
209 
211  bool HasGLSL();
212 
214 
216  vtkGetObjectMacro(RenderWindow, vtkOpenGLRenderWindow);
218 
222  virtual void ReleaseGraphicsResources(vtkWindow *window);
223 
224 //BTX
225 protected:
227  virtual ~vtkOpenGLContextDevice2D();
228 
230 
234  int GetNumberOfArcIterations(float rX,
235  float rY,
236  float startAngle,
237  float stopAngle);
239 
241  int Geometry[2];
242 
244  vtkRenderer *Renderer;
245 
247  vtkStringToImage *TextRenderer;
248 
250  bool InRender;
251 
253 
254  class Private;
255  Private *Storage;
257 
259  virtual bool LoadExtensions(vtkOpenGLExtensionManager *m);
260 
262  vtkOpenGLRenderWindow* RenderWindow;
263 
264 private:
265  vtkOpenGLContextDevice2D(const vtkOpenGLContextDevice2D &); // Not implemented.
266  void operator=(const vtkOpenGLContextDevice2D &); // Not implemented.
267 
268  void AlignText(double orientation, float width, float height, float *p);
269 
270 //ETX
271 };
272 
273 #endif //__vtkOpenGLContextDevice2D_h
#define VTK_CHARTS_EXPORT
Wrapper around vtkstd::string to keep symbols short.
Definition: vtkStdString.h:45
virtual void SetMatrix(vtkMatrix3x3 *m)=0
virtual void SetClipping(int *x)=0
virtual void BufferIdModeEnd()
abstract specification for Viewports
Definition: vtkViewport.h:45
virtual void DisableClipping()=0
Class for drawing 2D primitives using OpenGL 1.1+.
virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId)
virtual void DrawPoints(float *points, int n, unsigned char *colors=0, int nc_comps=0)=0
virtual void Begin(vtkViewport *)
virtual void DrawPolygon(float *, int)
virtual void SetColor4(unsigned char color[4])=0
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
virtual void SetLineWidth(float width)=0
vtkOpenGLRenderWindow * RenderWindow
virtual void DrawPoly(float *points, int n, unsigned char *colors=0, int nc_comps=0)=0
a simple class to control print indentation
Definition: vtkIndent.h:37
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
virtual void DrawQuadStrip(float *, int)
Abstract class for drawing 2D primitives.
virtual void PopMatrix()=0
virtual void SetTexture(vtkImageData *image, int properties)=0
virtual void SetPointSize(float size)=0
virtual void DrawQuad(float *, int)
2D array of ids, used for picking.
virtual void DrawEllipticArc(float x, float y, float rX, float rY, float startAngle, float stopAngle)=0
virtual void MultiplyMatrix(vtkMatrix3x3 *m)=0
virtual void DrawString(float *point, const vtkStdString &string)=0
virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy, float inRx, float inRy, float startAngle, float stopAngle)=0
virtual void GetMatrix(vtkMatrix3x3 *m)=0
virtual void PrintSelf(ostream &os, vtkIndent indent)
virtual void ComputeStringBounds(const vtkStdString &string, float bounds[4])=0
virtual void PushMatrix()=0
virtual void DrawImage(float p[2], float scale, vtkImageData *image)=0
static vtkObject * New()
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:34
virtual void SetLineType(int type)=0
virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n, unsigned char *colors=0, int nc_comps=0)=0
String class that stores Unicode text.