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
00021 #ifndef GNASH_DYNAMIC_SHAPE_H
00022 #define GNASH_DYNAMIC_SHAPE_H
00023
00024 #include <vector>
00025 #include "LineStyle.h"
00026 #include "ShapeRecord.h"
00027
00028 namespace gnash {
00029 class DisplayObject;
00030 class Renderer;
00031 class FillStyle;
00032 class GradientRecord;
00033 class Transform;
00034 }
00035
00036 namespace gnash {
00037
00039
00042
00045 class DynamicShape
00046 {
00047 public:
00048
00049 DynamicShape();
00050
00051 ~DynamicShape() {}
00052
00054 void clear();
00055
00057 void moveTo(boost::int32_t x, boost::int32_t y);
00058
00060 void lineTo(boost::int32_t x, boost::int32_t y, int swfVersion);
00061
00065 void curveTo(boost::int32_t cx, boost::int32_t cy,
00066 boost::int32_t ax, boost::int32_t ay, int swfVersion);
00067
00069 void beginFill(const FillStyle& f);
00070
00072 void endFill();
00073
00074 const SWFRect& getBounds() const {
00075 return _shape.getBounds();
00076 }
00077
00078 void setBounds(const SWFRect& bounds) {
00079 _shape.setBounds(bounds);
00080 }
00081
00083 void display(Renderer& renderer, const Transform& xform) const;
00084
00086
00096 void lineStyle(boost::uint16_t thickness, const rgba& color,
00097 bool vScale=true, bool hScale=true,
00098 bool pixelHinting=false,
00099 bool noClose=false,
00100 CapStyle startCapStyle=CAP_ROUND,
00101 CapStyle endCapStyle=CAP_ROUND,
00102 JoinStyle joinStyle=JOIN_ROUND,
00103 float miterLimitFactor=1.0f);
00104
00106 void resetLineStyle();
00107
00111
00117 size_t addFillStyle(const FillStyle& stl);
00118
00122
00128 size_t add_line_style(const LineStyle& stl);
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 bool pointTestLocal(boost::int32_t x, boost::int32_t y,
00148 const SWFMatrix& wm) const
00149 {
00150 finalize();
00151 return geometry::pointTest(_shape.paths(), _shape.lineStyles(), x, y,
00152 wm);
00153 }
00154
00155 const SWF::ShapeRecord& shapeRecord() const {
00156 return _shape;
00157 }
00158
00160
00165 void add_path(const Path& pth);
00166
00168
00171 void finalize() const;
00172
00173 private:
00174
00176
00183 void startNewPath(bool newShape);
00184
00185 Path* _currpath;
00186
00187 size_t _currfill;
00188
00189 size_t _currline;
00190
00191
00192 boost::int32_t _x;
00193
00194
00195 boost::int32_t _y;
00196
00197 mutable bool _changed;
00198
00200
00202 mutable SWF::ShapeRecord _shape;
00203 };
00204
00205 }
00206
00207
00208 #endif // GNASH_DYNAMIC_SHAPE_H
00209
00210
00211
00212
00213
00214
00215
00216