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 _FPDF_PROGRESSIVE_H_ 8#define _FPDF_PROGRESSIVE_H_ 9 10#include "fpdfview.h" 11 12//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 17 18 19#ifdef __cplusplus 20extern "C" { 21#endif 22 23 24//IFPDF_RENDERINFO interface. 25typedef struct _IFSDK_PAUSE 26{ 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 progressively. 53// Parameters: 54// bitmap - Handle to the device independent bitmap (as the output buffer). 55// Bitmap handle can be created by FPDFBitmap_Create function. 56// page - Handle to the page. Returned by FPDF_LoadPage function. 57// start_x - Left pixel position of the display area in the bitmap coordinate. 58// start_y - Top pixel position of the display area in the bitmap coordinate. 59// size_x - Horizontal size (in pixels) for displaying the page. 60// size_y - Vertical size (in pixels) for displaying the page. 61// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 62// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise). 63// flags - 0 for normal display, or combination of flags defined above. 64// pause - The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process 65// Return value: 66// Rendering Status. See flags for progressive process status for the details. 67// 68DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, 69 int size_y, int rotate, int flags,IFSDK_PAUSE * pause); 70 71// Function: FPDF_RenderPage_Continue 72// Continue rendering a PDF page. 73// Parameters: 74// page - Handle to the page. Returned by FPDF_LoadPage function. 75// pause - The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process 76// to be paused before it's finished. This can be NULL if you don't want to pause. 77// Return value: 78// The rendering status. See flags for progressive process status for the details. 79DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,IFSDK_PAUSE * pause); 80 81// Function: FPDF_RenderPage_Close 82// Release the resource allocate during page rendering. Need to be called after finishing rendering or 83// cancel the rendering. 84// Parameters: 85// page - Handle to the page. Returned by FPDF_LoadPage function. 86// Return value: 87// NULL 88DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page); 89 90#ifdef __cplusplus 91} 92#endif 93 94#endif //_FPDF_PROGRESSIVE_H_ 95