resize remove +1

This commit is contained in:
Ryan Oldenburg 2021-01-27 16:45:56 -06:00
parent a6103ac444
commit fe1cfc41a6

View file

@ -500,15 +500,18 @@ proc draw*(a, b: Image, pos = vec2(0, 0), blendMode = bmNormal) {.inline.} =
a.draw(b, translate(pos), blendMode) a.draw(b, translate(pos), blendMode)
proc resize*(srcImage: Image, width, height: int): Image = proc resize*(srcImage: Image, width, height: int): Image =
result = newImage(width, height) if width == srcImage.width and height == srcImage.height:
result.draw( result = srcImage.copy()
srcImage, else:
scale(vec2( result = newImage(width, height)
(width + 1).float / srcImage.width.float, result.draw(
(height + 1).float / srcImage.height.float srcImage,
)), scale(vec2(
bmOverwrite width.float32 / srcImage.width.float32,
) height.float32 / srcImage.height.float32
)),
bmOverwrite
)
proc shift*(image: Image, offset: Vec2) = proc shift*(image: Image, offset: Vec2) =
## Shifts the image by offset. ## Shifts the image by offset.