VTK
dox/Imaging/Sources/vtkImageCanvasSource2D.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkImageCanvasSource2D.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00029 #ifndef __vtkImageCanvasSource2D_h
00030 #define __vtkImageCanvasSource2D_h
00031 
00032 #include "vtkImagingSourcesModule.h" // For export macro
00033 #include "vtkImageAlgorithm.h"
00034 
00035 class VTKIMAGINGSOURCES_EXPORT vtkImageCanvasSource2D : public vtkImageAlgorithm
00036 {
00037 public:
00039   static vtkImageCanvasSource2D *New();
00040 
00041   vtkTypeMacro(vtkImageCanvasSource2D,vtkImageAlgorithm);
00042   void PrintSelf(ostream& os, vtkIndent indent);
00043 
00045 
00047   vtkSetVector4Macro(DrawColor, double);
00048   vtkGetVector4Macro(DrawColor, double);
00050 
00052   void SetDrawColor(double a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
00053 
00055   void SetDrawColor(double a,double b) {this->SetDrawColor(a, b, 0.0, 0.0);}
00056 
00058 
00059   void SetDrawColor(double a, double b, double c) {
00060     this->SetDrawColor(a, b, c, 0.0);}
00062 
00064 
00066   void FillBox(int min0, int max0, int min1, int max1);
00067   void FillTube(int x0, int y0, int x1, int y1, double radius);
00068   void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
00069   void DrawCircle(int c0, int c1, double radius);
00070   void DrawPoint(int p0, int p1);
00071   void DrawSegment(int x0, int y0, int x1, int y1);
00072   void DrawSegment3D(double *p0, double *p1);
00073   void DrawSegment3D(double x1, double y1, double z1,
00074                      double x2, double y2, double z2)
00075     { double p1[3], p2[3];
00076     p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
00077     this->DrawSegment3D(p1, p2);}
00079 
00081 
00083   void DrawImage(int x0, int y0, vtkImageData* i)
00084     { this->DrawImage(x0, y0, i, -1, -1, -1, -1); }
00085   void DrawImage(int x0, int y0, vtkImageData*, int sx, int sy,
00086                  int width, int height);
00088 
00092   void FillPixel(int x, int y);
00093 
00095 
00098   void SetExtent(int *extent);
00099   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00101 
00103 
00106   vtkSetMacro(DefaultZ, int);
00107   vtkGetMacro(DefaultZ, int);
00109 
00111 
00114   vtkSetVector3Macro(Ratio, double);
00115   vtkGetVector3Macro(Ratio, double);
00117 
00119 
00120   virtual void SetNumberOfScalarComponents(int i);
00121   virtual int GetNumberOfScalarComponents() const;
00123 
00125 
00130   void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
00131   void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
00132   void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
00133   void SetScalarTypeToUnsignedInt()
00134     {this->SetScalarType(VTK_UNSIGNED_INT);};
00135   void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
00136   void SetScalarTypeToUnsignedLong()
00137     {this->SetScalarType(VTK_UNSIGNED_LONG);};
00138   void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
00139   void SetScalarTypeToUnsignedShort()
00140     {this->SetScalarType(VTK_UNSIGNED_SHORT);};
00141   void SetScalarTypeToUnsignedChar()
00142     {this->SetScalarType(VTK_UNSIGNED_CHAR);};
00143   void SetScalarTypeToChar()
00144     {this->SetScalarType(VTK_CHAR);};
00145   void SetScalarType(int);
00146   int GetScalarType() const;
00148 
00149 protected:
00150   vtkImageCanvasSource2D();
00151   // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
00152   // associated vtkImageData.  However, since the data is reference counted,
00153   // it may not actually be deleted.
00154   ~vtkImageCanvasSource2D();
00155 
00156   vtkImageData *ImageData;
00157   int WholeExtent[6];
00158   double DrawColor[4];
00159   int DefaultZ;
00160   double Ratio[3];
00161 
00162   int ClipSegment(int &a0, int &a1, int &b0, int &b1);
00163 
00164   virtual int RequestInformation (vtkInformation *,
00165                                   vtkInformationVector**,
00166                                   vtkInformationVector *);
00167   virtual int RequestData (vtkInformation *,
00168                            vtkInformationVector**,
00169                            vtkInformationVector *);
00170 
00171 private:
00172   vtkImageCanvasSource2D(const vtkImageCanvasSource2D&);  // Not implemented.
00173   void operator=(const vtkImageCanvasSource2D&);  // Not implemented.
00174 };
00175 
00176 
00177 
00178 #endif
00179 
00180