Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Description :
Write geometry to svg
Synopsis
- toSvgXML :: ToMarkup t => t -> ByteString
- printSvgXML :: ToMarkup t => t -> IO ()
- svgO :: ToMarkup a => a -> Svg
- toSvgXMLElem :: ToMarkup t => t -> ByteString
- printSvgXMLElem :: ToMarkup t => t -> IO ()
- toPath :: Real r => NonEmpty (Point 2 r :+ p) -> Path
- applyAts :: Markup -> [(SvgF, AttributeValue)] -> Markup
- svgWriteAttrs :: (AllConstrained IpeToSvgAttr rs, RMap rs, RecordToList rs, ReifyConstraint ToValue (Attr f) rs, RecAll (Attr f) rs ToValue) => Attributes f rs -> [(SvgF, AttributeValue)]
- writeAttrFunctions :: AllConstrained IpeToSvgAttr rs => Rec f rs -> Rec (Const (Maybe SvgF)) rs
- writeAttrValues :: (ReifyConstraint ToValue (Attr f) rs, RMap rs, RecAll (Attr f) rs ToValue) => Rec (Attr f) rs -> Rec (Const (Maybe AttributeValue)) rs
- toMaybeValue :: ToValue (Attr f at) => Attr f at -> Maybe AttributeValue
- type SvgF = AttributeValue -> Attribute
- class IpeToSvgAttr (a :: AttributeUniverse) where
Documentation
toSvgXML :: ToMarkup t => t -> ByteString Source #
Converts an element into a valid svg document (including doctype etc.) The size of the resulting svg is set to 800x600. Moreover, we flip the axes so that the origin is in the bottom-left.
printSvgXML :: ToMarkup t => t -> IO () Source #
Convert an element to Svg using toSvgXML
and prints the resulting svg
(as xml) output to stdout.
toSvgXMLElem :: ToMarkup t => t -> ByteString Source #
Convert an element to Svg, and render this svg as xml. Note that the xml contains *only* this element.
printSvgXMLElem :: ToMarkup t => t -> IO () Source #
Convert an element to Svg, and prints the xml output to stdout.
Dealing with attributes
svgWriteAttrs :: (AllConstrained IpeToSvgAttr rs, RMap rs, RecordToList rs, ReifyConstraint ToValue (Attr f) rs, RecAll (Attr f) rs ToValue) => Attributes f rs -> [(SvgF, AttributeValue)] Source #
Functon to write all attributes in a Rec
writeAttrFunctions :: AllConstrained IpeToSvgAttr rs => Rec f rs -> Rec (Const (Maybe SvgF)) rs Source #
Writing Attribute names
writeAttrValues :: (ReifyConstraint ToValue (Attr f) rs, RMap rs, RecAll (Attr f) rs ToValue) => Rec (Attr f) rs -> Rec (Const (Maybe AttributeValue)) rs Source #
Writing the attribute values
toMaybeValue :: ToValue (Attr f at) => Attr f at -> Maybe AttributeValue Source #
type SvgF = AttributeValue -> Attribute Source #
class IpeToSvgAttr (a :: AttributeUniverse) where Source #
For the types representing attribute values we can get the name/key to use when serializing to ipe.