Re: [whatwg] Proposal: HTMLCanvasElement.printCallback API

On 1/28/13 6:25 AM, Elliott Sprehn wrote:
> 1) I feel like this should probably be an event. I don't know why 
> we're inventing new callback facilities everywhere.
>
> canvas.onprintcanvas = function(e) { e.printState ... }

Not sure I get what you're trying to say. Do you want the function to be 
an event, such that you can do

   canvas.addEventListener('printCallback', function(e) { ...} )

or just rename the `canvas.printCallback` to `canvas.onprintcallback`?

A event might be dispatched to multiple listeners. In the scenario with 
the print callback it makes only sense to have one function that defines 
the look of the canvas during printing. Therefore I've choosen to not 
use the event-listener pattern but instead a single callback function.

> 2) What does "send the canvas' content without rasterization to the 
> printer" mean? How are blending and overlapping images handled? Your 
> current description makes it sound like if I did two drawImage() calls 
> it would make my printer print the images on top of each other.
The drawing is done exactly the same as you expect it to show up on the 
screen including blending and overlapping.

Here is an example using the canvas.printCallback API. It draws shapes 
over each other:
- test html page: 
https://bug745025.bugzilla.mozilla.org/attachment.cgi?id=625810
- output: 
https://docs.google.com/file/d/0B4VOqqwjYRMLS05JNVZpZWt3MG8/edit?usp=sharing

Is this clear or does it need more clearification?

Very best,

Julian

Received on Thursday, 7 February 2013 08:38:31 UTC