![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Welcome to Deadbeef.com
SearchLinksOpen SourceOtherFavoritesWho's Online?
Misc |
|
Archives for: June 2008, 0506/05/08One year of debt freedomSo it has now been one year since we became debt free! How has life changed? I must say as good as it felt to be debt free, it felt much better when we had 3 months of expenses saved as an emergency fund. In the last year we have:
Thanks Dave Converting RGB to HSV in C++I don't know why this is so hard to find, but it is. I ended up following the suggestion of a google answers question and converting the javascript formula at http://www.csgnetwork.com/csgcolorsel4.html to C++. (Ok, it is just plain C).
// RGB are from 0..1, H is from 0..360, SV from 0..1
double maxC = b;
if (maxC < g) maxC = g;
if (maxC < r) maxC = r;
double minC = b;
if (minC > g) minC = g;
if (minC > r) minC = r;
double delta = maxC - minC;
double V = maxC;
double S = 0;
double H = 0;
if (delta == 0)
{
H = 0;
S = 0;
}
else
{
S = delta / maxC;
double dR = 60*(maxC - r)/delta + 180;
double dG = 60*(maxC - g)/delta + 180;
double dB = 60*(maxC - b)/delta + 180;
if (r == maxC)
H = dB - dG;
else if (g == maxC)
H = 120 + dR - dB;
else
H = 240 + dG - dR;
}
if (H<0)
H+=360;
if (H>=360)
H-=360;
|
|
Sponsored LinksTop Articles
Categories
Archives
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||