将显示对象变成黑白

//显示对象变成彩色
private function applyGrayToColour(child:DisplayObject):void {
var matrix:Array = [];
matrix = matrix.concat([1,0,0, 0, 0]); // red
matrix = matrix.concat([0,1,0, 0, 0]); // green
matrix = matrix.concat([0,0,1, 0, 0]); // blue
matrix = matrix.concat([0, 0, 0, 1, 0]); // alpha
applyFilter(child, matrix);
}

//显示对象变成黑白
private function applyGray(child:DisplayObject):void {
var matrix:Array = [];
matrix = matrix.concat([0.3086, 0.6094, 0.0820, 0, 0]); // red
matrix = matrix.concat([0.3086, 0.6094,0.0820, 0, 0]); // green
matrix = matrix.concat([0.3086, 0.6094, 0.0820, 0, 0]); // blue
matrix = matrix.concat([0, 0, 0, 0.8, 0]); // alpha
applyFilter(child, matrix);
}

posted @ 2014-03-07 16:56  actionkong  阅读(152)  评论(0编辑  收藏  举报