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 =========================================================================*/
00059 #ifndef __vtkImageCanvasSource2D_h
00060 #define __vtkImageCanvasSource2D_h
00061 
00062 #include <math.h>
00063 #include "vtkStructuredPoints.h"
00064 
00065 //
00066 // Special classes for manipulating data
00067 //
00068 //BTX - begin tcl exclude
00069 //
00070 // For the fill functionality (use connector ??)
00071 class vtkImageCanvasSource2DPixel { //;prevent man page generation
00072 public:
00073   static vtkImageCanvasSource2DPixel *New() 
00074     { return new vtkImageCanvasSource2DPixel ;}
00075   int X;
00076   int Y;
00077   void *Pointer;
00078   vtkImageCanvasSource2DPixel *Next;
00079 };
00080 //ETX - end tcl exclude
00081 //
00082 
00083 
00084 class VTK_IMAGING_EXPORT vtkImageCanvasSource2D : public vtkStructuredPoints
00085 {
00086 public:
00088   static vtkImageCanvasSource2D *New();
00089 
00090   vtkTypeMacro(vtkImageCanvasSource2D,vtkStructuredPoints);
00091   void PrintSelf(ostream& os, vtkIndent indent);
00092 
00094 
00095   void SetImageData(vtkImageData *image);
00096   vtkGetObjectMacro(ImageData, vtkImageData);
00098   
00100 
00102   vtkSetVector4Macro(DrawColor, float);
00103   vtkGetVector4Macro(DrawColor, float);
00104   void SetDrawColor(float a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
00105   void SetDrawColor(float a,float b) {this->SetDrawColor(a, b, 0.0, 0.0);}
00106   void SetDrawColor(float a, float b, float c) {this->SetDrawColor(a, b, c, 0.0);}
00108     
00109   void FillBox(int min0, int max0, int min1, int max1);
00110   void FillTube(int x0, int y0, int x1, int y1, float radius);
00111   void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
00112   void DrawCircle(int c0, int c1, float radius);
00113   void DrawPoint(int p0, int p1);
00114   void DrawSegment(int x0, int y0, int x1, int y1);
00115   void DrawSegment3D(float *p0, float *p1);
00116   void DrawSegment3D(float x1, float y1, float z1, float x2, float y2, float z2) 
00117     { float p1[3], p2[3]; 
00118     p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
00119     this->DrawSegment3D(p1, p2);}
00120 
00124   void FillPixel(int x, int y);
00125 
00128   vtkImageData *GetOutput() {return this;}
00129   
00131 
00134   void SetExtent(int *extent);
00135   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00137   
00139 
00142   vtkSetMacro(DefaultZ, int);
00143   vtkGetMacro(DefaultZ, int);
00145 
00146 protected:
00147   vtkImageCanvasSource2D();
00148   // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
00149   // associated vtkImageData.  However, since the data is reference counted,
00150   // it may not actually be deleted.
00151   ~vtkImageCanvasSource2D();
00152 
00153   vtkImageData *ImageData;
00154   float DrawColor[4];
00155   int DefaultZ;
00156   
00157   int ClipSegment(int &a0, int &a1, int &b0, int &b1);
00158 private:
00159   vtkImageCanvasSource2D(const vtkImageCanvasSource2D&);  // Not implemented.
00160   void operator=(const vtkImageCanvasSource2D&);  // Not implemented.
00161 };
00162 
00163 
00164 
00165 #endif
00166 
00167 

Generated on Thu Mar 28 14:19:25 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001