xref: /aosp_15_r20/external/pdfium/core/fxge/cfx_graphstate.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2016 The PDFium Authors
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_FXGE_CFX_GRAPHSTATE_H_
8 #define CORE_FXGE_CFX_GRAPHSTATE_H_
9 
10 #include <stddef.h>
11 
12 #include <vector>
13 
14 #include "core/fxcrt/shared_copy_on_write.h"
15 #include "core/fxge/cfx_graphstatedata.h"
16 
17 class CFX_GraphState {
18  public:
19   CFX_GraphState();
20   CFX_GraphState(const CFX_GraphState& that);
21   ~CFX_GraphState();
22 
23   void Emplace();
24 
25   void SetLineDash(std::vector<float> dashes, float phase, float scale);
26   void SetLineDashPhase(float phase);
27   std::vector<float> GetLineDashArray() const;
28   size_t GetLineDashSize() const;
29   float GetLineDashPhase() const;
30 
31   float GetLineWidth() const;
32   void SetLineWidth(float width);
33 
34   CFX_GraphStateData::LineCap GetLineCap() const;
35   void SetLineCap(CFX_GraphStateData::LineCap cap);
36 
37   CFX_GraphStateData::LineJoin GetLineJoin() const;
38   void SetLineJoin(CFX_GraphStateData::LineJoin join);
39 
40   float GetMiterLimit() const;
41   void SetMiterLimit(float limit);
42 
43   // FIXME(tsepez): remove when all GraphStateData usage gone.
GetObject()44   const CFX_GraphStateData* GetObject() const { return m_Ref.GetObject(); }
45 
46  private:
47   SharedCopyOnWrite<CFX_RetainableGraphStateData> m_Ref;
48 };
49 
50 #endif  // CORE_FXGE_CFX_GRAPHSTATE_H_
51