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