diff options
| author | Mike Wey | 2011-09-27 22:52:34 +0200 |
|---|---|---|
| committer | Mike Wey | 2011-09-27 22:52:34 +0200 |
| commit | 87157b5c821e05da274abefc48953492140479f8 (patch) | |
| tree | fe452299332efbad2d20971223f2b4b3ed5dc797 /dmagick/Image.d | |
| parent | 0927a16764b5ccd2ea7275bb26da8c097ce40929 (diff) | |
Add Image.separate
Diffstat (limited to 'dmagick/Image.d')
| -rw-r--r-- | dmagick/Image.d | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/dmagick/Image.d b/dmagick/Image.d index 9b565ce..f2012f3 100644 --- a/dmagick/Image.d +++ b/dmagick/Image.d @@ -2455,7 +2455,30 @@ class Image imageRef = ImageRef(image); } - //TODO: implement separate, returns a range of images. + /** + * Constructs a grayscale image for each channel specified. + */ + Image[] separate(ChannelType channel = ChannelType.DefaultChannels) + { + Image[] images; + + if ( channel & ChannelType.RedChannel != 0 ) + images ~= new Image( SeparateImageChannel(imageRef, ChannelType.RedChannel) ); + else if ( channel & ChannelType.GreenChannel != 0 ) + images ~= new Image( SeparateImageChannel(imageRef, ChannelType.GreenChannel) ); + else if ( channel & ChannelType.BlueChannel != 0 ) + images ~= new Image( SeparateImageChannel(imageRef, ChannelType.BlueChannel) ); + else if ( channel & ChannelType.OpacityChannel != 0 ) + images ~= new Image( SeparateImageChannel(imageRef, ChannelType.OpacityChannel) ); + else if ( channel & ChannelType.TrueAlphaChannel != 0 ) + images ~= new Image( SeparateImageChannel(imageRef, ChannelType.TrueAlphaChannel) ); + else if ( channel & ChannelType.GrayChannels != 0 ) + images ~= new Image( SeparateImageChannel(imageRef, ChannelType.GrayChannels) ); + + DMagickException.throwException(&(imageRef.exception)); + + return images; + } /** * applies a special effect to the image, similar to the effect achieved |
