blob: 0c3d501317b4755dd778a57b3b358e29ca4b04a9 [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.
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-Malek3f3b45c2014-05-23 17:28:10 -070018
19#ifdef __cplusplus
20extern "C" {
21#endif
22
Nico Weber9d8ec5a2015-08-04 13:00:21 -070023// IFPDF_RENDERINFO interface.
24typedef struct _IFSDK_PAUSE {
25 /**
26 * Version number of the interface. Currently must be 1.
27 **/
28 int version;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070029
Nico Weber9d8ec5a2015-08-04 13:00:21 -070030 /*
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-Malek3f3b45c2014-05-23 17:28:10 -070044
Nico Weber9d8ec5a2015-08-04 13:00:21 -070045 // A user defined data pointer, used by user's application. Can be NULL.
46 void* user;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070047} IFSDK_PAUSE;
48
49// Function: FPDF_RenderPageBitmap_Start
Nico Weber9d8ec5a2015-08-04 13:00:21 -070050// Start to render page contents to a device independent bitmap
51// progressively.
Tom Sepez9857e202015-05-13 17:09:26 -070052// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070053// 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 Sepez9857e202015-05-13 17:09:26 -070063// size_x - Horizontal size (in pixels) for displaying the page.
64// size_y - Vertical size (in pixels) for displaying the page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070065// 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
jaepark75f84a52016-09-09 15:39:09 -070070// 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 Weber9d8ec5a2015-08-04 13:00:21 -070074// pause - The IFSDK_PAUSE interface.A callback mechanism
75// allowing the page rendering process
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070076// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070077// Rendering Status. See flags for progressive process status for the
78// details.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070079//
Nico Weber9d8ec5a2015-08-04 13:00:21 -070080DLLEXPORT 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-Malek3f3b45c2014-05-23 17:28:10 -070089
90// Function: FPDF_RenderPage_Continue
Tom Sepez9857e202015-05-13 17:09:26 -070091// Continue rendering a PDF page.
92// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070093// 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-Malek3f3b45c2014-05-23 17:28:10 -070099// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700100// The rendering status. See flags for progressive process status for
101// the details.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700102DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,
103 IFSDK_PAUSE* pause);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700104
105// Function: FPDF_RenderPage_Close
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700106// Release the resource allocate during page rendering. Need to be
107// called after finishing rendering or
Tom Sepez9857e202015-05-13 17:09:26 -0700108// cancel the rendering.
109// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700110// page - Handle to the page. Returned by FPDF_LoadPage
111// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700112// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700113// NULL
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700114DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page);
115
116#ifdef __cplusplus
117}
118#endif
119
Tom Sepez9857e202015-05-13 17:09:26 -0700120#endif // PUBLIC_FPDF_PROGRESSIVE_H_