Registry / other / nanosvg

nanosvg

JSON →
library2023-12-29vcpkgunverified

A simple single-header-file SVG parser and rasterizer.

vcpkg install nanosvg
INSTALL
IMPORT
SIG · NANOSVG
N
nanosvg
othercppv2023-12-29
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nanosvg.h
#include <nanosvg.h>

Parse an SVG file and print its dimensions

#define NANOSVG_IMPLEMENTATION #include "nanosvg.h" #include <iostream> int main() { // Parse SVG from file NSVGimage* image = nsvgParseFromFile("example.svg", "px", 96.0f); if (!image) { std::cerr << "Failed to parse SVG" << std::endl; return 1; } std::cout << "Parsed SVG with width=" << image->width << " height=" << image->height << std::endl; nsvgDelete(image); return 0; }
Debug
Known issues
gotchaNanoSVG requires defining NANOSVG_IMPLEMENTATION before including the header in exactly one source file to instantiate the implementation.
fix
Add #define NANOSVG_IMPLEMENTATION before #include "nanosvg.h" in exactly one .cpp file.
affects: *
Upgrade
Version history
2023-12-29latest on vcpkg
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources

No resource links recorded.

nanosvg — pip install nanosvg · libregistry