1 //======================================================================== 2 // 3 // TiffWriter.h 4 // 5 // This file is licensed under the GPLv2 or later 6 // 7 // Copyright (C) 2010, 2012 William Bader <williambader@hotmail.com> 8 // Copyright (C) 2011, 2012, 2021 Albert Astals Cid <aacid@kde.org> 9 // Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> 10 // Copyright (C) 2012 Pino Toscano <pino@kde.org> 11 // 12 //======================================================================== 13 14 #ifndef TIFFWRITER_H 15 #define TIFFWRITER_H 16 17 #include "poppler-config.h" 18 #include "poppler_private_export.h" 19 20 #ifdef ENABLE_LIBTIFF 21 22 # include <sys/types.h> 23 # include "ImgWriter.h" 24 25 struct TiffWriterPrivate; 26 27 class POPPLER_PRIVATE_EXPORT TiffWriter : public ImgWriter 28 { 29 public: 30 /* RGB - 3 bytes/pixel 31 * RGBA_PREMULTIPLIED - 4 bytes/pixel premultiplied by alpha 32 * GRAY - 1 byte/pixel 33 * MONOCHROME - 8 pixels/byte 34 * CMYK - 4 bytes/pixel 35 * RGB48 - 6 bytes/pixel 36 */ 37 enum Format 38 { 39 RGB, 40 RGBA_PREMULTIPLIED, 41 GRAY, 42 MONOCHROME, 43 CMYK, 44 RGB48 45 }; 46 47 explicit TiffWriter(Format format = RGB); 48 ~TiffWriter() override; 49 50 TiffWriter(const TiffWriter &other) = delete; 51 TiffWriter &operator=(const TiffWriter &other) = delete; 52 53 void setCompressionString(const char *compressionStringArg); 54 55 bool init(FILE *openedFile, int width, int height, int hDPI, int vDPI) override; 56 57 bool writePointers(unsigned char **rowPointers, int rowCount) override; 58 bool writeRow(unsigned char **rowData) override; 59 supportCMYK()60 bool supportCMYK() override { return true; } 61 62 bool close() override; 63 64 private: 65 TiffWriterPrivate *priv; 66 }; 67 68 #endif 69 70 #endif 71