[whatwg] "canvas" reading ???

On Mon, 13 Jun 2005, Charles Iliya Krempeaux wrote:

> Hello,
> 
> I know people are going to want to read individual or groups of pixel
> values.  Certain image processing algorithms require it.  (For
> example, certain edge detection algorithms.  Etc.  There's alot of
> different ones.)

The problem is that it is quite easy for a single x,y coordinate of the 
canvas to have either multiple pixels, or have a pixel that is shared 
between multiple x,y coordinates.

That is to say, <canvas> is resolution-independent. The units of the API 
calls are CSS pixels, which are a length, not an index into the bitmap 
that implements the canvas.

When you say

   <canvas width="20" height="40">

...the coorindate space for the drawing commands is a 20x40 space, but the 
actual bitmap depends on the actual size of the canvas when it is 
rendered. If CSS specifies that it is 100px x 50px, then the bitmap will 
(probably) be a 100x50 pixel bitmap. Except if you are on a printer or a 
high-res screen, in which case it might be more like a 600x300 dot bitmap.

So which pixel do you return when you get asked for a specific pixel?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 14 June 2005 03:12:35 UTC