00001 //================================================================================================== 00002 // Copyright (C) 2010 Brian Tietz sdbtietz at yahoo dot com 00003 // 00004 // This program is free software; you can redistribute it and/or modify it under the terms of the 00005 // GNU General Public License as published by the Free Software Foundation, version 2.0 of the 00006 // License. 00007 // 00008 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 00009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00010 // General Public License for more details. 00011 // 00012 // You should have received a copy of the GNU General Public License along with this program; if 00013 // not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00014 // 02110-1301, USA. 00015 // 00016 // For commercial software, the copyright holder (Brian Tietz, email sdbtietz at yahoo dot com) 00017 // reserves the right and is willing to waive the proprietary source code disclosure aspects of that 00018 // license as applied to the UT library in exchange for either substantial contributions to the 00019 // development of the UT library or other forms of compensation. Any such waiver must be 00020 // established in writing between the copyright holder and the commercial entity obtaining such a 00021 // waiver. 00022 //================================================================================================== 00023 00024 00025 #ifndef _UT_COLOR_H_ 00026 #define _UT_COLOR_H_ 00027 00030 00031 00032 //================================================================================================== 00033 //=== Project headers 00034 //================================================================================================== 00035 #include "UTgfx.h" 00036 00037 00038 EXTERN_C_BEGIN 00039 00040 00041 //================================================================================================== 00042 struct UTGFX_EXPORT Color_t 00043 //================================================================================================== 00051 { 00052 uint8 red; 00055 00056 uint8 green; 00059 00060 uint8 blue; 00063 00064 uint8 alpha; 00067 00068 #if __cplusplus 00069 00070 inline Color_t(); 00075 00076 inline Color_t( uint8 red, uint8 green, uint8 blue, uint8 alpha = 255 ); 00078 00079 inline const Color_t& operator =(const Color_t& copy); 00081 00082 inline bool operator ==(const Color_t& other) const; 00084 00085 inline bool operator !=(const Color_t& other) const; 00087 00088 #endif // __cplusplus 00089 }; 00090 00091 00092 EXTERN_C_END 00093 #if __cplusplus 00094 00095 00096 //================================================================================================== 00097 //================================================================================================== 00098 //=== 00099 //=== Inline function implementations 00100 //=== 00101 //================================================================================================== 00102 //================================================================================================== 00103 inline 00104 Color_t::Color_t() 00105 { 00106 red = 0; // Irrelevant 00107 green = 0; // Irrelevant 00108 blue = 0; // Irrelevant 00109 alpha = 0; // Transparent 00110 } 00111 00112 00113 inline 00114 Color_t::Color_t( uint8 a_red, uint8 a_green, uint8 a_blue, uint8 a_alpha ) 00115 { 00116 red = a_red; 00117 green = a_green; 00118 blue = a_blue; 00119 alpha = a_alpha; 00120 } 00121 00122 00123 inline const Color_t& 00124 Color_t::operator =(const Color_t& copy) 00125 { 00126 red = copy.red; 00127 green = copy.green; 00128 blue = copy.blue; 00129 alpha = copy.alpha; 00130 00131 return *this; 00132 } 00133 00134 00135 inline bool 00136 Color_t::operator ==(const Color_t& other) const 00137 { 00138 return ( red == other.red 00139 && green == other.green 00140 && blue == other.blue 00141 && alpha == other.alpha ); 00142 } 00143 00144 00145 inline bool 00146 Color_t::operator !=(const Color_t& other) const 00147 { 00148 return ( red != other.red 00149 || green != other.green 00150 || blue != other.blue 00151 || alpha != other.alpha ); 00152 } 00153 00154 00155 #endif // __cplusplus 00156 #endif // _UT_COLOR_H_