blob: f352ff9d000dae3dfcb3ac987b4173d33846795c [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
10#include "fpdfview.h"
11
Nico Weber9d8ec5a2015-08-04 13:00:21 -070012// 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-Malek3f3b45c2014-05-23 17:28:10 -070017
18#ifdef __cplusplus
19extern "C" {
20#endif
21
Nico Weber9d8ec5a2015-08-04 13:00:21 -070022// IFPDF_RENDERINFO interface.
23typedef struct _IFSDK_PAUSE {
24 /**
25 * Version number of the interface. Currently must be 1.
26 **/
27 int version;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070028
Nico Weber9d8ec5a2015-08-04 13:00:21 -070029 /*
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-Malek3f3b45c2014-05-23 17:28:10 -070043
Nico Weber9d8ec5a2015-08-04 13:00:21 -070044 // A user defined data pointer, used by user's application. Can be NULL.
45 void* user;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070046} IFSDK_PAUSE;
47
48// Function: FPDF_RenderPageBitmap_Start
Nico Weber9d8ec5a2015-08-04 13:00:21 -070049// Start to render page contents to a device independent bitmap
50// progressively.
Tom Sepez9857e202015-05-13 17:09:26 -070051// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070052// 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 Sepez9857e202015-05-13 17:09:26 -070062// size_x - Horizontal size (in pixels) for displaying the page.
63// size_y - Vertical size (in pixels) for displaying the page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070064// 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-Malek3f3b45c2014-05-23 17:28:10 -070072// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070073// Rendering Status. See flags for progressive process status for the
74// details.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070075//
Nico Weber9d8ec5a2015-08-04 13:00:21 -070076DLLEXPORT 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-Malek3f3b45c2014-05-23 17:28:10 -070085
86// Function: FPDF_RenderPage_Continue
Tom Sepez9857e202015-05-13 17:09:26 -070087// Continue rendering a PDF page.
88// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070089// 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-Malek3f3b45c2014-05-23 17:28:10 -070095// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070096// The rendering status. See flags for progressive process status for
97// the details.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070098DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,
99 IFSDK_PAUSE* pause);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700100
101// Function: FPDF_RenderPage_Close
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700102// Release the resource allocate during page rendering. Need to be
103// called after finishing rendering or
Tom Sepez9857e202015-05-13 17:09:26 -0700104// cancel the rendering.
105// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700106// page - Handle to the page. Returned by FPDF_LoadPage
107// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700108// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700109// NULL
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700110DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page);
111
112#ifdef __cplusplus
113}
114#endif
115
Tom Sepez9857e202015-05-13 17:09:26 -0700116#endif // PUBLIC_FPDF_PROGRESSIVE_H_