PCL
pcl::SVG Class Reference

Scalable Vector Graphics generation. More...

#include <SVG.h>

+ Inheritance diagram for pcl::SVG:

Public Member Functions

 SVG (const String &filePath, int width=0, int height=0)
 
 SVG (int width=0, int height=0)
 
 ~SVG () override
 
Rect Bounds () const
 
ByteArray Data () const
 
String Description () const
 
String FilePath () const
 
void GetDimensions (int &width, int &height) const
 
int Height () const
 
bool IsPainting () const
 
int Resolution () const
 
void SetDescription (const String &desc)
 
void SetDimensions (int width, int height) const
 
void SetResolution (int r)
 
void SetTitle (const String &title)
 
template<typename T >
void SetViewBox (const GenericRectangle< T > &r)
 
void SetViewBox (double x0, double y0, double x1, double y1)
 
String Title () const
 
DRect ViewBox () const
 
int Width () const
 
- Public Member Functions inherited from pcl::UIObject
virtual ~UIObject () noexcept(false)
 
virtual void EnsureUnique ()
 
bool IsAlias () const
 
bool IsGarbage () const
 
bool IsNull () const
 
bool IsSameObject (const UIObject &o) const
 
bool IsUnique () const
 
String ObjectId () const
 
IsoString ObjectType () const
 
bool operator< (const UIObject &o) const
 
bool operator== (const UIObject &o) const
 
size_type RefCount () const
 
void SetObjectId (const String &id)
 

Static Public Member Functions

static SVGNull ()
 
- Static Public Member Functions inherited from pcl::UIObject
static UIObjectNull ()
 

Additional Inherited Members

- Protected Member Functions inherited from pcl::UIObject
 UIObject ()=default
 
 UIObject (const UIObject &x)
 
 UIObject (UIObject &&x)
 
UIObjectoperator= (const UIObject &x)
 
UIObjectoperator= (UIObject &&x)
 

Detailed Description

The SVG class performs generation of Scalable Vector Graphics output. Generated SVG data can be sent to either a disk file or to a memory buffer. The Bitmap class can be used to render SVG objects as images.

See also
Graphics, Bitmap

Definition at line 80 of file SVG.h.

Constructor & Destructor Documentation

◆ SVG() [1/2]

pcl::SVG::SVG ( const String filePath,
int  width = 0,
int  height = 0 
)

Constructs an SVG object that will send graphics output to a file at the specified filePath.

The optional width and height values, if nonzero, will be written as the corresponding attributes of the root <svg> XML element.

◆ SVG() [2/2]

pcl::SVG::SVG ( int  width = 0,
int  height = 0 
)

Constructs an SVG object that will send graphics output to a memory buffer.

The optional width and height values, if nonzero, will be written as the corresponding attributes of the <svg> XML element.

◆ ~SVG()

pcl::SVG::~SVG ( )
inlineoverride

Destroys an SVG object.

Definition at line 105 of file SVG.h.

Member Function Documentation

◆ Bounds()

Rect pcl::SVG::Bounds ( ) const
inline

Returns the bounding rectangle of this SVG object. The returned rectangle is equal to Rect( 0, 0, Width(), Height() ).

Definition at line 145 of file SVG.h.

◆ Data()

ByteArray pcl::SVG::Data ( ) const

Returns a copy of the output data buffer generated by this SVG object as a dynamic array of bytes. If this object sends graphics output to a file buffer, or if a Graphics object is still painting it, this function returns an empty array.

◆ Description()

String pcl::SVG::Description ( ) const

Returns the description attribute of this SVG object.

◆ FilePath()

String pcl::SVG::FilePath ( ) const

Returns the output file path of this SVG object. If this object sends its graphics output to a memory buffer, this function returns an empty string.

◆ GetDimensions()

void pcl::SVG::GetDimensions ( int &  width,
int &  height 
) const

Obtains the dimensions (width, height) of this SVG object in pixels.

◆ Height()

int pcl::SVG::Height ( ) const
inline

Returns the height of this SVG object.

Definition at line 136 of file SVG.h.

◆ IsPainting()

bool pcl::SVG::IsPainting ( ) const

Returns true iff this SVG instance is being actively painted by a Graphics object.

◆ Null()

static SVG& pcl::SVG::Null ( )
static

Returns a reference to a null SVG instance. A null SVG does not correspond to an existing SVG object in the PixInsight core application.

◆ Resolution()

int pcl::SVG::Resolution ( ) const

Returns the resolution attribute of this SVG object in dots per inch.

◆ SetDescription()

void pcl::SVG::SetDescription ( const String desc)

Sets the description attribute of this SVG object.

If no specific value is set by a call to this function, a default description attribute is set to "Generated with " plus a string representing the version of the PixInsight core application.

◆ SetDimensions()

void pcl::SVG::SetDimensions ( int  width,
int  height 
) const

Sets the dimensions of this SVG object, width and height in pixels.

◆ SetResolution()

void pcl::SVG::SetResolution ( int  r)

Sets the resolution attribute of this SVG object in dots per inch.

◆ SetTitle()

void pcl::SVG::SetTitle ( const String title)

Sets the title attribute of this SVG object.

If no specific value is set by a call to this function, a default title attribute is set to "PixInsight SVG Document" by the PixInsight core application.

◆ SetViewBox() [1/2]

template<typename T >
void pcl::SVG::SetViewBox ( const GenericRectangle< T > &  r)
inline

Sets the viewBox attribute of this SVG object to the specified rectangle r.

Definition at line 175 of file SVG.h.

References pcl::GenericRectangle< T >::x0, pcl::GenericRectangle< T >::x1, pcl::GenericRectangle< T >::y0, and pcl::GenericRectangle< T >::y1.

◆ SetViewBox() [2/2]

void pcl::SVG::SetViewBox ( double  x0,
double  y0,
double  x1,
double  y1 
)

Sets the viewBox attribute of this SVG object.

Parameters
x0Left coordinate of the viewBox rectangle.
y0Upper coordinate of the viewBox rectangle.
x1Right coordinate of the viewBox rectangle.
y1Bottom coordinate of the viewBox rectangle.

The viewBox defines a clipping rectangle for graphics output. It can be useful when an SVG drawing will be used as an element of a larger drawing.

◆ Title()

String pcl::SVG::Title ( ) const

Returns the title attribute of this SVG object.

◆ ViewBox()

DRect pcl::SVG::ViewBox ( ) const

Returns the viewBox attribute of this SVG object. The viewBox defines a clipping rectangle for graphics output. It can be useful when an SVG drawing will be used as an element of a larger drawing.

◆ Width()

int pcl::SVG::Width ( ) const
inline

Returns the width of this SVG object.

Definition at line 128 of file SVG.h.


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