sf-svg
Public Member Functions | List of all members
nsvg::Image Class Reference

C++-styled cstyle::ImageStruct wrapper. More...

#include <Image.hpp>

Public Member Functions

 Image ()
 Default constructor. More...
 
 Image (const Image &image)
 Copy constructor. More...
 
Imageoperator= (const Image &image)
 Assignment operator. More...
 
bool loadFromFile (const std::string &filename, const std::string &units, const float dpi=96.f)
 Parses SVG from file. More...
 
bool loadFromMemory (std::string input, const std::string &units, const float dpi=96.f)
 Parses SVG from memory. More...
 
cstyle::ImageStructgetInternalImage ()
 Get internal image. More...
 
ShapeVector getShapes ()
 Get shape vector. More...
 
sf::Vector2f getSize () const
 Get size. More...
 
 ~Image ()
 Destructor. More...
 

Detailed Description

C++-styled cstyle::ImageStruct wrapper.

Provides object orientated interface for C-style nsvg::cstyle::ImageStruct.

Constructor & Destructor Documentation

◆ Image() [1/2]

nsvg::Image::Image ( )

Default constructor.

Does nothing;

◆ Image() [2/2]

nsvg::Image::Image ( const Image image)

Copy constructor.

Protects from double-free error afrer assigning.

◆ ~Image()

nsvg::Image::~Image ( )

Destructor.

Releases resources if any were allocated

Member Function Documentation

◆ getInternalImage()

cstyle::ImageStruct * nsvg::Image::getInternalImage ( )

Get internal image.

Returns
C-styled nsvg::ImageStruct

◆ getShapes()

ShapeVector nsvg::Image::getShapes ( )

Get shape vector.

Returns
ShapeVector instance

◆ getSize()

sf::Vector2f nsvg::Image::getSize ( ) const

Get size.

Returns
Image's size in sf::Vector2f

◆ loadFromFile()

bool nsvg::Image::loadFromFile ( const std::string &  filename,
const std::string &  units,
const float  dpi = 96.f 
)

Parses SVG from file.

Parameters
[in]filename– path to file
[in]units– passed to nanosvg
[in]dpi– passed to nanosvg
Returns
True if ok, False otherwise

◆ loadFromMemory()

bool nsvg::Image::loadFromMemory ( std::string  input,
const std::string &  units,
const float  dpi = 96.f 
)

Parses SVG from memory.

Parameters
[in]input– null-terminated data
[in]units– passed to nanosvg
[in]dpi– passed to nanosvg
Returns
True if ok, False otherwise

◆ operator=()

Image & nsvg::Image::operator= ( const Image image)

Assignment operator.

Protects from double-free error afrer assigning.


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