Binding for MagickSetSize

This commit is contained in:
Daniel Rönnkvist
2020-03-25 14:26:41 +01:00
parent 6efd70c41a
commit 7d805d9a83
2 changed files with 14 additions and 0 deletions

View File

@ -230,6 +230,14 @@ impl MagickWand {
} }
} }
pub fn set_size(&self, columns: size_t, rows: size_t) -> Result<(), &'static str> {
let result = unsafe { bindings::MagickSetSize(self.wand, columns, rows) };
match result {
bindings::MagickBooleanType_MagickTrue => Ok(()),
_ => Err("failed to set size of wand"),
}
}
/// Extend the image as defined by the geometry, gravity, and wand background color. Set the /// Extend the image as defined by the geometry, gravity, and wand background color. Set the
/// (x,y) offset of the geometry to move the original wand relative to the extended wand. /// (x,y) offset of the geometry to move the original wand relative to the extended wand.
pub fn extend_image( pub fn extend_image(

View File

@ -319,3 +319,9 @@ fn test_set_background_color() {
assert_eq!(0u8, blob[2]); assert_eq!(0u8, blob[2]);
assert_eq!(0u8, blob[3]); assert_eq!(0u8, blob[3]);
} }
#[test]
fn test_set_size() {
let wand = MagickWand::new();
assert!(wand.set_size(100, 100).is_ok());
}