feat: MagickFxImage bindning

New macro to create a new wand from another wand.
This commit is contained in:
Daniel Rönnkvist
2020-04-20 08:45:52 +02:00
parent 2c95cd7173
commit a277b7cfe7
2 changed files with 10 additions and 0 deletions

View File

@ -29,6 +29,10 @@ macro_rules! wand_common {
} }
} }
pub fn new_from_wand(wand: *mut ::bindings::$wand) -> Self {
$wand { wand }
}
fn clear(&mut self) { fn clear(&mut self) {
unsafe { ::bindings::$clear_wand(self.wand) } unsafe { ::bindings::$clear_wand(self.wand) }
} }

View File

@ -243,6 +243,12 @@ impl MagickWand {
} }
} }
pub fn fx(&mut self, expression: &str) -> MagickWand {
let c_expression = CString::new(expression).unwrap();
let wand = unsafe { bindings::MagickFxImage(self.wand, c_expression.as_ptr()) };
MagickWand::new_from_wand(wand)
}
pub fn set_size(&self, columns: size_t, rows: size_t) -> Result<(), &'static str> { pub fn set_size(&self, columns: size_t, rows: size_t) -> Result<(), &'static str> {
let result = unsafe { bindings::MagickSetSize(self.wand, columns, rows) }; let result = unsafe { bindings::MagickSetSize(self.wand, columns, rows) };
match result { match result {