xref: /aosp_15_r20/external/pdfium/xfa/fxfa/parser/cxfa_stroke.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 XFA_FXFA_PARSER_CXFA_STROKE_H_
8 #define XFA_FXFA_PARSER_CXFA_STROKE_H_
9 
10 #include "core/fxcrt/mask.h"
11 #include "core/fxge/dib/fx_dib.h"
12 #include "xfa/fxfa/fxfa_basic.h"
13 #include "xfa/fxfa/parser/cxfa_node.h"
14 
15 class CFGAS_GEGraphics;
16 class CFGAS_GEPath;
17 class CXFA_Node;
18 
19 void XFA_StrokeTypeSetLineDash(CFGAS_GEGraphics* pGraphics,
20                                XFA_AttributeValue iStrokeType,
21                                XFA_AttributeValue iCapType);
22 
23 class CXFA_Stroke : public CXFA_Node {
24  public:
25   enum class SameStyleOption {
26     kNoPresence = 1 << 0,
27     kCorner = 1 << 1,
28   };
29   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
30   ~CXFA_Stroke() override;
31 
IsCorner()32   bool IsCorner() const { return GetElementType() == XFA_Element::Corner; }
33   bool IsVisible();
34   bool IsInverted();
35 
36   XFA_AttributeValue GetCapType();
37   XFA_AttributeValue GetStrokeType();
38   XFA_AttributeValue GetJoinType();
39   float GetRadius() const;
40   float GetThickness() const;
41 
42   CXFA_Measurement GetMSThickness() const;
43   void SetMSThickness(CXFA_Measurement msThinkness);
44 
45   FX_ARGB GetColor() const;
46   void SetColor(FX_ARGB argb);
47 
48   bool SameStyles(CXFA_Stroke* stroke, Mask<SameStyleOption> dwFlags);
49 
50   void Stroke(CFGAS_GEGraphics* pGS,
51               const CFGAS_GEPath& pPath,
52               const CFX_Matrix& matrix);
53 
54  protected:
55   CXFA_Stroke(CXFA_Document* pDoc,
56               XFA_PacketType ePacket,
57               Mask<XFA_XDPPACKET> validPackets,
58               XFA_ObjectType oType,
59               XFA_Element eType,
60               pdfium::span<const PropertyData> properties,
61               pdfium::span<const AttributeData> attributes,
62               CJX_Object* js_node);
63 };
64 
65 #endif  // XFA_FXFA_PARSER_CXFA_STROKE_H_
66