image

package
v0.0.0-...-7ac4638 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT Imports: 4 Imported by: 3

Documentation

Overview

Package image contains types to deal with nine-slice images, buffered (cached) images, as well as drawing using masks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewImageColor

func NewImageColor(c color.Color) *ebiten.Image

NewImageColor constructs a new Image that when drawn fills with color c.

Types

type BufferedImage

type BufferedImage struct {
	Width  int
	Height int
	// contains filtered or unexported fields
}

BufferedImage is a wrapper for an Ebiten Image that helps with caching the Image. As long as Width and Height stay the same, no new Image will be created.

func (*BufferedImage) Image

func (b *BufferedImage) Image() *ebiten.Image

Image returns the internal Ebiten Image. If b.Width or b.Height have changed, a new Image will be created and returned, otherwise the cached Image will be returned.

type DrawFunc

type DrawFunc func(buf *ebiten.Image)

DrawFunc is a function that draws something into buf.

type DrawImageOptionsFunc

type DrawImageOptionsFunc func(opts *ebiten.DrawImageOptions)

A DrawImageOptionsFunc is responsible for setting DrawImageOptions when drawing an image. This is usually used to translate the image.

type MaskedRenderBuffer

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

MaskedRenderBuffer is a helper to draw images using a mask.

func NewMaskedRenderBuffer

func NewMaskedRenderBuffer() *MaskedRenderBuffer

NewMaskedRenderBuffer returns a new MaskedRenderBuffer.

func (*MaskedRenderBuffer) Draw

func (m *MaskedRenderBuffer) Draw(screen *ebiten.Image, d DrawFunc, dm DrawFunc)

Draw calls d to draw onto screen, using the mask drawn by dm. The buffer images passed to d and dm are of the same size as screen.

type NineSlice

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

A NineSlice is an image that can be drawn with any width and height. It is basically a 3x3 grid of image tiles: The corner tiles are drawn as-is, while the center columns and rows of tiles will be stretched to fit the desired width and height.

func NewNineSlice

func NewNineSlice(i *ebiten.Image, w [3]int, h [3]int) *NineSlice

NewNineSlice constructs a new NineSlice from i, having columns widths w and row heights h.

func NewNineSliceColor

func NewNineSliceColor(c color.Color) *NineSlice

NewNineSliceColor constructs a new NineSlice that when drawn fills with color c.

func NewNineSliceSimple

func NewNineSliceSimple(image *ebiten.Image, borderWidthHeight int, centerWidthHeight int) *NineSlice

NewNineSliceSimple constructs a new NineSlice from image. borderWidthHeight specifies the width of the left and right column and the height of the top and bottom row. centerWidthHeight specifies the width of the center column and row.

func (*NineSlice) Draw

func (n *NineSlice) Draw(screen *ebiten.Image, width int, height int, optsFunc DrawImageOptionsFunc)

Draw draws n onto screen, with the size specified by width and height. If optsFunc is not nil, it is used to set DrawImageOptions for each tile drawn.

func (*NineSlice) MinSize

func (n *NineSlice) MinSize() (int, int)

MinSize returns the minimum width and height to draw n correctly. If n is drawn with a smaller size, the corner or edge tiles will overlap.

Jump to

Keyboard shortcuts

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