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