W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2013

Re: [whatwg] Proposal: HTMLCanvasElement.printCallback API

From: Julian Viereck <julian.viereck@googlemail.com>
Date: Thu, 07 Feb 2013 09:38:09 +0100
Message-ID: <511367F1.5080602@gmail.com>
To: Elliott Sprehn <esprehn@gmail.com>
Cc: whatwg <whatwg@lists.whatwg.org>, Julian Viereck <julian.viereck@googlemail.com>
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

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:19 UTC