Gnash
0.8.11dev
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
libcore
SWFMatrix.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2005, 2006, 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
// Original author: Thatcher Ulrich <tu@tulrich.com> 2003
22
//
23
//
24
25
#ifndef GNASH_MATRIX_H
26
#define GNASH_MATRIX_H
27
28
#include "
dsodefs.h
"
// for DSOEXPORT
29
30
#include <iosfwd>
31
#include <boost/cstdint.hpp>
32
33
// Forward declarations
34
namespace
gnash {
35
class
SWFRect;
36
namespace
geometry {
37
class
Point2d;
38
template
<
typename
T>
class
Range2d;
39
}
40
}
41
42
43
namespace
gnash {
44
53
class
DSOEXPORT
SWFMatrix
54
{
55
public
:
56
58
SWFMatrix
()
59
:
60
_a
(65536),
61
_b
(0),
62
_c
(0),
63
_d(65536),
64
_tx(0),
65
_ty(0)
66
{}
67
69
SWFMatrix
(
int
a
,
int
b
,
int
c
,
int
d
,
int
x
,
int
y
)
70
:
71
_a
(a),
72
_b
(b),
73
_c
(c),
74
_d(d),
75
_tx(x),
76
_ty(y)
77
{}
78
79
boost::int32_t
a
()
const
{
80
return
_a
;
81
}
82
83
boost::int32_t
b
()
const
{
84
return
_b
;
85
}
86
87
boost::int32_t
c
()
const
{
88
return
_c
;
89
}
90
91
boost::int32_t
d
()
const
{
92
return
_d;
93
}
94
95
boost::int32_t
tx
()
const
{
96
return
_tx;
97
}
98
99
boost::int32_t
ty
()
const
{
100
return
_ty;
101
}
102
104
void
set_identity();
105
107
//
110
void
concatenate(
const
SWFMatrix
&
m
);
111
113
//
116
void
concatenate_translation(
int
_tx,
int
_ty);
117
119
//
122
void
concatenate_scale(
double
x
,
double
y
);
123
125
void
set_lerp(
const
SWFMatrix
& m1,
const
SWFMatrix
& m2,
float
t
);
126
128
void
set_scale_rotation(
double
x_scale,
double
y_scale,
double
rotation);
129
131
void
set_scale(
double
x_scale,
double
y_scale);
132
134
void
set_x_scale(
double
scale);
135
137
void
set_y_scale(
double
scale);
138
140
void
set_rotation(
double
rotation);
141
143
void
set_x_translation
(
int
x
) {
144
_tx =
x
;
145
}
146
148
void
set_y_translation
(
int
y
) {
149
_ty =
y
;
150
}
151
153
void
set_translation
(
int
x
,
int
y
) {
154
_tx =
x
;
155
_ty =
y
;
156
}
157
159
void
transform(
geometry::Point2d
&
p
)
const
;
160
162
void
transform(boost::int32_t&
x
, boost::int32_t&
y
)
const
;
163
165
//
168
void
transform(
geometry::Point2d
* result,
const
geometry::Point2d
&
p
)
const
;
169
171
//
174
void
transform(
geometry::Range2d<boost::int32_t>
&
r
)
const
;
175
176
void
transform(
SWFRect
&
r
)
const
;
177
179
SWFMatrix
& invert();
180
182
double
get_x_scale()
const
;
183
185
double
get_y_scale()
const
;
186
188
double
get_rotation()
const
;
189
191
int
get_x_translation
()
const
{
192
return
_tx;
193
}
194
196
int
get_y_translation
()
const
{
197
return
_ty;
198
}
199
201
friend
bool
operator==
(
const
SWFMatrix
&
a
,
const
SWFMatrix
&
b
);
202
203
private
:
204
206
boost::int64_t determinant()
const
;
207
209
boost::int32_t
_a
;
210
212
boost::int32_t
_b
;
213
215
boost::int32_t
_c
;
216
218
boost::int32_t _d;
219
221
boost::int32_t _tx;
222
224
boost::int32_t _ty;
225
226
227
};
//end of SWFMatrix
228
229
inline
bool
230
operator==
(
const
SWFMatrix
&
a
,
const
SWFMatrix
&
b
)
231
{
232
return
233
a.
a
() == b._a &&
234
a._b == b._b &&
235
a._tx == b._tx &&
236
a._d == b._d &&
237
a._c == b._c &&
238
a._ty == b._ty;
239
}
240
241
DSOTEXPORT
std::ostream&
operator<<
(std::ostream&
o
,
const
SWFMatrix&
m
);
242
243
}
// namespace gnash
244
245
#endif
246
247
248
// Local Variables:
249
// mode: C++
250
// indent-tabs-mode: t
251
// End:
252
//
Generated on Sat Nov 30 2013 06:54:23 for Gnash by
1.8.1.2