func (a XY) Times(s int16) XY {
	return XY{a.X * s, a.Y * s}
}
Times returns the product with a scalar.
package pixel
import (
	"math"
	"github.com/cozely/cozely/coord"
	"github.com/cozely/cozely/window"
)
type XY struct {
	X, Y int16
}
func XYof(v coord.Coordinates) XY {
	switch v := v.(type) {
	case window.XY:
		v = v.Minus(screen.border).Slash(screen.zoom)
		if !screen.resolution.Null() {
			return XY(v).Minus(screen.margin)
		}
		return XY(v)
	default:
		x, y, _ := v.Cartesian()
		return XY{int16(x), int16(y)}
	}
}
func (a XY) WindowXY() window.XY {
	if !screen.resolution.Null() {
		a = a.Times(screen.zoom)
		return window.XY(a).Plus(screen.border)
	}
	a = a.Plus(screen.margin).Times(screen.zoom)
	return window.XY(a).Plus(screen.border)
}
func RoundXYof(v coord.Coordinates) XY {
	x, y, _ := v.Cartesian()
	return XY{
		int16(math.Round(float64(x))),
		int16(math.Round(float64(y))),
	}
}
func (a XY) Cartesian() (x, y, z float32) {
	return float32(a.X), float32(a.Y), 0
}
func (a XY) Coord() coord.XY {
	return coord.XY{float32(a.X), float32(a.Y)}
}
func (a XY) Plus(b XY) XY {
	return XY{a.X + b.X, a.Y + b.Y}
}
func (a XY) PlusS(s int16) XY {
	return XY{a.X + s, a.Y + s}
}
func (a XY) Minus(b XY) XY {
	return XY{a.X - b.X, a.Y - b.Y}
}
func (a XY) MinusS(s int16) XY {
	return XY{a.X - s, a.Y - s}
}
func (a XY) Opposite() XY {
	return XY{-a.X, -a.Y}
}