types

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DoParserDebug = false
View Source
const TwipFactor = 20

Variables

View Source
var SignatureCompressedLZMA = HeaderSignature{'Z', 'W', 'S'}
View Source
var SignatureCompressedZLIB = HeaderSignature{'C', 'W', 'S'}
View Source
var SignatureUncompressed = HeaderSignature{'F', 'W', 'S'}

Functions

func ReadArraySI16

func ReadArraySI16[T ~int16](r DataReader, n int) (d []T, err error)

func ReadArraySI8

func ReadArraySI8[T ~int8](r DataReader, n int) (d []T, err error)

func ReadArrayU16

func ReadArrayU16[T ~uint16](r DataReader, n int) (d []T, err error)

func ReadArrayU24

func ReadArrayU24[T ~uint32](r DataReader, n int) (d []T, err error)

func ReadArrayU32

func ReadArrayU32[T ~uint32](r DataReader, n int) (d []T, err error)

func ReadArrayU64

func ReadArrayU64[T ~uint64](r DataReader, n int) (d []T, err error)

func ReadArrayU8

func ReadArrayU8[T ~uint8](r DataReader, n int) (d []T, err error)

func ReadBool

func ReadBool(r DataReader) (d bool, err error)

func ReadEncodedU32

func ReadEncodedU32[T ~uint32](r DataReader) (d T, err error)

func ReadFB

func ReadFB(r DataReader, n uint64) (d int32, err error)

func ReadNullTerminatedString

func ReadNullTerminatedString(r DataReader, swfVersion uint8) (d string, err error)

func ReadSB

func ReadSB[T ~int | ~int64 | ~int32 | ~int16 | ~int8](r DataReader, n uint64) (d T, err error)

func ReadSI16

func ReadSI16[T ~int16](r DataReader, d *T) (err error)

func ReadSI32

func ReadSI32[T ~int32](r DataReader, d *T) (err error)

func ReadSI64

func ReadSI64[T ~int64](r DataReader, d *T) (err error)

func ReadSI8

func ReadSI8[T ~int8](r DataReader, d *T) (err error)

func ReadType

func ReadType(r DataReader, ctx ReaderContext, data any) (err error)

func ReadTypeInner

func ReadTypeInner(r DataReader, ctx ReaderContext, data any) (err error)

func ReadU16

func ReadU16[T ~uint16](r DataReader, d *T) (err error)

func ReadU24

func ReadU24[T ~uint32](r DataReader, d *T) (err error)

func ReadU32

func ReadU32[T ~uint32](r DataReader, d *T) (err error)

func ReadU64

func ReadU64[T ~uint64](r DataReader, d *T) (err error)

func ReadU8

func ReadU8[T ~uint8](r DataReader, d *T) (err error)

func ReadUB

func ReadUB[T ~uint | ~uint64 | ~uint32 | ~uint16 | ~uint8](r DataReader, n uint64) (d T, err error)

Types

type ARGB

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

func (ARGB) A

func (argb ARGB) A() uint8

func (ARGB) B

func (argb ARGB) B() uint8

func (ARGB) G

func (argb ARGB) G() uint8

func (ARGB) R

func (argb ARGB) R() uint8

type CXFORM

type CXFORM struct {
	Flag struct {
		HasAddTerms  bool
		HasMultTerms bool
	}
	NBits    uint8 `swfBits:",4"`
	Multiply struct {
		Red   Fixed8 `swfBits:"NBits,fixed"`
		Green Fixed8 `swfBits:"NBits,fixed"`
		Blue  Fixed8 `swfBits:"NBits,fixed"`
	} `swfCondition:"Flag.HasMultTerms"`
	Add struct {
		Red   int16 `swfBits:"NBits,signed"`
		Green int16 `swfBits:"NBits,signed"`
		Blue  int16 `swfBits:"NBits,signed"`
	} `swfCondition:"Flag.HasAddTerms"`
	// contains filtered or unexported fields
}

func (*CXFORM) SWFDefault

func (cf *CXFORM) SWFDefault(ctx ReaderContext)

type CXFORMWITHALPHA

type CXFORMWITHALPHA struct {
	Flag struct {
		HasAddTerms  bool
		HasMultTerms bool
	}
	NBits    uint8 `swfBits:",4"`
	Multiply struct {
		Red   Fixed8 `swfBits:"NBits,fixed"`
		Green Fixed8 `swfBits:"NBits,fixed"`
		Blue  Fixed8 `swfBits:"NBits,fixed"`
		Alpha Fixed8 `swfBits:"NBits,fixed"`
	} `swfCondition:"Flag.HasMultTerms"`
	Add struct {
		Red   int16 `swfBits:"NBits,signed"`
		Green int16 `swfBits:"NBits,signed"`
		Blue  int16 `swfBits:"NBits,signed"`
		Alpha int16 `swfBits:"NBits,signed"`
	} `swfCondition:"Flag.HasAddTerms"`
	// contains filtered or unexported fields
}

func (*CXFORMWITHALPHA) SWFDefault

func (cf *CXFORMWITHALPHA) SWFDefault(ctx ReaderContext)

type Color

type Color interface {
	R() uint8
	G() uint8
	B() uint8
	A() uint8
}

type DataReader

type DataReader interface {
	io.ByteReader
	io.Reader
	ReadBits(n uint8) (u uint64, err error)
	Align() (skipped uint8)
}

type Fixed16

type Fixed16 int32

func (Fixed16) Float32

func (t Fixed16) Float32() float32

func (Fixed16) Float64

func (t Fixed16) Float64() float64

type Fixed8

type Fixed8 int16

func (Fixed8) Float32

func (t Fixed8) Float32() float32

func (Fixed8) Float64

func (t Fixed8) Float64() float64

type Float16

type Float16 float16.Float16

Float16 TODO: check if proper values

func (*Float16) SWFRead

func (f *Float16) SWFRead(r DataReader, ctx ReaderContext) (err error)
type Header struct {
	Signature  HeaderSignature
	Version    uint8
	FileLength uint32
	FrameSize  RECT
	FrameRate  Fixed8
	FrameCount uint16
}

type HeaderSignature

type HeaderSignature [3]uint8

type MATRIX

type MATRIX struct {
	HasScale                 bool
	NScaleBits               uint8   `swfCondition:"HasScale" swfBits:",5"`
	ScaleX, ScaleY           Fixed16 `swfCondition:"HasScale" swfBits:"NScaleBits,fixed"`
	HasRotate                bool
	NRotateBits              uint8   `swfCondition:"HasRotate" swfBits:",5"`
	RotateSkew0, RotateSkew1 Fixed16 `swfCondition:"HasRotate" swfBits:"NRotateBits,fixed"`
	NTranslateBits           uint8   `swfBits:",5"`
	TranslateX, TranslateY   Twip    `swfBits:"NTranslateBits,signed"`
	// contains filtered or unexported fields
}

func (*MATRIX) SWFDefault

func (matrix *MATRIX) SWFDefault(ctx ReaderContext)

type RECT

type RECT struct {
	NBits uint8 `swfBits:",5"`
	Xmin  Twip  `swfBits:"NBits,signed"`
	Xmax  Twip  `swfBits:"NBits,signed"`
	Ymin  Twip  `swfBits:"NBits,signed"`
	Ymax  Twip  `swfBits:"NBits,signed"`
	// contains filtered or unexported fields
}

type RGB

type RGB struct {
	Red   uint8
	Green uint8
	Blue  uint8
}

func (RGB) A

func (rgb RGB) A() uint8

func (RGB) B

func (rgb RGB) B() uint8

func (RGB) G

func (rgb RGB) G() uint8

func (RGB) R

func (rgb RGB) R() uint8

type RGBA

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

func (RGBA) A

func (rgba RGBA) A() uint8

func (RGBA) B

func (rgba RGBA) B() uint8

func (RGBA) G

func (rgba RGBA) G() uint8

func (RGBA) R

func (rgba RGBA) R() uint8

type ReaderContext

type ReaderContext struct {
	Version   uint8
	Root      reflect.Value
	Flags     []string
	FieldType reflect.StructField
}

func (ReaderContext) GetNestedType

func (ctx ReaderContext) GetNestedType(fields ...string) reflect.Value

type Twip

type Twip int64

func (Twip) Components

func (t Twip) Components() (pixel int64, subPixel uint8)

func (Twip) Float32

func (t Twip) Float32() float32

func (Twip) Float64

func (t Twip) Float64() float64

func (Twip) FromFloat64

func (t Twip) FromFloat64(v float64) Twip

func (Twip) String

func (t Twip) String() string

type TypeDefault

type TypeDefault interface {
	SWFDefault(ctx ReaderContext)
}

type TypeFuncConditional

type TypeFuncConditional func(ctx ReaderContext) bool

type TypeFuncNumber

type TypeFuncNumber func(ctx ReaderContext) uint64

type TypeReader

type TypeReader interface {
	SWFRead(reader DataReader, ctx ReaderContext) error
}

type UntilEnd

type UntilEnd[T any] []T

func (*UntilEnd[T]) SWFRead

func (b *UntilEnd[T]) SWFRead(r DataReader, ctx ReaderContext) (err error)

type UntilEndBytes

type UntilEndBytes = UntilEnd[byte]

Jump to

Keyboard shortcuts

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