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

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 UTC