Possible SVG and colorTransform workaround idea

The previous post is referring to your sample code, that is, new project, paste your sample code, and it only renders the square in the flash target, the others (windows, neko and html5) only shows a black stage with no errors and crashes. I’ve tried build and run from inside haxedevelop and using openfl command line.

I don’t know if I can upload the svg file that I use, but I could try, but perhaps my problem is regardless the svg asset that I load, because I can´t even make your sample work…

I’ll problably have to reinstall everything, don’t I?

No, it is me that have to thank you, big time! :smiley:

Here is the svg that I use for my own tests, but I think my problem lies elsewhere…
https://we.tl/0l8YXCyhNR

Thanks for the file :slight_smile:

I discovered a rendering discrepancy with this file, which should be fixed in the development version of OpenFL now

package;


import format.SVG;
import openfl.Assets;
import openfl.display.Shape;
import openfl.display.Sprite;


class Main extends Sprite {
	
	
	public function new () {
		
		super ();
		
		var shape = new Shape ();
		//shape.graphics.beginFill (0xFF0000);
		//shape.graphics.drawRect (0, 0, 100, 100);
		
		var svg = new SVG (Assets.getText ("assets/svg_test_asset.svg"));
		svg.render (shape.graphics);
		
		addChild (shape);
		
		var graphicsData = shape.graphics.readGraphicsData ();
		
		var shape2 = new Shape ();
		//shape2.graphics.copyFrom (shape.graphics);
		shape2.graphics.drawGraphicsData (graphicsData);
		shape2.y = 200;
		addChild (shape2);
		
	}
	
	
}

If Windows and Neko are not working properly for you, can you try openfl test neko -Dcairo or openfl test html5 -Dcanvas, in case it is an OpenGL issue on your system?

Thanks

Cool, at least my doubts lead to a bug fix!

But in my case I still can’t render your red square code sample in neko/windows/html, what I’ve tried since my last post:

  • Reinstall haxe and openfl (haxe 3.4.2 / openfl 5.0.0 / lime 4.1.0);
  • Tried straight away openfl test neko -Dcairo - didn’t show the red square;
  • Tried openfl test html5 -Dcanvas- no red square;
  • Tried openfl test neko, openfl test windows, openfl test html5 - still no red square;
  • Tried openfl test flash - showed the red square, no issues here.

I can’t figure out what is happennig in my end, I think the only thing I’ve not tried yet is build and run on other machine. I don’t know if anyone else that is reading this, could try the following sample, with the latest OpenFL, and test the neko/windows/html5 targets and see if the red square appears normally:

package;


import openfl.display.Shape;
import openfl.display.Sprite;


class Main extends Sprite {
	
	
	public function new () {
		
		super ();
		
		var shape = new Shape ();
		shape.graphics.beginFill (0xFF0000);
		shape.graphics.drawRect (0, 0, 100, 100);
		
		var graphicsData = shape.graphics.readGraphicsData ();
		
		var shape2 = new Shape ();
		shape2.graphics.drawGraphicsData (graphicsData);
		addChild (shape2);
		
	}
	
		
}

Something is definitely wrong, I’ve tested in other machine, made a clean install of haxe and openfl (and haxe never was installed there before). Copied only the sample project without the bin folder. So new builds from scratch for all the targets, and the red square only appears in flash target, regardless I use -Dcairo in neko.

I don’t what is happening, but I starting to think that the problem couldn’t be only in my end. @singmajesty, could you please give me some advices in how I could sort this out?

And please, could other good soul try the previous sample code and see if the red square appears in other target besides flash?

I tested it in Haxe 3.4.0/OpenFL 5.0.0/Lime 4.1.0.

The red square shows up in Flash, but not CPP, Neko, or html5. Adding -Dcairo has no effect.

Thanks for testing it, I thought I was going nuts, and that I always did something wrong…

@singmajesty what could it be?

Could you test it in 5.1?

Well, I’ve updated to openfl 5.1.1/lime 5.0.0 and when I do openfl test "any target", it gives me a error:

Error: Could not find haxelib "lime" version "5.0.*", does it need to be installed?

I don’t know if it’s a haxe newbie mistake, but what I’ve done so far:

  • hashlib update (and it updated to versions openfl 5.1.1/lime 5.0.0);
  • hashlib list (to confirm if the last version is set - confirmed);
  • openfl (to be absolutely sure that its the 5.1.1 in play - shows OpenFL Command-Line Tools (5.1.1-LC7mPS))
  • lime (shows Lime Command-Line Tools (5.0.0)).

So, am I doing something wrong? or this is not the correct way of updating OpenFL?

The “wildcard” versioning is a new feature in Lime 5, I’m sorry this isn’t working on your system :frowning:

What OS are you running? How was Haxe installed (official installer, package manager, manual, etc)?

What do haxelib path openfl or haxelib path lime return?

Thank you

Windows 10 Pro

Haxe installed with the official installer (v3.4.2). OpenFL installed using haxelib, then did the setup (as instructed in the openfl.org download page), and lastly made an update by haxelib when you instructed me to do so.

returns:
--macro openfl._internal.utils.ExtraParams.include() C:\HaxeToolkit\haxe\lib\openfl/5,1,1/ -D openfl=5.1.1

returns:
--macro lime.Lib.extraParams() C:\HaxeToolkit\haxe\lib\lime/5,0,0/ -D lime=5.0.0
To update OpenFL, we can use the haxelib update, right? or do we have to remove everything, and install again Haxe, fetch Openfl with haxelib and run the setup?

Could you please try updating to OpenFL 5.1.1 and Lime 5.0.1 (Lime was just updated) and see if that resolves the issue you had? :slight_smile:

Unfortunately, after updating (and I confirm that lime is set to version 5.0.1) it still giving me the same error:

Error: Could not find haxelib "lime" version "5.0.*", does it need to be installed?

Is this happening to anyone else?

Could you share the output of haxelib list? I’m sorry you’re having this problem, I haven’t seen it elsewhere

actuate: [1.8.7]
box2d: [1.2.3]
haxelib: [3.3.0]
hxcpp: [3.4.64]
layout: [1.2.1]
lime-samples: [4.0.1]
lime: 4.1.0 5.0.0 [5.0.1]
openfl-samples: [4.9.0]
openfl: 5.0.0 [5.1.1]
svg: [1.1.1]

Hope it helps. Thanks.

edit-----

I’ve update lime to 5.0.2, but still no joy.

What operating system are you using? What version of Haxe is installed?

Windows 10 Pro and Haxe version is 3.4.2.

Could you try these steps here:

…and see if it helps?

Before trying the steps from your last post, I updated openfl to version 5.1.2, and all works fine now.

And yes the red square sample code now works in all the targets I’ve mencioned before, Yeah!

I’m now going to play a little with readGraphicsData on my current project ;)!

Thanks @singmajesty, for all the help!!

1 Like

Sorry again for the version not found trouble :slight_smile:

No problem at all, we are here to make OpenFL/Haxe stronger. I think that is what a community means, and we have to thank the creators (you of course!) for bringing this great tools. I hope I could continue to grow (as a developer) along side OpenFL/Haxe and help to contribute even further. Keep up the good work ;)!

2 Likes