CWE sprites have their RGB values clamped to 0-64 instead of 0-255

This commit is contained in:
Michael Becker 2022-07-24 11:11:12 -04:00
parent 1b38d7ad6a
commit 4b1db6636c
No known key found for this signature in database
GPG Key ID: DA394832305DA332

View File

@ -147,7 +147,21 @@ namespace UniversalEditor.Plugins.ChaosWorks.DataFormats.Multimedia.PictureColle
a = (byte)(255 - a);
}
if (r > 63 || g > 63 || b > 63)
{
Console.WriteLine("cwe: sprite warning: color component exceeds 63 ( {0} {1} {2} {3} )", r, g, b, a);
}
else
{
// clamp-64 to clamp-255
r = (byte)(((double)r / 63) * 255);
g = (byte)(((double)g / 63) * 255);
b = (byte)(((double)b / 63) * 255);
}
Color color = Color.FromRGBAByte(r, g, b, a);
Console.WriteLine("cwe: sprite debug: color added ( {0} {1} {2} {3} )", r, g, b, a);
EmbeddedPalette.Entries.Add(color);
palette.Entries.Add(color);
}