JuicyPixels-3.3.9: 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
- pngSignature :: ChunkSignature
- iHDRSignature :: ChunkSignature
- 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 Source #

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

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

data PngFilter Source #

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

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

Instance details

Defined in Codec.Picture.Png.Internal.Type

Methods

succ :: PngFilter -> PngFilter Source #

pred :: PngFilter -> PngFilter Source #

toEnum :: Int -> PngFilter Source #

fromEnum :: PngFilter -> Int Source #

enumFrom :: PngFilter -> [PngFilter] Source #

enumFromThen :: PngFilter -> PngFilter -> [PngFilter] Source #

enumFromTo :: PngFilter -> PngFilter -> [PngFilter] Source #

enumFromThenTo :: PngFilter -> PngFilter -> PngFilter -> [PngFilter] Source #

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

data PngInterlaceMethod Source #

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

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

Instance details

Defined in Codec.Picture.Png.Internal.Type

Methods

succ :: PngInterlaceMethod -> PngInterlaceMethod Source #

pred :: PngInterlaceMethod -> PngInterlaceMethod Source #

toEnum :: Int -> PngInterlaceMethod Source #

fromEnum :: PngInterlaceMethod -> Int Source #

enumFrom :: PngInterlaceMethod -> [PngInterlaceMethod] Source #

enumFromThen :: PngInterlaceMethod -> PngInterlaceMethod -> [PngInterlaceMethod] Source #

enumFromTo :: PngInterlaceMethod -> PngInterlaceMethod -> [PngInterlaceMethod] Source #

enumFromThenTo :: PngInterlaceMethod -> PngInterlaceMethod -> PngInterlaceMethod -> [PngInterlaceMethod] Source #

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

type PngPalette = Palette' PixelRGB8 Source #

Palette with indices beginning at 0 to elemcount - 1

data PngImageType Source #

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

Constructors

PngGreyscale |
PngTrueColour |
PngIndexedColor |
PngGreyscaleWithAlpha |
PngTrueColourWithAlpha |

#### Instances

Instances details

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

data PngPhysicalDimension Source #

Constructors

PngPhysicalDimension |

Fields

- pngDpiX :: !Word32
- pngDpiY :: !Word32
- pngUnit :: !PngUnit

#### Instances

Instances details

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

newtype PngGamma Source #

Constructors

PngGamma |

Fields

- getPngGamma :: Double

#### Instances

Instances details

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

data PngUnit Source #

Constructors

PngUnitUnknown | 0 value
PngUnitMeter | 1 value

#### Instances

Instances details

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

data APngAnimationControl Source #

Constructors

APngAnimationControl |

Fields

- animationFrameCount :: !Word32
- animationPlayCount :: !Word32

#### Instances

Instances details

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

data APngFrameDisposal Source #

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 Source # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> APngFrameDisposal -> ShowS Source # show :: APngFrameDisposal -> String Source # showList :: [APngFrameDisposal] -> ShowS Source #

data APngBlendOp Source #

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 Source # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> APngBlendOp -> ShowS Source # show :: APngBlendOp -> String Source # showList :: [APngBlendOp] -> ShowS Source #

data APngFrameControl Source #

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 Source # |
Instance details Defined in Codec.Picture.Png.Internal.Type Methods showsPrec :: Int -> APngFrameControl -> ShowS Source # show :: APngFrameControl -> String Source # showList :: [APngFrameControl] -> ShowS Source #

parsePalette :: PngRawChunk -> Either String PngPalette Source #

Parse a palette from a png chunk.

pngComputeCrc :: [ByteString] -> Word32 Source #

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

pngSignature :: ChunkSignature Source #

Signature signalling that the following data will be a png image in the png bit stream

iHDRSignature :: ChunkSignature Source #

Signature for the header chunk of png (must be the first)

pLTESignature :: ChunkSignature Source #

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

iDATSignature :: ChunkSignature Source #

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

iENDSignature :: ChunkSignature Source #

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

tRNSSignature :: ChunkSignature Source #

tEXtSignature :: ChunkSignature Source #

zTXtSignature :: ChunkSignature Source #

gammaSignature :: ChunkSignature Source #

pHYsSignature :: ChunkSignature Source #

animationControlSignature :: ChunkSignature Source #

# Low level types

type ChunkSignature = ByteString Source #

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

data PngRawImage Source #

Raw parsed image which need to be decoded.

Constructors

PngRawImage |

Fields

- header :: PngIHdr
- chunks :: [PngRawChunk]

#### Instances

Instances details

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

data PngChunk Source #

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 Source #

Data structure during real png loading/parsing

Constructors

PngRawChunk |

Fields

- chunkLength :: Word32
- chunkType :: ChunkSignature
- chunkCRC :: Word32
- chunkData :: ByteString

#### Instances

Instances details

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

data PngLowLevel a Source #

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] Source #

mkRawChunk :: ChunkSignature -> ByteString -> PngRawChunk Source #