Class SVGImageUtils
java.lang.Object
VASSAL.tools.image.svg.SVGImageUtils
Utility methods for manipulating SVG images.
- Since:
- 3.1.0
- Author:
- Joel Uckelman
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.w3c.dom.svg.SVGDocument
getDocument
(String file, InputStream in) getExternalReferences
(String path) Conducts a recursive depth-first search for external references in the given SVG file.getExternalReferences
(String path, List<String> known) Conducts a recursive depth-first search for external references in the SVG file named by path.static Dimension
Returns the default dimensions of the SVG image.static Dimension
getImageSize
(String file, InputStream in) Returns the default dimensions of the SVG image.static Dimension
getImageSize
(org.w3c.dom.svg.SVGDocument doc) static AffineTransform
getViewBoxTransform
(org.w3c.dom.svg.SVGDocument doc) protected static void
static byte[]
Rewrites external references contained in SVG files.
-
Method Details
-
getDocument
public static org.w3c.dom.svg.SVGDocument getDocument(String file, InputStream in) throws IOException - Throws:
IOException
-
getImageSize
Returns the default dimensions of the SVG image. Closes theInputStream
.- Returns:
- the image dimensions
- Throws:
IOException
- if the image cannot be read
-
getViewBoxTransform
public static AffineTransform getViewBoxTransform(org.w3c.dom.svg.SVGDocument doc) throws IOException - Throws:
IOException
-
getImageSize
- Throws:
IOException
-
getImageSize
Returns the default dimensions of the SVG image.- Returns:
- the image dimensions
- Throws:
IOException
- if the image cannot be read
-
getExternalReferences
Conducts a recursive depth-first search for external references in the given SVG file.- Parameters:
path
- the path of the file to check for external references- Throws:
IOException
-
getExternalReferences
protected static List<String> getExternalReferences(String path, List<String> known) throws IOException Conducts a recursive depth-first search for external references in the SVG file named by path. This is a helper function forgetExternalReferences(java.lang.String)
.- Parameters:
path
- the path of the file to check for external referencesknown
- the list of references already found- Throws:
IOException
-
relativizeExternalReferences
Rewrites external references contained in SVG files.- Parameters:
path
- the path of the file to be processed- Throws:
IOException
-
relativizeElement
-