oops, extra methods
part of bug 163736, again not part of build git-svn-id: svn://10.0.0.236/trunk@128907 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
8425f7a31d
commit
e14adce270
@ -197,130 +197,6 @@ int NS_GetBrightness(PRUint8 aRed, PRUint8 aGreen, PRUint8 aBlue)
|
||||
(luminosity * LUMINOSITY_FACTOR)) / 100;
|
||||
}
|
||||
|
||||
nscolor NS_BrightenColor(nscolor inColor)
|
||||
{
|
||||
PRIntn r, g, b, max, over;
|
||||
|
||||
r = NS_GET_R(inColor);
|
||||
g = NS_GET_G(inColor);
|
||||
b = NS_GET_B(inColor);
|
||||
|
||||
//10% of max color increase across the board
|
||||
r += 25;
|
||||
g += 25;
|
||||
b += 25;
|
||||
|
||||
//figure out which color is largest
|
||||
if (r > g)
|
||||
{
|
||||
if (b > r)
|
||||
max = b;
|
||||
else
|
||||
max = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b > g)
|
||||
max = b;
|
||||
else
|
||||
max = g;
|
||||
}
|
||||
|
||||
//if we overflowed on this max color, increase
|
||||
//other components by the overflow amount
|
||||
if (max > 255)
|
||||
{
|
||||
over = max - 255;
|
||||
|
||||
if (max == r)
|
||||
{
|
||||
g += over;
|
||||
b += over;
|
||||
}
|
||||
else if (max == g)
|
||||
{
|
||||
r += over;
|
||||
b += over;
|
||||
}
|
||||
else
|
||||
{
|
||||
r += over;
|
||||
g += over;
|
||||
}
|
||||
}
|
||||
|
||||
//clamp
|
||||
if (r > 255)
|
||||
r = 255;
|
||||
if (g > 255)
|
||||
g = 255;
|
||||
if (b > 255)
|
||||
b = 255;
|
||||
|
||||
return NS_RGBA(r, g, b, NS_GET_A(inColor));
|
||||
}
|
||||
|
||||
nscolor NS_DarkenColor(nscolor inColor)
|
||||
{
|
||||
PRIntn r, g, b, max;
|
||||
|
||||
r = NS_GET_R(inColor);
|
||||
g = NS_GET_G(inColor);
|
||||
b = NS_GET_B(inColor);
|
||||
|
||||
//10% of max color decrease across the board
|
||||
r -= 25;
|
||||
g -= 25;
|
||||
b -= 25;
|
||||
|
||||
//figure out which color is largest
|
||||
if (r > g)
|
||||
{
|
||||
if (b > r)
|
||||
max = b;
|
||||
else
|
||||
max = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b > g)
|
||||
max = b;
|
||||
else
|
||||
max = g;
|
||||
}
|
||||
|
||||
//if we underflowed on this max color, decrease
|
||||
//other components by the underflow amount
|
||||
if (max < 0)
|
||||
{
|
||||
if (max == r)
|
||||
{
|
||||
g += max;
|
||||
b += max;
|
||||
}
|
||||
else if (max == g)
|
||||
{
|
||||
r += max;
|
||||
b += max;
|
||||
}
|
||||
else
|
||||
{
|
||||
r += max;
|
||||
g += max;
|
||||
}
|
||||
}
|
||||
|
||||
//clamp
|
||||
if (r < 0)
|
||||
r = 0;
|
||||
if (g < 0)
|
||||
g = 0;
|
||||
if (b < 0)
|
||||
b = 0;
|
||||
|
||||
return NS_RGBA(r, g, b, NS_GET_A(inColor));
|
||||
}
|
||||
|
||||
// Function to convert RGB color space into the HSV colorspace
|
||||
// Hue is the primary color defined from 0 to 359 degrees
|
||||
// Saturation is defined from 0 to 255. The higher the number.. the deeper the color
|
||||
|
||||
@ -51,14 +51,6 @@ void NS_GetSpecial3DColors(nscolor aResult[2],
|
||||
nscolor aBackgroundColor,
|
||||
nscolor aBorderColor);
|
||||
|
||||
// Special method to brighten a Color and have it shift to white when
|
||||
// fully saturated.
|
||||
nscolor NS_BrightenColor(nscolor inColor);
|
||||
|
||||
// Special method to darken a Color and have it shift to black when
|
||||
// darkest component underflows
|
||||
nscolor NS_DarkenColor(nscolor inColor);
|
||||
|
||||
// Determins brightness for a specific color
|
||||
int NS_GetBrightness(PRUint8 aRed, PRUint8 aGreen, PRUint8 aBlue);
|
||||
|
||||
|
||||
@ -197,130 +197,6 @@ int NS_GetBrightness(PRUint8 aRed, PRUint8 aGreen, PRUint8 aBlue)
|
||||
(luminosity * LUMINOSITY_FACTOR)) / 100;
|
||||
}
|
||||
|
||||
nscolor NS_BrightenColor(nscolor inColor)
|
||||
{
|
||||
PRIntn r, g, b, max, over;
|
||||
|
||||
r = NS_GET_R(inColor);
|
||||
g = NS_GET_G(inColor);
|
||||
b = NS_GET_B(inColor);
|
||||
|
||||
//10% of max color increase across the board
|
||||
r += 25;
|
||||
g += 25;
|
||||
b += 25;
|
||||
|
||||
//figure out which color is largest
|
||||
if (r > g)
|
||||
{
|
||||
if (b > r)
|
||||
max = b;
|
||||
else
|
||||
max = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b > g)
|
||||
max = b;
|
||||
else
|
||||
max = g;
|
||||
}
|
||||
|
||||
//if we overflowed on this max color, increase
|
||||
//other components by the overflow amount
|
||||
if (max > 255)
|
||||
{
|
||||
over = max - 255;
|
||||
|
||||
if (max == r)
|
||||
{
|
||||
g += over;
|
||||
b += over;
|
||||
}
|
||||
else if (max == g)
|
||||
{
|
||||
r += over;
|
||||
b += over;
|
||||
}
|
||||
else
|
||||
{
|
||||
r += over;
|
||||
g += over;
|
||||
}
|
||||
}
|
||||
|
||||
//clamp
|
||||
if (r > 255)
|
||||
r = 255;
|
||||
if (g > 255)
|
||||
g = 255;
|
||||
if (b > 255)
|
||||
b = 255;
|
||||
|
||||
return NS_RGBA(r, g, b, NS_GET_A(inColor));
|
||||
}
|
||||
|
||||
nscolor NS_DarkenColor(nscolor inColor)
|
||||
{
|
||||
PRIntn r, g, b, max;
|
||||
|
||||
r = NS_GET_R(inColor);
|
||||
g = NS_GET_G(inColor);
|
||||
b = NS_GET_B(inColor);
|
||||
|
||||
//10% of max color decrease across the board
|
||||
r -= 25;
|
||||
g -= 25;
|
||||
b -= 25;
|
||||
|
||||
//figure out which color is largest
|
||||
if (r > g)
|
||||
{
|
||||
if (b > r)
|
||||
max = b;
|
||||
else
|
||||
max = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b > g)
|
||||
max = b;
|
||||
else
|
||||
max = g;
|
||||
}
|
||||
|
||||
//if we underflowed on this max color, decrease
|
||||
//other components by the underflow amount
|
||||
if (max < 0)
|
||||
{
|
||||
if (max == r)
|
||||
{
|
||||
g += max;
|
||||
b += max;
|
||||
}
|
||||
else if (max == g)
|
||||
{
|
||||
r += max;
|
||||
b += max;
|
||||
}
|
||||
else
|
||||
{
|
||||
r += max;
|
||||
g += max;
|
||||
}
|
||||
}
|
||||
|
||||
//clamp
|
||||
if (r < 0)
|
||||
r = 0;
|
||||
if (g < 0)
|
||||
g = 0;
|
||||
if (b < 0)
|
||||
b = 0;
|
||||
|
||||
return NS_RGBA(r, g, b, NS_GET_A(inColor));
|
||||
}
|
||||
|
||||
// Function to convert RGB color space into the HSV colorspace
|
||||
// Hue is the primary color defined from 0 to 359 degrees
|
||||
// Saturation is defined from 0 to 255. The higher the number.. the deeper the color
|
||||
|
||||
@ -51,14 +51,6 @@ void NS_GetSpecial3DColors(nscolor aResult[2],
|
||||
nscolor aBackgroundColor,
|
||||
nscolor aBorderColor);
|
||||
|
||||
// Special method to brighten a Color and have it shift to white when
|
||||
// fully saturated.
|
||||
nscolor NS_BrightenColor(nscolor inColor);
|
||||
|
||||
// Special method to darken a Color and have it shift to black when
|
||||
// darkest component underflows
|
||||
nscolor NS_DarkenColor(nscolor inColor);
|
||||
|
||||
// Determins brightness for a specific color
|
||||
int NS_GetBrightness(PRUint8 aRed, PRUint8 aGreen, PRUint8 aBlue);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user