graphicsdriver

package
v2.5.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidImageID  = 0
	InvalidShaderID = 0
)

Variables

View Source
var BlendClear = Blend{
	BlendFactorSourceRGB:        BlendFactorZero,
	BlendFactorSourceAlpha:      BlendFactorZero,
	BlendFactorDestinationRGB:   BlendFactorZero,
	BlendFactorDestinationAlpha: BlendFactorZero,
	BlendOperationRGB:           BlendOperationAdd,
	BlendOperationAlpha:         BlendOperationAdd,
}
View Source
var BlendCopy = Blend{
	BlendFactorSourceRGB:        BlendFactorOne,
	BlendFactorSourceAlpha:      BlendFactorOne,
	BlendFactorDestinationRGB:   BlendFactorZero,
	BlendFactorDestinationAlpha: BlendFactorZero,
	BlendOperationRGB:           BlendOperationAdd,
	BlendOperationAlpha:         BlendOperationAdd,
}
View Source
var BlendSourceOver = Blend{
	BlendFactorSourceRGB:        BlendFactorOne,
	BlendFactorSourceAlpha:      BlendFactorOne,
	BlendFactorDestinationRGB:   BlendFactorOneMinusSourceAlpha,
	BlendFactorDestinationAlpha: BlendFactorOneMinusSourceAlpha,
	BlendOperationRGB:           BlendOperationAdd,
	BlendOperationAlpha:         BlendOperationAdd,
}

Functions

This section is empty.

Types

type Blend added in v2.5.0

type Blend struct {
	BlendFactorSourceRGB        BlendFactor
	BlendFactorSourceAlpha      BlendFactor
	BlendFactorDestinationRGB   BlendFactor
	BlendFactorDestinationAlpha BlendFactor
	BlendOperationRGB           BlendOperation
	BlendOperationAlpha         BlendOperation
}

type BlendFactor added in v2.5.0

type BlendFactor byte
const (
	BlendFactorZero BlendFactor = iota
	BlendFactorOne
	BlendFactorSourceColor
	BlendFactorOneMinusSourceColor
	BlendFactorSourceAlpha
	BlendFactorOneMinusSourceAlpha
	BlendFactorDestinationColor
	BlendFactorOneMinusDestinationColor
	BlendFactorDestinationAlpha
	BlendFactorOneMinusDestinationAlpha
	BlendFactorSourceAlphaSaturated
)

type BlendOperation added in v2.5.0

type BlendOperation byte
const (
	BlendOperationAdd BlendOperation = iota
	BlendOperationSubtract
	BlendOperationReverseSubtract
)

type DstRegion added in v2.5.0

type DstRegion struct {
	Region     Region
	IndexCount int
}

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)
	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, shader ShaderID, dstRegions []DstRegion, indexOffset int, blend Blend, uniforms []uint32, evenOdd bool) error
}

type Image

type Image interface {
	ID() ImageID
	Dispose()
	IsInvalidated() bool
	ReadPixels(buf []byte, x, y, width, height int) error
	WritePixels(args []*WritePixelsArgs) error
}

type ImageID

type ImageID int

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
}

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

Jump to

Keyboard shortcuts

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