From 963b4c44475fbb86a202d1446cbb027847ad3dc8 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 21 May 2016 14:46:17 -0300 Subject: [PATCH] Fixed ImageData:mapPixel's color component arguments to the mapping function to be within [0, 1] instead of [0, 255]. --HG-- branch : minor --- src/modules/image/wrap_ImageData.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/image/wrap_ImageData.lua b/src/modules/image/wrap_ImageData.lua index 12117a541..e1a5b99db 100644 --- a/src/modules/image/wrap_ImageData.lua +++ b/src/modules/image/wrap_ImageData.lua @@ -131,7 +131,7 @@ function ImageData:_mapPixelUnsafe(func, ix, iy, iw, ih) for y=iy, iy+ih-1 do for x=ix, ix+iw-1 do local p = pixels[y*idw+x] - local r, g, b, a = func(x, y, tonumber(p.r), tonumber(p.g), tonumber(p.b), tonumber(p.a)) + local r, g, b, a = func(x, y, tonumber(p.r) / 255, tonumber(p.g) / 255, tonumber(p.b) / 255, tonumber(p.a) / 255) pixels[y*idw+x].r = r * 255 pixels[y*idw+x].g = g * 255 pixels[y*idw+x].b = b * 255