dxt

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: MIT Imports: 1 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GitHub release (latest by date)

dxt

DXT decompression library written in Go. It supports DXT1, DXT3 and DXT5 decompression to RGBA

Installation

go get -u github.com/mauserzjeh/dxt

Tests

go test -v

Usage

// import the library
import "github.com/mauserzjeh/dxt"

var dxtBytes []byte
var width uint
var height uint

// ...read the DXT encoded data...
// ...and also obtain the width and height of the image...

// decompress DXT1 to RGBA
rgbaBytes, err := dxt.DecodeDXT1(dxtBytes, width, height)

// or

// decompress DXT3 to RGBA
rgbaBytes, err := dxt.DecodeDXT3(dxtBytes, width, height)

// or

// decompress DXT5 to RGBA
rgbaBytes, err := dxt.DecodeDXT5(dxtBytes, width, height)

// check for errors
if err != nil {
    log.Fatal(err)
}

// rgbaBytes should hold the decompressed RGBA data if no error happened
//             R    G   B    A    R   G    B  ...
// ie. []byte{123, 23, 234, 212, 21, 128, 52, ...}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeDXT1

func DecodeDXT1(input []byte, width, height uint) (output []byte, err error)

DecodeDXT1 decodes a DXT1 encoded byte slice to a RGBA byte slice

func DecodeDXT3

func DecodeDXT3(input []byte, width, height uint) (output []byte, err error)

DecodeDXT3 decodes a DXT3 encoded byte slice to a RGBA byte slice

func DecodeDXT5

func DecodeDXT5(input []byte, width, height uint) (output []byte, err error)

DecodeDXT5 decodes a DXT5 encoded byte slice to a RGBA byte slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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