Browse Source

Fixed ImageData:mapPixel's color component arguments to the mapping function to be within [0, 1] instead of [0, 255].

--HG--
branch : minor
Alex Szpakowski 9 years ago
parent
commit
963b4c4447
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/modules/image/wrap_ImageData.lua

+ 1 - 1
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