1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
use crateRenderConfig;
use DynamicImage;
use *;
/// Renders PDF pages to images; implemented per rasterization backend (e.g. PDFium).
/// A CPU-based renderer for generating images without GPU acceleration.
///
/// The `CpuRenderer` struct provides software rendering capabilities,
/// allowing for image generation and manipulation using only CPU resources.
/// This renderer is useful for environments where GPU acceleration is
/// unavailable or when consistent, predictable rendering performance is required.
///
/// # Examples
///
/// ```no_test
/// let renderer = CpuRenderer::new();
/// // Use the renderer for software-based image processing
/// ```
;
/// A graphics processing unit (GPU) renderer responsible for handling
/// hardware-accelerated rendering operations.
///
/// This struct provides an interface for rendering graphics using GPU
/// capabilities, enabling efficient processing of visual data through
/// parallel computation and specialized hardware functions.
///
/// # Examples
///
/// ```no_test
/// let renderer = GpuRenderer::new();
/// // Use renderer for graphics operations
/// ```
///
/// # Thread Safety
///
/// The thread safety characteristics of this renderer depend on the
/// underlying GPU driver implementation and should be consulted in
/// the specific platform documentation.
; // Stubbed
/// Renders a PDF page to a dynamic image using the CPU renderer.
///
/// This function takes a reference to a `PdfPage` and rendering configuration,
/// and returns a `DynamicImage` containing the rendered page contents. The
/// rendering is performed using the CPU-based renderer implementation.
///
/// # Arguments
///
/// * `page` - A reference to the `PdfPage` to be rendered
/// * `config` - A reference to the `RenderConfig` containing rendering parameters
/// such as scale, rotation, and color settings
///
/// # Returns
///
/// * `Ok(DynamicImage)` - The rendered page as a dynamic image on success
/// * `Err(Error)` - An `Error` if rendering fails
///
/// # Example
///
/// ```no_test
/// use pdfium::prelude::*;
///
/// let document = PdfDocument::load("document.pdf")?;
/// let page = document.pages().get(0)?;
/// let config = RenderConfig::new()
/// .set_scale(2.0)
/// .set_rotation(PageRotation::Degrees0);
///
/// let image = render_page(&page, &config)?;
/// ```
/// Render a single tile of a PDF page by rendering the full page at `dpi` and
/// cropping to the `tile_size × tile_size` region at grid position `(col, row)`.
///
/// Edge tiles that fall partially outside the page are cropped to the actual
/// content area; they will be smaller than `tile_size` on one or both axes.
///
/// Callers that render many tiles for the same page should cache the full-page
/// image themselves (e.g. via `render_page`) and crop with `crop_imm` to avoid
/// re-rendering the whole page for each tile.