[whatwg] "canvas" reading ???

Charles Iliya Krempeaux supercanadian at gmail.com
Tue Jun 14 13:14:28 PDT 2005


On 6/14/05, Ian Hickson <ian at hixie.ch> wrote:
> 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?

>From the point-of-view of the image-processing algorithms, most of the
time you'd want to get the "virtual pixel".  That should let you do
most things.

However, I can see a need to get at the "real pixels" too.  (To avoid
aliasing.)  So, if possible, it would actually be useful to be able to
get at both.  (If not, the the "virtual pixel" would have to do.)

See ya

     Charles Iliya Krempeaux, B.Sc.

     charles @ reptile.ca
     supercanadian @ gmail.com

     developer weblog: http://ChangeLog.ca/
 Ask the toughest Linux System questions at...   http://linuxmanagers.org/

More information about the whatwg mailing list