Homepage Demos Overview Downloads Tutorials 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(int r=0, int g=0, int b=0)
00071     : red((uchar)r), green((uchar)g), blue((uchar)b)
00072   { };
00073        
00074 
00075   bool operator ==(const rgb &x) const {
00076     return (red  ==x.red   &&
00077             green==x.green &&
00078             blue ==x.blue);
00079   }
00080 
00081   bool operator !=(const rgb &x) const {
00082     return !operator==(x);
00083   }
00084 };
00085 #endif
00086 
00087 #ifndef RGBA_STRUCT
00088 #define RGBA_STRUCT
00089 struct rgba{
00090   uchar r,g,b,a;
00091 };
00092 #endif
00093 
00094 #ifndef ARGB_STRUCT
00095 #define ARGB_STRUCT
00096 struct argb{
00097   uchar a,r,g,b;
00098 };
00099 #endif
00100 
00101 #ifndef RGBF_STRUCT
00102 #define RGBF_STRUCT
00103 struct rgbf{
00104   float red,green,blue;
00105 
00106   rgbf()
00107     : red(0),green(0),blue(0) {}
00108   rgbf(float nred,float ngreen,float nblue)
00109     : red(nred),green(ngreen),blue(nblue) {}
00110 
00111 };
00112 #endif
00113 
00114 #ifndef RGBAF_STRUCT
00115 #define RGBAF_STRUCT
00116 struct rgbaf{
00117   float r,g,b,a;
00118 };
00119 #endif
00120 
00121 #ifndef ARGBF_STRUCT
00122 #define ARGBF_STRUCT
00123 struct argbf{
00124   float a,r,g,b;
00125 };
00126 #endif
00127 
00128 
00129 //==== Color Names ===================================================//
00130 
00131 #ifdef RGB_COLOR_NAMES
00132 namespace Rgb{
00133 /*   const rgb Black   = {  0,  0,  0}; */
00134 /*   const rgb Blue    = {  0,128,255}; */
00135 /*   const rgb Green   = {  0,128,  0}; */
00136 /*   const rgb Orange  = {255,128,  0}; */
00137 /*   const rgb Bgreen  = {  0,255,  0}; */
00138 /*   const rgb Purple  = {128,  0,255}; */
00139 /*   const rgb Red     = {255,  0,  0}; */
00140 /*   const rgb Pink    = {255,128,224}; */
00141 /*   const rgb Yellow  = {255,255,  0}; */
00142 /*   const rgb Gray    = {200,200,200}; */
00143 /*   const rgb Skin    = {150,100,  0}; */
00144 
00145 /*   const rgb Black(0,  0,  0); */
00146 /*   const rgb Blue(0,128,255); */
00147 /*   const rgb Green(  0,128,  0); */
00148 /*   const rgb Orange(255,128,  0); */
00149 /*   const rgb Bgreen(0,255,  0); */
00150 /*   const rgb Purple(128,  0,255); */
00151 /*   const rgb Red(255,  0,  0); */
00152 /*   const rgb Pink(255,128,224); */
00153 /*   const rgb Yellow(255,255,  0); */
00154 /*   const rgb Gray(200,200,200); */
00155 /*   const rgb Skin(150,100,  0); */
00156 }
00157 #endif
00158 
00159 #endif

Tekkotsu v2.2.2
Generated Tue Jan 4 15:43:13 2005 by Doxygen 1.4.0