Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Imaging/vtkImageCanvasSource2D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkImageCanvasSource2D.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00048 #ifndef __vtkImageCanvasSource2D_h
00049 #define __vtkImageCanvasSource2D_h
00050 
00051 #include "vtkStructuredPoints.h"
00052 
00053 //
00054 // Special classes for manipulating data
00055 //
00056 //BTX - begin tcl exclude
00057 //
00058 // For the fill functionality (use connector ??)
00059 class vtkImageCanvasSource2DPixel { //;prevent man page generation
00060 public:
00061   static vtkImageCanvasSource2DPixel *New() 
00062     { return new vtkImageCanvasSource2DPixel ;}
00063   int X;
00064   int Y;
00065   void *Pointer;
00066   vtkImageCanvasSource2DPixel *Next;
00067 };
00068 //ETX - end tcl exclude
00069 //
00070 
00071 
00072 class VTK_IMAGING_EXPORT vtkImageCanvasSource2D : public vtkStructuredPoints
00073 {
00074 public:
00076   static vtkImageCanvasSource2D *New();
00077 
00078   vtkTypeRevisionMacro(vtkImageCanvasSource2D,vtkStructuredPoints);
00079   void PrintSelf(ostream& os, vtkIndent indent);
00080 
00082 
00083   void SetImageData(vtkImageData *image);
00084   vtkGetObjectMacro(ImageData, vtkImageData);
00086   
00088 
00090   vtkSetVector4Macro(DrawColor, float);
00091   vtkGetVector4Macro(DrawColor, float);
00092   void SetDrawColor(float a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
00093   void SetDrawColor(float a,float b) {this->SetDrawColor(a, b, 0.0, 0.0);}
00094   void SetDrawColor(float a, float b, float c) {this->SetDrawColor(a, b, c, 0.0);}
00096     
00097   void FillBox(int min0, int max0, int min1, int max1);
00098   void FillTube(int x0, int y0, int x1, int y1, float radius);
00099   void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
00100   void DrawCircle(int c0, int c1, float radius);
00101   void DrawPoint(int p0, int p1);
00102   void DrawSegment(int x0, int y0, int x1, int y1);
00103   void DrawSegment3D(float *p0, float *p1);
00104   void DrawSegment3D(float x1, float y1, float z1, float x2, float y2, float z2) 
00105     { float p1[3], p2[3]; 
00106     p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
00107     this->DrawSegment3D(p1, p2);}
00108 
00110 
00112   void DrawImage(int x0, int y0, vtkImageData* i)
00113     { this->DrawImage(x0, y0, i, -1, -1, -1, -1); }
00114   void DrawImage(int x0, int y0, vtkImageData*, int sx, int sy,
00115                  int width, int height);
00117 
00121   void FillPixel(int x, int y);
00122 
00125   vtkImageData *GetOutput() {return this;}
00126   
00128 
00131   void SetExtent(int *extent);
00132   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00134   
00136 
00139   vtkSetMacro(DefaultZ, int);
00140   vtkGetMacro(DefaultZ, int);
00142 
00144 
00146   vtkSetVector3Macro(Ratio, float);
00147   vtkGetVector3Macro(Ratio, float);
00149 
00150 protected:
00151   vtkImageCanvasSource2D();
00152   // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
00153   // associated vtkImageData.  However, since the data is reference counted,
00154   // it may not actually be deleted.
00155   ~vtkImageCanvasSource2D();
00156 
00157   vtkImageData *ImageData;
00158   float DrawColor[4];
00159   int DefaultZ;
00160   float Ratio[3];
00161   
00162   int ClipSegment(int &a0, int &a1, int &b0, int &b1);
00163 private:
00164   vtkImageCanvasSource2D(const vtkImageCanvasSource2D&);  // Not implemented.
00165   void operator=(const vtkImageCanvasSource2D&);  // Not implemented.
00166 };
00167 
00168 
00169 
00170 #endif
00171 
00172