1 //======================================================================== 2 // 3 // PNGWriter.h 4 // 5 // This file is licensed under the GPLv2 or later 6 // 7 // Copyright (C) 2009 Warren Toomey <wkt@tuhs.org> 8 // Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> 9 // Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> 10 // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> 11 // Copyright (C) 2010 Adrian Johnson <ajohnson@redneon.com> 12 // 13 //======================================================================== 14 15 #ifndef PNGWRITER_H 16 #define PNGWRITER_H 17 18 #include <config.h> 19 20 #ifdef ENABLE_LIBPNG 21 22 #include <cstdio> 23 #include <png.h> 24 #include "ImgWriter.h" 25 26 class PNGWriter : public ImgWriter 27 { 28 public: 29 PNGWriter(); 30 ~PNGWriter(); 31 32 bool init(FILE *f, int width, int height, int hDPI, int vDPI); 33 34 bool writePointers(unsigned char **rowPointers, int rowCount); 35 bool writeRow(unsigned char **row); 36 37 bool close(); 38 39 private: 40 png_structp png_ptr; 41 png_infop info_ptr; 42 }; 43 44 #endif 45 46 #endif 47