wxMaxima
Loading...
Searching...
No Matches
Functions
SvgSize.h File Reference

Reads the size an SVG image says it has. More...

#include <wx/gdicmn.h>
#include <wx/string.h>
Include dependency graph for SvgSize.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

wxSize wxm::SvgIntrinsicSize (const wxString &svg, double ppi=96)
 The size an SVG document declares, in pixels.
 

Detailed Description

Reads the size an SVG image says it has.

wxBitmapBundle::FromSVG() renders an SVG at whatever size it is asked for, but wxWidgets has no public way to ask the SVG how big it wants to be (its implementations know, but keep it to themselves, in 3.2 and 3.3 alike). An image in the worksheet needs exactly that, as its 100% size, so we read it from the root element ourselves: its width and height attributes, or its viewBox if those are missing or relative.

Function Documentation

◆ SvgIntrinsicSize()

wxSize wxm::SvgIntrinsicSize ( const wxString &  svg,
double  ppi = 96 
)

The size an SVG document declares, in pixels.

Parameters
svgThe SVG document as text.
ppiThe resolution physical units (in, cm, mm, pt, pc) are converted at. A unitless length or one in px is a pixel at any resolution, as in every SVG renderer.
Returns
The size, or wxDefaultSize if the text has no root svg element or that element gives no usable size.