W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2006

[whatwg] proposed canvas 2d API additions

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 26 Apr 2006 20:15:31 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0604262013560.21459@dhalsim.dreamhost.com>
On Sat, 22 Apr 2006, Sjoerd Visscher wrote:
> 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.

Vlad suggested the use case was sightly more complex, basically:

   c.putPixels(manipulate(c.getPixels(...)), ...);


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

You could manually do this using the API I suggested earlier today, FWIW, 
including handling transparency in special ways.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 26 April 2006 13:15:31 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:46 UTC