fix(resize): width and height were swapped accidentally :|

This commit is contained in:
Mahdi Dibaiee 2017-02-04 12:48:34 +03:30
parent 232b1291fa
commit ffdf17c84e
2 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
name: picedit
version: 0.2.2.0
version: 0.2.3.0
synopsis: simple image manipulation functions
description: Simple set of functions for image manipulation: contrast, brightnesss, rotation, etc.
homepage: https://github.com/mdibaiee/picedit#readme

View File

@ -177,12 +177,12 @@ module Data.Picture ( Picture
resize (sWidth, sHeight) (r, g, b, a) = (f r, f g, f b, f a)
where
initial = vector [0..fromIntegral sWidth * fromIntegral sHeight - 1]
(width, height) = (rows r, cols r)
(width, height) = (cols r, rows r)
factor = 2 ^ 16
(xRatio, yRatio) = (width * factor `div` sWidth + 1, height * factor `div` sHeight + 1)
f m = tr $ reshape sWidth $ V.map replace initial
f m = reshape sWidth $ V.map replace initial
where
v = flatten (tr m)
v = flatten m
replace index =
let (x, y) = (floor index `mod` sWidth, floor index `div` sWidth)
(px, py) = (x * xRatio `div` factor, y * yRatio `div` factor)
@ -193,7 +193,7 @@ module Data.Picture ( Picture
scale 1 p = p
scale s (r, g, b, a) = resize (floor $ s * width, floor $ s * height) (r, g, b, a)
where
(width, height) = (fromIntegral $ rows r, fromIntegral $ cols r)
(width, height) = (fromIntegral $ cols r, fromIntegral $ rows r)
bound (l, u) x = max l $ min u x