CenterDevice JavaFxSVG

JavaFxSVG is a simple library adding SVG support to JavaFX and thus allowing to use SVG graphics just like any other image type.

License

License

Categories

Categories

JavaFX User Interface
GroupId

GroupId

de.codecentric.centerdevice
ArtifactId

ArtifactId

javafxsvg
Last Version

Last Version

1.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

CenterDevice JavaFxSVG
JavaFxSVG is a simple library adding SVG support to JavaFX and thus allowing to use SVG graphics just like any other image type.
Project URL

Project URL

https://github.com/codecentric/javafxsvg
Project Organization

Project Organization

CenterDevice GmbH
Source Code Management

Source Code Management

https://github.com/codecentric/javafxsvg.git

Download javafxsvg

How to add to project

<!-- https://jarcasting.com/artifacts/de.codecentric.centerdevice/javafxsvg/ -->
<dependency>
    <groupId>de.codecentric.centerdevice</groupId>
    <artifactId>javafxsvg</artifactId>
    <version>1.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/de.codecentric.centerdevice/javafxsvg/
implementation 'de.codecentric.centerdevice:javafxsvg:1.3.0'
// https://jarcasting.com/artifacts/de.codecentric.centerdevice/javafxsvg/
implementation ("de.codecentric.centerdevice:javafxsvg:1.3.0")
'de.codecentric.centerdevice:javafxsvg:jar:1.3.0'
<dependency org="de.codecentric.centerdevice" name="javafxsvg" rev="1.3.0">
  <artifact name="javafxsvg" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.codecentric.centerdevice', module='javafxsvg', version='1.3.0')
)
libraryDependencies += "de.codecentric.centerdevice" % "javafxsvg" % "1.3.0"
[de.codecentric.centerdevice/javafxsvg "1.3.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.xmlgraphics : batik-transcoder jar 1.8
org.apache.xmlgraphics : xmlgraphics-commons jar 2.1

test (2)

Group / Artifact Type Version
org.loadui : testFx jar 3.1.2
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

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.

de.codecentric.centerdevice

codecentric AG

Versions

Version
1.3.0
1.2.1
1.2.0
1.1.0
1.0.0