diff --git a/imagick/magick_wand_image.go b/imagick/magick_wand_image.go index d857443..206b25b 100644 --- a/imagick/magick_wand_image.go +++ b/imagick/magick_wand_image.go @@ -8,6 +8,11 @@ package imagick #include #include #include + +// declare symbols only defined in C source and not in header +WandExport MagickBooleanType MagickSetImageMask( + MagickWand *wand, const PixelMask type, const MagickWand *clip_mask +); */ import "C" @@ -2357,6 +2362,13 @@ func (mw *MagickWand) SetImageMatte(matte bool) error { return mw.getLastErrorIfFailed(ok) } +// Sets image clip mask. +// PixelMaskType can be one of: PIXEL_MASK_READ, PIXEL_MASK_WRITE +func (mw *MagickWand) SetImageMask(typ PixelMaskType, clipMask *MagickWand) error { + ok := C.MagickSetImageMask(mw.mw, C.PixelMask(typ), clipMask.mw) + return mw.getLastErrorIfFailed(ok) +} + // Sets the image orientation. func (mw *MagickWand) SetImageOrientation(orientation OrientationType) error { ok := C.MagickSetImageOrientation(mw.mw, C.OrientationType(orientation)) diff --git a/imagick/pixel_mask_type.go b/imagick/pixel_mask_type.go new file mode 100644 index 0000000..1f09e51 --- /dev/null +++ b/imagick/pixel_mask_type.go @@ -0,0 +1,19 @@ +// Copyright 2013 Herbert G. Fischer. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package imagick + +/* +#include +*/ +import "C" + +type PixelMaskType int + +const ( + PIXEL_MASK_UNDEFINED PixelMaskType = C.UndefinedPixelMask + PIXEL_MASK_READ PixelMaskType = C.ReadPixelMask + PIXEL_MASK_WRITE PixelMaskType = C.WritePixelMask + PIXEL_MASK_COMPOSITE PixelMaskType = C.CompositePixelMask +)