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

PlaceObject2Tag.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_SWF_PLACEOBJECT2TAG_H
00019 #define GNASH_SWF_PLACEOBJECT2TAG_H
00020 
00021 #include "DisplayListTag.h" // for inheritance
00022 #include "SWF.h" // for TagType definition
00023 #include "SWFMatrix.h" // for composition
00024 #include "cxform.h" // for composition 
00025 #include <string>
00026 #include <vector>
00027 
00028 // Forward declarations
00029 namespace gnash {
00030     class SWFStream;
00031     class swf_event;
00032     class action_buffer;
00033     class movie_definition;
00034         class DisplayList;
00035     class RunResources;
00036 }
00037 
00038 namespace gnash {
00039 namespace SWF {
00040 
00042 //
00083 class PlaceObject2Tag : public DisplayListTag
00084 {
00085 public:
00086 
00087     typedef std::vector<action_buffer*> ActionBuffers;
00088     typedef std::vector<swf_event*> EventHandlers;
00089 
00090     PlaceObject2Tag(const movie_definition& def)
00091         :
00092         DisplayListTag(0), // why is it 0 here and -1 for RemoveObjectTag ??
00093         m_TagType(0),
00094         m_has_flags2(0),
00095         m_has_flags3(0),
00096         _id(0),
00097         _ratio(0),
00098         m_clip_depth(0),
00099         _blendMode(0),
00100         _movie_def(def)
00101     {
00102     }
00103 
00104     ~PlaceObject2Tag();
00105 
00107     void read(SWFStream& in, TagType tag);
00108 
00110     void executeState(MovieClip* m, DisplayList& dlist) const;
00111 
00112     static void loader(SWFStream& in, TagType tag, movie_definition& m,
00113             const RunResources& r);
00114 
00115     int getPlaceType() const { 
00116         return m_has_flags2 & (HAS_CHARACTER_MASK | MOVE_MASK);
00117     } 
00118 
00119     int getRatio()     const { return _ratio; }
00120     int getClipDepth() const { return m_clip_depth; }
00121     boost::uint16_t getID()        const { return _id; }
00122     const std::string& getName() const { return m_name; }
00123     const SWFMatrix& getMatrix()    const { return m_matrix; }
00124     const cxform& getCxform()    const { return m_color_transform; }
00125     const EventHandlers& getEventHandlers() const { return _eventHandlers; }
00126     
00127     bool hasClipActions() const { return m_has_flags2 & HAS_CLIP_ACTIONS_MASK; }
00128     bool hasClipDepth()   const { return m_has_flags2 & HAS_CLIP_DEPTH_MASK; };
00129     bool hasName()        const { return m_has_flags2 & HAS_NAME_MASK; }
00130     bool hasRatio()       const { return m_has_flags2 & HAS_RATIO_MASK; }
00131     bool hasCxform()      const { return m_has_flags2 & HAS_CXFORM_MASK; }
00132     bool hasMatrix()      const { return m_has_flags2 & HAS_MATRIX_MASK; }
00133     bool hasCharacter()   const { return m_has_flags2 & HAS_CHARACTER_MASK; }
00134 
00135     bool hasImage()         const { return m_has_flags3 & HAS_IMAGE_MASK; }
00136 
00137     bool hasClassName() const {
00138         return m_has_flags3 & HAS_CLASS_NAME_MASK;
00139     }
00140 
00141     bool hasBitmapCaching() const { 
00142         return m_has_flags3 & HAS_BITMAP_CACHING_MASK;
00143     }
00144 
00145     bool hasBlendMode() const {
00146         return m_has_flags3 & HAS_BLEND_MODE_MASK;
00147     }
00148 
00149     bool hasFilters() const {
00150         return m_has_flags3 & HAS_FILTERS_MASK;
00151     }
00152 
00154     //
00157     boost::uint8_t getBlendMode() const {
00158         return _blendMode;
00159     }
00160 
00161 private:
00162     int m_TagType;
00163     boost::uint8_t m_has_flags2;
00164     boost::uint8_t m_has_flags3;
00165     boost::uint16_t _id;
00166     cxform  m_color_transform;
00167     SWFMatrix  m_matrix;
00168     int     _ratio;
00169     std::string m_name;
00170     int     m_clip_depth;
00171     
00172     boost::uint8_t _blendMode;
00173 
00175     enum PlaceType
00176     {
00177         REMOVE  = 0, 
00178         MOVE    = 1,
00179         PLACE   = 2,
00180         REPLACE = 3
00181     };
00182 
00183     enum has_flags2_mask_e
00184     {
00185         HAS_CLIP_ACTIONS_MASK = 1 << 7,
00186         HAS_CLIP_DEPTH_MASK   = 1 << 6,
00187         HAS_NAME_MASK         = 1 << 5,
00188         HAS_RATIO_MASK        = 1 << 4,
00189         HAS_CXFORM_MASK       = 1 << 3,
00190         HAS_MATRIX_MASK       = 1 << 2,
00191         HAS_CHARACTER_MASK    = 1 << 1,
00192         MOVE_MASK             = 1 << 0
00193     };
00194 
00195     enum has_flags3_mask_e
00196     {
00197         HAS_IMAGE_MASK          = 1 << 4,
00198         HAS_CLASS_NAME_MASK     = 1 << 3,
00199         HAS_BITMAP_CACHING_MASK = 1 << 2,
00200         HAS_BLEND_MODE_MASK     = 1 << 1,
00201         HAS_FILTERS_MASK        = 1 << 0
00202     };
00203 
00204     const movie_definition& _movie_def;
00205 
00206     ActionBuffers _actionBuffers;
00207 
00208     EventHandlers _eventHandlers;
00209 
00210     // read SWF::PLACEOBJECT 
00211     void readPlaceObject(SWFStream& in);
00212 
00213     // read placeObject2 actions
00214     void readPlaceActions(SWFStream& in);
00215 
00216     // read SWF::PLACEOBJECT2 
00217     void readPlaceObject2(SWFStream& in);
00218 
00219     // read SWF::PLACEOBJECT3
00220     void readPlaceObject3(SWFStream& in);
00221 
00222 };
00223 
00224 } // namespace gnash::SWF
00225 } // namespace gnash
00226 
00227 
00228 #endif // GNASH_SWF_PLACEOBJECT2TAG_H
00229 
00230 
00231 // Local Variables:
00232 // mode: C++
00233 // indent-tabs-mode: t
00234 // End:

Generated on Fri Mar 16 2012 15:46:11 for Gnash by  doxygen 1.7.1