graphicscommand

package
v1.11.9 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package graphicscommand represents a low layer for graphics using OpenGL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlushCommands

func FlushCommands() error

FlushCommands flushes the command queue.

func NeedsRestoring added in v1.10.0

func NeedsRestoring() bool

func ResetGraphicsDriverState

func ResetGraphicsDriverState() error

ResetGraphicsDriverState resets or initializes the current graphics driver state.

func SetGraphicsDriver added in v1.10.0

func SetGraphicsDriver(driver driver.Graphics)

Types

type Image

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

Image represents an image that is implemented with OpenGL.

func NewImage

func NewImage(width, height int) *Image

NewImage returns a new image.

Note that the image is not initialized yet.

func NewScreenFramebufferImage

func NewScreenFramebufferImage(width, height int) *Image

func (*Image) Dispose

func (i *Image) Dispose()

func (*Image) DrawTriangles added in v1.10.0

func (i *Image) DrawTriangles(src *Image, vertices []float32, indices []uint16, clr *affine.ColorM, mode driver.CompositeMode, filter driver.Filter, address driver.Address)

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 (not texels!)
3:  Source Y in pixels
4:  Bounds of the source min X in pixels
5:  Bounds of the source min Y in pixels
6:  Bounds of the source max X in pixels
7:  Bounds of the source max Y in pixels
8:  Color R [0.0-1.0]
9:  Color G
10: Color B
11: Color Y

func (*Image) Dump added in v1.10.0

func (i *Image) Dump(path string, blackbg bool) error

Dump dumps the image to the specified path. In the path, '*' is replaced with the image's ID.

If blackbg is true, any alpha values in the dumped image will be 255.

This is for testing usage.

func (*Image) InternalSize added in v1.10.0

func (i *Image) InternalSize() (int, int)

func (*Image) IsInvalidated

func (i *Image) IsInvalidated() bool

func (*Image) Pixels

func (i *Image) Pixels() ([]byte, error)

Pixels returns the image's pixels. Pixels might return nil when OpenGL error happens.

func (*Image) ReplacePixels

func (i *Image) ReplacePixels(pixels []byte, x, y, width, height int)

Jump to

Keyboard shortcuts

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