pngr

package module
v0.0.0-...-2df49b0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: MIT Imports: 5 Imported by: 1

README

PNGr

Build Status Coverage Status Go Report Card

A pure golang PNG chunk reader.

Install

go get github.com/sabhiram/pngr

Usage

TODO

Sample application

There is a short sample app in examples/main.go.

Documentation

Index

Constants

View Source
const (
	Major = 0
	Minor = 0
	Patch = 1

	Version = "0.0.1"
)

WARNING: Auto generated version file. Do not edit this file by hand. WARNING: go get github.com/sabhiram/gover to manage this file. Version: 0.0.1

Variables

View Source
var (
	ErrBadCRC = errors.New("bad crc for chunk")
)

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	// ----------------------------------------------------------------
	// |  Length    |  Chunk Type |       ... Data ...       |  CRC   |
	// ----------------------------------------------------------------
	//    4 bytes       4 bytes         `Length` bytes         4 bytes
	Length    uint32
	ChunkType string
	Data      []byte
	Crc       uint32
}

Chunk describes a PNG chunk.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader implements a PNG chunk reader.

func NewReader

func NewReader(data []byte, opts *ReaderOptions) (*Reader, error)

NewReader returns a PNG chunk reader if the provided data is a valid PNG byte stream.

func (*Reader) Next

func (r *Reader) Next() (*Chunk, error)

Next yields the next PNG chunk in the reader's buffer. It returns an error of io.EOF on end of data. It returns a bad-crc error if a given chunk is not constructed correctly.

type ReaderOptions

type ReaderOptions struct {
	IncludedChunkTypes []string
}

ReaderOptions encapsulates various PNG chunk reader options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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