-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheffects.go
More file actions
48 lines (41 loc) · 990 Bytes
/
effects.go
File metadata and controls
48 lines (41 loc) · 990 Bytes
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
46
47
48
package gg
import (
"image"
"math"
"github.com/disintegration/imaging"
)
// AdjustBrightness 调整亮度 范围:±100%
func (dc *Context) AdjustBrightness(s float64) {
if math.Abs(s) < 0.001 {
return
}
dc.im = (*image.RGBA)(imaging.AdjustBrightness(dc.im, s))
}
// AdjustContrast 调整对比度 范围:±100%
func (dc *Context) AdjustContrast(s float64) {
if math.Abs(s) < 0.001 {
return
}
dc.im = (*image.RGBA)(imaging.AdjustContrast(dc.im, s))
}
// AdjustSaturation 调整饱和度 范围:±100%
func (dc *Context) AdjustSaturation(s float64) {
if math.Abs(s) < 0.001 {
return
}
dc.im = (*image.RGBA)(imaging.AdjustSaturation(dc.im, s))
}
// Sharpen 锐化 范围:±100%
func (dc *Context) Sharpen(s float64) {
if math.Abs(s) < 0.001 {
return
}
dc.im = (*image.RGBA)(imaging.Sharpen(dc.im, s))
}
// Blur 模糊图像 正数
func (dc *Context) Blur(s float64) {
if math.Abs(s) < 0.001 {
return
}
dc.im = (*image.RGBA)(imaging.Blur(dc.im, s))
}