문제

When i use bitmapdata threshold, what happens to the pixels that fail the threshold test? As per my observation they remain as in, so is there any way to remove them?

도움이 되었습니까?

해결책

The best way would be to use a temporary (static, reusable) transparent BitmapData for this operation. You fill it with 0x0, then call threshold() setting source to your BitmapData, and copySource flag set to false, then you copyPixels() back with mergeAlpha set to false.

var tbd:BitmapData=yourBitmapData.clone(); // this makes a new BitmapData, so be warned
var p0:Point=new Point();
tbd.fillRect(tbd.rect,0);
tbd.threshold(yourBitmapData,yourBitmapData.rect,p0,yourOperation,
    yourThreshold,yourColor,yourMask,false);
yourBitmapData.copyPixels(tbd,tbd.rect,p0);
tbd.dispose();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top