1//========================================================================
2//
3// NetPBMWriter.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) 2009, 2011, 2021, 2022 Albert Astals Cid <aacid@kde.org>
9// Copyright (C) 2010, 2013 Adrian Johnson <ajohnson@redneon.com>
10// Copyright (C) 2010 Brian Cameron <brian.cameron@oracle.com>
11// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de>
12//
13//========================================================================
14
15#ifndef NETPBMWRITER_H
16#define NETPBMWRITER_H
17
18#include "poppler-config.h"
19#include "poppler_private_export.h"
20
21#include "ImgWriter.h"
22
23// Writer for the NetPBM formats (PBM and PPM)
24// This format is documented at:
25// http://netpbm.sourceforge.net/doc/pbm.html
26// http://netpbm.sourceforge.net/doc/ppm.html
27
28class POPPLER_PRIVATE_EXPORT NetPBMWriter : public ImgWriter
29{
30public:
31 /* RGB - 3 bytes/pixel
32 * MONOCHROME - 8 pixels/byte
33 */
34 enum Format
35 {
36 RGB,
37 MONOCHROME
38 };
39
40 explicit NetPBMWriter(Format formatA = RGB);
41 ~NetPBMWriter() override = default;
42
43 bool init(FILE *f, int width, int height, double /*hDPI*/, double /*vDPI*/) override;
44
45 bool writePointers(unsigned char **rowPointers, int rowCount) override;
46 bool writeRow(unsigned char **row) override;
47
48 bool close() override;
49
50private:
51 FILE *file;
52 Format format;
53 int width;
54};
55
56#endif
57

source code of poppler/goo/NetPBMWriter.h