CrystalSpace

Public API Reference

csgfx/gradient.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2003 by Jorrit Tyberghein
00003               (C) 2003 by Frank Richter
00004               (C) 2006 by Christopher Nelson
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the Free
00018     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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__

Generated for Crystal Space by doxygen 1.4.7