[whatwg] getImageData/putImageData comments
bzbarsky at MIT.EDU
Fri Jun 12 11:46:18 PDT 2009
Ian Hickson wrote:
>> 2) The description of putImageData says it "Paints the data from the
>> given ImageData object onto the canvas". It may be worth
>> specifying that this uses the SOURCE operator, though this is
>> clear later on when defining what the method _really_ does.
> That's the author description, which is non-normative and trades precision
> for accessibility, so I've not added this text. I recommend not reading
> those sections as an implementor.
I was reading it as an author; as an author I assumed that if I'm
painting data with an alpha < 1 I'll see things under it (which is not
hthe case with PutImageData).
> The long and short of this is that if we solve this problem today, the
> solution will be abused as much as the current API, and we'll have to
> introduce yet another solution when high-res backing stores are common. So
> instead I'm hoping that (a) authors won't screw this up, and (b) high-res
> backing stores will be implemented sooner rather than later. If we fail
> with (a), which is more likely if (b) is delayed, then we'll just
> introduce a higher-res API later, and designate this one a lost cause.
OK. This was sort of discussed in a follow-on thread to my mail, but my
last comment about there being two fundamentally different use cases for
PutImageData never got any responses....
> Also, I'm not really convinced that the use case you describe is common.
It was the first use I tried to put canvas to: visualizing something by
computing color values for pixels and then painting to the canvas (in my
case Julia sets).
> If you have sprite data, use drawImage().
> The putImageData() API is really
> intended for filters and generated patterns, both of which would want to
> be as high-res as possible.
People are using it for things that are not filters or generated
patterns as we speak... And generally getting it wrong (in the sense
that their stuff will break on high-res displays).
More information about the whatwg