graphics

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2018 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitmapTexture

type BitmapTexture struct {
	// contains filtered or unexported fields
}

BitmapTexture wraps an OpenGL handle for a downloaded image.

func NewBitmapTexture

func NewBitmapTexture(gl opengl.OpenGL, width, height int, pixelData []byte) *BitmapTexture

NewBitmapTexture downloads the provided raw data to OpenGL and returns a BitmapTexture instance.

func (*BitmapTexture) Dispose

func (tex *BitmapTexture) Dispose()

Dispose releases the OpenGL texture.

func (*BitmapTexture) Handle

func (tex *BitmapTexture) Handle() uint32

Handle returns the texture handle.

func (*BitmapTexture) Size

func (tex *BitmapTexture) Size() (width, height float32)

Size returns the dimensions of the bitmap, in pixels.

func (*BitmapTexture) UV

func (tex *BitmapTexture) UV() (u, v float32)

UV returns the maximum U and V values for the bitmap. The bitmap will be stored in a power-of-two texture, which may be larger than the bitmap.

type PaletteCache

type PaletteCache struct {
	// contains filtered or unexported fields
}

PaletteCache loads palettes and provides OpenGL textures.

func NewPaletteCache

func NewPaletteCache(gl opengl.OpenGL, 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 palette from resources that are specified in the given slice.

func (*PaletteCache) Palette

func (cache *PaletteCache) Palette(index int) (*PaletteTexture, error)

Palette returns the palette with given index - if available.

type PaletteTexture

type PaletteTexture struct {
	// contains filtered or unexported fields
}

PaletteTexture contains a palette stored as OpenGL texture.

func NewPaletteTexture

func NewPaletteTexture(gl opengl.OpenGL, palette bitmap.Palette) *PaletteTexture

NewPaletteTexture creates a new PaletteTexture instance.

func (*PaletteTexture) Dispose

func (tex *PaletteTexture) Dispose()

Dispose releases the OpenGL texture.

func (*PaletteTexture) Handle

func (tex *PaletteTexture) Handle() uint32

Handle returns the texture handle.

func (*PaletteTexture) Palette

func (tex *PaletteTexture) Palette() bitmap.Palette

Palette returns the original palette.

func (*PaletteTexture) Update

func (tex *PaletteTexture) Update(palette bitmap.Palette)

Update reloads the palette.

type TextureCache

type TextureCache struct {
	// contains filtered or unexported fields
}

TextureCache loads bitmaps and provides OpenGL textures.

func NewTextureCache

func NewTextureCache(gl opengl.OpenGL, localizer resource.Localizer) *TextureCache

NewTextureCache returns a new instance.

func (*TextureCache) InvalidateResources

func (cache *TextureCache) InvalidateResources(ids []resource.ID)

InvalidateResources lets the cache remove any textures from resources that are specified in the given slice.

func (*TextureCache) Texture

func (cache *TextureCache) Texture(key resource.Key) (*BitmapTexture, error)

Texture returns the texture with given key - if available.

Jump to

Keyboard shortcuts

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