Page 1 of 1

floating point ImageData?

Posted: Thu Apr 30, 2015 4:12 am
by vjlove
It seems that Canvas:getImageData() always converts the pixels to UNSIGNED_BYTE, probably since ImageData wants it that way. Is there anyway I can get access to the floating point pixel data in my 'rgba32f' Canvas, from Lua? I know I can get there in a shader, but that also won't let me 'export' the data to Lua. Or is there another way? Also would like to get the f.p. Canvas contents into a .HDR or similar file format...but the raw floats would be okay. I guess I can write a version of Canvas::newImageData() in C++ that doesn't do the pixel format conversion, but I'm hoping to stay in Lua.

Re: floating point ImageData?

Posted: Thu Apr 30, 2015 4:20 am
by slime
There isn't any way at the moment.
I guess you could draw the Canvas to a separate rgba8 canvas using the "replace" [wiki]BlendMode[/wiki] and a pixel shader which outputs pixel colors in the RGBE (RGB plus a shared exponent in the alpha channel) format, which is what .hdr files use I believe.