xcanvas

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canvas

type Canvas struct {
	*xgraphics.Image
}

Canvas satisfies the canvas.Canvas interface. It draws to an xgraphics.Image. It must be closed after use.

func NewCanvas

func NewCanvas(x *xgbutil.XUtil, bounds image.Rectangle) *Canvas

NewCanvas creates a new canvas from a bounding rectangle.

func NewCanvasFrom

func NewCanvasFrom(image *xgraphics.Image) *Canvas

NewCanvasFrom creates a new canvas from an existing xgraphics.Image. Note that calling Close() on the resulting canvas will destroy this image.

func (*Canvas) Close

func (this *Canvas) Close() error

Close frees this canvas from the X server.

func (*Canvas) Pen

func (this *Canvas) Pen() canvas.Pen

Pen returns a new drawing context.

func (*Canvas) Push

func (this *Canvas) Push(window xproto.Window)

Push pushes this canvas to the screen.

func (*Canvas) SubCanvas

func (this *Canvas) SubCanvas(bounds image.Rectangle) canvas.Canvas

SubCanvas returns a subset of this canvas that points to the same data.

type Texture

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

Texture is a read-only image texture that can be quickly written to a canvas. It must be closed manually after use.

func AssertTexture

func AssertTexture(unknown canvas.Texture) *Texture

AssertTexture checks if a given canvas.Texture is a texture from this package.

func NewTextureFrom

func NewTextureFrom(source image.Image) *Texture

NewTextureFrom creates a new texture from a source image.

func (*Texture) At

func (this *Texture) At(x, y int) color.Color

func (*Texture) BGRAAt

func (this *Texture) BGRAAt(x, y int) xgraphics.BGRA

func (*Texture) Bounds

func (this *Texture) Bounds() image.Rectangle

Bounds returns the bounding rectangle of this texture.

func (*Texture) Close

func (this *Texture) Close() error

Close frees the texture from memory.

func (*Texture) ColorModel

func (this *Texture) ColorModel() color.Model

func (*Texture) Opaque

func (this *Texture) Opaque() bool

Opaque reports whether or not the texture is fully opaque.

func (*Texture) PixOffset

func (this *Texture) PixOffset(x, y int) int

func (*Texture) SubTexture

func (this *Texture) SubTexture(bounds image.Rectangle) canvas.Texture

SubTexture returns a subset of this texture that points to the same data.

Jump to

Keyboard shortcuts

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