OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ |
8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ | 8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ |
9 | 9 |
10 #include "core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h" |
11 #include "core/fxcrt/include/fx_basic.h" | 11 #include "core/fxcrt/include/fx_basic.h" |
12 | 12 |
13 class CPDF_GeneralState : public CFX_CountRef<CPDF_GeneralStateData> { | 13 class CPDF_GeneralState { |
14 public: | 14 public: |
| 15 CPDF_GeneralState(); |
| 16 CPDF_GeneralState(const CPDF_GeneralState& that); |
| 17 ~CPDF_GeneralState(); |
| 18 |
| 19 void Emplace() { m_Ref.Emplace(); } |
| 20 operator bool() const { return !!m_Ref; } |
| 21 |
15 void SetRenderIntent(const CFX_ByteString& ri); | 22 void SetRenderIntent(const CFX_ByteString& ri); |
16 | 23 |
17 int GetBlendType() const { | 24 int GetBlendType() const; |
18 const CPDF_GeneralStateData* pData = GetObject(); | 25 void SetBlendType(int type); |
19 return pData ? pData->m_BlendType : FXDIB_BLEND_NORMAL; | |
20 } | |
21 | 26 |
22 int GetAlpha(FX_BOOL bStroke) const { | 27 FX_FLOAT GetFillAlpha() const; |
23 const CPDF_GeneralStateData* pData = GetObject(); | 28 void SetFillAlpha(FX_FLOAT alpha); |
24 if (!pData) | 29 |
25 return 255; | 30 FX_FLOAT GetStrokeAlpha() const; |
26 return FXSYS_round((bStroke ? pData->m_StrokeAlpha : pData->m_FillAlpha) * | 31 void SetStrokeAlpha(FX_FLOAT alpha); |
27 255); | 32 |
28 } | 33 CPDF_Object* GetSoftMask() const; |
| 34 void SetSoftMask(CPDF_Object* pObject); |
| 35 |
| 36 CPDF_Object* GetTR() const; |
| 37 void SetTR(CPDF_Object* pObject); |
| 38 |
| 39 CPDF_TransferFunc* GetTransferFunc() const; |
| 40 void SetTransferFunc(CPDF_TransferFunc* pFunc); |
| 41 |
| 42 void SetBlendMode(const CFX_ByteStringC& mode); |
| 43 |
| 44 const FX_FLOAT* GetSMaskMatrix() const; |
| 45 FX_FLOAT* GetMutableSMaskMatrix(); |
| 46 |
| 47 bool GetFillOP() const; |
| 48 void SetFillOP(bool op); |
| 49 |
| 50 bool GetStrokeOP() const; |
| 51 void SetStrokeOP(bool op); |
| 52 |
| 53 int GetOPMode() const; |
| 54 void SetOPMode(int mode); |
| 55 |
| 56 void SetBG(CPDF_Object* pObject); |
| 57 void SetUCR(CPDF_Object* pObject); |
| 58 void SetHT(CPDF_Object* pObject); |
| 59 |
| 60 void SetFlatness(FX_FLOAT flatness); |
| 61 void SetSmoothness(FX_FLOAT smoothness); |
| 62 |
| 63 bool GetStrokeAdjust() const; |
| 64 void SetStrokeAdjust(bool adjust); |
| 65 |
| 66 void SetAlphaSource(bool source); |
| 67 void SetTextKnockout(bool knockout); |
| 68 |
| 69 void SetMatrix(const CFX_Matrix& matrix); |
| 70 CFX_Matrix* GetMutableMatrix(); |
| 71 |
| 72 private: |
| 73 CFX_CountRef<CPDF_GeneralStateData> m_Ref; |
29 }; | 74 }; |
30 | 75 |
31 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ | 76 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ |
OLD | NEW |