Main Page | Class Hierarchy | Class List | File List | Class Members

RGBColor.hh

00001 /**************************************************************************
00002 **       Title: RGB Color class
00003 **    $RCSfile: RGBColor.hh,v $
00004 **   $Revision: 1.2 $$Name:  $
00005 **       $Date: 2001/04/30 16:51:25 $
00006 **   Copyright: GPL $Author: ronneber $
00007 ** Description:
00008 **
00009 **    
00010 **
00011 **-------------------------------------------------------------------------
00012 **
00013 **  $Log: RGBColor.hh,v $
00014 **  Revision 1.2  2001/04/30 16:51:25  ronneber
00015 **  corrected prototype of print() method
00016 **
00017 **  Revision 1.1  2001/04/06 15:12:46  haasdonk
00018 **  slight modification
00019 **
00020 **  Revision 1.2  2001/03/31 17:52:43  ronneber
00021 **  - many changes, see file 'Kommentare' for details
00022 **
00023 **
00024 **************************************************************************/
00025 #ifndef RGBCOLOR_HH
00026 #define RGBCOLOR_HH
00027 
00028 typedef unsigned char uchar;
00029 
00030 /*======================================================================*/
00038 /*======================================================================*/
00039 class RGBColor 
00040 {
00041 public:
00042 
00043   /*-----------------------------------------------------------------------
00044    *  Fixed colors by name
00045    *-----------------------------------------------------------------------*/
00046   static const RGBColor White;
00047   static const RGBColor Red;
00048   static const RGBColor Green; 
00049   static const RGBColor Blue; 
00050   static const RGBColor Black;
00051   static const RGBColor Yellow; 
00052   static const RGBColor Magenta; 
00053   static const RGBColor Cyan;
00054 
00055   /*======================================================================*/
00059   /*======================================================================*/
00060   RGBColor ();
00061   
00062   /*======================================================================*/
00070   /*======================================================================*/
00071   RGBColor (uchar red, uchar green, uchar blue); 
00072   
00073   /*======================================================================*/
00079   /*======================================================================*/
00080   RGBColor (uchar gray);
00081   
00082   uchar red() const;
00083   uchar green() const;
00084   uchar blue() const;
00085   
00086   void set(uchar red, uchar green, uchar blue);
00087 
00088 
00090   void print() const;
00091    
00092   RGBColor& operator +=(const RGBColor& c);
00093   RGBColor& operator +=(uchar gray);
00094   RGBColor& operator -=(const RGBColor& c);
00095   RGBColor& operator -=(uchar gray);
00096   RGBColor& operator *=(float factor); 
00097 
00098   
00099   bool operator ==(const RGBColor& c) const;
00100   bool operator !=(const RGBColor& c) const;
00101   
00102   
00103 protected:
00104   
00105   uchar rc, gc, bc;
00106 };    
00107 
00108 
00109 RGBColor operator ! (const RGBColor& c);
00110 RGBColor operator + (const RGBColor& c1, const RGBColor& c2);
00111 RGBColor operator - (const RGBColor& c1, const RGBColor& c2);
00112 RGBColor operator * (const RGBColor& c1, float factor); 
00113 RGBColor operator * (float factor, const RGBColor& c1); 
00114 
00115 
00116 #include "RGBColor.icc"
00117 
00118 #endif 

Generated on Wed May 4 16:19:59 2005 by  doxygen 1.4.2