| Copyright | (C) Frank Staals |
|---|---|
| License | see the LICENSE file |
| Maintainer | Frank Staals |
| Safe Haskell | None |
| Language | GHC2024 |
HGeometry.Miso.Svg
Description
Render geometric objects to Svg files through miso
Synopsis
- renderSvgToFile :: OsPath -> View model action -> IO ()
- renderAsSvgText :: View model action -> Text
- renderAsSvgByteString :: View model action -> ByteString
- withAts :: ([Attribute action] -> View model action) -> [Attribute action] -> [Attribute action] -> View model action
- class Drawable t where
- dPoint :: (Point_ point 2 r, ToMisoString r) => point -> [Attribute action] -> View model action
- dLineSegment :: (LineSegment_ lineSegment point, Point_ point 2 r, ToMisoString r) => lineSegment -> [Attribute action] -> View model action
- dRectangle :: (Rectangle_ rectangle point, Point_ point 2 r, ToMisoString r, Num r) => rectangle -> [Attribute action] -> View model action
- dCircle :: (Point_ point 2 r, ToMisoString r) => Circle point -> [Attribute action] -> View model action
- dDisk :: (Disk_ disk point, ConstructableBall_ disk point, Point_ point 2 r, ToMisoString r, Floating r) => disk -> [Attribute action] -> View model action
- dPolyLine :: (PolyLine_ polyLine point, Point_ point 2 r, ToMisoString r) => polyLine -> [Attribute action] -> View model action
- dSimplePolygon :: (SimplePolygon_ simplePolygon point r, ToMisoString r) => simplePolygon -> [Attribute action] -> View model action
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
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
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