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_IVARIA_GRADIENT_H__
00022 #define __CS_IVARIA_GRADIENT_H__
00023
00028 #include "iutil/array.h"
00029
00030 #include "csutil/cscolor.h"
00031 #include "csgfx/rgbpixel.h"
00032
00036 struct csGradientShade
00037 {
00039 csColor4 left;
00041 csColor4 right;
00043 float position;
00044
00046 csGradientShade () : left (0, 0, 0, 1.0f), right (0, 0, 0, 1.0f),
00047 position (0) {}
00048
00050 csGradientShade (const csColor4& left_color, const csColor4& right_color,
00051 float pos) : left (left_color), right (right_color), position (pos) {}
00053 explicit csGradientShade (const csColor& left_color,
00054 const csColor& right_color, float pos) : left (left_color),
00055 right (right_color), position (pos) {}
00056
00061 csGradientShade (const csColor4& color, float pos) : left (color),
00062 right (color), position (pos) {}
00067 explicit csGradientShade (const csColor& color, float pos) :
00068 left (color), right (color), position (pos) {}
00069
00070 bool operator== (const csGradientShade& other)
00071 {
00072 return (left == other.left) && (right == other.right)
00073 && (position == other.position);
00074 }
00075 };
00076
00080 struct iGradientShades : public iArrayReadOnly<csGradientShade>
00081 {
00082 SCF_IARRAYREADONLY_INTERFACE(iGradientShades);
00083 };
00084
00127 struct iGradient : public virtual iBase
00128 {
00129 SCF_INTERFACE(iGradient, 0, 0, 1);
00130
00132
00133 virtual void AddShade (const csGradientShade& shade) = 0;
00134 virtual void AddShade (const csColor4& color, float position) = 0;
00135 virtual void AddShade (const csColor4& left, const csColor4& right,
00136 float position) = 0;
00138
00140 virtual void Clear () = 0;
00141
00158 virtual bool Render (csRGBcolor* pal, size_t count, float begin = 0.0f,
00159 float end = 1.0f) const = 0;
00160
00177 virtual bool Render (csRGBpixel* pal, size_t count, float begin = 0.0f,
00178 float end = 1.0f) const = 0;
00179
00181 virtual csPtr<iGradientShades> GetShades () = 0;
00182 };
00183
00184
00185 #endif // __CS_IVARIA_GRADIENT_H__