mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-20 04:09:16 +00:00
Use premultiplied alpha for plDynamicTextMaps on GUI controls.
This fixes the irregular dark fringes around light text when not exactly pixel-aligned that are caused by independent interpolation of color and alpha. It also makes calculations simpler for things to come.
This commit is contained in:
@ -71,6 +71,7 @@ struct hsColorRGBA {
|
||||
|
||||
hsColorRGBA& FromARGB32(UInt32 c);
|
||||
UInt32 ToARGB32() const;
|
||||
UInt32 ToARGB32Premultiplied() const;
|
||||
|
||||
void Read(hsStream *stream);
|
||||
void Write(hsStream *stream) const;
|
||||
@ -109,6 +110,14 @@ inline UInt32 hsColorRGBA::ToARGB32() const
|
||||
| (UInt32(b * 255.99f) << 0);
|
||||
}
|
||||
|
||||
inline UInt32 hsColorRGBA::ToARGB32Premultiplied() const
|
||||
{
|
||||
return (UInt32(a * 255.0f + 0.5f) << 24)
|
||||
| (UInt32(a * r * 255.0f + 0.5f) << 16)
|
||||
| (UInt32(a * g * 255.0f + 0.5f) << 8)
|
||||
| (UInt32(a * b * 255.0f + 0.5f) << 0);
|
||||
}
|
||||
|
||||
inline hsColorRGBA operator+(const hsColorRGBA& s, const hsColorRGBA& t)
|
||||
{
|
||||
hsColorRGBA res;
|
||||
|
Reference in New Issue
Block a user