svg-tree- SVG file loader and serializer

Safe HaskellNone




Module providing basic input/output for the SVG document, for document building, please refer to Graphics.Svg.Types.


Saving/Loading functions

loadSvgFile :: FilePath -> IO (Maybe Document) Source #

Try to load an svg file on disc and parse it as a SVG Document.

parseSvgFile Source #


:: FilePath

Source path/URL of the document, used to resolve relative links.

-> ByteString 
-> Maybe Document 

Parse an in-memory SVG file

xmlOfDocument :: Document -> Element Source #

Transform a SVG document to a XML node.

saveXmlFile :: FilePath -> Document -> IO () Source #

Save a svg Document on a file on disk.

Manipulation functions

cssApply :: [CssRule] -> Tree -> Tree Source #

Rewrite a SVG Tree using some CSS rules.

This action will propagate the definition of the css directly in each matched element.

cssRulesOfText :: Text -> [CssRule] Source #

Parse CSS text into rules.

applyCSSRules :: Document -> Document Source #

Rewrite the document by applying the CSS rules embedded inside it.

resolveUses :: Document -> Document Source #

For every HasUse tag, try to resolve the geometry associated with it and place it in the scene Tree. It is important to resolve the HasUse tag before applying the CSS rules, as some rules may apply some elements matching the children of "use".

Type definitions