mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +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:
committed by
Anne Marije v/d Meer
parent
b34577103e
commit
8c5286400a
@ -103,6 +103,7 @@ struct hsColorRGBA {
|
||||
|
||||
hsColorRGBA& FromARGB32(uint32_t c);
|
||||
uint32_t ToARGB32() const;
|
||||
uint32_t ToARGB32Premultiplied() const;
|
||||
|
||||
void Read(hsStream *stream);
|
||||
void Write(hsStream *stream) const;
|
||||
@ -141,6 +142,14 @@ inline uint32_t hsColorRGBA::ToARGB32() const
|
||||
| (uint32_t(b * 255.99f) << 0);
|
||||
}
|
||||
|
||||
inline uint32_t hsColorRGBA::ToARGB32Premultiplied() const
|
||||
{
|
||||
return (uint32_t(a * 255.0f + 0.5f) << 24)
|
||||
| (uint32_t(a * r * 255.0f + 0.5f) << 16)
|
||||
| (uint32_t(a * g * 255.0f + 0.5f) << 8)
|
||||
| (uint32_t(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