Hello again obscure,
Thanks for the offer, but I’m using Sublime Text on a Mac (Retina display).
Having had a look around, I read a related post of yours: HTML5 and High DPI
If I add
<window allow-high-dpi="true" />
to the project.xml, I get a crisp display of the SVG in HTML5. That’s great - thanks.
However, the image is much smaller on screen now (50% width and height than previously).
I experimented with stage.window.scale and resizing the Lib.application.window:
var app_w = Std.int(Lib.application.window.width * stage.window.scale);
var app_h = Std.int(Lib.application.window.height * stage.window.scale);
Lib.application.window.resize(app_w,app_h);
But this doesn’t seem to have any effect (the image remains 50% smaller)… Am I missing something?
FYI:
HTML5
stage.window.scale = 2
Lib.application.window.width = 1416
Lib.application.window.height = 759
stage.stageWidth = 2832
stage.stageHeight = 1518
Flash
stage.window.scale = 1
Lib.application.window.width = 800
Lib.application.window.height = 600
stage.stageWidth = 800
stage.stageHeight = 600
What has seemed to work to get the image the same size as in Flash is to multiply the render size of the shape graphics (here 500) by stage.window.scale:
var image_w = Std.int(500 * stage.window.scale);
var image_h = Std.int(500 * stage.window.scale);
var svg : SVG = new SVG(Assets.getText("assets/apple_01_testG2.svg"));
var shape : Shape = new Shape();
svg.render(shape.graphics,0,0,image_w,image_h);
addChild(shape);
Here’s a screenshot of the output in HTML (left) & Flash (right):
As you can see, the result is extremely good. So thanks again for your help in getting this far.
Just trying to digest the implications of this for coding layout, positioning, etc…
Any additional pointers gratefully accepted.
Thanks
Mark