zntg/ui/renderer.go
Sander Schobers 2c9007ce9b Added renderer factory.
- Removes dependency on the specific backend from an application point-of-view.
2020-05-12 22:46:58 +02:00

38 lines
951 B
Go

package ui
import (
"image"
"image/color"
"opslag.de/schobers/geom"
)
type Renderer interface {
// Events
PushEvents(t EventTarget, wait bool)
Refresh()
// Lifetime
Destroy() error
// Drawing
Clear(c color.Color)
CreateImage(m image.Image) (Image, error)
CreateImagePath(path string) (Image, error)
CreateImageSize(w, h float32) (Image, error)
DefaultTarget() Image
DrawImage(im Image, p geom.PointF32)
DrawImageOptions(im Image, p geom.PointF32, opts DrawOptions)
FillRectangle(r geom.RectangleF32, c color.Color)
Font(name string) Font
Rectangle(r geom.RectangleF32, c color.Color, thickness float32)
RegisterFont(name, path string, size int) error
RenderTo(Image)
RenderToDisplay()
SetMouseCursor(c MouseCursor)
Size() geom.PointF32
Target() Image
Text(p geom.PointF32, font string, color color.Color, text string)
TextAlign(p geom.PointF32, font string, color color.Color, text string, align HorizontalAlignment)
}