Imagine that you want to record video with filter you made but stream class doesn't publish video but camera and camera class doesn't have filter option. What wou开发者_如何转开发ld you do?
To do that, the idea would be to write the video feed in a bitmapData and then apply the filter to the bitmapData
Try this code:
// get the cam
var video:Video;
var camera:Camera=Camera.getCamera();
video=new Video(320,240);
video.attachCamera(camera);
// create the bitmap
var bmpD:BitmapData=new BitmapData(video.width,video.height);
bmpD.draw(video);
var bm:Bitmap=new Bitmap(bmpD);
addChild(bm);
// apply the filter
var bf:BlurFilter = new BlurFilter(4, 4, 3);
bm.filters = [bf];
精彩评论