mask resize
This commit is contained in:
parent
b3999b0598
commit
6b843f9404
|
@ -156,6 +156,7 @@ exportRefObject Mask:
|
|||
applyOpacity(Mask, float32)
|
||||
invert(Mask)
|
||||
blur(Mask, float32, uint8)
|
||||
resize(Mask, int, int)
|
||||
draw(Mask, Mask, Mat3, BlendMode)
|
||||
draw(Mask, Image, Mat3, BlendMode)
|
||||
fillText(Mask, Font, string, Mat3, Vec2, HorizontalAlignment, VerticalAlignment)
|
||||
|
|
|
@ -1155,6 +1155,21 @@ proc resize*(srcImage: Image, width, height: int): Image {.raises: [PixieError].
|
|||
OverwriteBlend
|
||||
)
|
||||
|
||||
proc resize*(srcMask: Mask, width, height: int): Mask {.raises: [PixieError].} =
|
||||
## Resize a mask to a given height and width.
|
||||
if width == srcMask.width and height == srcMask.height:
|
||||
result = srcMask.copy()
|
||||
else:
|
||||
result = newMask(width, height)
|
||||
result.draw(
|
||||
srcMask,
|
||||
scale(vec2(
|
||||
width.float32 / srcMask.width.float32,
|
||||
height.float32 / srcMask.height.float32
|
||||
)),
|
||||
OverwriteBlend
|
||||
)
|
||||
|
||||
proc shadow*(
|
||||
image: Image, offset: Vec2, spread, blur: float32, color: SomeColor
|
||||
): Image {.raises: [PixieError].} =
|
||||
|
|
Loading…
Reference in a new issue