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:13:35 -0800
Message-ID: <CAGN7qDDRPnwy+qv4F9cZ=r_9beh6GezLiopXmM2f-qygmJ_C9Q@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: WHATWG <whatwg@lists.whatwg.org>, Boris Zbarsky <bzbarsky@mit.edu>
ah, sorry. I looked at the dictionary for hitregions and assumed that's how
you make something optional in a dict [1]

Second try:

enum CanvasMaskType { luminosity, alpha};
dictionary maskOptions {

CanvasImageSource image;
optional unrestricted double sx;
optional unrestricted double sy;
optional unrestricted double sw;
optional unrestricted double sh;
unrestricted double dx;
unrestricted double dy;
optional unrestricted double dw;
optional unrestricted double dh;
optional CanvasMaskType maskType = "luminosity";
optional boolean invert = false;
optional boolean clipToMask = 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.


1:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#hitregionoptions

On Tue, Jan 29, 2013 at 9:07 PM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> On Tue, Jan 29, 2013 at 9:04 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> > On 1/29/13 11:37 PM, Rik Cabanier wrote:
> >>
> >> So the API could be as follows:
> >
> > ...
> >
> >> unrestricted double? sx;
> >> unrestricted double? sy;
> >
> >
> > Do these actually need to be nullable?  What's the use case for setting
> them
> > to null?
> >
> > Same thing for the rest of this dictionary's members.
>
> Hah, right, I overlooked that.  They don't need to be *nullable*, just
> *optional*.
>
> ~TJ
>
Received on Wednesday, 30 January 2013 05:13:58 GMT

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