small
This commit is contained in:
parent
5a3e2b8ad7
commit
aeb531aedb
1 changed files with 6 additions and 7 deletions
|
@ -360,6 +360,8 @@ proc blur*(
|
||||||
let radius = round(radius).int
|
let radius = round(radius).int
|
||||||
if radius == 0:
|
if radius == 0:
|
||||||
return
|
return
|
||||||
|
if radius < 0:
|
||||||
|
raise newException(PixieError, "Cannot apply negative blur")
|
||||||
|
|
||||||
let
|
let
|
||||||
kernel = gaussianKernel(radius)
|
kernel = gaussianKernel(radius)
|
||||||
|
@ -776,7 +778,7 @@ proc drawTiled*(dest, src: Image, mat: Mat3, blendMode = bmNormal) =
|
||||||
dest.drawCorrect(src, mat, true, blendMode)
|
dest.drawCorrect(src, mat, true, blendMode)
|
||||||
|
|
||||||
proc resize*(srcImage: Image, width, height: int): Image =
|
proc resize*(srcImage: Image, width, height: int): Image =
|
||||||
## Resize an image to a given hight and width.
|
## Resize an image to a given height and width.
|
||||||
if width == srcImage.width and height == srcImage.height:
|
if width == srcImage.width and height == srcImage.height:
|
||||||
result = srcImage.copy()
|
result = srcImage.copy()
|
||||||
else:
|
else:
|
||||||
|
@ -808,11 +810,8 @@ proc shadow*(
|
||||||
): Image =
|
): Image =
|
||||||
## Create a shadow of the image with the offset, spread and blur.
|
## Create a shadow of the image with the offset, spread and blur.
|
||||||
let mask = image.newMask()
|
let mask = image.newMask()
|
||||||
if offset != vec2(0, 0):
|
|
||||||
mask.shift(offset)
|
mask.shift(offset)
|
||||||
if spread > 0:
|
|
||||||
mask.spread(spread)
|
mask.spread(spread)
|
||||||
if blur > 0:
|
|
||||||
mask.blur(blur)
|
mask.blur(blur)
|
||||||
result = newImage(mask.width, mask.height)
|
result = newImage(mask.width, mask.height)
|
||||||
result.fill(color)
|
result.fill(color)
|
||||||
|
|
Loading…
Reference in a new issue