VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkImageCanvasSource2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageCanvasSource2D.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 =========================================================================*/
29 #ifndef __vtkImageCanvasSource2D_h
30 #define __vtkImageCanvasSource2D_h
31 
32 #include "vtkImagingSourcesModule.h" // For export macro
33 #include "vtkImageAlgorithm.h"
34 
35 class VTKIMAGINGSOURCES_EXPORT vtkImageCanvasSource2D : public vtkImageAlgorithm
36 {
37 public:
39  static vtkImageCanvasSource2D *New();
40 
41  vtkTypeMacro(vtkImageCanvasSource2D,vtkImageAlgorithm);
42  void PrintSelf(ostream& os, vtkIndent indent);
43 
45 
47  vtkSetVector4Macro(DrawColor, double);
48  vtkGetVector4Macro(DrawColor, double);
50 
52  void SetDrawColor(double a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
53 
55  void SetDrawColor(double a,double b) {this->SetDrawColor(a, b, 0.0, 0.0);}
56 
58 
59  void SetDrawColor(double a, double b, double c) {
60  this->SetDrawColor(a, b, c, 0.0);}
62 
64 
66  void FillBox(int min0, int max0, int min1, int max1);
67  void FillTube(int x0, int y0, int x1, int y1, double radius);
68  void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
69  void DrawCircle(int c0, int c1, double radius);
70  void DrawPoint(int p0, int p1);
71  void DrawSegment(int x0, int y0, int x1, int y1);
72  void DrawSegment3D(double *p0, double *p1);
73  void DrawSegment3D(double x1, double y1, double z1,
74  double x2, double y2, double z2)
75  { double p1[3], p2[3];
76  p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
77  this->DrawSegment3D(p1, p2);}
79 
81 
83  void DrawImage(int x0, int y0, vtkImageData* i)
84  { this->DrawImage(x0, y0, i, -1, -1, -1, -1); }
85  void DrawImage(int x0, int y0, vtkImageData*, int sx, int sy,
86  int width, int height);
88 
92  void FillPixel(int x, int y);
93 
95 
98  void SetExtent(int *extent);
99  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
101 
103 
106  vtkSetMacro(DefaultZ, int);
107  vtkGetMacro(DefaultZ, int);
109 
111 
114  vtkSetVector3Macro(Ratio, double);
115  vtkGetVector3Macro(Ratio, double);
117 
119 
120  virtual void SetNumberOfScalarComponents(int i);
121  virtual int GetNumberOfScalarComponents() const;
123 
125 
130  void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
131  void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
132  void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
134  {this->SetScalarType(VTK_UNSIGNED_INT);};
135  void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
137  {this->SetScalarType(VTK_UNSIGNED_LONG);};
138  void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
140  {this->SetScalarType(VTK_UNSIGNED_SHORT);};
142  {this->SetScalarType(VTK_UNSIGNED_CHAR);};
144  {this->SetScalarType(VTK_CHAR);};
145  void SetScalarType(int);
146  int GetScalarType() const;
148 
149 protected:
151  // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
152  // associated vtkImageData. However, since the data is reference counted,
153  // it may not actually be deleted.
155 
156  vtkImageData *ImageData;
157  int WholeExtent[6];
158  double DrawColor[4];
159  int DefaultZ;
160  double Ratio[3];
161 
162  int ClipSegment(int &a0, int &a1, int &b0, int &b1);
163 
164  virtual int RequestInformation (vtkInformation *,
165  vtkInformationVector**,
166  vtkInformationVector *);
167  virtual int RequestData (vtkInformation *,
168  vtkInformationVector**,
169  vtkInformationVector *);
170 
171 private:
172  vtkImageCanvasSource2D(const vtkImageCanvasSource2D&); // Not implemented.
173  void operator=(const vtkImageCanvasSource2D&); // Not implemented.
174 };
175 
176 
177 
178 #endif
179 
180 
void DrawImage(int x0, int y0, vtkImageData *i)
void SetDrawColor(double a, double b, double c)
void DrawSegment3D(double x1, double y1, double z1, double x2, double y2, double z2)
void SetDrawColor(double a, double b)