types

package
v0.0.0-...-cb98339 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionPlace = PlaceAction(iota)
	ActionReplace
	ActionModify
)
View Source
const BackgroundObjectDepth = 0
View Source
const BackgroundObjectId = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface {
	Code() subtypes.ActionCode
}

type ActionList

type ActionList []Action

type AudioStream

type AudioStream struct {
	Format     swftag.SoundFormat
	SampleRate int
	SampleSize int
	Channels   int

	SoundId   uint16
	SoundData []byte

	Start *int64

	Data []byte
}

func AudioStreamFromSWF

func AudioStreamFromSWF(soundRate swftag.SoundRate, soundSize uint8, isStereo bool, soundFormat swftag.SoundFormat) *AudioStream

func (*AudioStream) AddStreamBlock

func (s *AudioStream) AddStreamBlock(node *swftag.SoundStreamBlock)

type BitmapDefinition

type BitmapDefinition struct {
	ObjectId  uint16
	ShapeList shapes.DrawPathList
}

func BitmapDefinitionFromSWF

func BitmapDefinitionFromSWF(bitmapId uint16, imageData []byte, alphaData []byte) (*BitmapDefinition, error)

func BitmapDefinitionFromSWFLossless

func BitmapDefinitionFromSWFLossless(bitmapId uint16, im image.Image) *BitmapDefinition

func (*BitmapDefinition) GetObjectId

func (d *BitmapDefinition) GetObjectId() uint16

func (*BitmapDefinition) GetSafeObject

func (d *BitmapDefinition) GetSafeObject() shapes.ObjectDefinition

func (*BitmapDefinition) GetShapeList

func (d *BitmapDefinition) GetShapeList(p shapes.ObjectProperties) (list shapes.DrawPathList)

type Combinable

type Combinable[T any] interface {
	Combine(o T) T
}

type Depth

type Depth []uint16

func DepthFromPackedLayer

func DepthFromPackedLayer(layer int32) (d Depth)

func DepthFromString

func DepthFromString(layer string) (d Depth, err error)

func (Depth) Compare

func (d Depth) Compare(o Depth) int

func (Depth) Equals

func (d Depth) Equals(o Depth) bool

func (Depth) GetPackedLayer

func (d Depth) GetPackedLayer() (layer int32)

GetPackedLayer Segment depth into specific layers, leaving 2^16 for first, at least 2^8 for second (and 2^8 for third), if no third it'll use whole for second TODO: handle higher depths gracefully It is known layers CAN overlap, TODO: check if limiting range might make sense? TODO: change this to a truly dynamic mode. might need 2-pass to check for hole overlap libass reads this onto an int32, TODO it overflows onto negative? Additionally the order of fields has extra read order. earlier lines have lower effective layer than later lines, if layers are equal

func (Depth) String

func (d Depth) String() string

type FontDefinition

type FontDefinition struct {
	FontId uint16

	Name   []byte
	Italic bool
	Bold   bool
	Scale  float64

	Entries []FontEntry
}

func FontDefinitionFromSWF

func FontDefinitionFromSWF[T1 uint16 | uint32, T2 uint8 | uint16](fontId uint16, name []byte, hasLayout, hasCodeTable, italic, bold bool, boundsTable []types.RECT, shapeTable []subtypes.SHAPE, offsetTable []T1, codeTable []T2, scale float64) *FontDefinition

func (*FontDefinition) ComposeTextSWF

func (d *FontDefinition) ComposeTextSWF(entries []subtypes.GLYPHENTRY, height, yOffset, xOffset float64, c math.Color) (list shapes.DrawPathList, newXOffset float64)

func (*FontDefinition) GetObjectId

func (d *FontDefinition) GetObjectId() uint16

func (*FontDefinition) GetSafeObject

func (d *FontDefinition) GetSafeObject() shapes.ObjectDefinition

func (*FontDefinition) GetShapeList

func (d *FontDefinition) GetShapeList(p shapes.ObjectProperties) (list shapes.DrawPathList)

type FontEntry

type FontEntry struct {
	Bounds shapes.Rectangle[float64]
	Code   uint32
	Offset uint32
	List   shapes.DrawPathList
}

type FrameInformation

type FrameInformation struct {
	FrameNumber int64
	FrameOffset int64

	FrameRate float64

	Frame *ViewFrame
}

func (FrameInformation) Difference

func (FrameInformation) GetEndTime

func (i FrameInformation) GetEndTime() time.Duration

func (FrameInformation) GetFrameDuration

func (i FrameInformation) GetFrameDuration() time.Duration

func (FrameInformation) GetFrameNumber

func (i FrameInformation) GetFrameNumber() int64

func (FrameInformation) GetStartTime

func (i FrameInformation) GetStartTime() time.Duration

type MorphShapeDefinition

type MorphShapeDefinition struct {
	ObjectId                     uint16
	StartBounds, EndBounds       shapes.Rectangle[float64]
	StartShapeList, EndShapeList shapes.DrawPathList
}

func MorphShapeDefinitionFromSWF

func MorphShapeDefinitionFromSWF(collection shapes.ObjectCollection, shapeId uint16, startBounds, endBounds shapes.Rectangle[float64], startRecords, endRecords subtypes.SHAPERECORDS, fillStyles subtypes.MORPHFILLSTYLEARRAY, lineStyles subtypes.MORPHLINESTYLEARRAY) *MorphShapeDefinition

func (*MorphShapeDefinition) GetObjectId

func (d *MorphShapeDefinition) GetObjectId() uint16

func (*MorphShapeDefinition) GetSafeObject

func (d *MorphShapeDefinition) GetSafeObject() shapes.ObjectDefinition

func (*MorphShapeDefinition) GetShapeList

type MultiFrameObjectDefinition

type MultiFrameObjectDefinition interface {
	shapes.ObjectDefinition
	NextFrame(frameNumber int64, p shapes.ObjectProperties) *ViewFrame
}

type NextFrameAction

type NextFrameAction struct {
}

func (*NextFrameAction) Code

type Option

type Option[T any] struct {
	// contains filtered or unexported fields
}

func None

func None[T any]() Option[T]

func Some

func Some[T any](value T) Option[T]

func SomeDefault

func SomeDefault[T any](o Option[T], def T) Option[T]

func SomePointer

func SomePointer[T any](value *T) Option[T]

func SomeWith

func SomeWith[T any](value T, ok bool) Option[T]

func (Option[T]) Combine

func (o Option[T]) Combine(other Option[T], f func(a, b T) Option[T]) (result Option[T])

Combine Combines two Option or returns either if any is Option.Some but not the other f is not necessary if T implements Combinable

func (Option[T]) Pointer

func (o Option[T]) Pointer() *T

func (Option[T]) Some

func (o Option[T]) Some() (T, bool)

func (Option[T]) Unwrap

func (o Option[T]) Unwrap() T

func (Option[T]) With

func (o Option[T]) With(f func(T))

type PlaceAction

type PlaceAction uint8

func PlaceActionFromFlags

func PlaceActionFromFlags(hasCharacter, isMove bool) PlaceAction

type PlayAction

type PlayAction struct {
}

func (*PlayAction) Code

func (a *PlayAction) Code() subtypes.ActionCode

type RenderedFrame

type RenderedFrame []*RenderedObject

type RenderedObject

type RenderedObject struct {
	Depth    Depth
	ObjectId uint16

	DrawPathList shapes.DrawPathList

	Clip *shapes.ClipPath

	ColorTransform  math.ColorTransform
	MatrixTransform math.MatrixTransform
}

func (*RenderedObject) GetDepth

func (o *RenderedObject) GetDepth() Depth

type SWFProcessor

type SWFProcessor struct {
	SWFTreeProcessor

	Background         *shapes.FillStyleRecord
	ViewPort           shapes.Rectangle[float64]
	FrameRate          float64
	ExpectedFrameCount int64

	Audio *AudioStream
}

func NewSWFProcessor

func NewSWFProcessor(tags []swftag.Tag, viewPort shapes.Rectangle[float64], frameRate float64, frameCount int64, version uint8) *SWFProcessor

func (*SWFProcessor) NextFrameOutput

func (p *SWFProcessor) NextFrameOutput() *FrameInformation

type SWFTreeProcessor

type SWFTreeProcessor struct {
	Layout *ViewLayout

	Objects shapes.ObjectCollection

	Tags []swftag.Tag

	Index int

	Frame int64

	LastFrame *ViewFrame
	Playing   bool
	Loops     int

	Version uint8

	JPEGTables []byte
	// contains filtered or unexported fields
}

func NewSWFTreeProcessor

func NewSWFTreeProcessor(objectId uint16, tags []swftag.Tag, objects shapes.ObjectCollection, version uint8) *SWFTreeProcessor

func (*SWFTreeProcessor) Current

func (p *SWFTreeProcessor) Current() swftag.Tag

func (*SWFTreeProcessor) Next

func (p *SWFTreeProcessor) Next()

func (*SWFTreeProcessor) NextFrame

func (p *SWFTreeProcessor) NextFrame(loop bool) *ViewFrame

func (*SWFTreeProcessor) Process

func (p *SWFTreeProcessor) Process(actions ActionList) (tag swftag.Tag, newActions ActionList)

type ShapeDefinition

type ShapeDefinition struct {
	ObjectId  uint16
	Bounds    shapes.Rectangle[float64]
	ShapeList shapes.DrawPathList
}

func ShapeDefinitionFromSWF

func ShapeDefinitionFromSWF(collection shapes.ObjectCollection, shapeId uint16, bounds shapes.Rectangle[float64], records subtypes.SHAPERECORDS, fillStyles subtypes.FILLSTYLEARRAY, lineStyles subtypes.LINESTYLEARRAY) *ShapeDefinition

func (*ShapeDefinition) GetObjectId

func (d *ShapeDefinition) GetObjectId() uint16

func (*ShapeDefinition) GetSafeObject

func (d *ShapeDefinition) GetSafeObject() shapes.ObjectDefinition

func (*ShapeDefinition) GetShapeList

func (d *ShapeDefinition) GetShapeList(p shapes.ObjectProperties) (list shapes.DrawPathList)

type SpriteDefinition

type SpriteDefinition struct {
	ObjectId uint16
	Frames   [][]SpriteFrameEntry
}

func SpriteDefinitionFromSWF

func SpriteDefinitionFromSWF(spriteId uint16, frameCount int, p *SWFTreeProcessor) *SpriteDefinition

func (*SpriteDefinition) GetObjectId

func (d *SpriteDefinition) GetObjectId() uint16

func (*SpriteDefinition) GetSafeObject

func (d *SpriteDefinition) GetSafeObject() shapes.ObjectDefinition

func (*SpriteDefinition) GetShapeList

func (d *SpriteDefinition) GetShapeList(p shapes.ObjectProperties) (list shapes.DrawPathList)

func (*SpriteDefinition) NextFrame

func (d *SpriteDefinition) NextFrame(frameNumber int64, p shapes.ObjectProperties) *ViewFrame

type SpriteFrameEntry

type SpriteFrameEntry struct {
	Depth           uint16
	Object          shapes.ObjectDefinition
	ColorTransform  Option[math2.ColorTransform]
	MatrixTransform Option[math2.MatrixTransform]
	ClipDepth       Option[uint16]
	Properties      shapes.ObjectProperties
}

type StopAction

type StopAction struct {
}

func (*StopAction) Code

func (a *StopAction) Code() subtypes.ActionCode

type TextDefinition

type TextDefinition struct {
	ObjectId  uint16
	Bounds    shapes.Rectangle[float64]
	ShapeList shapes.DrawPathList
}

func TextDefinitionFromSWF

func TextDefinitionFromSWF(collection shapes.ObjectCollection, characterId uint16, bounds types.RECT, textRecords subtypes.TEXTRECORDS, matrix types.MATRIX) *TextDefinition

func (*TextDefinition) GetObjectId

func (d *TextDefinition) GetObjectId() uint16

func (*TextDefinition) GetSafeObject

func (d *TextDefinition) GetSafeObject() shapes.ObjectDefinition

func (*TextDefinition) GetShapeList

func (d *TextDefinition) GetShapeList(p shapes.ObjectProperties) (list shapes.DrawPathList)

type ViewFrame

type ViewFrame struct {
	ObjectId uint16

	DepthMap map[uint16]*ViewFrame

	DrawPathList Option[shapes.DrawPathList]

	ColorTransform  Option[math.ColorTransform]
	MatrixTransform Option[math.MatrixTransform]

	ClipDepth Option[uint16]
}

func NewClippingFrame

func NewClippingFrame(objectId, clipDepth uint16, list Option[shapes.DrawPathList]) *ViewFrame

func NewViewFrame

func NewViewFrame(objectId uint16, list Option[shapes.DrawPathList]) *ViewFrame

func (*ViewFrame) AddChild

func (f *ViewFrame) AddChild(depth uint16, frame *ViewFrame)

func (*ViewFrame) Render

func (f *ViewFrame) Render(baseDepth uint16, depthChain Depth, parentColor Option[math.ColorTransform], parentMatrix Option[math.MatrixTransform]) RenderedFrame

type ViewLayout

type ViewLayout struct {
	Parent *ViewLayout

	DepthMap map[uint16]*ViewLayout

	Object shapes.ObjectDefinition

	ColorTransform  Option[math2.ColorTransform]
	MatrixTransform Option[math2.MatrixTransform]

	Properties shapes.ObjectProperties

	ClipDepth Option[uint16]
}

func NewClippingViewLayout

func NewClippingViewLayout(objectId, clipDepth uint16, object shapes.ObjectDefinition, parent *ViewLayout) *ViewLayout

func NewViewLayout

func NewViewLayout(objectId uint16, object shapes.ObjectDefinition, parent *ViewLayout) *ViewLayout

func (*ViewLayout) Get

func (v *ViewLayout) Get(depth uint16) *ViewLayout

func (*ViewLayout) GetObjectId

func (v *ViewLayout) GetObjectId() uint16

func (*ViewLayout) NextFrame

func (v *ViewLayout) NextFrame(frameNumber int64, actions ActionList) (frame *ViewFrame)

func (*ViewLayout) Place

func (v *ViewLayout) Place(depth uint16, ob *ViewLayout)

func (*ViewLayout) Remove

func (v *ViewLayout) Remove(depth uint16)

func (*ViewLayout) Replace

func (v *ViewLayout) Replace(depth uint16, ob *ViewLayout)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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