VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "vtkRenderingContext2DModule.h" // For export macro
36 #include "vtkContextDevice2D.h"
37 
38 #include <list> // for std::list
39 
40 class vtkWindow;
41 class vtkViewport;
42 class vtkRenderer;
43 class vtkStringToImage;
46 
48 {
49 public:
51  virtual void PrintSelf(ostream &os, vtkIndent indent);
52 
54  static vtkOpenGLContextDevice2D *New();
55 
57 
60  virtual void DrawPoly(float *f, int n, unsigned char *colors = 0,
61  int nc_comps = 0);
63 
65 
68  virtual void DrawPoints(float *points, int n, unsigned char* colors = 0,
69  int nc_comps = 0);
71 
73 
78  virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n,
79  unsigned char* colors = 0, int nc_comps = 0);
81 
83 
89  virtual void DrawMarkers(int shape, bool highlight, float *points, int n,
90  unsigned char *colors = 0, int nc_comps = 0);
92 
94 
98  vtkSetMacro(MaximumMarkerCacheSize, int)
99  vtkGetMacro(MaximumMarkerCacheSize, int)
101 
103  virtual void DrawQuad(float *points, int n);
104 
106  virtual void DrawQuadStrip(float *points, int n);
107 
109  virtual void DrawPolygon(float *, int);
110 
112 
118  virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy,
119  float inRx, float inRy, float startAngle,
120  float stopAngle);
122 
124 
127  virtual void DrawEllipticArc(float x, float y, float rX, float rY,
128  float startAngle, float stopAngle);
130 
131 
133  virtual void DrawString(float *point, const vtkStdString &string);
134 
136 
143  virtual void ComputeStringBounds(const vtkStdString &string,
144  float bounds[4]);
146 
148  virtual void DrawString(float *point, const vtkUnicodeString &string);
149 
151 
158  virtual void ComputeStringBounds(const vtkUnicodeString &string,
159  float bounds[4]);
161 
165  virtual void DrawMathTextString(float point[2], const vtkStdString &string);
166 
169  virtual void DrawImage(float p[2], float scale, vtkImageData *image);
170 
174  void DrawImage(const vtkRectf& pos, vtkImageData *image);
175 
177  virtual void SetColor4(unsigned char color[4]);
178 
180  virtual void SetColor(unsigned char color[3]);
181 
183  virtual void SetTexture(vtkImageData* image, int properties = 0);
184 
186  virtual void SetPointSize(float size);
187 
189  virtual void SetLineWidth(float width);
190 
192  virtual void SetLineType(int type);
193 
195  virtual void MultiplyMatrix(vtkMatrix3x3 *m);
196 
198  virtual void SetMatrix(vtkMatrix3x3 *m);
199 
201  virtual void GetMatrix(vtkMatrix3x3 *m);
202 
204  virtual void PushMatrix();
205 
207  virtual void PopMatrix();
208 
211  virtual void SetClipping(int *x);
212 
214  virtual void EnableClipping(bool enable);
215 
217  virtual void Begin(vtkViewport* viewport);
218 
220  virtual void End();
221 
225  virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId);
226 
231  virtual void BufferIdModeEnd();
232 
236  bool SetStringRendererToFreeType();
237 
240  bool SetStringRendererToQt();
241 
243  bool HasGLSL();
244 
246 
250 
254  virtual void ReleaseGraphicsResources(vtkWindow *window);
255 
256 //BTX
257 protected:
259  virtual ~vtkOpenGLContextDevice2D();
260 
262 
266  int GetNumberOfArcIterations(float rX,
267  float rY,
268  float startAngle,
269  float stopAngle);
271 
273  int Geometry[2];
274 
276  vtkRenderer *Renderer;
277 
279  vtkStringToImage *TextRenderer;
280 
282  bool InRender;
283 
285 
286  class Private;
287  Private *Storage;
289 
291  virtual bool LoadExtensions(vtkOpenGLExtensionManager *m);
292 
294  vtkOpenGLRenderWindow* RenderWindow;
295 
296 private:
297  vtkOpenGLContextDevice2D(const vtkOpenGLContextDevice2D &); // Not implemented.
298  void operator=(const vtkOpenGLContextDevice2D &); // Not implemented.
299 
300  void AlignText(double orientation, float width, float height, float *p);
301 
307  vtkImageData *GetMarker(int shape, int size, bool highlight);
308 
309  class vtkMarkerCacheObject
310  {
311  public:
312  vtkTypeUInt64 Key;
313  vtkImageData *Value;
314  bool operator==(vtkTypeUInt64 key)
315  {
316  return this->Key == key;
317  }
318  };
319 
320  std::list<vtkMarkerCacheObject> MarkerCache;
321  int MaximumMarkerCacheSize;
322 
326  vtkImageData * GenerateMarker(int shape, int size, bool highlight);
327 
328 //ETX
329 };
330 
331 #endif //__vtkOpenGLContextDevice2D_h
OpenGL rendering window.
GLsizeiptr size
Definition: vtkgl.h:11843
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
GLclampf f
Definition: vtkgl.h:14181
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: vtkgl.h:11341
abstract specification for Viewports
Definition: vtkViewport.h:46
GLenum GLenum GLenum GLenum GLenum scale
Definition: vtkgl.h:15942
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
Class for drawing 2D primitives using OpenGL 1.1+.
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void DrawPoints(float *points, int n, unsigned char *colors=0, int nc_comps=0)=0
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
virtual void DrawMarkers(int shape, bool highlight, float *points, int n, unsigned char *colors=0, int nc_comps=0)
uses Qt to render the supplied text to an image.
GLint GLint GLsizei GLsizei height
Definition: vtkgl.h:11316
window superclass for vtkRenderWindow
Definition: vtkWindow.h:33
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
#define VTKRENDERINGCONTEXT2D_EXPORT
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:38
const GLfloat * m
Definition: vtkgl.h:18169
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
GLint GLint GLsizei width
Definition: vtkgl.h:11316
Abstract class for drawing 2D primitives.
Interface class for querying and using OpenGL extensions.
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
vtkWeakPointer< vtkRenderWindow > RenderWindow
2D array of ids, used for picking.
GLsizei const GLfloat * points
Definition: vtkgl.h:14786
GLboolean enable
Definition: vtkgl.h:18647
GLuint color
Definition: vtkgl.h:12351
GLclampd n
Definition: vtkgl.h:14370
virtual void PrintSelf(ostream &os, vtkIndent indent)
VTKCOMMONCORE_EXPORT bool operator==(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
static vtkObject * New()
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:35
virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n, unsigned char *colors=0, int nc_comps=0)=0
String class that stores Unicode text.
GLfloat GLfloat p
Definition: vtkgl.h:15717
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69