kumarashishg | 826308d | 2023-06-23 13:21:22 +0000 | [diff] [blame] | 1 | // Copyright 2014 The PDFium Authors |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 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 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 10 | // clang-format off |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 11 | // NOLINTNEXTLINE(build/include) |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 12 | #include "fpdfview.h" |
| 13 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 14 | // Flags for progressive process status. |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 15 | #define FPDF_RENDER_READY 0 |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 16 | #define FPDF_RENDER_TOBECONTINUED 1 |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 17 | #define FPDF_RENDER_DONE 2 |
| 18 | #define FPDF_RENDER_FAILED 3 |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 19 | |
| 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 24 | // IFPDF_RENDERINFO interface. |
| 25 | typedef struct _IFSDK_PAUSE { |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 26 | /* |
| 27 | * Version number of the interface. Currently must be 1. |
| 28 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 29 | int version; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 30 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 31 | /* |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 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 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 43 | FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 44 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 45 | // A user defined data pointer, used by user's application. Can be NULL. |
| 46 | void* user; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 47 | } IFSDK_PAUSE; |
| 48 | |
kumarashishg | 826308d | 2023-06-23 13:21:22 +0000 | [diff] [blame] | 49 | // Experimental API. |
| 50 | // Function: FPDF_RenderPageBitmapWithColorScheme_Start |
| 51 | // Start to render page contents to a device independent bitmap |
| 52 | // progressively with a specified color scheme for the content. |
| 53 | // Parameters: |
| 54 | // bitmap - Handle to the device independent bitmap (as the |
| 55 | // output buffer). Bitmap handle can be created by |
| 56 | // FPDFBitmap_Create function. |
| 57 | // page - Handle to the page as 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 |
| 62 | // bitmap coordinate. |
| 63 | // size_x - Horizontal size (in pixels) for displaying the |
| 64 | // page. |
| 65 | // size_y - Vertical size (in pixels) for displaying the page. |
| 66 | // rotate - Page orientation: 0 (normal), 1 (rotated 90 |
| 67 | // degrees clockwise), 2 (rotated 180 degrees), |
| 68 | // 3 (rotated 90 degrees counter-clockwise). |
| 69 | // flags - 0 for normal display, or combination of flags |
| 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. |
| 74 | // color_scheme - Color scheme to be used in rendering the |page|. |
| 75 | // If null, this function will work similar to |
| 76 | // FPDF_RenderPageBitmap_Start(). |
| 77 | // pause - The IFSDK_PAUSE interface. A callback mechanism |
| 78 | // allowing the page rendering process. |
| 79 | // Return value: |
| 80 | // Rendering Status. See flags for progressive process status for the |
| 81 | // details. |
| 82 | FPDF_EXPORT int FPDF_CALLCONV |
| 83 | FPDF_RenderPageBitmapWithColorScheme_Start(FPDF_BITMAP bitmap, |
| 84 | FPDF_PAGE page, |
| 85 | int start_x, |
| 86 | int start_y, |
| 87 | int size_x, |
| 88 | int size_y, |
| 89 | int rotate, |
| 90 | int flags, |
| 91 | const FPDF_COLORSCHEME* color_scheme, |
| 92 | IFSDK_PAUSE* pause); |
| 93 | |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 94 | // Function: FPDF_RenderPageBitmap_Start |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 95 | // Start to render page contents to a device independent bitmap |
| 96 | // progressively. |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 97 | // Parameters: |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 98 | // bitmap - Handle to the device independent bitmap (as the |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 99 | // output buffer). Bitmap handle can be created by |
| 100 | // FPDFBitmap_Create(). |
| 101 | // page - Handle to the page, as returned by FPDF_LoadPage(). |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 102 | // start_x - Left pixel position of the display area in the |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 103 | // bitmap coordinates. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 104 | // start_y - Top pixel position of the display area in the bitmap |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 105 | // coordinates. |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 106 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 107 | // size_y - Vertical size (in pixels) for displaying the page. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 108 | // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 109 | // clockwise), 2 (rotated 180 degrees), 3 (rotated 90 |
| 110 | // degrees counter-clockwise). |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 111 | // flags - 0 for normal display, or combination of flags |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 112 | // defined in fpdfview.h. With FPDF_ANNOT flag, it |
| 113 | // renders all annotations that does not require |
| 114 | // user-interaction, which are all annotations except |
| 115 | // widget and popup annotations. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 116 | // pause - The IFSDK_PAUSE interface.A callback mechanism |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 117 | // allowing the page rendering process |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 118 | // Return value: |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 119 | // Rendering Status. See flags for progressive process status for the |
| 120 | // details. |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 121 | FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, |
| 122 | FPDF_PAGE page, |
| 123 | int start_x, |
| 124 | int start_y, |
| 125 | int size_x, |
| 126 | int size_y, |
| 127 | int rotate, |
| 128 | int flags, |
| 129 | IFSDK_PAUSE* pause); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 130 | |
| 131 | // Function: FPDF_RenderPage_Continue |
| 132 | // Continue rendering a PDF page. |
| 133 | // Parameters: |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 134 | // page - Handle to the page, as returned by FPDF_LoadPage(). |
| 135 | // pause - The IFSDK_PAUSE interface (a callback mechanism |
| 136 | // allowing the page rendering process to be paused |
| 137 | // before it's finished). This can be NULL if you |
| 138 | // don't want to pause. |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 139 | // Return value: |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 140 | // The rendering status. See flags for progressive process status for |
| 141 | // the details. |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 142 | FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPage_Continue(FPDF_PAGE page, |
| 143 | IFSDK_PAUSE* pause); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 144 | |
| 145 | // Function: FPDF_RenderPage_Close |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 146 | // Release the resource allocate during page rendering. Need to be |
| 147 | // called after finishing rendering or |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 148 | // cancel the rendering. |
| 149 | // Parameters: |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 150 | // page - Handle to the page, as returned by FPDF_LoadPage(). |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 151 | // Return value: |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 152 | // None. |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 153 | FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage_Close(FPDF_PAGE page); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 154 | |
| 155 | #ifdef __cplusplus |
| 156 | } |
| 157 | #endif |
| 158 | |
| 159 | #endif // PUBLIC_FPDF_PROGRESSIVE_H_ |