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 __CS_CSGFX_GRADIENT_H__
00022 #define __CS_CSGFX_GRADIENT_H__
00023
00028 #include "csextern.h"
00029
00030 #include "ivaria/gradient.h"
00031
00032 #include "csutil/array.h"
00033 #include "csutil/cscolor.h"
00034 #include "csutil/scf_implementation.h"
00035 #include "csutil/scfarray.h"
00036 #include "csgfx/rgbpixel.h"
00037
00057 class CS_CRYSTALSPACE_EXPORT csGradient :
00058 public scfImplementation1<csGradient, iGradient>
00059 {
00060 protected:
00062 csArray<csGradientShade> shades;
00063 struct scfGradientShadesArray : public scfArrayWrapConst<iGradientShades,
00064 csArray<csGradientShade> >
00065 {
00066 scfGradientShadesArray (csGradient* parent) :
00067 scfArrayWrapConst<iGradientShades, csArray<csGradientShade> > (
00068 parent->shades, parent) {}
00069 };
00070 public:
00072 csGradient ();
00074 csGradient (csColor4 first, csColor4 last);
00075
00077
00078
00079 void AddShade (const csGradientShade& shade);
00080 void AddShade (const csColor4& color, float position);
00081 void AddShade (const csColor4& left, const csColor4& right,
00082 float position);
00084
00086 void Clear ();
00087
00104 bool Render (csRGBcolor* pal, size_t count, float begin = 0.0f,
00105 float end = 1.0f) const;
00106
00123 bool Render (csRGBpixel* pal, size_t count, float begin = 0.0f,
00124 float end = 1.0f) const;
00125
00127 csPtr<iGradientShades> GetShades ();
00128 };
00129
00130
00131 #endif // __CS_CSGFX_GRADIENT_H__