Last update Sun May 11 01:02:35 2014

dmagick.Geometry

License:
zlib (See accompanying LICENSE file)

Authors:
Mike Wey

struct Geometry;

Geometry provides a convenient means to specify a geometry argument.

size_t width;


size_t height;


ssize_t xOffset;


ssize_t yOffset;


bool percent;

The width and/or height are percentages of the original.

bool minimum;

The specified width and/or height is the minimum value.

bool keepAspect;

Retain the aspect ratio.

bool greater;

Resize only if the image is greater than the width and/or height.

bool less;

Resize only if the image is smaller than the width and/or height.

this(string geometry);

Create a Geometry form a Imagemagick / X11 geometry string.

The string constist of a size and a optional offset, the size can be a width, a height (prefixed with an x), or both ( widthxheight ).

When a offset is needed ammend the size with an x an y offset ( signs are required ) like this: {size}+x+Y.

The way the size is interpreted can be determined by the following flags:

Flag Explanation
%Normally the attributes are treated as pixels. Use this flag when the width and height attributes represent percentages.
!Use this flag when you want to force the new image to have exactly the size specified by the the width and height attributes.
<Use this flag when you want to change the size of the image only if both its width and height are smaller the values specified by those attributes. The image size is changed proportionally.
>Use this flag when you want to change the size of the image if either its width and height exceed the values specified by those attributes. The image size is changed proportionally.
^Use ^ to set a minimum image size limit. The geometry 640x480^ means the image width will not be less than 640 and the image height will not be less than 480 pixels after the resize. One of those dimensions will match the requested size. But the image will likely overflow the space requested to preserve its aspect ratio.

this(size_t width, size_t height, ssize_t xOffset = 0, ssize_t yOffset = 0);

Initialize with width heigt and offsets.

package this(RectangleInfo rectangle);


string toString();

Convert Geometry into a Imagemagick geometry string.

Geometry toAbsolute(size_t width, size_t height);

Calculate the absolute width and height based on the flags, and the profided width and height.

package RectangleInfo rectangleInfo();


size_t opCmp(ref const Geometry geometry);