OpenCPN Partial API docs
Loading...
Searching...
No Matches
svg_utils.h File Reference

SVG utilities. More...

#include <wx/wxprec.h>
#include <wx/wx.h>
#include <string>
#include <mutex>
#include <unordered_map>
#include <wx/string.h>

Go to the source code of this file.

Classes

class  SVGBitmapCache
 Manage memory and disk cache for rendered bitmaps. More...
 

Functions

wxBitmap LoadSVG (const wxString filename, const unsigned int width, const unsigned int height, wxBitmap *default_bitmap=NULL, bool use_cache=true)
 Load SVG file and return it's bitmap representation of requested size In case file can't be loaded an empty bitmap of desired size or a provided default bitmap is returned.
 
bool SVGDocumentPixelSize (const wxString filename, unsigned int &width, unsigned int &height)
 Return the size of the SVG document in standard 96 DPI pixels https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#length Percentage, em and ex make no sense without being able to relate them to something, so we just return the numerical value as we do for px.
 
unsigned int SVGPixelsToDisplay (unsigned int svg_px)
 Recalculate the length in standard 96 DPI pixels to actual display pixels.
 
wxBitmap LoadSvgStdIcon (const std::string &svg_file, const wxWindow *w, bool touch)
 Load an svg icon from standard path, roughly scaled to the height of a char.
 

Detailed Description

SVG utilities.

Definition in file svg_utils.h.

Function Documentation

◆ LoadSVG()

wxBitmap LoadSVG ( const wxString  filename,
const unsigned int  width,
const unsigned int  height,
wxBitmap *  default_bitmap = NULL,
bool  use_cache = true 
)

Load SVG file and return it's bitmap representation of requested size In case file can't be loaded an empty bitmap of desired size or a provided default bitmap is returned.

Definition at line 65 of file svg_utils.cpp.

◆ LoadSvgStdIcon()

wxBitmap LoadSvgStdIcon ( const std::string &  svg_file,
const wxWindow *  w,
bool  touch 
)

Load an svg icon from standard path, roughly scaled to the height of a char.

Parameters
touchIf true ensures icon is "big enough" for touch screens

Definition at line 213 of file svg_utils.cpp.

◆ SVGDocumentPixelSize()

bool SVGDocumentPixelSize ( const wxString  filename,
unsigned int &  width,
unsigned int &  height 
)

Return the size of the SVG document in standard 96 DPI pixels https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#length Percentage, em and ex make no sense without being able to relate them to something, so we just return the numerical value as we do for px.

Definition at line 154 of file svg_utils.cpp.

◆ SVGPixelsToDisplay()

unsigned int SVGPixelsToDisplay ( unsigned int  svg_px)

Recalculate the length in standard 96 DPI pixels to actual display pixels.

Definition at line 208 of file svg_utils.cpp.