Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

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__
00022 #define __CS_RGB_VECTOR__
00023 
00024 #include "csvector.h"
00025 
00030 class csRGBVector : public csVector
00031 {
00032 
00033 public:
00035   virtual int Compare(csSome item1, csSome item2, int Mode)
00036   {
00037     csRGBcolor *i1 = STATIC_CAST(csRGBcolor *, item1);
00038     csRGBcolor *i2 = STATIC_CAST(csRGBcolor *, item2);
00039 
00040     if ((*i1)==(*i2))
00041       return 0;
00042     else if(i1->red < i2->red &&
00043             i1->green < i2->green &&
00044             i1->blue < i2->blue)
00045     {
00046       return -1;
00047     }
00048     else
00049       return 1;
00050   }
00051 
00053   virtual int CompareKey(csSome item, csConstSome key, int Mode)
00054   {
00055     csRGBcolor *i1 = STATIC_CAST(csRGBcolor *, item);
00056     const csRGBcolor *i2 = STATIC_CAST(const csRGBcolor *, key);
00057 
00058     if ((*i1)==(*i2))
00059       return 0;
00060     else if(i1->red < i2->red &&
00061             i1->green < i2->green &&
00062             i1->blue < i2->blue)
00063     {
00064       return -1;
00065     }
00066     else
00067       return 1;
00068   }
00069 
00070 };
00071 
00072 #endif

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000