zntg/ui/drawoptions.go

21 lines
364 B
Go

package ui
import (
"image/color"
"opslag.de/schobers/geom"
)
type DrawOptions struct {
Source *geom.RectangleF32
Tint color.Color
}
func ScaleToHeight(size geom.PointF32, height float32) (*geom.PointF32, float32) {
if size.Y == height {
return nil, size.X
}
factor := height / size.Y
return &geom.PointF32{X: factor, Y: factor}, factor * size.X
}