This class provides methods for loading SVG documents from various sources, such as files, URLs, and input streams, and then rendering them to JavaFX Image objects.
Note for SVGUtil: Currently, due to the limitation that weisj can only render BufferedImage from SVG, SvgImageView does not support usage in native packaging scenarios.| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static SVGDocument | |
| private static SVGDocument | |
| private static SVGDocument | |
| public static Image | Returns: an Image object representing the parsed SVG file.the file path of the SVG file. svgFilePath)Parses an SVG file from a given file path. |
| public static Image | Returns: an Image object representing the parsed SVG file.the File object representing the SVG file. svgFile)Parses an SVG file from a given File object. |
| public static Image | Returns: an Image object representing the parsed SVG file.the File object representing the SVG file. svgFile, double the preferred width of the Image. prefWidth, double the preferred height of the Image. prefHeight)Parses an SVG file from a given File object with the specified width and height. |
| public static Image | Returns: an Image object representing the parsed SVG file.the URL string of the SVG file. urlString)Parses an SVG file from a given URL string. |
| public static Image | Returns: an Image object representing the parsed SVG file.the URL object of the SVG file. url)Parses an SVG file from a given URL object. |
| public static Image | Returns: an Image object representing the parsed SVG file.the URL object of the SVG file. url, double the preferred width of the Image. prefWidth, double the preferred height of the Image. prefHeight)Parses an SVG file from a given URL object with the specified width and height. |
| private static BufferedImage | renderImage(SVGDocument svgDocument, double requestedWidth, double requestedHeight, double outputScaleX, double outputScaleY)
|
| public static Image | Returns: an Image object representing the SVG file.the InputStream of the SVG file. is, double the preferred width of the Image. requestedWidth, double the preferred height of the Image. requestedHeight, double the horizontal scale factor. outputScaleX, double the vertical scale factor. outputScaleY)Converts an InputStream representing an SVG file to an Image object with the specified dimensions and scale factors. |
| public static Image | Returns: an Image object representing the SVG file.the URL of the SVG file. url, double the preferred width of the Image. requestedWidth, double the preferred height of the Image. requestedHeight, double the horizontal scale factor. outputScaleX, double the vertical scale factor. outputScaleY)Converts a URL representing an SVG file to an Image object with the specified dimensions and scale factors. |
| public static Image | Returns: an Image object representing the SVG file.the URL string of the SVG file. urlStr, double the preferred width of the Image. requestedWidth, double the preferred height of the Image. requestedHeight, double the horizontal scale factor. outputScaleX, double the vertical scale factor. outputScaleY)Converts a URL string representing an SVG file to an Image object with the specified dimensions and scale factors. |
| public static Image | |
| private static Image | toImage(SVGDocument svgDocument, double requestedWidth, double requestedHeight, double outputScaleX, double outputScaleY)
|
| SVGUtil | back to summary |
|---|---|
| private SVGUtil() | |
| loadSVGDocument | back to summary |
|---|---|
| private static SVGDocument loadSVGDocument(File svgFile) | |
| loadSVGDocument | back to summary |
|---|---|
| private static SVGDocument loadSVGDocument(URL url) | |
| loadSVGDocument | back to summary |
|---|---|
| private static SVGDocument loadSVGDocument(InputStream is) | |
| parseSVGFromFile | back to summary |
|---|---|
| public static Image parseSVGFromFile(String svgFilePath) Parses an SVG file from a given file path. | |
| parseSVGFromFile | back to summary |
|---|---|
| public static Image parseSVGFromFile(File svgFile) Parses an SVG file from a given File object. | |
| parseSVGFromFile | back to summary |
|---|---|
| public static Image parseSVGFromFile(File svgFile, double prefWidth, double prefHeight) Parses an SVG file from a given File object with the specified width and height. | |
| parseSVGFromUrl | back to summary |
|---|---|
| public static Image parseSVGFromUrl(String urlString) Parses an SVG file from a given URL string. | |
| parseSVGFromUrl | back to summary |
|---|---|
| public static Image parseSVGFromUrl(URL url) Parses an SVG file from a given URL object. | |
| parseSVGFromUrl | back to summary |
|---|---|
| public static Image parseSVGFromUrl(URL url, double prefWidth, double prefHeight) Parses an SVG file from a given URL object with the specified width and height. | |
| renderImage | back to summary |
|---|---|
| private static BufferedImage renderImage(SVGDocument svgDocument, double requestedWidth, double requestedHeight, double outputScaleX, double outputScaleY) | |
| toImage | back to summary |
|---|---|
| public static Image toImage(InputStream is, double requestedWidth, double requestedHeight, double outputScaleX, double outputScaleY) Converts an InputStream representing an SVG file to an Image object with the specified dimensions and scale factors.
| |
| toImage | back to summary |
|---|---|
| public static Image toImage(URL url, double requestedWidth, double requestedHeight, double outputScaleX, double outputScaleY) Converts a URL representing an SVG file to an Image object with the specified dimensions and scale factors.
| |
| toImage | back to summary |
|---|---|
| public static Image toImage(String urlStr, double requestedWidth, double requestedHeight, double outputScaleX, double outputScaleY) Converts a URL string representing an SVG file to an Image object with the specified dimensions and scale factors.
| |
| toImage | back to summary |
|---|---|
| public static Image toImage(File svgFile, double requestedWidth, double requestedHeight, double outputScaleX, double outputScaleY) | |
| toImage | back to summary |
|---|---|
| private static Image toImage(SVGDocument svgDocument, double requestedWidth, double requestedHeight, double outputScaleX, double outputScaleY) | |