Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

colors.h

Go to the documentation of this file.
00001 /*========================================================================
00002     colors.h : Color definitions for CMVision2 and the Simple Image class
00003   ------------------------------------------------------------------------
00004     Copyright (C) 1999-2002  James R. Bruce
00005     School of Computer Science, Carnegie Mellon University
00006   ------------------------------------------------------------------------
00007     This software is distributed under the GNU General Public License,
00008     version 2.  If you do not have a copy of this licence, visit
00009     www.gnu.org, or write: Free Software Foundation, 59 Temple Place,
00010     Suite 330 Boston, MA 02111-1307 USA.  This program is distributed
00011     in the hope that it will be useful, but WITHOUT ANY WARRANTY,
00012     including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00013     ========================================================================*/
00014 
00015 #ifndef __COLORS_H__
00016 #define __COLORS_H__
00017 
00018 #define RGB_COLOR_NAMES
00019 
00020 //==== Color Classes =================================================//
00021 
00022 typedef unsigned char uchar;
00023 
00024 #ifndef YUV_STRUCT
00025 #define YUV_STRUCT
00026 struct yuv{
00027   uchar y,u,v;
00028 };
00029 
00030 /* Depricated
00031 struct yuv_int{
00032   int y,u,v;
00033 };
00034 */
00035 #endif
00036 
00037 #ifndef YUVI_STRUCT
00038 #define YUVI_STRUCT
00039 struct yuvi{
00040   int y,u,v;
00041 };
00042 #endif
00043 
00044 #ifndef YUVF_STRUCT
00045 #define YUVF_STRUCT
00046 struct yuvf{
00047   float y,u,v;
00048 };
00049 #endif
00050 
00051 #ifndef YUYV_STRUCT
00052 #define YUYV_STRUCT
00053 struct yuyv{
00054   uchar y1,u,y2,v;
00055 };
00056 #endif
00057 
00058 struct uyvy{
00059 #ifndef UYVY_STRUCT
00060 #define UYVY_STRUCT
00061   uchar u,y1,v,y2;
00062 };
00063 #endif
00064 
00065 #ifndef RGB_STRUCT
00066 #define RGB_STRUCT
00067 struct rgb{
00068   uchar red,green,blue;
00069 
00070   rgb() : red(0), green(0), blue(0) {};
00071 
00072   rgb(int r, int g, int b)
00073     : red((uchar)r), green((uchar)g), blue((uchar)b)
00074   { };
00075        
00076 
00077   bool operator ==(const rgb &x) const {
00078     return (red  ==x.red   &&
00079             green==x.green &&
00080             blue ==x.blue);
00081   }
00082 
00083   bool operator !=(const rgb &x) const {
00084     return !operator==(x);
00085   }
00086 };
00087 #endif
00088 
00089 #ifndef RGBA_STRUCT
00090 #define RGBA_STRUCT
00091 struct rgba{
00092   uchar r,g,b,a;
00093 };
00094 #endif
00095 
00096 #ifndef ARGB_STRUCT
00097 #define ARGB_STRUCT
00098 struct argb{
00099   uchar a,r,g,b;
00100 };
00101 #endif
00102 
00103 #ifndef RGBF_STRUCT
00104 #define RGBF_STRUCT
00105 struct rgbf{
00106   float red,green,blue;
00107 
00108   rgbf()
00109     : red(0),green(0),blue(0) {}
00110   rgbf(float nred,float ngreen,float nblue)
00111     : red(nred),green(ngreen),blue(nblue) {}
00112 
00113 };
00114 #endif
00115 
00116 #ifndef RGBAF_STRUCT
00117 #define RGBAF_STRUCT
00118 struct rgbaf{
00119   float r,g,b,a;
00120 };
00121 #endif
00122 
00123 #ifndef ARGBF_STRUCT
00124 #define ARGBF_STRUCT
00125 struct argbf{
00126   float a,r,g,b;
00127 };
00128 #endif
00129 
00130 
00131 //==== Color Names ===================================================//
00132 
00133 #ifdef RGB_COLOR_NAMES
00134 namespace Rgb{
00135 /*   const rgb Black   = {  0,  0,  0}; */
00136 /*   const rgb Blue    = {  0,128,255}; */
00137 /*   const rgb Green   = {  0,128,  0}; */
00138 /*   const rgb Orange  = {255,128,  0}; */
00139 /*   const rgb Bgreen  = {  0,255,  0}; */
00140 /*   const rgb Purple  = {128,  0,255}; */
00141 /*   const rgb Red     = {255,  0,  0}; */
00142 /*   const rgb Pink    = {255,128,224}; */
00143 /*   const rgb Yellow  = {255,255,  0}; */
00144 /*   const rgb Gray    = {200,200,200}; */
00145 /*   const rgb Skin    = {150,100,  0}; */
00146 
00147 /*   const rgb Black(0,  0,  0); */
00148 /*   const rgb Blue(0,128,255); */
00149 /*   const rgb Green(  0,128,  0); */
00150 /*   const rgb Orange(255,128,  0); */
00151 /*   const rgb Bgreen(0,255,  0); */
00152 /*   const rgb Purple(128,  0,255); */
00153 /*   const rgb Red(255,  0,  0); */
00154 /*   const rgb Pink(255,128,224); */
00155 /*   const rgb Yellow(255,255,  0); */
00156 /*   const rgb Gray(200,200,200); */
00157 /*   const rgb Skin(150,100,  0); */
00158 }
00159 #endif
00160 
00161 #endif

Tekkotsu v2.4.1
Generated Tue Aug 16 16:32:46 2005 by Doxygen 1.4.4