-
Notifications
You must be signed in to change notification settings - Fork 36
/
helper.go
56 lines (46 loc) · 797 Bytes
/
helper.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
46
47
48
49
50
51
52
53
54
55
56
package duit
import "image"
func pt(v int) image.Point {
return image.Point{v, v}
}
func rect(p image.Point) image.Rectangle {
return image.Rectangle{image.ZP, p}
}
func extendY(r image.Rectangle, dy int) image.Rectangle {
r.Max.Y += dy
return r
}
func insetPt(r image.Rectangle, pad image.Point) image.Rectangle {
r.Min = r.Min.Add(pad)
r.Max = r.Max.Sub(pad)
return r
}
func outsetPt(r image.Rectangle, pad image.Point) image.Rectangle {
r.Min = r.Min.Sub(pad)
r.Max = r.Max.Add(pad)
return r
}
func minimum64(a, b int64) int64 {
if a < b {
return a
}
return b
}
func maximum64(a, b int64) int64 {
if a > b {
return a
}
return b
}
func minimum(a, b int) int {
if a < b {
return a
}
return b
}
func maximum(a, b int) int {
if a > b {
return a
}
return b
}