Gnash  0.8.11dev
MorphShape.h
Go to the documentation of this file.
1 // MorphShape.h: the MorphShape DisplayObject implementation for Gnash.
2 //
3 // Copyright (C) 2005, 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 #ifndef GNASH_MORPH_SHAPE_H
21 #define GNASH_MORPH_SHAPE_H
22 
23 #include "DisplayObject.h"
25 #include <boost/intrusive_ptr.hpp>
26 #include <cassert>
27 
28 namespace gnash {
29  class Renderer;
30 }
31 
32 namespace gnash {
33 
35 //
39 //
45 //
48 class MorphShape : public DisplayObject
49 {
50 
51 public:
52 
53  MorphShape(movie_root& mr, as_object* object,
55 
56  virtual void display(Renderer& renderer, const Transform& xform);
57 
58  virtual SWFRect getBounds() const;
59 
60  virtual bool pointInShape(std::int32_t x, std::int32_t y) const;
61 
62  const SWF::ShapeRecord& shape() const {
63  return _shape;
64  }
65 
66 private:
67 
68  void morph();
69 
70  double currentRatio() const;
71 
72  const boost::intrusive_ptr<const SWF::DefineMorphShapeTag> _def;
73 
74  SWF::ShapeRecord _shape;
75 
76 };
77 
78 
79 } // namespace gnash
80 
81 
82 #endif
83 
84 
85 // Local Variables:
86 // mode: C++
87 // indent-tabs-mode: t
88 // End:
gnash::SWF::ShapeRecord::pointTest
bool pointTest(std::int32_t x, std::int32_t y, const SWFMatrix &wm) const
Definition: ShapeRecord.h:183
MorphShape.h
ShapeRecord.h
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
y
std::int32_t y
Definition: BitmapData_as.cpp:435
gnash::MorphShape::MorphShape
MorphShape(movie_root &mr, as_object *object, const SWF::DefineMorphShapeTag *def, DisplayObject *parent)
Definition: MorphShape.cpp:30
gnash::MorphShape::pointInShape
virtual bool pointInShape(std::int32_t x, std::int32_t y) const
Return true if the given point falls in this DisplayObject's shape.
Definition: MorphShape.cpp:40
DefineMorphShapeTag.h
gnash::SWFMatrix::invert
SWFMatrix & invert()
Invert this SWFMatrix and return the result.
Definition: SWFMatrix.cpp:288
gnash::SWF::DefineMorphShapeTag
DefineMorphShape tag.
Definition: DefineMorphShapeTag.h:46
gnash::SWFRect::expand_to_rect
DSOEXPORT void expand_to_rect(const SWFRect &r)
Makes union of the given and the current SWFRect.
Definition: SWFRect.cpp:56
Geometry.h
Transform.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::SWF::ShapeRecord::getBounds
const SWFRect & getBounds() const
Definition: ShapeRecord.h:166
gnash::getWorldMatrix
SWFMatrix getWorldMatrix(const DisplayObject &d, bool includeRoot=true)
Get concatenated SWFMatrix (all ancestor transforms and our SWFMatrix)
Definition: DisplayObject.h:1131
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
gnash::DisplayObject::transform
const Transform & transform() const
Definition: DisplayObject.h:292
gnash::SWFRect
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:45
gnash::geometry::Point2d::x
std::int32_t x
The x coordinate.
Definition: Point2d.h:43
gnash::MorphShape::getBounds
virtual SWFRect getBounds() const
Definition: MorphShape.cpp:79
gnash::SWFMatrix::transform
void transform(geometry::Point2d &p) const
Transform a given point by our SWFMatrix.
Definition: SWFMatrix.cpp:99
gnash::SWFMatrix
Definition: SWFMatrix.h:54
gnash::geometry::Point2d
2D Point class
Definition: Point2d.h:39
DisplayObject.h
gnash::DisplayObject::clear_invalidated
void clear_invalidated()
Definition: DisplayObject.h:720
gnash::DisplayObject::parent
DisplayObject * parent() const
Return the parent of this DisplayObject, or NULL if the DisplayObject has no parent.
Definition: DisplayObject.h:252
gnash::movie_root
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:151
gnash::SWFRect::point_test
bool point_test(std::int32_t x, std::int32_t y) const
Return true if the given point is inside this SWFRect.
Definition: SWFRect.h:143
gnash::MorphShape::display
virtual void display(Renderer &renderer, const Transform &xform)
Render the DisplayObject.
Definition: MorphShape.cpp:62
gnash::MorphShape::shape
const SWF::ShapeRecord & shape() const
Definition: MorphShape.h:62
gnash::geometry::Point2d::y
std::int32_t y
The y coordinate.
Definition: Point2d.h:46
gnash::DisplayObject
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:169
gnash::SWF::ShapeRecord
Holds information needed to draw a shape.
Definition: ShapeRecord.h:127
gnash::MorphShape
A DisplayObject that tweens between two shapes.
Definition: MorphShape.h:49
gnash::DisplayObject::get_ratio
std::uint16_t get_ratio() const
Definition: DisplayObject.h:360
gnash::Transform
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:34
x
std::int32_t x
Definition: BitmapData_as.cpp:434
gnash::SWF::ShapeRecord::setLerp
void setLerp(const ShapeRecord &a, const ShapeRecord &b, const double ratio)
Set to the lerp of two ShapeRecords.
Definition: ShapeRecord.cpp:132
SWFMatrix.h