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 "vtkObject.h"
29 
30 class vtkWindow;
31 class vtkViewport;
32 class vtkStdString;
33 class vtkUnicodeString;
34 class vtkTextProperty;
35 class vtkPoints2D;
36 class vtkImageData;
37 class vtkMatrix3x3;
39 class vtkPen;
40 class vtkBrush;
41 class vtkRectf;
42 
44 {
45 public:
46  vtkTypeMacro(vtkContextDevice2D, vtkObject);
47  virtual void PrintSelf(ostream &os, vtkIndent indent);
48 
50 
54  virtual void DrawPoly(float *points, int n,
55  unsigned char *colors = 0, int nc_comps = 0) = 0;
57 
59 
61  virtual void DrawPoints(float *points, int n, unsigned char* colors = 0,
62  int nc_comps = 0) = 0;
64 
66 
71  virtual void DrawPointSprites(vtkImageData *sprite, float *points, int n,
72  unsigned char *colors = 0, int nc_comps = 0) = 0;
74 
76  virtual void DrawQuad(float *, int) { ; }
77 
79  virtual void DrawQuadStrip(float *, int) { ; }
80 
82  virtual void DrawPolygon(float *, int) { ; }
83 
85 
91  virtual void DrawEllipseWedge(float x, float y, float outRx, float outRy,
92  float inRx, float inRy, float startAngle,
93  float stopAngle)=0;
95 
97 
100  virtual void DrawEllipticArc(float x, float y, float rX, float rY,
101  float startAngle, float stopAngle)=0;
103 
105  virtual void DrawString(float *point, const vtkStdString &string) = 0;
106 
108 
113  virtual void ComputeStringBounds(const vtkStdString &string,
114  float bounds[4]) = 0;
116 
118  virtual void DrawString(float *point, const vtkUnicodeString &string) = 0;
119 
121 
126  virtual void ComputeStringBounds(const vtkUnicodeString &string,
127  float bounds[4]) = 0;
129 
132  virtual void DrawImage(float p[2], float scale, vtkImageData *image) = 0;
133 
137  virtual void DrawImage(const vtkRectf& pos, vtkImageData *image) = 0;
138 
143  void ApplyPen(vtkPen *pen);
144 
146 
149  vtkGetObjectMacro(Pen, vtkPen);
151 
156  void ApplyBrush(vtkBrush *brush);
157 
159 
161  vtkGetObjectMacro(Brush, vtkBrush);
163 
167  void ApplyTextProp(vtkTextProperty *prop);
168 
170 
171  vtkGetObjectMacro(TextProp, vtkTextProperty);
173 
175  virtual void SetColor4(unsigned char color[4]) = 0;
176 
178  Nearest = 0x01,
179  Linear = 0x02,
180  Stretch = 0x04,
181  Repeat = 0x08
182  };
184  virtual void SetTexture(vtkImageData* image, int properties) = 0;
185 
187  virtual void SetPointSize(float size) = 0;
188 
190  virtual void SetLineWidth(float width) = 0;
191 
193  virtual void SetLineType(int type) = 0;
194 
196  virtual int GetWidth() { return this->Geometry[0]; }
197 
199  virtual int GetHeight() { return this->Geometry[1]; }
200 
202  virtual void SetMatrix(vtkMatrix3x3 *m) = 0;
203 
205  virtual void GetMatrix(vtkMatrix3x3 *m) = 0;
206 
208  virtual void MultiplyMatrix(vtkMatrix3x3 *m) = 0;
209 
211  virtual void PushMatrix() = 0;
212 
214  virtual void PopMatrix() = 0;
215 
218  virtual void SetClipping(int *x) = 0;
219 
221  virtual void DisableClipping() = 0;
222 
224  virtual void Begin(vtkViewport*) { }
225 
227  virtual void End() { }
228 
231  virtual bool GetBufferIdMode() const;
232 
233 //BTX
235 
238  virtual void BufferIdModeBegin(vtkAbstractContextBufferId *bufferId);
239 //ETX
240  // Description:
241  // Finalize BufferId creation Mode. It makes sure that the content of the
242  // bufferId passed in argument of BufferIdModeBegin() is correctly set.
243  // The default implementation is empty.
244  // \pre started: GetBufferIdMode()
245  // \post done: !GetBufferIdMode()
246  virtual void BufferIdModeEnd();
248 
249 //BTX
250 protected:
252  virtual ~vtkContextDevice2D();
253 
255  int Geometry[2];
256 
258 
259  vtkPen *Pen; // Outlining
260  vtkBrush *Brush; // Fills
261  vtkTextProperty *TextProp; // Text property
262 
263 private:
264  vtkContextDevice2D(const vtkContextDevice2D &); // Not implemented.
265  void operator=(const vtkContextDevice2D &); // Not implemented.
266 
267 //ETX
268 };
269 
270 #endif //__vtkContextDevice2D_h
#define VTK_CHARTS_EXPORT
Wrapper around vtkstd::string to keep symbols short.
Definition: vtkStdString.h:45
abstract base class for most VTK objects
Definition: vtkObject.h:60
abstract specification for Viewports
Definition: vtkViewport.h:45
virtual void Begin(vtkViewport *)
virtual void DrawPolygon(float *, int)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:35
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:37
represent and manipulate 2D points
Definition: vtkPoints2D.h:34
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
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:37
virtual void DrawQuad(float *, int)
2D array of ids, used for picking.
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:34
vtkTextProperty * TextProp
String class that stores Unicode text.