Documentation ¶
Index ¶
Constants ¶
const HeaderSize = 28
HeaderSize is the size of the Header structure, in bytes.
const PaletteSize = 256
PaletteSize indicates how many colors a palette can hold with a byte index.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Animation ¶ added in v1.2.0
type Animation struct { Width int16 Height int16 ResourceID resource.ID IntroFlag uint16 Entries []AnimationEntry }
Animation describes a sequence of bitmaps to form a small movie.
type AnimationCache ¶ added in v1.2.0
type AnimationCache struct {
// contains filtered or unexported fields
}
AnimationCache retrieves animations from a localizer and keeps them decoded until they are invalidated.
func NewAnimationCache ¶ added in v1.2.0
func NewAnimationCache(localizer resource.Localizer) *AnimationCache
NewAnimationCache returns a new instance.
func (*AnimationCache) Animation ¶ added in v1.2.0
func (cache *AnimationCache) Animation(key resource.Key) (anim Animation, err error)
Animation tries to look up given animation.
func (*AnimationCache) InvalidateResources ¶ added in v1.2.0
func (cache *AnimationCache) InvalidateResources(ids []resource.ID)
InvalidateResources lets the cache remove any animations from resources that are specified in the given slice.
type AnimationEntry ¶ added in v1.2.0
AnimationEntry describes one part of an animation with common frame time.
type Area ¶
type Area [4]int16
Area is a placeholder for either a rectangle, or an anchoring point (first two entries).
type Bitmap ¶
Bitmap describes a palette based image.
func Decode ¶
Decode tries to read a bitmap from given reader. Should the bitmap be a compressed bitmap, then a reference image with pixel data all 0x00 is assumed.
func DecodeReferenced ¶
func DecodeReferenced(reader io.Reader, provider func(width, height int16) ([]byte, error)) (*Bitmap, error)
DecodeReferenced tries to read a bitmap from given reader. If the serialized bitmap describes a compressed bitmap, then the pixels from the reference are used as a basis for the result. The returned byte array from the provider will be used as pixel buffer for the new bitmap.
type Bitmapper ¶ added in v0.6.0
type Bitmapper struct {
// contains filtered or unexported fields
}
Bitmapper creates bitmap images from generic images.
func NewBitmapper ¶ added in v0.6.0
NewBitmapper returns a new bitmapper instance based on the given palette.
type Flag ¶
type Flag uint16
Flag adds further properties.
const ( // FlagTransparent is set for bitmaps that shall treat palette index 0x00 as fully transparent. FlagTransparent Flag = 0x0001 )
Flag constants are listed below.
type Header ¶
type Header struct { Type Type Flags Flag Width int16 Height int16 Stride uint16 WidthFactor byte HeightFactor byte Area Area PaletteOffset int32 // contains filtered or unexported fields }
Header contains the meta information for a bitmap.
type Palette ¶
type Palette [PaletteSize]RGB
Palette describes a list of colors to be used by bitmaps. It is an array of 256 RGB values.
func (Palette) ColorPalette ¶ added in v0.6.0
ColorPalette returns a palette usable for the image packages.
type PaletteCache ¶
type PaletteCache struct {
// contains filtered or unexported fields
}
PaletteCache retrieves palettes from a localizer and keeps them decoded until they are invalidated.
func NewPaletteCache ¶
func NewPaletteCache(localizer resource.Localizer) *PaletteCache
NewPaletteCache returns a new instance.
func (*PaletteCache) InvalidateResources ¶
func (cache *PaletteCache) InvalidateResources(ids []resource.ID)
InvalidateResources lets the cache remove any palettes from resources that are specified in the given slice.
type Type ¶
type Type byte
Type describes the data layout of a bitmap.
const ( // TypeFlat8Bit bitmaps are 8-bit paletted bitmaps that have their pixel stored in a flat layout. TypeFlat8Bit Type = 2 // TypeCompressed8Bit bitmaps are 8-bit paletted bitmaps that have their pixel compressed in storage. // Compression is using run-length-encoding (RLE); See package rle. TypeCompressed8Bit Type = 4 )
Type constants are listed below.