John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 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. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 7 | #ifndef PUBLIC_FPDF_PROGRESSIVE_H_ |
| 8 | #define PUBLIC_FPDF_PROGRESSIVE_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
Dan Sinclair | 85c8e7f | 2016-11-21 13:50:32 -0500 | [diff] [blame] | 10 | // NOLINTNEXTLINE(build/include) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 11 | #include "fpdfview.h" |
| 12 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 13 | // Flags for progressive process status. |
| 14 | #define FPDF_RENDER_READER 0 |
| 15 | #define FPDF_RENDER_TOBECOUNTINUED 1 |
| 16 | #define FPDF_RENDER_DONE 2 |
| 17 | #define FPDF_RENDER_FAILED 3 |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 23 | // IFPDF_RENDERINFO interface. |
| 24 | typedef struct _IFSDK_PAUSE { |
| 25 | /** |
| 26 | * Version number of the interface. Currently must be 1. |
| 27 | **/ |
| 28 | int version; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 29 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 30 | /* |
| 31 | * Method: NeedToPauseNow |
| 32 | * Check if we need to pause a progressive process now. |
| 33 | * Interface Version: |
| 34 | * 1 |
| 35 | * Implementation Required: |
| 36 | * yes |
| 37 | * Parameters: |
| 38 | * pThis - Pointer to the interface structure itself |
| 39 | * Return Value: |
| 40 | * Non-zero for pause now, 0 for continue. |
| 41 | * |
| 42 | */ |
| 43 | FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 44 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 45 | // A user defined data pointer, used by user's application. Can be NULL. |
| 46 | void* user; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 47 | } IFSDK_PAUSE; |
| 48 | |
| 49 | // Function: FPDF_RenderPageBitmap_Start |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 50 | // Start to render page contents to a device independent bitmap |
| 51 | // progressively. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 52 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 53 | // bitmap - Handle to the device independent bitmap (as the |
| 54 | // output buffer). |
| 55 | // Bitmap handle can be created by FPDFBitmap_Create |
| 56 | // function. |
| 57 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 58 | // function. |
| 59 | // start_x - Left pixel position of the display area in the |
| 60 | // bitmap coordinate. |
| 61 | // start_y - Top pixel position of the display area in the bitmap |
| 62 | // coordinate. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 63 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 64 | // size_y - Vertical size (in pixels) for displaying the page. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 65 | // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees |
| 66 | // clockwise), |
| 67 | // 2 (rotated 180 degrees), 3 (rotated 90 degrees |
| 68 | // counter-clockwise). |
| 69 | // flags - 0 for normal display, or combination of flags |
jaepark | 75f84a5 | 2016-09-09 15:39:09 -0700 | [diff] [blame] | 70 | // defined in fpdfview.h. With FPDF_ANNOT flag, it |
| 71 | // renders all annotations that does not require |
| 72 | // user-interaction, which are all annotations except |
| 73 | // widget and popup annotations. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 74 | // pause - The IFSDK_PAUSE interface.A callback mechanism |
| 75 | // allowing the page rendering process |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 76 | // Return value: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 77 | // Rendering Status. See flags for progressive process status for the |
| 78 | // details. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 79 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 80 | DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, |
| 81 | FPDF_PAGE page, |
| 82 | int start_x, |
| 83 | int start_y, |
| 84 | int size_x, |
| 85 | int size_y, |
| 86 | int rotate, |
| 87 | int flags, |
| 88 | IFSDK_PAUSE* pause); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 89 | |
| 90 | // Function: FPDF_RenderPage_Continue |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 91 | // Continue rendering a PDF page. |
| 92 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 93 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 94 | // function. |
| 95 | // pause - The IFSDK_PAUSE interface.A callback mechanism |
| 96 | // allowing the page rendering process |
| 97 | // to be paused before it's finished. This can be NULL |
| 98 | // if you don't want to pause. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 99 | // Return value: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 100 | // The rendering status. See flags for progressive process status for |
| 101 | // the details. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 102 | DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page, |
| 103 | IFSDK_PAUSE* pause); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 104 | |
| 105 | // Function: FPDF_RenderPage_Close |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 106 | // Release the resource allocate during page rendering. Need to be |
| 107 | // called after finishing rendering or |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 108 | // cancel the rendering. |
| 109 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 110 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 111 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 112 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 113 | // NULL |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 114 | DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page); |
| 115 | |
| 116 | #ifdef __cplusplus |
| 117 | } |
| 118 | #endif |
| 119 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 120 | #endif // PUBLIC_FPDF_PROGRESSIVE_H_ |