- assert, + exception

This commit is contained in:
Ryan Oldenburg 2021-01-27 03:11:37 -06:00
parent 8668f355f1
commit c4abba5d8a

View file

@ -519,10 +519,14 @@ proc shift*(image: Image, offset: Vec2) =
proc spread*(image: Image, spread: float32) = proc spread*(image: Image, spread: float32) =
## Grows the image as a mask by spread. ## Grows the image as a mask by spread.
if spread == 0:
return
if spread < 0:
raise newException(PixieError, "Cannot apply negative spread")
let let
copy = image.copy() copy = image.copy()
spread = round(spread).int spread = round(spread).int
assert spread > 0
for y in 0 ..< image.height: for y in 0 ..< image.height:
for x in 0 ..< image.width: for x in 0 ..< image.width:
var maxAlpha = 0.uint8 var maxAlpha = 0.uint8