Documentation ¶
Index ¶
- type GLContext
- type Image
- type ImagePattern
- type LinearGradient
- type RadialGradient
- type XMobileBackend
- func (b *XMobileBackend) Activate()
- func (b *XMobileBackend) AsImage() backendbase.Image
- func (b *XMobileBackend) CanUseAsImage(b2 backendbase.Backend) bool
- func (b *XMobileBackend) Clear(pts [4][2]float64)
- func (b *XMobileBackend) ClearClip()
- func (b *XMobileBackend) Clip(pts [][2]float64)
- func (b *XMobileBackend) DrawImage(dimg backendbase.Image, sx, sy, sw, sh float64, pts [4][2]float64, ...)
- func (b *XMobileBackend) Fill(style *backendbase.FillStyle, pts [][2]float64)
- func (b *XMobileBackend) FillImageMask(style *backendbase.FillStyle, mask *image.Alpha, pts [][2]float64)
- func (b *XMobileBackend) GetImageData(x, y, w, h int) *image.RGBA
- func (b *XMobileBackend) LoadImage(src image.Image) (backendbase.Image, error)
- func (b *XMobileBackend) LoadImagePattern(data backendbase.ImagePatternData) backendbase.ImagePattern
- func (b *XMobileBackend) LoadLinearGradient(data backendbase.Gradient) backendbase.LinearGradient
- func (b *XMobileBackend) LoadRadialGradient(data backendbase.Gradient) backendbase.RadialGradient
- func (b *XMobileBackend) PutImageData(img *image.RGBA, x, y int)
- func (b *XMobileBackend) SetBounds(x, y, w, h int)
- func (b *XMobileBackend) Size() (int, int)
- type XMobileBackendOffscreen
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
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
type ImagePattern ¶ added in v0.7.1
type ImagePattern struct {
// contains filtered or unexported fields
}
func (*ImagePattern) Delete ¶ added in v0.7.1
func (ip *ImagePattern) Delete()
func (*ImagePattern) Replace ¶ added in v0.7.1
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][2]float64)
func (*XMobileBackend) ClearClip ¶
func (b *XMobileBackend) ClearClip()
func (*XMobileBackend) Clip ¶
func (b *XMobileBackend) Clip(pts [][2]float64)
func (*XMobileBackend) DrawImage ¶
func (b *XMobileBackend) DrawImage(dimg backendbase.Image, sx, sy, sw, sh float64, pts [4][2]float64, alpha float64)
func (*XMobileBackend) Fill ¶
func (b *XMobileBackend) Fill(style *backendbase.FillStyle, pts [][2]float64)
func (*XMobileBackend) FillImageMask ¶
func (b *XMobileBackend) FillImageMask(style *backendbase.FillStyle, mask *image.Alpha, pts [][2]float64)
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 ¶ added in v0.7.1
func (b *XMobileBackend) LoadImagePattern(data backendbase.ImagePatternData) backendbase.ImagePattern
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 ¶
func (b *XMobileBackendOffscreen) AsImage() backendbase.Image
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