diff options
| author | Mike Wey | 2011-07-30 18:03:13 +0200 |
|---|---|---|
| committer | Mike Wey | 2011-07-30 18:03:13 +0200 |
| commit | 2791966faa34399c3802a21141ed2c17643306e4 (patch) | |
| tree | 04b2d7398435807e07da1c503a25d24deaf5efdb | |
| parent | 5bc3f21c79901de94c8e9e6d216f8bdbab84b791 (diff) | |
Add vignette, wave and whiteThreshold.
| -rw-r--r-- | dmagick/Image.d | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/dmagick/Image.d b/dmagick/Image.d index 7ccffb8..2a987f4 100644 --- a/dmagick/Image.d +++ b/dmagick/Image.d @@ -2897,6 +2897,77 @@ class Image imageRef = ImageRef(image); } + //TODO: view. + + /** + * Gradually shades the edges of the image by transforming the pixels + * into the background color. + * + * Larger values of sigma increase the blurring at the expense of + * increased execution time. In general, radius should be larger than + * sigma, although if radius is 0 then ImageMagick will choose a suitable + * value. Sigma must be non-zero. Choose a very small value for sigma to + * produce a "hard" edge. + * + * Params: + * xOffset = Influences the amount of background color in the + * horizontal dimension. + * yOffset = Influences the amount of background color in the + * vertical dimension. + * radius = The radius of the pixel neighborhood. + * sigma = The standard deviation of the Gaussian, in pixels. + */ + void vignette(ssize_t xOffset, ssize_t yOffset, double radius = 0, double sigma = 10) + { + MagickCoreImage* image = + VignetteImage(imageRef, radius, sigma, xOffset, yOffset, DMagickExceptionInfo()); + + imageRef = ImageRef(image); + } + + /** + * Creates a "ripple" effect in the image by shifting the pixels + * vertically along a sine wave whose amplitude and wavelength is + * specified by the given parameters.Creates a "ripple" effect in the + * image by shifting the pixels vertically along a sine wave whose + * amplitude and wavelength is specified by the given parameters. + */ + void wave(double amplitude = 25, double wavelength = 150) + { + MagickCoreImage* image = + WaveImage(imageRef, amplitude, wavelength, DMagickExceptionInfo()); + + imageRef = ImageRef(image); + } + + /** + * Forces all pixels above the threshold into white while leaving + * all pixels below the threshold unchanged. + * + * Params: + * threshold = The threshold value for red green and blue. + * channel = One or more channels to adjust. + */ + void whiteThreshold(Quantum threshold, ChannelType channel = ChannelType.DefaultChannels) + { + whiteThreshold(threshold, threshold, threshold, 0, channel); + } + + ///ditto + void whiteThreshold( + Quantum red, + Quantum green, + Quantum blue, + Quantum opacity = 0, + ChannelType channel = ChannelType.DefaultChannels) + { + string thresholds = std.string.format("%s,%s,%s,%s", red, green, blue, opacity); + + WhiteThresholdImageChannel( + imageRef, channel, toStringz(thresholds), DMagickExceptionInfo() + ); + } + /** * Writes the image to the specified file. ImageMagick * determines image format from the prefix or extension. |
