Mercurial > projects > doodle
diff tk/geometry.d @ 17:c643c04e3f5e
Checkpoint
author | David Bryant <daveb@acres.com.au> |
---|---|
date | Mon, 13 Jul 2009 16:46:21 +0930 |
parents | 9e63308b749c |
children | 22abbf4cde96 |
line wrap: on
line diff
--- a/tk/geometry.d Mon Jul 13 16:16:17 2009 +0930 +++ b/tk/geometry.d Mon Jul 13 16:46:21 2009 +0930 @@ -198,6 +198,15 @@ return Rectangle(new_position, _size); } + void get_quantised(out int x, out int y, out int w, out int h) const { + x = cast(int)floor(_position.x); + y = cast(int)floor(_position.y); + w = cast(int)ceil(_position.x + _size.x) - x; + h = cast(int)ceil(_position.y + _size.y) - y; + } + + // + Point centre() const { return _position + _size / 2.0; }