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
00020 #ifndef GNASH_DYNAMIC_SHAPE_H
00021 #define GNASH_DYNAMIC_SHAPE_H
00022
00023 #include <vector>
00024 #include "LineStyle.h"
00025 #include "ShapeRecord.h"
00026
00027 namespace gnash {
00028 class DisplayObject;
00029 class Renderer;
00030 class FillStyle;
00031 class GradientRecord;
00032 }
00033
00034 namespace gnash {
00035
00037
00040
00043 class DynamicShape
00044 {
00045 public:
00046
00047 DynamicShape();
00048
00049 ~DynamicShape() {}
00050
00052 void clear();
00053
00055 void moveTo(boost::int32_t x, boost::int32_t y);
00056
00058 void lineTo(boost::int32_t x, boost::int32_t y, int swfVersion);
00059
00063 void curveTo(boost::int32_t cx, boost::int32_t cy,
00064 boost::int32_t ax, boost::int32_t ay, int swfVersion);
00065
00067 void beginFill(const FillStyle& f);
00068
00070 void endFill();
00071
00072 const SWFRect& getBounds() const {
00073 return _shape.getBounds();
00074 }
00075
00076 void setBounds(const SWFRect& bounds) {
00077 _shape.setBounds(bounds);
00078 }
00079
00081 void display(Renderer& renderer, const DisplayObject& inst) const;
00082
00084
00103 void lineStyle(boost::uint16_t thickness, const rgba& color,
00104 bool vScale=true, bool hScale=true,
00105 bool pixelHinting=false,
00106 bool noClose=false,
00107 CapStyle startCapStyle=CAP_ROUND,
00108 CapStyle endCapStyle=CAP_ROUND,
00109 JoinStyle joinStyle=JOIN_ROUND,
00110 float miterLimitFactor=1.0f);
00111
00113 void resetLineStyle();
00114
00118
00124 size_t addFillStyle(const FillStyle& stl);
00125
00129
00135 size_t add_line_style(const LineStyle& stl);
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 bool pointTestLocal(boost::int32_t x, boost::int32_t y,
00155 const SWFMatrix& wm) const
00156 {
00157 finalize();
00158 return geometry::pointTest(_shape.paths(), _shape.lineStyles(), x, y,
00159 wm);
00160 }
00161
00162 const SWF::ShapeRecord& shapeRecord() const {
00163 return _shape;
00164 }
00165
00167
00172 void add_path(const Path& pth);
00173
00175
00178 void finalize() const;
00179
00180 private:
00181
00183
00190 void startNewPath(bool newShape);
00191
00192 Path* _currpath;
00193
00194 size_t _currfill;
00195
00196 size_t _currline;
00197
00198
00199 boost::int32_t _x;
00200
00201
00202 boost::int32_t _y;
00203
00204 mutable bool _changed;
00205
00207
00209 mutable SWF::ShapeRecord _shape;
00210 };
00211
00212 }
00213
00214
00215 #endif // GNASH_DYNAMIC_SHAPE_H
00216
00217
00218
00219
00220
00221
00222
00223