From 76f90b98a512efe4655868772c98edf82641fba5 Mon Sep 17 00:00:00 2001 From: FaithBeam <32502411+FaithBeam@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:41:36 -0400 Subject: [PATCH] Add compose_images_gravity --- src/wand/magick.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/wand/magick.rs b/src/wand/magick.rs index c217865..cdd5b3a 100644 --- a/src/wand/magick.rs +++ b/src/wand/magick.rs @@ -262,6 +262,27 @@ impl MagickWand { } } + /// Compose another image onto self with gravity using composition_operator + pub fn compose_images_gravity( + &self, + reference: &MagickWand, + composition_operator: bindings::CompositeOperator, + gravity_type: bindings::GravityType, + ) -> Result<()> { + let result = unsafe { + bindings::MagickCompositeImageGravity( + self.wand, + reference.wand, + composition_operator, + gravity_type, + ) + }; + match result { + bindings::MagickBooleanType_MagickTrue => Ok(()), + _ => Err(MagickError("failed to compose images")), + } + } + /// Rebuilds image sequence with each frame size the same as first frame, and composites each frame atop of previous. /// Only affects GIF, and other formats with multiple pages/layers. pub fn coalesce(&mut self) -> Result<()> {