blob: f26c077bde60f3a7d27f8bfac905df18ea14f3d9 [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
Dan Sinclair85c8e7f2016-11-21 13:50:32 -050010// NOLINTNEXTLINE(build/include)
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070011#include "fpdfview.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070012
Tom Sepezcf22eb82015-05-12 17:28:08 -070013#ifdef __cplusplus
14extern "C" {
15#endif
16
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070017typedef void* FPDF_PAGEARCSAVER;
18typedef void* FPDF_PAGEARCLOADER;
Tom Sepez9857e202015-05-13 17:09:26 -070019
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020/**
Tom Sepez9857e202015-05-13 17:09:26 -070021* 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-Malek3f3b45c2014-05-23 17:28:10 -070027* @retval None.
28*/
Dan Sinclair00d2ad12017-08-10 14:13:02 -040029FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetMediaBox(FPDF_PAGE page,
30 float left,
31 float bottom,
32 float right,
33 float top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070034
35/**
Tom Sepez9857e202015-05-13 17:09:26 -070036* 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-Malek3f3b45c2014-05-23 17:28:10 -070042* @retval None.
43*/
Dan Sinclair00d2ad12017-08-10 14:13:02 -040044FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page,
45 float left,
46 float bottom,
47 float right,
48 float top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070049
Tom Sepez9857e202015-05-13 17:09:26 -070050/** Get "MediaBox" entry from the page dictionary.
51* @param[in] page - Handle to a page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070052* @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-Malek3f3b45c2014-05-23 17:28:10 -070060* @retval True if success,else fail.
61*/
Dan Sinclair00d2ad12017-08-10 14:13:02 -040062FPDF_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-Malek3f3b45c2014-05-23 17:28:10 -070067
Tom Sepez9857e202015-05-13 17:09:26 -070068/** Get "CropBox" entry from the page dictionary.
69* @param[in] page - Handle to a page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070070* @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-Malek3f3b45c2014-05-23 17:28:10 -070078* @retval True if success,else fail.
79*/
Dan Sinclair00d2ad12017-08-10 14:13:02 -040080FPDF_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-Malek3f3b45c2014-05-23 17:28:10 -070085
86/**
Nico Weber9d8ec5a2015-08-04 13:00:21 -070087* Transform the whole page with a specified matrix, then clip the page content
88* region.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070089*
Tom Sepez9857e202015-05-13 17:09:26 -070090* @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 Weber9d8ec5a2015-08-04 13:00:21 -070093* @Note. This function will transform the whole page, and would take effect to
94* all the objects in the page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070095*/
Dan Sinclair00d2ad12017-08-10 14:13:02 -040096FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
97FPDFPage_TransFormWithClip(FPDF_PAGE page,
98 FS_MATRIX* matrix,
99 FS_RECTF* clipRect);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700100
101/**
102* Transform (scale, rotate, shear, move) the clip path of page object.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700103* @param[in] page_object - Handle to a page object. Returned by
104* FPDFPageObj_NewImageObj.
Tom Sepez9857e202015-05-13 17:09:26 -0700105* @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-Malek3f3b45c2014-05-23 17:28:10 -0700111* @retval None.
112*/
Dan Sinclair00d2ad12017-08-10 14:13:02 -0400113FPDF_EXPORT void FPDF_CALLCONV
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700114FPDFPageObj_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-Malek3f3b45c2014-05-23 17:28:10 -0700121
122/**
123* Create a new clip path, with a rectangle inserted.
Tom Sepez9857e202015-05-13 17:09:26 -0700124*
125* @param[in] left - The left of the clip box.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700126* @param[in] bottom - The bottom of the clip box.
Tom Sepez9857e202015-05-13 17:09:26 -0700127* @param[in] right - The right of the clip box.
128* @param[in] top - The top of the clip box.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700129* @retval a handle to the clip path.
130*/
Dan Sinclair00d2ad12017-08-10 14:13:02 -0400131FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV FPDF_CreateClipPath(float left,
132 float bottom,
133 float right,
134 float top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700135
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 Sinclair00d2ad12017-08-10 14:13:02 -0400143FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700144
145/**
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700146* Clip the page content, the page content that outside the clipping region
147* become invisible.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700148*
Tom Sepez9857e202015-05-13 17:09:26 -0700149* @param[in] page - A page handle.
150* @param[in] clipPath - A handle to the clip path.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700151* @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 Sepez326a2a72015-11-20 10:47:32 -0800153* by this clip path.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700154*/
Dan Sinclair00d2ad12017-08-10 14:13:02 -0400155FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page,
156 FPDF_CLIPPATH clipPath);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700157
Tom Sepezcf22eb82015-05-12 17:28:08 -0700158#ifdef __cplusplus
159}
160#endif
161
Tom Sepez9857e202015-05-13 17:09:26 -0700162#endif // PUBLIC_FPDF_TRANSFORMPAGE_H_