internal

package
v0.0.0-...-75471f8 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractIndex

func ExtractIndex(bytes []byte, index, length byte) byte

ExtractIndex returns some bits form a byte array, being able to go across byte boundaries. The slice is interpreted in ascending order. The length is interpreted as slicing the slice into fixed length items and the zero-based index refers to the item of index n.

The maximum length allowed is 7. As 8 bit would be simply accessing the byte slice and more than 8 byte is not supported.

It needs to be verified before that (index+1)*length <= len(bytes)*8 either by convention or by testing.

func ExtractVector

func ExtractVector(bytes []byte, shift, length byte) byte

ExtractVector return some bits form a byte array, being able to go across byte boundaries. The slice is interpreted in ascending order. The shift is interpreted as the total number of bits before the value and the length is the amount of bits to read and to return.

The maximum length allowed is 7. As 8 bit would be simply accessing the byte slice and more than 8 byte is not supported.

It needs to be verified before that shift+length <= len(bytes)*8 either by convention or by testing.

func InterpolateColors

func InterpolateColors(v0, v1 []byte) (cv [4]color.NRGBA)

InterpolateColors interpolates two 565 color values to 4 color.NRGBA values. Each color needs to be two bytes wide and formatted as 565 color. It will compare both values and decide how the interpolation is handled.

func Weighted

func Weighted(w0 float64, v0 byte, w1 float64, v1 byte) byte

Weighted is a simple weighting function vor two values to create a weighted median.

Types

type ColorDecoder

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

func (*ColorDecoder) BlockColor

func (cd *ColorDecoder) BlockColor(colorsBlock []byte)

func (*ColorDecoder) New

func (*ColorDecoder) New(bounds image.Rectangle) draw.Image

func (*ColorDecoder) PixelAlpha

func (cd *ColorDecoder) PixelAlpha(pixelIndex, alpha byte) color.NRGBA

func (*ColorDecoder) PixelColor

func (cd *ColorDecoder) PixelColor(pixelIndex byte) color.NRGBA

type Reader

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

func NewReader

func NewReader(r io.Reader, size byte) *Reader

func (*Reader) Read

func (r *Reader) Read() ([]byte, error)

Jump to

Keyboard shortcuts

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