As an experiment in extending existing filters, I decided to take a swing at creating a sharpen filter. It was very simple to do, and works exactly as you would expect. All I did was extend ConvolutionFilter and abstract the logic required to carry out sharpen operations with it. You can download it here to use in your own projects, or to learn from.
Using it is really easy:
import com.gskinner.filters.SharpenFilter; // sharpen amount is between 0-100. var sharpenF:SharpenFilter = new SharpenFilter(sharpenAmount); myClip.filters = [sharpenF]; // change the amount: sharpenF.amount = 50; // get the amount: trace(sharpenF.amount);
Here's a simple demo (included in the zip file):
Comments (6)
very nice. i like that you're using OS X too... could tell by the files in your zip :)
Posted by: ericd at December 9, 2005 12:40 PMURL: http://www.ericd.net
excellent. i've been creating some filters as well, but was sending either the bitmapdata or the movieclip reference onto a class with some static methods - ie :
public static function detectEdge(bmp:BitmapData, strength:Number)
... my thick head never thought of just extending an existing filter and adding it to the mc's filter list or through bitmpadata's applyFilter.
Posted by: todd anderson at December 9, 2005 01:59 PMthanks. - t
URL:
so who's going to build the first free web based photoshop killing app?
Posted by: ronenosity at December 10, 2005 12:14 PMURL:
I will translate this from English to Chinease.It is very nice!Thank you!
Posted by: zikey at December 11, 2005 07:53 PMURL: http://www.flashpixy.com
Good stuff, and for ronenosity, good idea... First web "photoshop" killer application.
F
Posted by: fandango at December 11, 2005 11:27 PMURL: http://www.fandango.cz
Thanks for the script. I used it in an app and found that adjust the image via AS after applying the filter any adjustments I make to the size and or rotation of the filtered clip slows down my flash app, has anyone run into this?
Thanks
Posted by: Grant at April 7, 2007 04:52 PMURL: