drawCaps :: Context -> CFloat -> CFloat -> CFloat -> IO ()
drawCaps c x y width =
  do save c

     beginPath c
     rect c (x-lineWidth/2) y (width+lineWidth) 40
     fillColor c (rgba 255 255 255 32)
     fill c

     beginPath c
     rect c x y width 40
     fillColor c (rgba 255 255 255 32)
     fill c

     strokeWidth c lineWidth
     forM_ (zip [0..] [Butt,Round,Square]) $ \(i,cap) ->
       do lineCap c cap
          strokeColor c (rgba 0 0 0 255)
          beginPath c
          moveTo c x (y+i*10+5)
          lineTo c (x+width) (y+i*10+5)
          stroke c
     restore c
  where lineWidth = 8
drawCaps :: Context -> CFloat -> CFloat -> CFloat -> IO ()
drawCaps c x y width =
  do save c

     beginPath c
     rect c (x-lineWidth/2) y (width+lineWidth) 40
     fillColor c (rgba 255 255 255 32)
     fill c

     beginPath c
     rect c x y width 40
     fillColor c (rgba 255 255 255 32)
     fill c

     strokeWidth c lineWidth
     forM_ (zip [0..] [Butt,Round,Square]) $ \(i,cap) ->
       do lineCap c cap
          strokeColor c (rgba 0 0 0 255)
          beginPath c
          moveTo c x (y+i*10+5)
          lineTo c (x+width) (y+i*10+5)
          stroke c
     restore c
  where lineWidth = 8
drawCaps c x y width =
  do save c

     beginPath c
     rect c (x-lineWidth/2) y (width+lineWidth) 40
     fillColor c (rgba 255 255 255 32)
     fill c

     beginPath c
     rect c x y width 40
     fillColor c (rgba 255 255 255 32)
     fill c

     strokeWidth c lineWidth
     forM_ (zip [0..] [Butt,Round,Square]) $ \(i,cap) ->
       do lineCap c cap
          strokeColor c (rgba 0 0 0 255)
          beginPath c
          moveTo c x (y+i*10+5)
          lineTo c (x+width) (y+i*10+5)
          stroke c
     restore c
  where lineWidth = 8