BitmapData.draw seems to ignore Matrix.transform in HTML5 (OpenFL 3.1.3)

With OpenFL Command-Line Tools (3.1.3-LO0LwQ) (just ran update this morning, some of my projects no longer draw things where they used to, and draw things in different places on HTML5 vs Flash)

I modified one of the examples from openfl-samples-master to draw text on a BitmapData using a matrix. If you compile in flash vs HTML5, you’ll see the font in different places - seems to be setting position to 0,0 in HTML5?

flash (I’m drawing to -100,something)

html5 (seems to draw at 0,0)

here’s the project:

here’s the relevant code


import openfl.display.Sprite;
import openfl.text.Font;
import openfl.text.TextField;
import openfl.text.TextFormat;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Matrix;

class Main extends Sprite {
    public function new () {
        super ();
        var format = new TextFormat ("Katamotz Ikasi", 30, 0x7A0026);
        var textField = new TextField ();
        textField.defaultTextFormat = format;
        textField.embedFonts = true;
        textField.selectable = false;
        textField.x = 200;
        textField.y = 50;
        textField.width = 200;
        textField.text = "Hello World";
        //addChild (textField);

        var myBitmapData:BitmapData = new BitmapData(800, 200);

        var m:Matrix = new Matrix();
        var bmp:Bitmap = new Bitmap(myBitmapData);


tracing the matrix coords, it says

[Log] Main.hx:39: matrix(1, 0, 0, 1, -100, 100) (AddingText.js, line 2443)

so there’s probably something funky maybe happening elsewhere

Thank you!

This was caused by a regression with scrollRect changes in OpenFL 3.1.2, I spotted the problem, and it appears to be working fine again in the development builds, will go out in the next release :slight_smile:

1 Like