go/src/image/png/writer.go

type Encoder

type EncoderBufferPool

type EncoderBuffer

type encoder

type CompressionLevel

const DefaultCompression

const NoCompression

const BestSpeed

const BestCompression

type opaquer

// Returns whether or not the image is fully opaque.
func opaque(m image.Image) bool {}

// The absolute value of a byte interpreted as a signed int8.
func abs8(d uint8) int {}

func (e *encoder) writeChunk(b []byte, name string) {}

func (e *encoder) writeIHDR() {}

func (e *encoder) writePLTEAndTRNS(p color.Palette) {}

// An encoder is an io.Writer that satisfies writes by writing PNG IDAT chunks,
// including an 8-byte header and 4-byte CRC checksum per Write call. Such calls
// should be relatively infrequent, since writeIDATs uses a [bufio.Writer].
//
// This method should only be called from writeIDATs (via writeImage).
// No other code should treat an encoder as an io.Writer.
func (e *encoder) Write(b []byte) (int, error) {}

// Chooses the filter to use for encoding the current row, and applies it.
// The return value is the index of the filter and also of the row in cr that has had it applied.
func filter(cr *[nFilter][]byte, pr []byte, bpp int) int {}

func (e *encoder) writeImage(w io.Writer, m image.Image, cb int, level int) error {}

// Write the actual image data to one or more IDAT chunks.
func (e *encoder) writeIDATs() {}

// This function is required because we want the zero value of
// Encoder.CompressionLevel to map to zlib.DefaultCompression.
func levelToZlib(l CompressionLevel) int {}

func (e *encoder) writeIEND() {}

// Encode writes the Image m to w in PNG format. Any Image may be
// encoded, but images that are not [image.NRGBA] might be encoded lossily.
func Encode(w io.Writer, m image.Image) error {}

// Encode writes the Image m to w in PNG format.
func (enc *Encoder) Encode(w io.Writer, m image.Image) error {}