Fix ?border behaving slightly different to vanilla (due to alterations for font directives)

This commit is contained in:
Kae 2024-04-18 11:54:31 +10:00
parent 5bf3b20542
commit 9533c8d0a5

View File

@ -591,8 +591,8 @@ void processImageOperation(ImageOperation const& operation, Image& image, ImageR
if (dist < std::numeric_limits<int>::max()) { if (dist < std::numeric_limits<int>::max()) {
float percent = (dist - 1) / (2.0f * pixels - 1); float percent = (dist - 1) / (2.0f * pixels - 1);
Color color = Color::rgba(op->startColor).mix(Color::rgba(op->endColor), percent);
if (pixel[3] != 0) { if (pixel[3] != 0) {
Color color = Color::rgba(op->startColor).mix(Color::rgba(op->endColor), percent);
if (op->outlineOnly) { if (op->outlineOnly) {
float pixelA = byteToFloat(pixel[3]); float pixelA = byteToFloat(pixel[3]);
color.setAlphaF((1.0f - pixelA) * fminf(pixelA, 0.5f) * 2.0f); color.setAlphaF((1.0f - pixelA) * fminf(pixelA, 0.5f) * 2.0f);
@ -607,8 +607,10 @@ void processImageOperation(ImageOperation const& operation, Image& image, ImageR
color.convertToSRGB(); color.convertToSRGB();
color.setAlphaF(colorA); color.setAlphaF(colorA);
} }
pixel = color.toRgba();
} else {
pixel = Vec4B(Vec4F(op->startColor) * (1 - percent) + Vec4F(op->endColor) * percent);
} }
pixel = color.toRgba();
} }
} else if (op->outlineOnly) { } else if (op->outlineOnly) {
pixel = Vec4B(0, 0, 0, 0); pixel = Vec4B(0, 0, 0, 0);