Compare commits
2 Commits
be1b9d77e8
...
d096d40c57
Author | SHA1 | Date | |
---|---|---|---|
d096d40c57 | |||
34358da6eb |
@ -29,6 +29,10 @@ type Backend interface {
|
||||
// reject any texture that was not made by it.
|
||||
NewTexture (image.Image) canvas.TextureCloser
|
||||
|
||||
// NewCanvas creates a new canvas with the specified bounds. The backend
|
||||
// must reject any canvas that was not made by it.
|
||||
NewCanvas (image.Rectangle) canvas.CanvasCloser
|
||||
|
||||
// Run runs the event loop until Stop() is called, or the backend
|
||||
// experiences a fatal error.
|
||||
Run () error
|
||||
|
@ -77,6 +77,13 @@ type Canvas interface {
|
||||
SubCanvas (image.Rectangle) Canvas
|
||||
}
|
||||
|
||||
// CanvasCloser is a canvas that can be closed. Anything that receives a
|
||||
// CanvasCloser must close it after use.
|
||||
type CanvasCloser interface {
|
||||
CanvasCloser
|
||||
io.Closer
|
||||
}
|
||||
|
||||
// Drawer can draw to a canvas.
|
||||
type Drawer interface {
|
||||
// Draw draws to the given canvas.
|
||||
|
7
tomo.go
7
tomo.go
@ -93,3 +93,10 @@ func NewTexture (source image.Image) canvas.TextureCloser {
|
||||
assertBackend()
|
||||
return backend.NewTexture(source)
|
||||
}
|
||||
|
||||
// NewCanvas creates a new canvas with the specified bounds. When no longer in
|
||||
// use, it must be freed using Close().
|
||||
func NewCanvas (bounds image.Rectangle) canvas.CanvasCloser {
|
||||
assertBackend()
|
||||
return backend.NewTexture(bounds)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user