xmobilebackend

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GLContext

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

GLContext is a context that contains all the shaders and buffers necessary for rendering

func NewGLContext

func NewGLContext(glctx gl.Context) (*GLContext, error)

NewGLContext creates all the necessary GL resources, like shaders and buffers

type Image

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

Image represents a loaded image that can be used in various drawing functions

func (*Image) Delete

func (img *Image) Delete()

Delete deletes the image from memory. Any draw calls with a deleted image will not do anything

func (*Image) Height

func (img *Image) Height() int

Height returns the height of the image

func (*Image) Replace

func (img *Image) Replace(src image.Image) error

Replace replaces the image with the new one

func (*Image) Size

func (img *Image) Size() (int, int)

Size returns the width and height of the image

func (*Image) Width

func (img *Image) Width() int

Width returns the width of the image

type ImagePattern

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

func (*ImagePattern) Delete

func (ip *ImagePattern) Delete()

func (*ImagePattern) Replace

func (ip *ImagePattern) Replace(data backendbase.ImagePatternData)

type LinearGradient

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

LinearGradient is a gradient with any number of stops and any number of colors. The gradient will be drawn such that each point on the gradient will correspond to a straight line

func (*LinearGradient) Delete

func (g *LinearGradient) Delete()

Delete explicitly deletes the gradient

func (*LinearGradient) Replace

func (lg *LinearGradient) Replace(data backendbase.Gradient)

type RadialGradient

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

RadialGradient is a gradient with any number of stops and any number of colors. The gradient will be drawn such that each point on the gradient will correspond to a circle

func (*RadialGradient) Delete

func (g *RadialGradient) Delete()

Delete explicitly deletes the gradient

func (*RadialGradient) Replace

func (rg *RadialGradient) Replace(data backendbase.Gradient)

type XMobileBackend

type XMobileBackend struct {
	*GLContext
	// contains filtered or unexported fields
}

XMobileBackend is a canvas backend using Go-GL

func New

func New(x, y, w, h int, ctx *GLContext) (*XMobileBackend, error)

New returns a new canvas backend. x, y, w, h define the target rectangle in the window. ctx is a GLContext created with NewGLContext

func (*XMobileBackend) Activate

func (b *XMobileBackend) Activate()

Activate only needs to be called if there is other code also using the GL state

func (*XMobileBackend) AsImage

func (b *XMobileBackend) AsImage() backendbase.Image

AsImage returns nil, since this backend cannot be directly used as an image. Used internally

func (*XMobileBackend) CanUseAsImage

func (b *XMobileBackend) CanUseAsImage(b2 backendbase.Backend) bool

CanUseAsImage returns true if the given backend can be directly used by this backend to avoid a conversion. Used internally

func (*XMobileBackend) Clear

func (b *XMobileBackend) Clear(pts [4]backendbase.Vec)

func (*XMobileBackend) ClearClip

func (b *XMobileBackend) ClearClip()

func (*XMobileBackend) Clip

func (b *XMobileBackend) Clip(pts []backendbase.Vec)

func (*XMobileBackend) DrawImage

func (b *XMobileBackend) DrawImage(dimg backendbase.Image, sx, sy, sw, sh float64, pts [4]backendbase.Vec, alpha float64)

func (*XMobileBackend) Fill

func (b *XMobileBackend) Fill(style *backendbase.FillStyle, pts []backendbase.Vec, tf backendbase.Mat, canOverlap bool)

func (*XMobileBackend) FillImageMask

func (b *XMobileBackend) FillImageMask(style *backendbase.FillStyle, mask *image.Alpha, pts [4]backendbase.Vec)

func (*XMobileBackend) GetImageData

func (b *XMobileBackend) GetImageData(x, y, w, h int) *image.RGBA

GetImageData returns an RGBA image of the current image

func (*XMobileBackend) LoadImage

func (b *XMobileBackend) LoadImage(src image.Image) (backendbase.Image, error)

func (*XMobileBackend) LoadImagePattern

func (*XMobileBackend) LoadLinearGradient

func (b *XMobileBackend) LoadLinearGradient(data backendbase.Gradient) backendbase.LinearGradient

func (*XMobileBackend) LoadRadialGradient

func (b *XMobileBackend) LoadRadialGradient(data backendbase.Gradient) backendbase.RadialGradient

func (*XMobileBackend) PutImageData

func (b *XMobileBackend) PutImageData(img *image.RGBA, x, y int)

PutImageData puts the given image at the given x/y coordinates

func (*XMobileBackend) SetBounds

func (b *XMobileBackend) SetBounds(x, y, w, h int)

SetBounds updates the bounds of the canvas. This would usually be called for example when the window is resized

func (*XMobileBackend) Size

func (b *XMobileBackend) Size() (int, int)

Size returns the size of the window or offscreen texture

type XMobileBackendOffscreen

type XMobileBackendOffscreen struct {
	XMobileBackend

	TextureID gl.Texture
	// contains filtered or unexported fields
}

XMobileBackendOffscreen is a canvas backend using an offscreen texture

func NewOffscreen

func NewOffscreen(w, h int, alpha bool, ctx *GLContext) (*XMobileBackendOffscreen, error)

NewOffscreen returns a new offscreen canvas backend. w, h define the size of the offscreen texture. ctx is a GLContext created with NewGLContext

func (*XMobileBackendOffscreen) AsImage

AsImage returns an implementation of the Image interface that can be used to render this offscreen texture directly. Used internally

func (*XMobileBackendOffscreen) Delete

func (b *XMobileBackendOffscreen) Delete()

Delete deletes the offscreen texture. After calling this the backend can no longer be used

func (*XMobileBackendOffscreen) SetSize

func (b *XMobileBackendOffscreen) SetSize(w, h int)

SetSize updates the size of the offscreen texture

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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