xcf

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: ISC, ISC Imports: 20 Imported by: 1

README

xcf

-- import "vimagination.zapto.org/limage/xcf"

Package xcf implements an image encoder and decoder for GIMPs XCF format

Usage

var (
	ErrInvalidFileTypeID   = errors.New("invalid file type identification")
	ErrUnsupportedVersion  = errors.New("unsupported file version")
	ErrInvalidHeader       = errors.New("invalid header")
	ErrInvalidProperties   = errors.New("invalid property list")
	ErrInvalidOpacity      = errors.New("opacity not in valid range")
	ErrInvalidGuideLength  = errors.New("invalid guide length")
	ErrInvalidUnit         = errors.New("invalid unit")
	ErrInvalidSampleLength = errors.New("invalid sample points length")
	ErrInvalidGroup        = errors.New("invalid or unknown group specified for layer")
	ErrUnknownCompression  = errors.New("unknown compression method")
	ErrMissingAlpha        = errors.New("non-bottom layer missing alpha channel")
	ErrNeedReaderAt        = errors.New("need a io.ReaderAt")
)

Errors

var (
	ErrInvalidLayerType      = errors.New("invalid layer type")
	ErrInvalidItemPathLength = errors.New("invalid item path length")
	ErrInconsistantData      = errors.New("inconsistant data read")
)

Errors

var (
	ErrInvalidParasites = errors.New("invalid parasites layout")
	ErrNoOpen           = errors.New("didn't receive Open token")
	ErrNoName           = errors.New("didn't receive Name token")
)

Errors

var (
	ErrInconsistantClosedState = errors.New("inconsistant closed state")
	ErrUnknownPathsVersion     = errors.New("unknown paths version")
)

Errors

var (
	ErrInvalidString = errors.New("string is invalid")
	ErrStringTooLong = errors.New("string exceeds maximum length")
	ErrInvalidSeek   = errors.New("invalid seek")
)

Errors

var (
	ErrUnknownVectorVersion = errors.New("unknown vector version")
	ErrUnknownStrokeType    = errors.New("unknown stroke type")
	ErrInvalidFloatsNumber  = errors.New("invalids number of floats")
)

Errors

var (
	ErrInvalidBoolean = errors.New("invalid boolean value")
)

Errors

var (
	ErrInvalidRLE = errors.New("invalid RLE data")
)

Errors

var (
	ErrTooBig = errors.New("write too big")
)

Errors

func Decode
func Decode(r io.ReaderAt) (limage.Image, error)

Decode reads an XCF layered image from the given ReaderAt

func DecodeCompressed
func DecodeCompressed(r io.ReaderAt) (limage.Image, error)

DecodeCompressed reads an XCF layered image, as Decode, but defers decoding and decompressing, doing so upon an At method

func DecodeConfig
func DecodeConfig(r io.ReaderAt) (image.Config, error)

DecodeConfig retrieves the color model and dimensions of the XCF image

func Encode
func Encode(w io.WriterAt, im image.Image) error

Encode encodes the given image as an XCF file to the given WriterAt

type CompressedGray
type CompressedGray struct {
	Rect image.Rectangle
}

CompressedGray is an image.Image for which the data remains in a compressed form until read.

func (*CompressedGray) At
func (c *CompressedGray) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedGray) Bounds
func (c *CompressedGray) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (CompressedGray) ColorModel
func (CompressedGray) ColorModel() color.Model

ColorModel returns the Gray Color Model

func (*CompressedGray) GrayAt
func (c *CompressedGray) GrayAt(x, y int) color.Gray

GrayAt returns Gray colour at the specified coords

type CompressedGrayAlpha
type CompressedGrayAlpha struct {
	Rect image.Rectangle
}

CompressedGrayAlpha is an image.Image for which the data remains in a compressed form until read.

func (*CompressedGrayAlpha) At
func (c *CompressedGrayAlpha) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedGrayAlpha) Bounds
func (c *CompressedGrayAlpha) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (CompressedGrayAlpha) ColorModel
func (CompressedGrayAlpha) ColorModel() color.Model

ColorModel returns the Gray Alpha Color Model

func (*CompressedGrayAlpha) GrayAlphaAt
func (c *CompressedGrayAlpha) GrayAlphaAt(x, y int) lcolor.GrayAlpha

GrayAlphaAt returns Gray+Alpha colour at the specified coords

type CompressedNRGBA
type CompressedNRGBA struct {
	Rect image.Rectangle
}

CompressedNRGB is an image.Image for which the data remains in a compressed form until read.

func (*CompressedNRGBA) At
func (c *CompressedNRGBA) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedNRGBA) Bounds
func (c *CompressedNRGBA) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (CompressedNRGBA) ColorModel
func (CompressedNRGBA) ColorModel() color.Model

ColorModel returns the NRGBA Color Model

func (*CompressedNRGBA) NRGBAAt
func (c *CompressedNRGBA) NRGBAAt(x, y int) color.NRGBA

NRGBAAt returns NRGBA colour at the specified coords

type CompressedPaletted
type CompressedPaletted struct {
	Rect    image.Rectangle
	Palette color.Palette
}

CompressedPaletted is an image.Image for which the data remains in a compressed form until read.

func (*CompressedPaletted) At
func (c *CompressedPaletted) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedPaletted) Bounds
func (c *CompressedPaletted) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (*CompressedPaletted) ColorModel
func (c *CompressedPaletted) ColorModel() color.Model

ColorModel returns the Pallette of the image

type CompressedPalettedAlpha
type CompressedPalettedAlpha struct {
	Rect    image.Rectangle
	Palette lcolor.AlphaPalette
}

CompressedPalettedAlpha is an image.Image for which the data remains in a compressed form until read.

func (*CompressedPalettedAlpha) At
func (c *CompressedPalettedAlpha) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedPalettedAlpha) Bounds
func (c *CompressedPalettedAlpha) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (*CompressedPalettedAlpha) ColorModel
func (c *CompressedPalettedAlpha) ColorModel() color.Model

ColorModel returns the Pallette of the image

type CompressedRGB
type CompressedRGB struct {
	Rect image.Rectangle
}

CompressedRGB is an image.Image for which the data remains in a compressed form until read.

func (*CompressedRGB) At
func (c *CompressedRGB) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedRGB) Bounds
func (c *CompressedRGB) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (CompressedRGB) ColorModel
func (CompressedRGB) ColorModel() color.Model

ColorModel returns the RGB Color Model

func (*CompressedRGB) RGBAt
func (c *CompressedRGB) RGBAt(x, y int) lcolor.RGB

RGBAt returns RGB colour at the specified coords

Documentation

Overview

Package xcf implements an image encoder and decoder for GIMPs XCF format

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFileTypeID   = errors.New("invalid file type identification")
	ErrUnsupportedVersion  = errors.New("unsupported file version")
	ErrInvalidHeader       = errors.New("invalid header")
	ErrInvalidProperties   = errors.New("invalid property list")
	ErrInvalidOpacity      = errors.New("opacity not in valid range")
	ErrInvalidGuideLength  = errors.New("invalid guide length")
	ErrInvalidUnit         = errors.New("invalid unit")
	ErrInvalidSampleLength = errors.New("invalid sample points length")
	ErrInvalidGroup        = errors.New("invalid or unknown group specified for layer")
	ErrUnknownCompression  = errors.New("unknown compression method")
	ErrMissingAlpha        = errors.New("non-bottom layer missing alpha channel")
	ErrNeedReaderAt        = errors.New("need a io.ReaderAt")
)

Errors

View Source
var (
	ErrInvalidLayerType      = errors.New("invalid layer type")
	ErrInvalidItemPathLength = errors.New("invalid item path length")
	ErrInconsistantData      = errors.New("inconsistant data read")
)

Errors

View Source
var (
	ErrInvalidParasites = errors.New("invalid parasites layout")
	ErrNoOpen           = errors.New("didn't receive Open token")
	ErrNoName           = errors.New("didn't receive Name token")
)

Errors

View Source
var (
	ErrInconsistantClosedState = errors.New("inconsistant closed state")
	ErrUnknownPathsVersion     = errors.New("unknown paths version")
)

Errors

View Source
var (
	ErrInvalidString = errors.New("string is invalid")
	ErrStringTooLong = errors.New("string exceeds maximum length")
	ErrInvalidSeek   = errors.New("invalid seek")
)

Errors

View Source
var (
	ErrUnknownVectorVersion = errors.New("unknown vector version")
	ErrUnknownStrokeType    = errors.New("unknown stroke type")
	ErrInvalidFloatsNumber  = errors.New("invalids number of floats")
)

Errors

View Source
var (
	ErrInvalidBoolean = errors.New("invalid boolean value")
)

Errors

View Source
var (
	ErrInvalidRLE = errors.New("invalid RLE data")
)

Errors

View Source
var (
	ErrTooBig = errors.New("write too big")
)

Errors

Functions

func Decode

func Decode(r io.ReaderAt) (limage.Image, error)

Decode reads an XCF layered image from the given ReaderAt

func DecodeCompressed

func DecodeCompressed(r io.ReaderAt) (limage.Image, error)

DecodeCompressed reads an XCF layered image, as Decode, but defers decoding and decompressing, doing so upon an At method

func DecodeConfig

func DecodeConfig(r io.ReaderAt) (image.Config, error)

DecodeConfig retrieves the color model and dimensions of the XCF image

func Encode

func Encode(w io.WriterAt, im image.Image) error

Encode encodes the given image as an XCF file to the given WriterAt

Types

type CompressedGray

type CompressedGray struct {
	Rect image.Rectangle
	// contains filtered or unexported fields
}

CompressedGray is an image.Image for which the data remains in a compressed form until read.

func (*CompressedGray) At

func (c *CompressedGray) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedGray) Bounds

func (c *CompressedGray) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (CompressedGray) ColorModel

func (CompressedGray) ColorModel() color.Model

ColorModel returns the Gray Color Model

func (*CompressedGray) GrayAt

func (c *CompressedGray) GrayAt(x, y int) color.Gray

GrayAt returns Gray colour at the specified coords

type CompressedGrayAlpha

type CompressedGrayAlpha struct {
	Rect image.Rectangle
	// contains filtered or unexported fields
}

CompressedGrayAlpha is an image.Image for which the data remains in a compressed form until read.

func (*CompressedGrayAlpha) At

func (c *CompressedGrayAlpha) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedGrayAlpha) Bounds

func (c *CompressedGrayAlpha) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (CompressedGrayAlpha) ColorModel

func (CompressedGrayAlpha) ColorModel() color.Model

ColorModel returns the Gray Alpha Color Model

func (*CompressedGrayAlpha) GrayAlphaAt

func (c *CompressedGrayAlpha) GrayAlphaAt(x, y int) lcolor.GrayAlpha

GrayAlphaAt returns Gray+Alpha colour at the specified coords

type CompressedNRGBA

type CompressedNRGBA struct {
	Rect image.Rectangle
	// contains filtered or unexported fields
}

CompressedNRGB is an image.Image for which the data remains in a compressed form until read.

func (*CompressedNRGBA) At

func (c *CompressedNRGBA) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedNRGBA) Bounds

func (c *CompressedNRGBA) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (CompressedNRGBA) ColorModel

func (CompressedNRGBA) ColorModel() color.Model

ColorModel returns the NRGBA Color Model

func (*CompressedNRGBA) NRGBAAt

func (c *CompressedNRGBA) NRGBAAt(x, y int) color.NRGBA

NRGBAAt returns NRGBA colour at the specified coords

type CompressedPaletted

type CompressedPaletted struct {
	Rect    image.Rectangle
	Palette color.Palette
	// contains filtered or unexported fields
}

CompressedPaletted is an image.Image for which the data remains in a compressed form until read.

func (*CompressedPaletted) At

func (c *CompressedPaletted) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedPaletted) Bounds

func (c *CompressedPaletted) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (*CompressedPaletted) ColorModel

func (c *CompressedPaletted) ColorModel() color.Model

ColorModel returns the Pallette of the image

type CompressedPalettedAlpha

type CompressedPalettedAlpha struct {
	Rect    image.Rectangle
	Palette lcolor.AlphaPalette
	// contains filtered or unexported fields
}

CompressedPalettedAlpha is an image.Image for which the data remains in a compressed form until read.

func (*CompressedPalettedAlpha) At

func (c *CompressedPalettedAlpha) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedPalettedAlpha) Bounds

Bounds returns a Rect containg the boundary data for the image

func (*CompressedPalettedAlpha) ColorModel

func (c *CompressedPalettedAlpha) ColorModel() color.Model

ColorModel returns the Pallette of the image

type CompressedRGB

type CompressedRGB struct {
	Rect image.Rectangle
	// contains filtered or unexported fields
}

CompressedRGB is an image.Image for which the data remains in a compressed form until read.

func (*CompressedRGB) At

func (c *CompressedRGB) At(x, y int) color.Color

At returns colour at the specified coords

func (*CompressedRGB) Bounds

func (c *CompressedRGB) Bounds() image.Rectangle

Bounds returns a Rect containg the boundary data for the image

func (CompressedRGB) ColorModel

func (CompressedRGB) ColorModel() color.Model

ColorModel returns the RGB Color Model

func (*CompressedRGB) RGBAt

func (c *CompressedRGB) RGBAt(x, y int) lcolor.RGB

RGBAt returns RGB colour at the specified coords

Jump to

Keyboard shortcuts

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