blob: 21421a18e078ce7452f9e0792e224d0a5f1ce59a [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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 Sepez9857e202015-05-13 17:09:26 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Tom Sepez9857e202015-05-13 17:09:26 -07007#ifndef PUBLIC_FPDF_TRANSFORMPAGE_H_
8#define PUBLIC_FPDF_TRANSFORMPAGE_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070010#include "fpdfview.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070011
Tom Sepezcf22eb82015-05-12 17:28:08 -070012#ifdef __cplusplus
13extern "C" {
14#endif
15
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070016typedef void* FPDF_PAGEARCSAVER;
17typedef void* FPDF_PAGEARCLOADER;
Tom Sepez9857e202015-05-13 17:09:26 -070018
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070019/**
Tom Sepez9857e202015-05-13 17:09:26 -070020* 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-Malek3f3b45c2014-05-23 17:28:10 -070026* @retval None.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070027* @note The method can not support to set this feature for the document which
28* consists of dynamic XFA fields.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070029*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -070030DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page,
31 float left,
32 float bottom,
33 float right,
34 float top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070035
36/**
Tom Sepez9857e202015-05-13 17:09:26 -070037* 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-Malek3f3b45c2014-05-23 17:28:10 -070043* @retval None.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070044* @note The method can not support to set this feature for the document which
45* consists of dynamic XFA fields.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070046*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -070047DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page,
48 float left,
49 float bottom,
50 float right,
51 float top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070052
Tom Sepez9857e202015-05-13 17:09:26 -070053/** Get "MediaBox" entry from the page dictionary.
54* @param[in] page - Handle to a page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070055* @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-Malek3f3b45c2014-05-23 17:28:10 -070063* @retval True if success,else fail.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070064* @note The method can not support to get this feature for the document which
65* consists of dynamic XFA fields.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070066*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -070067DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page,
68 float* left,
69 float* bottom,
70 float* right,
71 float* top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070072
Tom Sepez9857e202015-05-13 17:09:26 -070073/** Get "CropBox" entry from the page dictionary.
74* @param[in] page - Handle to a page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070075* @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-Malek3f3b45c2014-05-23 17:28:10 -070083* @retval True if success,else fail.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070084* @note The method can not support to get this feature for the document which
85* consists of dynamic XFA fields.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070086*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -070087DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page,
88 float* left,
89 float* bottom,
90 float* right,
91 float* top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070092
93/**
Nico Weber9d8ec5a2015-08-04 13:00:21 -070094* Transform the whole page with a specified matrix, then clip the page content
95* region.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070096*
Tom Sepez9857e202015-05-13 17:09:26 -070097* @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 Weber9d8ec5a2015-08-04 13:00:21 -0700100* @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-Malek3f3b45c2014-05-23 17:28:10 -0700104*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700105DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
106 FS_MATRIX* matrix,
107 FS_RECTF* clipRect);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700108
109/**
110* Transform (scale, rotate, shear, move) the clip path of page object.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700111* @param[in] page_object - Handle to a page object. Returned by
112* FPDFPageObj_NewImageObj.
Tom Sepez9857e202015-05-13 17:09:26 -0700113* @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-Malek3f3b45c2014-05-23 17:28:10 -0700119* @retval None.
120*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700121DLLEXPORT void STDCALL
122FPDFPageObj_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-Malek3f3b45c2014-05-23 17:28:10 -0700129
130/**
131* Create a new clip path, with a rectangle inserted.
Tom Sepez9857e202015-05-13 17:09:26 -0700132*
133* @param[in] left - The left of the clip box.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700134* @param[in] bottom - The bottom of the clip box.
Tom Sepez9857e202015-05-13 17:09:26 -0700135* @param[in] right - The right of the clip box.
136* @param[in] top - The top of the clip box.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700137* @retval a handle to the clip path.
138*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700139DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left,
140 float bottom,
141 float right,
142 float top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700143
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*/
151DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
152
153/**
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700154* Clip the page content, the page content that outside the clipping region
155* become invisible.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700156*
Tom Sepez9857e202015-05-13 17:09:26 -0700157* @param[in] page - A page handle.
158* @param[in] clipPath - A handle to the clip path.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700159* @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-Malek3f3b45c2014-05-23 17:28:10 -0700163*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700164DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
165 FPDF_CLIPPATH clipPath);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700166
Tom Sepezcf22eb82015-05-12 17:28:08 -0700167#ifdef __cplusplus
168}
169#endif
170
Tom Sepez9857e202015-05-13 17:09:26 -0700171#endif // PUBLIC_FPDF_TRANSFORMPAGE_H_