CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csrgbvct.h

00001 /*
00002     Crystal Space utility library: vector class interface
00003     Copyright (C) 1998,1999,2000 by Andrew Zabolotny <bit@eltech.ru>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 
00021 #ifndef __CS_RGB_VECTOR_H__
00022 #define __CS_RGB_VECTOR_H__
00023 
00024 #include "array.h"
00025 #include "csgfx/rgbpixel.h"
00026 
00027 // @@@@@@@@@ THIS CLASS SHOULD MOVE TO include/csgfx probably!
00028 
00034 class csRGBVector : public csArray<csRGBcolor*>
00035 {
00036 public:
00038   static int Compare (void const* item1, void const* item2)
00039   {
00040     csRGBcolor* i1 = (csRGBcolor*)item1;
00041     csRGBcolor* i2 = (csRGBcolor*)item2;
00042     if ((*i1)==(*i2))
00043       return 0;
00044     else if(i1->red < i2->red &&
00045             i1->green < i2->green &&
00046             i1->blue < i2->blue)
00047       return -1;
00048     else
00049       return 1;
00050   }
00051 
00053   static int CompareKey (csRGBcolor* const& i1, void* key)
00054   {
00055     const csRGBcolor *i2 = STATIC_CAST(const csRGBcolor *, key);
00056 
00057     if ((*i1)==(*i2))
00058       return 0;
00059     else if(i1->red < i2->red &&
00060             i1->green < i2->green &&
00061             i1->blue < i2->blue)
00062       return -1;
00063     else
00064       return 1;
00065   }
00066 
00067 };
00068 
00069 #endif // __CS_RGB_VECTOR_H__

Generated for Crystal Space by doxygen 1.2.14