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

Side by Side Diff: skia/images/fpdfemb.h

Issue 113827: Remove the remainder of the skia source code from the Chromium repo.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « skia/images/bmpdecoderhelper.cpp ('k') | skia/images/fpdfemb_ext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // FPDFEMB.H - Header file for FPDFEMB SDK
2 // Copyright (c) 2007-2008 Foxit Software Company, All Right Reserved.
3
4 // Date: 2008-04-07
5
6 // Embedded platforms have many different aspects from desktop platforms,
7 // among them, the followings are most important for PDF processing:
8 //
9 // 1. Embedded platforms have only limited memory, and there is no virtual mem ory.
10 // PDF is a very complicated format, processing PDF may consumes qu ite
11 // large amount of memory, even for some smaller PDFs. And, in orde r to
12 // increase the performance of PDF parsing and rendering, cache mem ory
13 // is often used. For some big PDFs with many pages, the cache may grow
14 // while user browing through pages, eventually, for some PDFs, the memory
15 // on the device may run out.
16 //
17 // FPDFEMB SDK allows graceful out-of-memory (OOM) handling by retu rning
18 // OOM error code for all functions that may involve memory allocat ion.
19 // When an application detects OOM situation, it can do one of the followings:
20 //
21 // a) Give user some prompt and quit the application or clo se the document;
22 // b) Or better, try to recover from the error. Sometimes O OM can be caused
23 // by ever-growing cache. For example, when user br owses a 1000-page
24 // document, let's say OOM happen at page #300. In this case, the
25 // application might close the whole document (cach e will be gone with
26 // it), reopen the document, then go directly to pa ge #300. It's likely
27 // the process will go through this time. This is c alled "OOM recovery".
28 // If OOM happens again during a recovery, then, it 's not possible to finish
29 // the process, the application must quit of close the document.
30 //
31 // 2. Embedded platforms has only limited computing power. Since some PDFs
32 // can be very complicated and require a lot of processing to be di splayed,
33 // it may take a lot of time for the process to finish. This may ca use
34 // some problem with user experience, especially for devices like m obile
35 // phones, when an application may need to be put on hold any time. Therefore,
36 // it's important to break lengthy process into small steps which c an be
37 // stopped or resumed at any time. We call this kind of process as
38 // "progressive process".
39 //
40 // FPDFEMB SDK allows progressive page parsing and rendering, the m ost time-
41 // consuming part of PDF processing.
42 //
43 // IMPORTANT:
44 // FPDFEMB module is not intended to run in multi-threaded environm ent.
45
46 // Components inside FPDFEMB:
47 // * Library Memory Management
48 // * Document Operations
49 // * Page Basic Operations
50 // * Page Parsing
51 // * Page Rendering
52 // * Coordination Conversion
53 // * Text Search
54 // * Text Information
55 // * Device Independant Bitmap
56 // * Custom Font Handler and CJK Support
57 // * Bookmark Information
58 // * Hyperlink Information
59 // * Graphic Output
60
61 #ifndef _FPDFEMB_H_
62 #define _FPDFEMB_H_
63
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67
68 // Standard return type for many FPDFEMB functions: FPDFERR_SUCCESS for success, otherwise error code
69 typedef int FPDFEMB_RESULT;
70
71 // Standard boolean type: 0 for false, non-zero for true
72 typedef int FPDFEMB_BOOL;
73
74 // Unicode character. FPDFEMB uses UTF16LE format for unicode string.
75 typedef unsigned short FPDFEMB_WCHAR;
76
77 // Error codes
78 #define FPDFERR_SUCCESS 0
79 #define FPDFERR_MEMORY 1 // Out of memory
80 #define FPDFERR_ERROR 2 // Error of any kind, without sp ecific reason
81 #define FPDFERR_PASSWORD 3 // Incorrect password
82 #define FPDFERR_FORMAT 4 // Not PDF format
83 #define FPDFERR_FILE 5 // File access error
84 #define FPDFERR_PARAM 6 // Parameter error
85 #define FPDFERR_STATUS 7 // Not in correct status
86 #define FPDFERR_TOBECONTINUED 8 // To be continued
87 #define FPDFERR_NOTFOUND 9 // Search result not found
88
89 /******************************************************************************* *************
90 ****
91 **** Library Memory Management
92 ****
93 ******************************************************************************** ************/
94
95 // Structure: FPDFEMB_MEMMGR
96 // Including interfaces implemented by host application, pr oviding memory allocation
97 // facilities. All members are required.
98 // A memory manager structure is required to be valid durin g the entire period
99 // when an application using FPDFEMB module.
100 //
101 // IMPORTANT NOTE: using of this interface is strongly not recommended, because
102 // FPDFEMB now internally use FPDFEMB_MEMMGR_EX interface, which allows more
103 // advanced memory management. This interface is retained f or backward compatibility
104 // only, and maybe discontinued in the future.
105 //
106 struct FPDFEMB_MEMMGR {
107 // Interface: Alloc
108 // Allocate a memory block
109 // Parameters:
110 // pMgr - Pointer to the memory manager.
111 // size - Number of bytes for the memory b lock.
112 // Return Value:
113 // The pointer to allocated memory block. NULL if no memory available.
114 // Comments:
115 // In order to handle OOM situation, application can use lo ngjmp() inside
116 // implementation of this function. If underlying memory ma nager fails to
117 // allocate enough memory, then application can use longjmp () to jump to
118 // OOM handling codes.
119 //
120 void* (*Alloc)(struct FPDFEMB_MEMMGR* pMgr, unsigned int size);
121
122 // Interface: AllocNL
123 // Allocate a memory block, without leaving
124 // Parameters:
125 // pMgr - Pointer to the memory manager.
126 // size - Number of bytes for the memory b lock.
127 // Return Value:
128 // The pointer to allocated memory block. NULL if no memory available.
129 // Comments:
130 // Implementation MUST return NULL if no memory available, no exception
131 // or longjmp() can be used.
132 //
133 void* (*AllocNL)(struct FPDFEMB_MEMMGR* pMgr, unsigned int size);
134
135 // Interfce: Realloc
136 // Reallocate a memory block
137 // Parameters:
138 // pMgr - Pointer to the memory manager.
139 // pointer - An existing memory block, or NUL L.
140 // new_size - New size (number of bytes) of th e memory block. Can be zero.
141 // Return value:
142 // The pointer of reallocated memory block, it could be a n ew block, or just
143 // the previous block with size modified.
144 // Comments:
145 // If an existing memory block specified, the data in the m emory block will
146 // be copied to the new block, if reallocated.
147 //
148 // In order to handle OOM situation, application can use lo ngjmp() inside
149 // implementation of this function. If underlying memory ma nager fails to
150 // allocate enough memory, then application can use longjmp () to jump to
151 // OOM handling codes.
152 //
153 void* (*Realloc)(struct FPDFEMB_MEMMGR* pMgr, void* pointer, unsigned int new_size);
154
155 // Interface: Free
156 // Free a memory block
157 // Parameters:
158 // pMgr - Pointer to the memory manager.
159 // pointer - An existing memory block.
160 // Return Value:
161 // None.
162 //
163 void (*Free)(struct FPDFEMB_MEMMGR* pMgr, void* pointer);
164 };
165
166 // Function: FPDFEMB_Init
167 // Initialize the FPDFEMB module
168 // Parameters:
169 // mem_mgr - Pointer to memory manager struct ure
170 // Return Value:
171 // Error code, or FPDFERR_SUCCESS for success.
172 // Comments:
173 // This function will allocate necessary internal data stru cture for
174 // the whole module to operate.
175 FPDFEMB_RESULT FPDFEMB_Init(FPDFEMB_MEMMGR* mem_mgr);
176
177 typedef void (*FPDFEMB_FIXED_OOM_HANDLER)(void* memory, int size);
178
179 // Function: FPDFEMB_InitFixedMemory
180 // Initialize the FPDFEMB module, providing a fixed memory heap
181 // Parameters:
182 // memory - Pointer to a pre-allocated memor y block
183 // size - Number of bytes in the memory bl ock
184 // oom_handler - Pointer to a function which will be called when OOM happens. Can be
185 // NULL if application does n't want to be notified om OOM.
186 // Return Value:
187 // Error code, or FPDFERR_SUCCESS for success.
188 // Comments:
189 // In many embedded system, memory usage are predetermined. The application
190 // is assigned with fixed size of available memory, then it can pre-allocate
191 // a memory block with maximum size and pass to this functi on to initialize
192 // FPDFEMB module. In this case, FPDFEMB won't need any add itional memory
193 // allocation.
194 //
195 // In case the pre-allocated memory has run out, the "oom_p roc" callback
196 // function will be called to notify the application that a n OOM recovery
197 // procedure needs to be performed.
198 //
199 FPDFEMB_RESULT FPDFEMB_InitFixedMemory(void* memory, int size, FPDFEMB_FIXED_OOM _HANDLER oom_handler);
200
201 // Memory Management Flags
202 #define FPDFEMB_NONLEAVE 1
203 #define FPDFEMB_MOVABLE 2
204 #define FPDFEMB_DISCARDABLE 4
205
206 // Structure: FPDFEMB_MEMMGR_EX
207 // This is an extended version of memory manager interface, allowing advanced
208 // memory management, including movable and discardable mem ory blocks.
209 //
210 // Use this interface with FPDFEMB_InitExt function.
211 //
212 struct FPDFEMB_MEMMGR_EX {
213 // Interface: Alloc
214 // Allocate a memory block
215 // Parameters:
216 // pMgr - Pointer to the memory manager.
217 // size - Number of bytes for the memory b lock.
218 // flags - A combination of flags defined a bove.
219 // Return Value:
220 // The pointer to allocated memory block. NULL if no memory available.
221 // If FPDFEMB_MOVABLE flag is used, implementation should r eturn a handle
222 // to the memory block, if it supports movable block alloca tion.
223 // Comments:
224 // The implementation should not do any action if no memory available,
225 // just return NULL. OOM handling can be done in OOM_Handle r interface.
226 //
227 void* (*Alloc)(struct FPDFEMB_MEMMGR_EX* pMgr, unsigned int size, int flags);
228
229 // Interface: OOM_Handler
230 // OOM (out-of-memory) situation handler
231 // Parameters:
232 // pMgr - Pointer to the memory manager.
233 // Return Value:
234 // None.
235 // Comments:
236 // In order to handle OOM situation, application can use lo ngjmp() inside
237 // implementation of this function.
238 //
239 void (*OOM_Handler)(struct FPDFEMB_MEMMGR_EX* pMgr);
240
241 // Interfce: Realloc
242 // Reallocate a memory block
243 // Parameters:
244 // pMgr - Pointer to the memory manager.
245 // pointer - Pointer to an existing memory bl ock, or handle to a movable
246 // block. Can not be NULL.
247 // new_size - New size (number of bytes) of th e memory block. Can not be zero.
248 // Return value:
249 // The pointer of reallocated memory block, it could be a n ew block, or just
250 // the previous block with size modified.
251 // If FPDFEMB_MOVABLE flag is used, implementation should r eturn a handle
252 // to the memory block, if it supports movable block alloca tion.
253 // Comments:
254 // If an existing memory block specified, the data in the m emory block should
255 // be copied to the new block, if reallocated.
256 //
257 // The implementation should not do any action if no memory available,
258 // just return NULL. OOM handling can be done in OOM_Handle r interface.
259 //
260 void* (*Realloc)(struct FPDFEMB_MEMMGR_EX* pMgr, void* pointer, unsign ed int new_size, int flags);
261
262 // Interface: Lock
263 // Lock a movable memory block
264 // Parameters:
265 // pMgr - Pointer to the memory manager.
266 // handle - Handle to movable memory block, returned by Alloc or Realloc.
267 // Return Value:
268 // The pointer of the memory block. NULL if the block was d iscarded.
269 // Comments:
270 // This interface is optional, if implementation doesn't su pport movable memory
271 // block, then this interface can be set to NULL.
272 //
273 void* (*Lock)(struct FPDFEMB_MEMMGR_EX* pMgr, void* handle);
274
275 // Interface: Unlock
276 // Unlock a locked movable memory block
277 // Parameters:
278 // pMgr - Pointer to the memory manager.
279 // handle - Handle to movable memory block, returned by Alloc or Realloc.
280 // Return Value:
281 // None.
282 // Comments:
283 // This interface is optional, if implementation doesn't su pport movable memory
284 // block, then this interface can be set to NULL.
285 //
286 void (*Unlock)(struct FPDFEMB_MEMMGR_EX* pMgr, void* handle);
287
288 // Interface: Free
289 // Free a memory block
290 // Parameters:
291 // pMgr - Pointer to the memory manager.
292 // pointer - Pointer to an existing memory bl ock, or handle to a movable block.
293 // Return Value:
294 // None.
295 //
296 void (*Free)(struct FPDFEMB_MEMMGR_EX* pMgr, void* pointer, int flags );
297
298 void* user; // A user pointer, used by the application
299 };
300
301 // Function: FPDFEMB_LoadJbig2Decoder
302 // Function: FPDFEMB_LoadJpeg2000Decoder
303 // Enable JBIG2 or JPEG2000 image decoder
304 // Parameters:
305 // None.
306 // Return Value:
307 // None.
308 // Comments:
309 // If you want to display JBIG2 or JPEG2000 encoded images, you need to call
310 // these functions after FPDFEMB initialized.
311 //
312 // Calling these functions will increase code size by about 200K-400K bytes.
313 // Also JPEG2000 decoder may not be available on some platf orms.
314 //
315 void FPDFEMB_LoadJbig2Decoder();
316 void FPDFEMB_LoadJpeg2000Decoder();
317
318 // Function: FPDFEMB_InitEx
319 // Initialize the FPDFEMB module with the extended memory m anager
320 // Parameters:
321 // mem_mgr - Pointer to memory manager struct ure
322 // Return Value:
323 // Error code, or FPDFERR_SUCCESS for success.
324 // Comments:
325 // This function will allocate necessary internal data stru cture for
326 // the whole module to operate.
327 FPDFEMB_RESULT FPDFEMB_InitEx(FPDFEMB_MEMMGR_EX* mem_mgr);
328
329 // Function: FPDFEMB_Exit
330 // Stop using FPDFEMB module and release all resources
331 // Parameters:
332 // None.
333 // Return Value:
334 // None.
335 // Comments:
336 // All loaded documents and pages will become invalid after this call.
337 //
338 // This function is useful for OOM recovery: when your appl ication hits
339 // an OOM situation, calling this function will clear all m emory allocated
340 // by FPDFEMB module, then you can call one of the initiali zation functions,
341 // reopen the document and recovery from OOM.
342 //
343 void FPDFEMB_Exit();
344
345 // Function: FPDFEMB_AllocMemory
346 // Allocate memory
347 // Parameters:
348 // size - Number of bytes
349 // Return Value:
350 // The allocated buffer pointer. NULL for out of memory.
351 //
352 void* FPDFEMB_AllocMemory(unsigned int size);
353
354 // Function: FPDFEMB_FreeMemory
355 // Free allocated memory
356 // Parameters:
357 // pointer - Pointer returned by FPDFEMB_Allo cMemory
358 // Return Value:
359 // None.
360 //
361 void FPDFEMB_FreeMemory(void* pointer);
362
363 // Function: FPDFEMB_FreeCaches
364 // Free all expendable caches used by FPDFEMB in order to s ave memory
365 // Parameters:
366 // None.
367 // Return Value:
368 // None.
369 // Comments:
370 // When an application memory manager runs out of memory, b efore an OOM situation
371 // is raised, the application can try this
372 //
373 void FPDFEMB_FreeCaches();
374
375 /******************************************************************************* *************
376 ****
377 **** Document Operations
378 ****
379 ******************************************************************************** ************/
380
381 // Structure: FPDFEMB_FILE_ACCESS
382 // Describe the way to access a file (readonly).
383 struct FPDFEMB_FILE_ACCESS {
384 // Inteface: GetSize
385 // Get total size of the file
386 // Parameters:
387 // file - Pointer to this file access stru cture
388 // Return Value:
389 // File size, in bytes. Implementation can return 0 for any error.
390 //
391 unsigned int (*GetSize)(struct FPDFEMB_FILE_ACCESS* file);
392
393 // Interface: ReadBlock
394 // Read a data block from the file
395 // Parameters:
396 // file - Pointer to this file access stru cture
397 // buffer - Pointer to a buffer receiving re ad data
398 // offset - Byte offset for the block, from beginning of the file
399 // size - Number of bytes for the block.
400 // Return Value:
401 // Error code, or FPDFERR_SUCCESS for success.
402 //
403 FPDFEMB_RESULT (*ReadBlock)(struct FPDFEMB_FILE_ACCESS* file, void* buf fer,
404 unsigned int offset, unsigned int size);
405
406 void* user; // A user pointer, used by the applicati on
407 };
408
409 // Structure: FPDFEMB_PAUSE
410 // An interface for pausing a progressive process.
411 struct FPDFEMB_PAUSE {
412 // Interface: NeedPauseNow
413 // Check if we need to pause a progressive proccess now
414 // Parameters:
415 // pause - Pointer to the pause structure
416 // Return Value:
417 // Non-zero for pause now, 0 for continue.
418 // Comments:
419 // Typically implementation of this interface compares the current system tick
420 // with the previous one, if the time elapsed exceeds certa in threshold, then
421 // the implementation returns TRUE, indicating a pause is n eeded.
422 //
423 FPDFEMB_BOOL (*NeedPauseNow)(struct FPDFEMB_PAUSE* pause);
424
425 void* user; // A user pointer, used by the applicati on
426 };
427
428 typedef void* FPDFEMB_DOCUMENT;
429
430 // Function: FPDFEMB_StartLoadDocument
431 // Start loading a PDF document
432 // Parameters:
433 // file - Pointer to file access structure .
434 // This structure must be k ept valid as long as the document is open.
435 // password - Pointer to a zero-terminated byt e string, for the password.
436 // Or NULL for no password.
437 // document - Receiving the document handle
438 // pause - A callback mechanism allowing th e document loading process
439 // to be paused before it's finished. This can be NULL if you
440 // don't want to pause.
441 // Return Value:
442 // FPDFERR_SUCCESS: document successfully loaded.
443 // FPDFERR_TOBECONTINUED: The document loading can't be fin ished now.
444 // See comments below.
445 // FPDFERR_PASSWORD: incorrect password.
446 // FPDFERR_FORMAT: not a PDF or corrupted PDF.
447 // FPDFERR_FILE: file access error.
448 // FPDFERR_MEMORY: out of memory.
449 // Comments:
450 // Document loading is a progressive process. It might take a long time to
451 // load a document, especiall when a file is corrupted, FPD FEMB will try to
452 // recover the document contents by scanning the whole file . If "pause" parameter
453 // is provided, this function may return FPDFERR_TOBECONTIN UED any time during
454 // the document loading.
455 //
456 // When FPDFERR_TOBECONTINUED is returned, the "document" p arameter will
457 // still receive a valid document handle, however, no furth er operations can
458 // be performed on the document, except the "FPDFEMB_Contin eLoadDocument" function
459 // call, which resume the document loading.
460 //
461 FPDFEMB_RESULT FPDFEMB_StartLoadDocument(FPDFEMB_FILE_ACCESS* file, const char* password,
462 FPDFEMB_ DOCUMENT* document, FPDFEMB_PAUSE* pause);
463
464 // Function: FPDFEMB_ContinueLoadDocument
465 // Continue loading a PDF document
466 // Parameters:
467 // document - Document handle returned by FPDF EMB_StartLoadDocument function
468 // pause - A callback mechanism allowing th e document loading process
469 // to be paused before it's finished. This can be NULL if you
470 // don't want to pause.
471 // Return Value:
472 // FPDFERR_SUCCESS: document successfully loaded.
473 // FPDFERR_TOBECONTINUED: The document loading can't be fin ished now.
474 // Further call to this function is needed.
475 // FPDFERR_PASSWORD: incorrect password.
476 // FPDFERR_FORMAT: not a PDF or corrupted PDF.
477 // FPDFERR_FILE: file access error.
478 // FPDFERR_MEMORY: out of memory.
479 // FPDFERR_STATUS: document already loaded.
480 // FPDFERR_PARAM: invalid parameter (like NULL document han dle)
481 //
482 FPDFEMB_RESULT FPDFEMB_ContinueLoadDocument(FPDFEMB_DOCUMENT document, FPDFEMB_P AUSE* pause);
483
484 // Function: FPDFEMB_CloseDocument
485 // Close a PDF document and free all associated resources
486 // Parameters:
487 // document - Document handle
488 // Return Value:
489 // Error code. FPDFERR_SUCCESS for success.
490 //
491 FPDFEMB_RESULT FPDFEMB_CloseDocument(FPDFEMB_DOCUMENT document);
492
493 // Function: Get page count
494 // Get number of pages in the document
495 // Parameters:
496 // document - Document handle
497 // Return Value:
498 // Number of pages.
499 //
500 int FPDFEMB_GetPageCount(FPDFEMB_DOCUMENT document);
501
502 // Function: FPDFEMB_SetFileBufferSize
503 // Set size of internal buffer used to read from source fil e.
504 // Parameters:
505 // size - Number of bytes
506 // Return Value:
507 // None.
508 // Comments:
509 // Currently FPDFEMB uses 512 bytes as default buffer size. The new buffer size
510 // takes effect next time you call FPDFEMB_StartLoadDocumen t.
511 //
512 void FPDFEMB_SetFileBufferSize(int size);
513
514 /******************************************************************************* *************
515 ****
516 **** Page Basic Operations
517 ****
518 ******************************************************************************** ************/
519
520 typedef void* FPDFEMB_PAGE;
521
522 // Function: FPDFEMB_LoadPage
523 // Load a page
524 // Parameters:
525 // document - Document handle
526 // index - Page index, starting from zero
527 // page - Receiving the loaded page handle r
528 // Return Value:
529 // Error code, or FPDFERR_SUCCESS for success.
530 //
531 FPDFEMB_RESULT FPDFEMB_LoadPage(FPDFEMB_DOCUMENT document, int index, FPDFEMB_PA GE* page);
532
533 // Function: FPDFEMB_ClosePage
534 // Close a page and release all related resources
535 // Parameters:
536 // page - Page handle
537 // Return Value:
538 // Error code, or FPDFERR_SUCCESS for success.
539 //
540 FPDFEMB_RESULT FPDFEMB_ClosePage(FPDFEMB_PAGE page);
541
542 // Function: FPDFEMB_GetPageSize
543 // Get size of a page
544 // Parameters:
545 // page - Page handle
546 // width - Receiving page width, in hundred th of points
547 // height - Receiving page height, in hundre dth of points
548 // Return Value:
549 // Error code, or FPDFERR_SUCCESS for success
550 //
551 FPDFEMB_RESULT FPDFEMB_GetPageSize(FPDFEMB_PAGE page, int* width, int* height);
552
553 // Structure: FPDFEMB_RECT
554 // Rectangle area in device or page coordination system
555 //
556 struct FPDFEMB_RECT
557 {
558 // For device system, coordinations are measured in pixels;
559 // For page system, coordinations are measured in hundredth of points.
560 int left;
561 int top;
562 int right;
563 int bottom;
564 };
565
566 // Function: FPDFEMB_GetPageBBox
567 // Get displayable area (bounding box) of a page
568 // Parameters:
569 // page - Page handle
570 // rect - Pointer to a structure receiving the rectangle
571 // Return Value:
572 // Error code, or FPDFERR_SUCCESS for success
573 //
574 FPDFEMB_RESULT FPDFEMB_GetPageBBox(FPDFEMB_PAGE page, FPDFEMB_RECT* rect);
575
576 /******************************************************************************* *************
577 ****
578 **** Page Parsing
579 ****
580 ******************************************************************************** ************/
581
582 // Function: FPDFEMB_StartParse
583 // Start parsing a page, so it can get rendered or searched
584 // Parameters:
585 // page - Page handle
586 // text_only - flag for parsing texts only (use d for searching)
587 // pause - A structure that can pause the p arsing process.
588 // Or NULL if you don't wan t to pause the process.
589 // Return Value:
590 // FPDFERR_SUCCESS: parsing successfully finished;
591 // FPDFERR_TOBECONTINUED: parsing started successfully, but not finished;
592 // FPDFERR_STATUS: page already parsed, or parsing already started.
593 // Other return value: error code.
594 // Comments:
595 // Parsing is a progressive process. This function starts t he parsing process,
596 // and may return before parsing is finished, if a pause st ructure is provided.
597 //
598 // Application should call FPDFEMB_ContinueParse repeatedly to finish the parsing
599 // when return value is FPDFERR_TOBECONTINUED.
600 //
601 // There can be only one parsing procedure active for a pag e, and if a page
602 // has already been parsed, you can't start a parsing again .
603 //
604 FPDFEMB_RESULT FPDFEMB_StartParse(FPDFEMB_PAGE page, FPDFEMB_BOOL text_only,
605 FPDFEMB_PAUSE* pause);
606
607 // Function: FPDFEMB_ContinueParse
608 // Continue the page parsing
609 // Parameters:
610 // page - Page handle
611 // pause - A structure that can pause the p arsing process.
612 // Or NULL if you don't wan t to pause the process.
613 // Return Value:
614 // FPDFERR_SUCCESS: parsing successfully finished;
615 // FPDFERR_TOBECONTINUED: parsing performed successfully, b ut not finished;
616 // FPDFERR_STATUS: page already parsed (or parsing not star ted).
617 // Other return value: error code.
618 // Comments:
619 // FPDFEMB_StartParse should be called before on the page.
620 //
621 // Application should call FPDFEMB_ContinueParse repeatedly to finish the parsing
622 // when return value is FPDFERR_TOBECONTINUED.
623 //
624 FPDFEMB_RESULT FPDFEMB_ContinueParse(FPDFEMB_PAGE page, FPDFEMB_PAUSE* pause);
625
626 // Function: FPDFEMB_GetParseProgress
627 // Get an estimated parsing progress in percentage
628 // Parameters:
629 // page - Page handle
630 // Return Value:
631 // An integer between 0 and 100 (inclusive) indicating the parsing progress.
632 // The result is just a rough estimation.
633 //
634 int FPDFEMB_GetParseProgress(FPDFEMB_PAGE page);
635
636 /******************************************************************************* *************
637 ****
638 **** Page Rendering
639 ****
640 ******************************************************************************** ************/
641
642 typedef void* FPDFEMB_BITMAP;
643
644 // Function: FPDFEMB_StartQuickDraw
645 // Start drawing a quick preview of a page
646 // Parameters:
647 // dib - DIB handle, as the rende ring device
648 // page - Page handle. The page has to be parsed first.
649 // start_x - Left pixel position of the displ ay area in the device coordination
650 // start_y - Top pixel position of the displa y area in the device coordination
651 // size_x - Horizontal size (in pixels) for displaying the page
652 // size_y - Vertical size (in pixels) for di splaying the page
653 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
654 // 2 (rotated 180 d egrees), 3 (rotated 90 degrees counter-clockwise).
655 // flags - Reserved, must be zero.
656 // pause - Pointer to a structure that can pause the rendering process.
657 // Can be NULL if no pausin g is needed.
658 // Return Value:
659 // FPDFERR_SUCCESS: quickdraw successly finished;
660 // FPDFERR_TOBECONTINUED: quickdraw started successfully, b ut not finished.
661 // FPDFEMB_ContinueQuickDra w needs to be called to finish the quickdraw;
662 // FPDFERR_STATUS: quickdraw already in progress, or page n ot parsed;
663 // Other return value: error code.
664 // Comments:
665 // It's often useful to present user a quick preview of a p age, right after the
666 // page is parsed. This preview renders only a limited set of easy features in the
667 // page, so it'll be rather quick to finish this process.
668 //
669 FPDFEMB_RESULT FPDFEMB_StartQuickDraw(FPDFEMB_BITMAP dib, FPDFEMB_PAGE page,
670 int start_x, int start_y , int size_x, int size_y, int rotate,
671 int flags, FPDFEMB_PAUSE * pause);
672
673 // Function: FPDFEMB_ContinueQuickDraw
674 // Continue a quick draw processing
675 // Parameters:
676 // page - Page handle. The page has to be parsed first.
677 // pause - Pointer to a structure that can pause the rendering process.
678 // Can be NULL if no pausin g is needed.
679 // Return Value:
680 // FPDFERR_SUCCESS: quickdraw successly finished;
681 // FPDFERR_TOBECONTINUED: quickdraw started successfully, b ut not finished.
682 // more calls to this funct ion needed to finish the quickdraw;
683 // FPDFERR_STATUS: quickdraw not started yet;
684 // Other return value: error code.
685 //
686 FPDFEMB_RESULT FPDFEMB_ContinueQuickDraw(FPDFEMB_PAGE page, FPDFEMB_PAUSE* pause );
687
688 #define FPDFEMB_ANNOT 0x01 // Set if annotations ar e to be rendered
689 #define FPDFEMB_LCD_TEXT 0x02 // Set if using text ren dering optimized for LCD display
690 #define FPDFEMB_BGR_STRIPE 0x04 // Set if the device is using BGR LCD stripe
691
692 // Function: FPDFEMB_StartRender
693 // Start rendering of a page.
694 // Parameter:
695 // dib - DIB handle, as the rende ring device
696 // page - Page handle. The page has to be parsed first.
697 // start_x - Left pixel position of the displ ay area in the device coordination
698 // start_y - Top pixel position of the displa y area in the device coordination
699 // size_x - Horizontal size (in pixels) for displaying the page
700 // size_y - Vertical size (in pixels) for di splaying the page
701 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
702 // 2 (rotated 180 d egrees), 3 (rotated 90 degrees counter-clockwise).
703 // flags - 0 for normal display, or combina tion of flags defined above
704 // clip - Pointer to clip rectangle (in DI B device coordinations),
705 // or NULL if no clipping n eeded.
706 // pause - Pointer to a structure that can pause the rendering process.
707 // Can be NULL if no pausin g is needed.
708 // Return Value:
709 // FPDFERR_SUCCESS: rendering successfully finished;
710 // FPDFERR_TOBECONTINUED: rendering started successfully, b ut not finished;
711 // Other return value: error code.
712 // Comments:
713 // Rendering is a progressive process. This function starts the rendering process,
714 // and may return before rendering is finished, if a pause structure is provided.
715 //
716 // Application should call FPDFEMB_ContinueRender repeatedl y to finish the rendering
717 // when return value is FPDFERR_TOBECONTINUED.
718 //
719 // There can be only one rendering procedure for a page at any time. And rendering
720 // can be started over and over again for the same page. If a page rendering is already
721 // active, starting another one will cancel the previous re ndering.
722 //
723 // Rendering of a page doesn't draw the page background, th erefore, you usually need
724 // to draw the background in the DIB yourself.
725 //
726 FPDFEMB_RESULT FPDFEMB_StartRender(FPDFEMB_BITMAP dib, FPDFEMB_PAGE page,
727 int start_x, int start_y, int si ze_x, int size_y, int rotate, int flags,
728 FPDFEMB_RECT* clip, FPDFEMB_PAUS E* pause);
729
730 // Function: FPDFEMB_ContinueRender
731 // Continue the page rendering
732 // Parameters:
733 // page - Page handle
734 // pause - Pointer to a structure that can pause the rendering process.
735 // Can be NULL if no pausin g is needed.
736 // Return Value:
737 // FPDFERR_SUCCESS: rendering successfully finished.
738 // FPDFERR_TOBECONTINUED: rendering needs to be continued;
739 // Other return value: error code.
740 // Comments:
741 // This function may return any time when the pause interfa ce indicates
742 // a pause is needed. Application can call FPDFEMB_Continue Render any number
743 // of times, until FPDFERR_TOBECONTINUED is not returned.
744 //
745 FPDFEMB_RESULT FPDFEMB_ContinueRender(FPDFEMB_PAGE page, FPDFEMB_PAUSE* pause);
746
747 // Function: FPDFEMB_GetRenderProgress
748 // Get an estimated rendering progress in percentage
749 // Parameters:
750 // page - Page handle
751 // Return Value:
752 // An integer between 0 and 100 (inclusive) indicating the rendering progress.
753 // The result is just a rough estimation.
754 // If the rendering just finished, this function will retur n 0.
755 //
756 int FPDFEMB_GetRenderProgress(FPDFEMB_PAGE page);
757
758 // Function: FPDFEMB_SetHalftoneLimit
759 // Set pixel count limit for using halftone when display im age
760 // Parameter:
761 // limit - Number of pixels for the limit
762 // Return Value:
763 // None.
764 // Comments:
765 // By default, FPDFEMB displays all bitmaps using downsampi ng, which means
766 // if the image is shrinked onto screen, only part of pixel s will be picked
767 // and displayed. This saves a lot of calculation, especial ly for big images
768 // with millions of pixels. However the display quality can be bad. In order to
769 // reach a balance between performance and quality, applica tion can use this
770 // function to set a limit, if number of pixels in an image is more than this
771 // limit, then FPDFEMB will use downsampling for quick draw ing, otherwise, if
772 // the image has less pixels, FPDFEMB will use halftoning f or better quality.
773 //
774 void FPDFEMB_SetHalftoneLimit(int limit);
775
776 /******************************************************************************* *************
777 ****
778 **** Coordination Conversion
779 ****
780 ******************************************************************************** ************/
781
782 // Structure: FPDFEMB_POINT
783 // A point in device or page coordination system
784 //
785 struct FPDFEMB_POINT
786 {
787 // For device system, coordinations are measured in pixels;
788 // For page system, coordinations are measured hundredth of points.
789 int x;
790 int y;
791 };
792
793 // Function: FPDFEMB_DeviceToPagePoint, FPDFEMB_DeviceToPageRect
794 // Convert the device coordinations of a point or a rectang le to page coordinations.
795 // Parameters:
796 // page - Handle to the page. Returned by FPDFEMB_LoadPage function.
797 // start_x - Left pixel position of the displ ay area in the device coordination
798 // start_y - Top pixel position of the displa y area in the device coordination
799 // size_x - Horizontal size (in pixels) for displaying the page
800 // size_y - Vertical size (in pixels) for di splaying the page
801 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
802 // 2 (rotated 180 d egrees), 3 (rotated 90 degrees counter-clockwise).
803 // point - A point structure with device co ordinations upon the call,
804 // also receiving the resul t page coordinations.
805 // rect - A rectangle structure with devic e coordinations upon the call,
806 // also receiving the resul t page coordinations.
807 // Return value:
808 // None.
809 // Comments:
810 // The page coordination system has its origin at left-bott om corner of the page,
811 // with X axis goes along the bottom side to the right, and Y axis goes along the
812 // left side upward. No matter how you zoom, scroll, or rot ate a page, a particular
813 // element (like text or image) on the page should always h ave the same coordination
814 // values in the page coordination system.
815 //
816 // The device coordination system is device dependant. For bitmap device, its origin
817 // is at left-top corner of the window. You must make sure the start_x, start_y, size_x,
818 // size_y and rotate parameters have exactly same values as you used in
819 // FPDFEMB_StartRender() function call.
820 //
821 // For rectangle conversion, the result rectangle is always "normalized", meaning for
822 // page coordinations, left is always smaller than right, b ottom is smaller than top.
823 //
824 void FPDFEMB_DeviceToPagePoint(FPDFEMB_PAGE page,
825 int start_x, int start_y, int si ze_x, int size_y, int rotate,
826 FPDFEMB_POINT* point);
827
828 void FPDFEMB_DeviceToPageRect(FPDFEMB_PAGE page,
829 int start_x, int start_y, int si ze_x, int size_y, int rotate,
830 FPDFEMB_RECT* rect);
831
832 // Function: FPDFEMB_PageToDevicePoint, FPDFEMB_PageToDeviceRect
833 // Convert the page coordinations of a point or a rectangle to device coordinations.
834 // Parameters:
835 // page - Handle to the page. Returned by FPDFEMB_LoadPage function.
836 // start_x - Left pixel position of the displ ay area in the device coordination
837 // start_y - Top pixel position of the displa y area in the device coordination
838 // size_x - Horizontal size (in pixels) for displaying the page
839 // size_y - Vertical size (in pixels) for di splaying the page
840 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
841 // 2 (rotated 180 d egrees), 3 (rotated 90 degrees counter-clockwise).
842 // point - A point structure with page coor dinations upon the call,
843 // also receiving the resul t device coordinations.
844 // rect - A rectangle structure with page coordinations upon the call,
845 // also receiving the resul t device coordinations.
846 // Return value:
847 // None
848 // Comments:
849 // For rectangle conversion, the result rectangle is always "normalized", meaning for
850 // device coordinations, left is always smaller than right, top is smaller than bottom.
851 //
852 void FPDFEMB_PageToDevicePoint(FPDFEMB_PAGE page,
853 int start_x, int start_y, int si ze_x, int size_y, int rotate,
854 FPDFEMB_POINT* point);
855
856 void FPDFEMB_PageToDeviceRect(FPDFEMB_PAGE page,
857 int start_x, int start_y, int si ze_x, int size_y, int rotate,
858 FPDFEMB_RECT* rect);
859
860 /******************************************************************************* *************
861 ****
862 **** Text Search
863 ****
864 ******************************************************************************** ************/
865
866 // Search flags for FPDFEMB_FindFirst function
867 #define FPDFEMB_MATCHCASE 1 // whether matching case
868 #define FPDFEMB_MATCHWHOLEWORD 2 // whether matching whole word
869 #define FPDFEMB_CONSECUTIVE 4 // whether matching cons ecutively (for example, "CC" will
870 // match twice in "CCC").
871
872 // Function: FPDFEMB_FindFirst
873 // Find first occurance of a pattern string in a page
874 // Parameters:
875 // page - Page handle.
876 // pattern - A zero-terminated unicode string to be found.
877 // from_last - Whether we start from the end of page
878 // flags - Search flags, see above defined constants
879 // Return Value:
880 // Error code, or FPDFERR_SUCCESS for success.
881 // Is not found, FPDFERR_NOTFOUND is returned.
882 // Comments:
883 // A page must be parsed first before it can be searched.
884 // There can be only one search in progress for a page. A n ew search will
885 // cancel the previous one.
886 //
887 // IMPORTANT: this function is now obsolete and kept for ba ck compatibility
888 // only, please use FPDFEMB_FindFrom function below.
889 //
890 FPDFEMB_RESULT FPDFEMB_FindFirst(FPDFEMB_PAGE page, const FPDFEMB_WCHAR* pattern ,
891 FPDFEMB_BOOL fr om_last, unsigned int flags);
892
893 // Function: FPDFEMB_FindFrom
894 // Find first occurance of a pattern string in a page, from a particular position
895 // Parameters:
896 // page - Page handle.
897 // pattern - A zero-terminated unicode string to be found.
898 // pos - The position, returned f rom FPDFEMB_GetSearchPos.
899 // Or 0 from the beginning of page, -1 from the end of page.
900 // flags - Search flags, see above defined constants
901 // Return Value:
902 // Error code, or FPDFERR_SUCCESS for success.
903 // Is not found, FPDFERR_NOTFOUND is returned.
904 // Comments:
905 // A page must be parsed first before it can be searched.
906 // There can be only one search in progress for a page. A n ew search will
907 // cancel the previous one.
908 //
909 FPDFEMB_RESULT FPDFEMB_FindFrom(FPDFEMB_PAGE page, const FPDFEMB_WCHAR* pattern,
910 int pos, unsign ed int flags);
911
912 // Function: FPDFEMB_FindNext
913 // Find next occurance of a search
914 // Parameters:
915 // page - Page handle.
916 // FPDFEMB_FindFirst must b e called for this page first.
917 // Return Value:
918 // Error code, or FPDFERR_SUCCESS for success.
919 // Is not found, FPDFERR_NOTFOUND is returned.
920 //
921 FPDFEMB_RESULT FPDFEMB_FindNext(FPDFEMB_PAGE page);
922
923 // Function: FPDFEMB_FindPrev
924 // Find previous occurance of a search
925 // Parameters:
926 // page - Page handle.
927 // FPDFEMB_FindFirst must b e called for this page first.
928 // Return Value:
929 // Error code, or FPDFERR_SUCCESS for success.
930 // Is not found, FPDFERR_NOTFOUND is returned.
931 //
932 FPDFEMB_RESULT FPDFEMB_FindPrev(FPDFEMB_PAGE page);
933
934 // Function: FPDFEMB_CountFoundRects
935 // Get number of rectangles for last found result
936 // Parameters:
937 // page - Page handle.
938 // Return Value:
939 // Number of rectangles for last found result. 0 for not fo und or failure.
940 //
941 int FPDFEMB_CountFoundRects(FPDFEMB_PAGE page);
942
943 // Function: FPDFEMB_GetFoundRect
944 // Get a particular found rectangle
945 // Parameters:
946 // page - Page handle.
947 // index - Zero-based index for the rectang le.
948 // rect - Receiving the result rectangle, in hundredth of points
949 // Return Value:
950 // Error code, or FPDFERR_SUCCESS for success.
951 // Comments:
952 // Application should always call FPDFEMB_CountFoundRects f irst to get
953 // number of rectangles, then use this function to get each rectangle.
954 //
955 // The returned rectangle uses page coordination system.
956 //
957 FPDFEMB_RESULT FPDFEMB_GetFoundRect(FPDFEMB_PAGE page, int index, FPDFEMB_RECT* rect);
958
959 // Function: FPDFEMB_GetSearchPos
960 // Return position of current search result
961 // Parameters:
962 // page - Page handle.
963 // Return Value:
964 // Zero based character index for the current search result . -1 if not found.
965 //
966 int FPDFEMB_GetSearchPos(FPDFEMB_PAGE page);
967
968 // Function: FPDFEMB_QuickSearch
969 // Search a pattern in a page quickly, without the page to be parsed
970 // Parameters:
971 // document - Document handle returned by FPDF EMB_StartLoadDocument function
972 // page_index - Zero-based index of the page
973 // pattern - A zero-terminated unicode string to be found.
974 // case_sensitive - Non-zero for case-sensitive sear ching, zero for case-insensitive
975 // Return Value:
976 // FPDFERR_SUCCESS if pattern found, FPDFERR_NOTFOUND if pa ttern not found.
977 // Otherwise error code is returned.
978 // Comments:
979 // This function does a rough and quick search in a page, b efore the page is loaded.
980 // The quick search will not generate an exact result sayin g where the pattern is
981 // found, and, it might be possible if a quick search resul t is "pattern found", and
982 // a real search for the same pattern, in the same page, wi ll result in "not found".
983 //
984 // However, if quick search doesn't find a pattern in a pag e, then we can be sure the
985 // pattern won't be found in this page when we do a real se arch. So, this function is
986 // very useful when we search in a multiple-page document, and we want to quickly skip
987 // those pages in which the pattern can't possibly be found .
988 //
989 FPDFEMB_RESULT FPDFEMB_QuickSearch(FPDFEMB_DOCUMENT document, int page_index,
990 const FPDFEMB _WCHAR* pattern, int case_sensitive);
991
992 /******************************************************************************* *************
993 ****
994 **** Text Information
995 ****
996 ******************************************************************************** ************/
997
998 // Function: FPDFEMB_GetCharCount
999 // Get number of characters in the page
1000 // Parameters:
1001 // page - Page handle
1002 // count - Receiving number of characters
1003 // Return Value:
1004 // Error code, or FPDFERR_SUCCESS for success.
1005 //
1006 FPDFEMB_RESULT FPDFEMB_GetCharCount(FPDFEMB_PAGE page, int* count);
1007
1008 // Structure: FPDFEMB_CHAR_INFO
1009 // Character information.
1010 struct FPDFEMB_CHAR_INFO {
1011 int unicode; // Unicode for the character. 0 if not available.
1012 // Space and new line ch arcters (U+0020 and U+000A) may be generated
1013 // according to the text formatting.
1014 FPDFEMB_POINT origin; // X/Y position for the character origin, in hun dredth of points
1015 FPDFEMB_RECT bbox; // Bounding box of the character, in hundredth o f points
1016 // Maybe an empty box (l eft == right or top == bottom).
1017 };
1018
1019 // Function: FPDFEMB_GetCharInfo
1020 // Get character information
1021 // Parameters:
1022 // page - Page handle
1023 // index - Character index, starting from z ero
1024 // char_info - Receiving the character info
1025 // Return Value:
1026 // Error code, or FPDFERR_SUCCESS for success
1027 // Comments:
1028 // Application must call FPDFEMB_GetCharCount first before it can call this function
1029 // for any particular characters.
1030 //
1031 FPDFEMB_RESULT FPDFEMB_GetCharInfo(FPDFEMB_PAGE page, int index, FPDFEMB_CHAR_IN FO* char_info);
1032
1033 // Function: FPDFEMB_GetCharIndexAtPos()
1034 // Get index of character nearest to a certain position on the page
1035 // Parameters:
1036 // page - Page handle
1037 // x - X position in PDF page c oordination system
1038 // y - Y position in PDF page c oordination system
1039 // index - Pointer to an integer receiving zero-based character index.
1040 // Return Value:
1041 // Error code, or FPDFERR_SUCCESS for success
1042 // Comments:
1043 // This function finds the character that's nearest to the particular page position.
1044 // If there is no character, the output index will be -1.
1045 //
1046 FPDFEMB_RESULT FPDFEMB_GetCharIndexAtPos(FPDFEMB_PAGE page, double x, double y, int* index);
1047
1048 /******************************************************************************* *************
1049 ****
1050 **** Device Independant Bitmap
1051 ****
1052 ******************************************************************************** ************/
1053
1054 #define FPDFDIB_BGR 1 // 3 bytes per pixel, byte order: Blue, Green, Red
1055 #define FPDFDIB_BGRx 2 // 4 bytes per pixel, byte order: Blue, Green, R ed, not used
1056 #define FPDFDIB_BGRA 3 // 4 bytes per pixel, byte order: Blue, Green, R ed, Alpha
1057 #define FPDFDIB_GRAY 4 // 1 byte per pixel (grayscale)
1058
1059 // Function: FPDFEMB_CreateDIB
1060 // Create a DIB (Device Independant Bitmap)
1061 // Parameters:
1062 // width - Width pixels;
1063 // height - Height pixels;
1064 // format - Format type. See FPDFDIB_xxx con stants
1065 // buffer - External buffer provided for the DIB,
1066 // or NULL if new buffer is to be allocated.
1067 // stride - Number of bytes for each scan li ne, for external buffer only.
1068 // If not specified, 4-byte alignment assumed.
1069 // dib - Receiving the created DI B handle
1070 // Return Value:
1071 // Error code, or FPDFERR_SUCCESS for success
1072 // Comments:
1073 // If "buffer" parameter is not NULL, then the provided buf fer must conform
1074 // to standard DIB format (see comments of FPDFEMB_GetDIBDa ta function below).
1075 //
1076 // This function doesn't initialize the pixels inside the D IB buffer. So if you
1077 // want to use the DIB to display a PDF page, you usually n eed to initialize
1078 // the DIB to white background by youself.
1079 //
1080 FPDFEMB_RESULT FPDFEMB_CreateDIB(int width, int height, int format,
1081 void* buffer, int stride, FPDFEMB_BITMAP* dib);
1082
1083 // Function: FPDFEMB_DestroyDIB
1084 // Destroy a DIB
1085 // Parameters:
1086 // dib - DIB handle
1087 // Return Value:
1088 // Error code, or FPDFERR_SUCCESS for success
1089 // Comments:
1090 // If external buffer is used (specified in "buffer" parame ter when calling
1091 // FPDFEMB_CreateDIB), the buffer will not be destroyed.
1092 //
1093 FPDFEMB_RESULT FPDFEMB_DestroyDIB(FPDFEMB_BITMAP dib);
1094
1095 // Function: FPDFEMB_GetDIBWidth
1096 // Get width (in pixels) of a DIB
1097 // Parameters:
1098 // dib - DIB handle
1099 // Return Value:
1100 // DIB width in pixels.
1101 //
1102 int FPDFEMB_GetDIBWidth(FPDFEMB_BITMAP dib);
1103
1104 // Function: FPDFEMB_GetDIBHeight
1105 // Get height (in pixels) of a DIB
1106 // Parameters:
1107 // dib - DIB handle
1108 // Return Value:
1109 // DIB height in pixels.
1110 //
1111 int FPDFEMB_GetDIBHeight(FPDFEMB_BITMAP dib);
1112
1113 // Function: FPDFEMB_GetDIBData
1114 // Get data pointer to a DIB
1115 // Parameters:
1116 // dib - DIB handle
1117 // Return Value:
1118 // Pointer to the DIB data.
1119 // Comments:
1120 // DIB data are organized in scanlines, from top down.
1121 //
1122 void* FPDFEMB_GetDIBData(FPDFEMB_BITMAP dib);
1123
1124 // Function: FPDFEMB_GetDIBStride
1125 // Get scan line stride of a DIB
1126 // Parameters:
1127 // dib - DIB handle
1128 // Return Value:
1129 // Number of bytes occupied by a scanline
1130 //
1131 int FPDFEMB_GetDIBStride(FPDFEMB_BITMAP dib);
1132
1133 // Function: FPDFEMB_GetRotatedDIB
1134 // Swap X/Y dimensions of a DIB to generate a rotated new D IB
1135 // Parameters:
1136 // dib - DIB handle
1137 // flip_x - Whether flip pixels on the desti nation X dimension (left/right)
1138 // flip_y - Whether flip pixels on the desti nation Y dimension (up/down)
1139 // result_dib - Receiving the result DIB handle
1140 // Return Value:
1141 // Error code, or FPDFERR_SUCCESS for success
1142 //
1143 FPDFEMB_RESULT FPDFEMB_GetRotatedDIB(FPDFEMB_BITMAP dib,
1144 FPDFEMB _BOOL bFlipX, FPDFEMB_BOOL bFlipY,
1145 FPDFEMB _BITMAP* result_dib);
1146
1147 // Function: FPDFEMB_StretchDIB
1148 // Stretch a source DIB into another destination DIB
1149 // Parameters:
1150 // dest_dib - The destination DIB handle
1151 // dest_left - Left position in the destination DIB
1152 // dest_top - Top position in the destination DIB
1153 // dest_width - Destination width, in pixels. Ca n be negative for horizontal flipping
1154 // dest_height - Destination height, in pixels. C an be negative for vertical flipping
1155 // clip - Destination clipping rectangle, or NULL for no clipping.
1156 // The coordinations are me asured in destination bitmap.
1157 // src_dib - Source DIB handle.
1158 // interpol - Whether we use interpolation to improve the result quality
1159 // Return Value:
1160 // Error code, or FPDFERR_SUCCESS for success
1161 //
1162 FPDFEMB_RESULT FPDFEMB_StretchDIB(FPDFEMB_BITMAP dest_dib, int dest_left, int de st_top,
1163 int dest_width , int dest_height, FPDFEMB_RECT* clip_rect,
1164 FPDFEMB_BITMAP src_dib, FPDFEMB_BOOL interpol);
1165
1166 // Function: FPDFEMB_TransformDIB
1167 // Transform a source DIB into another destination DIB
1168 // Parameters:
1169 // dest_dib - The destination DIB handle
1170 // clip - Destination clipping rectangle, or NULL for no clipping.
1171 // The coordinations are me asured in destination bitmap.
1172 // src_dib - Source DIB handle.
1173 // x - X coordination of the de st origin
1174 // y - Y coordination of the de st origin
1175 // xx - X distance of the dest X vector
1176 // yx - Y distance of the dest X vector
1177 // xy - X distance of the dest Y vector
1178 // yy - Y distance of the dest Y vector
1179 // interpol - Whether we use interpolation to improve the result quality
1180 // Return Value:
1181 // Error code, or FPDFERR_SUCCESS for success
1182 // Comments:
1183 // All coordinations and distances are measured in destinat ion bitmap system.
1184 //
1185 // This function places the bottom-left pixel of the image at the destination
1186 // origin, then the bottom sideline along the destination X vector, and left
1187 // sideline along the destination Y vector.
1188 //
1189 FPDFEMB_RESULT FPDFEMB_TransformDIB(FPDFEMB_BITMAP dest_dib, FPDFEMB_RECT* clip_ rect,
1190 FPDFEMB_BITMAP src_dib, int x, int y, int xx, int yx,
1191 int xy, int yy , FPDFEMB_BOOL interpol);
1192
1193 /******************************************************************************* *************
1194 ****
1195 **** Custom Font Handler and CJK Support
1196 ****
1197 ******************************************************************************** ************/
1198
1199 // FPDFEMB comes with standard fonts for Latin characters. If your device is tar geted to
1200 // Eastern Asian markets, then system fonts must be provided and registered with FPDFEMB.
1201 // Depending on your device configuration, those system fonts might be in TrueTy pe or Type1
1202 // format, or some other non-standard compact format. For the first case, you sh ould register
1203 // a font mapper so FPDFEMB can pick the right font file, and for the second cas e, you
1204 // should register a glyph provider so FPDFEMB can get glyph bitmap for each cha racter.
1205
1206 #define FPDFEMB_CHARSET_DEFAULT 0
1207 #define FPDFEMB_CHARSET_GB 936
1208 #define FPDFEMB_CHARSET_BIG5 950
1209 #define FPDFEMB_CHARSET_JIS 932
1210 #define FPDFEMB_CHARSET_KOREA 949
1211 #define FPDFEMB_CHARSET_UNICODE 1200
1212
1213 #define FPDFEMB_FONT_FIXEDPITCH 1
1214 #define FPDFEMB_FONT_SERIF 2
1215 #define FPDFEMB_FONT_SYMBOLIC 4
1216 #define FPDFEMB_FONT_SCRIPT 8
1217 #define FPDFEMB_FONT_NONSYMBOLIC 32
1218 #define FPDFEMB_FONT_ITALIC 64
1219 #define FPDFEMB_FONT_ALLCAP 0x10000
1220 #define FPDFEMB_FONT_SMALLCAP 0x20000
1221 #define FPDFEMB_FONT_FORCEBOLD 0x40000
1222
1223 // Structure: FPDFEMB_FONT_MAPPER
1224 // Defines interface for system font mapper.
1225 //
1226 struct FPDFEMB_FONT_MAPPER
1227 {
1228 // Interface: MapFont
1229 // Find font file path for a particular PDF font
1230 // Parameters:
1231 // mapper - Pointer to the FPDFEMB_FONT_MAPP ER structure
1232 // name - Font name
1233 // charset - Charset ID (see above FPDFEMB_CH ARSET_xxx constants)
1234 // flags - Font flags (see above FPDFEMB_FO NT_xxx constants)
1235 // weight - Weight of the font. Range from 1 00 to 900. 400 is normal,
1236 // 700 is bold.
1237 // path - Receiving the full file path. Th e buffer size is 512 bytes.
1238 // face_index - Receiving an zero-based index va lue for the font face, if the
1239 // mapped font file is a "c ollection" (meaning a number of faces
1240 // are stored in the same f ile). If the font file is not a
1241 // collection, the index va lue should be zero.
1242 // Return Value:
1243 // Non-zero for success, 0 for failure.
1244 //
1245 FPDFEMB_BOOL (*MapFont)(struct FPDFEMB_FONT_MAPPER* mapper, const cha r* name, int charset,
1246 unsigned int flags, int weight,
1247 char* pa th, int* face_index);
1248
1249 void* user; // A user pointer, used by the applicati on
1250 };
1251
1252 // Function: FPDFEMB_SetFontMapper
1253 // Use a system font mapper (typically for Chinese/Japanese /Korean charsets)
1254 // Parameters:
1255 // mapper - Pointer to FPDFEMB_FONT_MAPPER s tructure.
1256 // Return Value:
1257 // Error code, or FPDFERR_SUCCESS for success
1258 // Comments:
1259 // This function is used with devices that come with one or more system fonts,
1260 // and those fonts are in standard TT or T1 format.
1261 //
1262 FPDFEMB_RESULT FPDFEMB_SetFontMapper(FPDFEMB_FONT_MAPPER* mapper);
1263
1264 // Structure: FPDFEMB_GLYPH_PROVIDER
1265 // Interface for providing glyph bitmap of non-latin charac ters.
1266 // This is usually used for embedded devices with Chinese/J apanese/Korean
1267 // fonts installed, but those fonts are not in TrueType or Type1 format.
1268 //
1269 struct FPDFEMB_GLYPH_PROVIDER
1270 {
1271 // Interface: MapFont
1272 // Return an internal handle for a font
1273 // Parameters:
1274 // provider - Pointer to this structure
1275 // name - Font name
1276 // charset - Charset ID (see above FPDFEMB_CH ARSET_xxx constants)
1277 // flags - Font flags (see above FPDFEMB_FO NT_xxx constants)
1278 // weight - Weight of the font. Range from 1 00 to 900. 400 is normal,
1279 // 700 is bold.
1280 // Return Value:
1281 // An internal handle to the mapped font. If the embedded d evice supports
1282 // multiple fonts, then this value can serve as an identifi er to differentiate
1283 // among them. If the device supports only one font, then i mplementation of
1284 // this function can simply return NULL.
1285 //
1286 void* (*MapFont)(struct FPDFEMB_GLYPH_PROVIDER* provider, const char* name, int charset,
1287 unsigned int flags, int weight);
1288 // Interface: GetGlyphBBox
1289 // Get glyph bounding box
1290 // Parameters:
1291 // provider - Pointer to this structure
1292 // font - Internal handle to the font. Ret urned by MapFont interface.
1293 // unicode - Unicode of the character
1294 // CID - Adobe CID for this chara cter. Or zero if not available.
1295 // bbox - Receiving the result bounding bo x. See comments below.
1296 // Return Value:
1297 // None.
1298 // Comments:
1299 // The bounding box is measure in a glyph coordination syst em, in which the
1300 // origin is set to character origin, and unit is set to on e-thousandth of
1301 // "em size" (representing the font size).
1302 //
1303 // In most CJK fonts, all CJK characters (except some symbo ls or western
1304 // characters) have same glyph bounding box:
1305 // left = 0, right = 1000, bottom = -220, top = 780.
1306 //
1307 // It's OK to return a box that's larger than the actual gl yph box.
1308 //
1309 void (*GetGlyphBBox)(struct FPDFEMB_GLYPH_PROVIDER* provider, void* f ont,
1310 FPDFEMB_ WCHAR unicode, unsigned short CID,
1311 FPDFEMB_ RECT* bbox);
1312
1313 // Interface: GetGlyphBitmap
1314 // Get bitmap of a glyph
1315 // Parameters:
1316 // provider - Pointer to this structure
1317 // font - Internal handle to the font. Ret urned by MapFont interface.
1318 // unicode - Unicode of the character
1319 // CID - Adobe CID for this chara cter. Or zero if not available.
1320 // font_width - Width of the font em square, mea sured in device units.
1321 // font_height - Height of the font em square, me asured in device units.
1322 // left - Receiving the left offset, from the character origin, of the
1323 // result glyph bitmap. Pos itive value will move the bitmap to
1324 // the right side, negative to the left.
1325 // top - Receiving the top offset , from the character origin, of the
1326 // result glyph bitmap. Pos itive value will move the bitmap upward,
1327 // negative downward.
1328 // bitmap_width - Receiving number of width pixels in the result bitmap
1329 // bitmap_height - Receiving number of height pixels in the result bitmap
1330 // buffer - Receiving a data buffer pointer, allocated by the implementation.
1331 // See comments below.
1332 // stride - Receiving number of bytes per sc anline, in the data buffer.
1333 // pdf_width - Width of the character specified in PDF. It is measured in one-
1334 // thousandth of the font w idth. It can be 0 if width not specified
1335 // in PDF. See comments bel ow.
1336 // Return Value:
1337 // Non-zero for success. 0 for failure. In this case the gl yph can not be displayed.
1338 // Comments:
1339 // The buffer should be allocated by implemenation. And it must be allocated
1340 // using FPDFEMB_AllocMemory function. The result buffer wi ll be destroyed by
1341 // FPDFEMB SDK, so implementation should not destroy it.
1342 //
1343 // The implementation should write "coverage" data into all ocated buffer, one byte
1344 // for each pixel, from top scanline to bottom scanline, wi thin each scan line,
1345 // from left pixel to right. Coverage 0 means the pixel is outside the glyph,
1346 // coverage 255 means the pixel is inside the glyph.
1347 //
1348 // The "pdf_width" parameter can be used to scale the chara cter in system font
1349 // horizontally to match the font width specified in PDF. F or example, if we have
1350 // a PDF file which requires a character in half-width (pdf _width is 500), but
1351 // in the system font the character has full-width (1000), then the glyph provider
1352 // implementation should scale the font horizontally to hal f of its original width.
1353 //
1354 FPDFEMB_BOOL (*GetGlyphBitmap)(struct FPDFEMB_GLYPH_PROVIDER* provider, void* font,
1355 FPDFEMB_ WCHAR unicode, unsigned short CID,
1356 double f ont_width, double font_height, int* left, int* top,
1357 int* bit map_width, int* bitmap_height,
1358 void** b uffer, int* stride, int pdf_width);
1359
1360 void* user; // A user pointer, used by the applicati on
1361 };
1362
1363 // Function: FPDFEMB_SetGlyphProvider
1364 // Make use of a glyph provider: generating glyph bitmap fo r non-Latin characters
1365 // Parameters:
1366 // provider - Pointer to the glyph provider st ructure.
1367 // This structure must stay valid throughout usage of FPDFEMB module.
1368 // Return Value:
1369 // None.
1370 // Comments:
1371 // FPDFEMB embeds some standard fonts for Latin characters and symbols, like
1372 // Times, Courier and Helvetica (Arial). For non-Latin char acters, however,
1373 // FPDFEMB has to ask glyph provide for help.
1374 //
1375 // If an embedded device carries fonts for non-Latin charac ter sets, especially
1376 // those for CJK markets, then the application can implemen t a glyph provider,
1377 // allowing PDFs using non-embedded CJK fonts to be properl y displayed.
1378 //
1379 void FPDFEMB_SetGlyphProvider(FPDFEMB_GLYPH_PROVIDER* provider);
1380
1381 // Function: FPDFEMB_LoadCMap_GB
1382 // Function: FPDFEMB_LoadCMap_GB_Ext
1383 // Function: FPDFEMB_LoadCMap_CNS
1384 // Function: FPDFEMB_LoadCMap_Korean
1385 // Function: FPDFEMB_LoadCMap_Japan
1386 // Function: FPDFEMB_LoadCMap_Japan_Ext
1387 // Make use of character encoding maps embedded with FPDFEM B
1388 // Parameters:
1389 // None.
1390 // Return Value:
1391 // None.
1392 // Comments:
1393 // These functions add character encoding data to your appl ication. Each call
1394 // will increase the code size of your application. Total d ata size for all
1395 // character sets is 151K bytes.
1396 void FPDFEMB_LoadCMap_GB();
1397 void FPDFEMB_LoadCMap_GB_Ext(); // Load full code table for GB
1398 void FPDFEMB_LoadCMap_CNS();
1399 void FPDFEMB_LoadCMap_Korea();
1400 void FPDFEMB_LoadCMap_Japan();
1401 void FPDFEMB_LoadCMap_Japan_Ext(); // Load full code table for Japan
1402
1403 /******************************************************************************* *************
1404 ****
1405 **** Document Information
1406 ****
1407 ******************************************************************************** ************/
1408
1409 // Function: PDFEMB_GetDocInfoString
1410 // Get information string about the document, like creator, modifcation date, etc.
1411 // Parameters:
1412 // document - Handle to the document
1413 // key - A byte string for the in formation key. Currently can be one of the followings:
1414 // "Title", "Author", "Subj ect", "Keywords", "Creator", "Producer", "CreationDate",
1415 // "ModDate", or some custo m information key, if supported by the PDF file.
1416 // buffer - A buffer allocated by the applic ation, or NULL.
1417 // bufsize - [IN/OUT] A pointer to a number i ndicating the buffer size (number of bytes),
1418 // before this function cal l. After return, this place will store
1419 // number of bytes used by the output (including terminator).
1420 // Return Value:
1421 // Error code, or FPDFERR_SUCCESS for success
1422 // Comments:
1423 // The string is output in Unicode, using UTF-16LE format. It's terminated by
1424 // two consecutive zero bytes.
1425 //
1426 // If the "buffer" parameter is NULL, then the "bufsize" pa rameter will receive
1427 // number of bytes required to store the string (including the two-byte terminator).
1428 //
1429 FPDFEMB_RESULT FPDFEMB_GetDocInfoString(FPDFEMB_DOCUMENT document, const char* k ey, void* buffer, unsigned int* bufsize);
1430
1431 /******************************************************************************* *************
1432 ****
1433 **** Action (Destination) Information
1434 ****
1435 ******************************************************************************** ************/
1436
1437 typedef void* FPDFEMB_ACTION;
1438
1439 // Action types supported by FPDFEMB
1440 #define FPDFEMB_DEST_NONE 0 // No or unsuppo rted destination
1441 #define FPDFEMB_DEST_PAGE 1 // A page inside the same document
1442 #define FPDFEMB_DEST_DOC 2 // An external P DF document
1443 #define FPDFEMB_DEST_URL 3 // An external U RL
1444 #define FPDFEMB_ACTION_LAUNCH 4 // Launch an external fi le or command
1445
1446 // Zoom mode for destination
1447 #define FPDFEMB_ZOOM_NONE 0 // Zoom mode not specified
1448 #define FPDFEMB_ZOOM_FACTOR 1 // Specific zoom factor is used
1449 #define FPDFEMB_ZOOM_FITPAGE 2 // Fit the whole page on screen
1450 #define FPDFEMB_ZOOM_FITWIDTH 3 // Fit width of the page on screen
1451 #define FPDFEMB_ZOOM_FITHEIGHT 4 // Fit height of the pag e on screen
1452 #define FPDFEMB_ZOOM_FITRECT 5 // Fit a particular rect angle on screen
1453 #define FPDFEMB_ZOOM_FITCONTENT 6 // Fit whole content of page on screen
1454 #define FPDFEMB_ZOOM_FITCONTENTW 7 // Fit content width of page on screen
1455 #define FPDFEMB_ZOOM_FITCONTENTH 8 // Fit content height of page on screen
1456
1457 // Data structure for page destination
1458 struct FPDFEMB_PAGEDEST
1459 {
1460 int page_index; // Zero based in dex for the page
1461 int zoom_mode; // See FPDFEMB_Z OOM_xxx definition above
1462 int zoom_factor; // For FPDFEMB_ZOOM_FACT OR only: the zoom factor (in percentage)
1463 FPDFEMB_RECT position; // Specify position inside the p age. Depends on the zoom mode,
1464 // diffe rent members of the rectangle are used:
1465 // FPDFE MB_ZOOM_NONE: left, top
1466 // FPDFE MB_ZOOM_FACTOR: left, top
1467 // FPDFE MB_ZOOM_FITPAGE: none
1468 // FPDFE MB_ZOOM_FITWIDTH: top
1469 // FPDFE MB_ZOOM_FITHEIGHT: left
1470 // FPDFE MB_ZOOM_FITRECT: left, top, bottom, right
1471 // FPDFE MB_ZOOM_FITCONTENT: none
1472 // FPDFE MB_ZOOM_FITCONTENTW: top
1473 // FPDFE MB_ZOOM_FITCONTENTH: left
1474 };
1475
1476 // Data structure for document destination
1477 struct FPDFEMB_DOCDEST
1478 {
1479 FPDFEMB_PAGEDEST page_data; // page data
1480 char* file_name; // The file name, encode d in original charset (maybe MBCS)
1481 };
1482
1483 // Data structure for URL destination
1484 struct FPDFEMB_URLDEST
1485 {
1486 char* url; // URL encoded in 7-bit ASCII
1487 };
1488
1489 // Data structure for Launch action
1490 struct FPDFEMB_LAUNCHACTION
1491 {
1492 int new_window; // Whether a new window should be opened
1493 char* file_name; // The file name, encode d in original charset (maybe MBCS)
1494 };
1495
1496 // Function: FPDFEMB_Action_GetType
1497 // Get type of an action
1498 // Parameters:
1499 // document - Handle to the document
1500 // action - Handle to the action
1501 // dest_type - Pointer to an integer receiving type of the destination. See the above
1502 // FPDFEMB_DEST_xxx definit ions
1503 // data_size - Pointer to an integer receiving data block size for the destination.
1504 // If this parameter is NUL L, then data size won't be retrieved.
1505 // Comments:
1506 // Each different type of destination has different data st ructure. The "data_size" result
1507 // indicates how many bytes is required to hold the destina tion data structure. The application
1508 // can then allocate sufficient buffer and then call FPDFEM B_Bookmark_GetDest function to
1509 // get the real data.
1510 //
1511 FPDFEMB_RESULT FPDFEMB_Action_GetType(FPDFEMB_DOCUMENT document, FPDFEMB_ACTION action, int* dest_type, int* data_size);
1512
1513 // Function: FPDFEMB_Action_GetData
1514 // Get detailed data of a particular action
1515 // Parameters:
1516 // document - Handle to the document
1517 // action - Handle to the action
1518 // buffer - Application allocated buffer rec eiving the destination data
1519 // Return Value:
1520 // Error code, or FPDFERR_SUCCESS for success.
1521 // Comments:
1522 // See data structure definition for different action type above. Please note
1523 // the actual action data might use more space than the str ucture definition
1524 // shows, to store things like file name or URL. So you sho uld always call
1525 // FPDFEMB_Action_GetType first to get data size then alloc ate enough buffer
1526 // for this call.
1527 //
1528 FPDFEMB_RESULT FPDFEMB_Action_GetData(FPDFEMB_DOCUMENT document, FPDFEMB_ACTION action, void* buffer);
1529
1530 // Function: FPDFEMB_Action_GetNext
1531 // Get next action in an action chain
1532 // Parameters:
1533 // document - Handle to the document
1534 // action - Handle to current action
1535 // next - Receiving handle to next action.
1536 // Return Value:
1537 // Error code, or FPDFERR_SUCCESS for success.
1538 // Comments:
1539 // If there is no next action, the "next" parameter will be set to NULL after the function returns.
1540 //
1541 FPDFEMB_RESULT FPDFEMB_Action_GetNext(FPDFEMB_ACTION action, FPDFEMB_ACTION* nex t);
1542
1543 /******************************************************************************* *************
1544 ****
1545 **** Bookmark Information
1546 ****
1547 ******************************************************************************** ************/
1548
1549 typedef void* FPDFEMB_BOOKMARK;
1550
1551 // Function: FPDFEMB_Bookmark_GetFirstChild
1552 // Get first child of a bookmark item, or first top level b ookmark item
1553 // Parameters:
1554 // document - Handle to the document
1555 // parent - Handle to the parent bookmark.
1556 // Can be NULL if you want to get the first top level item.
1557 // bookmark - Receiving handle to the first ch ild or top level bookmark item.
1558 // If result is NULL, then bookmark not found.
1559 // Return Value:
1560 // Error code, or FPDFERR_SUCCESS for success
1561 //
1562 FPDFEMB_RESULT FPDFEMB_Bookmark_GetFirstChild(FPDFEMB_DOCUMENT document, FPDFEMB _BOOKMARK parent,
1563 FPDFEMB_BOOKMARK* bookmark);
1564
1565 // Function: FPDFEMB_Bookmark_GetFirstChild
1566 // Get next sibling of a bookmark item
1567 // Parameters:
1568 // document - Handle to the document
1569 // bookmark - Handle to the bookmark
1570 // sibling - Receiving the handle of next sib ling.
1571 // If result is NULL, then this is the last bookmark in this level.
1572 // Return Value:
1573 // Error code, or FPDFERR_SUCCESS for success
1574 //
1575 FPDFEMB_RESULT FPDFEMB_Bookmark_GetNextSibling(FPDFEMB_DOCUMENT document, FPDFEM B_BOOKMARK bookmark,
1576 FPDFEMB_BOOKMARK* sibling);
1577
1578 // Function: FPDFEMB_Bookmark_GetTitle
1579 // Get title of a bookmark
1580 // Parameters:
1581 // bookmark - Handle to the bookmark
1582 // buffer - A buffer allocated by the applic ation, or NULL.
1583 // bufsize - [IN/OUT] A pointer to a number i ndicating the buffer size,
1584 // before this function cal l. After return, this place will store
1585 // number of bytes used by the output (including terminator).
1586 // Return Value:
1587 // Error code, or FPDFERR_SUCCESS for success
1588 // Comments:
1589 // The title is output in Unicode, using UTF-16LE format. I t's terminated by
1590 // two consecutive zero bytes.
1591 //
1592 // If the "buffer" parameter is NULL, then the "bufsize" pa rameter will receive
1593 // number of bytes required to store the bookmark title (in cluding the two-
1594 // byte terminator).
1595 //
1596 // If the buffer provided is smaller than the required size , then this function
1597 // will not copy any data, return FPDFEMB_PARAM, and the re quired buffer size will
1598 // also be put in "bufsize" parameter.
1599 //
1600 FPDFEMB_RESULT FPDFEMB_Bookmark_GetTitle(FPDFEMB_BOOKMARK bookmark, void* buffer , unsigned int* bufsize);
1601
1602 // Function: FPDFEMB_Bookmark_GetPage
1603 // Get page number of a bookmark pointing to
1604 // Parameters:
1605 // document - Handle to the document
1606 // bookmark - Handle to the bookmark
1607 // page - Receiving the page number. -1 if this bookmark doesn't actually
1608 // point to a page inside t he document.
1609 // Return Value:
1610 // Error code, or FPDFERR_SUCCESS for success
1611 // Comments:
1612 // Some bookmark might not point to a page, some bookmark m ight have more than one destination
1613 // (action), for detailed information about a bookmark, you should call FPDFEMB_Bookmark_GetAction.
1614 //
1615 FPDFEMB_RESULT FPDFEMB_Bookmark_GetPage(FPDFEMB_DOCUMENT document, FPDFEMB_BOOKM ARK bookmark, int* page);
1616
1617 // Function: FPDFEMB_Bookmark_GetAction
1618 // Get action(s) associated with a particular bookmark
1619 // Parameters:
1620 // document - Handle to the document
1621 // bookmark - Handle to the bookmark
1622 // action - Receiving handle of first action
1623 // Return Value:
1624 // Error code, or FPDFERR_SUCCESS for success.
1625 //
1626 FPDFEMB_RESULT FPDFEMB_Bookmark_GetAction(FPDFEMB_DOCUMENT document, FPDFEMB_BOO KMARK bookmark, FPDFEMB_ACTION* action);
1627
1628 /******************************************************************************* *************
1629 ****
1630 **** Hyperlink Information
1631 ****
1632 ******************************************************************************** ************/
1633
1634 // Function: FPDFEMB_Link_GetCount
1635 // Get number of hyperlinks inside a page
1636 // Parameters:
1637 // page - Page handle.
1638 // link_count - Pointer to an integer receiving the number of links
1639 // reserved - Must be zero now.
1640 // Return Value:
1641 // Error code, or FPDFERR_SUCCESS for success.
1642 // Comments:
1643 // This function must be called before any other link relat ed function can
1644 // be called for the page.
1645 //
1646 FPDFEMB_RESULT FPDFEMB_Link_GetCount(FPDFEMB_PAGE page, int* link_count, int res erved);
1647
1648 // Function: FPDFEMB_Link_GetAction
1649 // Get action(s) associated with a particular hyperlink
1650 // Parameters:
1651 // page - Page handle
1652 // link_index - Zero-based index for the link
1653 // action - Receiving handle of first action
1654 // Return Value:
1655 // Error code, or FPDFERR_SUCCESS for success.
1656 //
1657 FPDFEMB_RESULT FPDFEMB_Link_GetAction(FPDFEMB_PAGE page, int link_index, FPDFEMB _ACTION* action);
1658
1659 // Function: FPDFEMB_Link_GetAreaCount
1660 // Get number of area (quadrilaterals) for a link
1661 // Parameters:
1662 // page - Page handle
1663 // link_index - Zero-based index for the link
1664 // count - Pointer to an integer receiving number of quadrilaterals
1665 // Return Value:
1666 // Error code, or FPDFERR_SUCCESS for success.
1667 //
1668 FPDFEMB_RESULT FPDFEMB_Link_GetAreaCount(FPDFEMB_PAGE page, int link_index, int* count);
1669
1670 // Function: FPDFEMB_Link_GetArea
1671 // Get a particular quadrilateral for a link
1672 // Parameters:
1673 // page - Page handle
1674 // link_index - Zero-based index for the link
1675 // area_index - Zero-based index for the quadril ateral
1676 // points - Pointer to an array consists 4 p oints, receiving coordinations
1677 // Return Value:
1678 // Error code, or FPDFERR_SUCCESS for success.
1679 // Comments:
1680 // The result in "points" array are the X/Y coordinations f or the four vertices
1681 // of the quadrilateral. Vertices are in the following orde r: lower left, lower
1682 // right, upper right, upper left.
1683 //
1684 FPDFEMB_RESULT FPDFEMB_Link_GetArea(FPDFEMB_PAGE page, int link_index, int area_ index,
1685 FPDFEMB_ POINT* points);
1686
1687 /******************************************************************************* *************
1688 ****
1689 **** Graphic Output (onto DIB)
1690 ****
1691 ******************************************************************************** ************/
1692
1693 typedef void* FPDFEMB_FONT;
1694
1695 // Function: FPDFEMB_OpenStandardFont
1696 // Get ready to use a standard PDF font
1697 // Parameters:
1698 // font_name - Name of the font. See a list of supported fonts below.
1699 // font_handle - Receiving the font handle.
1700 // Return Value:
1701 // Error code, or FPDFERR_SUCCESS for success.
1702 // Comments:
1703 // Currently supported standard fonts:
1704 // Courier, Courier-Bold, Courier-BoldOblique, Courier-Obli que,
1705 // Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvet ica-Oblique,
1706 // Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic,
1707 // Symbol, ZapfDingbats.
1708 //
1709 FPDFEMB_RESULT FPDFEMB_OpenStandardFont(const char* font_name, FPDFEMB_FONT* fon t_handle);
1710
1711 // Function: FPDFEMB_OpenSystemFont
1712 // Get ready to use a system font
1713 // Parameters:
1714 // font_name - Font name
1715 // charset - Charset ID (see above FPDFEMB_CH ARSET_xxx constants)
1716 // flags - Font flags (see above FPDFEMB_FO NT_xxx constants)
1717 // weight - Weight of the font. Range from 1 00 to 900. 400 is normal,
1718 // 700 is bold.
1719 // font_handle - Receiving the font handle.
1720 // Return Value:
1721 // Error code, or FPDFERR_SUCCESS for success.
1722 // Comments:
1723 // System font is supported only if either FPDFEMB_SetFontM apper or
1724 // FPDFEMB_SetGlyphProvider is called.
1725 // Font attributes (name, charset, flags and weight) can be all optional, if the
1726 // font mapper or glyph provider doesn't make use of them.
1727 //
1728 FPDFEMB_RESULT FPDFEMB_OpenSystemFont(const char* font_name, int charset, unsign ed int flags, int weight,
1729 FPDFEM B_FONT* font_handle);
1730
1731 // Function: FPDFEMB_CloseFont
1732 // Close a font handle.
1733 // Parameters:
1734 // font_handle - Handle to the font.
1735 // Return Value:
1736 // Error code, or FPDFERR_SUCCESS for success.
1737 //
1738 FPDFEMB_RESULT FPDFEMB_CloseFont(FPDFEMB_FONT font_handle);
1739
1740 struct FPDFEMB_TEXTMATRIX
1741 {
1742 double a, b, c, d;
1743 };
1744
1745 // Function: FPDFEMB_OutputText
1746 // Output text string onto a DIB device.
1747 // Parameters:
1748 // dib - DIB handle, as the outpu t device
1749 // x, y - DIB coordinations for the origin point of the first character.
1750 // font_handle - Handle to the font
1751 // font_size - Font size in pixels
1752 // matrix - Matrix for the text output. Can be NULL.
1753 // text - Zero-terminated unicode text str ing
1754 // argb - Color of the text, in 0xaarrggbb format.
1755 // Return Value:
1756 // Error code, or FPDFERR_SUCCESS for success.
1757 //
1758 FPDFEMB_RESULT FPDFEMB_OutputText(FPDFEMB_BITMAP dib, int x, int y, FPDFEMB_FONT font_handle, double font_size,
1759 FPDFEMB_TEXTMA TRIX* matrix, const FPDFEMB_WCHAR* text, unsigned long argb);
1760
1761 #ifdef __cplusplus
1762 };
1763 #endif
1764
1765 #endif // #ifdef _FPDFEMB_H_
OLDNEW
« no previous file with comments | « skia/images/bmpdecoderhelper.cpp ('k') | skia/images/fpdfemb_ext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698