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_PAGE_CPDF_PATHOBJECT_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_PATHOBJECT_H_
9 
10 #include "core/fpdfapi/page/cpdf_pageobject.h"
11 #include "core/fpdfapi/page/cpdf_path.h"
12 #include "core/fxcrt/fx_coordinates.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "core/fxge/render_defines.h"
15 
16 class CPDF_PathObject final : public CPDF_PageObject {
17  public:
18   explicit CPDF_PathObject(int32_t content_stream);
19   CPDF_PathObject();
20   ~CPDF_PathObject() override;
21 
22   // CPDF_PageObject
23   Type GetType() const override;
24   void Transform(const CFX_Matrix& matrix) override;
25   bool IsPath() const override;
26   CPDF_PathObject* AsPath() override;
27   const CPDF_PathObject* AsPath() const override;
28 
29   void CalcBoundingBox();
30 
stroke()31   bool stroke() const { return m_bStroke; }
set_stroke(bool stroke)32   void set_stroke(bool stroke) { m_bStroke = stroke; }
33 
34   // Layering, avoid caller knowledge of FXFILL_ values.
has_no_filltype()35   bool has_no_filltype() const { return m_FillType == 0; }
has_winding_filltype()36   bool has_winding_filltype() const { return m_FillType == FXFILL_WINDING; }
has_alternate_filltype()37   bool has_alternate_filltype() const { return m_FillType == FXFILL_ALTERNATE; }
set_no_filltype()38   void set_no_filltype() { m_FillType = 0; }
set_winding_filltype()39   void set_winding_filltype() { m_FillType = FXFILL_WINDING; }
set_alternate_filltype()40   void set_alternate_filltype() { m_FillType = FXFILL_ALTERNATE; }
41 
filltype()42   int filltype() const { return m_FillType; }
set_filltype(int filltype)43   void set_filltype(int filltype) { m_FillType = filltype; }
44 
path()45   CPDF_Path& path() { return m_Path; }
path()46   const CPDF_Path& path() const { return m_Path; }
47 
matrix()48   const CFX_Matrix& matrix() const { return m_Matrix; }
set_matrix(const CFX_Matrix & matrix)49   void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
50 
51  private:
52   bool m_bStroke = false;
53   int m_FillType = 0;
54   CPDF_Path m_Path;
55   CFX_Matrix m_Matrix;
56 };
57 
58 #endif  // CORE_FPDFAPI_PAGE_CPDF_PATHOBJECT_H_
59