
Wumpus.Basic.Graphic  Portability  GHC  Stability  highly unstable  Maintainer  stephen.tetley@gmail.com 





Description 
Graphic type and opertations
** WARNING **  this module is highly experimental, and
may change significantly or even be dropped from future
revisions.


Synopsis 

type Graphic u = H (Primitive u)   type DGraphic = Graphic Double   type GraphicF u = Point2 u > Graphic u   type DGraphicF = GraphicF Double   cc :: (r1 > a > ans) > (r1 > r2 > a) > r1 > r2 > ans   supply :: u > (u > a) > a   drawGraphic :: (Real u, Floating u, FromPtSize u) => Graphic u > Maybe (Picture u)   drawGraphicU :: (Real u, Floating u, FromPtSize u) => Graphic u > Picture u   wrapG :: Primitive u > Graphic u   emptyG :: Graphic u   textline :: (TextLabel t, Num u) => t > String > GraphicF u   straightLine :: (Stroke t, Fractional u) => t > Vec2 u > GraphicF u   strokedRectangle :: (Stroke t, Fractional u) => t > u > u > GraphicF u   filledRectangle :: (Fill t, Fractional u) => t > u > u > GraphicF u   rectanglePath :: Num u => u > u > Point2 u > PrimPath u   strokedCircle :: (Stroke t, Floating u) => t > Int > u > GraphicF u   filledCircle :: (Fill t, Floating u) => t > Int > u > GraphicF u   disk :: (Ellipse t, Fractional u) => t > u > GraphicF u   type Point2T u = Point2 u > Point2 u   type DPoint2T = Point2T Double   positionWith :: Point2T u > (Point2 u > a) > Point2 u > a   disp :: Num u => u > u > Point2T u   vdisp :: Num u => u > Point2T u   hdisp :: Num u => u > Point2T u   data Rectangle u = Rectangle {}   type DRectangle = Rectangle Double   grid :: (Stroke t, RealFrac u) => t > u > u > Rectangle u > GraphicF u   border :: (Stroke t, Num u) => t > Rectangle u > GraphicF u   type RectangleLoc u = (Rectangle u, Point2 u)   type DRectangleLoc = RectangleLoc Double   withinRectangleLoc :: (Num u, Ord u) => Point2 u > RectangleLoc u > Bool 



Type aliases



Note  this representation allows for zero, one or more
Primitives to be collected together.








General combinators


cc :: (r1 > a > ans) > (r1 > r2 > a) > r1 > r2 > ans  Source 

Composition operator...
cc f g = \x y > f x (g x y)


supply :: u > (u > a) > a  Source 

Reverse application.


Operations



Note  a Picture cannot be empty whereas a Graphic can.
Hence this function returns via Maybe.



Unsafe version of drawGraphic  this function throws
an error when the graphic is empty.



Lift a Primitive to a Graphic



The empty graphic.


Graphic primitives



Text should not contain newlines.
Note the supplied point is the 'leftbaseline'.



Vector is applied to the point.



Supplied point is center.



Supplied point is center.



Supplied point is bottomleft.



strokedCircle : stroked_props * num_subs * radius > GraphicF
Draw a stroked circle made from Bezier curves. num_subs is
the number of subdivisions per quadrant.
The result is a HOF (GraphicF :: Point > Graphic) where the
point is the center.



filledCircle : fill_props * num_subs * radius > GraphicF
Draw a filled circle made from Bezier curves. num_subs is
the number of subdivisions per quadrant.
The result is a HOF (GraphicF :: Point > Graphic) where the
point is the center.



disk is drawn with WumpusCore's ellipse primitive.
This is a efficient representation of circles using
PostScript's arc or SVG's circle in the generated
output. However, strokedcircles do not draw well after
nonuniform scaling  the line width is scaled as well as
the shape.
For stroked circles that can be scaled, consider making the
circle from Bezier curves.


Displacement














Grid



Constructors  Rectangle   rect_width :: !u   rect_height :: !u  

 Instances  





grid : stroke_props * xstep * ystep * boundary_rect > GraphicF
The result is a HOF (GraphicF :: Point > Graphic) where the
point is bottomleft.



border : stroke_props * boundary_rect > GraphicF
The result is a HOF (GraphicF :: Point > Graphic) where the
point is bottomleft.








Produced by Haddock version 2.6.1 