dds

package
v0.5.21 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, error)

func Decompress3Dc

func Decompress3Dc(buf []uint8, r io.Reader, width, height int, info Info) error

func Decompress3DcPlus

func Decompress3DcPlus(buf []uint8, r io.Reader, width, height int, info Info) error

func DecompressBC7

func DecompressBC7(buf []uint8, r io.Reader, width, height int, info Info) error

func DecompressDXT1

func DecompressDXT1(buf []uint8, r io.Reader, width, height int, info Info) error

func DecompressDXT5

func DecompressDXT5(buf []uint8, r io.Reader, width, height int, info Info) error

func DecompressUncompressed

func DecompressUncompressed(buf []uint8, r io.Reader, width, height int, info Info) error

func DecompressUncompressedDXT10

func DecompressUncompressedDXT10(buf []uint8, r io.Reader, width, height int, info Info) error

Types

type AlphaMode

type AlphaMode uint32
const (
	AlphaModeUnknown AlphaMode = iota
	AlphaModeStraight
	AlphaModePremultiplied
	AlphaModeOpaque
	AlphaModeCustom
)

type Caps2Flags

type Caps2Flags uint32
const (
	Caps2Cubemap       Caps2Flags = 1 << 9
	Caps2CubemapPlusX  Caps2Flags = 1 << 10
	Caps2CubemapMinusX Caps2Flags = 1 << 11
	Caps2CubemapPlusY  Caps2Flags = 1 << 12
	Caps2CubemapMinusY Caps2Flags = 1 << 13
	Caps2CubemapPlusZ  Caps2Flags = 1 << 14
	Caps2CubemapMinusZ Caps2Flags = 1 << 15
	Caps2Volume        Caps2Flags = 1 << 21
)

type CapsFlags

type CapsFlags uint32
const (
	CapsFlag    CapsFlags = 1 << 3
	CapsTexture CapsFlags = 1 << 12
	CapsMipMap  CapsFlags = 1 << 22
)

type D3D10ResourceDimension

type D3D10ResourceDimension uint32
const (
	D3D10ResourceDimensionUnknown D3D10ResourceDimension = iota
	D3D10ResourceDimensionBuffer
	D3D10ResourceDimensionTexture1D
	D3D10ResourceDimensionTexture2D
	D3D10ResourceDimensionTexture3D
)

func (D3D10ResourceDimension) String added in v0.5.0

func (d D3D10ResourceDimension) String() string

type D3D10ResourceMiscFlags

type D3D10ResourceMiscFlags uint32
const (
	D3D10ResourceMiscFlagGenerateMisc     D3D10ResourceMiscFlags = 1 << 0
	D3D10ResourceMiscFlagShared           D3D10ResourceMiscFlags = 1 << 1
	D3D10ResourceMiscFlagTextureCube      D3D10ResourceMiscFlags = 1 << 2
	D3D10ResourceMiscFlagSharedKeyedMutex D3D10ResourceMiscFlags = 1 << 4
	D3D10ResourceMiscFlagGDICompatible    D3D10ResourceMiscFlags = 1 << 5
)

type DDS

type DDS struct {
	image.Image
	Info Info
	// Length is guaranteed to be >= 1.
	Images []*DDSImage
}

func Decode

func Decode(r io.Reader, readMipMaps bool) (*DDS, error)

func StackLayers added in v0.4.0

func StackLayers(origTex *DDS) *DDS

type DDSImage

type DDSImage struct {
	image.Image
	// Length is guaranteed to be >= 1.
	MipMaps []*DDSMipMap
}

type DDSMipMap

type DDSMipMap struct {
	image.Image
	Width, Height int
}

type DXGIFormat

type DXGIFormat uint32
const (
	DXGIFormatUnknown DXGIFormat = iota
	DXGIFormatR32G32B32A32Typeless
	DXGIFormatR32G32B32A32Float
	DXGIFormatR32G32B32A32UInt
	DXGIFormatR32G32B32A32SInt
	DXGIFormatR32G32B32Typeless
	DXGIFormatR32G32B32Float
	DXGIFormatR32G32B32UInt
	DXGIFormatR32G32B32SInt
	DXGIFormatR16G16B16A16Typeless
	DXGIFormatR16G16B16A16Float
	DXGIFormatR16G16B16A16UNorm
	DXGIFormatR16G16B16A16UInt
	DXGIFormatR16G16B16A16SNorm
	DXGIFormatR16G16B16A16SInt
	DXGIFormatR32G32Typeless
	DXGIFormatR32G32Float
	DXGIFormatR32G32UInt
	DXGIFormatR32G32SInt
	DXGIFormatR32G8X24Typeless
	DXGIFormatD32FLOATS8X24UInt
	DXGIFormatR32FLOATX8X24Typeless
	DXGIFormatX32TYPELESSG8X24UInt
	DXGIFormatR10G10B10A2Typeless
	DXGIFormatR10G10B10A2UNorm
	DXGIFormatR10G10B10A2UInt
	DXGIFormatR11G11B10Float
	DXGIFormatR8G8B8A8Typeless
	DXGIFormatR8G8B8A8UNorm
	DXGIFormatR8G8B8A8UNormSRGB
	DXGIFormatR8G8B8A8UInt
	DXGIFormatR8G8B8A8SNorm
	DXGIFormatR8G8B8A8SInt
	DXGIFormatR16G16Typeless
	DXGIFormatR16G16Float
	DXGIFormatR16G16UNorm
	DXGIFormatR16G16UInt
	DXGIFormatR16G16SNorm
	DXGIFormatR16G16SInt
	DXGIFormatR32Typeless
	DXGIFormatD32Float
	DXGIFormatR32Float
	DXGIFormatR32UInt
	DXGIFormatR32SInt
	DXGIFormatR24G8Typeless
	DXGIFormatD24UnormS8UInt
	DXGIFormatR24UnormX8Typeless
	DXGIFormatX24TypelessG8UInt
	DXGIFormatR8G8Typeless
	DXGIFormatR8G8UNorm
	DXGIFormatR8G8UInt
	DXGIFormatR8G8SNorm
	DXGIFormatR8G8SInt
	DXGIFormatR16Typeless
	DXGIFormatR16Float
	DXGIFormatD16UNorm
	DXGIFormatR16UNorm
	DXGIFormatR16UInt
	DXGIFormatR16SNorm
	DXGIFormatR16SInt
	DXGIFormatR8Typeless
	DXGIFormatR8UNorm
	DXGIFormatR8UInt
	DXGIFormatR8SNorm
	DXGIFormatR8SInt
	DXGIFormatA8UNorm
	DXGIFormatR1UNorm
	DXGIFormatR9G9B9E5SharedExp
	DXGIFormatR8G8B8G8UNorm
	DXGIFormatG8R8G8B8UNorm
	DXGIFormatBC1Typeless
	DXGIFormatBC1UNorm
	DXGIFormatBC1UNormSRGB
	DXGIFormatBC2Typeless
	DXGIFormatBC2UNorm
	DXGIFormatBC2UNormSRGB
	DXGIFormatBC3Typeless
	DXGIFormatBC3UNorm
	DXGIFormatBC3UNormSRGB
	DXGIFormatBC4Typeless
	DXGIFormatBC4UNorm
	DXGIFormatBC4SNorm
	DXGIFormatBC5Typeless
	DXGIFormatBC5UNorm
	DXGIFormatBC5SNorm
	DXGIFormatB5G6R5UNorm
	DXGIFormatB5G5R5A1UNorm
	DXGIFormatB8G8R8A8UNorm
	DXGIFormatB8G8R8X8UNorm
	DXGIFormatR10G10B10XRBiasA2UNorm
	DXGIFormatB8G8R8A8Typeless
	DXGIFormatB8G8R8A8UNormSRGB
	DXGIFormatB8G8R8X8Typeless
	DXGIFormatB8G8R8X8UNormSRGB
	DXGIFormatBC6HTypeless
	DXGIFormatBC6HUF16
	DXGIFormatBC6HSF16
	DXGIFormatBC7Typeless
	DXGIFormatBC7UNorm
	DXGIFormatBC7UNormSRGB
	DXGIFormatAYUV
	DXGIFormatY410
	DXGIFormatY416
	DXGIFormatNV12
	DXGIFormatP010
	DXGIFormatP016
	DXGIFormat420Opaque
	DXGIFormatYUY2
	DXGIFormatY210
	DXGIFormatY216
	DXGIFormatNV11
	DXGIFormatAI44
	DXGIFormatIA44
	DXGIFormatP8
	DXGIFormatA8P8
	DXGIFormatB4G4R4A4UNorm
	DXGIFormatP208
	DXGIFormatV208
	DXGIFormatV408
	DXGIFormatForceUInt DXGIFormat = 0xffffffff
)

func (DXGIFormat) String added in v0.5.0

func (f DXGIFormat) String() string

type DXT10Header

type DXT10Header struct {
	DXGIFormat        DXGIFormat
	ResourceDimension D3D10ResourceDimension
	MiscFlag          D3D10ResourceMiscFlags
	ArraySize         uint32
	MiscFlags2        AlphaMode
}

func DecodeDXT10Header

func DecodeDXT10Header(r io.Reader) (DXT10Header, error)

type DecompressFunc

type DecompressFunc func(buf []uint8, r io.Reader, width, height int, info Info) error
type Header struct {
	Size              uint32
	Flags             HeaderFlags
	Height            uint32
	Width             uint32
	PitchOrLinearSize uint32
	Depth             uint32
	MipMapCount       uint32
	Reserved          [11]uint32
	PixelFormat       PixelFormat
	Caps              CapsFlags
	Caps2             Caps2Flags
	Caps3             uint32
	Caps4             uint32
	Reserved2         uint32
}

func DecodeHeader

func DecodeHeader(r io.Reader) (Header, error)

type HeaderFlags

type HeaderFlags uint32
const (
	HeaderFlagCaps        HeaderFlags = 1 << 0
	HeaderFlagHeight      HeaderFlags = 1 << 1
	HeaderFlagWidth       HeaderFlags = 1 << 2
	HeaderFlagPitch       HeaderFlags = 1 << 3
	HeaderFlagPixelFormat HeaderFlags = 1 << 12
	HeaderFlagMipMapCount HeaderFlags = 1 << 17
	HeaderFlagLinearsize  HeaderFlags = 1 << 19
	HeaderFlagDepth       HeaderFlags = 1 << 23
)

type Info

type Info struct {
	Header      Header
	DXT10Header *DXT10Header
	Decompress  DecompressFunc
	ColorModel  color.Model
	NumMipMaps  int
	NumImages   int
}

func DecodeInfo

func DecodeInfo(r io.Reader) (Info, error)

type PixelFormat

type PixelFormat struct {
	Size        uint32
	Flags       PixelFormatFlags
	FourCC      [4]uint8
	RGBBitCount uint32
	RBitMask    uint32
	GBitMask    uint32
	BBitMask    uint32
	ABitMask    uint32
}

type PixelFormatFlags

type PixelFormatFlags uint32
const (
	PixelFormatFlagAlphaPixels PixelFormatFlags = 1 << 0
	PixelFormatFlagAlpha       PixelFormatFlags = 1 << 1
	PixelFormatFlagFourCC      PixelFormatFlags = 1 << 2
	PixelFormatFlagRGB         PixelFormatFlags = 1 << 6
	PixelFormatFlagYUV         PixelFormatFlags = 1 << 9
	PixelFormatFlagLuminance   PixelFormatFlags = 1 << 17
)

Jump to

Keyboard shortcuts

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