• 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                  const PropertyData* properties,
36                  const AttributeData* attributes,
37                  const WideStringView& elementName,
38                  std::unique_ptr<CJX_Object> js_node);
39 
40  private:
41   void Stroke(const std::vector<CXFA_Stroke*>& strokes,
42               CXFA_Graphics* pGS,
43               CFX_RectF rtWidget,
44               const CFX_Matrix& matrix);
45   void StrokeEmbossed(CXFA_Graphics* pGS,
46                       CFX_RectF rt,
47                       float fThickness,
48                       const CFX_Matrix& matrix);
49   void StrokeLowered(CXFA_Graphics* pGS,
50                      CFX_RectF rt,
51                      float fThickness,
52                      const CFX_Matrix& matrix);
53   void StrokeRaised(CXFA_Graphics* pGS,
54                     CFX_RectF rt,
55                     float fThickness,
56                     const CFX_Matrix& matrix);
57   void StrokeEtched(CXFA_Graphics* pGS,
58                     CFX_RectF rt,
59                     float fThickness,
60                     const CFX_Matrix& matrix);
61   void StrokeRect(CXFA_Graphics* pGraphic,
62                   const CFX_RectF& rt,
63                   float fLineWidth,
64                   const CFX_Matrix& matrix,
65                   FX_ARGB argbTopLeft,
66                   FX_ARGB argbBottomRight);
67   void GetPath(const std::vector<CXFA_Stroke*>& strokes,
68                CFX_RectF rtWidget,
69                CXFA_GEPath& path,
70                int32_t nIndex,
71                bool bStart,
72                bool bCorner);
73 };
74 
75 #endif  // XFA_FXFA_PARSER_CXFA_RECTANGLE_H_
76