Gnash
0.8.10
|
00001 // 00002 // Copyright (C) 2005, 2006, 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 00020 #ifndef GNASH_SWF_SHAPERECORD_H 00021 #define GNASH_SWF_SHAPERECORD_H 00022 00023 #include "Geometry.h" 00024 #include "LineStyle.h" 00025 #include "SWFRect.h" 00026 00027 #include <vector> 00028 00029 00030 namespace gnash { 00031 class movie_definition; 00032 class RunResources; 00033 class FillStyle; 00034 } 00035 00036 namespace gnash { 00037 namespace SWF { 00038 00040 // 00043 // 00049 // 00052 class ShapeRecord 00053 { 00054 public: 00055 00056 typedef std::vector<FillStyle> FillStyles; 00057 typedef std::vector<LineStyle> LineStyles; 00058 typedef std::vector<Path> Paths; 00059 00061 // 00063 // 00066 ShapeRecord(); 00067 00069 // 00071 ShapeRecord(SWFStream& in, SWF::TagType tag, movie_definition& m, 00072 const RunResources& r); 00073 00075 ShapeRecord(const ShapeRecord& other); 00076 00078 ShapeRecord& operator=(const ShapeRecord& other); 00079 00080 ~ShapeRecord(); 00081 00083 // 00086 void read(SWFStream& in, SWF::TagType tag, movie_definition& m, 00087 const RunResources& r); 00088 00089 const FillStyles& fillStyles() const { 00090 return _fillStyles; 00091 } 00092 00093 const LineStyles& lineStyles() const { 00094 return _lineStyles; 00095 } 00096 00097 const Paths& paths() const { 00098 return _paths; 00099 } 00100 00101 const SWFRect& getBounds() const { 00102 return _bounds; 00103 } 00104 00106 // 00109 Path& currentPath() { 00110 return _paths.back(); 00111 } 00112 00114 // 00116 void setLerp(const ShapeRecord& a, const ShapeRecord& b, 00117 const double ratio); 00118 00120 void clear(); 00121 00122 void addFillStyle(const FillStyle& fs); 00123 00124 void addPath(const Path& path) { 00125 _paths.push_back(path); 00126 } 00127 00128 void addLineStyle(const LineStyle& ls) { 00129 _lineStyles.push_back(ls); 00130 } 00131 00132 void setBounds(const SWFRect& bounds) { 00133 _bounds = bounds; 00134 } 00135 00136 private: 00137 00139 enum ShapeRecordFlags { 00140 SHAPE_END = 0x00, 00141 SHAPE_MOVE = 0x01, 00142 SHAPE_FILLSTYLE0_CHANGE = 0x02, 00143 SHAPE_FILLSTYLE1_CHANGE = 0x04, 00144 SHAPE_LINESTYLE_CHANGE = 0x08, 00145 SHAPE_HAS_NEW_STYLES = 0x10 00146 }; 00147 00148 FillStyles _fillStyles; 00149 LineStyles _lineStyles; 00150 Paths _paths; 00151 SWFRect _bounds; 00152 00153 }; 00154 00155 std::ostream& operator<<(std::ostream& o, const ShapeRecord& sh); 00156 00157 } // namespace SWF 00158 } // namespace gnash 00159 00160 #endif