wumpus-microprint 0.11.0 → 0.12.0
raw patch · 5 files changed
+32/−25 lines, 5 filesdep ~vector-spacedep ~wumpus-basicdep ~wumpus-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: vector-space, wumpus-basic, wumpus-core
API changes (from Hackage documentation)
- Wumpus.Microprint.Render: render :: RenderScalingCtx -> DrawWordF -> GreekText -> Drawing Double ()
+ Wumpus.Microprint.Render: render :: RenderScalingCtx -> DrawWordF -> GreekText -> TraceDrawing Double ()
Files
- demo/Demo01.hs +8/−6
- src/Wumpus/Microprint.hs +2/−3
- src/Wumpus/Microprint/Render.hs +12/−10
- src/Wumpus/Microprint/VersionNumber.hs +2/−2
- wumpus-microprint.cabal +8/−4
demo/Demo01.hs view
@@ -19,23 +19,25 @@ createDirectoryIfMissing True "./out/" inp <- readFile "Demo01.hs" -- This file let gtext = runTokenizer (haskellTokenizer indian_red teal) inp+ -- let pic1 = makePicture gtext- writeEPS_latin1 "./out/microprint01.eps" pic1- writeSVG_latin1 "./out/microprint01.svg" pic1+ writeEPS "./out/microprint01.eps" pic1+ writeSVG "./out/microprint01.svg" pic1+ -- let pic2 = makeBordered gtext- writeEPS_latin1 "./out/microprint02.eps" pic2- writeSVG_latin1 "./out/microprint02.svg" pic2+ writeEPS "./out/microprint02.eps" pic2+ writeSVG "./out/microprint02.svg" pic2 makePicture :: GreekText -> DPicture-makePicture gtext = liftToPictureU $ execDrawing (standardContext 14) $ +makePicture gtext = liftToPictureU $ execTraceDrawing (standardContext 14) $ render sctx strokelineF gtext where sctx = makeRenderScaling (\x -> fromIntegral $ 2*x) (\y -> fromIntegral $ 3*y) makeBordered :: GreekText -> DPicture-makeBordered gtext = liftToPictureU $ execDrawing (standardContext 14) $ +makeBordered gtext = liftToPictureU $ execTraceDrawing (standardContext 14) $ render sctx borderedF gtext where sctx = makeRenderScaling (\x -> fromIntegral $ 6*x)
src/Wumpus/Microprint.hs view
@@ -54,9 +54,8 @@ -- This function returns Nothing if the picture is empty. -- renderTeletype :: RenderScalingCtx -> DrawWordF -> Teletype a -> Maybe DPicture-renderTeletype ctx fn mf = - liftToPictureMb $ execDrawing (standardContext 14) - $ render ctx fn $ execTeletype mf+renderTeletype sctx fn mf = + runDrawing (standardContext 24) $ drawTracing $ render sctx fn $ execTeletype mf -- | Build a picture from a Teletype - /unsafe/ version.
src/Wumpus/Microprint/Render.hs view
@@ -36,7 +36,6 @@ import Data.AffineSpace -- package: vector-space -import Control.Applicative -------------------------------------------------------------------------------- @@ -58,25 +57,28 @@ -- | Just a filled rectangle. -- greekF :: DrawWordF-greekF rgb w h _ = localize (fillColour rgb) . (filledRectangle w h)+greekF rgb w h _ = localize (fillColour rgb) (filledRectangle w h) ++-- This needs re-working.... borderedF :: DrawWordF-borderedF rgb w h i = oconcat <$> background <*> ticks+borderedF rgb w h i = ticks background where- background = localize (fillColour rgb) . (borderedRectangle w h)+ background = localize (fillColour rgb) (borderedRectangle w h) v1 = hvec $ w / fromIntegral i- ticks pt = map (straightLine (vvec h)) - $ take (i-1) $ iterate (.+^ v1) (pt .+^ v1)+ ticks g1 = promote1 (\pt -> oconcat (g1 `at` pt) $ + map (straightLine (vvec h) `at`) + $ take (i-1) $ iterate (.+^ v1) (pt .+^ v1) ) -- | A stroked line. -- strokelineF :: DrawWordF-strokelineF rgb w _ _ = localize (strokeColour rgb) . (straightLine (hvec w))+strokelineF rgb w _ _ = localize (strokeColour rgb) (straightLine (hvec w)) -render :: RenderScalingCtx -> DrawWordF -> GreekText -> Drawing Double ()+render :: RenderScalingCtx -> DrawWordF -> GreekText -> TraceDrawing Double () render ctx wordDraw (hmax,xs) = runScalingT ctx $ mstep hmax xs where@@ -84,7 +86,7 @@ mstep _ _ = return () renderLine :: DrawWordF -> Int -> [Tile] - -> RenderScalingT (Drawing Double) ()+ -> RenderScalingT (TraceDrawing Double) () renderLine fn h ts = mstep 0 ts where mstep x (Word rgb n:xs) = draw1 fn rgb n (x,h) >> mstep (x+n) xs@@ -92,7 +94,7 @@ mstep _ [] = return () draw1 :: DrawWordF -> RGBi -> Int -> (Int,Int) - -> RenderScalingT (Drawing Double) () + -> RenderScalingT (TraceDrawing Double) () draw1 fn rgb n (x,y) = scalePt x y >>= \pt -> scaleX n >>= \w -> unitY >>= \h -> draw $ fn rgb w h n `at` pt
src/Wumpus/Microprint/VersionNumber.hs view
@@ -22,7 +22,7 @@ -- | Version number ----- > (0,11,0)+-- > (0,12,0) -- wumpus_microprint_version :: (Int,Int,Int)-wumpus_microprint_version = (0,11,0)+wumpus_microprint_version = (0,12,0)
wumpus-microprint.cabal view
@@ -1,5 +1,5 @@ name: wumpus-microprint-version: 0.11.0+version: 0.12.0 license: BSD3 license-file: LICENSE copyright: Stephen Tetley <stephen.tetley@gmail.com>@@ -24,6 +24,10 @@ . Changelog: .+ 0.11.0 to 0.12.0:+ .+ * Updated to track changes to Wumpus-Basic and Wumpus-Core.+ . 0.10.0 to 0.11.0: . * Updated to track changes in Wumpus-Basic.@@ -45,9 +49,9 @@ library hs-source-dirs: src build-depends: base < 5, - vector-space >= 0.6,- wumpus-core == 0.36.0,- wumpus-basic == 0.12.0+ vector-space >= 0.6 && < 1.0,+ wumpus-core == 0.40.0,+ wumpus-basic == 0.13.0 exposed-modules: