W3C home > Mailing lists > Public > www-style@w3.org > March 2014

Re: [css-masking] multiple mask layers and mask-composite

From: Dirk Schulze <dschulze@adobe.com>
Date: Wed, 5 Mar 2014 11:15:51 +0000
To: fantasai <fantasai.lists@inkedblade.net>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <3D06B183-5586-4C6A-A13A-DEFAD4D45757@adobe.com>

On Mar 5, 2014, at 9:36 AM, fantasai <fantasai.lists@inkedblade.net> wrote:

> On 03/04/2014 12:54 AM, Dirk Schulze wrote:
>> Hi all,
>> 
>> We removed multiple mask layers from the CSS Masking spec[1]. We could not
>> reach consensus on how to composite the different mask layers. [...]
>> 
>> I would like to propose adding layered masks back to level 1 [by] adding
>> a new mask longhand property: mask-composite.
>> 
>> Name: mask-composite
>> Value: <composite-operator>#
>> 
>> <composite-operator> = clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor
> 
> I think this is an interesting idea worth exploring, and wouldn't mind
> exploring it for L1.
> 
> Are there ways to make these values (or at least, the commonly-used ones)
> more obvious? Not being a graphics person, I can't tell at all what they
> mean.

The terms are well known from HTML canvas and the keywords are the same.

I agree that people who are new to this topic will need some guidance. I suggest to add two examples of the most common composite operators to give authors a hint which operator they may want to use. If they are interested, they can get deeper into the topic.

> 
> I vaguely remember the problem being something about choosing between
>  - each layer acts individually as a mask over all the layers+content
>    before it
> vs.
>  - composite all the mask images, then use that as a mask
> and then the possibility of grouping certain combinations of images
> rather than all or none. Does your proposal address that in a reasonable
> way?

I believe so. Not only that, it provides much more control over the content, many people familiar with globalCompositeOperators from HTML canvas will appreciate having the same capabilities.

The two modes you mention can be archived with source-over (draw layers on top of each other and mask together) and destination-in (mask each layer with the the next layer and then mask content with the result).

I agree that we should make it more visible for authors that source-over and destination-in are probably more in their interest. The demo that I referenced also used XOR, which is not uncommon in graphic tools as well.

Greetings,
Dirk

> 
> ~fantasai
> 
Received on Wednesday, 5 March 2014 11:16:24 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 March 2014 11:16:25 UTC