blob: fd15b6427cef2038b5585c1d564f5514211a8796 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package ui
import (
"image"
)
func centerTextXOffset(b image.Rectangle) int {
return (b.Dx() / 2) - b.Min.X
}
func centerTextYOffset(b image.Rectangle) int {
return (b.Dy() / 2) + b.Min.Y
}
func centerText(b image.Rectangle) (x int, y int) {
x = centerTextXOffset(b)
y = centerTextYOffset(b)
return
}
|