1// 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. 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 10// NOLINTNEXTLINE(build/include) 11#include "fpdfview.h" 12 13// Flags for progressive process status. 14#define FPDF_RENDER_READY 0 15#define FPDF_RENDER_READER 0 // Deprecated 16#define FPDF_RENDER_TOBECONTINUED 1 17#define FPDF_RENDER_TOBECOUNTINUED 1 // Deprecated. 18#define FPDF_RENDER_DONE 2 19#define FPDF_RENDER_FAILED 3 20 21#ifdef __cplusplus 22extern "C" { 23#endif 24 25// IFPDF_RENDERINFO interface. 26typedef struct _IFSDK_PAUSE { 27 /** 28 * Version number of the interface. Currently must be 1. 29 **/ 30 int version; 31 32 /* 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); 46 47 // A user defined data pointer, used by user's application. Can be NULL. 48 void* user; 49} IFSDK_PAUSE; 50 51// Function: FPDF_RenderPageBitmap_Start 52// Start to render page contents to a device independent bitmap 53// progressively. 54// Parameters: 55// 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. 65// size_x - Horizontal size (in pixels) for displaying the page. 66// size_y - Vertical size (in pixels) for displaying the page. 67// 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 72// 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. 76// pause - The IFSDK_PAUSE interface.A callback mechanism 77// allowing the page rendering process 78// Return value: 79// Rendering Status. See flags for progressive process status for the 80// details. 81// 82FPDF_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); 91 92// Function: FPDF_RenderPage_Continue 93// Continue rendering a PDF page. 94// Parameters: 95// 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. 101// Return value: 102// The rendering status. See flags for progressive process status for 103// the details. 104FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPage_Continue(FPDF_PAGE page, 105 IFSDK_PAUSE* pause); 106 107// Function: FPDF_RenderPage_Close 108// Release the resource allocate during page rendering. Need to be 109// called after finishing rendering or 110// cancel the rendering. 111// Parameters: 112// page - Handle to the page. Returned by FPDF_LoadPage 113// function. 114// Return value: 115// NULL 116FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage_Close(FPDF_PAGE page); 117 118#ifdef __cplusplus 119} 120#endif 121 122#endif // PUBLIC_FPDF_PROGRESSIVE_H_ 123