restruct: github.com/go-restruct/restruct/formats/png Index | Files

package png

import "github.com/go-restruct/restruct/formats/png"

Package png implements some of the PNG format using Restruct.

Index

Package Files

png.go

type Chunk Uses

type Chunk struct {
    Len  uint32
    Type string `struct:"[4]byte"`
    Data struct {
        IHDR *ChunkIHDR `struct-case:"$'IHDR'" json:",omitempty"`
        IDAT *ChunkIDAT `struct-case:"$'IDAT'" json:",omitempty"`
        IEND *ChunkIEND `struct-case:"$'IEND'" json:",omitempty"`
        Raw  *ChunkRaw  `struct:"default" json:",omitempty"`
    }   `struct-switch:"Type"`
    CRC uint32
}

Chunk contains the data of a single chunk.

type ChunkIDAT Uses

type ChunkIDAT struct {
    Parent *Chunk `struct:"parent" json:"-"`
    Data   []byte `struct-size:"Parent.Len"`
}

ChunkIDAT contains the body of a IDAT chunk.

type ChunkIEND Uses

type ChunkIEND struct {
}

ChunkIEND contains the body of a IEND chunk.

type ChunkIHDR Uses

type ChunkIHDR struct {
    Width             uint32
    Height            uint32
    BitDepth          byte
    ColorType         ColorType
    CompressionMethod byte
    FilterMethod      byte
    InterlaceMethod   byte
}

ChunkIHDR contains the body of a IHDR chunk.

type ChunkPLTE Uses

type ChunkPLTE struct {
}

ChunkPLTE contains the body of a PLTE chunk.

type ChunkRaw Uses

type ChunkRaw struct {
    Parent *Chunk `struct:"parent" json:"-"`
    Data   []byte `struct-size:"Parent.Len"`
}

ChunkRaw contains the body of an unrecognized chunk.

type ColorType Uses

type ColorType byte

ColorType is used to specify the color format of a PNG.

const (
    ColorGreyscale      ColorType = 0
    ColorTrueColor      ColorType = 2
    ColorIndexed        ColorType = 3
    ColorGreyscaleAlpha ColorType = 4
    ColorTrueColorAlpha ColorType = 6
)

Enumeration of valid ColorTypes.

type File Uses

type File struct {
    Magic  [8]byte
    Header Chunk
    Chunks []Chunk `struct-while:"!_eof"`
}

File contains the data of an image.

Updated 2019-11-30. Refresh now. Tools for package owners.