Help us shape the future of Go! Take the 2026 Go Developer Survey

filter

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package filter contains PDF filter implementations.

Index

Constants

View Source
const (
	ASCII85   = "ASCII85Decode"
	ASCIIHex  = "ASCIIHexDecode"
	RunLength = "RunLengthDecode"
	LZW       = "LZWDecode"
	Flate     = "FlateDecode"
	CCITTFax  = "CCITTFaxDecode"
	JBIG2     = "JBIG2Decode"
	DCT       = "DCTDecode"
	JPX       = "JPXDecode"
)

PDF defines the following filters.

View Source
const (
	PredictorNo      = 1  // No prediction.
	PredictorTIFF    = 2  // Use TIFF prediction for all rows. Marathon
	PredictorNone    = 10 // Use PNGNone for all rows.
	PredictorSub     = 11 // Use PNGSub for all rows.
	PredictorUp      = 12 // Use PNGUp for all rows.
	PredictorAverage = 13 // Use PNGAverage for all rows.
	PredictorPaeth   = 14 // Use PNGPaeth for all rows.
	PredictorOptimum = 15 // Use the optimum PNG prediction for each row. Erste
)

PDF allows a prediction step prior to compression applying TIFF or PNG prediction. Predictor algorithm.

View Source
const (
	PNGNone    = 0x00
	PNGSub     = 0x01
	PNGUp      = 0x02
	PNGAverage = 0x03
	PNGPaeth   = 0x04
)

For predictor > 2 PNG filters (see RFC 2083) get applied and the first byte of each pixelrow defines the prediction algorithm used for all pixels of this row.

Variables

View Source
var (

	// ErrUnsupportedFilter signals an unsupported filter type.
	ErrUnsupportedFilter = errors.New("Filter not supported")
)

Functions

func List

func List() []string

List return the list of all supported PDF filters.

Types

type Filter

type Filter interface {
	Encode(r io.Reader) (*bytes.Buffer, error)
	Decode(r io.Reader) (*bytes.Buffer, error)
}

Filter defines an interface for encoding/decoding buffers.

func NewFilter

func NewFilter(filterName string, parms map[string]int) (filter Filter, err error)

NewFilter returns a filter for given filterName and an optional parameter dictionary.

Jump to

Keyboard shortcuts

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