Git Product home page Git Product logo

javafxsvg's Introduction

JavaFxSVG

Codacy Badge

A simple library to add SVG support to JavaFX, allowing to use SVG graphics just like any other image type.

More details about the project can be found at the codecentric blog: Adding a custom image renderer to JavaFX 8

Installation

If you are using maven, just add JavaFxSVG to the dependencies

<dependency>
	<groupId>de.codecentric.centerdevice</groupId>
	<artifactId>javafxsvg</artifactId>
	<version>1.3.0</version>
</dependency>

Usage

Add this line to your application:

SvgImageLoaderFactory.install();

preferably before any JavaFX code is executed. After this, you can use SVG images just as any other Image in your application.

If the JavaFX container does not specify any width or height, the image is rendered with default dimensions (currently 400x400). To changes this behavior, a DimensionProvider can be passed with the install command:

SvgImageLoaderFactory.install(new PrimitiveDimensionProvider());

will try to determine the actual size of the SVG (as specified by width and height attributes) and use this as a fallback size.

Known Issues

Currently, SVGs are required to start with either "<svg" or "<?xml" due to some rather static signature matching. As a result, svg might not be displayed when starting with whitespace characters or comment.

javafxsvg's People

Contributors

comfreek avatar codacy-badger 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.