Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GNASH_SWF_PLACEOBJECT2TAG_H
00019 #define GNASH_SWF_PLACEOBJECT2TAG_H
00020
00021 #include "DisplayListTag.h"
00022 #include "SWF.h"
00023 #include "SWFMatrix.h"
00024 #include "cxform.h"
00025 #include <string>
00026 #include <vector>
00027
00028
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),
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
00211 void readPlaceObject(SWFStream& in);
00212
00213
00214 void readPlaceActions(SWFStream& in);
00215
00216
00217 void readPlaceObject2(SWFStream& in);
00218
00219
00220 void readPlaceObject3(SWFStream& in);
00221
00222 };
00223
00224 }
00225 }
00226
00227
00228 #endif // GNASH_SWF_PLACEOBJECT2TAG_H
00229
00230
00231
00232
00233
00234