Giter Club home page Giter Club logo

lunasvg's Introduction

Releases License Build Status

LunaSVG

LunaSVG is an SVG rendering library in C++, designed to be lightweight and portable, offering efficient rendering and manipulation of Scalable Vector Graphics (SVG) files.

Basic Usage

#include <lunasvg.h>

using namespace lunasvg;

int main()
{
    auto document = Document::loadFromFile("tiger.svg");
    if(document == nullptr)
        return -1;
    auto bitmap = document->renderToBitmap();
    if(bitmap.isNull())
        return -1;
    bitmap.writeToPng("tiger.png");
    return 0;
}

tiger.png

Features

LunaSVG supports nearly all graphical features outlined in the SVG 1.1 and SVG 1.2 Tiny specifications. The primary exceptions are animation, filters, and scripts. As LunaSVG is designed for static rendering, animation is unlikely to be supported in the future. However, support for filters may be added.

Supported Elements

<a> <circle> <clipPath> <defs> <ellipse> <g> <image> <line> <linearGradient> <marker> <mask> <path> <pattern> <polygon> <polyline> <radialGradient> <rect> <stop> <style> <svg> <symbol> <text> <tspan> <use>

Installation

Ensure you have Meson and Ninja installed.

git clone https://github.com/sammycage/lunasvg.git
cd plutovg
meson setup build
ninja -C build
ninja -C build install

Demo

LunaSVG provides a command-line tool svg2png for converting SVG files to PNG format.

Usage:

svg2png [filename] [resolution] [bgColor]

Examples:

$ svg2png input.svg
$ svg2png input.svg 512x512
$ svg2png input.svg 512x512 0xff00ffff

Projects Using LunaSVG

lunasvg's People

Contributors

sammycage avatar fdwr avatar lhlaurini avatar seanharmer avatar m-carrasco avatar reputeless avatar etodanik avatar ewouth avatar werwolv avatar lemirep avatar lolpie244 avatar lpsd avatar toge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.