-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Image loading and writing microlibrary
--   
--   See
--   <a>https://github.com/typedrat/stb-image-redux/blob/master/README.md</a>.
@package stb-image-redux
@version 0.2.1.2


-- | Much like the original library, the focus of this library is placed on
--   ease of use rather than richness of feature set, thus the rather
--   spartan interface.
module Data.STBImage
class (Storable a) => Color a where {
    data family ColorFlag a :: *;
}

-- | <a>loadImage</a> reads the image (with ColorFlag <a>Y</a>, <a>YA</a>,
--   <a>RGB</a>, or <a>RGBA</a>) at the supplied path.
loadImage :: Color a => ColorFlag a -> FilePath -> IO (Either String (Image a))

-- | <a>writePNG</a> writes the image passed to it out at the path
--   <tt>path</tt> in PNG format. The path must include the extension.
writePNG :: Color a => FilePath -> Image a -> IO ()

-- | <a>writeBMP</a> writes the image passed to it out at the path
--   <tt>path</tt> in BMP format. The path must include the extension.
writeBMP :: Color a => FilePath -> Image a -> IO ()

-- | <a>writeTGA</a> writes the image passed to it out at the path
--   <tt>path</tt> in TGA format. The path must include the extension.
writeTGA :: Color a => FilePath -> Image a -> IO ()
red :: Color a => a -> Word8
green :: Color a => a -> Word8
blue :: Color a => a -> Word8
alpha :: Color a => a -> Word8
data YColor
YColor :: Word8 -> YColor
[_yGreyscale] :: YColor -> Word8
data YAColor
YAColor :: Word8 -> Word8 -> YAColor
[_yaGreyscale] :: YAColor -> Word8
[_yaAlpha] :: YAColor -> Word8
data RGBColor
RGBColor :: Word8 -> Word8 -> Word8 -> RGBColor
[_rgbRed] :: RGBColor -> Word8
[_rgbGreen] :: RGBColor -> Word8
[_rgbBlue] :: RGBColor -> Word8
data RGBAColor
RGBAColor :: Word8 -> Word8 -> Word8 -> Word8 -> RGBAColor
[_rgbaRed] :: RGBAColor -> Word8
[_rgbaGreen] :: RGBAColor -> Word8
[_rgbaBlue] :: RGBAColor -> Word8
[_rgbaAlpha] :: RGBAColor -> Word8

-- | <a>Image</a> is the least opinionated reasonable type to represent an
--   image, just a vector of pixel <tt>Color</tt>s (laid out top-to-bottom,
--   left-to-right) and a size.
data Image a
Image :: Vector a -> Int -> Int -> Image a
[_pixels] :: Image a -> Vector a
[_width] :: Image a -> Int
[_height] :: Image a -> Int

-- | Utility function to flip images, e.g. for use with OpenGL
flipImage :: (Storable a) => Image a -> Image a
