image.hpp

Go to the documentation of this file.
00001 
00002 #include <vector>
00003 #include <color.hpp>
00004 /*
00005 **    PROJET 3ETI CPE Lyon
00006 **    Copyright (C) 2011 Damien Rohmer
00007 **
00008 **    This program is free software: you can redistribute it and/or modify
00009 **    it under the terms of the GNU General Public License as published by
00010 **    the Free Software Foundation, either version 3 of the License, or
00011 **    (at your option) any later version.
00012 **
00013 **   This program is distributed in the hope that it will be useful,
00014 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 **    GNU General Public License for more details.
00017 **
00018 **    You should have received a copy of the GNU General Public License
00019 **    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020 */
00021 
00022 
00023 namespace cpe
00024 {
00025 
00027     class image
00028     {
00029     public:
00030 
00031         // ********************************************* //
00032         // ********************************************* //
00033         //  CONSTRUCTORS
00034         // ********************************************* //
00035         // ********************************************* //
00036 
00038         image();
00043         image(const unsigned int& Nx,const unsigned int& Ny);
00044 
00045         // ********************************************* //
00046         // ********************************************* //
00047         //  Picture Size
00048         // ********************************************* //
00049         // ********************************************* //
00050 
00052         const unsigned int& Nx() const;
00054         const unsigned int& Ny() const;
00055 
00056         // ********************************************* //
00057         // ********************************************* //
00058         //  Pixel access
00059         // ********************************************* //
00060         // ********************************************* //
00061 
00063         const color& operator()(const int& px,const int& py) const;
00065         color& operator()(const int& px,const int& py);
00066 
00067 
00068 
00069         // ********************************************* //
00070         // ********************************************* //
00071         //  I/O
00072         // ********************************************* //
00073         // ********************************************* //
00074 
00078         void read_ppm(const std::string& filename);
00082         void export_ppm(const std::string& filename);
00083 
00084     private:
00085 
00086 
00087         // ********************************************* //
00088         // ********************************************* //
00089         //  Internal data
00090         // ********************************************* //
00091         // ********************************************* //
00092 
00094         unsigned int internal_Nx;
00096         unsigned int internal_Ny;
00097 
00102         std::vector<color> internal_data;
00103 
00104 
00105         // ********************************************* //
00106         // ********************************************* //
00107         //  Internal Methods
00108         // ********************************************* //
00109         // ********************************************* //
00110 
00114         bool check_position(const int& px,const int& py) const;
00115 
00116     };
00117 
00118 }
00119 
Generated on Fri Apr 1 14:59:45 2011 by  doxygen 1.6.3