Giter VIP home page Giter VIP logo

Comments (4)

9tontruck avatar 9tontruck commented on August 24, 2024

Figured out having viewbox parameter in tag makes size problem.

from as3svgrenderer.

mattlohkamp avatar mattlohkamp commented on August 24, 2024

this is huge - even if the artwork is 120x120, the artboard is 120x120, everything is 120x120 - the image drawn in flash might still end up being scaled wrong. removing that viewbox attr fixes it.

this is still very much a big bug.

from as3svgrenderer.

lucaslorentz avatar lucaslorentz commented on August 24, 2024

I am comparing the library result with chrome.
And both size is precisely equal when you have a viewbox and the svg width and height are set as pixels.

But if I change svg width and height to pt, in, cm, or any unit that must be converted using dpi, there is a slight size difference between the AS3SVGRenderer and chrome.

That conversion is coded on method getUserUnit, at this file:
https://github.com/LucasLorentz/AS3SVGRenderer/blob/master/SVGRenderer/src/com/lorentz/SVG/utils/SVGUtil.as

You can see that the conversion from "in" to "pixels" (user unit) is a multiplication by "90", that, means that this library considers 90 dpi (dots per inch). Which is the same of Inkscape. But each renderer choose a different DPI to render, maybe that's the difference that you are seeing.

Take a look at those links:
http://stackoverflow.com/questions/1346922/svg-and-dpi-absolute-units-and-user-units-inkscape-vs-firefox-vs-imagemagick
http://www.w3.org/TR/SVG/coords.html#Units

Can any of you confirm that this is what is causing the difference on size?
If that's the problem, I can provide a property to configure the DPI the library should use, that way you can customize it to fit your needs.

If that isn't the problem, can you provide me an svg to reproduce the problem?

About the differences between old version of AS3SVGRenderer and the current version, I believe the version you were using don't support ViewBox and ViewPort correctly, so it don't re-scale the svg.

from as3svgrenderer.

mattlohkamp avatar mattlohkamp commented on August 24, 2024

github won't let me attach svgs, so here are a couple links -

http://junk.mattlohkamp.com/2in1.svg
http://junk.mattlohkamp.com/tablet.svg

not sure what version of the library this was using, I wanna say I grabbed it a couple months ago?

it was happening intermittently too, which was one of the weirdest parts - sometimes they'd scale correctly, sometimes they wouldn't. sorry, I know this isn't much help. :[

I'll see if I can dig up the old build of my project that was showing the issue.

from as3svgrenderer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.