Re: [swfmill] Filter and blending mode support
Hi Folks, Just to keep you all updated, I now have a working implementation of a ColorMatrix class in C++. All I need to do now (he says, tongue in cheek) is plum this into swfmill-s somehow. I also noticed that the ColorMatrix/ element contains one two many Float/s. I'll look into that soon-ish. Cheers, Steve -- Steve Webster http://dynamicflash.com ___ swfmill mailing list swfmill@osflash.org http://osflash.org/mailman/listinfo/swfmill_osflash.org
Re: [swfmill] Filter and blending mode support
Have just checked the XML spec - and tags can't start with a number as a character, so unfortunately erix's version won't work. Also, just thinking it through - tags which vary their names (i.e. we don't know whether the first child of matrix would be 1 or 2 or 99, or whether any given element 1 would have children or not) make it harder for the XSL transform and also for creating a validating schema (if you wanted to do so). Sorry, Erix, didn't want to pick on you! Just trying to put words on why I was uncomfortable with your version... :-) Cheers, Ian On 6/8/06, Ian Thomas [EMAIL PROTECTED] wrote: 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 (I'm afraid I don't like erix's use of numbers as tag names - in fact, I'm not convinced it's legal XML...) or possibly just a string of numbers: matrix 1,2,3,4, 4,2,5,4, 1,1,3,9, 9,2,3,1 /matrix ... and leave it up to the coder how to format it - but I think this version is too error-prone (very easy to miss off a comma, for example). Cheers, Ian ___ swfmill mailing list swfmill@osflash.org http://osflash.org/mailman/listinfo/swfmill_osflash.org
Re: [swfmill] 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 [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
Re: [swfmill] Filter and blending mode support
Hi Steve, Great idea! Grant Skinner has written a pretty comprehensive AS2 ColorMatrix class which should help: http://www.gskinner.com/blog/archives/2005/09/flash_8_source.html as has Mario/Quasimondo: http://www.quasimondo.com/archives/000565.php I think that should give you all the needed info. Cheers, Ian On 6/8/06, Steve Webster [EMAIL PROTECTED] wrote: 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] / ___ swfmill mailing list swfmill@osflash.org http://osflash.org/mailman/listinfo/swfmill_osflash.org
Re: [swfmill] Filter and blending mode support
Steve, why don't keep it simple ? Since the IDE gives this representation color-matrix brightness=[-100 - 100] contrast=[-100 - 100] saturation=[-100 - 100] hue=[-100 - 100] / why not stick with that for place That's exactly what I'm going to do, thanks to Ian's links. Also, if you wanted more control you could use swfmill-ll syntax, which has the full matrix. Cheers, Steve -- Steve Webster http://dynamicflash.com ___ swfmill mailing list swfmill@osflash.org http://osflash.org/mailman/listinfo/swfmill_osflash.org
Re: [swfmill] Filter and blending mode support
Hi Ian, Great idea! Grant Skinner has written a pretty comprehensive AS2 ColorMatrix class which should help: http://www.gskinner.com/blog/archives/2005/09/flash_8_source.html as has Mario/Quasimondo: http://www.quasimondo.com/archives/000565.php I think that should give you all the needed info. Perfect - thank you very much for these. No wonder I couldn't guess my way to an implementation. It'll take a while to get this implemented. XSLT can't handle this type of calculation natively, but thankfully we can inject our own functions. I just need to familiarise myself with that part of swfmill. Thanks again! Steve -- Steve Webster http://dynamicflash.com ___ swfmill mailing list swfmill@osflash.org http://osflash.org/mailman/listinfo/swfmill_osflash.org
Re: [swfmill] Filter and blending mode support
I'll go on now to work on swfmill-simple support for this. Any/all suggestions for simple syntax for applying filters and blending modes to the place/ element are welcome at this point. Wow, there are so much combinaisons with those filters params ! What about creating a filters tag. Those could be collections of filters mode like : place hasFilter=true blend=overlay id= filters dropdownshadow param=… blur param=… /filters /place HTH. PS : did you manage to look at DefineFont3 swftag ? Best --- erixtekila http://blog.v-i-a.net/ ___ swfmill mailing list swfmill@osflash.org http://osflash.org/mailman/listinfo/swfmill_osflash.org
Re: [swfmill] Filter and blending mode support
Okay folks, I've drawn up a draft of how filter and blending mode support might look in swfmill-s syntax. http://mirror1.cvsdude.com/trac/osflash/swfmill/attachment/ticket/14/filter.swfml Please have a look and let me know what you think. Oh, and if anyone has any great ideas on how to represent a 4x4 matrix as easy to read/write xml (for the color-matrix/ filter) let me know. 'night all, Steve PS. I've yet to check some of the datatypes for existing swfmill-s compatibility. For example, if swfmill-s doesn't currently support 3 digit RGB hex values (#rgb instead of #rrggbb) then this won't be supported in the filter syntax. Having said that, anything here that swfmill-s doesn't currently support might be worthy of its own ticket. -- Steve Webster http://dynamicflash.com ___ swfmill mailing list swfmill@osflash.org http://osflash.org/mailman/listinfo/swfmill_osflash.org