Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: public/fpdf_edit.h

Issue 1265503005: clang-format all pdfium code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: sigh Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef PUBLIC_FPDF_EDIT_H_ 7 #ifndef PUBLIC_FPDF_EDIT_H_
8 #define PUBLIC_FPDF_EDIT_H_ 8 #define PUBLIC_FPDF_EDIT_H_
9 9
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include "fpdfview.h" 12 #include "fpdfview.h"
13 13
14 // Define all types used in the SDK. Note they can be simply regarded as opaque pointers 14 // Define all types used in the SDK. Note they can be simply regarded as opaque
15 // pointers
15 // or long integer numbers. 16 // or long integer numbers.
16 17
17 #define FPDF_ARGB(a,r,g,b) ((((uint32_t)(((uint8_t)(b)|((FX_WORD)((uint8_t) (g))<<8))|(((FX_DWORD)(uint8_t)(r))<<16)))) | (((FX_DWORD)(uint8_t)(a))<<24)) 18 #define FPDF_ARGB(a, r, g, b) \
18 #define FPDF_GetBValue(argb) ((uint8_t)(argb)) 19 ((((uint32_t)(((uint8_t)(b) | ((FX_WORD)((uint8_t)(g)) << 8)) | \
19 #define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8)) 20 (((FX_DWORD)(uint8_t)(r)) << 16)))) | \
20 #define FPDF_GetRValue(argb) ((uint8_t)((argb)>>16)) 21 (((FX_DWORD)(uint8_t)(a)) << 24))
21 #define FPDF_GetAValue(argb) ((uint8_t)((argb)>>24)) 22 #define FPDF_GetBValue(argb) ((uint8_t)(argb))
23 #define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8))
24 #define FPDF_GetRValue(argb) ((uint8_t)((argb) >> 16))
25 #define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24))
22 26
23 #ifdef __cplusplus 27 #ifdef __cplusplus
24 extern "C" { 28 extern "C" {
25 #endif 29 #endif
26 30
27 ////////////////////////////////////////////////////////////////////// 31 //////////////////////////////////////////////////////////////////////
28 // 32 //
29 // Document functions 33 // Document functions
30 // 34 //
31 ////////////////////////////////////////////////////////////////////// 35 //////////////////////////////////////////////////////////////////////
32 36
33 // Function: FPDF_CreateNewDocument 37 // Function: FPDF_CreateNewDocument
34 // Create a new PDF document. 38 // Create a new PDF document.
35 // Parameters: 39 // Parameters:
36 // None. 40 // None.
37 // Return value: 41 // Return value:
38 // A handle to a document. If failed, NULL is returned. 42 // A handle to a document. If failed, NULL is returned.
39 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument(); 43 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument();
40 44
41 ////////////////////////////////////////////////////////////////////// 45 //////////////////////////////////////////////////////////////////////
42 // 46 //
43 // Page functions 47 // Page functions
44 // 48 //
45 ////////////////////////////////////////////////////////////////////// 49 //////////////////////////////////////////////////////////////////////
46 50
47 // Function: FPDFPage_New 51 // Function: FPDFPage_New
48 // Construct an empty page. 52 // Construct an empty page.
49 // Parameters: 53 // Parameters:
50 // document - Handle to document. Returned by FPDF_LoadDocument an d FPDF_CreateNewDocument. 54 // document - Handle to document. Returned by FPDF_LoadDocument
55 // and FPDF_CreateNewDocument.
51 // page_index - The index of a page. 56 // page_index - The index of a page.
52 // width - The page width. 57 // width - The page width.
53 // height - The page height. 58 // height - The page height.
54 // Return value: 59 // Return value:
55 // The handle to the page. 60 // The handle to the page.
56 // Comments: 61 // Comments:
57 // Loaded page can be deleted by FPDFPage_Delete. 62 // Loaded page can be deleted by FPDFPage_Delete.
58 DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, int page_index, double width, double height); 63 DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
64 int page_index,
65 double width,
66 double height);
59 67
60 // Function: FPDFPage_Delete 68 // Function: FPDFPage_Delete
61 // Delete a PDF page. 69 // Delete a PDF page.
62 // Parameters: 70 // Parameters:
63 // document - Handle to document. Returned by FPDF_LoadDocument an d FPDF_CreateNewDocument. 71 // document - Handle to document. Returned by FPDF_LoadDocument
72 // and FPDF_CreateNewDocument.
64 // page_index - The index of a page. 73 // page_index - The index of a page.
65 // Return value: 74 // Return value:
66 // None. 75 // None.
67 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index); 76 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index);
68 77
69 // Function: FPDFPage_GetRotation 78 // Function: FPDFPage_GetRotation
70 // Get the page rotation. One of following values will be returned: 0(0 ), 1(90), 2(180), 3(270). 79 // Get the page rotation. One of following values will be returned:
80 // 0(0), 1(90), 2(180), 3(270).
71 // Parameters: 81 // Parameters:
72 // page - Handle to a page. Returned by FPDFPage_New or FPDF_L oadPage. 82 // page - Handle to a page. Returned by FPDFPage_New or
83 // FPDF_LoadPage.
73 // Return value: 84 // Return value:
74 // The PDF page rotation. 85 // The PDF page rotation.
75 // Comment: 86 // Comment:
76 // The PDF page rotation is rotated clockwise. 87 // The PDF page rotation is rotated clockwise.
77 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page); 88 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page);
78 89
79 // Function: FPDFPage_SetRotation 90 // Function: FPDFPage_SetRotation
80 // Set page rotation. One of following values will be set: 0(0), 1(90), 2(180), 3(270). 91 // Set page rotation. One of following values will be set: 0(0), 1(90),
92 // 2(180), 3(270).
81 // Parameters: 93 // Parameters:
82 // page - Handle to a page. Returned by FPDFPage_New or FPDF_L oadPage. 94 // page - Handle to a page. Returned by FPDFPage_New or
95 // FPDF_LoadPage.
83 // rotate - The value of the PDF page rotation. 96 // rotate - The value of the PDF page rotation.
84 // Return value: 97 // Return value:
85 // None. 98 // None.
86 // Comment: 99 // Comment:
87 // The PDF page rotation is rotated clockwise. 100 // The PDF page rotation is rotated clockwise.
88 // 101 //
89 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate); 102 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate);
90 103
91 // Function: FPDFPage_InsertObject 104 // Function: FPDFPage_InsertObject
92 // Insert an object to the page. The page object is automatically freed . 105 // Insert an object to the page. The page object is automatically
106 // freed.
93 // Parameters: 107 // Parameters:
94 // page - Handle to a page. Returned by FPDFPage_New or FPDF_L oadPage. 108 // page - Handle to a page. Returned by FPDFPage_New or
95 // page_obj - Handle to a page object. Returned by FPDFPageObj_New TextObj,FPDFPageObj_NewTextObjEx and 109 // FPDF_LoadPage.
110 // page_obj - Handle to a page object. Returned by
111 // FPDFPageObj_NewTextObj,FPDFPageObj_NewTextObjEx and
96 // FPDFPageObj_NewPathObj. 112 // FPDFPageObj_NewPathObj.
97 // Return value: 113 // Return value:
98 // None. 114 // None.
99 DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT pag e_obj); 115 DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
116 FPDF_PAGEOBJECT page_obj);
100 117
101 // Function: FPDFPage_CountObject 118 // Function: FPDFPage_CountObject
102 // Get number of page objects inside the page. 119 // Get number of page objects inside the page.
103 // Parameters: 120 // Parameters:
104 // page - Handle to a page. Returned by FPDFPage_New or FPDF_L oadPage. 121 // page - Handle to a page. Returned by FPDFPage_New or
122 // FPDF_LoadPage.
105 // Return value: 123 // Return value:
106 // The number of the page object. 124 // The number of the page object.
107 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page); 125 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page);
108 126
109 // Function: FPDFPage_GetObject 127 // Function: FPDFPage_GetObject
110 // Get page object by index. 128 // Get page object by index.
111 // Parameters: 129 // Parameters:
112 // page - Handle to a page. Returned by FPDFPage_New or FPDF_L oadPage. 130 // page - Handle to a page. Returned by FPDFPage_New or
131 // FPDF_LoadPage.
113 // index - The index of a page object. 132 // index - The index of a page object.
114 // Return value: 133 // Return value:
115 // The handle of the page object. Null for failed. 134 // The handle of the page object. Null for failed.
116 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index); 135 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index);
117 136
118 // Function: FPDFPage_HasTransparency 137 // Function: FPDFPage_HasTransparency
119 // Check that whether the content of specified PDF page contains transp arency. 138 // Check that whether the content of specified PDF page contains
139 // transparency.
120 // Parameters: 140 // Parameters:
121 // page - Handle to a page. Returned by FPDFPage_New or FPDF_L oadPage. 141 // page - Handle to a page. Returned by FPDFPage_New or
142 // FPDF_LoadPage.
122 // Return value: 143 // Return value:
123 // TRUE means that the PDF page does contains transparency. 144 // TRUE means that the PDF page does contains transparency.
124 // Otherwise, returns FALSE. 145 // Otherwise, returns FALSE.
125 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page); 146 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page);
126 147
127 // Function: FPDFPage_GenerateContent 148 // Function: FPDFPage_GenerateContent
128 // Generate PDF Page content. 149 // Generate PDF Page content.
129 // Parameters: 150 // Parameters:
130 // page - Handle to a page. Returned by FPDFPage_New or FPDF_L oadPage. 151 // page - Handle to a page. Returned by FPDFPage_New or
152 // FPDF_LoadPage.
131 // Return value: 153 // Return value:
132 // True if successful, false otherwise. 154 // True if successful, false otherwise.
133 // Comment: 155 // Comment:
134 // Before you save the page to a file, or reload the page, you must cal l the FPDFPage_GenerateContent function. 156 // Before you save the page to a file, or reload the page, you must
157 // call the FPDFPage_GenerateContent function.
135 // Or the changed information will be lost. 158 // Or the changed information will be lost.
136 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page); 159 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page);
137 160
138 ////////////////////////////////////////////////////////////////////// 161 //////////////////////////////////////////////////////////////////////
139 // 162 //
140 // Page Object functions 163 // Page Object functions
141 // 164 //
142 ////////////////////////////////////////////////////////////////////// 165 //////////////////////////////////////////////////////////////////////
143 166
144 // Function: FPDFPageObj_HasTransparency 167 // Function: FPDFPageObj_HasTransparency
145 // Check that whether the specified PDF page object contains transparen cy. 168 // Check that whether the specified PDF page object contains
169 // transparency.
146 // Parameters: 170 // Parameters:
147 // pageObject - Handle to a page object. 171 // pageObject - Handle to a page object.
148 // Return value: 172 // Return value:
149 // TRUE means that the PDF page object does contains transparency. 173 // TRUE means that the PDF page object does contains transparency.
150 // Otherwise, returns FALSE. 174 // Otherwise, returns FALSE.
151 DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObje ct); 175 DLLEXPORT FPDF_BOOL STDCALL
176 FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject);
152 177
153 // Function: FPDFPageObj_Transform 178 // Function: FPDFPageObj_Transform
154 // Transform (scale, rotate, shear, move) page object. 179 // Transform (scale, rotate, shear, move) page object.
155 // Parameters: 180 // Parameters:
156 // page_object - Handle to a page object. Returned by FPDFPageObj_New ImageObj. 181 // page_object - Handle to a page object. Returned by
182 // FPDFPageObj_NewImageObj.
157 // a - The coefficient "a" of the matrix. 183 // a - The coefficient "a" of the matrix.
158 // b - The coefficient "b" of the matrix. 184 // b - The coefficient "b" of the matrix.
159 // c - The coefficient "c" of the matrix. 185 // c - The coefficient "c" of the matrix.
160 // d - The coefficient "d" of the matrix. 186 // d - The coefficient "d" of the matrix.
161 // e - The coefficient "e" of the matrix. 187 // e - The coefficient "e" of the matrix.
162 // f - The coefficient "f" of the matrix. 188 // f - The coefficient "f" of the matrix.
163 // Return value: 189 // Return value:
164 // None. 190 // None.
165 DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, 191 DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
166 double a, double b, double c, double d, double e, do uble f); 192 double a,
193 double b,
194 double c,
195 double d,
196 double e,
197 double f);
167 198
168 // Function: FPDFPage_TransformAnnots 199 // Function: FPDFPage_TransformAnnots
169 // Transform (scale, rotate, shear, move) all annots in a page. 200 // Transform (scale, rotate, shear, move) all annots in a page.
170 // Parameters: 201 // Parameters:
171 // page - Handle to a page. 202 // page - Handle to a page.
172 // a - The coefficient "a" of the matrix. 203 // a - The coefficient "a" of the matrix.
173 // b - The coefficient "b" of the matrix. 204 // b - The coefficient "b" of the matrix.
174 // c - The coefficient "c" of the matrix. 205 // c - The coefficient "c" of the matrix.
175 // d - The coefficient "d" of the matrix. 206 // d - The coefficient "d" of the matrix.
176 // e - The coefficient "e" of the matrix. 207 // e - The coefficient "e" of the matrix.
177 // f - The coefficient "f" of the matrix. 208 // f - The coefficient "f" of the matrix.
178 // Return value: 209 // Return value:
179 // None. 210 // None.
180 DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, 211 DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
181 double a, double b, double c, doubl e d, double e, double f); 212 double a,
213 double b,
214 double c,
215 double d,
216 double e,
217 double f);
182 218
183 // The page object constants. 219 // The page object constants.
184 #define FPDF_PAGEOBJ_TEXT 1 220 #define FPDF_PAGEOBJ_TEXT 1
185 #define FPDF_PAGEOBJ_PATH 2 221 #define FPDF_PAGEOBJ_PATH 2
186 #define FPDF_PAGEOBJ_IMAGE 3 222 #define FPDF_PAGEOBJ_IMAGE 3
187 #define FPDF_PAGEOBJ_SHADING 4 223 #define FPDF_PAGEOBJ_SHADING 4
188 #define FPDF_PAGEOBJ_FORM 5 224 #define FPDF_PAGEOBJ_FORM 5
189 225
190 ////////////////////////////////////////////////////////////////////// 226 //////////////////////////////////////////////////////////////////////
191 // 227 //
192 // Image functions 228 // Image functions
193 // 229 //
194 ////////////////////////////////////////////////////////////////////// 230 //////////////////////////////////////////////////////////////////////
195 231
196 // Function: FPDFPageObj_NewImgeObj 232 // Function: FPDFPageObj_NewImgeObj
197 // Create a new Image Object. 233 // Create a new Image Object.
198 // Parameters: 234 // Parameters:
199 // document - Handle to document. Returned by FPDF_LoadDocumen t or FPDF_CreateNewDocument function. 235 // document - Handle to document. Returned by
236 // FPDF_LoadDocument or FPDF_CreateNewDocument function.
200 // Return Value: 237 // Return Value:
201 // Handle of image object. 238 // Handle of image object.
202 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) ; 239 DLLEXPORT FPDF_PAGEOBJECT STDCALL
203 240 FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document);
204 241
205 // Function: FPDFImageObj_LoadJpegFile 242 // Function: FPDFImageObj_LoadJpegFile
206 // Load Image from a JPEG image file and then set it to an image object . 243 // Load Image from a JPEG image file and then set it to an image
244 // object.
207 // Parameters: 245 // Parameters:
208 // pages - Pointers to the start of all loaded pages, could be NULL. 246 // pages - Pointers to the start of all loaded pages, could
247 // be NULL.
209 // nCount - Number of pages, could be 0. 248 // nCount - Number of pages, could be 0.
210 // image_object - Handle of image object returned by FPDFPageObj_N ewImgeObj. 249 // image_object - Handle of image object returned by
211 // fileAccess - The custom file access handler, which specifies the JPEG image file. 250 // FPDFPageObj_NewImgeObj.
251 // fileAccess - The custom file access handler, which specifies
252 // the JPEG image file.
212 // Return Value: 253 // Return Value:
213 // TRUE if successful, FALSE otherwise. 254 // TRUE if successful, FALSE otherwise.
214 // Note: 255 // Note:
215 // The image object might already has an associated image, which is sha red and cached by the loaded pages, In this case, we need to clear the cache of image for all the loaded pages. 256 // The image object might already has an associated image, which is
257 // shared and cached by the loaded pages, In this case, we need to
258 // clear the cache of image for all the loaded pages.
216 // Pass pages and count to this API to clear the image cache. 259 // Pass pages and count to this API to clear the image cache.
217 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCou nt,FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess); 260 DLLEXPORT FPDF_BOOL STDCALL
218 261 FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages,
262 int nCount,
263 FPDF_PAGEOBJECT image_object,
264 FPDF_FILEACCESS* fileAccess);
219 265
220 // Function: FPDFImageObj_SetMatrix 266 // Function: FPDFImageObj_SetMatrix
221 // Set the matrix of an image object. 267 // Set the matrix of an image object.
222 // Parameters: 268 // Parameters:
223 // image_object - Handle of image object returned by FPDFPageObj_N ewImgeObj. 269 // image_object - Handle of image object returned by
270 // FPDFPageObj_NewImgeObj.
224 // a - The coefficient "a" of the matrix. 271 // a - The coefficient "a" of the matrix.
225 // b - The coefficient "b" of the matrix. 272 // b - The coefficient "b" of the matrix.
226 // c - The coefficient "c" of the matrix. 273 // c - The coefficient "c" of the matrix.
227 // d - The coefficient "d" of the matrix. 274 // d - The coefficient "d" of the matrix.
228 // e - The coefficient "e" of the matrix. 275 // e - The coefficient "e" of the matrix.
229 // f - The coefficient "f" of the matrix. 276 // f - The coefficient "f" of the matrix.
230 // Return value: 277 // Return value:
231 // TRUE if successful, FALSE otherwise. 278 // TRUE if successful, FALSE otherwise.
232 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, 279 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
233 double a, double b, double c, doubl e d, double e, double f); 280 double a,
281 double b,
282 double c,
283 double d,
284 double e,
285 double f);
234 286
235 // Function: FPDFImageObj_SetBitmap 287 // Function: FPDFImageObj_SetBitmap
236 // Set the bitmap to an image object. 288 // Set the bitmap to an image object.
237 // Parameters: 289 // Parameters:
238 // pages - Pointer's to the start of all loaded pages. 290 // pages - Pointer's to the start of all loaded pages.
239 // nCount - Number of pages. 291 // nCount - Number of pages.
240 // image_object - Handle of image object returned by FPDFPageObj_N ewImgeObj. 292 // image_object - Handle of image object returned by
241 // bitmap - The handle of the bitmap which you want to set i t to the image object. 293 // FPDFPageObj_NewImgeObj.
294 // bitmap - The handle of the bitmap which you want to set
295 // it to the image object.
242 // Return value: 296 // Return value:
243 // TRUE if successful, FALSE otherwise. 297 // TRUE if successful, FALSE otherwise.
244 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,F PDF_PAGEOBJECT image_object, FPDF_BITMAP bitmap); 298 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,
299 int nCount,
300 FPDF_PAGEOBJECT image_object,
301 FPDF_BITMAP bitmap);
245 302
246 #ifdef __cplusplus 303 #ifdef __cplusplus
247 } 304 }
248 #endif 305 #endif
249 306
250 #endif // PUBLIC_FPDF_EDIT_H_ 307 #endif // PUBLIC_FPDF_EDIT_H_
OLDNEW
« fpdfsdk/src/javascript/Consts.cpp ('K') | « public/fpdf_doc.h ('k') | public/fpdf_ext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698