tools/hwmap.hs
changeset 10885 3ea36d8d4636
parent 10369 5adc765da26b
child 11015 7a905f0070ce
equal deleted inserted replaced
10884:7b76811fb689 10885:3ea36d8d4636
    50 compressWithLength b = BL.drop 8 . encode . runPut $ do
    50 compressWithLength b = BL.drop 8 . encode . runPut $ do
    51     put $ ((fromIntegral $ BL.length b)::Word32)
    51     put $ ((fromIntegral $ BL.length b)::Word32)
    52     mapM_ putWord8 $ BW.unpack $ BL.toStrict $ Z.compress b
    52     mapM_ putWord8 $ BW.unpack $ BL.toStrict $ Z.compress b
    53 
    53 
    54 mapString :: B.ByteString
    54 mapString :: B.ByteString
    55 mapString = B.pack . Base64.encode . BW.unpack . BL.toStrict . compressWithLength . BL.drop 8 . encode $ drawnMap04
    55 mapString = B.pack . Base64.encode . BW.unpack . BL.toStrict . compressWithLength . BL.drop 8 . encode $ drawnMap05
    56 
    56 
    57 main = B.writeFile "out.hwmap" mapString
    57 main = B.writeFile "out.hwmap" mapString
    58 
    58 
    59 drawnMap01 = translate (-3) (-3) $ sp ++ mirror sp ++ base ++ mirror base
    59 drawnMap01 = translate (-3) (-3) $ sp ++ mirror sp ++ base ++ mirror base
    60     where
    60     where
   150         , l [(2, 0), (2, 1)]
   150         , l [(2, 0), (2, 1)]
   151         , l [(5, 0), (5, 1)]
   151         , l [(5, 0), (5, 1)]
   152         ]
   152         ]
   153     l = Line Solid 0
   153     l = Line Solid 0
   154     fm = flip' . mirror
   154     fm = flip' . mirror
       
   155 
       
   156 drawnMap05 = sp ++ fullFill ++ lW
       
   157     where
       
   158         w = 320
       
   159         sh = 420
       
   160         basePoints = [(w, w), (1024 + w `div` 2, 2048 - w), (2048, w), (3072 - w `div` 2, 2048 - w), (4096 - w, w)]
       
   161         lW = [Line Erasing 60 basePoints]
       
   162         sp = [SpecialPoints $ basePoints ++ [(1024 + w `div` 2, 2048 - w - sh), (3072 - w `div` 2, 2048 - w - sh), (2048, w + sh)]]
       
   163 
       
   164 fullFill = scale 256 $ [Line Solid 63 [(0, 1), (16, 1), (16, 3), (0, 3), (0, 5), (16, 5), (16, 7), (0, 7)]]