texture

package
v0.0.0-...-63a8a9f Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Package texture handles hardware accelerated image drawing. It uses a small subset of the features provided by the SFML library version 2.5 1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drawable

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

Drawable represent a drawable texture. It implements the wandi.Drawable and wandi.Image interfaces.

func LoadDrawable

func LoadDrawable(path string) (*Drawable, error)

LoadDrawable loads the provided file and converts it into a drawable texture.

Note: The Free method of the texture must be called when finished using it.

func NewDrawable

func NewDrawable(width, height int) (*Drawable, error)

NewDrawable creates a drawable texture of the specified dimensions.

Note: The Free method of the texture must be called when finished using it.

func ReadDrawable

func ReadDrawable(img image.Image) (*Drawable, error)

ReadDrawable reads the provided image and converts it into a drawable texture.

Note: The Free method of the texture must be called when finished using it.

func (*Drawable) Draw

func (dst *Drawable) Draw(dp image.Point, src wandi.Image) error

Draw draws the entire src image onto the dst texture starting at the destination point dp.

func (*Drawable) DrawRect

func (dst *Drawable) DrawRect(dp image.Point, src wandi.Image, sr image.Rectangle) error

DrawRect draws a subset of the src image, as defined by the source rectangle sr, onto the dst texture starting at the destination point dp.

func (*Drawable) Fill

func (dst *Drawable) Fill(c color.Color)

Fill fills the entire texture with the provided color.

func (*Drawable) Free

func (tex *Drawable) Free()

Free frees the texture.

func (*Drawable) Height

func (tex *Drawable) Height() int

Height returns the height of the texture.

func (*Drawable) Image

func (tex *Drawable) Image() (image.Image, error)

Image returns an image.Image representation of the texture.

func (*Drawable) Width

func (tex *Drawable) Width() int

Width returns the width of the texture.

type Image

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

Image represent a read-only texture. It implements the wandi.Image interface.

func Load

func Load(path string) (*Image, error)

Load loads the provided file and converts it into a read-only texture.

Note: The Free method of the texture must be called when finished using it.

func Read

func Read(src image.Image) (*Image, error)

Read reads the provided image and converts it into a read-only texture.

Note: The Free method of the texture must be called when finished using it.

func (*Image) Free

func (tex *Image) Free()

Free frees the texture.

func (*Image) Height

func (tex *Image) Height() int

Height returns the height of the texture.

func (*Image) Width

func (tex *Image) Width() int

Width returns the width of the texture.

Jump to

Keyboard shortcuts

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