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


-- | Loading PBM, PGM, PPM image files
--   
--   This package contains pure Haskell parsers for the netpbm image
--   formats: PBM, PGM and PPM, for both ASCII and binary encodings.
--   
--   All netpbm image formats are implemented (P1 - P6).
--   
--   The current implementation parses PPM images at around 10 MB/s on a
--   Core i5-2520M.
--   
--   CHANGELOG
--   
--   Version 1.0.3
--   
--   <ul>
--   <li>Package maintenance improvements only (base-4.5 excluded). See
--   #3</li>
--   </ul>
--   
--   Version 1.0.2
--   
--   <ul>
--   <li>Package maintenance improvements only.</li>
--   </ul>
--   
--   Version 1.0.1
--   
--   <ul>
--   <li>Added required Vector imports necessary for deriving Unbox
--   instances.</li>
--   </ul>
--   
--   Version 1.0.0
--   
--   <ul>
--   <li>Use storable instead of unboxed vectors to allow easier
--   integration with Ptr based APIs.</li>
--   </ul>
@package netpbm
@version 1.0.3


-- | Parsing the netpbm image formates (PBM, PGM and PPM, both ASCII and
--   binary) from <a>ByteString</a>s.
--   
--   All netpbm image formats are implemented (P1 - P6).
--   
--   To parse one of these formats, use <a>parsePPM</a>.
--   
--   See also: <a>http://www.imagemagick.org/Usage/formats/#netpbm</a>
module Graphics.Netpbm

-- | The netpbm image type of an image.
data PPMType

-- | ASCII bitmap
P1 :: PPMType

-- | ASCII greymap
P2 :: PPMType

-- | ASCII pixmap (color)
P3 :: PPMType

-- | binary bitmap
P4 :: PPMType

-- | binary greymap
P5 :: PPMType

-- | binary pixmap (color)
P6 :: PPMType

-- | A PPM file with type, dimensions, and image data.
data PPM
PPM :: PPMHeader -> PpmPixelData -> PPM
[ppmHeader] :: PPM -> PPMHeader
[ppmData] :: PPM -> PpmPixelData

-- | A pixel containing three 8-bit color components, RGB.
data PpmPixelRGB8
PpmPixelRGB8 :: {-# UNPACK #-} !Word8 -> {-# UNPACK #-} !Word8 -> {-# UNPACK #-} !Word8 -> PpmPixelRGB8

-- | A pixel containing three 16-bit color components, RGB.
data PpmPixelRGB16
PpmPixelRGB16 :: {-# UNPACK #-} !Word16 -> {-# UNPACK #-} !Word16 -> {-# UNPACK #-} !Word16 -> PpmPixelRGB16

-- | A pixel containing black or white.
newtype PbmPixel
PbmPixel :: Bool -> PbmPixel

-- | A pixel containing an 8-bit greyscale value.
data PgmPixel8
PgmPixel8 :: {-# UNPACK #-} !Word8 -> PgmPixel8

-- | A pixel containing a 16-bit greyscale value.
data PgmPixel16
PgmPixel16 :: {-# UNPACK #-} !Word16 -> PgmPixel16

-- | Meta information about the image: The exact PPM format and dimensions.
data PPMHeader
PPMHeader :: !PPMType -> !Int -> !Int -> PPMHeader
[ppmType] :: PPMHeader -> !PPMType
[ppmWidth] :: PPMHeader -> !Int
[ppmHeight] :: PPMHeader -> !Int

-- | Image data, either 8 or 16 bits. TODO rename to PNM
data PpmPixelData

-- | For 8-bit PPMs.
PpmPixelDataRGB8 :: Vector PpmPixelRGB8 -> PpmPixelData

-- | For 16-bit PPMs.
PpmPixelDataRGB16 :: Vector PpmPixelRGB16 -> PpmPixelData

-- | For 1-bit PBMs.
PbmPixelData :: Vector PbmPixel -> PpmPixelData

-- | For 8-bit PGMs.
PgmPixelData8 :: Vector PgmPixel8 -> PpmPixelData

-- | For 16-bit PGMs.
PgmPixelData16 :: Vector PgmPixel16 -> PpmPixelData

-- | Converts a vector of pixels to a list for convenience.
pixelVectorToList :: Storable a => Vector a -> [a]

-- | Converts pixel data to a list of positive <a>Int</a>s.
--   
--   How big they can become depends on the bit depth of the pixel data.
pixelDataToIntList :: PpmPixelData -> [Int]

-- | Parses a PPM file from the given <a>ByteString</a>. On failure,
--   <tt>Left error</tt> contains the error message. On success, <tt>Right
--   (images, Maybe rest)</tt> contains the parsed images and potentially
--   an unparsable rest input.
parsePPM :: ByteString -> PpmParseResult

-- | The result of a PPM parse.
--   
--   See <a>parsePPM</a>.
type PpmParseResult = Either String ([PPM], Maybe ByteString)
instance Data.Vector.Unboxed.Base.Unbox Graphics.Netpbm.PgmPixel16
instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Graphics.Netpbm.PgmPixel16
instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Graphics.Netpbm.PgmPixel16
instance Foreign.Storable.Storable Graphics.Netpbm.PpmPixelRGB8
instance Foreign.Storable.Storable Graphics.Netpbm.PpmPixelRGB16
instance Foreign.Storable.Storable Graphics.Netpbm.PbmPixel
instance Foreign.Storable.Storable Graphics.Netpbm.PgmPixel8
instance Foreign.Storable.Storable Graphics.Netpbm.PgmPixel16
instance Data.Vector.Unboxed.Base.Unbox Graphics.Netpbm.PgmPixel8
instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Graphics.Netpbm.PgmPixel8
instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Graphics.Netpbm.PgmPixel8
instance Data.Vector.Unboxed.Base.Unbox Graphics.Netpbm.PbmPixel
instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Graphics.Netpbm.PbmPixel
instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Graphics.Netpbm.PbmPixel
instance Data.Vector.Unboxed.Base.Unbox Graphics.Netpbm.PpmPixelRGB16
instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Graphics.Netpbm.PpmPixelRGB16
instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Graphics.Netpbm.PpmPixelRGB16
instance Data.Vector.Unboxed.Base.Unbox Graphics.Netpbm.PpmPixelRGB8
instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Graphics.Netpbm.PpmPixelRGB8
instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Graphics.Netpbm.PpmPixelRGB8
instance GHC.Show.Show Graphics.Netpbm.PgmPixel16
instance GHC.Classes.Eq Graphics.Netpbm.PgmPixel16
instance GHC.Show.Show Graphics.Netpbm.PgmPixel8
instance GHC.Classes.Eq Graphics.Netpbm.PgmPixel8
instance GHC.Show.Show Graphics.Netpbm.PbmPixel
instance GHC.Classes.Eq Graphics.Netpbm.PbmPixel
instance GHC.Show.Show Graphics.Netpbm.PpmPixelRGB16
instance GHC.Classes.Eq Graphics.Netpbm.PpmPixelRGB16
instance GHC.Show.Show Graphics.Netpbm.PpmPixelRGB8
instance GHC.Classes.Eq Graphics.Netpbm.PpmPixelRGB8
instance GHC.Show.Show Graphics.Netpbm.PPMHeader
instance GHC.Classes.Eq Graphics.Netpbm.PPMHeader
instance GHC.Classes.Ord Graphics.Netpbm.PPMType
instance GHC.Enum.Enum Graphics.Netpbm.PPMType
instance GHC.Show.Show Graphics.Netpbm.PPMType
instance GHC.Classes.Eq Graphics.Netpbm.PPMType
instance GHC.Show.Show Graphics.Netpbm.PPM
