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