Main Page   Class Hierarchy   Compound List   File List   Compound Members  

image.h

00001 /*=============================================================================
00002         File: image.h
00003      Purpose: To add some basic image processing capabilities to the 
00004               matrix class
00005     Revision: $Id: image.h,v 1.5 2003/01/27 11:37:35 philosophil Exp $
00006   Created by: Philippe Lavoie          (3 Oct, 1996)
00007  Modified by: 
00008 
00009  Copyright notice:
00010           Copyright (C) 1996-1998 Philippe Lavoie
00011  
00012           This library is free software; you can redistribute it and/or
00013           modify it under the terms of the GNU Library General Public
00014           License as published by the Free Software Foundation; either
00015           version 2 of the License, or (at your option) any later version.
00016  
00017           This library is distributed in the hope that it will be useful,
00018           but WITHOUT ANY WARRANTY; without even the implied warranty of
00019           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020           Library General Public License for more details.
00021  
00022           You should have received a copy of the GNU Library General Public
00023           License along with this library; if not, write to the Free
00024           Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025 =============================================================================*/
00026 
00027 #ifndef _PLIB_image_h_
00028 #define _PLIB_image_h_
00029 
00030 #include "matrix.h"
00031 #include "color.h"
00032 
00035 namespace PLib {
00036 
00047   template <class T> 
00048     class MatrixImage : public Matrix<T> {
00049     public:
00050       MatrixImage(void) : Matrix<T>() {}
00051       MatrixImage(Matrix<T>& img): Matrix<T>(img) {}
00052       MatrixImage(MatrixImage<T>& img): Matrix<T>(img) {}
00053       MatrixImage(const int r, const int c): Matrix<T>(r,c) {}
00054       ~MatrixImage() {}
00055       
00056       void drawLine(int i1, int j1, int i2, int j2, T color) ;
00057       void drawPoint(int i, int j, double radius, T color) ;
00058       void store(Matrix<T>&) ;
00059     };
00060   
00061 } // end namespace
00062 
00063 typedef PLib::MatrixImage<unsigned char> Image_UBYTE ;
00064 typedef PLib::MatrixImage<char> Image_BYTE ;
00065 typedef PLib::MatrixImage<int> Image_INT ;
00066 typedef PLib::MatrixImage<double> Image_DOUBLE ;
00067 typedef PLib::MatrixImage<PLib::Color> Image_Color ;
00068 
00069 #ifdef WITH_IMAGE_MAGICK
00070 
00071 #include <magick/magick_config.h>
00072 #include <stdio.h>
00073 #include <magick/api.h>
00074 
00075 namespace PLib{
00076 
00097   template <class T>
00098     class IM_ImageT: public MatrixImage<T> {
00099     public:
00100       IM_ImageT(const std::string &filename, int save=0);
00101       IM_ImageT() ;
00102       IM_ImageT(const int r, const int c) ;
00103       ~IM_ImageT() ;
00104       
00105       int read(const std::string &filename);
00106       int write(const std::string &filename);
00107 
00108       IM_ImageT<T>& operator=(const Basic2DArray<T>& image){
00109         ((Basic2DArray<T>&)*this) = image;
00110         return *this;
00111       }
00112 
00113       
00114     protected:
00115       std::string file_name ;
00116       int autoSave ;
00117       
00118       void setImage() ;
00119       void setMatrix() ;
00120     };
00121   
00122 } // end namespace
00123 
00124 typedef PLib::IM_ImageT<unsigned char> IM_Image ;
00125 typedef PLib::IM_ImageT<PLib::Color> IM_ColorImage ;
00126 
00127 #ifdef INCLUDE_TEMPLATE_SOURCE
00128 #include "image_.cpp"
00129 #endif
00130 
00131 #endif // WITH_IMAGE_MAGICK
00132 
00133 #ifdef INCLUDE_TEMPLATE_SOURCE
00134 #include "image.cpp"
00135 #endif
00136 
00137 
00138 #endif 

Generated on Tue Jun 24 13:26:55 2003 for NURBS++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002