Poppler CPP 26.01.90
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, 2025, 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_cpp_export.h"
25
26#include <string>
27#include <vector>
28
29namespace poppler {
30
31class image_private;
32
33class POPPLER_CPP_EXPORT image
34{
35public:
37 {
38 format_invalid,
39 format_mono,
40 format_rgb24,
41 format_argb32,
42 format_gray8,
43 format_bgr24
44 };
45
46 image();
47 image(int iwidth, int iheight, format_enum iformat);
48 image(char *idata, int iwidth, int iheight, format_enum iformat);
49 image(const image &img);
50 ~image();
51
52 bool is_valid() const;
53 format_enum format() const;
54 int width() const;
55 int height() const;
56 char *data();
57 const char *const_data() const;
58 int bytes_per_row() const;
59
60 image copy() const;
61
62 bool save(const std::string &file_name, const std::string &out_format, int dpi = -1) const;
63
64 static std::vector<std::string> supported_image_formats();
65
66 image &operator=(const image &img);
67
68private:
69 void detach();
70
71 image_private *d;
72 friend class image_private;
73};
74
75}
76
77#endif
A simple representation of image, with direct access to the data.
Definition poppler-image.h:34
format_enum
The possible formats for an image.
Definition poppler-image.h:37
image()
Construct an invalid image.
Definition poppler-image.cpp:185
Single namespace containing all the classes and functions of poppler-cpp.
Definition poppler-destination.h:27