Home | History | Annotate | Download | only in public
      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_TRANSFORMPAGE_H_
      8 #define PUBLIC_FPDF_TRANSFORMPAGE_H_
      9 
     10 #include "fpdfview.h"
     11 
     12 #ifdef __cplusplus
     13 extern "C" {
     14 #endif
     15 
     16 typedef void* FPDF_PAGEARCSAVER;
     17 typedef void* FPDF_PAGEARCLOADER;
     18 
     19 /**
     20 *  Set "MediaBox" entry to the page dictionary.
     21 * @param[in] page   - Handle to a page.
     22 * @param[in] left   - The left of the rectangle.
     23 * @param[in] bottom - The bottom of the rectangle.
     24 * @param[in] right  - The right of the rectangle.
     25 * @param[in] top    - The top of the rectangle.
     26 * @retval None.
     27 */
     28 DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bottom, float right, float top);
     29 
     30 /**
     31 *  Set "CropBox" entry to the page dictionary.
     32 * @param[in] page   - Handle to a page.
     33 * @param[in] left   - The left of the rectangle.
     34 * @param[in] bottom - The bottom of the rectangle.
     35 * @param[in] right  - The right of the rectangle.
     36 * @param[in] top    - The top of the rectangle.
     37 * @retval None.
     38 */
     39 DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, float left, float bottom, float right, float top);
     40 
     41 
     42 /**  Get "MediaBox" entry from the page dictionary.
     43 * @param[in] page   - Handle to a page.
     44 * @param[in] left   - Pointer to a double value receiving the left of the rectangle.
     45 * @param[in] bottom - Pointer to a double value receiving the bottom of the rectangle.
     46 * @param[in] right  - Pointer to a double value receiving the right of the rectangle.
     47 * @param[in] top    - Pointer to a double value receiving the top of the rectangle.
     48 * @retval True if success,else fail.
     49 */
     50 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
     51 
     52 /**  Get "CropBox" entry from the page dictionary.
     53 * @param[in] page   - Handle to a page.
     54 * @param[in] left   - Pointer to a double value receiving the left of the rectangle.
     55 * @param[in] bottom - Pointer to a double value receiving the bottom of the rectangle.
     56 * @param[in] right  - Pointer to a double value receiving the right of the rectangle.
     57 * @param[in] top    - Pointer to a double value receiving the top of the rectangle.
     58 * @retval True if success,else fail.
     59 */
     60 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
     61 
     62 /**
     63 * Transform the whole page with a specified matrix, then clip the page content region.
     64 *
     65 * @param[in] page        - A page handle.
     66 * @param[in] matrix      - The transform matrix.
     67 * @param[in] clipRect    - A rectangle page area to be clipped.
     68 * @Note. This function will transform the whole page, and would take effect to all the objects in the page.
     69 */
     70 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX* matrix, FS_RECTF* clipRect);
     71 
     72 /**
     73 * Transform (scale, rotate, shear, move) the clip path of page object.
     74 * @param[in] page_object - Handle to a page object. Returned by FPDFPageObj_NewImageObj.
     75 * @param[in] a  - The coefficient "a" of the matrix.
     76 * @param[in] b  - The coefficient "b" of the matrix.
     77 * @param[in] c  - The coefficient "c" of the matrix.
     78 * @param[in] d  - The coefficient "d" of the matrix.
     79 * @param[in] e  - The coefficient "e" of the matrix.
     80 * @param[in] f  - The coefficient "f" of the matrix.
     81 * @retval None.
     82 */
     83 DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,double a, double b, double c, double d, double e, double f);
     84 
     85 /**
     86 * Create a new clip path, with a rectangle inserted.
     87 *
     88 * @param[in] left   - The left of the clip box.
     89 * @param[in] bottom - The bottom of the clip box.
     90 * @param[in] right  - The right of the clip box.
     91 * @param[in] top    - The top of the clip box.
     92 * @retval a handle to the clip path.
     93 */
     94 DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, float bottom, float right, float top);
     95 
     96 /**
     97 * Destroy the clip path.
     98 *
     99 * @param[in] clipPath - A handle to the clip path.
    100 * Destroy the clip path.
    101 * @retval None.
    102 */
    103 DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
    104 
    105 /**
    106 * Clip the page content, the page content that outside the clipping region become invisible.
    107 *
    108 * @param[in] page        - A page handle.
    109 * @param[in] clipPath    - A handle to the clip path.
    110 * @Note. A clip path will be inserted before the page content stream or content array. In this way, the page content will be clipped
    111 * by this clip path.
    112 */
    113 DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clipPath);
    114 
    115 #ifdef __cplusplus
    116 }
    117 #endif
    118 
    119 #endif  // PUBLIC_FPDF_TRANSFORMPAGE_H_
    120