W3C home > Mailing lists > Public > public-fx@w3.org > July to September 2012

Re: Specifying mask type for <mask> elements

From: Dirk Schulze <dschulze@adobe.com>
Date: Wed, 26 Sep 2012 19:41:37 -0700
To: Brian Birtles <bbirtles@mozilla.com>
CC: "public-fx@w3.org" <public-fx@w3.org>
Message-ID: <EF6B8D57-12A5-4936-A38D-C96D726351C4@adobe.com>
Hi Brian,

On Sep 26, 2012, at 6:11 PM, Brian Birtles <bbirtles@mozilla.com> wrote:

> (2012/09/27 1:03), Dirk Schulze wrote:
>> Hi,
>> I thought about adding the optional keywords 'alpha','luminance' to a <mask> reference again. It is not possible to differ between an image reference and a mask reference at parse time. As an example:
>> mask: url(test.svg#fragment) alpha;
>> The parser realizes that the reference is a valid URL. But the fragment can either point to a resource (mask, clipPath, linearGradient, radialGradient, pattern) or graphical element (rect, circle, path,). The document might not reachable at all.>
> I was under the impression that CSS Images didn't referring to, e.g. 
> "url(test.svg#rectElem)"? You should use element() for that. The text in 
> CSS4 Images simply talks about the url() syntax referring to an image 
> file, not a fragment.[1]
CSS4 Images just forgets one very important use case that is not covered by media fragments as well: SVG stacks [1]. Mozilla and Opera support them. I would like to see them in WebKit as well, but didn't have time to look at this. CSS Images is a bit behind real world :) (not really since it belongs to SVG). A SVG stack would be treated as CSS Image by the way.

> Hence, the note (Issue 4 currently) in the masking spec.[2]
> We had implementation feedback that said that if you have to look up the 
> fragment and determine what type of element it was before deciding if 
> you can use normal CSS image processing or not that would be difficult 
> and not performant. So we wanted a way to determine at parse time how to 
> treat the resource.
Not how to treat the resource! It is not possible to know which kind of resource you have, unless you downloaded and parsed it. This is not done in the parsing step, but afterwards. Therefore we need to make sure that the syntax is independent of the actual resource type. That is why I would like to have the same syntax on '<mask>' resources as for <mask-image> types.

> The current proposal is that if you have url() and a '#' then you abort 
> CSS image processing and treat it as a <mask> or whatever. Otherwise you 
> can just treat it as a CSS image.
That wouldn't even be possible with CSS images, which accepts media fragments (e.g #xywh=).

>> But while the above syntax would be correct for a reference to a graphical element, it is incorrect if it references a mask resource.
>> I suggest adding these keywords again to be consistent with the behavior of parsers.
>> The problem is, that it still does not make sense for most <mask> elements to let the masked object decide about the 'mask-type'. A mask mostly just good for one think: luminance or alpha masking. We could ignore the keywords in the case of a <mask> reference.
> It's not impossible to have a mask that is useful in both ways (e.g. a 
> circle with a radial gradient applied), but yes, definitely rare.

> I'm ok with adding the keywords back, but I don't think we should ignore 
> them.
Ok, so we add 'auto' to the mask-type property, but keep 'luminance' as default?


[1] http://simurai.com/post/20251013889/svg-stacks
Received on Thursday, 27 September 2012 02:42:05 UTC

This archive was generated by hypermail 2.3.1 : Monday, 22 June 2015 03:33:48 UTC