John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 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. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 7 | #ifndef PUBLIC_FPDF_TRANSFORMPAGE_H_ |
| 8 | #define PUBLIC_FPDF_TRANSFORMPAGE_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 10 | #include "fpdfview.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 11 | |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 12 | #ifdef __cplusplus |
| 13 | extern "C" { |
| 14 | #endif |
| 15 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 16 | typedef void* FPDF_PAGEARCSAVER; |
| 17 | typedef void* FPDF_PAGEARCLOADER; |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 18 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 19 | /** |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 20 | * Set "MediaBox" entry to the page dictionary. |
| 21 | * @param[in] page - Handle to a page. |
| 22 | * @param[in] left - The left of the rectangle. |
| 23 | * @param[in] bottom - The bottom of the rectangle. |
| 24 | * @param[in] right - The right of the rectangle. |
| 25 | * @param[in] top - The top of the rectangle. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 26 | * @retval None. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 27 | * @note The method can not support to set this feature for the document which |
| 28 | * consists of dynamic XFA fields. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 29 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 30 | DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, |
| 31 | float left, |
| 32 | float bottom, |
| 33 | float right, |
| 34 | float top); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 35 | |
| 36 | /** |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 37 | * Set "CropBox" entry to the page dictionary. |
| 38 | * @param[in] page - Handle to a page. |
| 39 | * @param[in] left - The left of the rectangle. |
| 40 | * @param[in] bottom - The bottom of the rectangle. |
| 41 | * @param[in] right - The right of the rectangle. |
| 42 | * @param[in] top - The top of the rectangle. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 43 | * @retval None. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 44 | * @note The method can not support to set this feature for the document which |
| 45 | * consists of dynamic XFA fields. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 46 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 47 | DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, |
| 48 | float left, |
| 49 | float bottom, |
| 50 | float right, |
| 51 | float top); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 52 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 53 | /** Get "MediaBox" entry from the page dictionary. |
| 54 | * @param[in] page - Handle to a page. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 55 | * @param[in] left - Pointer to a double value receiving the left of the |
| 56 | * rectangle. |
| 57 | * @param[in] bottom - Pointer to a double value receiving the bottom of the |
| 58 | * rectangle. |
| 59 | * @param[in] right - Pointer to a double value receiving the right of the |
| 60 | * rectangle. |
| 61 | * @param[in] top - Pointer to a double value receiving the top of the |
| 62 | * rectangle. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 63 | * @retval True if success,else fail. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 64 | * @note The method can not support to get this feature for the document which |
| 65 | * consists of dynamic XFA fields. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 66 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 67 | DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, |
| 68 | float* left, |
| 69 | float* bottom, |
| 70 | float* right, |
| 71 | float* top); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 72 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 73 | /** Get "CropBox" entry from the page dictionary. |
| 74 | * @param[in] page - Handle to a page. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 75 | * @param[in] left - Pointer to a double value receiving the left of the |
| 76 | * rectangle. |
| 77 | * @param[in] bottom - Pointer to a double value receiving the bottom of the |
| 78 | * rectangle. |
| 79 | * @param[in] right - Pointer to a double value receiving the right of the |
| 80 | * rectangle. |
| 81 | * @param[in] top - Pointer to a double value receiving the top of the |
| 82 | * rectangle. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 83 | * @retval True if success,else fail. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 84 | * @note The method can not support to get this feature for the document which |
| 85 | * consists of dynamic XFA fields. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 86 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 87 | DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, |
| 88 | float* left, |
| 89 | float* bottom, |
| 90 | float* right, |
| 91 | float* top); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 92 | |
| 93 | /** |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 94 | * Transform the whole page with a specified matrix, then clip the page content |
| 95 | * region. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 96 | * |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 97 | * @param[in] page - A page handle. |
| 98 | * @param[in] matrix - The transform matrix. |
| 99 | * @param[in] clipRect - A rectangle page area to be clipped. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 100 | * @Note. This function will transform the whole page, and would take effect to |
| 101 | * all the objects in the page. |
| 102 | * The method can not support to get this feature for the document which |
| 103 | * consists of dynamic XFA fields. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 104 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 105 | DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, |
| 106 | FS_MATRIX* matrix, |
| 107 | FS_RECTF* clipRect); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 108 | |
| 109 | /** |
| 110 | * Transform (scale, rotate, shear, move) the clip path of page object. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 111 | * @param[in] page_object - Handle to a page object. Returned by |
| 112 | * FPDFPageObj_NewImageObj. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 113 | * @param[in] a - The coefficient "a" of the matrix. |
| 114 | * @param[in] b - The coefficient "b" of the matrix. |
| 115 | * @param[in] c - The coefficient "c" of the matrix. |
| 116 | * @param[in] d - The coefficient "d" of the matrix. |
| 117 | * @param[in] e - The coefficient "e" of the matrix. |
| 118 | * @param[in] f - The coefficient "f" of the matrix. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 119 | * @retval None. |
| 120 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 121 | DLLEXPORT void STDCALL |
| 122 | FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, |
| 123 | double a, |
| 124 | double b, |
| 125 | double c, |
| 126 | double d, |
| 127 | double e, |
| 128 | double f); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 129 | |
| 130 | /** |
| 131 | * Create a new clip path, with a rectangle inserted. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 132 | * |
| 133 | * @param[in] left - The left of the clip box. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 134 | * @param[in] bottom - The bottom of the clip box. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 135 | * @param[in] right - The right of the clip box. |
| 136 | * @param[in] top - The top of the clip box. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 137 | * @retval a handle to the clip path. |
| 138 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 139 | DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, |
| 140 | float bottom, |
| 141 | float right, |
| 142 | float top); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 143 | |
| 144 | /** |
| 145 | * Destroy the clip path. |
| 146 | * |
| 147 | * @param[in] clipPath - A handle to the clip path. |
| 148 | * Destroy the clip path. |
| 149 | * @retval None. |
| 150 | */ |
| 151 | DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath); |
| 152 | |
| 153 | /** |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 154 | * Clip the page content, the page content that outside the clipping region |
| 155 | * become invisible. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 156 | * |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 157 | * @param[in] page - A page handle. |
| 158 | * @param[in] clipPath - A handle to the clip path. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 159 | * @Note. A clip path will be inserted before the page content stream or content |
| 160 | * array. In this way, the page content will be clipped |
| 161 | * by this clip path. The method can not support this feature for the document |
| 162 | * consists of dynamic XFA fields. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 163 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 164 | DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, |
| 165 | FPDF_CLIPPATH clipPath); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 166 | |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 167 | #ifdef __cplusplus |
| 168 | } |
| 169 | #endif |
| 170 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 171 | #endif // PUBLIC_FPDF_TRANSFORMPAGE_H_ |