backendbase

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Size() (int, int)

	LoadImage(img image.Image) (Image, error)
	LoadImagePattern(data ImagePatternData) ImagePattern
	LoadLinearGradient(data Gradient) LinearGradient
	LoadRadialGradient(data Gradient) RadialGradient

	Clear(pts [4][2]float64)
	Fill(style *FillStyle, pts [][2]float64)
	DrawImage(dimg Image, sx, sy, sw, sh float64, pts [4][2]float64, alpha float64)
	FillImageMask(style *FillStyle, mask *image.Alpha, pts [][2]float64) // pts must have four points

	ClearClip()
	Clip(pts [][2]float64)

	GetImageData(x, y, w, h int) *image.RGBA
	PutImageData(img *image.RGBA, x, y int)

	CanUseAsImage(b Backend) bool
	AsImage() Image // can return nil if not supported
}

Backend is used by the canvas to actually do the final drawing. This enables the backend to be implemented by various methods (OpenGL, but also other APIs or software)

type FillStyle

type FillStyle struct {
	Color          color.RGBA
	Blur           float64
	LinearGradient LinearGradient
	RadialGradient RadialGradient
	Gradient       struct {
		X0, Y0  float64
		X1, Y1  float64
		RadFrom float64
		RadTo   float64
	}
	ImagePattern ImagePattern
}

FillStyle is the color and other details on how to fill

type Gradient

type Gradient []GradientStop

func (Gradient) ColorAt

func (g Gradient) ColorAt(pos float64) color.RGBA

type GradientStop

type GradientStop struct {
	Pos   float64
	Color color.RGBA
}

type Image

type Image interface {
	Width() int
	Height() int
	Size() (w, h int)
	Delete()
	Replace(src image.Image) error
}

type ImagePattern

type ImagePattern interface {
	Delete()
	Replace(data ImagePatternData)
}

type ImagePatternData

type ImagePatternData struct {
	Image Image
}

type LinearGradient

type LinearGradient interface {
	Delete()
	Replace(data Gradient)
}

type RadialGradient

type RadialGradient interface {
	Delete()
	Replace(data Gradient)
}

Jump to

Keyboard shortcuts

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