Re: [csswg-drafts] [filter-effects-2] Allow masking of filters (#13288)

> > You can reach any value, it's just about how we define the behavior. For example, we could define that the slope for some filters for values < 100% is negative.
>
> Can you expand on this? E.g. imagine a filter of brightness(200%) and you want to apply a mask that goes from 0 to 1, i.e. a brightness value between 0% and 200%. How would that look like?

Right, you can't do 0% to 200%, but then that's not what you ask for when you do `filter: brightness(0%)`. What you ask is to darken the image, so I'd expect applying a mask on that would be from noop to 0%.

Also, with that logic, if you have something like:

```css
.filtered {
  filter-mask: linear-gradient(transparent, black);
}
```

And
```css
.filtered {
  filter: brightness(100%);
  filter-mask: linear-gradient(transparent, black);
}
```

You'd get 2 different results, which IMO is highly unexpected.

> We could also define additional parameters defining the range of the multiplier the mask should cover. So something like
> ```
> mask() = mask( <mask-reference># <integer>{2}? )
> ```
> where the first <integer> defines the lower bound and the second the upper bound of multiplier. So a fully transparent pixel in the mask corresponds to the lower bound and a fully opaque pixel the upper bound.

That's possible.
The way I imagined it was using the lerp function as: 

```
F = a * (1 - t) + b * t
```

Where:
-  `F`: result for each pixel
- `a`: noop value for the filter
- `b`: specified value for the filter
- `t`: the value of the mask in each filter

If we allow to set `a` to something else we can also achieve something like `0%` to `200%`.

-- 
GitHub Notification of comment by ydaniv
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13288#issuecomment-3909877931 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 16 February 2026 18:11:42 UTC