Source Code: SharpenFilter for Flash 8

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):

Grant Skinner

The "g" in gskinner. Also the "skinner".

@gskinner

6 Comments

  1. very nice. i like that you’re using OS X too… could tell by the files in your zip 🙂

  2. 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.

    thanks. – t

  3. so who’s going to build the first free web based photoshop killing app?

  4. I will translate this from English to Chinease.It is very nice!Thank you!

  5. Good stuff, and for ronenosity, good idea… First web “photoshop” killer application.

    F

  6. 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

Leave a Reply

Your email address will not be published. Required fields are marked *