Package com.iizix.urn.svg
Class SVG_URN
- java.lang.Object
- com.iizix.urn.URN
- com.iizix.urn.svg.SVG_URN
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class SVG_URN extends URN implements java.lang.Cloneable, java.io.Serializable
SVG image Uniform Resource Naming (URN) instance class, holding the SVG data.- Author:
- Christopher Mindus
- See Also:
- Serialized Form
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Checks if two instances are equal.static SVG_URNfromURL(java.lang.String svgString, int width, int height)Creates a SVG URN from an SVG string.java.lang.StringgetParamString()Gets the parameter string for theURN.toString()method.GSizegetScaledSize()Gets the scaled size in logical pixels.java.lang.StringgetSVGForHTML()Gets the HTML SVG rendering string.java.lang.StringgetURL()Gets the URL of this as a data URL containing SVG code.inthashCode()Hash code of this instance.Methods inherited from class com.iizix.urn.URN
asURNResource, from, getImageTarget, getURNString, isImageTargetSupported, isURNResource, toString
Method Detail
fromURL
public static SVG_URN fromURL(java.lang.String svgString, int width, int height) throws java.io.IOException, org.xml.sax.SAXException
Creates a SVG URN from an SVG string.- Parameters:
svgString- The SVG string.width- Scale to width in logical pixels, zero or negative for no scaling of the width. If non-zero, theheightmust also be non-zero, otherwise no width scaling is assumed.height- Scale to height in logical pixels, zero or negative for no scaling of the height. If non-zero, thewidthmust also be non-zero, otherwise no height scaling is assumed.- Throws:
java.lang.NullPointerException- If thesvgStringis null.java.io.IOException- For read errors.org.xml.sax.SAXException- For XML (SVG) parser errors.
getURL
public java.lang.String getURL()
Gets the URL of this as a data URL containing SVG code.
getScaledSize
public GSize getScaledSize()
Gets the scaled size in logical pixels.- Returns:
- The scaling size, or
nullfor no scaling.
getSVGForHTML
public java.lang.String getSVGForHTML()
Gets the HTML SVG rendering string.- Returns:
- The SVG string in HTML format, i.e. without XML heading.
getParamString
public java.lang.String getParamString()
Gets the parameter string for theURN.toString()method.- Specified by:
getParamStringin classURN- Returns:
- The parameter string, always
non-null, formatted as"svg=SVG_DATA,size=[width=W,height=H]"where thescaleinformation is not present if scaling is not performed on the SVG. If scaled, thewidthandheightare integer values in logical pixels.
hashCode
public int hashCode()
Hash code of this instance.