Rasterific-0.7.5.4: A pure haskell drawing engine.
Safe HaskellNone
LanguageHaskell2010

Graphics.Rasterific.PathWalker

Description

This module help the walking of path of any shape, being able to return the current position and the actual orientation.

Synopsis

Documentation

data PathWalkerT m a Source #

The walking transformer monad.

Instances

Instances details
MonadTrans PathWalkerT Source # 
Instance details

Defined in Graphics.Rasterific.PathWalker

Methods

lift :: Monad m => m a -> PathWalkerT m a #

Monad m => Monad (PathWalkerT m) Source # 
Instance details

Defined in Graphics.Rasterific.PathWalker

Methods

(>>=) :: PathWalkerT m a -> (a -> PathWalkerT m b) -> PathWalkerT m b #

(>>) :: PathWalkerT m a -> PathWalkerT m b -> PathWalkerT m b #

return :: a -> PathWalkerT m a #

Functor m => Functor (PathWalkerT m) Source # 
Instance details

Defined in Graphics.Rasterific.PathWalker

Methods

fmap :: (a -> b) -> PathWalkerT m a -> PathWalkerT m b #

(<$) :: a -> PathWalkerT m b -> PathWalkerT m a #

Monad m => Applicative (PathWalkerT m) Source # 
Instance details

Defined in Graphics.Rasterific.PathWalker

Methods

pure :: a -> PathWalkerT m a #

(<*>) :: PathWalkerT m (a -> b) -> PathWalkerT m a -> PathWalkerT m b #

liftA2 :: (a -> b -> c) -> PathWalkerT m a -> PathWalkerT m b -> PathWalkerT m c #

(*>) :: PathWalkerT m a -> PathWalkerT m b -> PathWalkerT m b #

(<*) :: PathWalkerT m a -> PathWalkerT m b -> PathWalkerT m a #

type PathWalker a = PathWalkerT Identity a Source #

Simpler alias if monad transformers are not needed.

type PathDrawer m px = Transformation -> PlaneBound -> DrawOrder px -> m () Source #

Callback function in charge to transform the DrawOrder given the transformation to place it on the path.

runPathWalking :: Monad m => Path -> PathWalkerT m a -> m a Source #

Create a path walker from a given path

advanceBy :: Monad m => Float -> PathWalkerT m () Source #

Advance by the given amount of pixels on the path.

currentPosition :: Monad m => PathWalkerT m (Maybe Point) Source #

Obtain the current position if we are still on the path, if not, return Nothing.

currentTangeant :: Monad m => PathWalkerT m (Maybe Vector) Source #

Obtain the current tangeant of the path if we're still on it. Return Nothing otherwise.

drawOrdersOnPath Source #

Arguments

:: Monad m 
=> PathDrawer m px

Function handling the placement of the order.

-> Float

Starting offset

-> Float

Baseline vertical position in the orders.

-> Path

Path on which to place the orders.

-> [DrawOrder px]

Orders to place on a path.

-> m () 

This function is the workhorse of the placement, it will walk the path and calculate the appropriate transformation for every order.