1/*
2 * Copyright (C) 2010, Pino Toscano <pino@kde.org>
3 * Copyright (C) 2018, Zsombor Hollay-Horvath <hollay.horvath@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef POPPLER_IMAGE_H
21#define POPPLER_IMAGE_H
22
23#include "poppler-global.h"
24#include "poppler-rectangle.h"
25
26namespace poppler {
27
28class image_private;
29
30class POPPLER_CPP_EXPORT image
31{
32public:
33 enum format_enum
34 {
35 format_invalid,
36 format_mono,
37 format_rgb24,
38 format_argb32,
39 format_gray8,
40 format_bgr24
41 };
42
43 image();
44 image(int iwidth, int iheight, format_enum iformat);
45 image(char *idata, int iwidth, int iheight, format_enum iformat);
46 image(const image &img);
47 ~image();
48
49 bool is_valid() const;
50 format_enum format() const;
51 int width() const;
52 int height() const;
53 char *data();
54 const char *const_data() const;
55 int bytes_per_row() const;
56
57 image copy(const rect &r = rect()) const;
58
59 bool save(const std::string &file_name, const std::string &out_format, int dpi = -1) const;
60
61 static std::vector<std::string> supported_image_formats();
62
63 image &operator=(const image &img);
64
65private:
66 void detach();
67
68 image_private *d;
69 friend class image_private;
70};
71
72}
73
74#endif
75

source code of poppler/cpp/poppler-image.h