Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cxfa_pattern.cpp
Go to the documentation of this file.
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
#
include
"xfa/fxfa/parser/cxfa_pattern.h"
8
9
#
include
"fxjs/xfa/cjx_node.h"
10
#
include
"xfa/fgas/graphics/cfgas_gegraphics.h"
11
#
include
"xfa/fgas/graphics/cfgas_gepattern.h"
12
#
include
"xfa/fxfa/parser/cxfa_color.h"
13
#
include
"xfa/fxfa/parser/cxfa_document.h"
14
15
namespace
{
16
17
const
CXFA_Node
::
PropertyData
kPatternPropertyData[] = {
18
{
XFA_Element
::Color, 1, {}},
19
{
XFA_Element
::Extras, 1, {}},
20
};
21
22
const
CXFA_Node
::
AttributeData
kPatternAttributeData[] = {
23
{
XFA_Attribute
::Id,
XFA_AttributeType
::
CData
,
nullptr
},
24
{
XFA_Attribute
::Use,
XFA_AttributeType
::
CData
,
nullptr
},
25
{
XFA_Attribute
::Type,
XFA_AttributeType
::
Enum
,
26
(
void
*)
XFA_AttributeValue
::CrossHatch},
27
{
XFA_Attribute
::Usehref,
XFA_AttributeType
::
CData
,
nullptr
},
28
};
29
30
}
// namespace
31
32
CXFA_Pattern::CXFA_Pattern(CXFA_Document* doc,
XFA_PacketType
packet)
33
: CXFA_Node(doc,
34
packet,
35
{XFA_XDPPACKET::kTemplate, XFA_XDPPACKET::kForm},
36
XFA_ObjectType::Node,
37
XFA_Element::Pattern,
38
kPatternPropertyData,
39
kPatternAttributeData,
40
cppgc::MakeGarbageCollected<CJX_Node>(
41
doc->GetHeap()->GetAllocationHandle(),
42
this
)) {}
43
44
CXFA_Pattern::~
CXFA_Pattern
() =
default
;
45
46
CXFA_Color* CXFA_Pattern::GetColorIfExists() {
47
return
GetChild<CXFA_Color>(0,
XFA_Element
::Color,
false
);
48
}
49
50
XFA_AttributeValue
CXFA_Pattern::GetType() {
51
return
JSObject()->GetEnum(
XFA_Attribute
::Type);
52
}
53
54
void
CXFA_Pattern::
Draw
(
CFGAS_GEGraphics
* pGS,
55
const
CFGAS_GEPath& fillPath,
56
FX_ARGB
crStart,
57
const
CFX_RectF
& rtFill,
58
const
CFX_Matrix
& matrix) {
59
CXFA_Color* pColor = GetColorIfExists();
60
FX_ARGB
crEnd = pColor ? pColor
->
GetValue
(
)
: CXFA_Color
::
kBlackColor
;
61
CFGAS_GEPattern::
HatchStyle
iHatch = CFGAS_GEPattern
::
HatchStyle
::
Cross
;
62
switch
(GetType()) {
63
case
XFA_AttributeValue
::CrossDiagonal:
64
iHatch = CFGAS_GEPattern
::
HatchStyle
::
DiagonalCross
;
65
break
;
66
case
XFA_AttributeValue
::DiagonalLeft:
67
iHatch = CFGAS_GEPattern
::
HatchStyle
::
ForwardDiagonal
;
68
break
;
69
case
XFA_AttributeValue
::DiagonalRight:
70
iHatch = CFGAS_GEPattern
::
HatchStyle
::
BackwardDiagonal
;
71
break
;
72
case
XFA_AttributeValue
::Horizontal:
73
iHatch = CFGAS_GEPattern
::
HatchStyle
::
Horizontal
;
74
break
;
75
case
XFA_AttributeValue
::Vertical:
76
iHatch = CFGAS_GEPattern
::
HatchStyle
::
Vertical
;
77
break
;
78
default
:
79
break
;
80
}
81
82
CFGAS_GEPattern pattern
(
iHatch
,
crEnd
,
crStart
)
;
83
CFGAS_GEGraphics
::
StateRestorer
restorer
(
pGS
)
;
84
pGS
->
SetFillColor
(
CFGAS_GEColor
(
&pattern
,
0x0
)
)
;
85
pGS
->
FillPath
(
fillPath
,
CFX_FillRenderOptions
::
FillType
::
kWinding
,
matrix
)
;
86
}
CFGAS_GEColor
Definition
cfgas_gecolor.h:19
CFGAS_GEColor::CFGAS_GEColor
CFGAS_GEColor(CFGAS_GEPattern *pattern, FX_ARGB argb)
Definition
cfgas_gecolor.cpp:11
CFGAS_GEGraphics::StateRestorer
Definition
cfgas_gegraphics.h:28
CFGAS_GEGraphics::StateRestorer::StateRestorer
StateRestorer(CFGAS_GEGraphics *graphics)
Definition
cfgas_gegraphics.cpp:421
CFGAS_GEGraphics
Definition
cfgas_gegraphics.h:26
CFGAS_GEGraphics::FillPath
void FillPath(const CFGAS_GEPath &path, CFX_FillRenderOptions::FillType fill_type, const CFX_Matrix &matrix)
Definition
cfgas_gegraphics.cpp:178
CFGAS_GEGraphics::SetFillColor
void SetFillColor(const CFGAS_GEColor &color)
Definition
cfgas_gegraphics.cpp:169
CFGAS_GEPattern::CFGAS_GEPattern
CFGAS_GEPattern(HatchStyle hatchStyle, FX_ARGB foreArgb, FX_ARGB backArgb)
Definition
cfgas_gepattern.cpp:9
CFGAS_GEPattern::HatchStyle
HatchStyle
Definition
cfgas_gepattern.h:14
CFGAS_GEPattern::HatchStyle::Vertical
@ Vertical
Definition
cfgas_gepattern.h:16
CFGAS_GEPattern::HatchStyle::DiagonalCross
@ DiagonalCross
Definition
cfgas_gepattern.h:20
CFGAS_GEPattern::HatchStyle::ForwardDiagonal
@ ForwardDiagonal
Definition
cfgas_gepattern.h:17
CFGAS_GEPattern::HatchStyle::BackwardDiagonal
@ BackwardDiagonal
Definition
cfgas_gepattern.h:18
CFGAS_GEPattern::HatchStyle::Horizontal
@ Horizontal
Definition
cfgas_gepattern.h:15
CFGAS_GEPattern::HatchStyle::Cross
@ Cross
Definition
cfgas_gepattern.h:19
CFX_Matrix
Definition
fx_coordinates.h:440
CFX_RectF
Definition
fx_coordinates.h:276
CXFA_Color::GetValue
FX_ARGB GetValue() const
Definition
cxfa_color.cpp:101
CXFA_Color::kBlackColor
static constexpr FX_ARGB kBlackColor
Definition
cxfa_color.h:15
CXFA_Node
Definition
cxfa_node.h:94
CXFA_Pattern::~CXFA_Pattern
~CXFA_Pattern() override
CXFA_Pattern::Draw
void Draw(CFGAS_GEGraphics *pGS, const CFGAS_GEPath &fillPath, FX_ARGB crStart, const CFX_RectF &rtFill, const CFX_Matrix &matrix)
Definition
cxfa_pattern.cpp:54
FX_ARGB
uint32_t FX_ARGB
Definition
fx_dib.h:36
XFA_AttributeType
XFA_AttributeType
Definition
fxfa_basic.h:83
XFA_AttributeType::Enum
@ Enum
Definition
fxfa_basic.h:84
XFA_AttributeType::CData
@ CData
Definition
fxfa_basic.h:85
XFA_Attribute
XFA_Attribute
Definition
fxfa_basic.h:67
XFA_Element
XFA_Element
Definition
fxfa_basic.h:75
XFA_AttributeValue
XFA_AttributeValue
Definition
fxfa_basic.h:60
XFA_PacketType
XFA_PacketType
Definition
fxfa_basic.h:44
CFX_FillRenderOptions
Definition
cfx_fillrenderoptions.h:11
CFX_FillRenderOptions::FillType
FillType
Definition
cfx_fillrenderoptions.h:13
CFX_FillRenderOptions::FillType::kWinding
@ kWinding
Definition
cfx_fillrenderoptions.h:23
CXFA_Node::AttributeData
Definition
cxfa_node.h:110
CXFA_Node::PropertyData
Definition
cxfa_node.h:96
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fxfa
parser
cxfa_pattern.cpp
Generated on
for Qt by
1.18.0