- assert, + exception
This commit is contained in:
parent
8668f355f1
commit
c4abba5d8a
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue