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
00019 #ifndef GNASH_SWF_SHAPERECORD_H
00020 #define GNASH_SWF_SHAPERECORD_H
00021
00022 #include "Geometry.h"
00023 #include "LineStyle.h"
00024 #include "SWFRect.h"
00025
00026 #include <vector>
00027
00028
00029 namespace gnash {
00030 class movie_definition;
00031 class RunResources;
00032 class FillStyle;
00033 }
00034
00035 namespace gnash {
00036 namespace SWF {
00037
00039
00042
00048
00051 class ShapeRecord
00052 {
00053 public:
00054
00055 typedef std::vector<FillStyle> FillStyles;
00056 typedef std::vector<LineStyle> LineStyles;
00057 typedef std::vector<Path> Paths;
00058
00060
00062
00065 ShapeRecord();
00066
00068
00070 ShapeRecord(SWFStream& in, SWF::TagType tag, movie_definition& m,
00071 const RunResources& r);
00072
00074 ShapeRecord(const ShapeRecord& other);
00075
00077 ShapeRecord& operator=(const ShapeRecord& other);
00078
00079 ~ShapeRecord();
00080
00082
00085 void read(SWFStream& in, SWF::TagType tag, movie_definition& m,
00086 const RunResources& r);
00087
00088 const FillStyles& fillStyles() const {
00089 return _fillStyles;
00090 }
00091
00092 const LineStyles& lineStyles() const {
00093 return _lineStyles;
00094 }
00095
00096 const Paths& paths() const {
00097 return _paths;
00098 }
00099
00100 const SWFRect& getBounds() const {
00101 return _bounds;
00102 }
00103
00105
00108 Path& currentPath() {
00109 return _paths.back();
00110 }
00111
00113
00115 void setLerp(const ShapeRecord& a, const ShapeRecord& b,
00116 const double ratio);
00117
00119 void clear();
00120
00121 void addFillStyle(const FillStyle& fs);
00122
00123 void addPath(const Path& path) {
00124 _paths.push_back(path);
00125 }
00126
00127 void addLineStyle(const LineStyle& ls) {
00128 _lineStyles.push_back(ls);
00129 }
00130
00131 void setBounds(const SWFRect& bounds) {
00132 _bounds = bounds;
00133 }
00134
00135 private:
00136
00138 enum ShapeRecordFlags {
00139 SHAPE_END = 0x00,
00140 SHAPE_MOVE = 0x01,
00141 SHAPE_FILLSTYLE0_CHANGE = 0x02,
00142 SHAPE_FILLSTYLE1_CHANGE = 0x04,
00143 SHAPE_LINESTYLE_CHANGE = 0x08,
00144 SHAPE_HAS_NEW_STYLES = 0x10
00145 };
00146
00147 FillStyles _fillStyles;
00148 LineStyles _lineStyles;
00149 Paths _paths;
00150 SWFRect _bounds;
00151
00152 };
00153
00154 std::ostream& operator<<(std::ostream& o, const ShapeRecord& sh);
00155
00156 }
00157 }
00158
00159 #endif