Tekkotsu 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 namespace CMVision{
00022   typedef unsigned char uchar;
00023 }
00024 
00025 #ifndef YUV_STRUCT
00026 #define YUV_STRUCT
00027 struct yuv{
00028   CMVision::uchar y,u,v;
00029 };
00030 
00031 /* Depricated
00032 struct yuv_int{
00033   int y,u,v;
00034 };
00035 */
00036 #endif
00037 
00038 #ifndef YUVI_STRUCT
00039 #define YUVI_STRUCT
00040 struct yuvi{
00041   int y,u,v;
00042 };
00043 #endif
00044 
00045 #ifndef YUVF_STRUCT
00046 #define YUVF_STRUCT
00047 struct yuvf{
00048   float y,u,v;
00049 };
00050 #endif
00051 
00052 #ifndef YUYV_STRUCT
00053 #define YUYV_STRUCT
00054 struct yuyv{
00055   CMVision::uchar y1,u,y2,v;
00056 };
00057 #endif
00058 
00059 struct uyvy{
00060 #ifndef UYVY_STRUCT
00061 #define UYVY_STRUCT
00062   CMVision::uchar u,y1,v,y2;
00063 };
00064 #endif
00065 
00066 #ifndef RGB_STRUCT
00067 #define RGB_STRUCT
00068 struct rgb{
00069   CMVision::uchar red,green,blue;
00070 
00071   rgb() : red(0), green(0), blue(0) {};
00072 
00073   rgb(int r, int g, int b)
00074     : red((CMVision::uchar)r), green((CMVision::uchar)g), blue((CMVision::uchar)b)
00075   { };
00076        
00077 
00078   bool operator ==(const rgb &x) const {
00079     return (red  ==x.red   &&
00080             green==x.green &&
00081             blue ==x.blue);
00082   }
00083 
00084   bool operator !=(const rgb &x) const {
00085     return !operator==(x);
00086   }
00087 };
00088 #endif
00089 
00090 #ifndef RGBA_STRUCT
00091 #define RGBA_STRUCT
00092 struct rgba{
00093   CMVision::uchar r,g,b,a;
00094 };
00095 #endif
00096 
00097 #ifndef ARGB_STRUCT
00098 #define ARGB_STRUCT
00099 struct argb{
00100   CMVision::uchar a,r,g,b;
00101 };
00102 #endif
00103 
00104 #ifndef RGBF_STRUCT
00105 #define RGBF_STRUCT
00106 struct rgbf{
00107   float red,green,blue;
00108 
00109   rgbf()
00110     : red(0),green(0),blue(0) {}
00111   rgbf(float nred,float ngreen,float nblue)
00112     : red(nred),green(ngreen),blue(nblue) {}
00113 
00114 };
00115 #endif
00116 
00117 #ifndef RGBAF_STRUCT
00118 #define RGBAF_STRUCT
00119 struct rgbaf{
00120   float r,g,b,a;
00121 };
00122 #endif
00123 
00124 #ifndef ARGBF_STRUCT
00125 #define ARGBF_STRUCT
00126 struct argbf{
00127   float a,r,g,b;
00128 };
00129 #endif
00130 
00131 
00132 //==== Color Names ===================================================//
00133 
00134 #ifdef RGB_COLOR_NAMES
00135 namespace Rgb{
00136 /*   const rgb Black   = {  0,  0,  0}; */
00137 /*   const rgb Blue    = {  0,128,255}; */
00138 /*   const rgb Green   = {  0,128,  0}; */
00139 /*   const rgb Orange  = {255,128,  0}; */
00140 /*   const rgb Bgreen  = {  0,255,  0}; */
00141 /*   const rgb Purple  = {128,  0,255}; */
00142 /*   const rgb Red     = {255,  0,  0}; */
00143 /*   const rgb Pink    = {255,128,224}; */
00144 /*   const rgb Yellow  = {255,255,  0}; */
00145 /*   const rgb Gray    = {200,200,200}; */
00146 /*   const rgb Skin    = {150,100,  0}; */
00147 
00148 /*   const rgb Black(0,  0,  0); */
00149 /*   const rgb Blue(0,128,255); */
00150 /*   const rgb Green(  0,128,  0); */
00151 /*   const rgb Orange(255,128,  0); */
00152 /*   const rgb Bgreen(0,255,  0); */
00153 /*   const rgb Purple(128,  0,255); */
00154 /*   const rgb Red(255,  0,  0); */
00155 /*   const rgb Pink(255,128,224); */
00156 /*   const rgb Yellow(255,255,  0); */
00157 /*   const rgb Gray(200,200,200); */
00158 /*   const rgb Skin(150,100,  0); */
00159 }
00160 
00161 #endif
00162 #endif

Tekkotsu v3.0
Generated Wed Oct 4 00:03:42 2006 by Doxygen 1.4.7