summaryrefslogtreecommitdiffhomepage
path: root/Stars45/Color.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/Color.cpp')
-rw-r--r--Stars45/Color.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/Stars45/Color.cpp b/Stars45/Color.cpp
index 5991d44..58b25f4 100644
--- a/Stars45/Color.cpp
+++ b/Stars45/Color.cpp
@@ -194,7 +194,7 @@ Color::Formatted() const
DWORD g = Green()>>format.gdown;
DWORD b = Blue() >>format.bdown;
DWORD a = Alpha()>>format.adown;
-
+
return (r<<format.rshift)|(g<<format.gshift)|(b<<format.bshift)|(a<<format.ashift);
}
}
@@ -239,7 +239,7 @@ Color::Unfaded() const
DWORD g = Green()>>format.gdown;
DWORD b = Blue() >>format.bdown;
DWORD a = Alpha()>>format.adown;
-
+
return (r<<format.rshift)|(g<<format.gshift)|(b<<format.bshift)|(a<<format.ashift);
}
}
@@ -257,12 +257,12 @@ Color::TextureFormat(int keep_alpha) const
}
else {
ColorFormat& tf = texture_format[texture_alpha_level];
-
+
DWORD r = Red();
DWORD g = Green();
DWORD b = Blue();
DWORD a = 0;
-
+
if (keep_alpha) {
a = Alpha()>>tf.adown;
}
@@ -271,7 +271,7 @@ Color::TextureFormat(int keep_alpha) const
// transparent:
a = 255>>tf.adown;
}
-
+
else if (texture_alpha_level == 2) {
// translucent:
if (r || g || b)
@@ -304,7 +304,7 @@ Color::ShadeColor(int shade) const
}
else if (shade > SHADE_LEVELS) { // shade towards white
double step = (shade - range)/range;
-
+
sr = fr - (fr - 1.0) * step;
sg = fg - (fg - 1.0) * step;
sb = fb - (fb - 1.0) * step;
@@ -339,7 +339,7 @@ Color::Unformat(DWORD formatted_color)
BYTE g = (BYTE) ((formatted_color & format.gmask)>>format.gshift) << format.gdown;
BYTE b = (BYTE) ((formatted_color & format.bmask)>>format.bshift) << format.bdown;
BYTE a = (BYTE) ((formatted_color & format.amask)>>format.ashift) << format.adown;
-
+
return Color(r,g,b,a);
}
}
@@ -465,13 +465,13 @@ static BYTE MatchRGB(PALETTEENTRY* pal, BYTE r, BYTE g, BYTE b)
double dr = p->peRed - r;
double dg = p->peGreen - g;
double db = p->peBlue - b;
-
+
double d = (dr*dr) + (dg*dg) + (db*db);
if (d < mindist) {
mindist = d;
match = i;
-
+
if (d < 1.0)
return match;
}
@@ -497,9 +497,9 @@ Color::SetPalette(PALETTEENTRY* pal, int palsize, BYTE* invpal)
BYTE r = (i >> 10) & 0x1f;
BYTE g = (i >> 5) & 0x1f;
BYTE b = (i ) & 0x1f;
-
+
Color c(r<<3, g<<3, b<<3);
-
+
table[i] = MatchRGB(palette, r<<3, g<<3, b<<3);
}
}
@@ -556,7 +556,7 @@ Color::SetFade(double f, Color c, int build_shade)
// modify the video palette as well:
if (format.pal && video) {
PALETTEENTRY fade_palette[256];
-
+
double step = (1.0 - fade);
for (int i = 0; i < 256; i++) {
PALETTEENTRY& entry = fade_palette[i];
@@ -569,7 +569,7 @@ Color::SetFade(double f, Color c, int build_shade)
}
}
- // otherwise, we need to re-compute
+ // otherwise, we need to re-compute
// the shade table:
else {
if (build_shade) {
@@ -601,11 +601,11 @@ Color::BuildBlendTable()
for (int dst = 0; dst < 256; dst++) {
ColorIndex src_clr = ColorIndex(src);
ColorIndex dst_clr = ColorIndex(dst);
-
+
int r = src_clr.Red() + dst_clr.Red();
int g = src_clr.Green() + dst_clr.Green();
int b = src_clr.Blue() + dst_clr.Blue();
-
+
if (r>255) r=255;
if (g>255) g=255;
if (b>255) b=255;
@@ -700,7 +700,7 @@ inline BYTE bclamp(float x) { return (BYTE) ((x<0) ? 0 : (x>255) ? 255 : x); }
Color
ColorValue::ToColor() const
{
- return Color(bclamp(r * 255.0f),
+ return Color(bclamp(r * 255.0f),
bclamp(g * 255.0f),
bclamp(b * 255.0f),
bclamp(a * 255.0f));