• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef _TRANSFORMPAGE_H_
8 #define _TRANSFORMPAGE_H_
9 
10 #ifndef _FPDFVIEW_H_
11 #include "fpdfview.h"
12 #endif
13 
14 typedef void* FPDF_PAGEARCSAVER;
15 typedef void* FPDF_PAGEARCLOADER;
16 /**
17 *  Set "MediaBox" entry to the page dictionary.
18 * @param[in] page	- Handle to a page.
19 * @param[in] left	- The left of the rectangle.
20 * @param[in] bottom	- The bottom of the rectangle.
21 * @param[in] right	- The right of the rectangle.
22 * @param[in] top	- The top of the rectangle.
23 * @retval None.
24 */
25 DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bottom, float right, float top);
26 
27 /**
28 *  Set "CropBox" entry to the page dictionary.
29 * @param[in] page	- Handle to a page.
30 * @param[in] left	- The left of the rectangle.
31 * @param[in] bottom	- The bottom of the rectangle.
32 * @param[in] right	- The right of the rectangle.
33 * @param[in] top	- The top of the rectangle.
34 * @retval None.
35 */
36 DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, float left, float bottom, float right, float top);
37 
38 
39 /**  Get "MediaBox" entry from the page dictionary.
40 * @param[in] page	- Handle to a page.
41 * @param[in] left	- Pointer to a double value receiving the left of the rectangle.
42 * @param[in] bottom	- Pointer to a double value receiving the bottom of the rectangle.
43 * @param[in] right	- Pointer to a double value receiving the right of the rectangle.
44 * @param[in] top	- Pointer to a double value receiving the top of the rectangle.
45 * @retval True if success,else fail.
46 */
47 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
48 
49 /**  Get "CropBox" entry from the page dictionary.
50 * @param[in] page	- Handle to a page.
51 * @param[in] left	- Pointer to a double value receiving the left of the rectangle.
52 * @param[in] bottom	- Pointer to a double value receiving the bottom of the rectangle.
53 * @param[in] right	- Pointer to a double value receiving the right of the rectangle.
54 * @param[in] top	- Pointer to a double value receiving the top of the rectangle.
55 * @retval True if success,else fail.
56 */
57 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
58 
59 /**
60 * Transform the whole page with a specified matrix, then clip the page content region.
61 *
62 * @param[in] page		 - A page handle.
63 * @param[in] matrix		 - The transform matrix.
64 * @param[in] clipRect	 - A rectangle page area to be clipped.
65 * @Note. This function will transform the whole page, and would take effect to all the objects in the page.
66 */
67 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX* matrix, FS_RECTF* clipRect);
68 
69 /**
70 * Transform (scale, rotate, shear, move) the clip path of page object.
71 * @param[in] page_object - Handle to a page object. Returned by FPDFPageObj_NewImageObj.
72 * @param[in] a	- The coefficient "a" of the matrix.
73 * @param[in] b	- The coefficient "b" of the matrix.
74 * @param[in] c	- The coefficient "c" of the matrix.
75 * @param[in] d	- The coefficient "d" of the matrix.
76 * @param[in] e	- The coefficient "e" of the matrix.
77 * @param[in] f	- The coefficient "f" of the matrix.
78 * @retval None.
79 */
80 DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,double a, double b, double c, double d, double e, double f);
81 
82 /**
83 * Create a new clip path, with a rectangle inserted.
84 *
85 * @param[in] left	- The left of the clip box.
86 * @param[in] bottom - The bottom of the clip box.
87 * @param[in] right	- The right of the clip box.
88 * @param[in] top	- The top of the clip box.
89 * @retval a handle to the clip path.
90 */
91 DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, float bottom, float right, float top);
92 
93 /**
94 * Destroy the clip path.
95 *
96 * @param[in] clipPath - A handle to the clip path.
97 * Destroy the clip path.
98 * @retval None.
99 */
100 DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
101 
102 /**
103 * Clip the page content, the page content that outside the clipping region become invisible.
104 *
105 * @param[in] page		 - A page handle.
106 * @param[in] clipPath	 - A handle to the clip path.
107 * @Note. A clip path will be inserted before the page content stream or content array. In this way, the page content will be clipped
108 * by this clip path.
109 */
110 DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clipPath);
111 
112 #endif
113 
114