// image.hpp -- base class for image data // // Written by Frederic Bouvier, started October 2001. // // Copyright (C) 2001 Frederic Bouvier - fredb@users.sourceforge.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // // $Id: image.hpp,v 1.3 2005/05/09 07:01:52 fredb Exp $ #ifndef _image_hpp_ #define _image_hpp_ 1 class FGSD_Image { public: FGSD_Image(); virtual ~FGSD_Image(); virtual bool load( const char *__fileName ); virtual bool save( const char *__fileName ); void allocImage( unsigned int __width, unsigned int __height, unsigned int __depth = 3 ); unsigned char * buffer( unsigned int __row = 0 ); unsigned int width() const; unsigned int height() const; unsigned int rowStride() const; unsigned int depth() const; void getAverageColor( float &red, float &green, float &blue ); protected: unsigned char *_buffer; unsigned int _width; unsigned int _height; unsigned int _rowStride; unsigned int _depth; }; inline unsigned int FGSD_Image::width() const { return _width; } inline unsigned int FGSD_Image::height() const { return _height; } inline unsigned int FGSD_Image::rowStride() const { return _rowStride; } inline unsigned int FGSD_Image::depth() const { return _depth; } #endif