• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/fpdfdoc/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 #define RENDER_CLEARTYPE 0x00000001
16 #define RENDER_PRINTGRAPHICTEXT 0x00000002
17 #define RENDER_FORCE_DOWNSAMPLE 0x00000004
18 #define RENDER_PRINTPREVIEW 0x00000008
19 #define RENDER_BGR_STRIPE 0x00000010
20 #define RENDER_NO_NATIVETEXT 0x00000020
21 #define RENDER_FORCE_HALFTONE 0x00000040
22 #define RENDER_RECT_AA 0x00000080
23 #define RENDER_FILL_FULLCOVER 0x00000100
24 #define RENDER_PRINTIMAGETEXT 0x00000200
25 #define RENDER_OVERPRINT 0x00000400
26 #define RENDER_THINLINE 0x00000800
27 #define RENDER_BREAKFORMASKS 0x00001000
28 #define RENDER_NOTEXTSMOOTH 0x10000000
29 #define RENDER_NOPATHSMOOTH 0x20000000
30 #define RENDER_NOIMAGESMOOTH 0x40000000
31 #define RENDER_LIMITEDIMAGECACHE 0x80000000
32 
33 class CPDF_RenderOptions {
34  public:
35   enum Type { kNormal = 0, kGray, kAlpha };
36 
37   CPDF_RenderOptions();
38   CPDF_RenderOptions(const CPDF_RenderOptions& rhs);
39   ~CPDF_RenderOptions();
40 
41   FX_ARGB TranslateColor(FX_ARGB argb) const;
42 
SetColorMode(Type mode)43   void SetColorMode(Type mode) { m_ColorMode = mode; }
ColorModeIs(Type mode)44   bool ColorModeIs(Type mode) const { return m_ColorMode == mode; }
45 
HasFlag(uint32_t flag)46   bool HasFlag(uint32_t flag) const { return !!(m_Flags & flag); }
GetFlags()47   uint32_t GetFlags() const { return m_Flags; }
SetFlags(uint32_t flags)48   void SetFlags(uint32_t flags) { m_Flags = flags; }
49 
GetCacheSizeLimit()50   uint32_t GetCacheSizeLimit() const { return m_dwLimitCacheSize; }
51 
SetDrawAnnots(bool draw)52   void SetDrawAnnots(bool draw) { m_bDrawAnnots = draw; }
GetDrawAnnots()53   bool GetDrawAnnots() const { return m_bDrawAnnots; }
54 
SetOCContext(RetainPtr<CPDF_OCContext> context)55   void SetOCContext(RetainPtr<CPDF_OCContext> context) {
56     m_pOCContext = context;
57   }
GetOCContext()58   CPDF_OCContext* GetOCContext() const { return m_pOCContext.Get(); }
59 
60  private:
61   Type m_ColorMode;
62   uint32_t m_Flags;
63   uint32_t m_dwLimitCacheSize;
64   bool m_bDrawAnnots;
65   RetainPtr<CPDF_OCContext> m_pOCContext;
66 };
67 
68 #endif  // CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_
69