mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-08 18:25:53 -05:00
Clamp stripe height to img height
No more out of range settings crashing the logic :)
This commit is contained in:
@@ -128,6 +128,9 @@ public static Image ApplyEncounterColor(IEncounterTemplate enc, Image img, Sprit
|
||||
if (type == SpriteBackgroundType.BottomStripe)
|
||||
{
|
||||
int stripeHeight = SpriteBuilder.ShowEncounterThicknessStripe; // from bottom
|
||||
if ((uint)stripeHeight > img.Height) // clamp negative & too-high values back to height.
|
||||
stripeHeight = img.Height;
|
||||
|
||||
byte opacity = SpriteBuilder.ShowEncounterOpacityStripe;
|
||||
return ImageUtil.ChangeTransparentTo(img, color, opacity, img.Width * 4 * (img.Height - stripeHeight));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user