[whatwg] HTML Canvas Element getBlob

Glenn Maynard glenn at zewt.org
Mon Dec 27 17:04:29 PST 2010


On Mon, Dec 27, 2010 at 7:25 PM, Charles Pritchard <chuck at jumis.com> wrote:
> With the File API, readAsXXX is as far as things have gotten.
> There's no precedent, yet, for deflate compression, sha1/md5 checksum, etc.

There's nothing like that synchronously either, though.  If you mean
there are no async calls for purely CPU-bound operations (vs. the
network-bound XHR and I/O-bound File/FS-API), then you're probably
right about that.

> Using an ArrayBuffer, with onprogress events would be more flexible (and
> verbose) than using a getAsyncBlob method.

It almost seems like the API this hints at is exactly that of
FileReader/FileReaderSync (minus readAsText), with
FileReaderSync.readAsDataURL obsoleting Canvas.toDataURL.
"canvas.getImageReaderSync('image/png').readAsDataURL()"

I agree that having no API for this at all in the coming generation of
browsers by waiting for something like this to be specced and
implemented would be a loss, though; it's too important.  It would
also be partially redundant if Canvas access in worker threads ever
happens.

-- 
Glenn Maynard



More information about the whatwg mailing list