Bitmap cannot be used as a mask in html5

This https://github.com/openfl/openfl/issues/1406 was marked as “Moved to “Recently Completed””.
This https://github.com/openfl/openfl/pull/1709 was marked as “Closed”.

However, a simple test of using a bitmap as a mask in html5 (openfl 8.9.6) shows nothing on the page. You can mask a bitmap with a shape, but not a shape with a bitmap.

class SimpleTestMask extends Sprite {

public function new() {
        super();

        var container:Sprite = new Sprite();
        this.addChild(container);

        var sh:Shape = new Shape();
        sh.graphics.beginFill(0xFF0000);
        sh.graphics.drawCircle(0, 0, 200);
        sh.graphics.endFill();

        var bmd:BitmapData = new Match02(0, 0);
        var bmp:Bitmap = new Bitmap(bmd);
        container.addChild(bmp);
        //container.mask = sh; // This works - bitmap is masked by shape
        container.mask = bmp; // This does not - cannot use bitmaps as masks???
    }

}

@:bitmap("../src/com/masque/samples/simple/Match02.png")
class Match02 extends BitmapData { }

FWIW - I tried both canvas and webgl compiles

1 Like