Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Image.h

Go to the documentation of this file.
00001 /*
00002  * @(#)include/Image.h  1.0  2002-08-27 13:49
00003  *
00004  * Copyright (C)  2002  Daniel Léonard
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  */
00020 
00026 #ifndef _IMAGE_H_
00027 #define _IMAGE_H_
00028 
00029 #include <stdexcept>
00030 
00031 namespace halftoner
00032 {
00033 
00037    class Image
00038    {
00039       private:
00042 
00043          unsigned char* pixels;
00045          int width;
00047          int height;
00049 
00050       public:
00059          Image(int width, int height) throw(std::invalid_argument);
00060 
00064          ~Image() throw();
00065 
00068 
00072          int getWidth() const throw();
00073 
00078          int getHeight() const throw();
00079 
00089          int getColorAt(int x, int y) const throw (std::out_of_range);
00090 
00095          unsigned char* getCopy() const throw();
00097 
00100 
00109          void setColorAt(int x, int y, int color) throw (std::out_of_range);
00110 
00119          void setLine(int line, int* colors, int width) throw (std::out_of_range);
00121 
00122       private:
00125 
00129          unsigned char* getPixels() const throw();
00130 
00140          unsigned char* getPixel(int x, int y) const throw(std::out_of_range);
00142 
00143       public:
00146 
00153          static int calculateOffset(int x, int y, int width) throw();
00155    };
00156 
00157 }
00158 
00159 #endif   /* ifndef _IMAGE_H_ */

Generated on Sat Sep 7 16:31:38 2002 for Halftoning Library by doxygen1.2.17