[whatwg] Canvas pixel manipulation and performance

Philip Taylor excors+whatwg at gmail.com
Mon Nov 30 10:31:53 PST 2009


On Mon, Nov 30, 2009 at 4:46 PM, Kenneth Russell <kbr at google.com> wrote:
> CanvasPixelArray specifies that values greater than 255, including
> +inf, are clamped to 255 and values less than 0, including -inf, are
> clamped to zero. WebGLUnsignedByteArray (as people will see in the
> WebGL draft spec this week or next) specifies that the conversion is
> done with a C-style cast. The results are different for out-of-range
> values.

I was going to say: It doesn't include +/-inf, because
http://whatwg.org/html5#dependencies says "if a method with an
argument that is a floating point number type (float) is passed an
Infinity or Not-a-Number (NaN) value, a NOT_SUPPORTED_ERR exception
must be raised", and that probably applies to the CanvasPixelArray
setter method.

But it looks like the spec changed since I last looked, and the setter
takes an 'octet' argument, so I think the conversion should happen as
per http://dev.w3.org/2006/webapi/WebIDL/#es-octet and
CanvasPixelArray shouldn't define any conversion. (Filed as
http://www.w3.org/Bugs/Public/show_bug.cgi?id=8405). Hopefully WebIDL
and WebGL either match or can be made to match.

-- 
Philip Taylor
excors at gmail.com



More information about the whatwg mailing list