Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

rvcolor.h

Go to the documentation of this file.
00001 /*
00002  *  Part of rvglue source code,
00003  *  Copyright (C) 2000 Alexander Kroeller (alilein@gmx.de)
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 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., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 
00020 /*
00021  * $Id: rvcolor.h,v 1.1 2000/05/03 08:49:54 ali Exp ali $
00022  *
00023  * $Log: rvcolor.h,v $
00024  * Revision 1.1  2000/05/03 08:49:54  ali
00025  * Initial revision
00026  *
00027  *
00028  */
00029 #ifndef __COLOR_H
00030 #define __COLOR_H
00031 
00032 #include "rvbasetypes.h"
00033 
00035 
00038 class RVColor
00039 {
00040 public:
00041 
00043   inline void setRed(rvulong val) { setChannel(1, val); }
00045   inline void setGreen(rvulong val) { setChannel(2, val); }
00047   inline void setBlue(rvulong val) { setChannel(3, val); }
00049   inline void setAlpha(rvulong val) { setChannel(0, val); }
00050 
00052   inline rvulong red(void) { return channel(1); }
00054   inline rvulong green(void) { return channel(2); }
00056   inline rvulong blue(void) { return channel(3); }
00057 
00059   inline rvulong alpha(void) { return channel(0); }
00060 
00061 
00063   void shadeAdd(int r, int g, int b);
00064 
00071   rvulong channel(int ch);
00072 
00079   void setChannel(int ch, rvulong val);
00080 
00082   void setRGB(rvulong r, rvulong g, rvulong b);
00083 
00085   inline void setRGBf(rvfloat r, rvfloat g, rvfloat b)
00086     { setRGB( (rvulong)(r*255.0), (rvulong)(g*255.0), (rvulong)(b*255.0) ); }
00087 
00089   rvfloat brightness(void);
00090 
00093   void shade(float sr, float sg, float sb);
00094 
00095   inline void shade(float s) { shade(s,s,s); };
00096 
00097 
00099   rvulong value;
00100 };
00101 
00102 #define COLOR_STORAGE_SIZE_OKAY (sizeof(RVColor) == sizeof(rvlong))
00103 
00104 
00105 #endif

Generated at Mon Jul 2 16:54:58 2001 for rvtmod/rvglue by doxygen1.2.0 written by Dimitri van Heesch, © 1997-2000