1 //======================================================================== 2 // 3 // JpegWriter.h 4 // 5 // This file is licensed under the GPLv2 or later 6 // 7 // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> 8 // Copyright (C) 2010, 2012 Adrian Johnson <ajohnson@redneon.com> 9 // Copyright (C) 2010 Jürg Billeter <j@bitron.ch> 10 // Copyright (C) 2010 Harry Roberts <harry.roberts@midnight-labs.org> 11 // Copyright (C) 2010 Brian Cameron <brian.cameron@oracle.com> 12 // Copyright (C) 2011 Albert Astals Cid <aacid@kde.org> 13 // Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de> 14 // 15 //======================================================================== 16 17 #ifndef JPEGWRITER_H 18 #define JPEGWRITER_H 19 20 #include "poppler-config.h" 21 22 #ifdef ENABLE_LIBJPEG 23 24 #include <sys/types.h> 25 #include "ImgWriter.h" 26 27 struct JpegWriterPrivate; 28 29 class JpegWriter : public ImgWriter 30 { 31 public: 32 /* RGB - 3 bytes/pixel 33 * GRAY - 1 byte/pixel 34 * CMYK - 4 bytes/pixel 35 */ 36 enum Format { RGB, GRAY, CMYK }; 37 38 JpegWriter(int quality, bool progressive, Format format = RGB); 39 JpegWriter(Format format = RGB); 40 ~JpegWriter(); 41 42 bool init(FILE *f, int width, int height, int hDPI, int vDPI); 43 44 bool writePointers(unsigned char **rowPointers, int rowCount); 45 bool writeRow(unsigned char **row); 46 47 bool close(); 48 bool supportCMYK(); 49 50 private: 51 JpegWriter(const JpegWriter &other); 52 JpegWriter& operator=(const JpegWriter &other); 53 54 JpegWriterPrivate *priv; 55 }; 56 57 #endif 58 59 #endif 60