• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

ShapeRecord.h

Go to the documentation of this file.
00001 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
00002 //   Foundation, Inc
00003 // 
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 3 of the License, or
00007 // (at your option) any later version.
00008 // 
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 // 
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
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 } // namespace SWF
00157 } // namespace gnash
00158 
00159 #endif

Generated on Thu Sep 30 2010 14:35:02 for Gnash by  doxygen 1.7.1