2 // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef GNASH_BITMAPMOVIEDEFINITION_H
19 #define GNASH_BITMAPMOVIEDEFINITION_H
21 #include "movie_definition.h" // for inheritance
23 #include "GnashNumeric.h"
25 #include <boost/intrusive_ptr.hpp>
29 // Forward declarations
40 /// A "movie" definition for a bitmap file
42 /// The createMovie function will return a BitmapMovie
44 class BitmapMovieDefinition
: public movie_definition
49 /// Construct a BitmapMovieDefinition for the given image (rgb)
51 /// Will be initialized with the following values
54 /// - Framesize extracted from image
55 /// - Single frame (unlabeled)
57 /// - image->size() bytes (for get_bytes_loaded()/get_bytes_total())
60 BitmapMovieDefinition(std::auto_ptr
<image::GnashImage
> image
,
61 Renderer
* renderer
, const std::string
& url
);
63 virtual DisplayObject
* createDisplayObject(Global_as
&, DisplayObject
*)
66 virtual int get_version() const {
70 virtual size_t get_width_pixels() const {
71 return std::ceil(twipsToPixels(_framesize
.width()));
74 virtual size_t get_height_pixels() const {
75 return std::ceil(twipsToPixels(_framesize
.height()));
78 virtual size_t get_frame_count() const {
82 virtual float get_frame_rate() const {
86 virtual const SWFRect
& get_frame_size() const {
90 /// Return number of bytes loaded
92 /// Since no progressive load is implemented yet
93 /// we'll always return total bytes here..
95 virtual size_t get_bytes_loaded() const {
96 return get_bytes_total();
99 /// Return total number of bytes which composed this movie
101 /// We actually cheat, and return the image size here...
103 virtual size_t get_bytes_total() const {
107 /// Create a playable Movie from this def.
108 virtual Movie
* createMovie(Global_as
& gl
, DisplayObject
* parent
= 0);
110 virtual const std::string
& get_url() const {
114 // Inheritance from movie_definition requires this.
115 // we always return 1 so MovieClip::construct()
116 // doesn't skip our handling (TODO: check if it's correct to
117 // skip handling of 0-frames movies..).
118 size_t get_loading_frame() const
123 const CachedBitmap
* bitmap() const {
124 return _bitmap
.get();
139 boost::intrusive_ptr
<CachedBitmap
> _bitmap
;
144 #endif // GNASH_BITMAPMOVIEDEFINITION_H