wallpaper

package
v0.0.0-...-1f00af5 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileToB64

func FileToB64(filename string) (string, error)

FileToB64 loads an image file from disk and returns the Base64 encoded file data, if it is a valid image and so on.

Types

type Wallpaper

type Wallpaper struct {
	Name   string
	Format string // image file format
	Image  *image.RGBA
	// contains filtered or unexported fields
}

Wallpaper is a repeatable background image to go behind levels.

func FromFile

func FromFile(filename string, embeddable filesystem.Embeddable) (*Wallpaper, error)

FromFile creates a Wallpaper from a file on disk. If the renger.Engine is nil it will compute images but not pre-cache any textures yet.

func FromImage

func FromImage(img *image.RGBA, name string) (*Wallpaper, error)

FromImage creates a Wallpaper from an image.Image. If the renger.Engine is nil it will compute images but not pre-cache any textures yet.

func (*Wallpaper) Corner

func (wp *Wallpaper) Corner() *image.RGBA

Corner returns the top left corner image.

func (*Wallpaper) CornerTexture

func (wp *Wallpaper) CornerTexture(e render.Engine) (render.Texturer, error)

CornerTexture returns the Texture.

func (*Wallpaper) Free

func (wp *Wallpaper) Free() int

Free all SDL2 textures from memory.

The Canvas widget will free wallpaper textures in its Destroy method. Note that if the wallpaper was still somehow in use, the textures will be regenerated the next time a method like CornerTexture() asks for one.

Returns the number of textures freed (up to 4) or -1 if wallpaper was not ready.

func (*Wallpaper) Left

func (wp *Wallpaper) Left() *image.RGBA

Left returns the left repeating image.

func (*Wallpaper) LeftTexture

func (wp *Wallpaper) LeftTexture(e render.Engine) (render.Texturer, error)

LeftTexture returns the Texture.

func (*Wallpaper) QuarterRect

func (wp *Wallpaper) QuarterRect() render.Rect

QuarterRect returns a Rect of the size of the quarter images.

func (*Wallpaper) QuarterSize

func (wp *Wallpaper) QuarterSize() (int, int)

QuarterSize returns the width and height of the quarter images.

func (*Wallpaper) Repeat

func (wp *Wallpaper) Repeat() *image.RGBA

Repeat returns the main repeating image.

func (*Wallpaper) RepeatTexture

func (wp *Wallpaper) RepeatTexture(e render.Engine) (render.Texturer, error)

RepeatTexture returns the Texture.

func (*Wallpaper) Top

func (wp *Wallpaper) Top() *image.RGBA

Top returns the top repeating image.

func (*Wallpaper) TopTexture

func (wp *Wallpaper) TopTexture(e render.Engine) (render.Texturer, error)

TopTexture returns the Texture.

Jump to

Keyboard shortcuts

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