Initial commit.
[pdfium.git] / fpdfsdk / include / fpdf_progressive.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4  \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FPDF_PROGRESSIVE_H_\r
8 #define _FPDF_PROGRESSIVE_H_\r
9 \r
10 #include "fpdfview.h"\r
11 \r
12 //Flags for progressive process status.\r
13 #define FPDF_RENDER_READER                      0\r
14 #define FPDF_RENDER_TOBECOUNTINUED      1\r
15 #define FPDF_RENDER_DONE                        2\r
16 #define FPDF_RENDER_FAILED                      3\r
17 \r
18 \r
19 #ifdef __cplusplus\r
20 extern "C" {\r
21 #endif\r
22 \r
23 \r
24 //IFPDF_RENDERINFO interface.\r
25 typedef struct _IFSDK_PAUSE\r
26 {\r
27         /**\r
28         * Version number of the interface. Currently must be 1.\r
29         **/\r
30         int version;\r
31 \r
32         /*\r
33         * Method: NeedToPauseNow\r
34         *                       Check if we need to pause a progressive process now.\r
35         * Interface Version:\r
36         *                       1\r
37         * Implementation Required:\r
38         *                       yes\r
39         * Parameters:\r
40         *                       pThis           -       Pointer to the interface structure itself\r
41         * Return Value:\r
42         *                        Non-zero for pause now, 0 for continue.\r
43         *\r
44         */\r
45         FPDF_BOOL (*NeedToPauseNow) (struct _IFSDK_PAUSE* pThis);\r
46         \r
47         //A user defined data pointer, used by user's application. Can be NULL.\r
48         void*           user;\r
49 } IFSDK_PAUSE;\r
50 \r
51 // Function: FPDF_RenderPageBitmap_Start\r
52 //                      Start to render page contents to a device independent bitmap progressively.\r
53 // Parameters: \r
54 //                      bitmap          -       Handle to the device independent bitmap (as the output buffer).\r
55 //                                                      Bitmap handle can be created by FPDFBitmap_Create function.\r
56 //                      page            -       Handle to the page. Returned by FPDF_LoadPage function.\r
57 //                      start_x         -       Left pixel position of the display area in the bitmap coordinate.\r
58 //                      start_y         -       Top pixel position of the display area in the bitmap coordinate.\r
59 //                      size_x          -       Horizontal size (in pixels) for displaying the page.\r
60 //                      size_y          -       Vertical size (in pixels) for displaying the page.\r
61 //                      rotate          -       Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),\r
62 //                                                              2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).\r
63 //                      flags           -       0 for normal display, or combination of flags defined above.\r
64 //                      pause           -       The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process\r
65 // Return value:\r
66 //                      Rendering Status. See flags for progressive process status for the details.\r
67 //\r
68 DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x,\r
69                                                                                                    int size_y, int rotate, int flags,IFSDK_PAUSE * pause);\r
70 \r
71 // Function: FPDF_RenderPage_Continue\r
72 //                      Continue rendering a PDF page.\r
73 // Parameters: \r
74 //                      page            -       Handle to the page. Returned by FPDF_LoadPage function.\r
75 //                      pause           -       The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process\r
76 //                                                      to be paused before it's finished. This can be NULL if you don't want to pause.\r
77 // Return value:\r
78 //                      The rendering status. See flags for progressive process status for the details.\r
79 DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,IFSDK_PAUSE * pause);\r
80 \r
81 // Function: FPDF_RenderPage_Close\r
82 //                      Release the resource allocate during page rendering. Need to be called after finishing rendering or\r
83 //                      cancel the rendering.\r
84 // Parameters: \r
85 //                      page            -       Handle to the page. Returned by FPDF_LoadPage function.\r
86 // Return value:\r
87 //                      NULL\r
88 DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page);\r
89 \r
90 #ifdef __cplusplus\r
91 }\r
92 #endif\r
93 \r
94 #endif  //_FPDF_PROGRESSIVE_H_\r