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