// jpgimage.hpp -- image data from jpeg file // // 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: jpgimage.hpp,v 1.4 2005/05/09 07:02:06 fredb Exp $ #ifndef jpgimage_h #define jpgimage_h 1 #include extern "C" { #ifdef FAR #undef FAR #endif #include "jpeglib.h" } // image #include "image.hpp" class FGSD_JPEGImage : public FGSD_Image { public: FGSD_JPEGImage(bool __reverted = false); ~FGSD_JPEGImage (); bool load (const char *__fileName); bool loadFromBuffer( const unsigned char *__buffer, size_t __len ); bool save (const char *__fileName); private: static void jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *__buffer, size_t __len ); static void init_source(j_decompress_ptr cinfo); static boolean fill_input_buffer(j_decompress_ptr cinfo); static void skip_input_data(j_decompress_ptr cinfo, long num_bytes); static void term_source(j_decompress_ptr cinfo); private: bool _reverted; }; #endif