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 #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 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 // IFPDF_RENDERINFO interface. 23 typedef struct _IFSDK_PAUSE { 24 /** 25 * Version number of the interface. Currently must be 1. 26 **/ 27 int version; 28 29 /* 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); 43 44 // A user defined data pointer, used by user's application. Can be NULL. 45 void* user; 46 } IFSDK_PAUSE; 47 48 // Function: FPDF_RenderPageBitmap_Start 49 // Start to render page contents to a device independent bitmap 50 // progressively. 51 // Parameters: 52 // 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. 62 // size_x - Horizontal size (in pixels) for displaying the page. 63 // size_y - Vertical size (in pixels) for displaying the page. 64 // 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 72 // Return value: 73 // Rendering Status. See flags for progressive process status for the 74 // details. 75 // 76 DLLEXPORT 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); 85 86 // Function: FPDF_RenderPage_Continue 87 // Continue rendering a PDF page. 88 // Parameters: 89 // 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. 95 // Return value: 96 // The rendering status. See flags for progressive process status for 97 // the details. 98 DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page, 99 IFSDK_PAUSE* pause); 100 101 // Function: FPDF_RenderPage_Close 102 // Release the resource allocate during page rendering. Need to be 103 // called after finishing rendering or 104 // cancel the rendering. 105 // Parameters: 106 // page - Handle to the page. Returned by FPDF_LoadPage 107 // function. 108 // Return value: 109 // NULL 110 DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page); 111 112 #ifdef __cplusplus 113 } 114 #endif 115 116 #endif // PUBLIC_FPDF_PROGRESSIVE_H_ 117