1 /* 2 * jpegsave.cpp - class for saving an ImageSource to disk as a JPEG file. 3 * 4 * Copyright (c) 2004 by Alastair M. Robinson 5 * Distributed under the terms of the GNU General Public License - 6 * see the file named "COPYING" for more details. 7 * 8 */ 9 10 11 #ifndef JPEGSAVE_H 12 #define JPEGSAVE_H 13 14 #include <stdio.h> 15 extern "C" 16 { 17 #ifdef WIN32 18 // Ugly hack to be compatible with the libjpeg62 shipped with GIMP. 19 typedef unsigned char boolean; 20 #define HAVE_BOOLEAN 21 #endif 22 #include <jpeglib.h> 23 #include <jerror.h> 24 } 25 26 #include "imagesource.h" 27 #include "imagesaver.h" 28 29 struct JPEGSaver_ErrManager; 30 class JPEGSaver : public ImageSaver 31 { 32 public: 33 JPEGSaver(const char *filename,ImageSource *is,int compression=85); 34 ~JPEGSaver(); 35 void Save(); 36 void EmbedProfile(CMSProfile *profile); 37 private: 38 struct ImageSource *imagesource; 39 int width,height; 40 int bytesperrow; 41 struct jpeg_compress_struct *cinfo; 42 unsigned char *tmpbuffer; 43 struct JPEGSaver_ErrManager *err; 44 }; 45 46 #endif 47