Gnash
0.8.11dev
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
libcore
DynamicShape.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
3
// Free Software Foundation, Inc.
4
//
5
// This program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19
20
21
#ifndef GNASH_DYNAMIC_SHAPE_H
22
#define GNASH_DYNAMIC_SHAPE_H
23
24
#include "
LineStyle.h
"
25
#include "
ShapeRecord.h
"
26
27
namespace
gnash {
28
class
DisplayObject;
29
class
Renderer;
30
class
FillStyle;
31
class
GradientRecord;
32
class
Transform;
33
}
34
35
namespace
gnash {
36
38
//
41
//
44
class
DynamicShape
45
{
46
public
:
47
48
DynamicShape
();
49
50
~DynamicShape
() {}
51
53
void
clear
();
54
56
void
moveTo
(boost::int32_t
x
, boost::int32_t
y
);
57
59
void
lineTo
(boost::int32_t
x
, boost::int32_t
y
,
int
swfVersion);
60
64
void
curveTo
(boost::int32_t cx, boost::int32_t cy,
65
boost::int32_t ax, boost::int32_t ay,
int
swfVersion);
66
68
void
beginFill
(
const
FillStyle
&
f
);
69
71
void
endFill
();
72
73
const
SWFRect
&
getBounds
()
const
{
74
return
_shape.
getBounds
();
75
}
76
77
void
setBounds
(
const
SWFRect
& bounds) {
78
_shape.
setBounds
(bounds);
79
}
80
82
void
display
(
Renderer
& renderer,
const
Transform
& xform)
const
;
83
85
//
95
void
lineStyle
(boost::uint16_t thickness,
const
rgba
&
color
,
96
bool
vScale=
true
,
bool
hScale=
true
,
97
bool
pixelHinting=
false
,
98
bool
noClose=
false
,
99
CapStyle
startCapStyle=
CAP_ROUND
,
100
CapStyle
endCapStyle=
CAP_ROUND
,
101
JoinStyle
joinStyle=
JOIN_ROUND
,
102
float
miterLimitFactor=1.0
f
);
103
105
void
resetLineStyle
();
106
110
//
116
size_t
addFillStyle
(
const
FillStyle
& stl);
117
121
//
127
size_t
add_line_style
(
const
LineStyle
& stl);
128
129
// Override from DefineShapeTag to call ::finalize
130
// NOTE: this is not correct in that a call to hitTest should
131
// not force closing the path being drawn.
132
// Instead, the closeup should be "temporary" and in
133
// the pointTestLocal itself (but only for dynamic drawing).
134
// We need to add a testcase for this as we currently have none.
135
// The testcase would look like this:
136
//
137
// moveTo(0, 0); lineTo(10, 0); lineTo(10, 10); // an L shape so far
138
// hitTest(8, 2, true); !hitTest(2, 8, true); // imaginarly forming a closed triangle as hitTest is concerned
139
// lineTo(0, 10); lineTo(0, 0); // explicitly closed as a square now
140
// hitTest(8, 2, true); hitTest(2, 8, true); // effectively forming a closed square
141
//
142
// In the test above, permanently closing on hit-test (what this implementation does)
143
// would result in a triangle and a stroke, which should fail the last hitTest(2,8).
144
//
145
//
146
bool
pointTestLocal
(boost::int32_t
x
, boost::int32_t
y
,
147
const
SWFMatrix
& wm)
const
148
{
149
finalize
();
150
return
_shape.
pointTest
(x, y, wm);
151
}
152
153
const
SWF::ShapeRecord
&
shapeRecord
()
const
{
154
return
_shape;
155
}
156
158
//
163
void
add_path
(
const
Path
& pth);
164
166
//
169
void
finalize
()
const
;
170
171
private
:
172
174
//
181
void
startNewPath(
bool
newShape);
182
183
184
185
Path
* _currpath;
186
187
size_t
_currfill;
188
189
size_t
_currline;
190
191
// Current pen X position
192
boost::int32_t _x;
193
194
// Current pen Y position
195
boost::int32_t _y;
196
197
mutable
bool
_changed;
198
199
mutable
SWF::Subshape
_currsubshape;
200
202
//
204
mutable
SWF::ShapeRecord
_shape;
205
};
206
207
}
// end namespace gnash
208
209
210
#endif // GNASH_DYNAMIC_SHAPE_H
211
212
213
// Local Variables:
214
// mode: C++
215
// c-basic-offset: 8
216
// tab-width: 8
217
// indent-tabs-mode: t
218
// End:
Generated on Sat Nov 30 2013 06:54:21 for Gnash by
1.8.1.2