csgfx/csrgbvct.h
00001 /* 00002 Crystal Space graphics 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 "csutil/array.h" 00025 #include "csgfx/rgbpixel.h" 00026 00032 class csRGBVector : public csArray<csRGBcolor*> 00033 { 00034 public: 00036 static int Compare (void const* item1, void const* item2) 00037 { 00038 csRGBcolor* i1 = (csRGBcolor*)item1; 00039 csRGBcolor* i2 = (csRGBcolor*)item2; 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 return -1; 00046 else 00047 return 1; 00048 } 00049 00051 static int CompareKey (csRGBcolor* const& i1, void* key) 00052 { 00053 const csRGBcolor* i2 = CS_REINTERPRET_CAST(const csRGBcolor*, key); 00054 00055 if ((*i1)==(*i2)) 00056 return 0; 00057 else if(i1->red < i2->red && 00058 i1->green < i2->green && 00059 i1->blue < i2->blue) 00060 return -1; 00061 else 00062 return 1; 00063 } 00064 00065 }; 00066 00067 #endif // __CS_RGB_VECTOR_H__
Generated for Crystal Space by doxygen 1.2.18