From c4abba5d8a41f173ccab6d9d34c3c89d7d6a12e0 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Wed, 27 Jan 2021 03:11:37 -0600 Subject: [PATCH] - assert, + exception --- src/pixie/images.nim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pixie/images.nim b/src/pixie/images.nim index 6f399f0..0172a8d 100644 --- a/src/pixie/images.nim +++ b/src/pixie/images.nim @@ -519,10 +519,14 @@ proc shift*(image: Image, offset: Vec2) = proc spread*(image: Image, spread: float32) = ## Grows the image as a mask by spread. + if spread == 0: + return + if spread < 0: + raise newException(PixieError, "Cannot apply negative spread") + let copy = image.copy() spread = round(spread).int - assert spread > 0 for y in 0 ..< image.height: for x in 0 ..< image.width: var maxAlpha = 0.uint8