W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2013

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

From: Rik Cabanier <cabanier@gmail.com>
Date: Tue, 29 Jan 2013 21:37:12 -0800
Message-ID: <CAGN7qDAdkRTH0x7uQMrD5+dRR6HimboQTOFux9hg28mryRW5cw@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: WHATWG <whatwg@lists.whatwg.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
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@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 05:37:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:12 GMT