exr

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Extension = "exr"
)
View Source
const (
	SupportedVersion = 2
)

Variables

View Source
var (
	MagicSequence = [4]byte{0x76, 0x2F, 0x31, 0x01}
)

Functions

func ChunkCount

func ChunkCount(dataWindow Box2i, compression Compression) int

func Read

func Read(in io.Reader, data any) error

func ReadAttributeName

func ReadAttributeName(in io.Reader, target *AttributeName) error

func ReadAttributeType

func ReadAttributeType(in io.Reader, target *AttributeType) error

func ReadBox2i

func ReadBox2i(in io.Reader, target *Box2i) error

func ReadChannelList

func ReadChannelList(in io.Reader, target *ChannelList) error

func ReadCompression

func ReadCompression(in io.Reader, target *Compression) error

func ReadHeader

func ReadHeader(in io.Reader, target *Header) error

func ReadLineOrder

func ReadLineOrder(in io.Reader, target *LineOrder) error

func ReadMagic

func ReadMagic(in io.Reader, target *Magic) error

func ReadNullTerminatedString

func ReadNullTerminatedString[T ~string](in io.Reader, target *T) error

func ReadOffsets

func ReadOffsets(in io.Reader, chunkCount int) error

func ReadScanLineBlock

func ReadScanLineBlock(in io.Reader, dataWindow Box2i, compression Compression, decompressor Decompressor, dataChannels []PixelData) error

func ReadVersion

func ReadVersion(in io.Reader, target *Version) error

Types

type AttributeName

type AttributeName string
const (
	AttributeNameChannels           AttributeName = "channels"
	AttributeNameCompression        AttributeName = "compression"
	AttributeNameDataWindow         AttributeName = "dataWindow"
	AttributeNameDisplayWindow      AttributeName = "displayWindow"
	AttributeNameLineOrder          AttributeName = "lineOrder"
	AttributeNamePixelAspectRatio   AttributeName = "pixelAspectRatio"
	AttributeNameScreenWindowCenter AttributeName = "screenWindowCenter"
	AttributeNameScreenWindowWidth  AttributeName = "screenWindowWidth"
)

type AttributeType

type AttributeType string
const (
	AttributeTypeChannelList AttributeType = "chlist"
	AttributeTypeCompression AttributeType = "compression"
	AttributeTypeBox2i       AttributeType = "box2i"
	AttributeTypeLineOrder   AttributeType = "lineOrder"
	AttributeTypeFloat       AttributeType = "float"
	AttributeTypeV2f         AttributeType = "v2f"
)

type Box2i

type Box2i struct {
	XMin int32
	YMin int32
	XMax int32
	YMax int32
}

func (Box2i) Contains

func (b Box2i) Contains(other Box2i) bool

func (Box2i) Height

func (b Box2i) Height() int32

func (Box2i) Width

func (b Box2i) Width() int32

type Channel

type Channel struct {
	Name      string
	PixelType PixelType
	Linear    bool
	XSampling int32
	YSampling int32
}

type ChannelList

type ChannelList []Channel

type Compression

type Compression uint8
const (
	CompressionNone  Compression = 0
	CompressionRLE   Compression = 1
	CompressionZIPS  Compression = 2
	CompressionZIP   Compression = 3
	CompressionPIZ   Compression = 4
	CompressionPXR24 Compression = 5
	CompressionB44   Compression = 6
	CompressionB44A  Compression = 7
)

func (Compression) LineCount

func (c Compression) LineCount() int

func (Compression) String

func (c Compression) String() string

type Decompressor

type Decompressor interface {
	Decompress(src *bytes.Buffer) (*bytes.Buffer, error)
}

func NewNopDecompressor

func NewNopDecompressor() Decompressor

func NewZipDecompressor

func NewZipDecompressor() Decompressor

type Flag

type Flag int32
const (
	FlagSingleTile Flag = 1 << 8  // one at 9-th bit in version
	FlagLongName   Flag = 1 << 9  // one at 10-th bit in version
	FlagNonImage   Flag = 1 << 10 // one at 11-th bit in version
	FlagMultipart  Flag = 1 << 11 // one at 12-th bit in version
)
type Header struct {
	Channels      ChannelList
	Compression   Compression
	DataWindow    Box2i
	DisplayWindow Box2i
	LineOrder     LineOrder
}

type LineOrder

type LineOrder uint8
const (
	LineOrderIncreasingY LineOrder = 0
	LineOrderDecreasingY LineOrder = 1
	LineOrderRandomY     LineOrder = 2
)

func (LineOrder) String

func (o LineOrder) String() string

type Magic

type Magic [4]byte

func (Magic) IsCorrect

func (m Magic) IsCorrect() bool

type PixelData

type PixelData interface {
	LineSize() int32
	ReadLine(in io.Reader, y int32) error
	Float32(x, y int) float32
}

func NewFloat16PixelData

func NewFloat16PixelData(window Box2i, xSampling, ySampling int32) PixelData

func NewFloat32PixelData

func NewFloat32PixelData(window Box2i, xSampling, ySampling int32) PixelData

func NewNopPixelData

func NewNopPixelData(value float32) PixelData

func NewUint32PixelData

func NewUint32PixelData(window Box2i, xSampling, ySampling int32) PixelData

type PixelType

type PixelType int32
const (
	PixelTypeUint  PixelType = 0
	PixelTypeHalf  PixelType = 1
	PixelTypeFloat PixelType = 2
)

func (PixelType) String

func (t PixelType) String() string

type Version

type Version int32

func (Version) HasFlag

func (v Version) HasFlag(flag Flag) bool

func (Version) Number

func (v Version) Number() int

Jump to

Keyboard shortcuts

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