aboutsummaryrefslogtreecommitdiffstats
path: root/layout/interface.go
blob: 28b6a01892e7d3ac3a15e677148860c5ea74f220 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package layout

import (
	"fmt"
	"image"
	"image/draw"
)

type EventDrawer interface {
	Event() <-chan Event
	Draw() chan<- func(draw.Image) image.Rectangle
}

type Event string

func Eventf(format string, a ...interface{}) Event {
	return Event(fmt.Sprintf(format, a...))
}

func (e Event) Matches(format string, a ...interface{}) bool {
	_, err := fmt.Sscanf(string(e), format, a...)
	return err == nil
}