blob: b146d48c39ef1ba0f6dcfb46bf7fe09c2266e329 [file] [log] [blame]
kumarashishg826308d2023-06-23 13:21:22 +00001// Copyright 2014 The PDFium Authors
Svet Ganove6986e12015-06-04 14:52:15 -07002// 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 Huang49cc9302020-04-27 16:14:24 -070010// clang-format off
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070011// NOLINTNEXTLINE(build/include)
Svet Ganove6986e12015-06-04 14:52:15 -070012#include "fpdfview.h"
13
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080014// Flags for progressive process status.
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -070015#define FPDF_RENDER_READY 0
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -070016#define FPDF_RENDER_TOBECONTINUED 1
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080017#define FPDF_RENDER_DONE 2
18#define FPDF_RENDER_FAILED 3
Svet Ganove6986e12015-06-04 14:52:15 -070019
20#ifdef __cplusplus
21extern "C" {
22#endif
23
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080024// IFPDF_RENDERINFO interface.
25typedef struct _IFSDK_PAUSE {
Haibo Huang49cc9302020-04-27 16:14:24 -070026 /*
27 * Version number of the interface. Currently must be 1.
28 */
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080029 int version;
Svet Ganove6986e12015-06-04 14:52:15 -070030
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080031 /*
Haibo Huang49cc9302020-04-27 16:14:24 -070032 * 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. Moltmannac3d58c2016-03-04 15:19:21 -080043 FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis);
Svet Ganove6986e12015-06-04 14:52:15 -070044
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080045 // A user defined data pointer, used by user's application. Can be NULL.
46 void* user;
Svet Ganove6986e12015-06-04 14:52:15 -070047} IFSDK_PAUSE;
48
kumarashishg826308d2023-06-23 13:21:22 +000049// 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.
82FPDF_EXPORT int FPDF_CALLCONV
83FPDF_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 Ganove6986e12015-06-04 14:52:15 -070094// Function: FPDF_RenderPageBitmap_Start
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080095// Start to render page contents to a device independent bitmap
96// progressively.
Svet Ganove6986e12015-06-04 14:52:15 -070097// Parameters:
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080098// bitmap - Handle to the device independent bitmap (as the
Haibo Huang49cc9302020-04-27 16:14:24 -070099// output buffer). Bitmap handle can be created by
100// FPDFBitmap_Create().
101// page - Handle to the page, as returned by FPDF_LoadPage().
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -0800102// start_x - Left pixel position of the display area in the
Haibo Huang49cc9302020-04-27 16:14:24 -0700103// bitmap coordinates.
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -0800104// start_y - Top pixel position of the display area in the bitmap
Haibo Huang49cc9302020-04-27 16:14:24 -0700105// coordinates.
Svet Ganove6986e12015-06-04 14:52:15 -0700106// size_x - Horizontal size (in pixels) for displaying the page.
107// size_y - Vertical size (in pixels) for displaying the page.
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -0800108// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
Haibo Huang49cc9302020-04-27 16:14:24 -0700109// clockwise), 2 (rotated 180 degrees), 3 (rotated 90
110// degrees counter-clockwise).
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -0800111// flags - 0 for normal display, or combination of flags
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -0700112// 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. Moltmannac3d58c2016-03-04 15:19:21 -0800116// pause - The IFSDK_PAUSE interface.A callback mechanism
Haibo Huang49cc9302020-04-27 16:14:24 -0700117// allowing the page rendering process
Svet Ganove6986e12015-06-04 14:52:15 -0700118// Return value:
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -0800119// Rendering Status. See flags for progressive process status for the
120// details.
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -0700121FPDF_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 Ganove6986e12015-06-04 14:52:15 -0700130
131// Function: FPDF_RenderPage_Continue
132// Continue rendering a PDF page.
133// Parameters:
Haibo Huang49cc9302020-04-27 16:14:24 -0700134// 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 Ganove6986e12015-06-04 14:52:15 -0700139// Return value:
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -0800140// The rendering status. See flags for progressive process status for
141// the details.
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -0700142FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPage_Continue(FPDF_PAGE page,
143 IFSDK_PAUSE* pause);
Svet Ganove6986e12015-06-04 14:52:15 -0700144
145// Function: FPDF_RenderPage_Close
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -0800146// Release the resource allocate during page rendering. Need to be
147// called after finishing rendering or
Svet Ganove6986e12015-06-04 14:52:15 -0700148// cancel the rendering.
149// Parameters:
Haibo Huang49cc9302020-04-27 16:14:24 -0700150// page - Handle to the page, as returned by FPDF_LoadPage().
Svet Ganove6986e12015-06-04 14:52:15 -0700151// Return value:
Haibo Huang49cc9302020-04-27 16:14:24 -0700152// None.
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -0700153FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage_Close(FPDF_PAGE page);
Svet Ganove6986e12015-06-04 14:52:15 -0700154
155#ifdef __cplusplus
156}
157#endif
158
159#endif // PUBLIC_FPDF_PROGRESSIVE_H_