wxMaxima
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
SvgBitmap Class Reference

A wxBitmap with a constructor that generates the image from SVG. More...

#include <SvgBitmap.h>

Inheritance diagram for SvgBitmap:
[legend]
Collaboration diagram for SvgBitmap:
[legend]

Public Member Functions

 SvgBitmap (wxWindow *window, const unsigned char *data, const size_t len, int width=640, int height=480)
 Renders an SVG image.
 
 SvgBitmap (wxWindow *window, const unsigned char *data, const std::size_t len, wxSize siz)
 
 SvgBitmap (SvgBitmap &&)=delete
 
SvgBitmap & operator= (SvgBitmap &&o) noexcept
 
const SvgBitmap & SetSize (int width, int height)
 Sets the bitmap to a new size and renders the svg image at this size.
 
const SvgBitmap & SetSize (wxSize siz)
 Sets the bitmap to a new size and renders the svg image at this size.
 

Static Public Member Functions

static bool RendersText ()
 Does the SVG renderer wxWidgets was built with draw text?
 
static wxString TextRenderingDiagnosis (bool rendersText)
 Why SVG plots are available or not, given RendersText()'s result.
 
static wxBitmap GetInvalidBitmap (int targetSize)
 An "invalid bitmap" sign.
 

Detailed Description

A wxBitmap with a constructor that generates the image from SVG.

The rendering is done by wxWidgets (wxBitmapBundle::FromSVG()); this class only unpacks our embedded data and keeps the bundle around, so a new size is rendered from the vector data again rather than scaled from pixels.

Constructor & Destructor Documentation

◆ SvgBitmap()

SvgBitmap::SvgBitmap ( wxWindow *  window,
const unsigned char *  data,
const size_t  len,
int  width = 640,
int  height = 480 
)

Renders an SVG image.

Parameters
windowUnused; kept so the call sites read as before
dataThe SVG, either as text or gzip-compressed
lenThe length of data in bytes

Member Function Documentation

◆ RendersText()

bool SvgBitmap::RendersText ( )
static

Does the SVG renderer wxWidgets was built with draw text?

Only LunaSVG does (wxWidgets >= 3.3.2, built with LunaSVG on and NanoSVG off); NanoSVG ignores text altogether, which would leave a plot without its labels and tick marks' numbers. Found out by rendering a word set in the font gnuplot's svg terminal asks for, so this also says no if the renderer can find neither that font nor its fallback. Rendered once, on first use, which has to be on the GUI thread, and logs TextRenderingDiagnosis() then, since the option for scalable plots is hidden without it.

◆ TextRenderingDiagnosis()

wxString SvgBitmap::TextRenderingDiagnosis ( bool  rendersText)
static

Why SVG plots are available or not, given RendersText()'s result.

Says which SVG renderer wxWidgets was built with and what would enable scalable plots. Not translated: it is meant for a bug report.


The documentation for this class was generated from the following files: