module Main (main) where import Labygen import Graphics.Rendering.Cairo import System.Random import Data.Array drawBlock p Free = return () drawBlock (Pos2 (x,y)) Block = do rectangle (fromIntegral (x-1) * 20.0) (fromIntegral (y-1) * 40.0) 20 40 fill draw laby = do setSourceRGBA 0.0 0.0 0.0 1.0 translate 20 40 rectangle 0 0 (fromIntegral xb * 20.0) (fromIntegral yb * 40.0) stroke sequence_ [ drawBlock p b | (p, b) <- assocs laby ] where (_, Pos2 (xb, yb)) = bounds laby main = do putStrLn "LabyGen" laby <- labygenIO (Pos2 (1,1), (Pos2 (30,50))) (Pos2 (1,1)) (Pos2 (30, 50)) withPDFSurface "laby.pdf" 740 2100 $ \ sf -> renderWith sf $ draw laby