00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018
00019
00020 00021 00022 00023 00024 00025 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