Gnash  0.8.11dev
Bitmap.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 #ifndef GNASH_BITMAP_H
21 #define GNASH_BITMAP_H
22 
23 #include <boost/intrusive_ptr.hpp>
24 #include "DisplayObject.h"
26 #include "DynamicShape.h"
27 
28 namespace gnash {
29  class CachedBitmap;
30  class BitmapMovieDefinition;
31 }
32 
33 
34 namespace gnash {
35 
36 
39 //
42 //
45 //
49 class Bitmap : public DisplayObject
50 {
51 public:
52 
54  Bitmap(movie_root& mr, as_object* object, BitmapData_as* bd,
56 
58  Bitmap(movie_root& mr, as_object* object, const BitmapMovieDefinition* def,
60 
61  virtual ~Bitmap();
62 
64  virtual void update();
65 
66  virtual void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
67 
69  virtual void display(Renderer& renderer, const Transform& xform);
70 
72  virtual SWFRect getBounds() const;
73 
75  virtual bool pointInShape(std::int32_t x, std::int32_t y) const;
76 
78  virtual void construct(as_object* init = nullptr);
79 
80 protected:
81 
82  void markReachableObjects() const {
83  if (_bitmapData) _bitmapData->setReachable();
84  }
85 
86 private:
87 
89  //
91  const CachedBitmap* bitmap() const;
92 
94  //
97  void checkBitmapData();
98 
100  //
103  const boost::intrusive_ptr<const BitmapMovieDefinition> _def;
104 
105  BitmapData_as* _bitmapData;
106 
108  DynamicShape _shape;
109 
111  size_t _width;
112 
114  size_t _height;
115 
116 };
117 
118 } // end namespace gnash
119 
120 
121 #endif // GNASH_DYNAMIC_SHAPE_H
122 
123 
124 // Local Variables:
125 // mode: C++
126 // c-basic-offset: 8
127 // tab-width: 8
128 // indent-tabs-mode: t
129 // End:
gnash::geometry::SnappingRanges2d< std::int32_t >
gnash::Bitmap
Definition: Bitmap.h:50
gnash::DynamicShape::addFillStyle
size_t addFillStyle(const FillStyle &stl)
Add a fill style, possibly reusing an existing one if existent.
Definition: DynamicShape.cpp:261
gnash::BitmapMovieDefinition
A "movie" definition for a bitmap file.
Definition: BitmapMovieDefinition.h:46
movie_root.h
gnash::Bitmap::getBounds
virtual SWFRect getBounds() const
Get the bounds of the Bitmap.
Definition: Bitmap.cpp:139
height
@ height
Definition: klash_part.cpp:329
DynamicShape.h
gnash::DynamicShape::clear
void clear()
Remove all paths and style informations.
Definition: DynamicShape.cpp:39
gnash::DynamicShape::add_path
void add_path(const Path &pth)
Add a path, updating _currpath and recomputing bounds.
Definition: DynamicShape.cpp:55
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
gnash::DynamicShape::finalize
void finalize() const
Always call this function before displaying !
Definition: DynamicShape.cpp:139
BitmapMovieDefinition.h
gnash::BitmapData_as::bitmapInfo
const CachedBitmap * bitmapInfo() const
Return the image data.
Definition: BitmapData_as.h:111
gnash::SWFRect::getRange
geometry::Range2d< std::int32_t > getRange() const
Construct and return a Range2d object.
Definition: SWFRect.h:222
y
std::int32_t y
Definition: BitmapData_as.cpp:435
gnash::DisplayObject::pointInBounds
bool pointInBounds(std::int32_t x, std::int32_t y) const
Return true if the given point falls in this DisplayObject's bounds.
Definition: DisplayObject.h:488
Bitmap.h
gnash::pixelsToTwips
std::int32_t pixelsToTwips(double a)
Definition: GnashNumeric.h:144
Renderer.h
gnash::Bitmap::pointInShape
virtual bool pointInShape(std::int32_t x, std::int32_t y) const
Test whether a point is in the Bitmap's bounds.
Definition: Bitmap.cpp:108
gnash::FillStyle
FillStyle describes the various fill styles for shapes.
Definition: FillStyle.h:282
Transform.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::getWorldMatrix
SWFMatrix getWorldMatrix(const DisplayObject &d, bool includeRoot=true)
Get concatenated SWFMatrix (all ancestor transforms and our SWFMatrix)
Definition: DisplayObject.h:1131
gnash::BitmapFill::SMOOTHING_UNSPECIFIED
@ SMOOTHING_UNSPECIFIED
Definition: FillStyle.h:76
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
gnash::DisplayObject::m_old_invalidated_ranges
InvalidatedRanges m_old_invalidated_ranges
Bounds of this DisplayObject instance before first invalidation since last call to clear_invalidated(...
Definition: DisplayObject.h:1029
gnash::Bitmap::Bitmap
Bitmap(movie_root &mr, as_object *object, BitmapData_as *bd, DisplayObject *parent)
Construct a Bitmap character from a BitmapData.
Definition: Bitmap.cpp:35
gnash::DisplayObject::transform
const Transform & transform() const
Definition: DisplayObject.h:292
SWFRect.h
GnashImage.h
gnash::BitmapFill::CLIPPED
@ CLIPPED
Definition: FillStyle.h:86
gnash::DynamicShape::display
void display(Renderer &renderer, const Transform &xform) const
Display a DynamicShape object.
Definition: DynamicShape.cpp:49
gnash::Bitmap::update
virtual void update()
Notify the Bitmap that it's been updated during ActionScript execution.
Definition: Bitmap.cpp:145
BitmapData_as.h
gnash::Bitmap::construct
virtual void construct(as_object *init=nullptr)
Called when the object is placed on stage.
Definition: Bitmap.cpp:74
gnash::SWFRect
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:45
fill
VGPaint fill
Definition: testr_gtk.cpp:86
gnash::Bitmap::~Bitmap
virtual ~Bitmap()
Definition: Bitmap.cpp:61
gnash::BitmapData_as::disposed
bool disposed() const
Whether the BitmapData has been disposed.
Definition: BitmapData_as.h:139
gnash::Path::drawLineTo
void drawLineTo(std::int32_t dx, std::int32_t dy)
Draw a straight line.
Definition: Geometry.h:325
gnash::DynamicShape
The DynamicShape class represents a mutable shape.
Definition: DynamicShape.h:45
gnash::Path
A subset of a shape, a series of edges sharing a single set of styles.
Definition: Geometry.h:167
gnash::key::h
@ h
Definition: GnashKey.h:154
test.w
w
Definition: test.py:8
gnash::BitmapData_as::setReachable
virtual void setReachable()
Overrides Relay::setReachable().
Definition: BitmapData_as.cpp:615
gnash::Bitmap::display
virtual void display(Renderer &renderer, const Transform &xform)
Display this Bitmap.
Definition: Bitmap.cpp:114
gnash::DisplayObject::set_invalidated
void set_invalidated()
This function marks the DisplayObject as being modified in aspect and keeps track of current invalida...
Definition: DisplayObject.cpp:183
gnash::SWFMatrix
Definition: SWFMatrix.h:54
VM.h
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::geometry::SnappingRanges2d::add
void add(const RangeType &range)
Add a Range to the set, merging when possible and appropriate.
Definition: snappingrange.h:250
gnash::Bitmap::add_invalidated_bounds
virtual void add_invalidated_bounds(InvalidatedRanges &ranges, bool force)
Add the DisplayObject's invalidated bounds to the given ranges list.
Definition: Bitmap.cpp:126
gnash::Bitmap::markReachableObjects
void markReachableObjects() const
Definition: Bitmap.h:82
gnash::movie_root
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:151
RunResources.h
gnash::BitmapFill
A BitmapFill.
Definition: FillStyle.h:71
gnash::DynamicShape::setBounds
void setBounds(const SWFRect &bounds)
Definition: DynamicShape.h:77
gnash::DynamicShape::getBounds
const SWFRect & getBounds() const
Definition: DynamicShape.h:73
gnash::DisplayObject
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:169
gnash::BitmapData_as
Implements the BitmapData native type.
Definition: BitmapData_as.h:64
FillStyle.h
gnash::SWFMatrix::set_scale
void set_scale(double x_scale, double y_scale)
Set x and y scales, rotation is unchanged.
Definition: SWFMatrix.cpp:225
gnash::BitmapMovieDefinition::get_frame_size
virtual const SWFRect & get_frame_size() const
Return size of frame, in TWIPS.
Definition: BitmapMovieDefinition.h:87
gnash::Transform
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:34
width
@ width
Definition: klash_part.cpp:329
gnash::DisplayObject::invalidated
bool invalidated() const
Return whether this DisplayObject has been invalidated or not.
Definition: DisplayObject.h:657
gnash::CachedBitmap
A CachedBitmap is created by the renderer in a format of its choosing.
Definition: CachedBitmap.h:38
x
std::int32_t x
Definition: BitmapData_as.cpp:434
gnash::SWFRect::expand_to_transformed_rect
DSOEXPORT void expand_to_transformed_rect(const SWFMatrix &m, const SWFRect &r)
Definition: SWFRect.cpp:74
gnash::BitmapData_as::attach
void attach(DisplayObject *obj)
Attach this BitmapData to an object.
Definition: BitmapData_as.h:126