黑白图片滤镜
public static function grayFilter(param1:BitmapData):BitmapData
{
sourceBitmap = new Bitmap(param1);
sourceBitmap.filters = [getGrayFilter()];
returnBitmapData = new BitmapData(sourceBitmap.width, sourceBitmap.height, true, 16777215);
returnBitmapData.draw(sourceBitmap);
return returnBitmapData;
}// end function
Brightness -- 调25这个位置
_loc_1 = [0.3, 0.59, 0.11, 0, 25,
0.3, 0.59, 0.11, 0, 25,
0.3, 0.59, 0.11, 0, 25,
0, 0, 0, 1, 0];
private static function getGrayFilter():*
{
var _loc_1:Array = null;
var _loc_2:ColorMatrixFilter = null;
///*
_loc_1 = [0.3, 0.59, 0.11, 0, 0,
0.3, 0.59, 0.11, 0, 0,
0.3, 0.59, 0.11, 0, 0,
0, 0, 0, 1, 0];
//*/
_loc_2 = new ColorMatrixFilter(_loc_1);
return _loc_2;
}// end function
private static function cleanValue(param1:Number, param2:Number) : Number
{
return Math.min(param2, Math.max(-param2, param1));
}// end function
var bmpData_input:BitmapData = new BitmapData(
Screen.width,
Screen.height,
true,
4294967295);
bmpData_input.draw(Screen);
var bmpData_output:BitmapData = Filters.grayFilter(bmpData_input);
var filters_bmp:Bitmap = new Bitmap(bmpData_output);