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

[whatwg] createImageData -> new ImageData() ?

From: Anne van Kesteren <annevk@opera.com>
Date: Sun, 03 Feb 2008 12:30:49 +0100
Message-ID: <op.t5x4xnbe64w2qv@annevk-t60.oslo.opera.com>
On Sun, 03 Feb 2008 12:20:54 +0100, Oliver Hunt <oliver at apple.com> wrote:
> On Feb 3, 2008, at 2:38 AM, Anne van Kesteren wrote:
>> Why not give the object a constructor? I think that's cleaner. Also,  
>> Opera already supports that :-)
>
> The biggest problem is that you would have to define the behaviour in a  
> fairly counterintuitive way
> new ImageData(400, 400) would not necessarily result in an ImageData  
> object with width=400, height=400
> as a system with a non-1:1 css to device pixel ratio.

How is this a non-issue for createImageData()?


>> The moment people start using getImageData() as storage mechanism  
>> (which they will if browsers do not fix their data: image origin stuff)  
>> you'll have a problem with this if the application is accessed through  
>> different devices that have different ratios. I suspect though that  
>> given that Firefox has a 1:1 ratio sites will simply rely on that...
>
> Part of my commentary was on a misunderstanding of the spec sorry :(
>
> That said, what do you mean by using getImageData as a storage mechanism?

If you have some kind of painting application and to store the result of  
the painting so that the user can edit it in another session every now and  
then you do getImageData() on the whole <canvas> and export the data to  
some database through XMLHttpRequest so when the visitor comes back he  
doesn't have to start all over again.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Received on Sunday, 3 February 2008 03:30:49 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:39 UTC