Package pamViewFX.fxGlyphs
Class PamSVGIcon
java.lang.Object
pamViewFX.fxGlyphs.PamSVGIcon
Load SVG icons. These are preferable to images because they scale nicely between different resolution
displays. code adapted from https://github.com/DeskChan/DeskChan
Note on speed: This can be very slow loading icons. It seems that this is due to the metadata at the start of the SVG file. Tried with more SVG focused builders but this leads to dependency issues with org.w3c.dom which is very hard to sort out. The fix is simply to replace the metadata at the start of the SVG file with generic metadata that loads fast. Example which works:
invalid input: '<'svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
This is a hack rather than a fix but works for now.
- Author:
- JamieMacaulauy
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPamSVGIcon
(javafx.scene.shape.SVGPath[] shapes, String contentStyle, javafx.geometry.Insets margin, URL path) -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Deprecated.double
double
static PamSVGIcon
double
double
javafx.scene.Node
static String
getTextStyle
(Document document) void
setFitHeight
(double height) void
setFitWidth
(double width)
-
Field Details
-
instance
-
-
Constructor Details
-
PamSVGIcon
-
PamSVGIcon
public PamSVGIcon()
-
-
Method Details
-
canRead
-
getInstance
-
create
@Deprecated public PamSVGIcon create(URL path, javafx.scene.paint.Color color, double lineWidth) throws Exception Deprecated.- Throws:
Exception
-
create
- Throws:
Exception
-
getOriginWidth
public double getOriginWidth() -
getOriginHeight
public double getOriginHeight() -
setFitWidth
public void setFitWidth(double width) -
setFitHeight
public void setFitHeight(double height) -
getTextStyle
-
getSpritePath
-
getSpriteNode
public javafx.scene.Node getSpriteNode() -
getFitWidth
public double getFitWidth() -
getFitHeight
public double getFitHeight()
-