00001
00002
00003
00004
00005
00006
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00029
00030 #ifndef ADVANCEDSTROKESHADERS_H
00031 # define ADVANCEDSTROKESHADERS_H
00032
00033 # include "BasicStrokeShaders.h"
00034
00042 class LIB_STROKE_EXPORT CalligraphicShader : public StrokeShader
00043 {
00044
00045 public:
00057 CalligraphicShader (real iMinThickness, real iMaxThickness,
00058 const Vec2f &iOrientation, bool clamp);
00060 virtual ~CalligraphicShader () {}
00062 virtual void shade(Stroke &ioStroke) const;
00063 protected:
00064 real _maxThickness;
00065 real _minThickness;
00066 Vec2f _orientation;
00067 bool _clamp;
00068 };
00069
00075 class LIB_STROKE_EXPORT SpatialNoiseShader : public StrokeShader
00076 {
00077 public:
00090 SpatialNoiseShader (float iAmount, float ixScale, int nbOctave, bool smooth, bool pureRandom);
00092 virtual ~SpatialNoiseShader () {}
00094 virtual void shade(Stroke &ioStroke) const;
00095
00096 protected:
00097
00098 float _amount;
00099 float _xScale;
00100 int _nbOctave;
00101 bool _smooth;
00102 bool _pureRandom;
00103 };
00104
00113 class LIB_STROKE_EXPORT SmoothingShader : public StrokeShader
00114 {
00115 public:
00134 SmoothingShader (int iNbIteration, real iFactorPoint, real ifactorCurvature, real iFactorCurvatureDifference,
00135 real iAnisoPoint, real iAnisoNormal, real iAnisoCurvature, real icarricatureFactor);
00137 virtual ~SmoothingShader () {}
00138
00140 virtual void shade(Stroke &ioStroke) const;
00141
00142 protected:
00143
00144 int _nbIterations;
00145 real _factorPoint;
00146 real _factorCurvature;
00147 real _factorCurvatureDifference;
00148 real _anisoPoint;
00149 real _anisoNormal;
00150 real _anisoCurvature;
00151 real _carricatureFactor;
00152 };
00153
00154 class LIB_STROKE_EXPORT Smoother
00155 {
00156 public:
00157 Smoother (Stroke &ioStroke);
00158
00159 virtual ~Smoother () {}
00160
00161 void smooth (int nbIterations, real iFactorPoint, real ifactorCurvature, real iFactorCurvatureDifference,
00162 real iAnisoPoint, real iAnisoNormal, real iAnisoCurvature, real icarricatureFactor);
00163 void computeCurvature ();
00164
00165 protected:
00166 real _factorPoint;
00167 real _factorCurvature;
00168 real _factorCurvatureDifference;
00169 real _anisoPoint;
00170 real _anisoNormal;
00171 real _anisoCurvature;
00172 real _carricatureFactor;
00173
00174 void iteration();
00175 void copyVertices ();
00176
00177 Stroke *_stroke;
00178 int _nbVertices;
00179 Vec2r *_vertex;
00180 Vec2r *_normal;
00181 real *_curvature;
00182 bool *_isFixedVertex;
00183
00184 bool _isClosedCurve;
00185 bool _safeTest;
00186 };
00187
00188 class LIB_STROKE_EXPORT Omitter : public Smoother
00189 {
00190 public:
00191 Omitter (Stroke &ioStroke);
00192 virtual ~Omitter () {}
00193
00194 void omit (real sizeWindow, real thrVari, real thrFlat, real lFlat);
00195 protected:
00196 real *_u;
00197
00198 real _sizeWindow;
00199 real _thresholdVariation;
00200 real _thresholdFlat;
00201 real _lengthFlat;
00202 };
00203
00206 class LIB_STROKE_EXPORT OmissionShader : public StrokeShader
00207 {
00208 public:
00209 OmissionShader (real sizeWindow, real thrVari, real thrFlat, real lFlat);
00210 virtual ~OmissionShader () {}
00211
00212 virtual void shade(Stroke &ioStroke) const;
00213
00214 protected:
00215
00216 real _sizeWindow;
00217 real _thresholdVariation;
00218 real _thresholdFlat;
00219 real _lengthFlat;
00220 };
00221
00222 #endif // ADVANCEDSTROKESHADERS_H