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:
50  vtkTypeMacro(vtkContextDevice2D, vtkObject);
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 
69  virtual void DrawLines(float *f, int n, unsigned char *colors = 0,
70  int nc_comps = 0) = 0;
72 
74 
76  virtual void DrawPoints(float *points, int n, unsigned char* colors = 0,
77  int nc_comps = 0) = 0;
79 
81 
86  virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n,
87  unsigned char *colors = 0, int nc_comps = 0) = 0;
89 
91 
97  virtual void DrawMarkers(int shape, bool highlight, float *points, int n,
98  unsigned char *colors = 0, int nc_comps = 0);
100 
102  virtual void DrawQuad(float *, int) { ; }
103 
105  virtual void DrawQuadStrip(float *, int) { ; }
106 
108  virtual void DrawPolygon(float *, int) { ; }
109 
111 
117  virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy,
118  float inRx, float inRy, float startAngle,
119  float stopAngle)=0;
121 
123 
126  virtual void DrawEllipticArc(float x, float y, float rX, float rY,
127  float startAngle, float stopAngle)=0;
129 
131  virtual void DrawString(float *point, const vtkStdString &string) = 0;
132 
134 
139  virtual void ComputeStringBounds(const vtkStdString &string,
140  float bounds[4]) = 0;
142 
144  virtual void DrawString(float *point, const vtkUnicodeString &string) = 0;
145 
147 
152  virtual void ComputeStringBounds(const vtkUnicodeString &string,
153  float bounds[4]) = 0;
155 
159  virtual void DrawMathTextString(float *point, const vtkStdString &string) = 0;
160 
162  virtual bool MathTextIsSupported();
163 
166  virtual void DrawImage(float p[2], float scale, vtkImageData *image) = 0;
167 
171  virtual void DrawImage(const vtkRectf& pos, vtkImageData *image) = 0;
172 
177  void ApplyPen(vtkPen *pen);
178 
180 
183  vtkGetObjectMacro(Pen, vtkPen);
185 
190  void ApplyBrush(vtkBrush *brush);
191 
193 
195  vtkGetObjectMacro(Brush, vtkBrush);
197 
201  void ApplyTextProp(vtkTextProperty *prop);
202 
204 
205  vtkGetObjectMacro(TextProp, vtkTextProperty);
207 
209  virtual void SetColor4(unsigned char color[4]) = 0;
210 
212  Nearest = 0x01,
213  Linear = 0x02,
214  Stretch = 0x04,
215  Repeat = 0x08
216  };
218  virtual void SetTexture(vtkImageData* image, int properties) = 0;
219 
221  virtual void SetPointSize(float size) = 0;
222 
224  virtual void SetLineWidth(float width) = 0;
225 
227  virtual void SetLineType(int type) = 0;
228 
230  virtual int GetWidth() { return this->Geometry[0]; }
231 
233  virtual int GetHeight() { return this->Geometry[1]; }
234 
236  virtual void SetMatrix(vtkMatrix3x3 *m) = 0;
237 
239  virtual void GetMatrix(vtkMatrix3x3 *m) = 0;
240 
242  virtual void MultiplyMatrix(vtkMatrix3x3 *m) = 0;
243 
245  virtual void PushMatrix() = 0;
246 
248  virtual void PopMatrix() = 0;
249 
252  virtual void SetClipping(int *x) = 0;
253 
256  virtual void DisableClipping() { this->EnableClipping(false); }
257 
259  virtual void EnableClipping(bool enable) = 0;
260 
262  virtual void Begin(vtkViewport*) { }
263 
265  virtual void End() { }
266 
269  virtual bool GetBufferIdMode() const;
270 
271 //BTX
273 
276  virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId);
277 //ETX
279 
283  virtual void BufferIdModeEnd();
284 
285  virtual void SetViewportSize(const vtkVector2i &size)
286  {
287  this->ViewportSize = size;
288  }
289 
290  virtual void SetViewportRect(const vtkRecti &rect)
291  {
292  this->ViewportRect = rect;
293  }
294 
295 //BTX
296 protected:
299 
301  int Geometry[2];
302 
305 
308 
310 
311  vtkPen *Pen; // Outlining
312  vtkBrush *Brush; // Fills
313  vtkTextProperty *TextProp; // Text property
314 
315 private:
316  vtkContextDevice2D(const vtkContextDevice2D &); // Not implemented.
317  void operator=(const vtkContextDevice2D &); // Not implemented.
318 
319 //ETX
320 };
321 
322 #endif //vtkContextDevice2D_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
virtual void SetViewportRect(const vtkRecti &rect)
abstract base class for most VTK objects
Definition: vtkObject.h:61
abstract specification for Viewports
Definition: vtkViewport.h:46
virtual void Begin(vtkViewport *)
virtual void DrawPolygon(float *, int)
virtual void DisableClipping()
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
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
represent and manipulate 2D points
Definition: vtkPoints2D.h:35
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
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.
virtual void SetViewportSize(const vtkVector2i &size)
virtual void DrawQuad(float *, int)
2D array of ids, used for picking.
static vtkObject * New()
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:35
vtkTextProperty * TextProp
String class that stores Unicode text.