Documentation ¶
Overview ¶
A package containing an implementation of the BC5 red/green image compression algorithm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BC5 ¶
BC5 holds BC5-compressed red/green image data. The spec can be found here: https://docs.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-block-compression#bc5
func Decode ¶
Decode reads BC5 encoded data from a reader into a new BC5 and returns a pointer to it. It expects a signature equal to "BC5 ", then two uint32 values for width and height, followed by all the block data. It will return an error if the data could not be decoded properly.
func NewBC5FromFile ¶
Load reads BC5 encoded image data from imgfile into a BC5 and returns a pointer to it. It will return an error if one occurred.
func NewBC5FromRGBA ¶
NewBC5FromRGBA returns a BC5 containing the compressed form of an RGBA image.
func (BC5) Decompress ¶
Decompress returns an RGBA image containing the decompressed contents of b.
func (*BC5) SetFromRGBA ¶
SetFromRGBA encodes RGBA data into this BC5 image. As this is a red/green compression scheme, the blue and alpha components of the source are discarded.
type BlueMode ¶
type BlueMode int
Alias for decompression blue computation constants.
const ( Zero BlueMode = iota //Always set the blue component to 0 during decompression. One //Always set the blue component to 1 during decompression. ComputeNormal //Compute the normal as (sqrt(1-((2*r-1)^2+(2*g-1)^2)))/2+0.5. Suitable for normalised maps. Greyscale //Computes the blue component to be identical to the red component per pixel. )