comparison tk/geometry.d @ 15:2f79aab4d385

Checkpoint
author "David Bryant <bagnose@gmail.com>"
date Sun, 12 Jul 2009 13:23:06 +0930
parents f0ade1b49fe7
children 9e63308b749c
comparison
equal deleted inserted replaced
14:0b7e7d43a79d 15:2f79aab4d385
172 return Rectangle(min_extents(min_corner(), r.min_corner()), 172 return Rectangle(min_extents(min_corner(), r.min_corner()),
173 max_extents(max_corner(), r.max_corner())); 173 max_extents(max_corner(), r.max_corner()));
174 } 174 }
175 } 175 }
176 176
177 /* 177 // TODO make these free functions
178 Rectangle moved(in Vector displacement) { 178
179 return Rectangle( 179 Rectangle moved(in Vector displacement) const {
180 } 180 return Rectangle(_position + displacement, _size);
181 Rectangle resized(in Vector new_size) { 181 }
182 } 182
183 Rectangle repositioned(in Point new_position) { 183 Rectangle expanded(in Vector expand_amount) const {
184 } 184 return Rectangle(_position, _size + expand_amount);
185 */ 185 }
186
187 Rectangle shrunk(in Vector shrink_amount) const {
188 return Rectangle(_position, _size - shrink_amount);
189 }
190
191 Rectangle resized(in Vector new_size) const {
192 return Rectangle(_position, new_size);
193 }
194
195 Rectangle repositioned(in Point new_position) const {
196 return Rectangle(new_position, _size);
197 }
198
199 Point centre() const {
200 return _position + _size / 2.0;
201 }
186 202
187 string toString() const { 203 string toString() const {
188 return std.string.format("{%s, %s}", _position, _size); 204 return std.string.format("{%s, %s}", _position, _size);
189 } 205 }
190 206