-
Notifications
You must be signed in to change notification settings - Fork 4
/
fill_opt.go
33 lines (28 loc) · 942 Bytes
/
fill_opt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package tcg
// FillOpt - fill options
type FillOpt func(*fillOptions)
type fillOptions struct {
pattern *Buffer // buffer with pattern for fill instead of black color
checkBuf *Buffer // buffer for check where we already fill pixels
mask *Buffer // mask buffer used for fill instead of original buffer
allAreas bool // fill in all areas, not necessarily continuous
}
// WithPattern - option for Fill method, which provide fill pattern from another buffer
func WithPattern(buf Buffer) FillOpt {
return func(fo *fillOptions) {
fo.pattern = &buf
}
}
// WithMask - option for Fill method: add mask from Buffer
func WithMask(buf Buffer) FillOpt {
return func(fo *fillOptions) {
fo.mask = &buf
}
}
// WithAllAreas - option for Fill method: fill in all areas, not necessarily continuous.
// Makes sense only when filled with a pattern.
func WithAllAreas() FillOpt {
return func(fo *fillOptions) {
fo.allAreas = true
}
}