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 [EMAIL PROTECTED] - this is right up his street)
then please feel free to enlighten me.

Cheers,

Steve

-- 
Steve Webster
http://dynamicflash.com

_______________________________________________
swfmill mailing list
swfmill@osflash.org
http://osflash.org/mailman/listinfo/swfmill_osflash.org

Reply via email to