[whatwg] Feature proposal - add method to CanvasRenderingContext2D

2010-03-03 Thread František Řezáč
Hi,
the subject says it all. Details follows.

Description
add overload of (or add similarly called) method createImageData to
interface CanvasRenderingContext2D which would take two arguments:
- encodedImageBinaryData
- dataMimeType
which are rather self explanatory.

Reason
The reason is to be able to supply output of the future File API
standard (http://www.w3.org/TR/FileAPI/) into canvas.

Use case
Usually there is a lot of image processing during image upload. This
processing takes place at the server and it can consume a lot of
system resources. The method I propose would enable basic client side
image processing by loading image to canvas tag. Then the modified
image could be sent to server instead of the original one. This would
save a lot of server's resources and sometimes even a lot of
bandwidth.

Another possibilities
There are already solutions for this use case, but they are based on
technologies like Flash or Silverlight. With this proposal, no plugin
would be needed.

-- 
František Řezáč
Prague, Czech Republic


Re: [whatwg] Feature proposal - add method to CanvasRenderingContext2D

2010-03-03 Thread Philip Taylor
On Wed, Mar 3, 2010 at 1:08 PM, František Řezáč
frantisek.re...@calavera.info wrote:
 Description
 add overload of (or add similarly called) method createImageData to
 interface CanvasRenderingContext2D which would take two arguments:
 - encodedImageBinaryData
 - dataMimeType
 which are rather self explanatory.

 Reason
 The reason is to be able to supply output of the future File API
 standard (http://www.w3.org/TR/FileAPI/) into canvas.

The canvas API already lets you do:

  var img = new Image();
  img.onload = function() {
ctx.drawImage(img, 0, 0);
// do processing on the canvas
  };
  img.src = 'data:image/png;base64,...'; // get this string from
readAsDataURL etc

Is that sufficient for your use case?

-- 
Philip Taylor
exc...@gmail.com


Re: [whatwg] Feature proposal - add method to CanvasRenderingContext2D

2010-03-03 Thread František Řezáč
Yes, it works. I failed to spot that it's possible to put data url to
Image.src, sorry.

On Wed, Mar 3, 2010 at 3:33 PM, Philip Taylor excors+wha...@gmail.com wrote:
 On Wed, Mar 3, 2010 at 1:08 PM, František Řezáč
 frantisek.re...@calavera.info wrote:
 Description
 add overload of (or add similarly called) method createImageData to
 interface CanvasRenderingContext2D which would take two arguments:
 - encodedImageBinaryData
 - dataMimeType
 which are rather self explanatory.

 Reason
 The reason is to be able to supply output of the future File API
 standard (http://www.w3.org/TR/FileAPI/) into canvas.

 The canvas API already lets you do:

  var img = new Image();
  img.onload = function() {
    ctx.drawImage(img, 0, 0);
    // do processing on the canvas
  };
  img.src = 'data:image/png;base64,...'; // get this string from
 readAsDataURL etc

 Is that sufficient for your use case?

 --
 Philip Taylor
 exc...@gmail.com




-- 
František Řezáč
Prague, Czech Republic
--
Mobile - personal: +420776161038
Mobile - work: +420725817361
Email - personal:
  frantisek.re...@calavera.info
Email - work:
  frantisek.re...@profinit.cz
Jabber IM (GTalk):
  frantisek.re...@calavera.info
Skype: calavera.info
www: http://calavera.info
---
Ekonomové jsou politruci kapitalismu.