Add pixel-snapping method to Au.

This commit is contained in:
Brian J. Burg 2012-11-20 17:08:17 -08:00
parent e1d4045399
commit a9fdbf0c66

View file

@ -52,6 +52,12 @@ impl Au {
(**self / 60) as int
}
pub pure fn to_snapped(&const self) -> Au {
let res = **self % 60i32;
return if res >= 30i32 { return Au(**self - res + 60i32) }
else { return Au(**self - res) };
}
static pub pure fn zero_point() -> Point2D<Au> {
Point2D(Au(0), Au(0))
}