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 #
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 :: FillType -> AttributeValue preEscapedToValue :: FillType -> AttributeValue | |
ToValue PinType Source # | |
toValue :: PinType -> AttributeValue preEscapedToValue :: PinType -> AttributeValue | |
ToValue TransformationTypes Source # | |
toValue :: TransformationTypes -> AttributeValue preEscapedToValue :: TransformationTypes -> AttributeValue | |
ToValue LayerName Source # | |
toValue :: LayerName -> AttributeValue preEscapedToValue :: LayerName -> AttributeValue | |
Real r => ToMarkup (Group r) Source # | |
toMarkup :: Group r -> Markup preEscapedToMarkup :: Group r -> Markup | |
Real r => ToMarkup (Image r) Source # | |
toMarkup :: Image r -> Markup preEscapedToMarkup :: Image r -> Markup | |
Real r => ToMarkup (IpeObject r) Source # | |
toMarkup :: IpeObject r -> Markup preEscapedToMarkup :: IpeObject r -> Markup | |
Real r => ToMarkup (IpeSymbol r) Source # | |
toMarkup :: IpeSymbol r -> Markup preEscapedToMarkup :: IpeSymbol r -> Markup | |
Real r => ToMarkup (MiniPage r) Source # | |
toMarkup :: MiniPage r -> Markup preEscapedToMarkup :: MiniPage r -> Markup | |
Real r => ToMarkup (Path r) Source # | |
toMarkup :: Path r -> Markup preEscapedToMarkup :: Path r -> Markup | |
Real r => ToMarkup (TextLabel r) Source # | |
toMarkup :: TextLabel r -> Markup preEscapedToMarkup :: TextLabel r -> Markup | |
Integral a => ToValue (Ratio a) Source # | |
toValue :: Ratio a -> AttributeValue preEscapedToValue :: Ratio a -> AttributeValue | |
HasResolution p => ToValue (Fixed p) Source # | |
toValue :: Fixed p -> AttributeValue preEscapedToValue :: Fixed p -> AttributeValue | |
Real r => ToValue (IpeArrow r) Source # | |
toValue :: IpeArrow r -> AttributeValue preEscapedToValue :: IpeArrow r -> AttributeValue | |
Real r => ToValue (IpeDash r) Source # | |
toValue :: IpeDash r -> AttributeValue preEscapedToValue :: IpeDash r -> AttributeValue | |
Real r => ToValue (IpePen r) Source # | |
toValue :: IpePen r -> AttributeValue preEscapedToValue :: IpePen r -> AttributeValue | |
Real r => ToValue (IpeSize r) Source # | |
toValue :: IpeSize r -> AttributeValue preEscapedToValue :: IpeSize r -> AttributeValue | |
Real r => ToValue (IpeColor r) Source # | |
toValue :: IpeColor r -> AttributeValue preEscapedToValue :: IpeColor r -> AttributeValue | |
Real r => ToValue (Path r) Source # | |
toValue :: Path r -> AttributeValue preEscapedToValue :: Path r -> AttributeValue | |
Real r => ToValue (PathSegment r) Source # | |
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 # | |
toMarkup :: (g :+ Attributes f rs) -> Markup preEscapedToMarkup :: (g :+ Attributes f rs) -> Markup | |
ToValue (Apply f at) => ToValue (Attr f at) Source # | |
toValue :: Attr f at -> AttributeValue preEscapedToValue :: Attr f at -> AttributeValue | |
Real r => ToValue (Matrix 3 3 r) Source # | |
toValue :: Matrix 3 3 r -> AttributeValue preEscapedToValue :: Matrix 3 3 r -> AttributeValue |