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 class Transform;
00033 }
00034
00035 namespace gnash {
00036
00038
00041
00044 class DynamicShape
00045 {
00046 public:
00047
00048 DynamicShape();
00049
00050 ~DynamicShape() {}
00051
00053 void clear();
00054
00056 void moveTo(boost::int32_t x, boost::int32_t y);
00057
00059 void lineTo(boost::int32_t x, boost::int32_t y, int swfVersion);
00060
00064 void curveTo(boost::int32_t cx, boost::int32_t cy,
00065 boost::int32_t ax, boost::int32_t ay, int swfVersion);
00066
00068 void beginFill(const FillStyle& f);
00069
00071 void endFill();
00072
00073 const SWFRect& getBounds() const {
00074 return _shape.getBounds();
00075 }
00076
00077 void setBounds(const SWFRect& bounds) {
00078 _shape.setBounds(bounds);
00079 }
00080
00082 void display(Renderer& renderer, const Transform& xform) const;
00083
00085
00095 void lineStyle(boost::uint16_t thickness, const rgba& color,
00096 bool vScale=true, bool hScale=true,
00097 bool pixelHinting=false,
00098 bool noClose=false,
00099 CapStyle startCapStyle=CAP_ROUND,
00100 CapStyle endCapStyle=CAP_ROUND,
00101 JoinStyle joinStyle=JOIN_ROUND,
00102 float miterLimitFactor=1.0f);
00103
00105 void resetLineStyle();
00106
00110
00116 size_t addFillStyle(const FillStyle& stl);
00117
00121
00127 size_t add_line_style(const LineStyle& stl);
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 bool pointTestLocal(boost::int32_t x, boost::int32_t y,
00147 const SWFMatrix& wm) const
00148 {
00149 finalize();
00150 return geometry::pointTest(_shape.paths(), _shape.lineStyles(), x, y,
00151 wm);
00152 }
00153
00154 const SWF::ShapeRecord& shapeRecord() const {
00155 return _shape;
00156 }
00157
00159
00164 void add_path(const Path& pth);
00165
00167
00170 void finalize() const;
00171
00172 private:
00173
00175
00182 void startNewPath(bool newShape);
00183
00184 Path* _currpath;
00185
00186 size_t _currfill;
00187
00188 size_t _currline;
00189
00190
00191 boost::int32_t _x;
00192
00193
00194 boost::int32_t _y;
00195
00196 mutable bool _changed;
00197
00199
00201 mutable SWF::ShapeRecord _shape;
00202 };
00203
00204 }
00205
00206
00207 #endif // GNASH_DYNAMIC_SHAPE_H
00208
00209
00210
00211
00212
00213
00214
00215