xref: /aosp_15_r20/external/pdfium/xfa/fxfa/parser/cxfa_rectangle.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 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 XFA_FXFA_PARSER_CXFA_RECTANGLE_H_
8 #define XFA_FXFA_PARSER_CXFA_RECTANGLE_H_
9 
10 #include <vector>
11 
12 #include "xfa/fgas/graphics/cfgas_gepath.h"
13 #include "xfa/fxfa/parser/cxfa_box.h"
14 
15 class CXFA_Rectangle : public CXFA_Box {
16  public:
17   static CXFA_Rectangle* FromNode(CXFA_Node* pNode);
18 
19   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
20   ~CXFA_Rectangle() override;
21 
22   void GetFillPath(const std::vector<CXFA_Stroke*>& strokes,
23                    const CFX_RectF& rtWidget,
24                    CFGAS_GEPath* fillPath);
25   void Draw(const std::vector<CXFA_Stroke*>& strokes,
26             CFGAS_GEGraphics* pGS,
27             CFX_RectF rtWidget,
28             const CFX_Matrix& matrix);
29 
30  protected:
31   CXFA_Rectangle(CXFA_Document* doc, XFA_PacketType packet);
32   CXFA_Rectangle(CXFA_Document* pDoc,
33                  XFA_PacketType ePacket,
34                  Mask<XFA_XDPPACKET> validPackets,
35                  XFA_ObjectType oType,
36                  XFA_Element eType,
37                  pdfium::span<const PropertyData> properties,
38                  pdfium::span<const AttributeData> attributes,
39                  CJX_Object* js_node);
40 
41   void Stroke(const std::vector<CXFA_Stroke*>& strokes,
42               CFGAS_GEGraphics* pGS,
43               CFX_RectF rtWidget,
44               const CFX_Matrix& matrix);
45   void StrokeEmbossed(CFGAS_GEGraphics* pGS,
46                       CFX_RectF rt,
47                       float fThickness,
48                       const CFX_Matrix& matrix);
49   void StrokeLowered(CFGAS_GEGraphics* pGS,
50                      CFX_RectF rt,
51                      float fThickness,
52                      const CFX_Matrix& matrix);
53   void StrokeRaised(CFGAS_GEGraphics* pGS,
54                     CFX_RectF rt,
55                     float fThickness,
56                     const CFX_Matrix& matrix);
57   void StrokeEtched(CFGAS_GEGraphics* pGS,
58                     CFX_RectF rt,
59                     float fThickness,
60                     const CFX_Matrix& matrix);
61   void StrokeRect(CFGAS_GEGraphics* 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                CFGAS_GEPath& path,
70                int32_t nIndex,
71                bool bStart,
72                bool bCorner);
73 };
74 
75 #endif  // XFA_FXFA_PARSER_CXFA_RECTANGLE_H_
76