1 // DefineMorphShapeTag.h:   Load and parse morphing shapes, for Gnash.
2 //
3 //   Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 //   Free Software Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 //
20 // Based on the public domain work of Mike Shaver <shaver@off.net> 2003,
21 // Vitalij Alexeev <tishka92@mail.ru> 2004.
22 
23 #ifndef GNASH_SWF_MORPH_SHAPE_H
24 #define GNASH_SWF_MORPH_SHAPE_H
25 
26 #include "SWF.h"
27 #include "ShapeRecord.h"
28 #include "DefinitionTag.h"
29 
30 // Forward declarations.
31 namespace gnash {
32     class movie_definition;
33     class SWFStream;
34 	class RunResources;
35     class MorphShape;
36     class Renderer;
37     class Transform;
38 }
39 
40 namespace gnash {
41 namespace SWF {
42 
43 /// DefineMorphShape tag
44 //
45 class DefineMorphShapeTag : public DefinitionTag
46 {
47 public:
48 
49     static void loader(SWFStream& in, TagType tag, movie_definition& m,
50             const RunResources& r);
51 
~DefineMorphShapeTag()52     virtual ~DefineMorphShapeTag() {}
53 
54 	virtual DisplayObject* createDisplayObject(Global_as& gl,
55             DisplayObject* parent) const;
56 
57     void display(Renderer& renderer, const ShapeRecord& shape,
58             const Transform& base) const;
59 
shape1()60     const ShapeRecord& shape1() const {
61         return _shape1;
62     }
63 
shape2()64     const ShapeRecord& shape2() const {
65         return _shape2;
66     }
67 
68 private:
69 
70     DefineMorphShapeTag(SWFStream& in, SWF::TagType tag, movie_definition& md,
71             const RunResources& r, std::uint16_t id);
72 
73     /// Read a DefineMorphShape tag from stream
74     //
75     /// Throw ParserException if the tag is malformed
76     ///
77     /// @param in
78     ///	The stream to read the definition from.
79     ///	Tag type is assumed to have been read already
80     ///
81     /// @param TagType
82     ///	Type of the tag.
83     ///	Need be SWF::DEFINEMORPHSHAPE or an assertion would fail.
84     ///	TODO: drop ?
85     ///
86     /// @param md
87     ///	Movie definition. Used to resolv DisplayObject ids for fill styles.
88     ///	Must be not-null or would segfault.
89     ///
90     void read(SWFStream& in, SWF::TagType tag, movie_definition& m,
91             const RunResources& r);
92 
93     ShapeRecord _shape1;
94     ShapeRecord _shape2;
95 
96     SWFRect _bounds;
97 
98 };
99 
100 } // namespace SWF
101 } // namespace gnash
102 
103 
104 #endif
105 
106 // Local Variables:
107 // mode: C++
108 // c-basic-offset: 8
109 // tab-width: 8
110 // indent-tabs-mode: t
111 // End:
112