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
00022 #ifndef GNASH_LINESTYLE_H
00023 #define GNASH_LINESTYLE_H
00024
00025 #include "RGBA.h"
00026 #include "SWF.h"
00027
00028 namespace gnash {
00029 class SWFStream;
00030 class movie_definition;
00031 class RunResources;
00032 }
00033
00034 namespace gnash {
00035
00036 enum CapStyle {
00037 CAP_ROUND = 0,
00038 CAP_NONE = 1,
00039 CAP_SQUARE = 2
00040 };
00041
00042 enum JoinStyle {
00043 JOIN_ROUND = 0,
00044 JOIN_BEVEL = 1,
00045 JOIN_MITER = 2
00046 };
00047
00049 class LineStyle
00050 {
00051 public:
00052
00054 LineStyle();
00055
00069 LineStyle(boost::uint16_t width, const rgba& color,
00070 bool scaleThicknessVertically=true,
00071 bool scaleThicknessHorizontally=true,
00072 bool pixelHinting=false,
00073 bool noClose=false,
00074 CapStyle startCapStyle=CAP_ROUND,
00075 CapStyle endCapStyle=CAP_ROUND,
00076 JoinStyle joinStyle=JOIN_ROUND,
00077 float miterLimitFactor=1.0f
00078 )
00079 :
00080 m_width(width),
00081 m_color(color),
00082 _scaleVertically(scaleThicknessVertically),
00083 _scaleHorizontally(scaleThicknessHorizontally),
00084 _pixelHinting(pixelHinting),
00085 _noClose(noClose),
00086 _startCapStyle(startCapStyle),
00087 _endCapStyle(endCapStyle),
00088 _joinStyle(joinStyle),
00089 _miterLimitFactor(miterLimitFactor)
00090 {
00091 }
00092
00094
00100 void read(SWFStream& in, SWF::TagType t, movie_definition& md,
00101 const RunResources& r);
00102
00105 void read_morph(SWFStream& in, SWF::TagType t, movie_definition& md,
00106 const RunResources& r, LineStyle *pOther);
00107
00109 boost::uint16_t getThickness() const {
00110 return m_width;
00111 }
00112
00114 bool scaleThicknessVertically() const {
00115 return _scaleVertically;
00116 }
00117
00119 bool scaleThicknessHorizontally() const {
00120 return _scaleHorizontally;
00121 }
00122
00124 CapStyle startCapStyle() const {
00125 return _startCapStyle;
00126 }
00127
00129 CapStyle endCapStyle() const {
00130 return _endCapStyle;
00131 }
00132
00134 JoinStyle joinStyle() const {
00135 return _joinStyle;
00136 }
00137
00139 float miterLimitFactor() const {
00140 return _miterLimitFactor;
00141 }
00142
00145 bool noClose() const {
00146 return _noClose;
00147 }
00148
00150 bool doPixelHinting() const {
00151 return _pixelHinting;
00152 }
00153
00155 const rgba& get_color() const { return m_color; }
00156
00158
00164 void set_lerp(const LineStyle& ls1, const LineStyle& ls2, float ratio);
00165
00166 private:
00167
00169 boost::uint16_t m_width;
00170
00171 rgba m_color;
00172
00173 bool _scaleVertically;
00174
00175 bool _scaleHorizontally;
00176
00177 bool _pixelHinting;
00178
00179 bool _noClose;
00180
00181 CapStyle _startCapStyle;
00182
00183 CapStyle _endCapStyle;
00184
00185 JoinStyle _joinStyle;
00186
00187 float _miterLimitFactor;
00188 };
00189
00190 inline void
00191 setLerp(LineStyle& s, const LineStyle& ls1, const LineStyle& ls2, double ratio)
00192 {
00193 s.set_lerp(ls1, ls2, ratio);
00194 }
00195
00196 }
00197
00198 #endif
00199
00200
00201
00202
00203