VTK
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 "vtkImageAlgorithm.h"
33 
35 {
36 public:
38  static vtkImageCanvasSource2D *New();
39 
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
44 
46  vtkSetVector4Macro(DrawColor, double);
47  vtkGetVector4Macro(DrawColor, double);
49 
51  void SetDrawColor(double a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
52 
54  void SetDrawColor(double a,double b) {this->SetDrawColor(a, b, 0.0, 0.0);}
55 
57 
58  void SetDrawColor(double a, double b, double c) {
59  this->SetDrawColor(a, b, c, 0.0);}
61 
63 
65  void FillBox(int min0, int max0, int min1, int max1);
66  void FillTube(int x0, int y0, int x1, int y1, double radius);
67  void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
68  void DrawCircle(int c0, int c1, double radius);
69  void DrawPoint(int p0, int p1);
70  void DrawSegment(int x0, int y0, int x1, int y1);
71  void DrawSegment3D(double *p0, double *p1);
72  void DrawSegment3D(double x1, double y1, double z1,
73  double x2, double y2, double z2)
74  { double p1[3], p2[3];
75  p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
76  this->DrawSegment3D(p1, p2);}
78 
80 
82  void DrawImage(int x0, int y0, vtkImageData* i)
83  { this->DrawImage(x0, y0, i, -1, -1, -1, -1); }
84  void DrawImage(int x0, int y0, vtkImageData*, int sx, int sy,
85  int width, int height);
87 
91  void FillPixel(int x, int y);
92 
94 
97  void SetExtent(int *extent);
98  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
100 
102 
105  vtkSetMacro(DefaultZ, int);
106  vtkGetMacro(DefaultZ, int);
108 
110 
113  vtkSetVector3Macro(Ratio, double);
114  vtkGetVector3Macro(Ratio, double);
116 
118 
119  virtual void SetNumberOfScalarComponents(int i);
120  virtual int GetNumberOfScalarComponents() const;
122 
124 
129  void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
130  void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
131  void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
133  {this->SetScalarType(VTK_UNSIGNED_INT);};
134  void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
136  {this->SetScalarType(VTK_UNSIGNED_LONG);};
137  void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
139  {this->SetScalarType(VTK_UNSIGNED_SHORT);};
141  {this->SetScalarType(VTK_UNSIGNED_CHAR);};
143  {this->SetScalarType(VTK_CHAR);};
144  void SetScalarType(int);
145  int GetScalarType() const;
147 
148 protected:
150  // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
151  // associated vtkImageData. However, since the data is reference counted,
152  // it may not actually be deleted.
154 
156  int WholeExtent[6];
157  double DrawColor[4];
158  int DefaultZ;
159  double Ratio[3];
160 
161  int ClipSegment(int &a0, int &a1, int &b0, int &b1);
162 
163  virtual int RequestInformation (vtkInformation *,
166  virtual int RequestData (vtkInformation *,
169 
170 private:
171  vtkImageCanvasSource2D(const vtkImageCanvasSource2D&); // Not implemented.
172  void operator=(const vtkImageCanvasSource2D&); // Not implemented.
173 };
174 
175 
176 
177 #endif
178 
179 
#define VTK_UNSIGNED_INT
Definition: vtkType.h:32
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:30
void DrawImage(int x0, int y0, vtkImageData *i)
#define VTK_DOUBLE
Definition: vtkType.h:36
#define VTK_FLOAT
Definition: vtkType.h:35
a simple class to control print indentation
Definition: vtkIndent.h:37
#define VTK_IMAGING_EXPORT
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTK_SHORT
Definition: vtkType.h:29
#define VTK_CHAR
Definition: vtkType.h:26
#define VTK_LONG
Definition: vtkType.h:33
void SetDrawColor(double a, double b, double c)
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:28
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
void PrintSelf(ostream &os, vtkIndent indent)
static vtkAlgorithm * New()
void DrawSegment3D(double x1, double y1, double z1, double x2, double y2, double z2)
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:34
void SetDrawColor(double a, double b)
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTK_INT
Definition: vtkType.h:31