aboutsummaryrefslogtreecommitdiffstats
path: root/style/fixed.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-03-03 14:22:43 -0500
committerSam Anthony <sam@samanthony.xyz>2026-03-03 14:22:43 -0500
commit0a0b9b8cc9cdc0ffe1819de0266dd1e3c3eb564f (patch)
treeead2723b26a2dcb1d1db80efc01390579056d4fc /style/fixed.go
parent8858a54b5ddb3a2d8a42ecb1a837c02800bc934f (diff)
downloadgui-0a0b9b8cc9cdc0ffe1819de0266dd1e3c3eb564f.zip
style: unit conversion
Implemented the golang.org/x/exp/shiny/unit.Converter interface on style.Style.
Diffstat (limited to 'style/fixed.go')
-rw-r--r--style/fixed.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/style/fixed.go b/style/fixed.go
new file mode 100644
index 0000000..fe3f91e
--- /dev/null
+++ b/style/fixed.go
@@ -0,0 +1,11 @@
+package style
+
+import "golang.org/x/image/math/fixed"
+
+func fixed26ToFloat(n fixed.Int26_6) float64 {
+ return float64(n) / (1 << 6)
+}
+
+func floatToFixed26(f float64) fixed.Int26_6 {
+ return fixed.Int26_6(f * (1 << 6))
+}