xref: /aosp_15_r20/external/pdfium/public/fpdf_transformpage.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1*3ac0a46fSAndroid Build Coastguard Worker // Copyright 2014 The PDFium Authors
2*3ac0a46fSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*3ac0a46fSAndroid Build Coastguard Worker // found in the LICENSE file.
4*3ac0a46fSAndroid Build Coastguard Worker 
5*3ac0a46fSAndroid Build Coastguard Worker // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6*3ac0a46fSAndroid Build Coastguard Worker 
7*3ac0a46fSAndroid Build Coastguard Worker #ifndef PUBLIC_FPDF_TRANSFORMPAGE_H_
8*3ac0a46fSAndroid Build Coastguard Worker #define PUBLIC_FPDF_TRANSFORMPAGE_H_
9*3ac0a46fSAndroid Build Coastguard Worker 
10*3ac0a46fSAndroid Build Coastguard Worker // NOLINTNEXTLINE(build/include)
11*3ac0a46fSAndroid Build Coastguard Worker #include "fpdfview.h"
12*3ac0a46fSAndroid Build Coastguard Worker 
13*3ac0a46fSAndroid Build Coastguard Worker #ifdef __cplusplus
14*3ac0a46fSAndroid Build Coastguard Worker extern "C" {
15*3ac0a46fSAndroid Build Coastguard Worker #endif
16*3ac0a46fSAndroid Build Coastguard Worker 
17*3ac0a46fSAndroid Build Coastguard Worker /**
18*3ac0a46fSAndroid Build Coastguard Worker  * Set "MediaBox" entry to the page dictionary.
19*3ac0a46fSAndroid Build Coastguard Worker  *
20*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
21*3ac0a46fSAndroid Build Coastguard Worker  * left   - The left of the rectangle.
22*3ac0a46fSAndroid Build Coastguard Worker  * bottom - The bottom of the rectangle.
23*3ac0a46fSAndroid Build Coastguard Worker  * right  - The right of the rectangle.
24*3ac0a46fSAndroid Build Coastguard Worker  * top    - The top of the rectangle.
25*3ac0a46fSAndroid Build Coastguard Worker  */
26*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetMediaBox(FPDF_PAGE page,
27*3ac0a46fSAndroid Build Coastguard Worker                                                     float left,
28*3ac0a46fSAndroid Build Coastguard Worker                                                     float bottom,
29*3ac0a46fSAndroid Build Coastguard Worker                                                     float right,
30*3ac0a46fSAndroid Build Coastguard Worker                                                     float top);
31*3ac0a46fSAndroid Build Coastguard Worker 
32*3ac0a46fSAndroid Build Coastguard Worker /**
33*3ac0a46fSAndroid Build Coastguard Worker  * Set "CropBox" entry to the page dictionary.
34*3ac0a46fSAndroid Build Coastguard Worker  *
35*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
36*3ac0a46fSAndroid Build Coastguard Worker  * left   - The left of the rectangle.
37*3ac0a46fSAndroid Build Coastguard Worker  * bottom - The bottom of the rectangle.
38*3ac0a46fSAndroid Build Coastguard Worker  * right  - The right of the rectangle.
39*3ac0a46fSAndroid Build Coastguard Worker  * top    - The top of the rectangle.
40*3ac0a46fSAndroid Build Coastguard Worker  */
41*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page,
42*3ac0a46fSAndroid Build Coastguard Worker                                                    float left,
43*3ac0a46fSAndroid Build Coastguard Worker                                                    float bottom,
44*3ac0a46fSAndroid Build Coastguard Worker                                                    float right,
45*3ac0a46fSAndroid Build Coastguard Worker                                                    float top);
46*3ac0a46fSAndroid Build Coastguard Worker 
47*3ac0a46fSAndroid Build Coastguard Worker /**
48*3ac0a46fSAndroid Build Coastguard Worker  * Set "BleedBox" entry to the page dictionary.
49*3ac0a46fSAndroid Build Coastguard Worker  *
50*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
51*3ac0a46fSAndroid Build Coastguard Worker  * left   - The left of the rectangle.
52*3ac0a46fSAndroid Build Coastguard Worker  * bottom - The bottom of the rectangle.
53*3ac0a46fSAndroid Build Coastguard Worker  * right  - The right of the rectangle.
54*3ac0a46fSAndroid Build Coastguard Worker  * top    - The top of the rectangle.
55*3ac0a46fSAndroid Build Coastguard Worker  */
56*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetBleedBox(FPDF_PAGE page,
57*3ac0a46fSAndroid Build Coastguard Worker                                                     float left,
58*3ac0a46fSAndroid Build Coastguard Worker                                                     float bottom,
59*3ac0a46fSAndroid Build Coastguard Worker                                                     float right,
60*3ac0a46fSAndroid Build Coastguard Worker                                                     float top);
61*3ac0a46fSAndroid Build Coastguard Worker 
62*3ac0a46fSAndroid Build Coastguard Worker /**
63*3ac0a46fSAndroid Build Coastguard Worker  * Set "TrimBox" entry to the page dictionary.
64*3ac0a46fSAndroid Build Coastguard Worker  *
65*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
66*3ac0a46fSAndroid Build Coastguard Worker  * left   - The left of the rectangle.
67*3ac0a46fSAndroid Build Coastguard Worker  * bottom - The bottom of the rectangle.
68*3ac0a46fSAndroid Build Coastguard Worker  * right  - The right of the rectangle.
69*3ac0a46fSAndroid Build Coastguard Worker  * top    - The top of the rectangle.
70*3ac0a46fSAndroid Build Coastguard Worker  */
71*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetTrimBox(FPDF_PAGE page,
72*3ac0a46fSAndroid Build Coastguard Worker                                                    float left,
73*3ac0a46fSAndroid Build Coastguard Worker                                                    float bottom,
74*3ac0a46fSAndroid Build Coastguard Worker                                                    float right,
75*3ac0a46fSAndroid Build Coastguard Worker                                                    float top);
76*3ac0a46fSAndroid Build Coastguard Worker 
77*3ac0a46fSAndroid Build Coastguard Worker /**
78*3ac0a46fSAndroid Build Coastguard Worker  * Set "ArtBox" entry to the page dictionary.
79*3ac0a46fSAndroid Build Coastguard Worker  *
80*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
81*3ac0a46fSAndroid Build Coastguard Worker  * left   - The left of the rectangle.
82*3ac0a46fSAndroid Build Coastguard Worker  * bottom - The bottom of the rectangle.
83*3ac0a46fSAndroid Build Coastguard Worker  * right  - The right of the rectangle.
84*3ac0a46fSAndroid Build Coastguard Worker  * top    - The top of the rectangle.
85*3ac0a46fSAndroid Build Coastguard Worker  */
86*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetArtBox(FPDF_PAGE page,
87*3ac0a46fSAndroid Build Coastguard Worker                                                   float left,
88*3ac0a46fSAndroid Build Coastguard Worker                                                   float bottom,
89*3ac0a46fSAndroid Build Coastguard Worker                                                   float right,
90*3ac0a46fSAndroid Build Coastguard Worker                                                   float top);
91*3ac0a46fSAndroid Build Coastguard Worker 
92*3ac0a46fSAndroid Build Coastguard Worker /**
93*3ac0a46fSAndroid Build Coastguard Worker  * Get "MediaBox" entry from the page dictionary.
94*3ac0a46fSAndroid Build Coastguard Worker  *
95*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
96*3ac0a46fSAndroid Build Coastguard Worker  * left   - Pointer to a float value receiving the left of the rectangle.
97*3ac0a46fSAndroid Build Coastguard Worker  * bottom - Pointer to a float value receiving the bottom of the rectangle.
98*3ac0a46fSAndroid Build Coastguard Worker  * right  - Pointer to a float value receiving the right of the rectangle.
99*3ac0a46fSAndroid Build Coastguard Worker  * top    - Pointer to a float value receiving the top of the rectangle.
100*3ac0a46fSAndroid Build Coastguard Worker  *
101*3ac0a46fSAndroid Build Coastguard Worker  * On success, return true and write to the out parameters. Otherwise return
102*3ac0a46fSAndroid Build Coastguard Worker  * false and leave the out parameters unmodified.
103*3ac0a46fSAndroid Build Coastguard Worker  */
104*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetMediaBox(FPDF_PAGE page,
105*3ac0a46fSAndroid Build Coastguard Worker                                                          float* left,
106*3ac0a46fSAndroid Build Coastguard Worker                                                          float* bottom,
107*3ac0a46fSAndroid Build Coastguard Worker                                                          float* right,
108*3ac0a46fSAndroid Build Coastguard Worker                                                          float* top);
109*3ac0a46fSAndroid Build Coastguard Worker 
110*3ac0a46fSAndroid Build Coastguard Worker /**
111*3ac0a46fSAndroid Build Coastguard Worker  * Get "CropBox" entry from the page dictionary.
112*3ac0a46fSAndroid Build Coastguard Worker  *
113*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
114*3ac0a46fSAndroid Build Coastguard Worker  * left   - Pointer to a float value receiving the left of the rectangle.
115*3ac0a46fSAndroid Build Coastguard Worker  * bottom - Pointer to a float value receiving the bottom of the rectangle.
116*3ac0a46fSAndroid Build Coastguard Worker  * right  - Pointer to a float value receiving the right of the rectangle.
117*3ac0a46fSAndroid Build Coastguard Worker  * top    - Pointer to a float value receiving the top of the rectangle.
118*3ac0a46fSAndroid Build Coastguard Worker  *
119*3ac0a46fSAndroid Build Coastguard Worker  * On success, return true and write to the out parameters. Otherwise return
120*3ac0a46fSAndroid Build Coastguard Worker  * false and leave the out parameters unmodified.
121*3ac0a46fSAndroid Build Coastguard Worker  */
122*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetCropBox(FPDF_PAGE page,
123*3ac0a46fSAndroid Build Coastguard Worker                                                         float* left,
124*3ac0a46fSAndroid Build Coastguard Worker                                                         float* bottom,
125*3ac0a46fSAndroid Build Coastguard Worker                                                         float* right,
126*3ac0a46fSAndroid Build Coastguard Worker                                                         float* top);
127*3ac0a46fSAndroid Build Coastguard Worker 
128*3ac0a46fSAndroid Build Coastguard Worker /**
129*3ac0a46fSAndroid Build Coastguard Worker  * Get "BleedBox" entry from the page dictionary.
130*3ac0a46fSAndroid Build Coastguard Worker  *
131*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
132*3ac0a46fSAndroid Build Coastguard Worker  * left   - Pointer to a float value receiving the left of the rectangle.
133*3ac0a46fSAndroid Build Coastguard Worker  * bottom - Pointer to a float value receiving the bottom of the rectangle.
134*3ac0a46fSAndroid Build Coastguard Worker  * right  - Pointer to a float value receiving the right of the rectangle.
135*3ac0a46fSAndroid Build Coastguard Worker  * top    - Pointer to a float value receiving the top of the rectangle.
136*3ac0a46fSAndroid Build Coastguard Worker  *
137*3ac0a46fSAndroid Build Coastguard Worker  * On success, return true and write to the out parameters. Otherwise return
138*3ac0a46fSAndroid Build Coastguard Worker  * false and leave the out parameters unmodified.
139*3ac0a46fSAndroid Build Coastguard Worker  */
140*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetBleedBox(FPDF_PAGE page,
141*3ac0a46fSAndroid Build Coastguard Worker                                                          float* left,
142*3ac0a46fSAndroid Build Coastguard Worker                                                          float* bottom,
143*3ac0a46fSAndroid Build Coastguard Worker                                                          float* right,
144*3ac0a46fSAndroid Build Coastguard Worker                                                          float* top);
145*3ac0a46fSAndroid Build Coastguard Worker 
146*3ac0a46fSAndroid Build Coastguard Worker /**
147*3ac0a46fSAndroid Build Coastguard Worker  * Get "TrimBox" entry from the page dictionary.
148*3ac0a46fSAndroid Build Coastguard Worker  *
149*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
150*3ac0a46fSAndroid Build Coastguard Worker  * left   - Pointer to a float value receiving the left of the rectangle.
151*3ac0a46fSAndroid Build Coastguard Worker  * bottom - Pointer to a float value receiving the bottom of the rectangle.
152*3ac0a46fSAndroid Build Coastguard Worker  * right  - Pointer to a float value receiving the right of the rectangle.
153*3ac0a46fSAndroid Build Coastguard Worker  * top    - Pointer to a float value receiving the top of the rectangle.
154*3ac0a46fSAndroid Build Coastguard Worker  *
155*3ac0a46fSAndroid Build Coastguard Worker  * On success, return true and write to the out parameters. Otherwise return
156*3ac0a46fSAndroid Build Coastguard Worker  * false and leave the out parameters unmodified.
157*3ac0a46fSAndroid Build Coastguard Worker  */
158*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetTrimBox(FPDF_PAGE page,
159*3ac0a46fSAndroid Build Coastguard Worker                                                         float* left,
160*3ac0a46fSAndroid Build Coastguard Worker                                                         float* bottom,
161*3ac0a46fSAndroid Build Coastguard Worker                                                         float* right,
162*3ac0a46fSAndroid Build Coastguard Worker                                                         float* top);
163*3ac0a46fSAndroid Build Coastguard Worker 
164*3ac0a46fSAndroid Build Coastguard Worker /**
165*3ac0a46fSAndroid Build Coastguard Worker  * Get "ArtBox" entry from the page dictionary.
166*3ac0a46fSAndroid Build Coastguard Worker  *
167*3ac0a46fSAndroid Build Coastguard Worker  * page   - Handle to a page.
168*3ac0a46fSAndroid Build Coastguard Worker  * left   - Pointer to a float value receiving the left of the rectangle.
169*3ac0a46fSAndroid Build Coastguard Worker  * bottom - Pointer to a float value receiving the bottom of the rectangle.
170*3ac0a46fSAndroid Build Coastguard Worker  * right  - Pointer to a float value receiving the right of the rectangle.
171*3ac0a46fSAndroid Build Coastguard Worker  * top    - Pointer to a float value receiving the top of the rectangle.
172*3ac0a46fSAndroid Build Coastguard Worker  *
173*3ac0a46fSAndroid Build Coastguard Worker  * On success, return true and write to the out parameters. Otherwise return
174*3ac0a46fSAndroid Build Coastguard Worker  * false and leave the out parameters unmodified.
175*3ac0a46fSAndroid Build Coastguard Worker  */
176*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetArtBox(FPDF_PAGE page,
177*3ac0a46fSAndroid Build Coastguard Worker                                                        float* left,
178*3ac0a46fSAndroid Build Coastguard Worker                                                        float* bottom,
179*3ac0a46fSAndroid Build Coastguard Worker                                                        float* right,
180*3ac0a46fSAndroid Build Coastguard Worker                                                        float* top);
181*3ac0a46fSAndroid Build Coastguard Worker 
182*3ac0a46fSAndroid Build Coastguard Worker /**
183*3ac0a46fSAndroid Build Coastguard Worker  * Apply transforms to |page|.
184*3ac0a46fSAndroid Build Coastguard Worker  *
185*3ac0a46fSAndroid Build Coastguard Worker  * If |matrix| is provided it will be applied to transform the page.
186*3ac0a46fSAndroid Build Coastguard Worker  * If |clipRect| is provided it will be used to clip the resulting page.
187*3ac0a46fSAndroid Build Coastguard Worker  * If neither |matrix| or |clipRect| are provided this method returns |false|.
188*3ac0a46fSAndroid Build Coastguard Worker  * Returns |true| if transforms are applied.
189*3ac0a46fSAndroid Build Coastguard Worker  *
190*3ac0a46fSAndroid Build Coastguard Worker  * This function will transform the whole page, and would take effect to all the
191*3ac0a46fSAndroid Build Coastguard Worker  * objects in the page.
192*3ac0a46fSAndroid Build Coastguard Worker  *
193*3ac0a46fSAndroid Build Coastguard Worker  * page        - Page handle.
194*3ac0a46fSAndroid Build Coastguard Worker  * matrix      - Transform matrix.
195*3ac0a46fSAndroid Build Coastguard Worker  * clipRect    - Clipping rectangle.
196*3ac0a46fSAndroid Build Coastguard Worker  */
197*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
198*3ac0a46fSAndroid Build Coastguard Worker FPDFPage_TransFormWithClip(FPDF_PAGE page,
199*3ac0a46fSAndroid Build Coastguard Worker                            const FS_MATRIX* matrix,
200*3ac0a46fSAndroid Build Coastguard Worker                            const FS_RECTF* clipRect);
201*3ac0a46fSAndroid Build Coastguard Worker 
202*3ac0a46fSAndroid Build Coastguard Worker /**
203*3ac0a46fSAndroid Build Coastguard Worker  * Transform (scale, rotate, shear, move) the clip path of page object.
204*3ac0a46fSAndroid Build Coastguard Worker  * page_object - Handle to a page object. Returned by
205*3ac0a46fSAndroid Build Coastguard Worker  * FPDFPageObj_NewImageObj().
206*3ac0a46fSAndroid Build Coastguard Worker  *
207*3ac0a46fSAndroid Build Coastguard Worker  * a  - The coefficient "a" of the matrix.
208*3ac0a46fSAndroid Build Coastguard Worker  * b  - The coefficient "b" of the matrix.
209*3ac0a46fSAndroid Build Coastguard Worker  * c  - The coefficient "c" of the matrix.
210*3ac0a46fSAndroid Build Coastguard Worker  * d  - The coefficient "d" of the matrix.
211*3ac0a46fSAndroid Build Coastguard Worker  * e  - The coefficient "e" of the matrix.
212*3ac0a46fSAndroid Build Coastguard Worker  * f  - The coefficient "f" of the matrix.
213*3ac0a46fSAndroid Build Coastguard Worker  */
214*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT void FPDF_CALLCONV
215*3ac0a46fSAndroid Build Coastguard Worker FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,
216*3ac0a46fSAndroid Build Coastguard Worker                               double a,
217*3ac0a46fSAndroid Build Coastguard Worker                               double b,
218*3ac0a46fSAndroid Build Coastguard Worker                               double c,
219*3ac0a46fSAndroid Build Coastguard Worker                               double d,
220*3ac0a46fSAndroid Build Coastguard Worker                               double e,
221*3ac0a46fSAndroid Build Coastguard Worker                               double f);
222*3ac0a46fSAndroid Build Coastguard Worker 
223*3ac0a46fSAndroid Build Coastguard Worker // Experimental API.
224*3ac0a46fSAndroid Build Coastguard Worker // Get the clip path of the page object.
225*3ac0a46fSAndroid Build Coastguard Worker //
226*3ac0a46fSAndroid Build Coastguard Worker //   page object - Handle to a page object. Returned by e.g.
227*3ac0a46fSAndroid Build Coastguard Worker //                 FPDFPage_GetObject().
228*3ac0a46fSAndroid Build Coastguard Worker //
229*3ac0a46fSAndroid Build Coastguard Worker // Returns the handle to the clip path, or NULL on failure. The caller does not
230*3ac0a46fSAndroid Build Coastguard Worker // take ownership of the returned FPDF_CLIPPATH. Instead, it remains valid until
231*3ac0a46fSAndroid Build Coastguard Worker // FPDF_ClosePage() is called for the page containing |page_object|.
232*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV
233*3ac0a46fSAndroid Build Coastguard Worker FPDFPageObj_GetClipPath(FPDF_PAGEOBJECT page_object);
234*3ac0a46fSAndroid Build Coastguard Worker 
235*3ac0a46fSAndroid Build Coastguard Worker // Experimental API.
236*3ac0a46fSAndroid Build Coastguard Worker // Get number of paths inside |clip_path|.
237*3ac0a46fSAndroid Build Coastguard Worker //
238*3ac0a46fSAndroid Build Coastguard Worker //   clip_path - handle to a clip_path.
239*3ac0a46fSAndroid Build Coastguard Worker //
240*3ac0a46fSAndroid Build Coastguard Worker // Returns the number of objects in |clip_path| or -1 on failure.
241*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT int FPDF_CALLCONV FPDFClipPath_CountPaths(FPDF_CLIPPATH clip_path);
242*3ac0a46fSAndroid Build Coastguard Worker 
243*3ac0a46fSAndroid Build Coastguard Worker // Experimental API.
244*3ac0a46fSAndroid Build Coastguard Worker // Get number of segments inside one path of |clip_path|.
245*3ac0a46fSAndroid Build Coastguard Worker //
246*3ac0a46fSAndroid Build Coastguard Worker //   clip_path  - handle to a clip_path.
247*3ac0a46fSAndroid Build Coastguard Worker //   path_index - index into the array of paths of the clip path.
248*3ac0a46fSAndroid Build Coastguard Worker //
249*3ac0a46fSAndroid Build Coastguard Worker // Returns the number of segments or -1 on failure.
250*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT int FPDF_CALLCONV
251*3ac0a46fSAndroid Build Coastguard Worker FPDFClipPath_CountPathSegments(FPDF_CLIPPATH clip_path, int path_index);
252*3ac0a46fSAndroid Build Coastguard Worker 
253*3ac0a46fSAndroid Build Coastguard Worker // Experimental API.
254*3ac0a46fSAndroid Build Coastguard Worker // Get segment in one specific path of |clip_path| at index.
255*3ac0a46fSAndroid Build Coastguard Worker //
256*3ac0a46fSAndroid Build Coastguard Worker //   clip_path     - handle to a clip_path.
257*3ac0a46fSAndroid Build Coastguard Worker //   path_index    - the index of a path.
258*3ac0a46fSAndroid Build Coastguard Worker //   segment_index - the index of a segment.
259*3ac0a46fSAndroid Build Coastguard Worker //
260*3ac0a46fSAndroid Build Coastguard Worker // Returns the handle to the segment, or NULL on failure. The caller does not
261*3ac0a46fSAndroid Build Coastguard Worker // take ownership of the returned FPDF_PATHSEGMENT. Instead, it remains valid
262*3ac0a46fSAndroid Build Coastguard Worker // until FPDF_ClosePage() is called for the page containing |clip_path|.
263*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV
264*3ac0a46fSAndroid Build Coastguard Worker FPDFClipPath_GetPathSegment(FPDF_CLIPPATH clip_path,
265*3ac0a46fSAndroid Build Coastguard Worker                             int path_index,
266*3ac0a46fSAndroid Build Coastguard Worker                             int segment_index);
267*3ac0a46fSAndroid Build Coastguard Worker 
268*3ac0a46fSAndroid Build Coastguard Worker /**
269*3ac0a46fSAndroid Build Coastguard Worker  * Create a new clip path, with a rectangle inserted.
270*3ac0a46fSAndroid Build Coastguard Worker  *
271*3ac0a46fSAndroid Build Coastguard Worker  * Caller takes ownership of the returned FPDF_CLIPPATH. It should be freed with
272*3ac0a46fSAndroid Build Coastguard Worker  * FPDF_DestroyClipPath().
273*3ac0a46fSAndroid Build Coastguard Worker  *
274*3ac0a46fSAndroid Build Coastguard Worker  * left   - The left of the clip box.
275*3ac0a46fSAndroid Build Coastguard Worker  * bottom - The bottom of the clip box.
276*3ac0a46fSAndroid Build Coastguard Worker  * right  - The right of the clip box.
277*3ac0a46fSAndroid Build Coastguard Worker  * top    - The top of the clip box.
278*3ac0a46fSAndroid Build Coastguard Worker  */
279*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV FPDF_CreateClipPath(float left,
280*3ac0a46fSAndroid Build Coastguard Worker                                                             float bottom,
281*3ac0a46fSAndroid Build Coastguard Worker                                                             float right,
282*3ac0a46fSAndroid Build Coastguard Worker                                                             float top);
283*3ac0a46fSAndroid Build Coastguard Worker 
284*3ac0a46fSAndroid Build Coastguard Worker /**
285*3ac0a46fSAndroid Build Coastguard Worker  * Destroy the clip path.
286*3ac0a46fSAndroid Build Coastguard Worker  *
287*3ac0a46fSAndroid Build Coastguard Worker  * clipPath - A handle to the clip path. It will be invalid after this call.
288*3ac0a46fSAndroid Build Coastguard Worker  */
289*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
290*3ac0a46fSAndroid Build Coastguard Worker 
291*3ac0a46fSAndroid Build Coastguard Worker /**
292*3ac0a46fSAndroid Build Coastguard Worker  * Clip the page content, the page content that outside the clipping region
293*3ac0a46fSAndroid Build Coastguard Worker  * become invisible.
294*3ac0a46fSAndroid Build Coastguard Worker  *
295*3ac0a46fSAndroid Build Coastguard Worker  * A clip path will be inserted before the page content stream or content array.
296*3ac0a46fSAndroid Build Coastguard Worker  * In this way, the page content will be clipped by this clip path.
297*3ac0a46fSAndroid Build Coastguard Worker  *
298*3ac0a46fSAndroid Build Coastguard Worker  * page        - A page handle.
299*3ac0a46fSAndroid Build Coastguard Worker  * clipPath    - A handle to the clip path. (Does not take ownership.)
300*3ac0a46fSAndroid Build Coastguard Worker  */
301*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page,
302*3ac0a46fSAndroid Build Coastguard Worker                                                        FPDF_CLIPPATH clipPath);
303*3ac0a46fSAndroid Build Coastguard Worker 
304*3ac0a46fSAndroid Build Coastguard Worker #ifdef __cplusplus
305*3ac0a46fSAndroid Build Coastguard Worker }
306*3ac0a46fSAndroid Build Coastguard Worker #endif
307*3ac0a46fSAndroid Build Coastguard Worker 
308*3ac0a46fSAndroid Build Coastguard Worker #endif  // PUBLIC_FPDF_TRANSFORMPAGE_H_
309