mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-03-28 14:56:22 +01:00
I changed my mind about averaging the outline layers for transparent text color. The effect it was supposed to fake was only a small difference, anyway.
This commit is contained in:
parent
7290851552
commit
840821c04e
1 changed files with 5 additions and 6 deletions
|
@ -2163,9 +2163,9 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
|||
/* Step 2: Compute the opacity of the outline that would have been drawn behind the text.
|
||||
* In RGSS, there's a 1 pixel wide region at the edge of the text that only has
|
||||
* 2 layers of outline instead of the 4 layers that's behind most of the text,
|
||||
* which noticeably affects the appearance of the text. We can't easily replicate this
|
||||
* in a way that looks nice in hires mode, however, so as a compromise we'll use the average
|
||||
* of the 2-layer and 4-layer alphas. */
|
||||
* which combined with the outlines having less opaque corners from how they're drawn
|
||||
* slightly affects the appearance of the text. We can't replicate this in a way that
|
||||
* looks nice in hires mode, however, this will have to be good enough. */
|
||||
uint8_t out_alpha_full = co.a; // compute outline alpha - 4 layers
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
int co1 = out_alpha * 255;
|
||||
|
@ -2176,11 +2176,10 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
|||
* RGSS seems to not round, but our blit shader seemingly does. */
|
||||
//out_alpha_full = (fa + 128 + ((fa + 128) >> 8)) >> 8;
|
||||
}
|
||||
out_alpha = (out_alpha + out_alpha_full) / 2;
|
||||
|
||||
/* Step 3: Calculate the text color using out_alpha in place of co.a. */
|
||||
/* Step 3: Calculate the text color using out_alpha_full in place of co.a. */
|
||||
int co1 = c.a * 255;
|
||||
int co2 = out_alpha * (255 - c.a);
|
||||
int co2 = out_alpha_full * (255 - c.a);
|
||||
int fa = co1 + co2;
|
||||
|
||||
float faInv = 1.0f / fa;
|
||||
|
|
Loading…
Add table
Reference in a new issue