-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Common drawing utilities built on wumpus-core. -- -- ** WARNING ** - this package is sub-alpha. It was released to Hackage -- prematurely - designing a higher-level drawing library turns out to be -- much more demanding than designing a low-level one (Wumpus-Core). -- -- A few of the modules (SafeFonts, SVGColours, X11Colours) are fairly -- stable others simply aren't and may even disappear in subsequent -- updates. -- -- Changelog: -- --
-- a `over` b ---- -- Place 'picture' a over b. The idea of over here is in terms -- z-ordering, nither picture a or b are actually moved. over :: (Num u, Ord u) => Picture u -> Picture u -> Picture u -- |
-- a `under` b ---- -- Similarly under draws the first picture behind the second but -- move neither. -- -- under was previously beneath. under :: (Num u, Ord u) => Picture u -> Picture u -> Picture u -- | Draw a centered over b - a is moved, b is static. -- --
-- a `centerOver` b ---- -- centerOver was previously the (-@-) operator. centerOver :: (Fractional u, Ord u) => Picture u -> Picture u -> Picture u -- |
-- a `nextToH` b ---- -- Horizontal composition - move b, placing it to the right of -- a. -- -- nextToH was previously the (->-) operator. nextToH :: (Num u, Ord u) => Picture u -> Picture u -> Picture u -- |
-- a `nextToV` b ---- -- Vertical composition - move b, placing it below a. -- -- nextToV was previously the (--) operator. nextToV :: (Num u, Ord u) => Picture u -> Picture u -> Picture u -- | Place the picture at the supplied point. -- -- atPoint was previous the at operator. atPoint :: (Num u, Ord u) => Picture u -> Point2 u -> Picture u -- | Center the picture at the supplied point. centeredAt :: (Fractional u, Ord u) => Picture u -> Point2 u -> Picture u -- |
-- xs `stackOver` x ---- -- Stack the list of pictures xs over x. -- -- Note, the first picture in the list is drawn at the top, all the -- pictures in the list are drawn 'over' x. No pictures are -- moved -- --
-- [p1,p2,p3] stackOver p4 => [p1,p2,p3,p4] --stackOver :: (Num u, Ord u) => [Picture u] -> Picture u -> Picture u -- |
-- x `zconcat` xs ---- -- Concatenate x over the list of pictures xs. -- -- x is drawn at the top. No pictures are moved. -- --
-- p1 zconcat [p2,p3,p4] => [p1,p2,p3,p4] --zconcat :: (Num u, Ord u) => Picture u -> [Picture u] -> Picture u -- | Concatenate the list pictures xs horizontally with -- nextToH starting at x. hcat :: (Num u, Ord u) => Picture u -> [Picture u] -> Picture u -- | Concatenate the list of pictures xs vertically with -- nextToV starting at x. vcat :: (Num u, Ord u) => Picture u -> [Picture u] -> Picture u -- | Stack pictures centered ontop of each other - the first picture in the -- list is drawn at the top, last picture is on drawn at the bottom. stackOverCenter :: (Fractional u, Ord u) => [Picture u] -> Picture u -> Picture u -- |
-- hspace n a b ---- -- Horizontal composition - move b, placing it to the right of -- a with a horizontal gap of n separating the -- pictures. hspace :: (Num u, Ord u) => u -> Picture u -> Picture u -> Picture u -- |
-- vspace n a b ---- -- Vertical composition - move b, placing it below a -- with a vertical gap of n separating the pictures. vspace :: (Num u, Ord u) => u -> Picture u -> Picture u -> Picture u -- |
-- hsep n x xs ---- -- Concatenate the list of pictures xs horizontally with -- hspace starting at x. The pictures are interspersed -- with spaces of n units. hsep :: (Num u, Ord u) => u -> Picture u -> [Picture u] -> Picture u -- |
-- vsep n x xs ---- -- Concatenate the list of pictures xs vertically with -- vspace starting at x. The pictures are interspersed -- with spaces of n units. vsep :: (Num u, Ord u) => u -> Picture u -> [Picture u] -> Picture u -- |
-- alignH align a b ---- -- Horizontal composition - move b, placing it to the right of -- a and align it with the top, center or bottom of a. alignH :: (Fractional u, Ord u) => HAlign -> Picture u -> Picture u -> Picture u -- |
-- alignV align a b ---- -- Vertical composition - move b, placing it below a -- and align it with the left, center or right of a. alignV :: (Fractional u, Ord u) => VAlign -> Picture u -> Picture u -> Picture u -- |
-- alignHSep align sep a b ---- -- Spacing version of alignH - move b to the right of a -- separated by sep units, align b according to -- align. alignHSep :: (Fractional u, Ord u) => HAlign -> u -> Picture u -> Picture u -> Picture u -- |
-- alignHSep align sep a b ---- -- Spacing version of alignV - move b below a separated -- by sep units, align b according to align. alignVSep :: (Fractional u, Ord u) => VAlign -> u -> Picture u -> Picture u -> Picture u -- | Variant of hcat that aligns the pictures as well as -- concatenating them. hcatA :: (Fractional u, Ord u) => HAlign -> Picture u -> [Picture u] -> Picture u -- | Variant of vcat that aligns the pictures as well as -- concatenating them. vcatA :: (Fractional u, Ord u) => VAlign -> Picture u -> [Picture u] -> Picture u -- | Variant of hsep that aligns the pictures as well as -- concatenating and spacing them. hsepA :: (Fractional u, Ord u) => HAlign -> u -> Picture u -> [Picture u] -> Picture u -- | Variant of vsep that aligns the pictures as well as -- concatenating and spacing them. vsepA :: (Fractional u, Ord u) => VAlign -> u -> Picture u -> [Picture u] -> Picture u instance Eq VAlign instance Show VAlign instance Eq HAlign instance Show HAlign -- | Version number module Wumpus.Basic.VersionNumber -- | Version number -- --
-- (0,8,0) --wumpus_basic_version :: (Int, Int, Int) -- | Turtle monad and monad transformer. -- -- The Turtle monad embodies the LOGO style of imperative drawing - -- sending commands to update the a cursor. -- -- While Wumpus generally aims for a more compositional, -- "coordinate-free" style of drawing, some types of diagram are more -- easily expressed in the LOGO style. module Wumpus.Basic.Monads.TurtleClass type Coord = (Int, Int) data TurtleConfig u TurtleConfig :: !u -> !u -> TurtleConfig u xstep :: TurtleConfig u -> !u ystep :: TurtleConfig u -> !u regularConfig :: u -> TurtleConfig u class (Monad m) => TurtleM m getLoc :: (TurtleM m) => m (Int, Int) setLoc :: (TurtleM m) => (Int, Int) -> m () getOrigin :: (TurtleM m) => m (Int, Int) setOrigin :: (TurtleM m) => (Int, Int) -> m () class (TurtleM m) => TurtleScaleM m u | m -> u xStep :: (TurtleScaleM m u) => m u yStep :: (TurtleScaleM m u) => m u askSteps :: (TurtleScaleM m u) => m (u, u) setsLoc :: (TurtleM m) => (Coord -> (a, Coord)) -> m a setsLoc_ :: (TurtleM m) => (Coord -> Coord) -> m () resetLoc :: (TurtleM m) => m () moveLeft :: (TurtleM m) => m () moveRight :: (TurtleM m) => m () moveUp :: (TurtleM m) => m () moveDown :: (TurtleM m) => m () nextLine :: (TurtleM m) => m () getPos :: (TurtleScaleM m u, Num u) => m (Point2 u) scaleCoord :: (TurtleScaleM m u, Num u) => (Int, Int) -> m (Point2 u) instance (Eq u) => Eq (TurtleConfig u) instance (Show u) => Show (TurtleConfig u) -- | Safe to use fonts. module Wumpus.Basic.SafeFonts -- | Times-Roman timesRoman :: FontFace -- | Times Italic timesItalic :: FontFace -- | Times Bold timesBold :: FontFace -- | Times Bold Italic timesBoldItalic :: FontFace -- | Helvetica helvetica :: FontFace -- | Helvetica Oblique helveticaOblique :: FontFace -- | Helvetica Bold helveticaBold :: FontFace -- | Helvetica Bold Oblique helveticaBoldOblique :: FontFace -- | Courier courier :: FontFace -- | Courier Oblique courierOblique :: FontFace -- | Courier Bold courierBold :: FontFace -- | Courier Bold Oblique courierBoldOblique :: FontFace -- | Symbol -- -- Note - Symbol does not appear to be well supported by some SVG -- renders. Seemingly Chrome is fine but Firefox defaults to some serif -- font. symbol :: FontFace -- | Hughes list, ... module Wumpus.Basic.Utils.HList type H a = [a] -> [a] emptyH :: H a wrapH :: a -> H a consH :: a -> H a -> H a snocH :: H a -> a -> H a appendH :: H a -> H a -> H a unfoldrH :: (b -> Maybe (a, b)) -> b -> H a -- | velo consumes the list as per map, but builds it back as a Hughes list -- - so items can be dropped replaced, repeated, etc... veloH :: (a -> H b) -> [a] -> H b concatH :: [H a] -> H a toListH :: H a -> [a] fromListH :: [a] -> H a -- | The X11 'named colours', as rgb [0,1] values module Wumpus.Basic.Colour.X11Colours antique_white1 :: RGBi antique_white2 :: RGBi antique_white3 :: RGBi antique_white4 :: RGBi aquamarine1 :: RGBi aquamarine2 :: RGBi aquamarine3 :: RGBi aquamarine4 :: RGBi azure1 :: RGBi azure2 :: RGBi azure3 :: RGBi azure4 :: RGBi bisque1 :: RGBi bisque2 :: RGBi bisque3 :: RGBi bisque4 :: RGBi blue1 :: RGBi blue2 :: RGBi blue3 :: RGBi blue4 :: RGBi brown1 :: RGBi brown2 :: RGBi brown3 :: RGBi brown4 :: RGBi burlywood1 :: RGBi burlywood2 :: RGBi burlywood3 :: RGBi burlywood4 :: RGBi cadet_blue1 :: RGBi cadet_blue2 :: RGBi cadet_blue3 :: RGBi cadet_blue4 :: RGBi chartreuse1 :: RGBi chartreuse2 :: RGBi chartreuse3 :: RGBi chartreuse4 :: RGBi chocolate1 :: RGBi chocolate2 :: RGBi chocolate3 :: RGBi chocolate4 :: RGBi coral1 :: RGBi coral2 :: RGBi coral3 :: RGBi coral4 :: RGBi cornsilk1 :: RGBi cornsilk2 :: RGBi cornsilk3 :: RGBi cornsilk4 :: RGBi cyan1 :: RGBi cyan2 :: RGBi cyan3 :: RGBi cyan4 :: RGBi dark_goldenrod1 :: RGBi dark_goldenrod2 :: RGBi dark_goldenrod3 :: RGBi dark_goldenrod4 :: RGBi dark_olive_green1 :: RGBi dark_olive_green2 :: RGBi dark_olive_green3 :: RGBi dark_olive_green4 :: RGBi dark_orange1 :: RGBi dark_orange2 :: RGBi dark_orange3 :: RGBi dark_orange4 :: RGBi dark_orchid1 :: RGBi dark_orchid2 :: RGBi dark_orchid3 :: RGBi dark_orchid4 :: RGBi dark_sea_green1 :: RGBi dark_sea_green2 :: RGBi dark_sea_green3 :: RGBi dark_sea_green4 :: RGBi dark_slate_gray1 :: RGBi dark_slate_gray2 :: RGBi dark_slate_gray3 :: RGBi dark_slate_gray4 :: RGBi deep_pink1 :: RGBi deep_pink2 :: RGBi deep_pink3 :: RGBi deep_pink4 :: RGBi deep_sky_blue1 :: RGBi deep_sky_blue2 :: RGBi deep_sky_blue3 :: RGBi deep_sky_blue4 :: RGBi dodger_blue1 :: RGBi dodger_blue2 :: RGBi dodger_blue3 :: RGBi dodger_blue4 :: RGBi firebrick1 :: RGBi firebrick2 :: RGBi firebrick3 :: RGBi firebrick4 :: RGBi gold1 :: RGBi gold2 :: RGBi gold3 :: RGBi gold4 :: RGBi goldenrod1 :: RGBi goldenrod2 :: RGBi goldenrod3 :: RGBi goldenrod4 :: RGBi green1 :: RGBi green2 :: RGBi green3 :: RGBi green4 :: RGBi honeydew1 :: RGBi honeydew2 :: RGBi honeydew3 :: RGBi honeydew4 :: RGBi hot_pink1 :: RGBi hot_pink2 :: RGBi hot_pink3 :: RGBi hot_pink4 :: RGBi indian_red1 :: RGBi indian_red2 :: RGBi indian_red3 :: RGBi indian_red4 :: RGBi ivory1 :: RGBi ivory2 :: RGBi ivory3 :: RGBi ivory4 :: RGBi khaki1 :: RGBi khaki2 :: RGBi khaki3 :: RGBi khaki4 :: RGBi lavender_blush1 :: RGBi lavender_blush2 :: RGBi lavender_blush3 :: RGBi lavender_blush4 :: RGBi lemon_chiffon1 :: RGBi lemon_chiffon2 :: RGBi lemon_chiffon3 :: RGBi lemon_chiffon4 :: RGBi light_blue1 :: RGBi light_blue2 :: RGBi light_blue3 :: RGBi light_blue4 :: RGBi light_cyan1 :: RGBi light_cyan2 :: RGBi light_cyan3 :: RGBi light_cyan4 :: RGBi light_goldenrod1 :: RGBi light_goldenrod2 :: RGBi light_goldenrod3 :: RGBi light_goldenrod4 :: RGBi light_pink1 :: RGBi light_pink2 :: RGBi light_pink3 :: RGBi light_pink4 :: RGBi light_salmon1 :: RGBi light_salmon2 :: RGBi light_salmon3 :: RGBi light_salmon4 :: RGBi light_sky_blue1 :: RGBi light_sky_blue2 :: RGBi light_sky_blue3 :: RGBi light_sky_blue4 :: RGBi light_steel_blue1 :: RGBi light_steel_blue2 :: RGBi light_steel_blue3 :: RGBi light_steel_blue4 :: RGBi light_yellow1 :: RGBi light_yellow2 :: RGBi light_yellow3 :: RGBi light_yellow4 :: RGBi magenta1 :: RGBi magenta2 :: RGBi magenta3 :: RGBi magenta4 :: RGBi maroon1 :: RGBi maroon2 :: RGBi maroon3 :: RGBi maroon4 :: RGBi medium_orchid1 :: RGBi medium_orchid2 :: RGBi medium_orchid3 :: RGBi medium_orchid4 :: RGBi medium_purple1 :: RGBi medium_purple2 :: RGBi medium_purple3 :: RGBi medium_purple4 :: RGBi misty_rose1 :: RGBi misty_rose2 :: RGBi misty_rose3 :: RGBi misty_rose4 :: RGBi navajo_white1 :: RGBi navajo_white2 :: RGBi navajo_white3 :: RGBi navajo_white4 :: RGBi olive_drab1 :: RGBi olive_drab2 :: RGBi olive_drab3 :: RGBi olive_drab4 :: RGBi orange1 :: RGBi orange2 :: RGBi orange3 :: RGBi orange4 :: RGBi orange_red1 :: RGBi orange_red2 :: RGBi orange_red3 :: RGBi orange_red4 :: RGBi orchid1 :: RGBi orchid2 :: RGBi orchid3 :: RGBi orchid4 :: RGBi pale_green1 :: RGBi pale_green2 :: RGBi pale_green3 :: RGBi pale_green4 :: RGBi pale_turquoise1 :: RGBi pale_turquoise2 :: RGBi pale_turquoise3 :: RGBi pale_turquoise4 :: RGBi pale_violet_red1 :: RGBi pale_violet_red2 :: RGBi pale_violet_red3 :: RGBi pale_violet_red4 :: RGBi peach_puff1 :: RGBi peach_puff2 :: RGBi peach_puff3 :: RGBi peach_puff4 :: RGBi pink1 :: RGBi pink2 :: RGBi pink3 :: RGBi pink4 :: RGBi plum1 :: RGBi plum2 :: RGBi plum3 :: RGBi plum4 :: RGBi purple1 :: RGBi purple2 :: RGBi purple3 :: RGBi purple4 :: RGBi red1 :: RGBi red2 :: RGBi red3 :: RGBi red4 :: RGBi rosy_brown1 :: RGBi rosy_brown2 :: RGBi rosy_brown3 :: RGBi rosy_brown4 :: RGBi royal_blue1 :: RGBi royal_blue2 :: RGBi royal_blue3 :: RGBi royal_blue4 :: RGBi salmon1 :: RGBi salmon2 :: RGBi salmon3 :: RGBi salmon4 :: RGBi sea_green1 :: RGBi sea_green2 :: RGBi sea_green3 :: RGBi sea_green4 :: RGBi seashell1 :: RGBi seashell2 :: RGBi seashell3 :: RGBi seashell4 :: RGBi sienna1 :: RGBi sienna2 :: RGBi sienna3 :: RGBi sienna4 :: RGBi sky_blue1 :: RGBi sky_blue2 :: RGBi sky_blue3 :: RGBi sky_blue4 :: RGBi slate_blue1 :: RGBi slate_blue2 :: RGBi slate_blue3 :: RGBi slate_blue4 :: RGBi slate_gray1 :: RGBi slate_gray2 :: RGBi slate_gray3 :: RGBi slate_gray4 :: RGBi snow1 :: RGBi snow2 :: RGBi snow3 :: RGBi snow4 :: RGBi spring_green1 :: RGBi spring_green2 :: RGBi spring_green3 :: RGBi spring_green4 :: RGBi steel_blue1 :: RGBi steel_blue2 :: RGBi steel_blue3 :: RGBi steel_blue4 :: RGBi tan1 :: RGBi tan2 :: RGBi tan3 :: RGBi tan4 :: RGBi thistle1 :: RGBi thistle2 :: RGBi thistle3 :: RGBi thistle4 :: RGBi tomato1 :: RGBi tomato2 :: RGBi tomato3 :: RGBi tomato4 :: RGBi turquoise1 :: RGBi turquoise2 :: RGBi turquoise3 :: RGBi turquoise4 :: RGBi violet_red1 :: RGBi violet_red2 :: RGBi violet_red3 :: RGBi violet_red4 :: RGBi wheat1 :: RGBi wheat2 :: RGBi wheat3 :: RGBi wheat4 :: RGBi yellow1 :: RGBi yellow2 :: RGBi yellow3 :: RGBi yellow4 :: RGBi -- | The SVG 'named colours', as rgb [0,1] values module Wumpus.Basic.Colour.SVGColours alice_blue :: RGBi antique_white :: RGBi aqua :: RGBi aquamarine :: RGBi azure :: RGBi beige :: RGBi bisque :: RGBi black :: RGBi blanched_almond :: RGBi blue :: RGBi blue_violet :: RGBi brown :: RGBi burlywood :: RGBi cadet_blue :: RGBi chartreuse :: RGBi chocolate :: RGBi coral :: RGBi cornflower_blue :: RGBi cornsilk :: RGBi crimson :: RGBi cyan :: RGBi dark_blue :: RGBi dark_cyan :: RGBi dark_goldenrod :: RGBi dark_gray :: RGBi dark_green :: RGBi dark_grey :: RGBi dark_khaki :: RGBi dark_magenta :: RGBi dark_olive_green :: RGBi dark_orange :: RGBi dark_orchid :: RGBi dark_red :: RGBi dark_salmon :: RGBi dark_sea_green :: RGBi dark_slate_blue :: RGBi dark_slate_gray :: RGBi dark_slate_grey :: RGBi dark_turquoise :: RGBi dark_violet :: RGBi deep_pink :: RGBi deep_sky_blue :: RGBi dim_gray :: RGBi dim_grey :: RGBi dodger_blue :: RGBi firebrick :: RGBi floral_white :: RGBi forest_green :: RGBi fuchsia :: RGBi gainsboro :: RGBi ghost_white :: RGBi gold :: RGBi goldenrod :: RGBi gray :: RGBi grey :: RGBi green :: RGBi green_yellow :: RGBi honeydew :: RGBi hot_pink :: RGBi indian_red :: RGBi indigo :: RGBi ivory :: RGBi khaki :: RGBi lavender :: RGBi lavender_blush :: RGBi lawn_green :: RGBi lemon_chiffon :: RGBi light_blue :: RGBi light_coral :: RGBi light_cyan :: RGBi light_goldenrod_yellow :: RGBi light_gray :: RGBi light_green :: RGBi light_grey :: RGBi light_pink :: RGBi light_salmon :: RGBi light_sea_green :: RGBi light_sky_blue :: RGBi light_slate_gray :: RGBi light_slate_grey :: RGBi light_steel_blue :: RGBi light_yellow :: RGBi lime :: RGBi lime_green :: RGBi linen :: RGBi magenta :: RGBi maroon :: RGBi medium_aquamarine :: RGBi medium_blue :: RGBi medium_orchid :: RGBi medium_purple :: RGBi medium_sea_green :: RGBi medium_slate_blue :: RGBi medium_spring_green :: RGBi medium_turquoise :: RGBi medium_violet_red :: RGBi midnight_blue :: RGBi mintcream :: RGBi mistyrose :: RGBi moccasin :: RGBi navajo_white :: RGBi navy :: RGBi old_lace :: RGBi olive :: RGBi olive_drab :: RGBi orange :: RGBi orange_red :: RGBi orchid :: RGBi pale_goldenrod :: RGBi pale_green :: RGBi pale_turquoise :: RGBi pale_violet_red :: RGBi papaya_whip :: RGBi peach_puff :: RGBi peru :: RGBi pink :: RGBi plum :: RGBi powder_blue :: RGBi purple :: RGBi red :: RGBi rosy_brown :: RGBi royal_blue :: RGBi saddle_brown :: RGBi salmon :: RGBi sandy_brown :: RGBi sea_green :: RGBi seashell :: RGBi sienna :: RGBi silver :: RGBi sky_blue :: RGBi slate_blue :: RGBi slate_gray :: RGBi slate_grey :: RGBi snow :: RGBi spring_green :: RGBi steel_blue :: RGBi tan :: RGBi teal :: RGBi thistle :: RGBi tomato :: RGBi turquoise :: RGBi violet :: RGBi wheat :: RGBi white :: RGBi whitesmoke :: RGBi yellow :: RGBi yellow_green :: RGBi -- | Drawing attributes -- -- ** WARNING ** - this module needs systematic naming schemes both for -- update functions (primaryColour, ...) and for synthesized selectors -- (e.g. lowerxHeight). The current names will change. module Wumpus.Basic.Graphic.DrawingContext data DrawingContext DrawingContext :: StrokeAttr -> FontAttr -> RGBi -> RGBi -> DrawingContext stroke_props :: DrawingContext -> StrokeAttr font_props :: DrawingContext -> FontAttr primary_colour :: DrawingContext -> RGBi secondary_colour :: DrawingContext -> RGBi standardContext :: FontSize -> DrawingContext textAttr :: DrawingContext -> (RGBi, FontAttr) -- | A Mark is consider to be the height of a lowercase letter in the -- current font. -- -- Note better to use xlowerHeight markHeight :: (FromPtSize u) => DrawingContext -> u -- | Height of a lower case 'x' in Courier. -- -- 'x' has no ascenders or descenders. lowerxHeight :: (FromPtSize u) => DrawingContext -> u -- | textDimensions : text -> DrawingContext -> (width,height) textDimensions :: (FromPtSize u) => String -> DrawingContext -> (u, u) thick :: DrawingContext -> DrawingContext ultrathick :: DrawingContext -> DrawingContext thin :: DrawingContext -> DrawingContext dashPattern :: DashPattern -> DrawingContext -> DrawingContext fontsize :: Int -> DrawingContext -> DrawingContext fontface :: FontFace -> DrawingContext -> DrawingContext swapColours :: DrawingContext -> DrawingContext primaryColour :: RGBi -> DrawingContext -> DrawingContext secondaryColour :: RGBi -> DrawingContext -> DrawingContext instance Eq DrawingContext instance Show DrawingContext -- | Base types for Drawing Objects, Graphics / Images (a Graphic that also -- returns an answer), etc. -- -- ** WARNING ** - some names are expected to change particularly the -- naming of the append and concat functions. module Wumpus.Basic.Graphic.BaseTypes -- | Graphics objects, even simple ones (line, arrow, dot) might need more -- than one primitive (path or text label) for their construction. Hence, -- the primary representation that all the others are built upon must -- support concatenation of primitives. -- -- Wumpus-Core has a type Picture - made from one or more Primitives - -- but Pictures include support for affine frames. For drawing many -- simple graphics (dots, connector lines...) that do not need individual -- affine transformations this is a penalty. A list of Primitives is -- therefore more suitable representation, and a Hughes list which -- supports efficient concatenation is wise. data HPrim u hprimToList :: HPrim u -> [PrimElement u] singleH :: PrimElement u -> HPrim u -- | Point transformation function. type Point2F u = Point2 u -> Point2 u type DPoint2F = Point2F Double -- | Drawings in Wumpus-Basic have an implicit graphics state the -- DrawingContext, the most primitive building block is a -- function from the DrawingContext to some polymorphic answer. -- -- This functional type is represented concretely as DrawingF. -- --
-- DrawingF :: DrawingContext -> a --data DrawingF a type LocDrawingF u a = Point2 u -> DrawingF a type DLocDrawingF a = LocDrawingF Double a -- | Run a Drawing Function with the supplied Drawing -- Context. runDF :: DrawingContext -> DrawingF a -> a -- | Wrap a value into a DrawingF. -- -- Note the value is pure it does depend on the DrawingContext (it -- is context free). pureDF :: a -> DrawingF a askDF :: DrawingF DrawingContext asksDF :: (DrawingContext -> a) -> DrawingF a localDF :: (DrawingContext -> DrawingContext) -> DrawingF a -> DrawingF a type Graphic u = DrawingF (HPrim u) type DGraphic = Graphic Double runGraphic :: DrawingContext -> Graphic u -> HPrim u xlinkGraphic :: XLink -> Graphic u -> Graphic u -- | Commonly graphics take a start point as well as a drawing context. -- -- Here they are called a LocGraphic - graphic with a (starting) -- location. type LocGraphic u = Point2 u -> Graphic u type DLocGraphic = LocGraphic Double localLG :: (DrawingContext -> DrawingContext) -> LocGraphic u -> LocGraphic u -- | Composition operator for LocGraphic - both LocGraphics are drawn at -- the same origin and the results concatenated. lgappend :: LocGraphic u -> LocGraphic u -> LocGraphic u -- | Images return a value as well as drawing. A node is a typical -- example - nodes are drawing but the also support taking anchor points. type Image u a = DrawingF (a, HPrim u) type DImage a = Image Double a type LocImage u a = Point2 u -> Image u a type DLocImage a = LocImage Double a runImage :: DrawingContext -> Image u a -> (a, HPrim u) intoImage :: DrawingF a -> Graphic u -> Image u a intoLocImage :: LocDrawingF u a -> LocGraphic u -> LocImage u a xlinkImage :: XLink -> Image u a -> Image u a type ConnDrawingF u a = Point2 u -> Point2 u -> DrawingF a type DConnDrawingF a = ConnDrawingF Double a -- | ConnGraphic is a connector drawn between two points contructing a -- Graphic. type ConnGraphic u = Point2 u -> Point2 u -> Graphic u type DConnGraphic = ConnGraphic Double -- | ConImage is a connector drawn between two points constructing an -- Image. type ConnImage u a = Point2 u -> Point2 u -> Image u a type DConnImage a = ConnImage Double a intoConnImage :: ConnDrawingF u a -> ConnGraphic u -> ConnImage u a instance Monad DrawingF instance Applicative DrawingF instance (Monoid a) => Monoid (DrawingF a) instance Functor DrawingF instance Monoid (HPrim u) -- | Base classes and type families. -- -- Drawing is always built on TraceM and DrawingCtxM, it may use -- PointSupplyM for chains or turtle drawing. module Wumpus.Basic.Graphic.BaseClasses -- | Collect elementary graphics as part of a larger drawing. -- -- TraceM works much like a writer monad. class (Monad m) => TraceM m :: (* -> *) trace :: (TraceM m) => HPrim (MonUnit m) -> m () class (Monad m) => DrawingCtxM m :: (* -> *) askCtx :: (DrawingCtxM m) => m DrawingContext localCtx :: (DrawingCtxM m) => (DrawingContext -> DrawingContext) -> m a -> m a -- | Project a value out of a context. asksCtx :: (DrawingCtxM m) => (DrawingContext -> a) -> m a -- | A monad that supplies points, e.g. a turtle monad. class (Monad m) => PointSupplyM m :: (* -> *) position :: (PointSupplyM m, u ~ (MonUnit m)) => m (Point2 u) -- | Supply points in an iterated chain. module Wumpus.Basic.Graphic.Chain data ChainT u m a runChainT :: (Monad m) => Point2F u -> Point2 u -> ChainT u m a -> m a horizontal :: (Num u, Monad m) => Point2 u -> u -> ChainT u m a -> m a instance (Monad m, DrawingCtxM m) => DrawingCtxM (ChainT u m) instance (u ~ MonUnit m, Monad m, TraceM m) => TraceM (ChainT u m) instance (Monad m) => PointSupplyM (ChainT u m) instance (Monad m) => Monad (ChainT u m) instance (Monad m) => Applicative (ChainT u m) instance (Monad m) => Functor (ChainT u m) -- | Drawing with trace - a Writer like monad collecting -- intermediate graphics - and drawing context - a reader monad of -- attributes - font_face, fill_colour etc. module Wumpus.Basic.Graphic.Drawing data Drawing u a data DrawingT u m a runDrawing :: DrawingContext -> Drawing u a -> (a, HPrim u) execDrawing :: DrawingContext -> Drawing u a -> HPrim u runDrawingT :: (Monad m) => DrawingContext -> DrawingT u m a -> m (a, HPrim u) execDrawingT :: (Monad m) => DrawingContext -> DrawingT u m a -> m (HPrim u) -- | Run the Drawing generating a Picture within a "font delta -- context" using the font-family and font-size from the intial -- DrawingContext. -- -- Using a font delta context can reduce the code size of the -- generated SVG file (PostScript ignores the FDC). runFdcDrawing :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Drawing u a -> (a, Maybe (Picture u)) -- | exec version of runFdcContext. execFdcDrawing :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Drawing u a -> Maybe (Picture u) -- | Transformer version of runFdcDrawing. runFdcDrawingT :: (Real u, Floating u, FromPtSize u, Monad m) => DrawingContext -> DrawingT u m a -> m (a, Maybe (Picture u)) -- | Transformer version of execFdcDrawing. execFdcDrawingT :: (Real u, Floating u, FromPtSize u, Monad m) => DrawingContext -> DrawingT u m a -> m (Maybe (Picture u)) -- | Unsafe promotion of HPrim to Picture. -- -- If the HPrim is empty, a run-time error is thrown. liftToPictureU :: (Real u, Floating u, FromPtSize u) => HPrim u -> Picture u -- | Safe promotion of HPrim to (Maybe Picture). -- -- If the HPrim is empty, then Nothing is returned. liftToPictureMb :: (Real u, Floating u, FromPtSize u) => HPrim u -> Maybe (Picture u) -- | Unsafe promotion of (Maybe Picture) to -- Picture. -- -- This is equivalent to: -- --
-- fromMaybe (error "empty") $ pic ---- -- This function is solely a convenience, using it saves one import and a -- few characters. -- -- If the supplied value is Nothing a run-time error is thrown. mbPictureU :: (Real u, Floating u, FromPtSize u) => Maybe (Picture u) -> Picture u -- | Draw a Graphic taking the drawing style from the drawing -- context. -- -- This operation is analogeous to tell in a Writer monad. draw :: (TraceM m, DrawingCtxM m, u ~ (MonUnit m)) => Graphic u -> m () -- | Hyperlink version of draw. xdraw :: (TraceM m, DrawingCtxM m, u ~ (MonUnit m)) => XLink -> Graphic u -> m () -- | Draw an Image taking the drawing style from the drawing -- context. -- -- The graphic representation of the Image is drawn in the Trace monad, -- and the result is returned. drawi :: (TraceM m, DrawingCtxM m, u ~ (MonUnit m)) => Image u a -> m a -- | Hyperlink version of drawi. xdrawi :: (TraceM m, DrawingCtxM m, u ~ (MonUnit m)) => XLink -> Image u a -> m a at :: LocGraphic u -> Point2 u -> Graphic u ati :: LocImage u a -> Point2 u -> Image u a conn :: ConnImage u a -> Point2 u -> LocImage u a node :: (TraceM m, DrawingCtxM m, PointSupplyM m, u ~ (MonUnit m)) => LocGraphic u -> m () nodei :: (TraceM m, DrawingCtxM m, PointSupplyM m, u ~ (MonUnit m)) => LocImage u a -> m a instance (Monad m) => DrawingCtxM (DrawingT u m) instance DrawingCtxM (Drawing u) instance (Monad m) => TraceM (DrawingT u m) instance TraceM (Drawing u) instance (Monad m) => Monad (DrawingT u m) instance Monad (Drawing u) instance (Monad m) => Applicative (DrawingT u m) instance Applicative (Drawing u) instance (Monad m) => Functor (DrawingT u m) instance Functor (Drawing u) -- | Elementary functions for the Graphic and LocGraphic types. -- -- The functions here are generally analogeous to the Picture API in -- Wumpus.Core, but here they exploit the implicit -- DrawingContext. module Wumpus.Basic.Graphic.PrimGraphic drawGraphic :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Graphic u -> Maybe (Picture u) drawGraphicU :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Graphic u -> Picture u openStroke :: (Num u) => PrimPath u -> Graphic u closedStroke :: (Num u) => PrimPath u -> Graphic u filledPath :: (Num u) => PrimPath u -> Graphic u borderedPath :: (Num u) => PrimPath u -> Graphic u textline :: (Num u) => String -> LocGraphic u hkernline :: (Num u) => [KerningChar u] -> LocGraphic u vkernline :: (Num u) => [KerningChar u] -> LocGraphic u strokedEllipse :: (Num u) => u -> u -> LocGraphic u filledEllipse :: (Num u) => u -> u -> LocGraphic u borderedEllipse :: (Num u) => u -> u -> LocGraphic u -- | Supplying a point to a CFGraphic takes it to a regular -- Graphic. supplyPt :: Point2 u -> LocGraphic u -> Graphic u localPoint :: (Point2 u -> Point2 u) -> LocGraphic u -> LocGraphic u displace :: (Num u) => u -> u -> Point2 u -> Point2 u straightLine :: (Fractional u) => Vec2 u -> LocGraphic u -- | Supplied point is bottom left. strokedRectangle :: (Fractional u) => u -> u -> LocGraphic u -- | Supplied point is bottom left. filledRectangle :: (Fractional u) => u -> u -> LocGraphic u -- | Supplied point is bottom left. borderedRectangle :: (Fractional u) => u -> u -> LocGraphic u -- | Supplied point is center. Circle is drawn with Bezier curves. strokedCircle :: (Floating u) => Int -> u -> LocGraphic u -- | Supplied point is center. Circle is drawn with Bezier curves. filledCircle :: (Floating u) => Int -> u -> LocGraphic u -- | Supplied point is center. Circle is drawn with Bezier curves. borderedCircle :: (Floating u) => Int -> u -> LocGraphic u -- | disk is drawn with Wumpus-Core's ellipse primitive. -- -- This is a efficient representation of circles using PostScript's -- arc or SVG's circle in the generated output. -- However, stroked-circles do not draw well after non-uniform 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. strokedDisk :: (Num u) => u -> LocGraphic u filledDisk :: (Num u) => u -> LocGraphic u borderedDisk :: (Num u) => u -> LocGraphic u -- | Intersection of line to line and line to plane module Wumpus.Basic.Utils.Intersection data LineSegment u LS :: (Point2 u) -> (Point2 u) -> LineSegment u data PointSlope u pointSlope :: (Fractional u) => Point2 u -> Radian -> PointSlope u -- | Line in equational form, i.e. Ax + By + C = 0. data LineEqn u lineEqn :: (Num u) => Point2 u -> Point2 u -> LineEqn u toLineEqn :: (Num u) => PointSlope u -> LineEqn u findIntersect :: (Floating u, Real u, Ord u) => Point2 u -> Radian -> [LineSegment u] -> Maybe (Point2 u) intersection :: (Fractional u, Ord u) => LineSegment u -> LineEqn u -> Maybe (Point2 u) rectangleLines :: (Num u) => Point2 u -> u -> u -> [LineSegment u] -- | Calculate the counter-clockwise angle between two points and the -- x-axis. langle :: (Floating u, Real u) => Point2 u -> Point2 u -> Radian instance (Eq u) => Eq (IntersectionResult u) instance (Show u) => Show (IntersectionResult u) instance (Eq u) => Eq (LineEqn u) instance (Show u) => Show (LineEqn u) instance (Eq u) => Eq (PointSlope u) instance (Show u) => Show (PointSlope u) instance (Eq u) => Eq (LineSegment u) instance (Ord u) => Ord (LineSegment u) instance (Show u) => Show (LineSegment u) -- | Extended path type - more amenable for complex drawings than the type -- in Wumpus-Core. -- -- ** WARNING ** this module is an experiment, and may change -- significantly or even be dropped from future revisions. module Wumpus.Basic.Paths.Base type PathF u = Point2 u -> Point2 u -> Path u data Path u Path :: u -> Seq (PathSeg u) -> Path u path_length :: Path u -> u path_elements :: Path u -> Seq (PathSeg u) data PathSeg u LineSeg :: u -> (Line u) -> PathSeg u CurveSeg :: u -> (Curve u) -> PathSeg u data Curve u Curve :: Point2 u -> Point2 u -> Point2 u -> Point2 u -> Curve u curve_start :: Curve u -> Point2 u ctrl_point1 :: Curve u -> Point2 u ctrl_point2 :: Curve u -> Point2 u curve_end :: Curve u -> Point2 u data Line u Line :: Point2 u -> Point2 u -> Line u line_start :: Line u -> Point2 u line_end :: Line u -> Point2 u emptyPath :: (Num u) => Path u pline :: (Floating u) => Point2 u -> Point2 u -> PathSeg u pcurve :: (Floating u, Ord u) => Point2 u -> Point2 u -> Point2 u -> Point2 u -> PathSeg u addSegment :: (Num u) => Path u -> PathSeg u -> Path u segmentLength :: PathSeg u -> u segmentStart :: PathSeg u -> Point2 u segmentEnd :: PathSeg u -> Point2 u -- | Turn a BasicPath into an ordinary Path. -- -- An empty path returns Nothing - the path representation in Wumpus-Core -- does not allow empty paths - a path must always have at least start -- point. -- -- Assumes path is properly formed - i.e. end point of one segment is the -- same point as the start point of the next segment. toPrimPath :: Path u -> Maybe (PrimPath u) toPrimPathU :: Path u -> PrimPath u -- | Curve subdivision via de Casteljau's algorithm. subdivide :: (Fractional u) => Curve u -> (Curve u, Curve u) -- | subdivide with an affine weight along the line... subdividet :: (Real u) => u -> Curve u -> (Curve u, Curve u) instance (Eq u) => Eq (Line u) instance (Ord u) => Ord (Line u) instance (Show u) => Show (Line u) instance (Eq u) => Eq (Curve u) instance (Ord u) => Ord (Curve u) instance (Show u) => Show (Curve u) instance (Eq u) => Eq (PathSeg u) instance (Ord u) => Ord (PathSeg u) instance (Show u) => Show (PathSeg u) instance (Eq u) => Eq (Path u) instance (Ord u) => Ord (Path u) instance (Show u) => Show (Path u) -- | Build paths. -- -- ** WARNING ** this module is an experiment, and may change -- significantly or even be dropped from future revisions. module Wumpus.Basic.Paths.Construction data MPath u a type CPath u = MPath u () runPath :: (Num u) => Point2 u -> MPath u a -> (a, Path u) execPath :: (Num u) => Point2 u -> MPath u a -> Path u lineto :: (Floating u) => Point2 u -> CPath u bezierto :: (Floating u, Ord u) => Point2 u -> Point2 u -> Point2 u -> CPath u curveto :: (Floating u, Ord u) => Radian -> Radian -> Point2 u -> CPath u verticalHorizontal :: (Floating u) => Point2 u -> CPath u horizontalVertical :: (Floating u) => Point2 u -> CPath u instance Monad (MPath u) instance Applicative (MPath u) instance Functor (MPath u) -- | Import shim for Wumpus.Basic.Graphic modules. module Wumpus.Basic.Graphic -- | Extended path type - more amenable for complex drawings than the type -- in Wumpus-Core. -- -- ** WARNING ** this module is an experiment, and may change -- significantly or even be dropped from future revisions. module Wumpus.Basic.Paths connectS :: (Floating u) => PathF u pathGraphic :: (Num u) => PathF u -> ConnGraphic u shorten :: (Real u, Floating u, Ord u) => u -> Path u -> Path u shortenL :: (Real u, Floating u, Ord u) => u -> Path u -> Path u shortenR :: (Real u, Floating u, Ord u) => u -> Path u -> Path u midpoint :: (Real u, Floating u) => Path u -> Point2 u directionL :: (Real u, Floating u) => Path u -> Radian directionR :: (Real u, Floating u) => Path u -> Radian -- | Marks - dots without anchor handles. -- -- ** WARNING ** - names are expected to change - filled and -- background-filled marks need a naming convention. module Wumpus.Basic.Dots.Primitive markChar :: (Fractional u, FromPtSize u) => Char -> LocGraphic u markText :: (Fractional u, FromPtSize u) => String -> LocGraphic u markHLine :: (Fractional u, FromPtSize u) => LocGraphic u markVLine :: (Fractional u, FromPtSize u) => LocGraphic u markX :: (Fractional u, FromPtSize u) => LocGraphic u markPlus :: (Fractional u, FromPtSize u) => LocGraphic u markCross :: (Floating u, FromPtSize u) => LocGraphic u markDiamond :: (Fractional u, FromPtSize u) => LocGraphic u markFDiamond :: (Fractional u, FromPtSize u) => LocGraphic u markBDiamond :: (Fractional u, FromPtSize u) => LocGraphic u -- | Note disk is filled. markDisk :: (Fractional u, FromPtSize u) => LocGraphic u markSquare :: (Fractional u, FromPtSize u) => LocGraphic u markCircle :: (Fractional u, FromPtSize u) => LocGraphic u markPentagon :: (Floating u, FromPtSize u) => LocGraphic u markStar :: (Floating u, FromPtSize u) => LocGraphic u markAsterisk :: (Floating u, FromPtSize u) => LocGraphic u markOPlus :: (Fractional u, FromPtSize u) => LocGraphic u markOCross :: (Floating u, FromPtSize u) => LocGraphic u markFOCross :: (Floating u, FromPtSize u) => LocGraphic u -- | Turtle monad transformer. -- -- The Turtle monad embodies the LOGO style of imperative drawing - -- sending commands to update the a cursor. -- -- While Wumpus generally aims for a more compositional, -- "coordinate-free" style of drawing, some types of diagram are more -- easily expressed in the LOGO style. -- -- Turtle is only a transformer - it is intended to be run within a -- Drawing. module Wumpus.Basic.Monads.TurtleMonad data TurtleT u m a runTurtleT :: (Monad m, Num u) => TurtleConfig u -> (Int, Int) -> TurtleT u m a -> m a data TurtleDrawing u a runTurtleDrawing :: (Num u) => TurtleConfig u -> (Int, Int) -> DrawingContext -> TurtleDrawing u a -> (a, HPrim u) execTurtleDrawing :: (Num u) => TurtleConfig u -> (Int, Int) -> DrawingContext -> TurtleDrawing u a -> HPrim u instance (Num u) => PointSupplyM (TurtleDrawing u) instance DrawingCtxM (TurtleDrawing u) instance TraceM (TurtleDrawing u) instance TurtleScaleM (TurtleDrawing u) u instance TurtleM (TurtleDrawing u) instance Monad (TurtleDrawing u) instance Applicative (TurtleDrawing u) instance Functor (TurtleDrawing u) instance (u ~ MonUnit m, Monad m, Num u) => PointSupplyM (TurtleT u m) instance (u ~ MonUnit m, Monad m, TraceM m) => TraceM (TurtleT u m) instance (DrawingCtxM m) => DrawingCtxM (TurtleT u m) instance (Monad m) => TurtleScaleM (TurtleT u m) u instance (Monad m) => TurtleM (TurtleT u m) instance (Monad m) => Monad (TurtleT u m) instance (Monad m) => Applicative (TurtleT u m) instance (Monad m) => Functor (TurtleT u m) -- | LRText monad - left-to-right text, with kerning. -- -- Note - because Wumpus has no access to the metrics data inside a font -- file, the default spacing is not good and it is expected that kerning -- will need to be added per-letter for variable width fonts. -- -- This module makes precise text spacing *possible* - it does not make -- it *easy*. module Wumpus.Basic.Text.LRText data TextM u a runTextM :: (Num u, FromPtSize u, DrawingCtxM m, u ~ (MonUnit m)) => TextM u a -> m (a, LocGraphic u) execTextM :: (Num u, FromPtSize u, DrawingCtxM m, u ~ (MonUnit m)) => TextM u a -> m (LocGraphic u) kern :: (Num u) => u -> TextM u () char :: (Num u) => Char -> TextM u () symb :: (Num u) => Char -> TextM u () symbi :: (Num u) => Int -> TextM u () symbEscInt :: (Num u) => Int -> TextM u () instance Monad (TextM u) instance Applicative (TextM u) instance Functor (TextM u) -- | Named literals from Symbol font, drawn with the LRText monad. -- -- Note - currently the techinique used here generates adequate -- PostScript, but very ineficient SVG. -- -- Also uUpsilon is not mapped to the correct character... module Wumpus.Basic.Text.LRSymbol alpha :: (Num u) => TextM u () beta :: (Num u) => TextM u () gamma :: (Num u) => TextM u () delta :: (Num u) => TextM u () epsilon :: (Num u) => TextM u () zeta :: (Num u) => TextM u () eta :: (Num u) => TextM u () theta :: (Num u) => TextM u () iota :: (Num u) => TextM u () kappa :: (Num u) => TextM u () lambda :: (Num u) => TextM u () mu :: (Num u) => TextM u () nu :: (Num u) => TextM u () xi :: (Num u) => TextM u () pi :: (Num u) => TextM u () rho :: (Num u) => TextM u () sigma :: (Num u) => TextM u () tau :: (Num u) => TextM u () upsilon :: (Num u) => TextM u () phi :: (Num u) => TextM u () chi :: (Num u) => TextM u () psi :: (Num u) => TextM u () omega :: (Num u) => TextM u () uGamma :: (Num u) => TextM u () uDelta :: (Num u) => TextM u () uTheta :: (Num u) => TextM u () uLambda :: (Num u) => TextM u () uXi :: (Num u) => TextM u () uPi :: (Num u) => TextM u () uSigma :: (Num u) => TextM u () -- | Not working in PostScript, ¡ works for SVG but -- PostScript needs an encoding table for Symbol-Font not Latin1! -- -- For PostScript, Latin1 161 maps to exclamdown not -- Upsilon1, extending Wumpus-Core to support this will require -- quite some work... uUpsilon :: (Num u) => TextM u () uPhi :: (Num u) => TextM u () uPsi :: (Num u) => TextM u () uOmega :: (Num u) => TextM u () otimes :: (Num u) => TextM u () oplus :: (Num u) => TextM u () -- | Anchor points on shapes. -- -- ** WARNING ** this module is an experiment, and may change -- significantly or even be dropped from future revisions. module Wumpus.Basic.Arrows.Tips tri90 :: (Floating u, Real u, FromPtSize u) => Radian -> LocGraphic u tri60 :: (Floating u, Real u, FromPtSize u) => Radian -> LocGraphic u tri45 :: (Floating u, Real u, FromPtSize u) => Radian -> LocGraphic u otri90 :: (Floating u, Real u, FromPtSize u) => Radian -> LocGraphic u otri60 :: (Floating u, Real u, FromPtSize u) => Radian -> LocGraphic u otri45 :: (Floating u, Real u, FromPtSize u) => Radian -> LocGraphic u barb90 :: (Floating u, Real u, FromPtSize u) => Radian -> LocGraphic u barb60 :: (Floating u, Real u, FromPtSize u) => Radian -> LocGraphic u barb45 :: (Floating u, Real u, FromPtSize u) => Radian -> LocGraphic u perp :: (Floating u, FromPtSize u) => Radian -> LocGraphic u -- | Anchor points on shapes. -- -- ** WARNING ** this module is an experiment, and may change -- significantly or even be dropped from future revisions. module Wumpus.Basic.Arrows line :: (Num u) => PathF u -> ConnImage u (Path u) arrowTri90 :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) arrowTri60 :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) arrowTri45 :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) arrowOTri90 :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) arrowOTri60 :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) arrowOTri45 :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) arrowBarb90 :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) arrowBarb60 :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) arrowBarb45 :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) arrowPerp :: (Real u, Floating u, FromPtSize u) => PathF u -> ConnImage u (Path u) -- | Anchor points on shapes. -- -- ** WARNING ** this module is an experiment, and may change -- significantly or even be dropped from future revisions. module Wumpus.Basic.Anchors class CenterAnchor t center :: (CenterAnchor t, (DUnit t) ~ u) => t -> Point2 u class CardinalAnchor t north :: (CardinalAnchor t, (DUnit t) ~ u) => t -> Point2 u south :: (CardinalAnchor t, (DUnit t) ~ u) => t -> Point2 u east :: (CardinalAnchor t, (DUnit t) ~ u) => t -> Point2 u west :: (CardinalAnchor t, (DUnit t) ~ u) => t -> Point2 u class CardinalAnchor2 t northeast :: (CardinalAnchor2 t, (DUnit t) ~ u) => t -> Point2 u southeast :: (CardinalAnchor2 t, (DUnit t) ~ u) => t -> Point2 u southwest :: (CardinalAnchor2 t, (DUnit t) ~ u) => t -> Point2 u northwest :: (CardinalAnchor2 t, (DUnit t) ~ u) => t -> Point2 u -- | textAnchor is the Bottom left corner on the baseline. class TextAnchor t baselineSW :: (TextAnchor t, (DUnit t) ~ u) => t -> Point2 u -- | Anchor on a border that can be identified with and angle. class RadialAnchor t radialAnchor :: (RadialAnchor t, (DUnit t) ~ u) => Radian -> t -> Point2 u -- | Dots with anchors. -- -- In many cases a surrounding circle is used to locate anchor points - -- this could be improved to use the actual dot border at some point. module Wumpus.Basic.Dots data DotAnchor u type DotLocImage u = LocImage u (DotAnchor u) type DDotLocImage = DotLocImage Double dotChar :: (Floating u, Real u, FromPtSize u) => Char -> DotLocImage u dotText :: (Floating u, Real u, FromPtSize u) => String -> DotLocImage u dotHLine :: (Floating u, FromPtSize u) => DotLocImage u dotVLine :: (Floating u, FromPtSize u) => DotLocImage u dotX :: (Floating u, FromPtSize u) => DotLocImage u dotPlus :: (Floating u, FromPtSize u) => DotLocImage u dotCross :: (Floating u, FromPtSize u) => DotLocImage u dotDiamond :: (Floating u, FromPtSize u) => DotLocImage u dotFDiamond :: (Floating u, FromPtSize u) => DotLocImage u dotDisk :: (Floating u, FromPtSize u) => DotLocImage u dotSquare :: (Floating u, Real u, FromPtSize u) => DotLocImage u dotCircle :: (Floating u, FromPtSize u) => DotLocImage u dotPentagon :: (Floating u, FromPtSize u) => DotLocImage u dotStar :: (Floating u, FromPtSize u) => DotLocImage u dotAsterisk :: (Floating u, FromPtSize u) => DotLocImage u dotOPlus :: (Floating u, FromPtSize u) => DotLocImage u dotOCross :: (Floating u, FromPtSize u) => DotLocImage u dotFOCross :: (Floating u, FromPtSize u) => DotLocImage u instance Eq Cardinal instance Show Cardinal instance CardinalAnchor2 (DotAnchor u) instance CardinalAnchor (DotAnchor u) instance RadialAnchor (DotAnchor u) instance CenterAnchor (DotAnchor u)