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, 2017 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, 2021, 2022 Albert Astals Cid <aacid@kde.org>
13// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de>
14// Copyright (C) 2018 Martin Packman <gzlist@googlemail.com>
15//
16//========================================================================
17
18#ifndef JPEGWRITER_H
19#define JPEGWRITER_H
20
21#include "poppler-config.h"
22#include "poppler_private_export.h"
23
24#ifdef ENABLE_LIBJPEG
25
26# include <sys/types.h>
27# include "ImgWriter.h"
28
29struct JpegWriterPrivate;
30
31class POPPLER_PRIVATE_EXPORT JpegWriter : public ImgWriter
32{
33public:
34 /* RGB - 3 bytes/pixel
35 * GRAY - 1 byte/pixel
36 * CMYK - 4 bytes/pixel
37 */
38 enum Format
39 {
40 RGB,
41 GRAY,
42 CMYK
43 };
44
45 JpegWriter(int quality, bool progressive, Format format = RGB);
46 explicit JpegWriter(Format format = RGB);
47 ~JpegWriter() override;
48
49 JpegWriter(const JpegWriter &other) = delete;
50 JpegWriter &operator=(const JpegWriter &other) = delete;
51
52 void setQuality(int quality);
53 void setProgressive(bool progressive);
54 void setOptimize(bool optimize);
55 bool init(FILE *f, int width, int height, double hDPI, double vDPI) override;
56
57 bool writePointers(unsigned char **rowPointers, int rowCount) override;
58 bool writeRow(unsigned char **row) override;
59
60 bool close() override;
61 bool supportCMYK() override;
62
63private:
64 JpegWriterPrivate *priv;
65};
66
67#endif
68
69#endif
70

source code of poppler/goo/JpegWriter.h