Package com.iizix.prop.image
Class SVGInfo
java.lang.Object
com.iizix.prop.image.SVGInfo
Information about the SVG and its contents for HTML.
To handle class definition renaming to make the SVG class names unique when the SVG is inlined in the HTML, the jStyleParser is used. New code from tokyo.northside:jstyleparser:4.1.4, source on https://codeberg.org/miurahr/jstyleparser.
- Author:
- Christopher Mindus
- Field SummaryFields
- Method SummaryModifier and TypeMethodDescription- static SVGInfoCreates the SVG inform from the SVG definition.- static SVGInfo- fromDefinition- (File file) Creates the SVG inform from the SVG definition.- static SVGInfo- fromString- (String string) Creates the SVG information from a String, used typically for iizi SVG URN's.- doubleGets the width of the SVG.- getKStringSVG- (double cx, double cy) Returns the SVG definition string.- getKStringSVG- (KStringHTMLImageTag source) Returns the SVG definition string.Returns the SVG used in the HTML.- double- getWidth()Gets the width of the SVG.Gets the XML string.- booleanReturns the a viewbox is present in XML SVG.- void- setScale- (int cx, int cy) Sets the requested scaled width and height.- voidUpdates the requested size from the definition.
- Field Details- widthpublic final double widthThe width of the SVG.
- heightpublic final double heightThe height of the SVG.
 
- Method Details- fromDefinitionCreates the SVG inform from the SVG definition.- Parameters:
- file- The file.
- Returns:
- The SVG information if complete, null if not defined properly.
 
- fromStringCreates the SVG information from a String, used typically for iizi SVG URN's.- Parameters:
- string- The string containing the SVG definition.
- Returns:
- The SVGInfo instance.
- Throws:
- IOException- For read errors.
- SAXException- For SAX parsing errors.
 
- fromDefinitionCreates the SVG inform from the SVG definition.- Parameters:
- def- The SVG definition.
- Returns:
- The SVG information if complete, null if not defined properly.
 
- updateFromDefinitionUpdates the requested size from the definition.- Parameters:
- def- The definition.
 
- setScalepublic void setScale- (int cx, int cy) Sets the requested scaled width and height. If any of cx or cy is zero or smaller, the scaled size is reset to original size.- Parameters:
- cx- The requested width.
- cy- The requested height.
 
- getXMLStringGets the XML string.- Returns:
- The XML string that can be used to display the SVG as a preview in the Designer, or null for failures.
 
- getWidthpublic double getWidth()Gets the width of the SVG.- Returns:
- The width.
 
- getHeightpublic double getHeight()Gets the width of the SVG.- Returns:
- The width.
 
- getSVGForHTMLReturns the SVG used in the HTML.- Returns:
- The SVG string for HTML, null for failures.
 
- hasViewBoxpublic boolean hasViewBox()Returns the a viewbox is present in XML SVG.- Returns:
- true if present, false otherwise.
 
- getKStringSVGReturns the SVG definition string.- Parameters:
- source- The source KString tag.
- Returns:
- The String to use as SVG, [em]SVG failed[/em] in case of failure.
 
- getKStringSVGReturns the SVG definition string.- Parameters:
- cx- Requested scaled width if larger than zero.
- cy- Requested scaled height if larger than zero.
- Returns:
- The SVG string, or nullfor failure.