Merge pull request #42 from NQNStudios/new-bindings
Adding binding for MagickAddImage and MagicRotateImage
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
*.swp
|
||||||
*.pyc
|
*.pyc
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
rust-bindgen
|
rust-bindgen
|
||||||
|
|||||||
@ -66,6 +66,14 @@ impl MagickWand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add all images from another wand to this wand at the current index.
|
||||||
|
pub fn add_image(&mut self, other_wand: &MagickWand) -> Result<(), &'static str> {
|
||||||
|
match unsafe { bindings::MagickAddImage(self.wand, other_wand.wand) } {
|
||||||
|
bindings::MagickBooleanType::MagickTrue => Ok(()),
|
||||||
|
_ => Err("unable to add images from another wand")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn append_all(&mut self, stack: bool) -> MagickWand {
|
pub fn append_all(&mut self, stack: bool) -> MagickWand {
|
||||||
unsafe { bindings::MagickResetIterator(self.wand) };
|
unsafe { bindings::MagickResetIterator(self.wand) };
|
||||||
MagickWand {
|
MagickWand {
|
||||||
@ -231,6 +239,15 @@ impl MagickWand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Rotate the currently selected image by the given number of degrees,
|
||||||
|
/// filling any empty space with the background color of a given PixelWand
|
||||||
|
pub fn rotate_image(&self, background: &PixelWand, degrees: f64) -> Result<(), &'static str> {
|
||||||
|
match unsafe { bindings::MagickRotateImage(self.wand, background.wand, degrees) } {
|
||||||
|
bindings::MagickBooleanType::MagickTrue => Ok(()),
|
||||||
|
_ => Err("failed to rotate image")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Trim the image removing the backround color from the edges.
|
/// Trim the image removing the backround color from the edges.
|
||||||
pub fn trim_image(&self, fuzz: f64) -> Result<(), &'static str> {
|
pub fn trim_image(&self, fuzz: f64) -> Result<(), &'static str> {
|
||||||
let result = unsafe {
|
let result = unsafe {
|
||||||
|
|||||||
Reference in New Issue
Block a user