[ Ian Hickson ]
I don't understand how these are supposed to work when the underlying
bitmap's device pixel space does not map 1:1 to the coordinate space.

[ Vladimir Vukicevic ]
I'm not sure what you mean -- the coordinates here are explicit canvas
pixels, and they specifically ignore the current canvas transform.
So, given
 <canvas width="100" height="200"></canvas>

the coordinates would be 0..99, 0..199.

Without expressing any other opinion at the moment, I'd just like to clarify how Opera's implementation of getPixel/setPixel currently follows the coordinate space, as Vlad is suggesting here, disregarding any translation and rotation. Given the following script snippet:

gc = document.getElementsByTagName('canvas')[0].getContext('opera-2dgame');
  for ( var y = 50; y < 100; y++){
    for (var x = 50; x < 100; x++){
      gc.setPixel(x,y,"blue");
    }
  }

... with this CSS:

  canvas  {
    width: 200px;
    height: 200px;
    border: 1px solid black;
  }

and the following markup:

  <canvas width="100" height="100">

we fill the bottom-right quadrant of the canvas, with a rectangle that is comprised of 100x100 CSS pixels.

--
Arve Bersvendsen, Opera Software ASA

Reply via email to