User:Roc/WorkerCanvasProposal

< User:Roc
Revision as of 22:52, 17 October 2013 by Roc (talk | contribs) (Created page with "== WebIDL == [Constructor(unsigned long width, unsigned long height)] interface WorkerCanvas { readonly attribute unsigned long width; readonly attribute unsigned lon...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WebIDL

[Constructor(unsigned long width, unsigned long height)]
interface WorkerCanvas {
  readonly attribute unsigned long width;
  readonly attribute unsigned long height;
  void resize(unsigned long width, unsigned long height);
  RenderingContext? getContext(DOMString contextId, any... arguments); 
  void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);
  ImageBitmap transferToImageBitmap();
};
partial interface RenderingContext {
  void commit();
};
WorkerCanvas implements Transferable;
partial interface HTMLCanvasElement {
  WorkerCanvas transferControlToWorker();
};

Spec changes

Structured clone of ImageBitmaps has to be defined; since they're immutable, it's straightforward. The implementation can share the underlying buffer data across threads. ImageBitmaps can also represent the results of deferred rendering of a list of drawing commands.