blob: 3f0ae293a85c1f0c8480a69c79f92732bc9da088 [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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 Sepez9857e202015-05-13 17:09:26 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Tom Sepez9857e202015-05-13 17:09:26 -07007#ifndef PUBLIC_FPDF_PROGRESSIVE_H_
8#define PUBLIC_FPDF_PROGRESSIVE_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Dan Sinclair85c8e7f2016-11-21 13:50:32 -050010// NOLINTNEXTLINE(build/include)
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070011#include "fpdfview.h"
12
Nico Weber9d8ec5a2015-08-04 13:00:21 -070013// Flags for progressive process status.
Dan Sinclair72cc6c62017-07-24 09:16:19 -040014#define FPDF_RENDER_READY 0
15#define FPDF_RENDER_READER 0 // Deprecated
Dan Sinclair56725242017-07-18 12:05:33 -040016#define FPDF_RENDER_TOBECONTINUED 1
17#define FPDF_RENDER_TOBECOUNTINUED 1 // Deprecated.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070018#define FPDF_RENDER_DONE 2
19#define FPDF_RENDER_FAILED 3
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020
21#ifdef __cplusplus
22extern "C" {
23#endif
24
Nico Weber9d8ec5a2015-08-04 13:00:21 -070025// IFPDF_RENDERINFO interface.
26typedef struct _IFSDK_PAUSE {
27 /**
28 * Version number of the interface. Currently must be 1.
29 **/
30 int version;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070031
Nico Weber9d8ec5a2015-08-04 13:00:21 -070032 /*
33 * Method: NeedToPauseNow
34 * Check if we need to pause a progressive process now.
35 * Interface Version:
36 * 1
37 * Implementation Required:
38 * yes
39 * Parameters:
40 * pThis - Pointer to the interface structure itself
41 * Return Value:
42 * Non-zero for pause now, 0 for continue.
43 *
44 */
45 FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070046
Nico Weber9d8ec5a2015-08-04 13:00:21 -070047 // A user defined data pointer, used by user's application. Can be NULL.
48 void* user;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070049} IFSDK_PAUSE;
50
51// Function: FPDF_RenderPageBitmap_Start
Nico Weber9d8ec5a2015-08-04 13:00:21 -070052// Start to render page contents to a device independent bitmap
53// progressively.
Tom Sepez9857e202015-05-13 17:09:26 -070054// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070055// bitmap - Handle to the device independent bitmap (as the
56// output buffer).
57// Bitmap handle can be created by FPDFBitmap_Create
58// function.
59// page - Handle to the page. Returned by FPDF_LoadPage
60// function.
61// start_x - Left pixel position of the display area in the
62// bitmap coordinate.
63// start_y - Top pixel position of the display area in the bitmap
64// coordinate.
Tom Sepez9857e202015-05-13 17:09:26 -070065// size_x - Horizontal size (in pixels) for displaying the page.
66// size_y - Vertical size (in pixels) for displaying the page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070067// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
68// clockwise),
69// 2 (rotated 180 degrees), 3 (rotated 90 degrees
70// counter-clockwise).
71// flags - 0 for normal display, or combination of flags
jaepark75f84a52016-09-09 15:39:09 -070072// defined in fpdfview.h. With FPDF_ANNOT flag, it
73// renders all annotations that does not require
74// user-interaction, which are all annotations except
75// widget and popup annotations.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070076// pause - The IFSDK_PAUSE interface.A callback mechanism
77// allowing the page rendering process
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070078// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070079// Rendering Status. See flags for progressive process status for the
80// details.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070081//
Dan Sinclair00d2ad12017-08-10 14:13:02 -040082FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
83 FPDF_PAGE page,
84 int start_x,
85 int start_y,
86 int size_x,
87 int size_y,
88 int rotate,
89 int flags,
90 IFSDK_PAUSE* pause);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070091
92// Function: FPDF_RenderPage_Continue
Tom Sepez9857e202015-05-13 17:09:26 -070093// Continue rendering a PDF page.
94// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070095// page - Handle to the page. Returned by FPDF_LoadPage
96// function.
97// pause - The IFSDK_PAUSE interface.A callback mechanism
98// allowing the page rendering process
99// to be paused before it's finished. This can be NULL
100// if you don't want to pause.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700101// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700102// The rendering status. See flags for progressive process status for
103// the details.
Dan Sinclair00d2ad12017-08-10 14:13:02 -0400104FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPage_Continue(FPDF_PAGE page,
105 IFSDK_PAUSE* pause);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700106
107// Function: FPDF_RenderPage_Close
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700108// Release the resource allocate during page rendering. Need to be
109// called after finishing rendering or
Tom Sepez9857e202015-05-13 17:09:26 -0700110// cancel the rendering.
111// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700112// page - Handle to the page. Returned by FPDF_LoadPage
113// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700114// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700115// NULL
Dan Sinclair00d2ad12017-08-10 14:13:02 -0400116FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage_Close(FPDF_PAGE page);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700117
118#ifdef __cplusplus
119}
120#endif
121
Tom Sepez9857e202015-05-13 17:09:26 -0700122#endif // PUBLIC_FPDF_PROGRESSIVE_H_