logo       

Re: Filter and blending mode support: msg#00029

Subject: Re: Filter and blending mode support
Hi All,

> <matrix>
>  <row values="1,2,3,4"/>
>  <row values="4,2,5,4"/>
>  <row values="1,1,3,9"/>
>  <row values="9,2,3,1"/>
> </matrix>

Actually the IDE exposes the colour matrix filter as brightness,
contrast, saturation and hue sliders from -100 to 100. So, what I'm
thinking is do away with the matrix and just have:

<color-matrix brightness="[-100 - 100]" contrast="[-100 - 100]"
saturation="[-100 - 100]" hue="[-100 - 100]" />

However, I need to work out a way to translate those values into a
matrix. So far I've been reverse engineering a couple of IDE-generated
examples, but I can't work out how they get from the BCSH values to
the matrix.

I can tell you that with all the values at 0, we get an identity matrix:

1, 0, 0, 0, 0
0, 1, 0, 0, 0
0, 0, 1, 0, 0
0, 0, 0, 1, 0

Note that there is a final row to this matrix (so it's 5x5) which is always:

0, 0, 0, 0, 1

...and is NOT stored in the SWF because it never changes. This
completes the identity matrix.

The product of this matrix and RBGA value for each pixel to which the
filter is applied is the resultant value for each component of the
rendered pixel.

[R']      [1, 0, 0, 0, 0] [R]
[G']      [0, 1, 0, 0, 0] [G]
[B']  =  [0, 0, 1, 0, 0] [B]
[A']      [0, 0, 0, 1, 0] [A]
[1']       [0, 0, 0, 0, 1] [1]

So the RGBA values stay the same.

Here are some of the other values I've reverse engineered thus far:

B0 C0 S0 H0

1, 0, 0, 0, 0
0, 1, 0, 0, 0
0, 0, 1, 0, 0
0, 0, 0, 1, 0


B100 C0 S0 H0

1, 0, 0, 0, 100
0, 1, 0, 0, 100
0, 0, 1, 0, 100
0, 0, 0, 1, 0


B0 C100 S0 H0

11, 0, 0, 0, -635
0, 11, 0, 0, -635
0, 0, 11, 0, -635
0, 0, 0, 11, 0


B0 C50 S0 H0

2, 0, 0, 0, -63.5
0, 2, 0, 0, -63.5
0, 0, 2, 0, -63.5
0, 0, 0, 1, 0


B0 C-100 S0 H0

0, 0, 0, 0, 63.5
0, 0, 0, 0, 63.5
0, 0, 0, 0, 63.5
0, 0, 0, 1, 0


B0 C-50 S0 H0

0.5, 0, 0, 0, 31.75
0, 0.5, 0, 0, 31.75
0, 0, 0.5, 0, 31.75
0, 0, 0, 1, 0


If there's a standard algorithm for doing this that someone knows
(anyone want to contact Keith@Bit-101 - this is right up his street)
then please feel free to enlighten me.

Cheers,

Steve

-- 
Steve Webster
http://dynamicflash.com


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe