Hello!
The display.colorSample() function does not work correctly.
More details:
JSON = require('json')
CX, CY = display.contentCenterX, display.contentCenterY
local rect = display.newRect(CX, CY, 100, 100)
timer.performWithDelay(1000, function()
display.colorSample(CX, CY,
function(event)
local r, g, b = event.r, event.g, event.b
r, g, b = tonumber(r)*255, tonumber(g)*255, tonumber(b)*255
print(r, g, b, JSON.encode(event))
end)
end, 1)
Output: 0 0 0 {“y”:512,“x”:384,“name”:“colorSample”,“r”:0,“a”:0,“g”:0,“b”:0}
But I assumed that there would be 1 1 1 {“y”:512,“x”:384,“name”:“colorSample”,“r”:1,“a”:1,“g”:1"b":1}, since the rect object is still white color