HiSlope
Download or fork HiSlope from Github
Then make sure you read the WIKI
Proper docs and more examples soon to follow. Stay patient :)
Hello world
import hislope.core.FilterChain;
import hislope.display.MetaBitmapData;
import hislope.filters.inputs.WebCam;
import hislope.filters.basic.Blur;
import hislope.filters.color.HSBC;
import flash.events.Event;
import hislope.events.HiSlopeEvent;
import hislope.gui.Output;
// create chain of filters and specify size
var filterChain:FilterChain = new FilterChain("hello world", 640, 480);
addChild(filterChain);
// create MetaBitmapData
var processedBmpData:MetaBitmapData = new MetaBitmapData();
// create and position output window
var output:Output = new Output(processedBmpData, "output");
addChild(output);
output.x = filterChain.width + 10;
output.scale = 1.0;
// initialize input
var input:WebCam = new WebCam();
input.addEventListener(HiSlopeEvent.INPUT_RENDERED, render);
// add example filters to the filter chain
filterChain.addFilter(input, true);
filterChain.addFilter(new HSBC(), true);
filterChain.addFilter(new Blur(), true);
// when input is rendered process filter chain
function render(event:Event):void
{
filterChain.process(processedBmpData);
}
Filter template
package
{
// IMPORTS ////////////////////////////////////////////////////////////////////////////////
import hislope.display.MetaBitmapData;
import hislope.filters.FilterBase;
// CLASS //////////////////////////////////////////////////////////////////////////////////
public class FilterName extends FilterBase
{
// CONSTANTS //////////////////////////////////////////////////////////////////////////
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 bitmaps, 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;
getPreviewFor(metaBmpData);
}
override public function updateParams():void
{
// update parameters if changed
}
// PRIVATE METHODS ////////////////////////////////////////////////////////////////////
}
}
