Fwd: [whatwg] proposal: Add support for masking to canvas

Sorry,

the thread got detached from the mailing list.

proposal:

enum CanvasMaskType { "luminosity", "alpha"};
dictionary MaskOptions {

CanvasImageSource image;
unrestricted double sx;
unrestricted double sy;
unrestricted double sw;

unrestricted double sh;
unrestricted double dx;
unrestricted double dy;
unrestricted double dw;
unrestricted double dh;
CanvasMaskType maskType = "luminosity";
boolean invert = false;
boolean clipToMask = true;
boolean imageSmoothingEnabled = true;

}

void maskImage(optional MaskOptions options);
void resetMask();

If not specified, the dw and dh arguments must default to the values of sw
and sh, interpreted such that one CSS pixel in the image is treated as one
unit in thescratch bitmap's coordinate space. If the sx, sy, sw, and sh
arguments are omitted, they must default to 0, 0, the image's intrinsic
width in image pixels, and the image's intrinsic height in image pixels,
respectively.


On Tue, Jan 29, 2013 at 9:23 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 1/30/13 12:13 AM, Rik Cabanier wrote:
>
>> ah, sorry. I looked at the dictionary for hitregions
>>
>
> Sounds like we should consider fixing this hitregions thing whatever it is.
>
>          optional unrestricted double sx;
>>
>
> That's not actually valid WebIDL, with the "optional".
>
> And that's because all dictionary members in WebIDL are always optional to
> start with.
>
> So just dropping all those "optional" should do the trick.
>
> Note that this does mean that for things you really must have the prose
> needs to specify throwing if they're not present.


I would specify the same language as for drawImage:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage

Thanks for the help!

Received on Wednesday, 30 January 2013 17:59:23 UTC