VTK
vtkContextDevice2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContextDevice2D.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 
25 #ifndef __vtkContextDevice2D_h
26 #define __vtkContextDevice2D_h
27 
28 #include "vtkRenderingContext2DModule.h" // For export macro
29 #include "vtkObject.h"
30 #include "vtkVector.h" // For vtkVector2i ivar
31 #include "vtkRect.h" // For vtkRecti ivar
32 #include "vtkRenderingCoreEnums.h" // For marker enum
33 
34 class vtkWindow;
35 class vtkViewport;
36 class vtkStdString;
37 class vtkUnicodeString;
38 class vtkTextProperty;
39 class vtkPoints2D;
40 class vtkImageData;
41 class vtkMatrix3x3;
43 class vtkPen;
44 class vtkBrush;
45 class vtkRectf;
46 
48 {
49 public:
51  virtual void PrintSelf(ostream &os, vtkIndent indent);
52 
54 
58  virtual void DrawPoly(float *points, int n,
59  unsigned char *colors = 0, int nc_comps = 0) = 0;
61 
63 
65  virtual void DrawPoints(float *points, int n, unsigned char* colors = 0,
66  int nc_comps = 0) = 0;
68 
70 
75  virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n,
76  unsigned char *colors = 0, int nc_comps = 0) = 0;
78 
80 
86  virtual void DrawMarkers(int shape, bool highlight, float *points, int n,
87  unsigned char *colors = 0, int nc_comps = 0);
89 
91  virtual void DrawQuad(float *, int) { ; }
92 
94  virtual void DrawQuadStrip(float *, int) { ; }
95 
97  virtual void DrawPolygon(float *, int) { ; }
98 
100 
106  virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy,
107  float inRx, float inRy, float startAngle,
108  float stopAngle)=0;
110 
112 
115  virtual void DrawEllipticArc(float x, float y, float rX, float rY,
116  float startAngle, float stopAngle)=0;
118 
120  virtual void DrawString(float *point, const vtkStdString &string) = 0;
121 
123 
128  virtual void ComputeStringBounds(const vtkStdString &string,
129  float bounds[4]) = 0;
131 
133  virtual void DrawString(float *point, const vtkUnicodeString &string) = 0;
134 
136 
141  virtual void ComputeStringBounds(const vtkUnicodeString &string,
142  float bounds[4]) = 0;
144 
148  virtual void DrawMathTextString(float *point, const vtkStdString &string) = 0;
149 
151  virtual bool MathTextIsSupported();
152 
155  virtual void DrawImage(float p[2], float scale, vtkImageData *image) = 0;
156 
160  virtual void DrawImage(const vtkRectf& pos, vtkImageData *image) = 0;
161 
166  void ApplyPen(vtkPen *pen);
167 
169 
174 
179  void ApplyBrush(vtkBrush *brush);
180 
182 
184  vtkGetObjectMacro(Brush, vtkBrush);
186 
190  void ApplyTextProp(vtkTextProperty *prop);
191 
193 
196 
198  virtual void SetColor4(unsigned char color[4]) = 0;
199 
201  Nearest = 0x01,
202  Linear = 0x02,
203  Stretch = 0x04,
204  Repeat = 0x08
205  };
207  virtual void SetTexture(vtkImageData* image, int properties) = 0;
208 
210  virtual void SetPointSize(float size) = 0;
211 
213  virtual void SetLineWidth(float width) = 0;
214 
216  virtual void SetLineType(int type) = 0;
217 
219  virtual int GetWidth() { return this->Geometry[0]; }
220 
222  virtual int GetHeight() { return this->Geometry[1]; }
223 
225  virtual void SetMatrix(vtkMatrix3x3 *m) = 0;
226 
228  virtual void GetMatrix(vtkMatrix3x3 *m) = 0;
229 
231  virtual void MultiplyMatrix(vtkMatrix3x3 *m) = 0;
232 
234  virtual void PushMatrix() = 0;
235 
237  virtual void PopMatrix() = 0;
238 
241  virtual void SetClipping(int *x) = 0;
242 
245  virtual void DisableClipping() { this->EnableClipping(false); }
246 
248  virtual void EnableClipping(bool enable) = 0;
249 
251  virtual void Begin(vtkViewport*) { }
252 
254  virtual void End() { }
255 
258  virtual bool GetBufferIdMode() const;
259 
260 //BTX
262 
265  virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId);
266 //ETX
268 
272  virtual void BufferIdModeEnd();
273 
274  virtual void SetViewportSize(const vtkVector2i &size)
275  {
276  this->ViewportSize = size;
277  }
278 
279  virtual void SetViewportRect(const vtkRecti &rect)
280  {
281  this->ViewportRect = rect;
282  }
283 
284 //BTX
285 protected:
288 
290  int Geometry[2];
291 
294 
297 
299 
300  vtkPen *Pen; // Outlining
301  vtkBrush *Brush; // Fills
302  vtkTextProperty *TextProp; // Text property
303 
304 private:
305  vtkContextDevice2D(const vtkContextDevice2D &); // Not implemented.
306  void operator=(const vtkContextDevice2D &); // Not implemented.
307 
308 //ETX
309 };
310 
311 #endif //__vtkContextDevice2D_h
GLsizeiptr size
Definition: vtkgl.h:11843
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
virtual void SetViewportRect(const vtkRecti &rect)
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
abstract base class for most VTK objects
Definition: vtkObject.h:61
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
virtual void Begin(vtkViewport *)
virtual void DrawPolygon(float *, int)
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
virtual void DisableClipping()
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
window superclass for vtkRenderWindow
Definition: vtkWindow.h:33
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:36
virtual void PrintSelf(ostream &os, vtkIndent indent)
#define VTKRENDERINGCONTEXT2D_EXPORT
a simple class to control print indentation
Definition: vtkIndent.h:38
const GLfloat * m
Definition: vtkgl.h:18169
represent and manipulate 2D points
Definition: vtkPoints2D.h:35
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
GLint GLint GLsizei width
Definition: vtkgl.h:11316
vtkAbstractContextBufferId * BufferId
virtual void DrawQuadStrip(float *, int)
Abstract class for drawing 2D primitives.
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:38
represent text properties.
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
virtual void SetViewportSize(const vtkVector2i &size)
virtual void DrawQuad(float *, int)
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
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:35
vtkTextProperty * TextProp
String class that stores Unicode text.
GLfloat GLfloat p
Definition: vtkgl.h:15717