summaryrefslogtreecommitdiff
path: root/goo/TiffWriter.h
blob: 2f7159ea49d978046766ce2548a5ecf40f47091e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//========================================================================
//
// TiffWriter.h
//
// This file is licensed under the GPLv2 or later
//
// Copyright (C) 2010, 2012 William Bader <williambader@hotmail.com>
// Copyright (C) 2011, 2012 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2012 Pino Toscano <pino@kde.org>
//
//========================================================================

#ifndef TIFFWRITER_H
#define TIFFWRITER_H

#include "poppler-config.h"

#ifdef ENABLE_LIBTIFF

#    include <sys/types.h>
#    include "ImgWriter.h"

struct TiffWriterPrivate;

class TiffWriter : public ImgWriter
{
public:
    /* RGB                 - 3 bytes/pixel
     * RGBA_PREMULTIPLIED  - 4 bytes/pixel premultiplied by alpha
     * GRAY                - 1 byte/pixel
     * MONOCHROME          - 8 pixels/byte
     * CMYK                - 4 bytes/pixel
     * RGB48               - 6 bytes/pixel
     */
    enum Format
    {
        RGB,
        RGBA_PREMULTIPLIED,
        GRAY,
        MONOCHROME,
        CMYK,
        RGB48
    };

    TiffWriter(Format format = RGB);
    ~TiffWriter() override;

    TiffWriter(const TiffWriter &other) = delete;
    TiffWriter &operator=(const TiffWriter &other) = delete;

    void setCompressionString(const char *compressionStringArg);

    bool init(FILE *openedFile, int width, int height, int hDPI, int vDPI) override;

    bool writePointers(unsigned char **rowPointers, int rowCount) override;
    bool writeRow(unsigned char **rowData) override;

    bool supportCMYK() override { return true; }

    bool close() override;

private:
    TiffWriterPrivate *priv;
};

#endif

#endif