Gnash  0.8.11dev
Shape.h
Go to the documentation of this file.
1 // Shape.h: Shape 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_SHAPE_H
21 #define GNASH_SHAPE_H
22 
23 #include "DisplayObject.h"
24 #include "DefineShapeTag.h"
25 #include "DynamicShape.h"
26 
27 #include <boost/intrusive_ptr.hpp>
28 #include <cassert>
29 
30 namespace gnash {
31 
33 //
37 class Shape : public DisplayObject
38 {
39 public:
40  Shape(movie_root& mr, as_object* object, const SWF::DefineShapeTag* def,
42  :
43  DisplayObject(mr, object, parent),
44  _def(def)
45  {
46  assert(_def);
47  }
48 
49  virtual void display(Renderer& renderer, const Transform& xform);
50 
51  virtual SWFRect getBounds() const {
52  return _def->bounds();
53  }
54 
55  virtual bool pointInShape(std::int32_t x, std::int32_t y) const;
56 
57 private:
58 
59  const boost::intrusive_ptr<const SWF::DefineShapeTag> _def;
60 
61 };
62 
63 
64 } // namespace gnash
65 
66 
67 #endif
68 
69 
70 // Local Variables:
71 // mode: C++
72 // indent-tabs-mode: t
73 // End:
Shape(movie_root &mr, as_object *object, const SWF::DefineShapeTag *def, DisplayObject *parent)
Definition: Shape.h:40
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:168
DisplayObject * parent() const
Return the parent of this DisplayObject, or NULL if the DisplayObject has no parent.
Definition: DisplayObject.h:252
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
The base class for all ActionScript objects.
Definition: as_object.h:161
Base class for render handlers.
Definition: Renderer.h:188
virtual SWFRect getBounds() const
Definition: Shape.h:51
Represents the outline of one or more shapes, along with information on fill and line styles...
Definition: DefineShapeTag.h:32
std::int32_t x
Definition: BitmapData_as.cpp:434
std::int32_t y
Definition: BitmapData_as.cpp:435
For DisplayObjects that don&#39;t store unusual state in their instances.
Definition: Shape.h:37
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
virtual bool pointInShape(std::int32_t x, std::int32_t y) const
Return true if the given point falls in this DisplayObject&#39;s shape.
Definition: Shape.cpp:27
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:33
virtual void display(Renderer &renderer, const Transform &xform)
Render the DisplayObject.
Definition: Shape.cpp:49
This class represents the &#39;Stage&#39; and top-level movie.
Definition: movie_root.h:150