drawLines :: Context -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO ()
drawLines c x y w h t =
  do save c
     forM_ [0..2] $ \i -> forM_ [0..2] $ \j ->
       do let fx = x +s*0.5+(fromIntegral i*3+fromIntegral j)/9*w+pad
              fy = y-s*0.5+pad
          lineCap c (caps V.! i)
          lineJoin c (joins V.! j)

          strokeWidth c (s*0.3)
          strokeColor c (rgba 0 0 0 160)
          beginPath c
          moveTo c (fx + pts V.! 0) (fy + pts V.! 1)
          moveTo c (fx + pts V.! 2) (fy + pts V.! 3)
          moveTo c (fx + pts V.! 4) (fy + pts V.! 5)
          moveTo c (fx + pts V.! 6) (fy + pts V.! 7)
          stroke c

          lineCap c Butt
          lineJoin c Bevel

          strokeWidth c 1
          strokeColor c (rgba 0 192 255 255)
          beginPath c
          moveTo c (fx + pts V.! 0) (fy + pts V.! 1)
          moveTo c (fx + pts V.! 2) (fy + pts V.! 3)
          moveTo c (fx + pts V.! 4) (fy + pts V.! 5)
          moveTo c (fx + pts V.! 6) (fy + pts V.! 7)
          stroke c
     restore c
  where pad = 0.5
        s = w / 9 - pad * 2
        joins = V.fromList [Miter,Round,Bevel]
        caps = V.fromList [Butt,Round,Square]
        pts =
          V.fromList
            [-s * 0.25 + cos (t * 0.3) * s * 0.5
            ,sin (t * 0.3) * s * 0.5
            ,-s * 0.25
            ,0
            ,s * 0.25
            ,0
            ,s * 0.25 + cos (-t * 0.3) * s * 0.5
            ,sin (-t * 0.3) * s * 0.5]
drawLines :: Context -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO ()
drawLines c x y w h t =
  do save c
     forM_ [0..2] $ \i -> forM_ [0..2] $ \j ->
       do let fx = x +s*0.5+(fromIntegral i*3+fromIntegral j)/9*w+pad
              fy = y-s*0.5+pad
          lineCap c (caps V.! i)
          lineJoin c (joins V.! j)

          strokeWidth c (s*0.3)
          strokeColor c (rgba 0 0 0 160)
          beginPath c
          moveTo c (fx + pts V.! 0) (fy + pts V.! 1)
          moveTo c (fx + pts V.! 2) (fy + pts V.! 3)
          moveTo c (fx + pts V.! 4) (fy + pts V.! 5)
          moveTo c (fx + pts V.! 6) (fy + pts V.! 7)
          stroke c

          lineCap c Butt
          lineJoin c Bevel

          strokeWidth c 1
          strokeColor c (rgba 0 192 255 255)
          beginPath c
          moveTo c (fx + pts V.! 0) (fy + pts V.! 1)
          moveTo c (fx + pts V.! 2) (fy + pts V.! 3)
          moveTo c (fx + pts V.! 4) (fy + pts V.! 5)
          moveTo c (fx + pts V.! 6) (fy + pts V.! 7)
          stroke c
     restore c
  where pad = 0.5
        s = w / 9 - pad * 2
        joins = V.fromList [Miter,Round,Bevel]
        caps = V.fromList [Butt,Round,Square]
        pts =
          V.fromList
            [-s * 0.25 + cos (t * 0.3) * s * 0.5
            ,sin (t * 0.3) * s * 0.5
            ,-s * 0.25
            ,0
            ,s * 0.25
            ,0
            ,s * 0.25 + cos (-t * 0.3) * s * 0.5
            ,sin (-t * 0.3) * s * 0.5]
drawLines c x y w h t =
  do save c
     forM_ [0..2] $ \i -> forM_ [0..2] $ \j ->
       do let fx = x +s*0.5+(fromIntegral i*3+fromIntegral j)/9*w+pad
              fy = y-s*0.5+pad
          lineCap c (caps V.! i)
          lineJoin c (joins V.! j)

          strokeWidth c (s*0.3)
          strokeColor c (rgba 0 0 0 160)
          beginPath c
          moveTo c (fx + pts V.! 0) (fy + pts V.! 1)
          moveTo c (fx + pts V.! 2) (fy + pts V.! 3)
          moveTo c (fx + pts V.! 4) (fy + pts V.! 5)
          moveTo c (fx + pts V.! 6) (fy + pts V.! 7)
          stroke c

          lineCap c Butt
          lineJoin c Bevel

          strokeWidth c 1
          strokeColor c (rgba 0 192 255 255)
          beginPath c
          moveTo c (fx + pts V.! 0) (fy + pts V.! 1)
          moveTo c (fx + pts V.! 2) (fy + pts V.! 3)
          moveTo c (fx + pts V.! 4) (fy + pts V.! 5)
          moveTo c (fx + pts V.! 6) (fy + pts V.! 7)
          stroke c
     restore c
  where pad = 0.5
        s = w / 9 - pad * 2
        joins = V.fromList [Miter,Round,Bevel]
        caps = V.fromList [Butt,Round,Square]
        pts =
          V.fromList
            [-s * 0.25 + cos (t * 0.3) * s * 0.5
            ,sin (t * 0.3) * s * 0.5
            ,-s * 0.25
            ,0
            ,s * 0.25
            ,0
            ,s * 0.25 + cos (-t * 0.3) * s * 0.5
            ,sin (-t * 0.3) * s * 0.5]