00001 // jpeg.h -- Thatcher Ulrich <tu@tulrich.com> 2002 00002 00003 // This source code has been donated to the Public Domain. Do 00004 // whatever you want with it. 00005 00006 // Wrapper for jpeg file operations. The actual work is done by the 00007 // IJG jpeg lib. 00008 00009 #ifndef JPEG_H 00010 #define JPEG_H 00011 00012 00013 #include "tu_config.h" 00014 00015 struct jpeg_decompress_struct; 00016 struct jpeg_compress_struct; 00017 class tu_file; 00018 00019 00021 // 00025 namespace jpeg 00026 { 00028 class input { 00029 public: 00031 DSOEXPORT static input* create(tu_file* in); 00032 00033 // // Read SWF JPEG2-style header (separate encoding 00034 // // table followed by image data), and create jpeg 00035 // // input object. 00036 // DSOEXPORT static input* create_swf_jpeg2(SDL_RWops* in); 00037 00038 00040 // 00045 DSOEXPORT static input* create_swf_jpeg2_header_only(tu_file* in); 00046 00047 virtual ~input(); 00048 00050 virtual void discard_partial_buffer() = 0; 00051 00052 virtual void start_image() = 0; 00053 virtual void finish_image() = 0; 00054 00055 virtual int get_height() const = 0; 00056 virtual int get_width() const = 0; 00057 virtual void read_scanline(unsigned char* rgb_data) = 0; 00058 }; 00059 00060 00061 // Helper object for writing jpeg image data. 00062 class output 00063 { 00064 public: 00065 // Create an output object. Quality goes from 1-100. 00066 DSOEXPORT static output* create(tu_file* out, int width, int height, int quality); 00067 00068 virtual ~output(); 00069 00070 // ... 00071 virtual void write_scanline(unsigned char* rgb_data) = 0; 00072 }; 00073 } 00074 00075 00076 #endif // JPEG_H 00077 00078 // Local Variables: 00079 // mode: C++ 00080 // c-basic-offset: 8 00081 // tab-width: 8 00082 // indent-tabs-mode: t 00083 // End: