Re: Specifying mask type for <mask> elements

(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]

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.

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.

> 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.

Best regards,

Brian

[1] http://dev.w3.org/csswg/css4-images/#url-notation
[2] http://dvcs.w3.org/hg/FXTF/raw-file/tip/masking/index.html#mask-property

Received on Thursday, 27 September 2012 01:11:54 UTC