Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
Common core for shapes
- data Shape u a
- type DShape a = Shape Double a
- makeShape :: Num u => LocThetaCF u a -> LocThetaCF u (Path u) -> Shape u a
- strokedShape :: Num u => Shape u a -> LocImage u a
- filledShape :: Num u => Shape u a -> LocImage u a
- borderedShape :: Num u => Shape u a -> LocImage u a
- rstrokedShape :: Num u => Shape u a -> LocThetaImage u a
- rfilledShape :: Num u => Shape u a -> LocThetaImage u a
- rborderedShape :: Num u => Shape u a -> LocThetaImage u a
- roundCornerShapePath :: (Real u, Floating u, FromPtSize u) => [Point2 u] -> CF (Path u)
- updatePathAngle :: (Radian -> Radian) -> Shape u a -> Shape u a
- setDecoration :: LocThetaGraphic u -> Shape u a -> Shape u a
- data ShapeCTM u
- makeShapeCTM :: Num u => Point2 u -> Radian -> ShapeCTM u
- ctmCenter :: ShapeCTM u -> Point2 u
- ctmAngle :: ShapeCTM u -> Radian
- displaceCenter :: (Real u, Floating u) => Vec2 u -> ShapeCTM u -> Point2 u
Documentation
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.
makeShape :: Num u => LocThetaCF u a -> LocThetaCF u (Path u) -> Shape u aSource
strokedShape :: Num u => Shape u a -> LocImage u aSource
filledShape :: Num u => Shape u a -> LocImage u aSource
borderedShape :: Num u => Shape u a -> LocImage u aSource
rstrokedShape :: Num u => Shape u a -> LocThetaImage u aSource
rfilledShape :: Num u => Shape u a -> LocThetaImage u aSource
rborderedShape :: Num u => Shape u a -> LocThetaImage u aSource
roundCornerShapePath :: (Real u, Floating u, FromPtSize u) => [Point2 u] -> CF (Path u)Source
Draw the shape path with round corners.
updatePathAngle :: (Radian -> Radian) -> Shape u a -> Shape u aSource
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.
setDecoration :: LocThetaGraphic u -> Shape u a -> Shape u aSource