Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 作为3 BitmapData阈值,测试失败的像素会发生什么情况?如何移除它们?_Actionscript 3_Pixels_Bitmapdata_Threshold - Fatal编程技术网

Actionscript 3 作为3 BitmapData阈值,测试失败的像素会发生什么情况?如何移除它们?

Actionscript 3 作为3 BitmapData阈值,测试失败的像素会发生什么情况?如何移除它们?,actionscript-3,pixels,bitmapdata,threshold,Actionscript 3,Pixels,Bitmapdata,Threshold,当我使用bitmapdata阈值时,阈值测试失败的像素会发生什么情况? 根据我的观察,它们仍然与中相同,因此有没有办法删除它们?最好的方法是使用临时(静态、可重用)透明位图数据进行此操作。用0x0填充,然后调用threshold()将源设置为位图数据,并将copySource标志设置为false,然后将copyPixels()设置为false返回 var tbd:BitmapData=yourBitmapData.clone(); // this makes a new BitmapData,

当我使用bitmapdata阈值时,阈值测试失败的像素会发生什么情况?
根据我的观察,它们仍然与中相同,因此有没有办法删除它们?

最好的方法是使用临时(静态、可重用)透明位图数据进行此操作。用0x0填充,然后调用
threshold()
将源设置为位图数据,并将
copySource
标志设置为false,然后将
copyPixels()
设置为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();

使用替换颜色0x00000000(即:零alpha)@LeeBurrows执行另一个阈值如果阈值颜色在阈值范围内,这将起作用,即调用相同的阈值不会进一步改变位图。但传递到
BitmapData.threshold()
的颜色可能会自然超出阈值,因此这种方法将使整个位图无效。@Vesper。Netrus可以在第二个阈值上反转条件,以影响其他像素集。ie:如果第一个阈值使用“>”,那么第二个阈值使用“@LeeBurrows是的,但这还不够。假设您有一个由两种颜色组成的位图,0x305070ff和0xaaaaaa。您希望alpha大于0x80的阈值变成0x55ff0000。因此,您调用
threshold()
并且有一个两种颜色的位图数据,0x305070ff和0x55ff0000。现在你想将所有其他像素置零,用反向操作调用阈值,然后BAM,所有位图数据现在都由零组成!这不是你通常想要的,对吧?thnx伙计们!D bt制作一个临时位图,用于复制通过测试工作的阈值他为我辩护。。