Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class 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 
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 =========================================================================*/
00030 #ifndef __vtkImageCanvasSource2D_h
00031 #define __vtkImageCanvasSource2D_h
00032 
00033 #include "vtkStructuredPoints.h"
00034 
00035 //
00036 // Special classes for manipulating data
00037 //
00038 //BTX - begin tcl exclude
00039 //
00040 // For the fill functionality (use connector ??)
00041 class vtkImageCanvasSource2DPixel { //;prevent man page generation
00042 public:
00043   static vtkImageCanvasSource2DPixel *New() 
00044     { return new vtkImageCanvasSource2DPixel ;}
00045   int X;
00046   int Y;
00047   void *Pointer;
00048   vtkImageCanvasSource2DPixel *Next;
00049 };
00050 //ETX - end tcl exclude
00051 //
00052 
00053 
00054 class VTK_IMAGING_EXPORT vtkImageCanvasSource2D : public vtkStructuredPoints
00055 {
00056 public:
00058   static vtkImageCanvasSource2D *New();
00059 
00060   vtkTypeRevisionMacro(vtkImageCanvasSource2D,vtkStructuredPoints);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00064 
00065   void SetImageData(vtkImageData *image);
00066   vtkGetObjectMacro(ImageData, vtkImageData);
00068   
00070 
00072   vtkSetVector4Macro(DrawColor, double);
00073   vtkGetVector4Macro(DrawColor, double);
00074   void SetDrawColor(double a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
00075   void SetDrawColor(double a,double b) {this->SetDrawColor(a, b, 0.0, 0.0);}
00076   void SetDrawColor(double a, double b, double c) {
00077     this->SetDrawColor(a, b, c, 0.0);}
00079     
00080   void FillBox(int min0, int max0, int min1, int max1);
00081   void FillTube(int x0, int y0, int x1, int y1, double radius);
00082   void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
00083   void DrawCircle(int c0, int c1, double radius);
00084   void DrawPoint(int p0, int p1);
00085   void DrawSegment(int x0, int y0, int x1, int y1);
00086   void DrawSegment3D(double *p0, double *p1);
00087   void DrawSegment3D(double x1, double y1, double z1, 
00088                      double x2, double y2, double z2) 
00089     { double p1[3], p2[3]; 
00090     p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
00091     this->DrawSegment3D(p1, p2);}
00092 
00094 
00096   void DrawImage(int x0, int y0, vtkImageData* i)
00097     { this->DrawImage(x0, y0, i, -1, -1, -1, -1); }
00098   void DrawImage(int x0, int y0, vtkImageData*, int sx, int sy,
00099                  int width, int height);
00101 
00105   void FillPixel(int x, int y);
00106 
00109   vtkImageData *GetOutput() {return this;}
00110   
00112 
00115   void SetExtent(int *extent);
00116   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00118   
00120 
00123   vtkSetMacro(DefaultZ, int);
00124   vtkGetMacro(DefaultZ, int);
00126 
00128 
00130   vtkSetVector3Macro(Ratio, double);
00131   vtkGetVector3Macro(Ratio, double);
00133 
00134 protected:
00135   vtkImageCanvasSource2D();
00136   // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
00137   // associated vtkImageData.  However, since the data is reference counted,
00138   // it may not actually be deleted.
00139   ~vtkImageCanvasSource2D();
00140 
00141   vtkImageData *ImageData;
00142   double DrawColor[4];
00143   int DefaultZ;
00144   double Ratio[3];
00145   
00146   int ClipSegment(int &a0, int &a1, int &b0, int &b1);
00147 private:
00148   vtkImageCanvasSource2D(const vtkImageCanvasSource2D&);  // Not implemented.
00149   void operator=(const vtkImageCanvasSource2D&);  // Not implemented.
00150 };
00151 
00152 
00153 
00154 #endif
00155 
00156