|
NovaSVG 0.10.0
A header-only SVG library
|
#include <novasvg.h>
Public Member Functions | |
| void | applyStyleSheet (const std::string &content) |
| Applies a CSS stylesheet to the document. | |
| ElementList | querySelectorAll (const std::string &content) const |
| Selects all elements that match the given CSS selector(s). | |
| float | width () const |
| Returns the intrinsic width of the document in pixels. | |
| float | height () const |
| Returns the intrinsic height of the document in pixels. | |
| Box | boundingBox () const |
| Returns the smallest rectangle that encloses the document content. | |
| void | updateLayout () |
| Updates the layout of the document if needed. | |
| void | forceLayout () |
| Forces an immediate layout update. | |
| void | render (Bitmap &bitmap, const Matrix &matrix=Matrix()) const |
| Renders the document onto a bitmap using a transformation matrix. | |
| Bitmap | renderToBitmap (int width=-1, int height=-1, const Color &backgroundColor=Color(0, 0, 0, 0)) const |
| Renders the document to a bitmap with specified dimensions. | |
| Element | elementFromPoint (float x, float y) const |
| Returns the topmost element under the specified point. | |
| Element | getElementById (const std::string &id) const |
| Retrieves an element by its ID. | |
| Element | documentElement () const |
| Retrieves the document element. | |
| Document (Document &&) | |
| Document & | operator= (Document &&) |
| ~Document () | |
Static Public Member Functions | |
| static std::unique_ptr< Document > | loadFromFile (const std::string &filename) |
| Load an SVG document from a file. | |
| static std::unique_ptr< Document > | loadFromData (const std::string &string) |
| Load an SVG document from a string. | |
| static std::unique_ptr< Document > | loadFromData (const char *data) |
| Load an SVG document from a null-terminated string. | |
| static std::unique_ptr< Document > | loadFromData (const char *data, size_t length) |
| Load an SVG document from a string with a specified length. | |
Friends | |
| class | SVGURIReference |
| class | SVGNode |
|
inlinedefault |
|
inlinedefault |
| NOVASVG_INLINE void novasvg::Document::applyStyleSheet | ( | const std::string & | content | ) |
Applies a CSS stylesheet to the document.
| content | A string containing the CSS rules to apply, with comments removed. |
Definition at line 1613 of file svgparser.hpp.
References novasvg::RuleIndex::candidates(), novasvg::ForeignObject, novasvg::SVGElement::id(), novasvg::SVGElement::setAttribute(), novasvg::Unknown, and width().
|
inline |
Returns the smallest rectangle that encloses the document content.
Definition at line 1051 of file novasvg.h.
References novasvg::SVGSVGElement::localTransform(), and novasvg::Transform::mapRect().
|
inline |
Returns the topmost element under the specified point.
| x | The x-coordinate in viewport space. |
| y | The y-coordinate in viewport space. |
Definition at line 1137 of file novasvg.h.
References novasvg::SVGElement::elementFromPoint().
|
inline |
|
inline |
Returns the intrinsic height of the document in pixels.
Definition at line 1046 of file novasvg.h.
References novasvg::SVGRootElement::intrinsicHeight().
Referenced by renderToBitmap().
Load an SVG document from a null-terminated string.
| data | The string containing the SVG data. |
Document, or nullptr on failure. Definition at line 1028 of file novasvg.h.
References loadFromData().
|
inlinestatic |
Load an SVG document from a string.
| string | The SVG data as a string. |
Document, or nullptr on failure. Definition at line 1023 of file novasvg.h.
References loadFromData().
Referenced by loadFromData(), loadFromData(), and loadFromFile().
|
inlinestatic |
Load an SVG document from a file.
| filename | The path to the SVG file. |
Document, or nullptr on failure. Definition at line 1011 of file novasvg.h.
References loadFromData(), and width().
|
inlinedefault |
| NOVASVG_INLINE ElementList novasvg::Document::querySelectorAll | ( | const std::string & | content | ) | const |
Selects all elements that match the given CSS selector(s).
| content | A string containing the CSS selector(s) to match elements. |
Definition at line 1659 of file svgparser.hpp.
References width().
Renders the document onto a bitmap using a transformation matrix.
| bitmap | The bitmap to render onto. |
| The | root transformation matrix. |
Definition at line 1066 of file novasvg.h.
References novasvg::Background_Color, novasvg::render::color_parse(), novasvg::render::color_to_argb32(), novasvg::Painting, novasvg::SVGSVGElement::render(), and width().
Referenced by renderToBitmap().
|
inline |
Renders the document to a bitmap with specified dimensions.
| width | The desired width in pixels, or -1 to auto-scale based on the intrinsic size. |
| height | The desired height in pixels, or -1 to auto-scale based on the intrinsic size. |
| backgroundColor | The background color to render onto. |
Definition at line 1112 of file novasvg.h.
References height(), novasvg::SVGRootElement::intrinsicHeight(), novasvg::SVGRootElement::intrinsicWidth(), render(), and width().
|
inline |
|
inline |
Returns the intrinsic width of the document in pixels.
Definition at line 1041 of file novasvg.h.
References novasvg::SVGRootElement::intrinsicWidth().
Referenced by applyStyleSheet(), loadFromFile(), querySelectorAll(), render(), and renderToBitmap().
|
friend |