atlas

package
v2.8.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NearestFilterShader = &Shader{shader: restorable.NearestFilterShader}
	LinearFilterShader  = &Shader{shader: restorable.LinearFilterShader}
)

Functions

func BeginFrame

func BeginFrame(graphicsDriver graphicsdriver.Graphics) error

func DumpImages

func DumpImages(graphicsDriver graphicsdriver.Graphics, dir string) (string, error)

func EndFrame

func EndFrame() error

func SwapBuffers added in v2.7.0

func SwapBuffers(graphicsDriver graphicsdriver.Graphics) error

Types

type Image

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

Image is a rectangle pixel set that might be on an atlas.

func NewImage

func NewImage(width, height int, imageType ImageType) *Image

func (*Image) Deallocate added in v2.7.0

func (i *Image) Deallocate()

Deallocate deallocates the internal state. Even after this call, the image is still available as a new cleared image.

func (*Image) DrawTriangles

func (i *Image) DrawTriangles(srcs [graphics.ShaderSrcImageCount]*Image, vertices []float32, indices []uint32, blend graphicsdriver.Blend, dstRegion image.Rectangle, srcRegions [graphics.ShaderSrcImageCount]image.Rectangle, shader *Shader, uniforms []uint32, fillRule graphicsdriver.FillRule, hint restorable.Hint)

DrawTriangles draws triangles with the given image.

The vertex floats are:

0: Destination X in pixels
1: Destination Y in pixels
2: Source X in pixels (the upper-left is (0, 0))
3: Source Y in pixels
4: Color R [0.0-1.0]
5: Color G
6: Color B
7: Color Y

func (*Image) DumpScreenshot added in v2.1.4

func (i *Image) DumpScreenshot(graphicsDriver graphicsdriver.Graphics, path string, blackbg bool) (string, error)

func (*Image) ReadPixels added in v2.4.0

func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, pixels []byte, region image.Rectangle) (ok bool, err error)

func (*Image) WritePixels added in v2.4.0

func (i *Image) WritePixels(pix []byte, region image.Rectangle)

WritePixels replaces the pixels on the image.

type ImageType added in v2.4.0

type ImageType int

ImageType represents the type of an image.

const (
	// ImageTypeRegular is a regular image, that can be on a big texture atlas (backend).
	ImageTypeRegular ImageType = iota

	// ImageTypeScreen is a screen image that is not on an atlas.
	// A screen image is also unmanaged.
	ImageTypeScreen

	// ImageTypeVolatile is a volatile image that is cleared every frame.
	// A volatile image is also unmanaged.
	ImageTypeVolatile

	// ImageTypeUnmanaged is an unmanaged image that is not on an atlas.
	ImageTypeUnmanaged
)

type Shader

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

func NewShader

func NewShader(ir *shaderir.Program, name string) *Shader

func (*Shader) Deallocate added in v2.7.0

func (s *Shader) Deallocate()

Deallocate deallocates the internal state.

Jump to

Keyboard shortcuts

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