wumpus-drawing-0.4.0: High-level drawing objects built on Wumpus-Basic.

Stabilityhighly unstable
MaintainerStephen Tetley <stephen.tetley@gmail.com>



Common core for shapes



data Shape t u Source

Shape is a record of three LocTheta functions - functions from Point and Angle to answer.

The shape_path_fun returns a path. When the Shape is drawn, the rendering function (strokedShape, etc.) uses the path for drawing and returns the polymorphic answer a of the shape_ans_fun. Lastly the shape_decoration function can instantiated to add decoration (e.g. text) to the Shape as it is rendered.

The a of the shape_ans_fun represents some concrete shape object (e.g. a Rectangle, Triangle etc.). Crucial for shape objects is that they support Anchors - this allows connectors to address specific locations on the Shape border so "node and link" diagrams can be made easily.

shapeMap :: (t u -> t' u) -> Shape t u -> Shape t' uSource

dblStrokedShape :: InterpretUnit u => Shape t u -> LocImage u (t u)Source

Note - this is simplistic double stroking - draw a background line with triple thickness and draw a white line on top.

I think this is what TikZ does, but it works better for TikZ where the extra thickness seems to be accounted for by the anchors. For Wumpus, arrows cut into the outside black line.

Probably Wumpus should calculate two paths instead.

roundCornerShapePath :: (Real u, Floating u, InterpretUnit u, Tolerance u) => u -> [Point2 u] -> Query u (AbsPath u)Source

Draw the shape path with round corners.

updatePathAngle :: (Radian -> Radian) -> Shape t u -> Shape t uSource

The path angle can be modified. This allows inverse versions of shapes (e.g. InvTriangle) to be made by wrapping a base Shape but rotating the path prior to drawing it.

Only the Path needs rotating, the decoration takes the original angle. The anchors are typically implemented by rotating the correspoding anchor of the wrapped Shape about its center.

data ShapeCTM u Source


Functor ShapeCTM 
(Ord u, Tolerance u) => Eq (ShapeCTM u) 
(Ord u, Tolerance u) => Ord (ShapeCTM u) 
Show u => Show (ShapeCTM u) 
(Real u, Floating u) => Rotate (ShapeCTM u) 
(Real u, Floating u) => RotateAbout (ShapeCTM u) 
Fractional u => Scale (ShapeCTM u) 
Num u => Translate (ShapeCTM u)