blob: 569df2a7e097594365de8c5216a0639eef21200d [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.
27*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -070028DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page,
29 float left,
30 float bottom,
31 float right,
32 float top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070033
34/**
Tom Sepez9857e202015-05-13 17:09:26 -070035* 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-Malek3f3b45c2014-05-23 17:28:10 -070041* @retval None.
42*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -070043DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page,
44 float left,
45 float bottom,
46 float right,
47 float top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070048
Tom Sepez9857e202015-05-13 17:09:26 -070049/** Get "MediaBox" entry from the page dictionary.
50* @param[in] page - Handle to a page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070051* @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-Malek3f3b45c2014-05-23 17:28:10 -070059* @retval True if success,else fail.
60*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -070061DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page,
62 float* left,
63 float* bottom,
64 float* right,
65 float* top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070066
Tom Sepez9857e202015-05-13 17:09:26 -070067/** Get "CropBox" entry from the page dictionary.
68* @param[in] page - Handle to a page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070069* @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-Malek3f3b45c2014-05-23 17:28:10 -070077* @retval True if success,else fail.
78*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -070079DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page,
80 float* left,
81 float* bottom,
82 float* right,
83 float* top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070084
85/**
Nico Weber9d8ec5a2015-08-04 13:00:21 -070086* Transform the whole page with a specified matrix, then clip the page content
87* region.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070088*
Tom Sepez9857e202015-05-13 17:09:26 -070089* @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 Weber9d8ec5a2015-08-04 13:00:21 -070092* @Note. This function will transform the whole page, and would take effect to
93* all the objects in the page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070094*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -070095DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
96 FS_MATRIX* matrix,
97 FS_RECTF* clipRect);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070098
99/**
100* Transform (scale, rotate, shear, move) the clip path of page object.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700101* @param[in] page_object - Handle to a page object. Returned by
102* FPDFPageObj_NewImageObj.
Tom Sepez9857e202015-05-13 17:09:26 -0700103* @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-Malek3f3b45c2014-05-23 17:28:10 -0700109* @retval None.
110*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700111DLLEXPORT void STDCALL
112FPDFPageObj_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-Malek3f3b45c2014-05-23 17:28:10 -0700119
120/**
121* Create a new clip path, with a rectangle inserted.
Tom Sepez9857e202015-05-13 17:09:26 -0700122*
123* @param[in] left - The left of the clip box.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700124* @param[in] bottom - The bottom of the clip box.
Tom Sepez9857e202015-05-13 17:09:26 -0700125* @param[in] right - The right of the clip box.
126* @param[in] top - The top of the clip box.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700127* @retval a handle to the clip path.
128*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700129DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left,
130 float bottom,
131 float right,
132 float top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700133
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*/
141DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
142
143/**
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700144* Clip the page content, the page content that outside the clipping region
145* become invisible.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700146*
Tom Sepez9857e202015-05-13 17:09:26 -0700147* @param[in] page - A page handle.
148* @param[in] clipPath - A handle to the clip path.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700149* @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 Sepez326a2a72015-11-20 10:47:32 -0800151* by this clip path.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700152*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700153DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
154 FPDF_CLIPPATH clipPath);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700155
Tom Sepezcf22eb82015-05-12 17:28:08 -0700156#ifdef __cplusplus
157}
158#endif
159
Tom Sepez9857e202015-05-13 17:09:26 -0700160#endif // PUBLIC_FPDF_TRANSFORMPAGE_H_