Home | History | Annotate | Download | only in render
      1 // Copyright 2016 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 CORE_FPDFAPI_RENDER_CPDF_RENDERCONTEXT_H_
      8 #define CORE_FPDFAPI_RENDER_CPDF_RENDERCONTEXT_H_
      9 
     10 #include <vector>
     11 
     12 #include "core/fxcrt/fx_basic.h"
     13 #include "core/fxcrt/fx_coordinates.h"
     14 
     15 class CPDF_Dictionary;
     16 class CPDF_Document;
     17 class CPDF_Page;
     18 class CPDF_PageObject;
     19 class CPDF_PageObjectHolder;
     20 class CPDF_PageRenderCache;
     21 class CPDF_RenderOptions;
     22 class CFX_DIBitmap;
     23 class CFX_Matrix;
     24 class CFX_RenderDevice;
     25 
     26 class CPDF_RenderContext {
     27  public:
     28   class Layer {
     29    public:
     30     CPDF_PageObjectHolder* m_pObjectHolder;
     31     CFX_Matrix m_Matrix;
     32   };
     33 
     34   explicit CPDF_RenderContext(CPDF_Page* pPage);
     35   CPDF_RenderContext(CPDF_Document* pDoc, CPDF_PageRenderCache* pPageCache);
     36   ~CPDF_RenderContext();
     37 
     38   void AppendLayer(CPDF_PageObjectHolder* pObjectHolder,
     39                    const CFX_Matrix* pObject2Device);
     40 
     41   void Render(CFX_RenderDevice* pDevice,
     42               const CPDF_RenderOptions* pOptions,
     43               const CFX_Matrix* pFinalMatrix);
     44 
     45   void Render(CFX_RenderDevice* pDevice,
     46               const CPDF_PageObject* pStopObj,
     47               const CPDF_RenderOptions* pOptions,
     48               const CFX_Matrix* pFinalMatrix);
     49 
     50   void GetBackground(CFX_DIBitmap* pBuffer,
     51                      const CPDF_PageObject* pObj,
     52                      const CPDF_RenderOptions* pOptions,
     53                      CFX_Matrix* pFinalMatrix);
     54 
     55   size_t CountLayers() const { return m_Layers.size(); }
     56   Layer* GetLayer(uint32_t index) { return &m_Layers[index]; }
     57 
     58   CPDF_Document* GetDocument() const { return m_pDocument; }
     59   CPDF_Dictionary* GetPageResources() const { return m_pPageResources; }
     60   CPDF_PageRenderCache* GetPageCache() const { return m_pPageCache; }
     61 
     62  protected:
     63   CPDF_Document* const m_pDocument;
     64   CPDF_Dictionary* m_pPageResources;
     65   CPDF_PageRenderCache* m_pPageCache;
     66   std::vector<Layer> m_Layers;
     67 };
     68 
     69 #endif  // CORE_FPDFAPI_RENDER_CPDF_RENDERCONTEXT_H_
     70