W3C home > Mailing lists > Public > public-fx@w3.org > January to March 2012

Re: Brightness filter in CSS Filters spec is wrong?

From: Rik Cabanier <cabanier@gmail.com>
Date: Tue, 24 Jan 2012 11:05:33 -0800
Message-ID: <CAGN7qDCJM2-2ooqfe5SAHS8vzMne9o32d2G7pJvbTF-q3krQ1A@mail.gmail.com>
To: Chris Marrin <cmarrin@apple.com>, public-fx@w3.org
Not sure I follow.
so instead of brightness:

-1 < brightness < 0 -> color.rgb * (1-brightness)
0 < brightness < 1 -> color.rgb * (1-brightness) + vec3(brightness)


it would be:

-1 < darken < 1 -> color.rgb * (1-darken)
-1 < lighten < 1 -> color.rgb + vec3(lighten)


Rik

On Tue, Jan 24, 2012 at 10:26 AM, Chris Marrin <cmarrin@apple.com> wrote:
>
> On Sat, Jan 21, 2012 at 4:37 PM, Rik Cabanier <cabanier@gmail.com> wrote:
>
>> Hi Chris,
>>
>> I agree that the current definition looks incorrect.
>> To give you one more option, Flash also provides a brightness filter that
>> uses a colormatrix. It seems to provide what you're looking for since it
>> will darken and brighten the result.
>>
>> For brightness settings that are negative (= darken), the formula is:
>>
>> color.rgb * (1-brightness)
>>
>> So, for rgb of (0, 255, 64) and brightness of -25%, the end result is (0,
>> 191, 48)
>>
>> For positive brightness (= lighten), the formula is:
>>
>> color.rgb * (1-brightness) + vec3(brightness)
>>
>> So, for rgb of (0, 255, 64) and brightness of 25%, the end result is (64,
>> 255, 112)
>>
>
> I know that many image editors (including Preview and iPhoto) have
> replaced brightness adjustments with separate lighten and darken filters.
> We could add those, but I think brightness as an additive effect is still
> useful. In its current incarnation, as a pure multiplication, it's not very
> useful. I won't comment on whether lighten/darken or brightness are more
> useful. But if you do the former, you need to have both to be able to have
> sufficient control.
>
>
Received on Tuesday, 24 January 2012 19:06:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 24 January 2012 19:06:10 GMT