00001 #include "color.h" 00002 00003 namespace util 00004 { 00005 QColor convertToQColor(const Color<float>& c) 00006 { 00007 return QColor::fromRgbF(c.r(), c.g(), c.b(), c.a()); 00008 } 00009 00010 QColor convertToQColor(const Color<double>& c) 00011 { 00012 return QColor::fromRgbF(c.r(), c.g(), c.b(), c.a()); 00013 } 00014 00015 QColor convertToQColor(const Color<long double>& c) 00016 { 00017 return QColor::fromRgbF(c.r(), c.g(), c.b(), c.a()); 00018 } 00019 00020 QColor convertToQColor(const Color<unsigned char>& c) 00021 { 00022 return QColor(c.r(), c.g(), c.b(), c.a()); 00023 } 00024 00025 QColor convertToQColor(const Color<unsigned short>& c) 00026 { 00027 return QColor(c.r(), c.g(), c.b(), c.a()); 00028 } 00029 00030 QColor convertToQColor(const Color<unsigned int>& c) 00031 { 00032 return QColor(c.r(), c.g(), c.b(), c.a()); 00033 } 00034 00035 QColor convertToQColor(const Color<unsigned long>& c) 00036 { 00037 return QColor(c.r(), c.g(), c.b(), c.a()); 00038 } 00039 00040 QColor convertToQColor(const Color<unsigned long long>& c) 00041 { 00042 return QColor(c.r(), c.g(), c.b(), c.a()); 00043 } 00044 00045 QColor convertToQColor(const Color<char>& c) 00046 { 00047 return QColor(c.r(), c.g(), c.b(), c.a()); 00048 } 00049 00050 QColor convertToQColor(const Color<short>& c) 00051 { 00052 return QColor(c.r(), c.g(), c.b(), c.a()); 00053 } 00054 00055 QColor convertToQColor(const Color<int>& c) 00056 { 00057 return QColor(c.r(), c.g(), c.b(), c.a()); 00058 } 00059 00060 QColor convertToQColor(const Color<long>& c) 00061 { 00062 return QColor(c.r(), c.g(), c.b(), c.a()); 00063 } 00064 00065 QColor convertToQColor(const Color<long long>& c) 00066 { 00067 return QColor(c.r(), c.g(), c.b(), c.a()); 00068 } 00069 00070 void convertFromQColor(Color<float>& c, const QColor& col) 00071 { 00072 c.r() = col.redF(); 00073 c.g() = col.greenF(); 00074 c.b() = col.blueF(); 00075 c.a() = col.alphaF(); 00076 } 00077 00078 void convertFromQColor(Color<double>& c, const QColor& col) 00079 { 00080 c.r() = col.redF(); 00081 c.g() = col.greenF(); 00082 c.b() = col.blueF(); 00083 c.a() = col.alphaF(); 00084 } 00085 00086 void convertFromQColor(Color<long double>& c, const QColor& col) 00087 { 00088 c.r() = col.redF(); 00089 c.g() = col.greenF(); 00090 c.b() = col.blueF(); 00091 c.a() = col.alphaF(); 00092 } 00093 00094 void convertFromQColor(Color<unsigned char>& c, const QColor& col) 00095 { 00096 c.r() = col.red(); 00097 c.g() = col.green(); 00098 c.b() = col.blue(); 00099 c.a() = col.alpha(); 00100 } 00101 00102 void convertFromQColor(Color<unsigned short>& c, const QColor& col) 00103 { 00104 c.r() = col.red(); 00105 c.g() = col.green(); 00106 c.b() = col.blue(); 00107 c.a() = col.alpha(); 00108 } 00109 00110 void convertFromQColor(Color<unsigned int>& c, const QColor& col) 00111 { 00112 c.r() = col.red(); 00113 c.g() = col.green(); 00114 c.b() = col.blue(); 00115 c.a() = col.alpha(); 00116 } 00117 00118 void convertFromQColor(Color<unsigned long>& c, const QColor& col) 00119 { 00120 c.r() = col.red(); 00121 c.g() = col.green(); 00122 c.b() = col.blue(); 00123 c.a() = col.alpha(); 00124 } 00125 00126 void convertFromQColor(Color<unsigned long long>& c, const QColor& col) 00127 { 00128 c.r() = col.red(); 00129 c.g() = col.green(); 00130 c.b() = col.blue(); 00131 c.a() = col.alpha(); 00132 } 00133 00134 void convertFromQColor(Color<char>& c, const QColor& col) 00135 { 00136 c.r() = col.red(); 00137 c.g() = col.green(); 00138 c.b() = col.blue(); 00139 c.a() = col.alpha(); 00140 } 00141 00142 void convertFromQColor(Color<short>& c, const QColor& col) 00143 { 00144 c.r() = col.red(); 00145 c.g() = col.green(); 00146 c.b() = col.blue(); 00147 c.a() = col.alpha(); 00148 } 00149 00150 void convertFromQColor(Color<int>& c, const QColor& col) 00151 { 00152 c.r() = col.red(); 00153 c.g() = col.green(); 00154 c.b() = col.blue(); 00155 c.a() = col.alpha(); 00156 } 00157 00158 void convertFromQColor(Color<long>& c, const QColor& col) 00159 { 00160 c.r() = col.red(); 00161 c.g() = col.green(); 00162 c.b() = col.blue(); 00163 c.a() = col.alpha(); 00164 } 00165 00166 void convertFromQColor(Color<long long>& c, const QColor& col) 00167 { 00168 c.r() = col.red(); 00169 c.g() = col.green(); 00170 c.b() = col.blue(); 00171 c.a() = col.alpha(); 00172 } 00173 00174 00175 } 00176