• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

BitmapMovieDefinition.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
00003 // 
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 3 of the License, or
00007 // (at your option) any later version.
00008 // 
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 // 
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017 
00018 #ifndef GNASH_BITMAPMOVIEDEFINITION_H
00019 #define GNASH_BITMAPMOVIEDEFINITION_H
00020 
00021 #include "movie_definition.h" // for inheritance
00022 #include "SWFRect.h" // for composition
00023 #include "GnashNumeric.h"
00024 
00025 #include <boost/intrusive_ptr.hpp>
00026 #include <string>
00027 #include <memory> // for auto_ptr
00028 
00029 // Forward declarations
00030 namespace gnash {
00031     class Renderer;
00032     class GnashImage;
00033 }
00034 
00035 namespace gnash
00036 {
00037 
00039 //
00042 class BitmapMovieDefinition : public movie_definition
00043 {
00044 public:
00045 
00046 
00048         //
00058         BitmapMovieDefinition(std::auto_ptr<GnashImage> image, Renderer* renderer,
00059             const std::string& url);
00060 
00061     virtual DisplayObject* createDisplayObject(Global_as&, DisplayObject*)
00062         const;
00063 
00064         virtual int     get_version() const {
00065                 return _version;
00066         }
00067 
00068         virtual size_t get_width_pixels() const {
00069                 return std::ceil(twipsToPixels(_framesize.width()));
00070         }
00071 
00072         virtual size_t get_height_pixels() const {
00073                 return std::ceil(twipsToPixels(_framesize.height()));
00074         }
00075 
00076         virtual size_t get_frame_count() const {
00077                 return _framecount;
00078         }
00079 
00080         virtual float get_frame_rate() const {
00081                 return _framerate;
00082         }
00083 
00084         virtual const SWFRect& get_frame_size() const {
00085                 return _framesize;
00086         }
00087 
00089         //
00093         virtual size_t get_bytes_loaded() const {
00094                 return get_bytes_total();
00095         }
00096 
00098         //
00101         virtual size_t get_bytes_total() const {
00102                 return _bytesTotal;
00103         }
00104         
00106         virtual Movie* createMovie(Global_as& gl, DisplayObject* parent = 0);
00107 
00108         virtual const std::string& get_url() const {
00109                 return _url;
00110         }
00111 
00112         // Inheritance from movie_definition requires this.
00113         // we always return 1 so MovieClip::construct()
00114         // doesn't skip our handling (TODO: check if it's correct to
00115         // skip handling of 0-frames movies..).
00116         size_t  get_loading_frame() const 
00117         {
00118                 return 1;
00119         }
00120 
00121     const CachedBitmap* bitmap() const {
00122         return _bitmap.get();
00123     }
00124 
00125 protected:
00126 
00127 private:
00128 
00129         int _version;
00130         SWFRect _framesize;
00131         size_t _framecount;
00132         float _framerate;
00133         std::string _url;
00134 
00135         size_t _bytesTotal;
00136 
00137     boost::intrusive_ptr<CachedBitmap> _bitmap;
00138 };
00139 
00140 } // namespace gnash
00141 
00142 #endif // GNASH_BITMAPMOVIEDEFINITION_H

Generated on Thu Sep 30 2010 14:34:56 for Gnash by  doxygen 1.7.1