graphicsdriver

package
v2.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidImageID  = 0
	InvalidShaderID = 0
)

Variables

View Source
var GraphicsNotReady = errors.New("graphics not ready")

GraphicsNotReady represents that the graphics driver is not ready for recovering from the context lost.

Functions

This section is empty.

Types

type Address

type Address int
const (
	AddressUnsafe Address = iota
	AddressClampToZero
	AddressRepeat
)

type ColorM

type ColorM interface {
	IsIdentity() bool
	At(i, j int) float32
	Elements(body *[16]float32, translate *[4]float32)
}

type CompositeMode

type CompositeMode int
const (
	CompositeModeUnknown    CompositeMode = iota - 1
	CompositeModeSourceOver               // This value must be 0 (= initial value)
	CompositeModeClear
	CompositeModeCopy
	CompositeModeDestination
	CompositeModeDestinationOver
	CompositeModeSourceIn
	CompositeModeDestinationIn
	CompositeModeSourceOut
	CompositeModeDestinationOut
	CompositeModeSourceAtop
	CompositeModeDestinationAtop
	CompositeModeXor
	CompositeModeLighter
	CompositeModeMultiply

	CompositeModeMax = CompositeModeMultiply
)

func (CompositeMode) Operations

func (c CompositeMode) Operations() (src Operation, dst Operation)

type Filter

type Filter int
const (
	FilterNearest Filter = iota
	FilterLinear
	FilterScreen
)

type Graphics

type Graphics interface {
	Initialize() error
	Begin() error
	End(present bool) error
	SetTransparent(transparent bool)
	SetVertices(vertices []float32, indices []uint16) error
	NewImage(width, height int) (Image, error)
	NewScreenFramebufferImage(width, height int) (Image, error)
	SetVsyncEnabled(enabled bool)
	SetFullscreen(fullscreen bool)
	FramebufferYDirection() YDirection
	NeedsRestoring() bool
	NeedsClearingScreen() bool
	IsGL() bool
	IsDirectX() bool
	MaxImageSize() int

	NewShader(program *shaderir.Program) (Shader, error)

	// DrawTriangles draws an image onto another image with the given parameters.
	DrawTriangles(dst ImageID, srcs [graphics.ShaderImageCount]ImageID, offsets [graphics.ShaderImageCount - 1][2]float32, shader ShaderID, indexLen int, indexOffset int, mode CompositeMode, colorM ColorM, filter Filter, address Address, dstRegion, srcRegion Region, uniforms [][]float32, evenOdd bool) error
}

type Image

type Image interface {
	ID() ImageID
	Dispose()
	IsInvalidated() bool
	ReadPixels(buf []byte) error
	WritePixels(args []*WritePixelsArgs) error
}

type ImageID

type ImageID int

type Operation

type Operation int
const (
	Zero Operation = iota
	One
	SrcAlpha
	DstAlpha
	OneMinusSrcAlpha
	OneMinusDstAlpha
	DstColor
)

type Region

type Region struct {
	X      float32
	Y      float32
	Width  float32
	Height float32
}

type Shader

type Shader interface {
	ID() ShaderID
	Dispose()
}

type ShaderID

type ShaderID int

type WritePixelsArgs added in v2.4.0

type WritePixelsArgs struct {
	Pixels []byte
	X      int
	Y      int
	Width  int
	Height int
}

type YDirection

type YDirection int
const (
	Upward YDirection = iota
	Downward
)

Directories

Path Synopsis
ca
Package ca provides access to Apple's Core Animation API (https://developer.apple.com/documentation/quartzcore).
Package ca provides access to Apple's Core Animation API (https://developer.apple.com/documentation/quartzcore).
mtl
Package mtl provides access to Apple's Metal API (https://developer.apple.com/documentation/metal).
Package mtl provides access to Apple's Metal API (https://developer.apple.com/documentation/metal).
ns
Package ns provides access to Apple's AppKit API (https://developer.apple.com/documentation/appkit).
Package ns provides access to Apple's AppKit API (https://developer.apple.com/documentation/appkit).
gl
Package gl implements Go bindings to OpenGL.
Package gl implements Go bindings to OpenGL.
gles
Package gles implements Go bindings to OpenGL ES.
Package gles implements Go bindings to OpenGL ES.

Jump to

Keyboard shortcuts

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