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


-- | BLP format decoder/encoder over JuicyPixels library
--   
--   The library provides decoding/encoding functions for BLP1 texture
--   format of Warcraft III game. The result is represented in types of
--   <a>JuicyPixels</a> library. Please see README.md for detailed
--   description.
@package JuicyPixels-blp
@version 0.1.0.1

module Codec.Picture.Blp.Internal.Convert
toPngRepresentable :: DynamicImage -> DynamicImage
toBlpUncompressable :: DynamicImage -> Image PixelRGBA8
toBlpCMYK8 :: Image PixelRGBA8 -> Image PixelCMYK8

module Codec.Picture.Blp.Internal.Data
data BlpStruct
BlpStruct :: !BlpCompression -> ![BlpFlag] -> !Word32 -> !Word32 -> !BlpPictureType -> !Word32 -> BlpExt -> BlpStruct
[blpCompression] :: BlpStruct -> !BlpCompression
[blpFlags] :: BlpStruct -> ![BlpFlag]
[blpWidth] :: BlpStruct -> !Word32
[blpHeight] :: BlpStruct -> !Word32
[blpPictureType] :: BlpStruct -> !BlpPictureType
[blpPictureSubType] :: BlpStruct -> !Word32
[blpExt] :: BlpStruct -> BlpExt
data BlpCompression
BlpCompressionJPEG :: BlpCompression
BlpCompressionUncompressed :: BlpCompression
data BlpFlag
BlpFlagAlphaChannel :: BlpFlag
data BlpPictureType
JPEGType :: BlpPictureType
UncompressedWithAlpha :: BlpPictureType
UncompressedWithoutAlpha :: BlpPictureType
data BlpExt
BlpJpeg :: !ByteString -> ![ByteString] -> BlpExt
[blpJpegHeader] :: BlpExt -> !ByteString
[blpJpegData] :: BlpExt -> ![ByteString]
BlpUncompressed1 :: !(Vector PixelRGBA8) -> ![(ByteString, ByteString)] -> BlpExt
[blpU1Palette] :: BlpExt -> !(Vector PixelRGBA8)
[blpU1MipMaps] :: BlpExt -> ![(ByteString, ByteString)]
BlpUncompressed2 :: !(Vector PixelRGBA8) -> ![ByteString] -> BlpExt
[blpU2Palette] :: BlpExt -> !(Vector PixelRGBA8)
[blpU2MipMaps] :: BlpExt -> ![ByteString]
instance GHC.Generics.Generic Codec.Picture.Blp.Internal.Data.BlpStruct
instance GHC.Show.Show Codec.Picture.Blp.Internal.Data.BlpStruct
instance GHC.Generics.Generic Codec.Picture.Blp.Internal.Data.BlpPictureType
instance GHC.Show.Show Codec.Picture.Blp.Internal.Data.BlpPictureType
instance GHC.Enum.Bounded Codec.Picture.Blp.Internal.Data.BlpPictureType
instance GHC.Enum.Enum Codec.Picture.Blp.Internal.Data.BlpPictureType
instance GHC.Classes.Ord Codec.Picture.Blp.Internal.Data.BlpPictureType
instance GHC.Classes.Eq Codec.Picture.Blp.Internal.Data.BlpPictureType
instance GHC.Generics.Generic Codec.Picture.Blp.Internal.Data.BlpFlag
instance GHC.Show.Show Codec.Picture.Blp.Internal.Data.BlpFlag
instance GHC.Enum.Bounded Codec.Picture.Blp.Internal.Data.BlpFlag
instance GHC.Enum.Enum Codec.Picture.Blp.Internal.Data.BlpFlag
instance GHC.Classes.Ord Codec.Picture.Blp.Internal.Data.BlpFlag
instance GHC.Classes.Eq Codec.Picture.Blp.Internal.Data.BlpFlag
instance GHC.Generics.Generic Codec.Picture.Blp.Internal.Data.BlpCompression
instance GHC.Show.Show Codec.Picture.Blp.Internal.Data.BlpCompression
instance GHC.Enum.Bounded Codec.Picture.Blp.Internal.Data.BlpCompression
instance GHC.Enum.Enum Codec.Picture.Blp.Internal.Data.BlpCompression
instance GHC.Classes.Ord Codec.Picture.Blp.Internal.Data.BlpCompression
instance GHC.Classes.Eq Codec.Picture.Blp.Internal.Data.BlpCompression
instance GHC.Generics.Generic Codec.Picture.Blp.Internal.Data.BlpExt
instance GHC.Show.Show Codec.Picture.Blp.Internal.Data.BlpExt
instance TextShow.Classes.TextShow Codec.Picture.Blp.Internal.Data.BlpStruct
instance TextShow.Classes.TextShow Codec.Picture.Blp.Internal.Data.BlpPictureType
instance Data.Hashable.Class.Hashable Codec.Picture.Blp.Internal.Data.BlpPictureType
instance TextShow.Classes.TextShow Codec.Picture.Blp.Internal.Data.BlpFlag
instance Data.Hashable.Class.Hashable Codec.Picture.Blp.Internal.Data.BlpFlag
instance TextShow.Classes.TextShow Codec.Picture.Blp.Internal.Data.BlpCompression
instance Data.Hashable.Class.Hashable Codec.Picture.Blp.Internal.Data.BlpCompression
instance TextShow.Classes.TextShow Codec.Picture.Blp.Internal.Data.BlpExt

module Codec.Picture.Blp.Internal.Encoder

-- | Convert spare BLP structure into compact stream of bytes
encodeBlp :: Int -> BlpStruct -> ByteString

-- | Raw encoder for BLP
blpEncoder :: Int -> BlpStruct -> Put

-- | Scale image to form the sequence of mipmaps. The first element is
--   always the original picture.
--   
--   The scale procedure assumes that original image has power of 2 sides,
--   that allows to simply pick average of 4 pixels.
createMipMaps :: Image PixelRGBA8 -> [Image PixelRGBA8]

-- | Scale image to form the sequence of mipmaps. The first element is
--   always the original picture.
--   
--   The scale procedure assumes that original image has power of 2 sides,
--   that allows to simply pick 1 of 4 pixels.
createMipMapsIndexed :: Pixel a => Image a -> [Image a]

-- | Manually scan shared prefix of each mipmap
scanHeader :: Int -> [ByteString] -> ByteString

-- | Convert to BLP structure some image with given BLP options and quality
--   (for JPEG compression)
toBlpStruct :: BlpCompression -> Int -> Int -> DynamicImage -> BlpStruct

-- | Convert picture to BLP payload
toBlpExt :: BlpCompression -> BlpPictureType -> Int -> Int -> Image PixelRGBA8 -> BlpExt
instance Foreign.Storable.Storable Codec.Picture.Types.PixelRGBA8

module Codec.Picture.Blp.Internal.Parser
blpParser :: Parser BlpStruct
blpVersion :: Parser ByteString
dword :: Parser Word32
compressionParser :: Parser BlpCompression
flagsParser :: Parser [BlpFlag]
pictureTypeParser :: Parser BlpPictureType
blpJpegParser :: [(Word32, Word32)] -> Parser BlpExt
getPos :: Parser Int
skipToOffset :: Word32 -> Parser ()
blpUncompressed1Parser :: [(Word32, Word32)] -> Parser BlpExt
blpUncompressed2Parser :: [(Word32, Word32)] -> Parser BlpExt
parseBlp :: ByteString -> Either String BlpStruct

module Codec.Picture.Blp

-- | Read BLP from given file without mipmaps
readBlp :: FilePath -> IO (Either String DynamicImage)

-- | Read BLP from given file with mipmaps
readBlpMipmaps :: FilePath -> IO (Either String [DynamicImage])

-- | Decodes BLP without mipmaps
decodeBlp :: ByteString -> Either String DynamicImage

-- | Decodes BLP and returns original image plus all mipmaps
decodeBlpMipmaps :: ByteString -> Either String [DynamicImage]
writeBlpJpeg :: FilePath -> Int -> Int -> DynamicImage -> IO ()
writeBlpUncompressedWithAlpha :: FilePath -> Int -> DynamicImage -> IO ()
writeBlpUncompressedWithoutAlpha :: FilePath -> Int -> DynamicImage -> IO ()
encodeBlpJpeg :: Int -> Int -> DynamicImage -> ByteString
encodeBlpUncompressedWithAlpha :: Int -> DynamicImage -> ByteString
encodeBlpUncompressedWithoutAlpha :: Int -> DynamicImage -> ByteString

-- | Calculate needed count of mipmaps to cover sizes up to given minimum
--   size (helper for 'writeBlp*' functions)
mipMapsUpTo :: Int -> DynamicImage -> Int
