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-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 
00038 =========================================================================*/
00055 #ifndef __vtkImageCanvasSource2D_h
00056 #define __vtkImageCanvasSource2D_h
00057 
00058 #include <math.h>
00059 #include "vtkStructuredPoints.h"
00060 
00061 //
00062 // Special classes for manipulating data
00063 //
00064 //BTX - begin tcl exclude
00065 //
00066 // For the fill functionality (use connector ??)
00067 class vtkImageCanvasSource2DPixel { //;prevent man page generation
00068 public:
00069   static vtkImageCanvasSource2DPixel *New() 
00070     { return new vtkImageCanvasSource2DPixel ;}
00071   int X;
00072   int Y;
00073   void *Pointer;
00074   vtkImageCanvasSource2DPixel *Next;
00075 };
00076 //ETX - end tcl exclude
00077 //
00078 
00079 
00080 class VTK_EXPORT vtkImageCanvasSource2D : public vtkStructuredPoints
00081 {
00082 public:
00084   static vtkImageCanvasSource2D *New();
00085 
00086   vtkTypeMacro(vtkImageCanvasSource2D,vtkStructuredPoints);
00087   void PrintSelf(ostream& os, vtkIndent indent);
00088 
00090   void SetImageData(vtkImageData *image);
00091   vtkGetObjectMacro(ImageData, vtkImageData);
00092   
00095   void SetDrawColor(int dim, float *color);
00096   void GetDrawColor(int dim, float *color);
00097   vtkSetVector4Macro(DrawColor, float);
00098   vtkGetVector4Macro(DrawColor, float);
00099   void SetDrawColor(float a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
00100   void SetDrawColor(float a,float b) {this->SetDrawColor(a, b, 0.0, 0.0);}
00101   void SetDrawColor(float a, float b, float c) {this->SetDrawColor(a, b, c, 0.0);}
00102     
00103   void FillBox(int min0, int max0, int min1, int max1);
00104   void FillTube(int x0, int y0, int x1, int y1, float radius);
00105   void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
00106   void DrawCircle(int c0, int c1, float radius);
00107   void DrawPoint(int p0, int p1);
00108   void DrawSegment(int x0, int y0, int x1, int y1);
00109   void DrawSegment3D(float *p0, float *p1);
00110   void DrawSegment3D(float x1, float y1, float z1, float x2, float y2, float z2) 
00111     { float p1[3], p2[3]; 
00112     p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
00113     this->DrawSegment3D(p1, p2);}
00114 
00117   void FillPixel(int x, int y);
00118 
00121   vtkImageData *GetOutput() {return this;}
00122   
00124   void SetExtent(int *extent);
00125   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00126   
00129   vtkSetMacro(DefaultZ, int);
00130   vtkGetMacro(DefaultZ, int);
00131 
00132 protected:
00133   vtkImageCanvasSource2D();
00134   // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
00135   // associated vtkImageData.  However, since the data is reference counted,
00136   // it may not actually be deleted.
00137   ~vtkImageCanvasSource2D();
00138   vtkImageCanvasSource2D(const vtkImageCanvasSource2D&) {};
00139   void operator=(const vtkImageCanvasSource2D&) {};
00140 
00141   vtkImageData *ImageData;
00142   float DrawColor[4];
00143   int DefaultZ;
00144   
00145   int ClipSegment(int &a0, int &a1, int &b0, int &b1);
00146 };
00147 
00148 
00149 
00150 #endif
00151 
00152 

Generated on Wed Nov 21 12:27:06 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001