-
Notifications
You must be signed in to change notification settings - Fork 16
1.3. Filter
og2t edited this page Sep 9, 2011
·
3 revisions
Writing your own HiSlope Filters is simple as pie. Each Filter extends FilterBase
class which handles all the necessary processing, generates previews and histograms. It also gets access to the Filter Panel UI (if enabled) which allows you to update UI elements in case your Filter Parameters change dynamically from within the Filter.
All you have to do is to use the template below and fill the blanks.
package hislope.filters // filter path
{
// IMPORTS ////////////////////////////////////////////////////////////////////////////////
import hislope.display.MetaBitmapData;
import hislope.filters.FilterBase;
// CLASS //////////////////////////////////////////////////////////////////////////////////
public class FilterName extends FilterBase
{
// CONSTANTS //////////////////////////////////////////////////////////////////////////
public static const INFO:String = "Filter Info / comments";
private static const NAME:String = "Filter Name";
private static const PARAMETERS:Array = [
{
name: "param1",
label: "param 1",
current: 0.1,
min: 0,
max: 1,
type: "number"
}, {
name: "param2",
label: "param 2",
current: 1,
min: 0,
max: 255,
type: "int"
}
];
private static const DEBUG_VARS:Array = [
"time",
"frames"
];
// MEMBERS ////////////////////////////////////////////////////////////////////////////
public var time:Number;
public var frames:Number;
// PARAMETERS /////////////////////////////////////////////////////////////////////////
public var param1:Number;
public var param2:int;
// CONSTRUCTOR ////////////////////////////////////////////////////////////////////////
public function FilterName(OVERRIDEN:Object = null)
{
// init your additional bitmapDatas, variables, etc. here
time = 0;
frames = 0;
init(NAME, PARAMETERS, OVERRIDEN, DEBUG_VARS);
}
// PUBLIC METHODS /////////////////////////////////////////////////////////////////////
override public function process(metaBmpData:MetaBitmapData):void
{
// do operations
time += param1;
frames += param2;
postPreview(metaBmpData);
}
override public function updateParams():void
{
// update parameters if changed
super.updateParams();
}
// PRIVATE METHODS ////////////////////////////////////////////////////////////////////
}
}
##Cloning MetaBitmapData
TBC