I haven't been in the forum much during the last week; sorry for that! But it has been for a good reason: I wanted to finally tackle the next major feature: filters!
And now, the time has come for you to play around with what I came up with!
Just pull the latest Starling head revision, and you'll find a new property on display objects: "filter". You can assign any of the provided sample-filters (in the "starling.filters" package.
Here is what is currently available:
- "IdentityFilter" - does nothing, actually, but is a good way to learn how to write your own filter
- "InverseFilter" - inverts the colors
- "GrayscaleFilter" - convertes object to B/W
- "ColorMatrixFilter" - works just like the one from Flash
- "BlurFilter" - works just like the one from Flash
To create drop shadows, call "BlurFilter.createDropShadow()"; to create a glow, call "BlurFilter.createGlow()".
The nice thing about their architecture is that is *extremely* easy to create your own filters. In essence, I think it's a perfect playground to learn AGAL! Just have a look at the "IdentityFilter" and "InverseFilter" classes, and you will see how to build your own: you just have to override two methods.
Beware that there is one problem with the Blur Filter at the moment: you will need to run Starling in "baseline" mode (Starling 1.2 defaults to "baselineConstrained"). It *did* work with the previous AIR Beta, though. And from what I understand, my code *should* work in that mode. I'll investigate this further. But in the meantime, just make your tests in "baseline" mode.
In the future, there will also be a way to combine several filters. (E.g. have an object blurred and B/W.) Stay tuned! =)
Concerning performance: the filters are really fast, BUT they always impose additional draw calls of course; and they need additional texture memory. Thus, at least on mobile devices, you should use them with care. On Desktop computers, though, there is absolutely no reason to be shy with them.
UPDATE: I've made a small demo image: