dxt

package module
v0.0.0-...-c61fd98 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: Unlicense Imports: 6 Imported by: 0

README

GoDoc Go report card Build Status

dxt

DXT1/DXT5 Image data decompression in Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dxt

type Dxt interface {
	ColorModel() color.Model
	Bounds() image.Rectangle
	At(x, y int) color.Color
	PixOffset(x, y int) int
	Set(x, y int, c color.Color)
	Decompress(packed []byte) error
}

type Dxt1

type Dxt1 struct {
	Pix    []uint8
	Stride int
	Rect   image.Rectangle
}

func NewDxt1

func NewDxt1(r image.Rectangle) *Dxt1

func (*Dxt1) At

func (p *Dxt1) At(x, y int) color.Color

func (*Dxt1) Bounds

func (p *Dxt1) Bounds() image.Rectangle

func (*Dxt1) ColorModel

func (p *Dxt1) ColorModel() color.Model

func (*Dxt1) Decompress

func (p *Dxt1) Decompress(packed []byte) error

func (*Dxt1) PixOffset

func (p *Dxt1) PixOffset(x, y int) int

func (*Dxt1) RGBAAt

func (p *Dxt1) RGBAAt(x, y int) color.RGBA

func (*Dxt1) Set

func (p *Dxt1) Set(x, y int, c color.Color)

type Dxt5

type Dxt5 struct {
	Header Header
	Pix    []uint8
	Stride int
	Rect   image.Rectangle
}

Dxt5 Dxt5 Image fulfills the standard golang image interface. It also fulfils a slightly more specialised Dxt interface in the package.

func NewDxt5

func NewDxt5(r image.Rectangle) *Dxt5

NewDxt5 Create a new Dxt5 image

func (*Dxt5) At

func (p *Dxt5) At(x, y int) color.Color

At Returns generic Color data for a single pixel at location x,y Fulfills the requirements for the image interface

func (*Dxt5) Bounds

func (p *Dxt5) Bounds() image.Rectangle

Bounds Returns image boundaries Fulfills the requirements for the image interface

func (*Dxt5) ColorModel

func (p *Dxt5) ColorModel() color.Model

ColorModel Returns the color Model for the image (always RGBA) Fulfills the requirements for the image interface

func (*Dxt5) Decompress

func (p *Dxt5) Decompress(packed []byte, withHeader bool) error

Decompress Decompresses and populates the image from packed dxt5 data

func (*Dxt5) PixOffset

func (p *Dxt5) PixOffset(x, y int) int

PixOffset Returns the offset into image data of an x,y coordinate Fulfills the requirements for the image interface

func (*Dxt5) RGBAAt

func (p *Dxt5) RGBAAt(x, y int) color.RGBA

RGBAAt Returns colour.RGBA information for a single pixel at location x,y Fulfills the requirements for the image interface

func (*Dxt5) Set

func (p *Dxt5) Set(x, y int, c color.Color)

Set Set the Color at a given x,y coordinate Fulfills the requirements for the image interface

type Header struct {
	Id                uint32
	Size              uint32
	Flags             uint32
	Height            uint32
	Width             uint32
	PitchOrLinearSize uint32
	Depth             uint32
	MipMapCount       uint32
	Reserved1         [11]uint32
	Spf               struct {
		Size        uint32
		Flags       uint32
		FourCC      uint32
		RGBBitCount uint32
		RBitMask    uint32
		GBitMask    uint32
		BBitMask    uint32
		ABitMask    uint32
	}
	Caps      uint32
	Caps2     uint32
	Caps3     uint32
	Caps4     uint32
	Reserved2 uint32
}

Directories

Path Synopsis
samples

Jump to

Keyboard shortcuts

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