• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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 XFA_FXFA_PARSER_CXFA_RECTANGLE_H_
8 #define XFA_FXFA_PARSER_CXFA_RECTANGLE_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 #include "xfa/fxfa/parser/cxfa_box.h"
14 #include "xfa/fxgraphics/cxfa_gepath.h"
15 
16 class CXFA_Rectangle : public CXFA_Box {
17  public:
18   CXFA_Rectangle(CXFA_Document* doc, XFA_PacketType packet);
19   ~CXFA_Rectangle() override;
20 
21   void GetFillPath(const std::vector<CXFA_Stroke*>& strokes,
22                    const CFX_RectF& rtWidget,
23                    CXFA_GEPath* fillPath);
24   void Draw(const std::vector<CXFA_Stroke*>& strokes,
25             CXFA_Graphics* pGS,
26             CFX_RectF rtWidget,
27             const CFX_Matrix& matrix);
28 
29  protected:
30   CXFA_Rectangle(CXFA_Document* pDoc,
31                  XFA_PacketType ePacket,
32                  uint32_t validPackets,
33                  XFA_ObjectType oType,
34                  XFA_Element eType,
35                  pdfium::span<const PropertyData> properties,
36                  pdfium::span<const AttributeData> attributes,
37                  std::unique_ptr<CJX_Object> js_node);
38 
39  private:
40   void Stroke(const std::vector<CXFA_Stroke*>& strokes,
41               CXFA_Graphics* pGS,
42               CFX_RectF rtWidget,
43               const CFX_Matrix& matrix);
44   void StrokeEmbossed(CXFA_Graphics* pGS,
45                       CFX_RectF rt,
46                       float fThickness,
47                       const CFX_Matrix& matrix);
48   void StrokeLowered(CXFA_Graphics* pGS,
49                      CFX_RectF rt,
50                      float fThickness,
51                      const CFX_Matrix& matrix);
52   void StrokeRaised(CXFA_Graphics* pGS,
53                     CFX_RectF rt,
54                     float fThickness,
55                     const CFX_Matrix& matrix);
56   void StrokeEtched(CXFA_Graphics* pGS,
57                     CFX_RectF rt,
58                     float fThickness,
59                     const CFX_Matrix& matrix);
60   void StrokeRect(CXFA_Graphics* pGraphic,
61                   const CFX_RectF& rt,
62                   float fLineWidth,
63                   const CFX_Matrix& matrix,
64                   FX_ARGB argbTopLeft,
65                   FX_ARGB argbBottomRight);
66   void GetPath(const std::vector<CXFA_Stroke*>& strokes,
67                CFX_RectF rtWidget,
68                CXFA_GEPath& path,
69                int32_t nIndex,
70                bool bStart,
71                bool bCorner);
72 };
73 
74 #endif  // XFA_FXFA_PARSER_CXFA_RECTANGLE_H_
75