Gnash  0.8.11dev
ShapeRecord.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 
20 #ifndef GNASH_SWF_SHAPERECORD_H
21 #define GNASH_SWF_SHAPERECORD_H
22 
23 #include "Geometry.h"
24 #include "LineStyle.h"
25 #include "SWFRect.h"
26 
27 #include <vector>
28 
29 
30 namespace gnash {
31  class movie_definition;
32  class RunResources;
33  class FillStyle;
34 }
35 
36 namespace gnash {
37 namespace SWF {
38 
40 //
43 //
49 //
53 {
54 public:
55 
56  typedef std::vector<FillStyle> FillStyles;
57  typedef std::vector<LineStyle> LineStyles;
58  typedef std::vector<Path> Paths;
59 
61  //
63  //
66  ShapeRecord();
67 
69  //
72  const RunResources& r);
73 
75  ShapeRecord(const ShapeRecord& other);
76 
78  ShapeRecord& operator=(const ShapeRecord& other);
79 
80  ~ShapeRecord();
81 
83  //
87  const RunResources& r);
88 
89  const FillStyles& fillStyles() const {
90  return _fillStyles;
91  }
92 
93  const LineStyles& lineStyles() const {
94  return _lineStyles;
95  }
96 
97  const Paths& paths() const {
98  return _paths;
99  }
100 
101  const SWFRect& getBounds() const {
102  return _bounds;
103  }
104 
106  //
110  return _paths.back();
111  }
112 
114  //
116  void setLerp(const ShapeRecord& a, const ShapeRecord& b,
117  const double ratio);
118 
120  void clear();
121 
122  void addFillStyle(const FillStyle& fs);
123 
124  void addPath(const Path& path) {
125  _paths.push_back(path);
126  }
127 
128  void addLineStyle(const LineStyle& ls) {
129  _lineStyles.push_back(ls);
130  }
131 
132  void setBounds(const SWFRect& bounds) {
133  _bounds = bounds;
134  }
135 
136 private:
137 
139  enum ShapeRecordFlags {
140  SHAPE_END = 0x00,
141  SHAPE_MOVE = 0x01,
142  SHAPE_FILLSTYLE0_CHANGE = 0x02,
143  SHAPE_FILLSTYLE1_CHANGE = 0x04,
144  SHAPE_LINESTYLE_CHANGE = 0x08,
145  SHAPE_HAS_NEW_STYLES = 0x10
146  };
147 
148  FillStyles _fillStyles;
149  LineStyles _lineStyles;
150  Paths _paths;
151  SWFRect _bounds;
152 
153 };
154 
155 std::ostream& operator<<(std::ostream& o, const ShapeRecord& sh);
156 
157 } // namespace SWF
158 } // namespace gnash
159 
160 #endif