-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoptions.go
45 lines (39 loc) · 912 Bytes
/
options.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
38
39
40
41
42
43
44
45
package resigif
// Option is option for GIF resizing1
type Option func(*processor)
type aspectRatioOption int
const (
// Ignore ignores aspect ratio
Ignore aspectRatioOption = iota
// Maintain maintains aspect ratio
Maintain
)
// WithAspectRatio sets aspect ratio option
//
// default: Maintain
func WithAspectRatio(aspectRatio aspectRatioOption) Option {
return func(o *processor) {
o.aspectRatio = aspectRatio
}
}
// WithImageResizeFunc sets image resize function
//
// default: using draw.CatmullRom
func WithImageResizeFunc(resizeFunc ImageResizeFunc) Option {
return func(o *processor) {
if resizeFunc != nil {
o.resizeFunc = resizeFunc
}
}
}
// WithParallel sets limit of parallel processing threads
//
// ignores limit if limit <= 0
// default: runtime.NumCPU()
func WithParallel(limit int) Option {
return func(o *processor) {
if limit > 0 {
o.parallelLimit = limit
}
}
}