map renderer fixes (#29523)

* map renderer fixes

* remove useless casts
This commit is contained in:
Nemanja
2024-06-27 20:09:05 -04:00
committed by GitHub
parent bc1703323e
commit c7fcbe8c16
3 changed files with 17 additions and 7 deletions

View File

@@ -86,7 +86,8 @@ public sealed class DecalPainter
image.Mutate(o => o.Rotate((float) -decal.Angle.Degrees));
var coloredImage = new Image<Rgba32>(image.Width, image.Height);
Color color = decal.Color?.ConvertImgSharp() ?? Color.White;
Color color = decal.Color?.WithAlpha(byte.MaxValue).ConvertImgSharp() ?? Color.White; // remove the encoded color alpha here
var alpha = decal.Color?.A ?? 1; // get the alpha separately so we can use it in DrawImage
coloredImage.Mutate(o => o.BackgroundColor(color));
image.Mutate(o => o
@@ -95,6 +96,6 @@ public sealed class DecalPainter
// Very unsure why the - 1 is needed in the first place but all decals are off by exactly one pixel otherwise
// Woohoo!
canvas.Mutate(o => o.DrawImage(image, new Point((int) data.X, (int) data.Y - 1), 1.0f));
canvas.Mutate(o => o.DrawImage(image, new Point((int) data.X, (int) data.Y - 1), alpha));
}
}