円形のColorTransform
-
22-09-2019 - |
質問
は円ではなく、矩形でのBitmapDataへのColorTransformを適用する方法はありますか?
の代わりに以下のコードのようにアルファチャネルを減少させることによって、画像の矩形部分を消去する、私は円でそれを実行したいと思います。
_bitmap.colorTransform(new Rectangle(mouseX-d/2, mouseY-d/2, d, d),
new ColorTransform(1, 1, 1, .5, 0, 0, 0, 1));
はI画素をループいくつかのコードを持っている、アルファ値及び用途を抽出するとsetPixelが、それはかなり遅いのColorTransform関数よりシーム。
解決
描画API(flash.display.Graphics)を使用して円を作成し、BlendMode.ERASEとビットマップデータ上にあることを描いてみてください。私はそれを正しく理解していればそれは、あなたの問題を解決する可能性があります。
var circle : Shape = new Shape;
circle.graphics.beginFill(0xffcc00, 1);
circle.graphics.drawEllipse(-50, -50, 100, 100);
// Create a transformation matrix for the draw() operation, with
// a translation matching the mouse position.
var mtx : Matrix = new Matrix();
mtx.translate(mouseX, mouseY);
// Draw circle at mouse position with the ERASE blend mode, to
// set affected pixels to alpha=0.
myBitmap.draw(circle, mtx, null, BlendMode.ERASE);
私は確信してERASEブレンドモードはドロー()コマンドを使用して満足のいく動作することは100%ないんだけど、なぜそれがいけない私が見ることができません。私はそれがうまくいく方法を教えてください!
所属していません StackOverflow