htmlflashhaxeblendingopenfl

[OpenFL][HTML5 Target] BlendMode not working


I'm adding a Sprite with a bitmap inside to the stage, than i change blendMode to SCREEN. Nothing happens on HTML5 targets while on flash everything works fine... OPENFL Wiki says "Available on all platforms" (link)

Am I doing something wrong?

Here is the code im using:

var sp:Sprite = new Sprite();
sp.graphics.beginFill(0xff0000, 1);
sp.graphics.drawCircle(200, 200, 100);
sp.graphics.endFill();
addChild(sp);

var bmd:BitmapData = Assets.getBitmapData("img/1.jpg");
var b:Bitmap = new Bitmap(bmd);
b.blendMode = BlendMode.SCREEN;

addChild(b);

Imporets are:

import openfl.Assets;
import openfl.display.BitmapData;
import openfl.display.Bitmap;
import openfl.display.BlendMode;
import openfl.display.Sprite;

Flash Target:

Flash export print screen

HTML5 Target:

HTML5 export print screen


Solution

  • As far as I know, HTML5 canvas doesn't have BlendMode support, HTML5 webGL does. Try compiling it with lime test html5 -Dwebgl

    image