github.com/cybriq/giocore@v0.0.7-0.20210703034601-cfb9cb5f3900/utils/utils.go (about)

     1  package utils
     2  
     3  import (
     4  	"github.com/cybriq/giocore/f32"
     5  	"image"
     6  )
     7  
     8  // FPt converts an point to a f32.Point.
     9  func FPt(p image.Point) f32.Point {
    10  	return f32.Point{
    11  		X: float32(p.X), Y: float32(p.Y),
    12  	}
    13  }
    14  
    15  // FRect converts a rectangle to a f32.Rectangle.
    16  func FRect(r image.Rectangle) f32.Rectangle {
    17  	return f32.Rectangle{
    18  		Min: FPt(r.Min), Max: FPt(r.Max),
    19  	}
    20  }