paa

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 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

Go Reference codecov

go-paa

A (WIP) Go library for working with PAA files from Bohemia Interactive.

Currently, it can only read DXT1, DXT3 and DXT5 format PAA files.

Usage

Web

A PAA to PNG conversion tool is available in your browser at tools.dzhosts.com. This is the easiest way to use it, and it should work on any platform.

paa-unpack

The paa-unpack command line tool with unpack the highest resolution image from the PAA file into a PNG file.

$ paa-unpack -h
usage: paa-unpack [options] <input-file>

options:
  -all
        unpack all mipmaps (default: false)
  -output string
        output filename (default: <input-file>.png)

$ paa-unpack testdata/test-pattern.paa
Wrote testdata/test-pattern.png

$ paa-unpack -all testdata/test-pattern.paa
Wrote testdata/test-pattern_(512x256).png
Wrote testdata/test-pattern_(256x128).png
Wrote testdata/test-pattern_(128x64).png
Wrote testdata/test-pattern_(64x32).png
Wrote testdata/test-pattern_(32x16).png
Wrote testdata/test-pattern_(16x8).png
Wrote testdata/test-pattern_(8x4).png
paa-inspect

Dump PAA information.

$ paa-inspect -h
usage: paa-inspect <input-file>

$ paa-inspect testdata/test-pattern.paa
Type: DXT1
AVGC: R=182, G=170, B=169, A=255 <#B6AAA9FF>

[Mipmaps]
  0: 512x256, size=639, compressed=true
  1: 256x128, size=373, compressed=true
  2: 128x64, size=4096, compressed=false
  3: 64x32, size=1024, compressed=false
  4: 32x16, size=256, compressed=false
  5: 16x8, size=64, compressed=false
  6: 8x4, size=16, compressed=false

References

https://community.bistudio.com/wiki/PAA_File_Format

Documentation

Index

Constants

View Source
const (
	Tagg_AVGC uint32 = 0x41564743
	Tagg_MAXC uint32 = 0x4d415843
	Tagg_OFFS uint32 = 0x4f464653
	Tagg_SWIZ uint32 = 0x5357495a
)

Variables

View Source
var TaggSignature uint32 = 0x54414747
View Source
var TypeOfPaXStrings = map[TypeOfPaX]string{
	Type_OFP:   "OFP",
	Type_DXT1:  "DXT1",
	Type_DXT2:  "DXT2",
	Type_DXT3:  "DXT3",
	Type_DXT4:  "DXT4",
	Type_DXT5:  "DXT5",
	Type_RGBA4: "RGBA4",
	Type_RGBA5: "RGBA5",
	Type_RGBA8: "RGBA8",
	Type_Gray:  "Gray",
}

Functions

This section is empty.

Types

type Channel added in v0.0.7

type Channel uint8
const (
	Alpha Channel = 0
	Red   Channel = 1
	Green Channel = 2
	Blue  Channel = 3
)

func (Channel) String added in v0.0.7

func (c Channel) String() string

type Mipmap

type Mipmap struct {
	Width      uint16
	Height     uint16
	Compressed bool
	Type       TypeOfPaX
	Size       uint32
	Offset     int64
}

func (*Mipmap) Image

func (m *Mipmap) Image(src io.ReadSeeker) (*image.NRGBA, error)

func (*Mipmap) Reader

func (m *Mipmap) Reader(src io.ReadSeeker) (io.Reader, error)

Get access to the raw mipmap texture data.

type PAA

type PAA struct {
	Type    TypeOfPaX
	AVGC    *TaggAVGC
	MAXC    *TaggMAXC
	OFFS    *TaggOFFS
	SWIZ    *TaggSWIZ
	Mipmaps []Mipmap
}

func Decode

func Decode(in io.ReadSeeker) (*PAA, error)

type SwizzleChannel added in v0.0.7

type SwizzleChannel struct {
	Destination Channel
	Negated     bool
	ForceFF     bool
}

func DecodeSwizzleChannel added in v0.0.7

func DecodeSwizzleChannel(b uint8) SwizzleChannel

func (SwizzleChannel) String added in v0.0.7

func (c SwizzleChannel) String() string

type TaggAVGC

type TaggAVGC struct {
	Red   uint8
	Green uint8
	Blue  uint8
	Alpha uint8
}

func CalculateAVGC added in v0.0.6

func CalculateAVGC(img image.Image) TaggAVGC

func DecodeTaggAVGC

func DecodeTaggAVGC(in io.Reader) (*TaggAVGC, error)

func (TaggAVGC) String added in v0.0.4

func (t TaggAVGC) String() string

func (TaggAVGC) Write added in v0.0.6

func (t TaggAVGC) Write(out io.Writer) error

type TaggMAXC

type TaggMAXC struct {
	Data [4]uint8
}

func DecodeTaggMAXC

func DecodeTaggMAXC(in io.Reader) (*TaggMAXC, error)

func (TaggMAXC) Write added in v0.0.6

func (t TaggMAXC) Write(out io.Writer) error

type TaggOFFS

type TaggOFFS struct {
	Offsets [16]uint32
}

func DecodeTaggOFFS

func DecodeTaggOFFS(in io.Reader) (*TaggOFFS, error)

func (TaggOFFS) Write added in v0.0.6

func (t TaggOFFS) Write(out io.Writer) error

type TaggSWIZ added in v0.0.7

type TaggSWIZ struct {
	Alpha uint8
	Red   uint8
	Green uint8
	Blue  uint8
}

func DecodeTaggSWIZ added in v0.0.7

func DecodeTaggSWIZ(in io.Reader) (*TaggSWIZ, error)

func (TaggSWIZ) AlphaChannel added in v0.0.7

func (t TaggSWIZ) AlphaChannel() SwizzleChannel

func (TaggSWIZ) BlueChannel added in v0.0.7

func (t TaggSWIZ) BlueChannel() SwizzleChannel

func (TaggSWIZ) GreenChannel added in v0.0.7

func (t TaggSWIZ) GreenChannel() SwizzleChannel

func (TaggSWIZ) RedChannel added in v0.0.7

func (t TaggSWIZ) RedChannel() SwizzleChannel

func (TaggSWIZ) String added in v0.0.7

func (t TaggSWIZ) String() string

func (TaggSWIZ) Unswizzle added in v0.0.7

func (t TaggSWIZ) Unswizzle(img *image.NRGBA) *image.NRGBA

func (TaggSWIZ) Write added in v0.0.7

func (t TaggSWIZ) Write(out io.Writer) error

type TypeOfPaX

type TypeOfPaX uint16
const (
	Type_OFP   TypeOfPaX = 0x0
	Type_DXT1  TypeOfPaX = 0xFF01
	Type_DXT2  TypeOfPaX = 0xFF02
	Type_DXT3  TypeOfPaX = 0xFF03
	Type_DXT4  TypeOfPaX = 0xFF04
	Type_DXT5  TypeOfPaX = 0xFF05
	Type_RGBA4 TypeOfPaX = 0x4444
	Type_RGBA5 TypeOfPaX = 0x1555
	Type_RGBA8 TypeOfPaX = 0x8888
	Type_Gray  TypeOfPaX = 0x8080
)

func (TypeOfPaX) String added in v0.0.4

func (t TypeOfPaX) String() string

Directories

Path Synopsis
cmd
paa-inspect command
paa-unpack command
wasm command

Jump to

Keyboard shortcuts

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