Página Principal   Hierarquia de Classes   Lista de Componentes   Lista de Arquivos   Componentes Membros  

Color.hpp

00001 /*      Color.hpp - Morpheous
00002  *
00003  *  $Header: /home/aldon/cvs/Morpheous/include/Color.hpp,v 1.4 2003/08/21 01:57:25 aldon Exp $
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program 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
00013  *  GNU Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018  */
00019 
00020 
00021 #ifndef __COLOR_HPP__
00022 #define __COLOR_HPP__
00023 
00024 
00028 class Color
00029 {
00030 public:
00031 
00035     unsigned char red;
00036     
00040     unsigned char green;
00041     
00045     unsigned char blue;
00046 
00054     static inline Color blending(Color c1, Color c2, float s);
00055 };
00056 
00057 
00058 inline Color Color::blending(Color c1, Color c2, float s)
00059 {
00060     //TODO: otimizar esse metodo usando inteiros    
00061     Color result;
00062 
00063     result.red = (char)(s*c2.red + (1-s)*c1.red);
00064     result.green = (char)(s*c2.green + (1-s)*c1.green);
00065     result.blue = (char)(s*c2.blue + (1-s)*c1.blue);
00066 
00067     return result;
00068 }
00069 
00070 
00071 #endif // __COLOR_HPP__

Gerado em Sun Sep 21 20:18:44 2003 para Morpheous por doxygen1.2.13.1 escrito por Dimitri van Heesch, © 1997-2001