Documentation ¶
Overview ¶
Package xcf implements a simple reader for XCF files. This is the native format of the GIMP program.
The current implementation only supports loading RGB and RGBA layers.
The implementation uses information from
http://henning.makholm.net/xcftools/xcfspec-saved
as a reference.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶
A Canvas contains all the image's layers. It is not itself an image, it just has a size and its top-left corner has the coordinates 0,0. The layers' bounds are relative to that. Layers are ordered top-most first and bottom-most last in the Layers slice.
func Decode ¶
func Decode(r io.ReadSeeker) (canvas Canvas, finalErr error)
Decode reads a canvas from the given ReadSeeker. It currently supports RGB and RGBA pixel formats, file format version "file" and RLE encoded data only.
func LoadFromFile ¶
LoadFromFile opens the given file and reads the XCF data using the Decode function. See that function for restrictions.
func (*Canvas) GetLayerByName ¶
GetLayerByName searches all layers for one with the given name and reutrns it. If no layer with that name exists, nil is returned.
type Layer ¶
A Layer is a rectangular pixel area. Its bounds are relative to the Canvas' origin, which is at 0,0. The bounds can lie outside the canvas. Each layer is itself an image.Image (*image.RGBA is an image.Image). The image data contains the unmodified pixels, the Visibility and Opacity are stored separately. You have to mask in the opacity if you want to draw the layer onto another image.