[whatwg] proposal: Add support for masking to canvas
Rik Cabanier
cabanier at gmail.com
Tue Jan 29 21:37:12 PST 2013
I want to get it right! :-)
After looking at the CG API, maybe imageSmoothing could be a part of the
mask too.
Third try:
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(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 at 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!
More information about the whatwg
mailing list