• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef PUBLIC_FPDF_PROGRESSIVE_H_
8 #define PUBLIC_FPDF_PROGRESSIVE_H_
9 
10 // clang-format off
11 // NOLINTNEXTLINE(build/include)
12 #include "fpdfview.h"
13 
14 // Flags for progressive process status.
15 #define FPDF_RENDER_READY 0
16 #define FPDF_RENDER_TOBECONTINUED 1
17 #define FPDF_RENDER_DONE 2
18 #define FPDF_RENDER_FAILED 3
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 // IFPDF_RENDERINFO interface.
25 typedef struct _IFSDK_PAUSE {
26   /*
27    * Version number of the interface. Currently must be 1.
28    */
29   int version;
30 
31   /*
32    * Method: NeedToPauseNow
33    *           Check if we need to pause a progressive process now.
34    * Interface Version:
35    *           1
36    * Implementation Required:
37    *           yes
38    * Parameters:
39    *           pThis       -   Pointer to the interface structure itself
40    * Return Value:
41    *           Non-zero for pause now, 0 for continue.
42    */
43   FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis);
44 
45   // A user defined data pointer, used by user's application. Can be NULL.
46   void* user;
47 } IFSDK_PAUSE;
48 
49 // Function: FPDF_RenderPageBitmap_Start
50 //          Start to render page contents to a device independent bitmap
51 //          progressively.
52 // Parameters:
53 //          bitmap      -   Handle to the device independent bitmap (as the
54 //                          output buffer). Bitmap handle can be created by
55 //                          FPDFBitmap_Create().
56 //          page        -   Handle to the page, as returned by FPDF_LoadPage().
57 //          start_x     -   Left pixel position of the display area in the
58 //                          bitmap coordinates.
59 //          start_y     -   Top pixel position of the display area in the bitmap
60 //                          coordinates.
61 //          size_x      -   Horizontal size (in pixels) for displaying the page.
62 //          size_y      -   Vertical size (in pixels) for displaying the page.
63 //          rotate      -   Page orientation: 0 (normal), 1 (rotated 90 degrees
64 //                          clockwise), 2 (rotated 180 degrees), 3 (rotated 90
65 //                          degrees counter-clockwise).
66 //          flags       -   0 for normal display, or combination of flags
67 //                          defined in fpdfview.h. With FPDF_ANNOT flag, it
68 //                          renders all annotations that does not require
69 //                          user-interaction, which are all annotations except
70 //                          widget and popup annotations.
71 //          pause       -   The IFSDK_PAUSE interface.A callback mechanism
72 //                          allowing the page rendering process
73 // Return value:
74 //          Rendering Status. See flags for progressive process status for the
75 //          details.
76 //
77 FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
78                                                           FPDF_PAGE page,
79                                                           int start_x,
80                                                           int start_y,
81                                                           int size_x,
82                                                           int size_y,
83                                                           int rotate,
84                                                           int flags,
85                                                           IFSDK_PAUSE* pause);
86 
87 // Function: FPDF_RenderPage_Continue
88 //          Continue rendering a PDF page.
89 // Parameters:
90 //          page        -   Handle to the page, as returned by FPDF_LoadPage().
91 //          pause       -   The IFSDK_PAUSE interface (a callback mechanism
92 //                          allowing the page rendering process to be paused
93 //                          before it's finished). This can be NULL if you
94 //                          don't want to pause.
95 // Return value:
96 //          The rendering status. See flags for progressive process status for
97 //          the details.
98 FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPage_Continue(FPDF_PAGE page,
99                                                        IFSDK_PAUSE* pause);
100 
101 // Function: FPDF_RenderPage_Close
102 //          Release the resource allocate during page rendering. Need to be
103 //          called after finishing rendering or
104 //          cancel the rendering.
105 // Parameters:
106 //          page        -   Handle to the page, as returned by FPDF_LoadPage().
107 // Return value:
108 //          None.
109 FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage_Close(FPDF_PAGE page);
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif  // PUBLIC_FPDF_PROGRESSIVE_H_
116