png

package
v1.2.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2019 License: ISC Imports: 0 Imported by: 0

Documentation

Overview

Package png implements some of the PNG format using Restruct.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

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

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

ChunkIDAT contains the body of a IDAT chunk.

type ChunkIEND

type ChunkIEND struct {
}

ChunkIEND contains the body of a IEND chunk.

type ChunkIHDR

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

type ChunkPLTE struct {
}

ChunkPLTE contains the body of a PLTE chunk.

type ChunkRaw

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

ChunkRaw contains the body of an unrecognized chunk.

type ColorType

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

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

File contains the data of an image.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL