00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00048 #ifndef __vtkImageCanvasSource2D_h
00049 #define __vtkImageCanvasSource2D_h
00050 
00051 #include "vtkStructuredPoints.h"
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 class vtkImageCanvasSource2DPixel { 
00060 public:
00061   static vtkImageCanvasSource2DPixel *New() 
00062     { return new vtkImageCanvasSource2DPixel ;}
00063   int X;
00064   int Y;
00065   void *Pointer;
00066   vtkImageCanvasSource2DPixel *Next;
00067 };
00068 
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   
00153   
00154   
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&);  
00165   void operator=(const vtkImageCanvasSource2D&);  
00166 };
00167 
00168 
00169 
00170 #endif
00171 
00172