Einhugur SVG plugin Question

@Björn_Eiríksson

Just a quick probably stupid question.

The SVG image height and width properties are doubles… but how to map those to pixels fro screen display… Are they points? The docs don’t state that. And looking at:

https://oreillymedia.github.io/Using_SVG/guide/units.html

So it looks like Pixels in SVG assumes Windows 96 dpi…

Basically seems like it could depend on how the SVGs are configured internally…

Why I am asking is that I want to create Xojo pictures with the appropriate resolution for the screen (retina vs non, or different MS Windows scaling the user can set).

In other words to create the bitmap the gets converted to a Xojo picture cached for the paint event, should I do:
DIM bitmap As RawBitmap = m_svg.ToRawBitmap(m_svg.width * Window.Scalefactor, m_svg.height * window.scalefactor)

if the length units are in points that would be right but teh calculation would be different if bases on 96 dpi…

I may be totally off base here… this kine of thing confuses me as I am not good with graphics!

-Karen

SVG it self can vary what it is

taking for example this SVG here:

<?xml version="1.0" standalone="yes"?>
<parent xmlns="http://some.url">

   <!-- SVG graphic -->
   <svg xmlns='http://www.w3.org/2000/svg'
      width="100px" height="200px">
      <path d="M100,100 Q200,400,300,100"/>
      <!-- rest of SVG graphic would go here -->
   </svg>

</parent>

This one would be in pixels…

The library we got under the hood does not specify as far as I know. So I guess some testing would be needed here. Like testing what you would get on image like the one above. Add if having some other kinds that maybe define cm instead of pixel.

So if I understand it correctly the SVG can have quite a bit of different as listed here:

Units for Measurements Reference — Using SVG with CSS3 and HTML5 — Supplementary Material (oreillymedia.github.io)

Ideally the plugin would take whatever units are defined in the SVG and convert what is reported to us in either points or pixels to be consistent so we can always draw a properly scaled bitmap when needed…

But it sounds like that is not the case and it will be SVG file dependent, which is unfortunate.

-Karen

As I said it depends on what the library under the hood does, which needs to be investigated.

Though we do not control that library.

It does not 100% mean that nothing can be done though since more details could be read from the XML.

They actually do say though its in pixels…

/**
* @brief Returns width of the document
* @return the width of the document in pixels
*/
double width() const;

/**
 * @brief Returns the height of the document
 * @return the height of the document in pixels
 */
double height() const;

Thanks! It would be helpful to document that… Pixels being a double is not intuitive!

Thanks
-Karen