From 3ea114fc80284ae3d32764765a96f34d6910d397 Mon Sep 17 00:00:00 2001 From: Mike Wey Date: Sun, 17 Jul 2011 20:22:10 +0200 Subject: Add Geometry.toAbsolute, resample, resize, roll, rotate, sample, scale, segment, selectiveBlur and sepiatone. --- dmagick/Geometry.d | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'dmagick/Geometry.d') diff --git a/dmagick/Geometry.d b/dmagick/Geometry.d index 2ccab99..261c691 100644 --- a/dmagick/Geometry.d +++ b/dmagick/Geometry.d @@ -120,6 +120,28 @@ struct Geometry assert( geo.toString == "200x150!-50+25"); } + /** + * Calculate the absolute width and height based on the flags, + * and the profided width and height. + */ + Geometry toAbsolute(size_t width, size_t height) + { + ssize_t x, y; + + ParseMetaGeometry(toStringz(toString()), &x, &y, &width, &height); + + return Geometry(width, height, x, y); + } + + unittest + { + Geometry percentage = Geometry("50%"); + Geometry absolute = percentage.toAbsolute(100, 100); + + assert(absolute.width == 50); + assert(absolute.height == 50); + } + RectangleInfo rectangleInfo() { RectangleInfo info; -- cgit v1.2.3