| Copyright | (C) Frank Staals |
|---|---|
| License | see the LICENSE file |
| Maintainer | Frank Staals |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Geometry.Svg.Writer
Description
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 #
class IpeToSvgAttr (a :: AttributeUniverse) where Source #
For the types representing attribute values we can get the name/key to use when serializing to ipe.
Instances
| IpeToSvgAttr Arrow Source # | |
| IpeToSvgAttr Clip Source # | |
| IpeToSvgAttr Dash Source # | |
| IpeToSvgAttr Fill Source # | |
| IpeToSvgAttr FillRule Source # | |
| IpeToSvgAttr Gradient Source # | |
| IpeToSvgAttr Layer Source # | |
| IpeToSvgAttr LineCap Source # | |
| IpeToSvgAttr LineJoin Source # | |
| IpeToSvgAttr Matrix Source # | |
| IpeToSvgAttr Opacity Source # | |
| IpeToSvgAttr Pen Source # | |
| IpeToSvgAttr Pin Source # | |
| IpeToSvgAttr RArrow Source # | |
| IpeToSvgAttr Size Source # | |
| IpeToSvgAttr Stroke Source # | |
| IpeToSvgAttr Tiling Source # | |
| IpeToSvgAttr Transformations Source # | |
Orphan instances
| ToValue FillType Source # | |
| ToValue PinType Source # | |
| ToValue TransformationTypes Source # | |
Methods toValue :: TransformationTypes -> AttributeValue preEscapedToValue :: TransformationTypes -> AttributeValue | |
| ToValue LayerName Source # | |
| Real r => ToMarkup (Group r) Source # | |
| Real r => ToMarkup (Image r) Source # | |
| Real r => ToMarkup (IpeObject r) Source # | |
| Real r => ToMarkup (IpeSymbol r) Source # | |
| Real r => ToMarkup (MiniPage r) Source # | |
| Real r => ToMarkup (Path r) Source # | |
| Real r => ToMarkup (TextLabel r) Source # | |
| Integral a => ToValue (Ratio a) Source # | |
| HasResolution p => ToValue (Fixed p) Source # | |
| Real r => ToValue (IpeArrow r) Source # | |
| Real r => ToValue (IpeDash r) Source # | |
| Real r => ToValue (IpePen r) Source # | |
| Real r => ToValue (IpeSize r) Source # | |
| Real r => ToValue (IpeColor r) Source # | |
| Real r => ToValue (Path r) Source # | |
| Real r => ToValue (PathSegment r) Source # | |
Methods toValue :: PathSegment r -> AttributeValue preEscapedToValue :: PathSegment r -> AttributeValue | |
| (ToMarkup g, AllConstrained IpeToSvgAttr rs, ReifyConstraint ToValue (Attr f) rs, RMap rs, RecordToList rs, RecAll (Attr f) rs ToValue) => ToMarkup (g :+ Attributes f rs) Source # | |
Methods toMarkup :: (g :+ Attributes f rs) -> Markup preEscapedToMarkup :: (g :+ Attributes f rs) -> Markup | |
| ToValue (Apply f at) => ToValue (Attr f at) Source # | |
| Real r => ToValue (Matrix 3 3 r) Source # | |