summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h
blob: b653d640d7a82ff9b603d62bfea72b9c304f5f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_
#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_

#include "core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h"
#include "core/fxcrt/include/fx_basic.h"

class CPDF_GeneralState {
 public:
  CPDF_GeneralState();
  CPDF_GeneralState(const CPDF_GeneralState& that);
  ~CPDF_GeneralState();

  void Emplace() { m_Ref.Emplace(); }
  operator bool() const { return !!m_Ref; }

  void SetRenderIntent(const CFX_ByteString& ri);

  int GetBlendType() const;
  void SetBlendType(int type);

  FX_FLOAT GetFillAlpha() const;
  void SetFillAlpha(FX_FLOAT alpha);

  FX_FLOAT GetStrokeAlpha() const;
  void SetStrokeAlpha(FX_FLOAT alpha);

  CPDF_Object* GetSoftMask() const;
  void SetSoftMask(CPDF_Object* pObject);

  CPDF_Object* GetTR() const;
  void SetTR(CPDF_Object* pObject);

  CPDF_TransferFunc* GetTransferFunc() const;
  void SetTransferFunc(CPDF_TransferFunc* pFunc);

  void SetBlendMode(const CFX_ByteStringC& mode);

  const FX_FLOAT* GetSMaskMatrix() const;
  FX_FLOAT* GetMutableSMaskMatrix();

  bool GetFillOP() const;
  void SetFillOP(bool op);

  bool GetStrokeOP() const;
  void SetStrokeOP(bool op);

  int GetOPMode() const;
  void SetOPMode(int mode);

  void SetBG(CPDF_Object* pObject);
  void SetUCR(CPDF_Object* pObject);
  void SetHT(CPDF_Object* pObject);

  void SetFlatness(FX_FLOAT flatness);
  void SetSmoothness(FX_FLOAT smoothness);

  bool GetStrokeAdjust() const;
  void SetStrokeAdjust(bool adjust);

  void SetAlphaSource(bool source);
  void SetTextKnockout(bool knockout);

  void SetMatrix(const CFX_Matrix& matrix);
  CFX_Matrix* GetMutableMatrix();

 private:
  CFX_CountRef<CPDF_GeneralStateData> m_Ref;
};

#endif  // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_