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