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_RENDEROPTIONS_H_ 8 #define CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_ 9 10 #include "core/fpdfapi/page/cpdf_occontext.h" 11 #include "core/fxcrt/fx_system.h" 12 #include "core/fxcrt/retain_ptr.h" 13 #include "core/fxge/fx_dib.h" 14 15 class CPDF_RenderOptions { 16 public: 17 enum Type : uint8_t { kNormal = 0, kGray, kAlpha }; 18 19 struct Options { 20 Options(); 21 Options(const Options& rhs); 22 23 bool bClearType = false; 24 bool bPrintGraphicText = false; 25 bool bPrintPreview = false; 26 bool bBGRStripe = false; 27 bool bNoNativeText = false; 28 bool bForceHalftone = false; 29 bool bRectAA = false; 30 bool bFillFullcover = false; 31 bool bPrintImageText = false; 32 bool bOverprint = false; 33 bool bThinLine = false; 34 bool bBreakForMasks = false; 35 bool bNoTextSmooth = false; 36 bool bNoPathSmooth = false; 37 bool bNoImageSmooth = false; 38 bool bLimitedImageCache = false; 39 }; 40 41 CPDF_RenderOptions(); 42 CPDF_RenderOptions(const CPDF_RenderOptions& rhs); 43 ~CPDF_RenderOptions(); 44 45 FX_ARGB TranslateColor(FX_ARGB argb) const; 46 SetColorMode(Type mode)47 void SetColorMode(Type mode) { m_ColorMode = mode; } ColorModeIs(Type mode)48 bool ColorModeIs(Type mode) const { return m_ColorMode == mode; } 49 GetOptions()50 const Options& GetOptions() const { return m_Options; } GetOptions()51 Options& GetOptions() { return m_Options; } 52 53 uint32_t GetCacheSizeLimit() const; 54 SetDrawAnnots(bool draw)55 void SetDrawAnnots(bool draw) { m_bDrawAnnots = draw; } GetDrawAnnots()56 bool GetDrawAnnots() const { return m_bDrawAnnots; } 57 SetOCContext(RetainPtr<CPDF_OCContext> context)58 void SetOCContext(RetainPtr<CPDF_OCContext> context) { 59 m_pOCContext = context; 60 } GetOCContext()61 const CPDF_OCContext* GetOCContext() const { return m_pOCContext.Get(); } 62 63 private: 64 Type m_ColorMode = kNormal; 65 bool m_bDrawAnnots = false; 66 Options m_Options; 67 RetainPtr<CPDF_OCContext> m_pOCContext; 68 }; 69 70 #endif // CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_ 71