[whatwg] More random comments on the putImageData definition

On Jan 25, 2008, at 6:56 AM, Oliver Hunt wrote:

> With the current model for putImageData there is no way for them to  
> specify a dirty rect, which means their only option is to update the  
> entire display -- they have to copy the entire buffer.
<snip>
>
> Anyway, i was thinking we would just need to putDataImage methods:
> void putImageData(in ImageData imagedata, in float dx, in float dy);
> void putImageData(in ImageData imagedata, in float dx, in float dy,  
> in float dirtyX, in float dirtyY, in float dirtyWidth, in float  
> dirtyHeight);
>
> Where the dirtyX and dirtyY are relative to the ImageData's origin.
>
> The repaint region would be (dx+dirtyX, dy+dirtyY),  
> dirtyWidth*dirtyHeight in the canvas domain

I think it would be less confusing for the repaint region to always  
have its origin at (dx, dy). This would be more similar to Windows'  
BitBlt API. Something like:

void putImageData(in ImageData imageData, in float destX, in float  
destY, in float srcX, in float srcY, in float width, in float height)

destX and destY are in canvas coordinates
srcX and srcY are in ImageData coordinates

The data from the ImageData in the rectangle specified by (srcX, srcY,  
width, height) is then painted into the canvas in the rectangle  
(destX, destY, width, height).

-Adam

Received on Friday, 25 January 2008 06:53:39 UTC