Вопрос

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