{-# LANGUAGE RankNTypes #-}-- | Uses the @JuicyPixels@ package to load images that are then used-- to create OpenGL textuers.moduleGraphics.GLUtil.JuicyTextureswhereimportCodec.Picture(readImage,DynamicImage(..),Image(..))importControl.Applicative((<$>))importGraphics.GLUtil.TexturesimportGraphics.Rendering.OpenGL(TextureObject)-- | Load a 'TexInfo' value from an image file, and supply it to a-- user-provided function. Supported image formats include @png@,-- @jpeg@, @bmp@, and @gif@. See 'readTexture' for most uses.readTexInfo::FilePath->(foralla.IsPixelDataa=>TexInfoa->IOb)->IO(EitherStringb)readTexInfofk=readImagef>>=either(return.Left)auxwhereaux(ImageY8(Imagewhp))=Right<$>k(texInfowhTexMonop)aux(ImageYF(Imagewhp))=Right<$>k(texInfowhTexMonop)aux(ImageYA8_)=return$Left"YA format not supported"aux(ImageRGB8(Imagewhp))=Right<$>k(texInfowhTexRGBp)aux(ImageRGBF(Imagewhp))=Right<$>k(texInfowhTexRGBp)aux(ImageRGBA8(Imagewhp))=Right<$>k(texInfowhTexRGBAp)aux_=return$Left"Unsupported image format"-- | Load a 'TextureObject' from an image file. Supported formats-- include @png@, @jpeg@, @bmp@, and @gif@.readTexture::FilePath->IO(EitherStringTextureObject)readTexturef=readTexInfofloadTexture