[whatwg] proposed canvas 2d API additions

Sjoerd Visscher sjoerd at w3future.com
Sat Apr 22 04:05:29 PDT 2006


Ian Hickson wrote:
> On Sat, 22 Apr 2006, Sjoerd Visscher wrote:
>>> I understand what you are proposing. What I don't understand is what 
>>> colour should be returned when the many device pixels represented by 
>>> the given coordinate space pixel have different colors.
>> The weighted average of the colors in the square the size of 1 by 1 
>> canvas pixels.
> 
> ...in fact, that won't work. It would mean that this, which should be a 
> no-op:
> 
>    c.putPixels(c.getPixels(x, y, width, height), x, y, width, height);
> 
> ...will end up down-sampling the bitmap, which seems like it would break 
> the main use case for this API.
> 

If this is the main use case, then putPixels is just drawImage, and 
getPixels should be called copyCanvas, with the 4 arguments just setting 
a clip region.

The main use case of calculating the color of a (pixel-)square whould be 
  the eye drop tool.

-- 
Sjoerd Visscher
http://w3future.com/weblog/



More information about the whatwg mailing list