-
Notifications
You must be signed in to change notification settings - Fork 0
/
filter.go
37 lines (30 loc) · 1.05 KB
/
filter.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
34
35
36
37
package script
import (
"github.com/peter-mount/go-anim/graph/color"
"github.com/peter-mount/go-anim/graph/filter"
"image"
)
import (
"github.com/peter-mount/go-anim/graph"
)
type Filter struct{}
// Filter applies a graph.Filter on a source image within the specified bounds,
// writing the result to the destination image.
//
// The source and destination image may be the same Image if the filter supports it.
func (_ Filter) Filter(f graph.Filter, src image.Image, dst graph.Image, b image.Rectangle) error {
return f.Do(src, dst, b)
}
// FilterNew applies a graph.Filter on a source image,
// returning a new mutable image with the new content.
func (_ Filter) FilterNew(f graph.Filter, src image.Image) (graph.Image, error) {
return f.DoNew(src)
}
// FilterOver applies the filter over the supplied mutable image,
// overwriting its previous state.
func (_ Filter) FilterOver(f graph.Filter, src graph.Image) error {
return f.DoOver(src)
}
func (_ Filter) Equalize(h *color.Histogram, b image.Rectangle) graph.Filter {
return filter.EqualizeFilter(h, b)
}