ilda

package module
v0.0.0-...-57d29b7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: ISC Imports: 7 Imported by: 0

README

ILDA Image Data Transfer Format

GoDoc Build

Install

go get -u github.com/dim13/ilda

Sample

test.png

Documentation

Overview

Package ilda implements decoding of ILDA Image Data Transfer Format

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrMagic  = errors.New("bad magic")
	ErrFormat = errors.New("invalid format")
)
View Source
var DefaultPalette = color.Palette{
	color.RGBA{0xff, 0x00, 0x00, 0xff},
	color.RGBA{0xff, 0x10, 0x00, 0xff},
	color.RGBA{0xff, 0x20, 0x00, 0xff},
	color.RGBA{0xff, 0x30, 0x00, 0xff},
	color.RGBA{0xff, 0x40, 0x00, 0xff},
	color.RGBA{0xff, 0x50, 0x00, 0xff},
	color.RGBA{0xff, 0x60, 0x00, 0xff},
	color.RGBA{0xff, 0x70, 0x00, 0xff},
	color.RGBA{0xff, 0x80, 0x00, 0xff},
	color.RGBA{0xff, 0x90, 0x00, 0xff},
	color.RGBA{0xff, 0xa0, 0x00, 0xff},
	color.RGBA{0xff, 0xb0, 0x00, 0xff},
	color.RGBA{0xff, 0xb0, 0x00, 0xff},
	color.RGBA{0xff, 0xc0, 0x00, 0xff},
	color.RGBA{0xff, 0xd0, 0x00, 0xff},
	color.RGBA{0xff, 0xe0, 0x00, 0xff},
	color.RGBA{0xff, 0xf0, 0x00, 0xff},
	color.RGBA{0xff, 0xff, 0x00, 0xff},
	color.RGBA{0xc0, 0xff, 0x00, 0xff},
	color.RGBA{0xa0, 0xff, 0x00, 0xff},
	color.RGBA{0x80, 0xff, 0x00, 0xff},
	color.RGBA{0x60, 0xff, 0x00, 0xff},
	color.RGBA{0x40, 0xff, 0x00, 0xff},
	color.RGBA{0x20, 0xff, 0x00, 0xff},
	color.RGBA{0x00, 0xff, 0x00, 0xff},
	color.RGBA{0x00, 0xff, 0x24, 0xff},
	color.RGBA{0x00, 0xff, 0x49, 0xff},
	color.RGBA{0x00, 0xff, 0x6d, 0xff},
	color.RGBA{0x00, 0xff, 0x92, 0xff},
	color.RGBA{0x00, 0xff, 0xb6, 0xff},
	color.RGBA{0x00, 0xff, 0xdb, 0xff},
	color.RGBA{0x00, 0xff, 0xff, 0xff},
	color.RGBA{0x00, 0xe3, 0xff, 0xff},
	color.RGBA{0x00, 0xc6, 0xff, 0xff},
	color.RGBA{0x00, 0xaa, 0xff, 0xff},
	color.RGBA{0x00, 0x8e, 0xff, 0xff},
	color.RGBA{0x00, 0x71, 0xff, 0xff},
	color.RGBA{0x00, 0x55, 0xff, 0xff},
	color.RGBA{0x00, 0x38, 0xff, 0xff},
	color.RGBA{0x00, 0x1c, 0xff, 0xff},
	color.RGBA{0x00, 0x00, 0xff, 0xff},
	color.RGBA{0x20, 0x00, 0xff, 0xff},
	color.RGBA{0x40, 0x00, 0xff, 0xff},
	color.RGBA{0x60, 0x00, 0xff, 0xff},
	color.RGBA{0x80, 0x00, 0xff, 0xff},
	color.RGBA{0xa0, 0x00, 0xff, 0xff},
	color.RGBA{0xc0, 0x00, 0xff, 0xff},
	color.RGBA{0xe0, 0x00, 0xff, 0xff},
	color.RGBA{0xff, 0x00, 0xff, 0xff},
	color.RGBA{0xff, 0x20, 0xff, 0xff},
	color.RGBA{0xff, 0x40, 0xff, 0xff},
	color.RGBA{0xff, 0x60, 0xff, 0xff},
	color.RGBA{0xff, 0x80, 0xff, 0xff},
	color.RGBA{0xff, 0xa0, 0xff, 0xff},
	color.RGBA{0xff, 0xc0, 0xff, 0xff},
	color.RGBA{0xff, 0xe0, 0xff, 0xff},
	color.RGBA{0xff, 0xff, 0xff, 0xff},
	color.RGBA{0xff, 0xe0, 0xe0, 0xff},
	color.RGBA{0xff, 0xc0, 0xc0, 0xff},
	color.RGBA{0xff, 0xa0, 0xa0, 0xff},
	color.RGBA{0xff, 0x80, 0x80, 0xff},
	color.RGBA{0xff, 0x60, 0x60, 0xff},
	color.RGBA{0xff, 0x40, 0x40, 0xff},
	color.RGBA{0xff, 0x20, 0x20, 0xff},
}

DefaultPalette used by most ILDA files that do not contain a color palette

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}
Example
fd, err := os.Open("testdata/ildatest.ild")
if err != nil {
	log.Fatal(err)
}
defer fd.Close()
d := NewDecoder(fd)
for d.Next() {
	f := d.Frame()
	fmt.Println("Name", f.Name)
	fmt.Println("Company", f.Company)
	fmt.Println("Number", f.Number)
	fmt.Println("Total", f.Total)
	fmt.Println("Projector", f.Projector)
	fmt.Println("Points", len(f.Points))
}
if err := d.Err(); err != nil {
	log.Fatal(err)
}
Output:

Name ILDA Tes
Company t patter
Number 0
Total 1
Projector 0
Points 1191

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) AllFrames

func (d *Decoder) AllFrames() ([]Frame, error)

func (*Decoder) Err

func (d *Decoder) Err() error

func (*Decoder) Frame

func (d *Decoder) Frame() Frame

func (*Decoder) Next

func (d *Decoder) Next() bool

type Frame

type Frame struct {
	Name      string
	Company   string
	Number    int
	Total     int
	Projector int
	Points    []Point
}

func (*Frame) Draw

func (f *Frame) Draw(dst draw.Image, r image.Rectangle, src image.Image, sp image.Point)

Draw aligns r.Min in dst with sp in src and then replaces the rectangle r in dst with the result of drawing src on dst.

type Point

type Point struct {
	X, Y, Z int16
	color.Color
}

Point coordinate

X: Extreme left: -32768, extreme right: +32767
Y: Extreme bottom: -32768, extreme top: +32767
Z: Extreme rear: -32768, extreme front: +32767
rear: away from viewer, behind screen
front: towards viewer, in front of screen

Jump to

Keyboard shortcuts

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