packages feed

wumpus-microprint 0.2.0 → 0.3.0

raw patch · 3 files changed

+33/−27 lines, 3 filesdep ~wumpus-basicdep ~wumpus-corePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: wumpus-basic, wumpus-core

API changes (from Hackage documentation)

Files

src/Wumpus/MicroPrint/Render.hs view
@@ -31,8 +31,7 @@ import Wumpus.Core import Wumpus.Core.Colour ( black ) import Wumpus.Basic.Graphic-import Wumpus.Basic.Monads.TraceMonad-import Wumpus.Basic.Monads.TurtleMonad+import Wumpus.Basic.Monads.ConsDrawing import Wumpus.Basic.Utils.HList  import Wumpus.MicroPrint.DrawMonad ( Tile(..), Height ) @@ -57,30 +56,29 @@        }  greekF :: DrawF-greekF _ (w,h) rgb = filledRectangle rgb w h +greekF _ (w,h) rgb = wrapG . fill rgb . rectanglePath w h   borderedF :: Double -> DrawF-borderedF line_width (i,uw) (w,h) rgb = +borderedF ln_width (i,uw) (w,h) rgb =      srect `cc` seps `cc` greekF (i,uw) (w,h) rgb   where-    props = (black, LineWidth line_width)+    props = (black, LineWidth ln_width)      srect :: DGraphicF-    srect = strokedRectangle props w h+    srect = wrapG . cstroke props . rectanglePath w h       seps  :: DGraphicF     seps  = \pt -> unfoldrH (phi pt) (1,uw)      -    phi pt (n,disp) | n >= i    = Nothing-                    | otherwise = let ln = vline props h (pt .+^ hvec disp)-                                  in  Just (ln,(n+1,disp+uw))+    phi pt (n,hshift) | n >= i    = Nothing+                      | otherwise = let ln = vline props h (pt .+^ hvec hshift)+                                    in  Just (ln,(n+1,hshift+uw))   vline :: (Stroke t, Num u, Ord u) => t -> u -> Point2 u -> Primitive u vline t h = \pt -> ostroke t $ path pt [lineTo $ pt .+^ vvec h]      -newtype RenderMonad a = RM { getRM :: ReaderT MP_config-                                    ( TraceT  DPrimitive Turtle)  a }+newtype RenderMonad a = RM { getRM :: ReaderT MP_config (ConsDrawing Double) a }  instance Functor RenderMonad where   fmap f = RM . fmap f . getRM@@ -101,8 +99,10 @@   ask      = RM $ ask  instance TurtleM RenderMonad where-  getLoc   = RM $ lift $ lift $ getLoc-  setLoc c = RM $ lift $ lift $ setLoc c+  getLoc        = RM $ lift $ getLoc+  setLoc c      = RM $ lift $ setLoc c+  getOrigin     = RM $ lift $ getOrigin+  setOrigin o   = RM $ lift $ setOrigin o   drawMicroPrint :: MP_config -> ([Tile],Height) -> Maybe DPicture@@ -114,9 +114,8 @@  runRender :: MP_config -> RenderMonad a -> (a, DGraphic) runRender cfg m = -    post $ runTurtle $ runTraceT $ runReaderT cfg $ getRM $ m-  where-    post ((a,w), _) = (a,w)+    runConsDrawing (regularConfig 1) (0,0) (standardAttr 14) +         $ runReaderT cfg $ getRM $ m  interpret :: [Tile] -> RenderMonad () interpret = mapM_ interp1@@ -133,17 +132,17 @@     trace (dF (i,uw) (w,h) rgb pt)     moveRightN i    -moveRightN :: Int -> RenderMonad ()-moveRightN i = setsLoc_ (\(Coord x y) -> Coord (x+i) y )+moveRightN   :: Int -> RenderMonad ()+moveRightN i = setsLoc_ $ \(x,y) -> (x+i,y) -moveUpN :: Int -> RenderMonad ()-moveUpN i = setsLoc_ (\(Coord x y) -> Coord x (y+i) )+moveUpN      :: Int -> RenderMonad ()+moveUpN i    = setsLoc_ $ \(x,y) -> (x,y+i)  scaleCurrentCoord :: RenderMonad DPoint2 scaleCurrentCoord =      fn <$> getLoc <*> asks char_width <*> asks char_height <*> asks line_spacing   where-    fn (Coord x y) cw ch sp = P2 (cw * fromIntegral x) ((ch+sp) * fromIntegral y)+    fn (x,y) cw ch sp = P2 (cw * fromIntegral x) ((ch+sp) * fromIntegral y)  scaleWidth :: Int -> RenderMonad Double scaleWidth i = (\cw -> cw * fromIntegral i) <$> asks char_width
src/Wumpus/MicroPrint/VersionNumber.hs view
@@ -20,6 +20,9 @@    ) where -+-- | Version number+--+-- > (0,3,0)+-- wumpus_microprint_version :: (Int,Int,Int)-wumpus_microprint_version = (0,2,0)+wumpus_microprint_version = (0,3,0)
wumpus-microprint.cabal view
@@ -1,5 +1,5 @@ name:             wumpus-microprint-version:          0.2.0+version:          0.3.0 license:          BSD3 license-file:     LICENSE copyright:        Stephen Tetley <stephen.tetley@gmail.com>@@ -20,7 +20,11 @@   \[1\] <http://scg.unibe.ch/archive/papers/Robb05b-microprintsESUG.pdf>   .   Changelog:+  . +  0.2.0 to 0.3.0:   .+  * Updated to use ConsDrawing monad from Wumpus-Basic.+  .   0.1.1 to 0.2.0:   .   * Updated to use Basic.Graphic types from wumpus-basic-0.2.0@@ -39,11 +43,11 @@    library   hs-source-dirs:     src-  build-depends:      base              < 5, +  build-depends:      base              <  5,                        vector-space      >= 0.6,                       monadLib          >= 3.6,-                      wumpus-core       >= 0.21.0,-                      wumpus-basic      >= 0.2.0+                      wumpus-core       >= 0.22.0,+                      wumpus-basic      >= 0.3.0       exposed-modules: