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_PAGE_RENDERER_H
21 #define POPPLER_PAGE_RENDERER_H
22 
23 #include "poppler-global.h"
24 #include "poppler-image.h"
25 
26 namespace poppler {
27 
28 typedef unsigned int argb;
29 
30 class page;
31 class page_renderer_private;
32 
33 class POPPLER_CPP_EXPORT page_renderer : public poppler::noncopyable
34 {
35 public:
36     enum render_hint
37     {
38         antialiasing = 0x00000001,
39         text_antialiasing = 0x00000002,
40         text_hinting = 0x00000004
41     };
42 
43     enum line_mode_enum
44     {
45         line_default,
46         line_solid,
47         line_shape
48     };
49 
50     page_renderer();
51     ~page_renderer();
52 
53     argb paper_color() const;
54     void set_paper_color(argb c);
55 
56     unsigned int render_hints() const;
57     void set_render_hint(render_hint hint, bool on = true);
58     void set_render_hints(unsigned int hints);
59 
60     image::format_enum image_format() const;
61     void set_image_format(image::format_enum format);
62 
63     line_mode_enum line_mode() const;
64     void set_line_mode(line_mode_enum mode);
65 
66     image render_page(const page *p, double xres = 72.0, double yres = 72.0, int x = -1, int y = -1, int w = -1, int h = -1, rotation_enum rotate = rotate_0) const;
67 
68     static bool can_render();
69 
70 private:
71     page_renderer_private *d;
72     friend class page_renderer_private;
73 };
74 
75 }
76 
77 #endif
78