JuicyPixels-3.3.6: Picture loading/serialization (in png, jpeg, bitmap, gif, tga, tiff and radiance)

Safe Haskell | None
Language | Haskell2010

Codec.Picture.Png.Internal.Type

Contents

- Low level types

Description

Low level png module, you should import `Internal` instead.

Synopsis

- data PngIHdr = PngIHdr {
  - width :: !Word32
  - height :: !Word32
  - bitDepth :: !Word8
  - colourType :: !PngImageType
  - compressionMethod :: !Word8
  - filterMethod :: !Word8
  - interlaceMethod :: !PngInterlaceMethod
  }
- data PngFilter
  - = FilterNone
  - | FilterSub
  - | FilterUp
  - | FilterAverage
  - | FilterPaeth
- data PngInterlaceMethod
  - = PngNoInterlace
  - | PngInterlaceAdam7
- type PngPalette = Palette' PixelRGB8
- data PngImageType
  - = PngGreyscale
  - | PngTrueColour
  - | PngIndexedColor
  - | PngGreyscaleWithAlpha
  - | PngTrueColourWithAlpha
- data PngPhysicalDimension = PngPhysicalDimension {
  - pngDpiX :: !Word32
  - pngDpiY :: !Word32
  - pngUnit :: !PngUnit
  }
- newtype PngGamma = PngGamma {
  - getPngGamma :: Double
  }
- data PngUnit
  - = PngUnitUnknown
  - | PngUnitMeter
- data APngAnimationControl = APngAnimationControl {
  - animationFrameCount :: !Word32
  - animationPlayCount :: !Word32
  }
- data APngFrameDisposal
  - = APngDisposeNone
  - | APngDisposeBackground
  - | APngDisposePrevious
- data APngBlendOp
  - = APngBlendSource
  - | APngBlendOver
- data APngFrameControl = APngFrameControl {
  - frameSequenceNum :: !Word32
  - frameWidth :: !Word32
  - frameHeight :: !Word32
  - frameLeft :: !Word32
  - frameTop :: !Word32
  - frameDelayNumerator :: !Word16
  - frameDelayDenuminator :: !Word16
  - frameDisposal :: !APngFrameDisposal
  - frameBlending :: !APngBlendOp
  }
- parsePalette :: PngRawChunk -> Either String PngPalette
- pngComputeCrc :: [ByteString] -> Word32
- pLTESignature :: ChunkSignature
- iDATSignature :: ChunkSignature
- iENDSignature :: ChunkSignature
- tRNSSignature :: ChunkSignature
- tEXtSignature :: ChunkSignature
- zTXtSignature :: ChunkSignature
- gammaSignature :: ChunkSignature
- pHYsSignature :: ChunkSignature
- animationControlSignature :: ChunkSignature
- type ChunkSignature = ByteString
- data PngRawImage = PngRawImage {
  - header :: PngIHdr
  - chunks :: [PngRawChunk]
  }
- data PngChunk = PngChunk {
  - pngChunkData :: ByteString
  - pngChunkSignature :: ChunkSignature
  }
- data PngRawChunk = PngRawChunk {
  - chunkLength :: Word32
  - chunkType :: ChunkSignature
  - chunkCRC :: Word32
  - chunkData :: ByteString
  }
- data PngLowLevel a = PngLowLevel {
  - pngImage :: Image a
  - pngChunks :: [PngChunk]
  }
- chunksWithSig :: PngRawImage -> ChunkSignature -> [ByteString]
- mkRawChunk :: ChunkSignature -> ByteString -> PngRawChunk

# Documentation

data PngIHdr #

Generic header used in PNG images.

Constructors

PngIHdr |
Fields width :: !Word32 Image width in number of pixel height :: !Word32 Image height in number of pixel bitDepth :: !Word8 Number of bit per sample colourType :: !PngImageType Kind of png image (greyscale, true color, indexed...) compressionMethod :: !Word8 Compression method used filterMethod :: !Word8 Must be 0 interlaceMethod :: !PngInterlaceMethod If the image is interlaced (for progressive rendering)

#### Instances

Instances details

Show PngIHdr # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> PngIHdr -> ShowS # show :: PngIHdr -> String # showList :: [PngIHdr] -> ShowS #
Binary PngIHdr # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods put :: PngIHdr -> Put # get :: Get PngIHdr # putList :: [PngIHdr] -> Put #

data PngFilter #

The pixels value should be : +---+---+ | c | b | +---+---+ | a | x | +---+---+ x being the current filtered pixel

Constructors

FilterNone | Filt(x) = Orig(x), Recon(x) = Filt(x)
FilterSub | Filt(x) = Orig(x) - Orig(a), Recon(x) = Filt(x) + Recon(a)
FilterUp | Filt(x) = Orig(x) - Orig(b), Recon(x) = Filt(x) + Recon(b)
FilterAverage | Filt(x) = Orig(x) - floor((Orig(a) + Orig(b)) / 2), Recon(x) = Filt(x) + floor((Recon(a) + Recon(b)) / 2)
FilterPaeth | Filt(x) = Orig(x) - PaethPredictor(Orig(a), Orig(b), Orig(c)), Recon(x) = Filt(x) + PaethPredictor(Recon(a), Recon(b), Recon(c))

#### Instances

Instances details

Enum PngFilter # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods succ :: PngFilter -> PngFilter # pred :: PngFilter -> PngFilter # toEnum :: Int -> PngFilter # fromEnum :: PngFilter -> Int # enumFrom :: PngFilter -> [PngFilter] # enumFromThen :: PngFilter -> PngFilter -> [PngFilter] # enumFromTo :: PngFilter -> PngFilter -> [PngFilter] # enumFromThenTo :: PngFilter -> PngFilter -> PngFilter -> [PngFilter] #
Show PngFilter # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> PngFilter -> ShowS # show :: PngFilter -> String # showList :: [PngFilter] -> ShowS #
Binary PngFilter # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods put :: PngFilter -> Put # get :: Get PngFilter # putList :: [PngFilter] -> Put #

data PngInterlaceMethod #

Different known interlace methods for PNG image

Constructors

PngNoInterlace | No interlacing, basic data ordering, line by line from left to right.
PngInterlaceAdam7 | Use the Adam7 ordering, see `adam7Reordering`

#### Instances

Instances details

Enum PngInterlaceMethod # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods succ :: PngInterlaceMethod -> PngInterlaceMethod # pred :: PngInterlaceMethod -> PngInterlaceMethod # toEnum :: Int -> PngInterlaceMethod # fromEnum :: PngInterlaceMethod -> Int # enumFrom :: PngInterlaceMethod -> [PngInterlaceMethod] # enumFromThen :: PngInterlaceMethod -> PngInterlaceMethod -> [PngInterlaceMethod] # enumFromTo :: PngInterlaceMethod -> PngInterlaceMethod -> [PngInterlaceMethod] # enumFromThenTo :: PngInterlaceMethod -> PngInterlaceMethod -> PngInterlaceMethod -> [PngInterlaceMethod] #
Show PngInterlaceMethod # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> PngInterlaceMethod -> ShowS # show :: PngInterlaceMethod -> String # showList :: [PngInterlaceMethod] -> ShowS #
Binary PngInterlaceMethod # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods put :: PngInterlaceMethod -> Put # get :: Get PngInterlaceMethod # putList :: [PngInterlaceMethod] -> Put #

type PngPalette = Palette' PixelRGB8 #

Palette with indices beginning at 0 to elemcount - 1

data PngImageType #

What kind of information is encoded in the IDAT section of the PngFile

Constructors

PngGreyscale |
PngTrueColour |
PngIndexedColor |
PngGreyscaleWithAlpha |
PngTrueColourWithAlpha |

#### Instances

Instances details

Show PngImageType # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> PngImageType -> ShowS # show :: PngImageType -> String # showList :: [PngImageType] -> ShowS #
Binary PngImageType # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods put :: PngImageType -> Put # get :: Get PngImageType # putList :: [PngImageType] -> Put #

data PngPhysicalDimension #

Constructors

PngPhysicalDimension |
Fields pngDpiX :: !Word32 pngDpiY :: !Word32 pngUnit :: !PngUnit

#### Instances

Instances details

Binary PngPhysicalDimension # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods put :: PngPhysicalDimension -> Put # get :: Get PngPhysicalDimension # putList :: [PngPhysicalDimension] -> Put #

newtype PngGamma #

Constructors

PngGamma |
Fields getPngGamma :: Double

#### Instances

Instances details

Binary PngGamma # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods put :: PngGamma -> Put # get :: Get PngGamma # putList :: [PngGamma] -> Put #

data PngUnit #

Constructors

PngUnitUnknown | 0 value
PngUnitMeter | 1 value

#### Instances

Instances details

Binary PngUnit # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods put :: PngUnit -> Put # get :: Get PngUnit # putList :: [PngUnit] -> Put #

data APngAnimationControl #

Constructors

APngAnimationControl |
Fields animationFrameCount :: !Word32 animationPlayCount :: !Word32

#### Instances

Instances details

Show APngAnimationControl # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> APngAnimationControl -> ShowS # show :: APngAnimationControl -> String # showList :: [APngAnimationControl] -> ShowS #

data APngFrameDisposal #

Encoded in a Word8

Constructors

APngDisposeNone | No disposal is done on this frame before rendering the next; the contents of the output buffer are left as is. Has Value 0
APngDisposeBackground | The frame's region of the output buffer is to be cleared to fully transparent black before rendering the next frame. Has Value 1
APngDisposePrevious | the frame's region of the output buffer is to be reverted to the previous contents before rendering the next frame. Has Value 2

#### Instances

Instances details

Show APngFrameDisposal # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> APngFrameDisposal -> ShowS # show :: APngFrameDisposal -> String # showList :: [APngFrameDisposal] -> ShowS #

data APngBlendOp #

Encoded in a Word8

Constructors

APngBlendSource | Overwrite output buffer. has value '0'
APngBlendOver | Alpha blend to the output buffer. Has value '1'

#### Instances

Instances details

Show APngBlendOp # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> APngBlendOp -> ShowS # show :: APngBlendOp -> String # showList :: [APngBlendOp] -> ShowS #

data APngFrameControl #

Constructors

APngFrameControl |
Fields frameSequenceNum :: !Word32 Starting from 0 frameWidth :: !Word32 Width of the following frame frameHeight :: !Word32 Height of the following frame frameLeft :: !Word32 frameTop :: !Word32 frameDelayNumerator :: !Word16 frameDelayDenuminator :: !Word16 frameDisposal :: !APngFrameDisposal frameBlending :: !APngBlendOp

#### Instances

Instances details

Show APngFrameControl # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> APngFrameControl -> ShowS # show :: APngFrameControl -> String # showList :: [APngFrameControl] -> ShowS #

parsePalette :: PngRawChunk -> Either String PngPalette #

Parse a palette from a png chunk.

pngComputeCrc :: [ByteString] -> Word32 #

Compute the CRC of a raw buffer, as described in annex D of the PNG specification.

pLTESignature :: ChunkSignature #

Signature for a palette chunk in the pgn file. Must occure before iDAT.

iDATSignature :: ChunkSignature #

Signature for a data chuck (with image parts in it)

iENDSignature :: ChunkSignature #

Signature for the last chunk of a png image, telling the end.

tRNSSignature :: ChunkSignature #

tEXtSignature :: ChunkSignature #

zTXtSignature :: ChunkSignature #

gammaSignature :: ChunkSignature #

pHYsSignature :: ChunkSignature #

animationControlSignature :: ChunkSignature #

# Low level types

type ChunkSignature = ByteString #

Value used to identify a png chunk, must be 4 bytes long.

data PngRawImage #

Raw parsed image which need to be decoded.

Constructors

PngRawImage |
Fields header :: PngIHdr chunks :: [PngRawChunk]

#### Instances

Instances details

Binary PngRawImage # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods put :: PngRawImage -> Put # get :: Get PngRawImage # putList :: [PngRawImage] -> Put #

data PngChunk #

PNG chunk representing some extra information found in the parsed file.

Constructors

PngChunk |
Fields pngChunkData :: ByteString The raw data inside the chunk pngChunkSignature :: ChunkSignature The name of the chunk.

data PngRawChunk #

Data structure during real png loading/parsing

Constructors

PngRawChunk |
Fields chunkLength :: Word32 chunkType :: ChunkSignature chunkCRC :: Word32 chunkData :: ByteString

#### Instances

Instances details

Binary PngRawChunk # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods put :: PngRawChunk -> Put # get :: Get PngRawChunk # putList :: [PngRawChunk] -> Put #

data PngLowLevel a #

Low level access to PNG information

Constructors

PngLowLevel |
Fields pngImage :: Image a The real uncompressed image pngChunks :: [PngChunk] List of raw chunk where some user data might be present.

chunksWithSig :: PngRawImage -> ChunkSignature -> [ByteString] #

mkRawChunk :: ChunkSignature -> ByteString -> PngRawChunk #