hgeometry-svg
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageGHC2024

HGeometry.Miso.Svg

Description

Render geometric objects to Svg files through miso

Synopsis

Documentation

renderSvgToFile :: OsPath -> View model action -> IO () Source #

Given an file path, and a view whose root is an svg element, render the output to the given file.

renderAsSvgText :: View model action -> Text Source #

Given an View whose root is an svg element, renders the view to a lazy Text

renderAsSvgByteString :: View model action -> ByteString Source #

Given an View whose root is an svg element, renders the view to a lazy ByteString.

withAts :: ([Attribute action] -> View model action) -> [Attribute action] -> [Attribute action] -> View model action Source #

Helper function to construct drawing functions. I..e it allows you do pre-specify a bunch of attributes that should be drawn (ats1) yet allow more attributes to be added by the user later.

class Drawable t where Source #

Default implementation for drawing geometric objects

Minimal complete definition

draw | drawWith

Methods

draw :: t -> [Attribute action] -> View model action Source #

Draws the given object with the given attributes

drawWith :: t -> [Attribute action] -> [View model action] -> View model action Source #

draw the given object, as well as the given "children"

Instances

Instances details
ToMisoString r => Drawable (Group r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: Group r -> [Attribute action] -> View model action Source #

drawWith :: Group r -> [Attribute action] -> [View model action] -> View model action Source #

ToMisoString r => Drawable (Image r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: Image r -> [Attribute action] -> View model action Source #

drawWith :: Image r -> [Attribute action] -> [View model action] -> View model action Source #

ToMisoString r => Drawable (IpeObject r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: IpeObject r -> [Attribute action] -> View model action Source #

drawWith :: IpeObject r -> [Attribute action] -> [View model action] -> View model action Source #

ToMisoString r => Drawable (IpeSymbol r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: IpeSymbol r -> [Attribute action] -> View model action Source #

drawWith :: IpeSymbol r -> [Attribute action] -> [View model action] -> View model action Source #

ToMisoString r => Drawable (MiniPage r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: MiniPage r -> [Attribute action] -> View model action Source #

drawWith :: MiniPage r -> [Attribute action] -> [View model action] -> View model action Source #

ToMisoString r => Drawable (TextLabel r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: TextLabel r -> [Attribute action] -> View model action Source #

drawWith :: TextLabel r -> [Attribute action] -> [View model action] -> View model action Source #

ToMisoString r => Drawable (Path r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: Path r -> [Attribute action] -> View model action Source #

drawWith :: Path r -> [Attribute action] -> [View model action] -> View model action Source #

ToMisoString r => Drawable (PathSegment r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: PathSegment r -> [Attribute action] -> View model action Source #

drawWith :: PathSegment r -> [Attribute action] -> [View model action] -> View model action Source #

(Point_ point 2 r, ToMisoString r, Floating r) => Drawable (Circle point) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: Circle point -> [Attribute action] -> View model action Source #

drawWith :: Circle point -> [Attribute action] -> [View model action] -> View model action Source #

(Point_ point 2 r, ToMisoString r, Floating r) => Drawable (Disk point) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: Disk point -> [Attribute action] -> View model action Source #

drawWith :: Disk point -> [Attribute action] -> [View model action] -> View model action Source #

(Point_ point 2 r, ToMisoString r, Num r) => Drawable (Rectangle point) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: Rectangle point -> [Attribute action] -> View model action Source #

drawWith :: Rectangle point -> [Attribute action] -> [View model action] -> View model action Source #

(Drawable l, Drawable r) => Drawable (Either l r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: Either l r -> [Attribute action] -> View model action Source #

drawWith :: Either l r -> [Attribute action] -> [View model action] -> View model action Source #

(Drawable g, AllConstrained IpeToMisoAttr rs, ReifyConstraint ToMisoString (Attr f) rs, RMap rs, RecordToList rs, RecAll (Attr f) rs ToMisoString) => Drawable (g :+ Attributes f rs) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: (g :+ Attributes f rs) -> [Attribute action] -> View model action Source #

drawWith :: (g :+ Attributes f rs) -> [Attribute action] -> [View model action] -> View model action Source #

(Point_ point 2 r, EndPoint_ (endPoint point), IxValue (endPoint point) ~ point, ToMisoString r) => Drawable (LineSegment endPoint point) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: LineSegment endPoint point -> [Attribute action] -> View model action Source #

drawWith :: LineSegment endPoint point -> [Attribute action] -> [View model action] -> View model action Source #

ToMisoString r => Drawable (Point 2 r) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: Point 2 r -> [Attribute action] -> View model action Source #

drawWith :: Point 2 r -> [Attribute action] -> [View model action] -> View model action Source #

(Point_ point 2 r, ToMisoString r, Traversable1 f, Ixed (f point), IxValue (f point) ~ point, Index (f point) ~ Int, HasFromFoldable1 f, TraversableWithIndex Int f) => Drawable (PolyLineF f point) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: PolyLineF f point -> [Attribute action] -> View model action Source #

drawWith :: PolyLineF f point -> [Attribute action] -> [View model action] -> View model action Source #

(Point_ point 2 r, VertexContainer f point, HasFromFoldable1 f, ToMisoString r) => Drawable (ConvexPolygonF f point) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: ConvexPolygonF f point -> [Attribute action] -> View model action Source #

drawWith :: ConvexPolygonF f point -> [Attribute action] -> [View model action] -> View model action Source #

(Point_ point 2 r, VertexContainer f point, HasFromFoldable1 f, ToMisoString r) => Drawable (SimplePolygonF f point) Source # 
Instance details

Defined in HGeometry.Miso.Svg.Writer

Methods

draw :: SimplePolygonF f point -> [Attribute action] -> View model action Source #

drawWith :: SimplePolygonF f point -> [Attribute action] -> [View model action] -> View model action Source #

dPoint :: (Point_ point 2 r, ToMisoString r) => point -> [Attribute action] -> View model action Source #

Draw a point

dLineSegment :: (LineSegment_ lineSegment point, Point_ point 2 r, ToMisoString r) => lineSegment -> [Attribute action] -> View model action Source #

Draw a line segment

dRectangle :: (Rectangle_ rectangle point, Point_ point 2 r, ToMisoString r, Num r) => rectangle -> [Attribute action] -> View model action Source #

Draw a rectangle

dCircle :: (Point_ point 2 r, ToMisoString r) => Circle point -> [Attribute action] -> View model action Source #

Draw a circle

dDisk :: (Disk_ disk point, ConstructableBall_ disk point, Point_ point 2 r, ToMisoString r, Floating r) => disk -> [Attribute action] -> View model action Source #

Draw a disk

dPolyLine :: (PolyLine_ polyLine point, Point_ point 2 r, ToMisoString r) => polyLine -> [Attribute action] -> View model action Source #

Draw a polyline

dSimplePolygon :: (SimplePolygon_ simplePolygon point r, ToMisoString r) => simplePolygon -> [Attribute action] -> View model action Source #

Draw a simple polygon