libyui
3.0.10
|
00001 /* 00002 Copyright (C) 2000-2012 Novell, Inc 00003 This library is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU Lesser General Public License as 00005 published by the Free Software Foundation; either version 2.1 of the 00006 License, or (at your option) version 3.0 of the License. This library 00007 is distributed in the hope that it will be useful, but WITHOUT ANY 00008 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00009 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00010 License for more details. You should have received a copy of the GNU 00011 Lesser General Public License along with this library; if not, write 00012 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 00013 Floor, Boston, MA 02110-1301 USA 00014 */ 00015 00016 00017 /*-/ 00018 00019 File: YColor.h 00020 00021 Author: Stefan Hundhammer <sh@suse.de> 00022 00023 /-*/ 00024 00025 #ifndef YColor_h 00026 #define YColor_h 00027 00028 typedef unsigned char uchar; 00029 00030 00031 /** 00032 * Helper class to define an RGB color. 00033 **/ 00034 class YColor 00035 { 00036 public: 00037 /** 00038 * Constructor. 00039 **/ 00040 YColor( uchar red, uchar green, uchar blue ) 00041 : _red ( red ) 00042 , _green( green ) 00043 , _blue ( blue ) 00044 , _undef( false ) 00045 {} 00046 00047 /** 00048 * Default constructor: Create "undefined" color. 00049 **/ 00050 YColor() 00051 : _red( 0 ), _green( 0 ), _blue( 0 ) 00052 , _undef( true ) 00053 {} 00054 00055 /** 00056 * Return the red component (0: none, 255: bright red). 00057 **/ 00058 uchar red() const { return _red; } 00059 00060 /** 00061 * Return the green component (0: none, 255: bright green). 00062 **/ 00063 uchar green() const { return _green; } 00064 00065 /** 00066 * Return the blue component (0: none, 255: bright blue). 00067 **/ 00068 uchar blue() const { return _blue; } 00069 00070 /** 00071 * Return 'true' if this color is undefined. 00072 **/ 00073 bool isUndefined() const { return _undef; } 00074 00075 /** 00076 * Return 'true' if this color is defined. 00077 **/ 00078 bool isDefined() const { return ! _undef; } 00079 00080 private: 00081 00082 uchar _red; 00083 uchar _green; 00084 uchar _blue; 00085 00086 bool _undef; 00087 }; 00088 00089 00090 #endif // YColor_h