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 
53  static vtkContextDevice2D * New();
54 
56 
60  virtual void DrawPoly(float *points, int n,
61  unsigned char *colors = 0, int nc_comps = 0) = 0;
63 
65 
67  virtual void DrawPoints(float *points, int n, unsigned char* colors = 0,
68  int nc_comps = 0) = 0;
70 
72 
77  virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n,
78  unsigned char *colors = 0, int nc_comps = 0) = 0;
80 
82 
88  virtual void DrawMarkers(int shape, bool highlight, float *points, int n,
89  unsigned char *colors = 0, int nc_comps = 0);
91 
93  virtual void DrawQuad(float *, int) { ; }
94 
96  virtual void DrawQuadStrip(float *, int) { ; }
97 
99  virtual void DrawPolygon(float *, int) { ; }
100 
102 
108  virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy,
109  float inRx, float inRy, float startAngle,
110  float stopAngle)=0;
112 
114 
117  virtual void DrawEllipticArc(float x, float y, float rX, float rY,
118  float startAngle, float stopAngle)=0;
120 
122  virtual void DrawString(float *point, const vtkStdString &string) = 0;
123 
125 
130  virtual void ComputeStringBounds(const vtkStdString &string,
131  float bounds[4]) = 0;
133 
135  virtual void DrawString(float *point, const vtkUnicodeString &string) = 0;
136 
138 
143  virtual void ComputeStringBounds(const vtkUnicodeString &string,
144  float bounds[4]) = 0;
146 
150  virtual void DrawMathTextString(float *point, const vtkStdString &string) = 0;
151 
153  virtual bool MathTextIsSupported();
154 
157  virtual void DrawImage(float p[2], float scale, vtkImageData *image) = 0;
158 
162  virtual void DrawImage(const vtkRectf& pos, vtkImageData *image) = 0;
163 
168  void ApplyPen(vtkPen *pen);
169 
171 
176 
181  void ApplyBrush(vtkBrush *brush);
182 
184 
186  vtkGetObjectMacro(Brush, vtkBrush);
188 
192  void ApplyTextProp(vtkTextProperty *prop);
193 
195 
198 
200  virtual void SetColor4(unsigned char color[4]) = 0;
201 
203  Nearest = 0x01,
204  Linear = 0x02,
205  Stretch = 0x04,
206  Repeat = 0x08
207  };
209  virtual void SetTexture(vtkImageData* image, int properties) = 0;
210 
212  virtual void SetPointSize(float size) = 0;
213 
215  virtual void SetLineWidth(float width) = 0;
216 
218  virtual void SetLineType(int type) = 0;
219 
221  virtual int GetWidth() { return this->Geometry[0]; }
222 
224  virtual int GetHeight() { return this->Geometry[1]; }
225 
227  virtual void SetMatrix(vtkMatrix3x3 *m) = 0;
228 
230  virtual void GetMatrix(vtkMatrix3x3 *m) = 0;
231 
233  virtual void MultiplyMatrix(vtkMatrix3x3 *m) = 0;
234 
236  virtual void PushMatrix() = 0;
237 
239  virtual void PopMatrix() = 0;
240 
243  virtual void SetClipping(int *x) = 0;
244 
247  virtual void DisableClipping() { this->EnableClipping(false); }
248 
250  virtual void EnableClipping(bool enable) = 0;
251 
253  virtual void Begin(vtkViewport*) { }
254 
256  virtual void End() { }
257 
260  virtual bool GetBufferIdMode() const;
261 
262 //BTX
264 
267  virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId);
268 //ETX
270 
274  virtual void BufferIdModeEnd();
275 
276  virtual void SetViewportSize(const vtkVector2i &size)
277  {
278  this->ViewportSize = size;
279  }
280 
281  virtual void SetViewportRect(const vtkRecti &rect)
282  {
283  this->ViewportRect = rect;
284  }
285 
286 //BTX
287 protected:
290 
292  int Geometry[2];
293 
296 
299 
301 
302  vtkPen *Pen; // Outlining
303  vtkBrush *Brush; // Fills
304  vtkTextProperty *TextProp; // Text property
305 
306 private:
307  vtkContextDevice2D(const vtkContextDevice2D &); // Not implemented.
308  void operator=(const vtkContextDevice2D &); // Not implemented.
309 
310 //ETX
311 };
312 
313 #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:632
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
static vtkObject * New()
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