|
Flash CS4 Resources |
Shader filterThe ShaderFilter class lets you use a custom filter effect defined as a Pixel Bender shader. Because the filter effect is written as a Pixel Bender shader, the effect can be completely customized. The filtered content is passed in to the shader as an image input, and the result of the shader operation becomes the filter result. Note: The Shader filter is available in ActionScript starting with
Flash Player 10 and Adobe AIR 1.5.
To apply a shader filter to an object, you first create a Shader instance representing the Pixel Bender shader that you are using. For details on the procedure for creating a Shader instance and on how to specify input image and parameter values, see Working with Pixel Bender shaders. When using a shader as a filter, there are three important things to keep in mind:
Once you have a Shader object for your shader, you create a ShaderFilter instance. This is the actual filter object that you use like any other filter. To create a ShaderFilter that uses a Shader object, call the ShaderFilter() constructor and pass the Shader object as an argument, as shown in this listing: var myFilter:ShaderFilter = new ShaderFilter(myShader); For a complete example of using a shader filter, see Using a shader as a filter. |