SVGImage
is a a JavaFX Group which is the result of the SVGLoader load
static method.
SVGImage
can be used directly in any JavaFX node graph. This class has also several additional methods which allows you to: SVGImage
to a JavaFX ImageSVGImage
SVGLoader
class, you can use this class in the JavaFX Platform Thread or in any other Thread. The library will make sure that the conversion will be performed in the JavaFX Platform Thread, and will return the result in the calling Thread.
SVGImage
, you can use one of the following methods: scale(double scale)
methods creates a new SVGImage
scaled compared to the initial imagescaleTo(double with)
method creates a new SVGImage
scaled with a new width compared to the initial imagesetScaleX
and setScaleY
on the initial image, but will create a new SVGImage with the same SVG input and a scale parameter.
snapshot(String format, File file)
method allows to save a snapshot of the initial image.
toImage()
allows to create a JavaFX image from the initial image. It is possible to specify the width of the result by using one of the following methods:toImage(double width)
will create a scaled JavaFX image from the initial image, using the width
parameter as the width of the resulting imagetoImage(short quality, double width)
does the same thing, and allows to specify the quality of the resulttoImageScaled(double scaleX, double scaleY)
will create a scaled JavaFX image from the initial imagetoImageScaled(short quality, double scaleX, double scaleY)
will create a scaled JavaFX image from the initial image, and allows to specify the quality of the resultSVGImage img = SVGLoader.load(<my SVG file>); // the resulting image will have a width of 100 pixels Image fxImg = img.toImage(100); // the resulting image will be scaled by a 0.5 factor Image fxImg2 = img.toImageScaled(0.5d); // the resulting image will have a width of 50 pixels, but the image will be scaled at the SVG level before creating // the image Image fxImg2 = img.toImage(ScaleQuality.RENDER_QUALITY, 50);
Copyright 2021-2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD-3-Clause License