-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstyle.go
57 lines (45 loc) · 1.43 KB
/
style.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
57
package main
import (
"image/color"
"deedles.dev/ximage/geom"
)
const (
MinWidth = 128
MinHeight = 24
WindowBorder = 5
StatusBarHeight = 5 * WindowBorder
)
var (
ColorBackground = color.NRGBA{0x77, 0x77, 0x77, 0xFF}
ColorSelectionBox = color.NRGBA{0xFF, 0x0, 0x0, 0xFF}
ColorSelectionBackground = color.NRGBA{0xFF, 0xFF, 0xFF, 0xFF / 100}
ColorActiveBorder = color.NRGBA{0x50, 0xA1, 0xAD, 0xFF}
ColorInactiveBorder = color.NRGBA{0x9C, 0xE9, 0xE9, 0xFF}
ColorMenuSelected = color.NRGBA{0x3D, 0x7D, 0x42, 0xFF}
ColorMenuUnselected = color.NRGBA{0xEB, 0xFF, 0xEC, 0xFF}
ColorMenuBorder = color.NRGBA{0x78, 0xAD, 0x84, 0xFF}
ColorSurface = color.NRGBA{0xEE, 0xEE, 0xEE, 0xFF}
)
var (
DefaultRestore = geom.Rt[float64](0, 0, 640, 480).Add(geom.Pt[float64](10, 10))
)
type scaleFunc func(out, r geom.Rect[float64]) geom.Rect[float64]
func scaleStretch(out, r geom.Rect[float64]) geom.Rect[float64] {
return out
}
func scaleCenter(out, r geom.Rect[float64]) geom.Rect[float64] {
return r.CenterAt(out.Center())
}
func scaleFit(out, r geom.Rect[float64]) geom.Rect[float64] {
if (r.Dx() < out.Dx()) && (r.Dy() < out.Dy()) {
return r
}
return scaleFill(out, r)
}
func scaleFill(out, r geom.Rect[float64]) geom.Rect[float64] {
return scaleCenter(out, r.FitTo(out.Size()))
}
func scaleTile(out, r geom.Rect[float64]) geom.Rect[float64] {
// TODO
return scaleCenter(out, r)
}