packages feed

fudgets-0.18.3: Demos/SpaceInvaders/ReadPic.hs

module ReadPic(readPic,readPics,bmScale) where
import Control.Applicative
import AllFudgets
--import Pics
import BitmapOps
import Metrics

readPics m (file1,file2) = (,) <$> readPic m file1 <*> readPic m file2

readPic m name =
  case pics m name of
    Bitmap (w,h) bytes ->
      do bmr <- Mk (bitmapFromData (BitmapData (Point w h) Nothing bytes))
         case bmr of
           BitmapReturn size _ pm -> return (PixmapImage size pm)
           BitmapBad -> error ("Can't read bitmap "++show name)