Gnash
0.8.10
|
00001 // 00002 // Copyright (C) 2007, 2008, 2009, 2010, 2011. 2012 00003 // Free Software Foundation, Inc. 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 #ifndef GNASH_SWF_PLACEOBJECT2TAG_H 00020 #define GNASH_SWF_PLACEOBJECT2TAG_H 00021 00022 #include <string> 00023 #include <boost/ptr_container/ptr_vector.hpp> 00024 00025 #include "DisplayListTag.h" // for inheritance 00026 #include "SWF.h" // for TagType definition 00027 #include "SWFMatrix.h" // for composition 00028 #include "SWFCxForm.h" // for composition 00029 00030 // Forward declarations 00031 namespace gnash { 00032 class SWFStream; 00033 class swf_event; 00034 class action_buffer; 00035 class movie_definition; 00036 class DisplayList; 00037 class RunResources; 00038 } 00039 00040 namespace gnash { 00041 namespace SWF { 00042 00044 // 00085 class PlaceObject2Tag : public DisplayListTag 00086 { 00087 public: 00088 00089 typedef boost::ptr_vector<action_buffer> ActionBuffers; 00090 typedef boost::ptr_vector<swf_event> EventHandlers; 00091 00092 PlaceObject2Tag(const movie_definition& def); 00093 00094 ~PlaceObject2Tag(); 00095 00097 void read(SWFStream& in, TagType tag); 00098 00100 void executeState(MovieClip* m, DisplayList& dlist) const; 00101 00102 static void loader(SWFStream& in, TagType tag, movie_definition& m, 00103 const RunResources& r); 00104 00105 int getPlaceType() const { 00106 return m_has_flags2 & (HAS_CHARACTER_MASK | MOVE_MASK); 00107 } 00108 00109 boost::uint16_t getRatio() const { return _ratio; } 00110 int getClipDepth() const { return m_clip_depth; } 00111 boost::uint16_t getID() const { return _id; } 00112 const std::string& getName() const { return m_name; } 00113 const SWFMatrix& getMatrix() const { return m_matrix; } 00114 const SWFCxForm& getCxform() const { return m_color_transform; } 00115 const EventHandlers& getEventHandlers() const { return _eventHandlers; } 00116 00117 bool hasClipActions() const { return m_has_flags2 & HAS_CLIP_ACTIONS_MASK; } 00118 bool hasClipDepth() const { return m_has_flags2 & HAS_CLIP_DEPTH_MASK; }; 00119 bool hasName() const { return m_has_flags2 & HAS_NAME_MASK; } 00120 bool hasRatio() const { return m_has_flags2 & HAS_RATIO_MASK; } 00121 bool hasCxform() const { return m_has_flags2 & HAS_CXFORM_MASK; } 00122 bool hasMatrix() const { return m_has_flags2 & HAS_MATRIX_MASK; } 00123 bool hasCharacter() const { return m_has_flags2 & HAS_CHARACTER_MASK; } 00124 00125 bool hasImage() const { return m_has_flags3 & HAS_IMAGE_MASK; } 00126 00127 bool hasClassName() const { 00128 return m_has_flags3 & HAS_CLASS_NAME_MASK; 00129 } 00130 00131 bool hasBitmapCaching() const { 00132 return m_has_flags3 & HAS_BITMAP_CACHING_MASK; 00133 } 00134 00135 bool hasBlendMode() const { 00136 return m_has_flags3 & HAS_BLEND_MODE_MASK; 00137 } 00138 00139 bool hasFilters() const { 00140 return m_has_flags3 & HAS_FILTERS_MASK; 00141 } 00142 00144 // 00147 boost::uint8_t getBlendMode() const { 00148 return _blendMode; 00149 } 00150 00151 private: 00152 00153 // read SWF::PLACEOBJECT 00154 void readPlaceObject(SWFStream& in); 00155 00156 // read placeObject2 actions 00157 void readPlaceActions(SWFStream& in); 00158 00159 // read SWF::PLACEOBJECT2 00160 void readPlaceObject2(SWFStream& in); 00161 00162 // read SWF::PLACEOBJECT3 00163 void readPlaceObject3(SWFStream& in); 00164 00165 boost::uint8_t m_has_flags2; 00166 boost::uint8_t m_has_flags3; 00167 boost::uint16_t _id; 00168 SWFCxForm m_color_transform; 00169 SWFMatrix m_matrix; 00170 boost::uint16_t _ratio; 00171 std::string m_name; 00172 int m_clip_depth; 00173 00174 boost::uint8_t _blendMode; 00175 00177 enum PlaceType 00178 { 00179 REMOVE = 0, 00180 MOVE = 1, 00181 PLACE = 2, 00182 REPLACE = 3 00183 }; 00184 00185 enum has_flags2_mask_e 00186 { 00187 HAS_CLIP_ACTIONS_MASK = 1 << 7, 00188 HAS_CLIP_DEPTH_MASK = 1 << 6, 00189 HAS_NAME_MASK = 1 << 5, 00190 HAS_RATIO_MASK = 1 << 4, 00191 HAS_CXFORM_MASK = 1 << 3, 00192 HAS_MATRIX_MASK = 1 << 2, 00193 HAS_CHARACTER_MASK = 1 << 1, 00194 MOVE_MASK = 1 << 0 00195 }; 00196 00197 enum has_flags3_mask_e 00198 { 00199 HAS_IMAGE_MASK = 1 << 4, 00200 HAS_CLASS_NAME_MASK = 1 << 3, 00201 HAS_BITMAP_CACHING_MASK = 1 << 2, 00202 HAS_BLEND_MODE_MASK = 1 << 1, 00203 HAS_FILTERS_MASK = 1 << 0 00204 }; 00205 00206 const movie_definition& _movie_def; 00207 00208 ActionBuffers _actionBuffers; 00209 00210 EventHandlers _eventHandlers; 00211 }; 00212 00213 } // namespace gnash::SWF 00214 } // namespace gnash 00215 00216 00217 #endif // GNASH_SWF_PLACEOBJECT2TAG_H 00218 00219 00220 // Local Variables: 00221 // mode: C++ 00222 // indent-tabs-mode: t 00223 // End: