add negate_image() operation
Signed-off-by: Nikola Pajkovsky <nikola.pajkovsky@livesporttv.cz>
This commit is contained in:
@ -335,6 +335,16 @@ impl MagickWand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn negate_image(&self) -> Result<(), &'static str> {
|
||||||
|
let result = unsafe {
|
||||||
|
bindings::MagickNegateImage(self.wand, bindings::MagickBooleanType_MagickTrue)
|
||||||
|
};
|
||||||
|
match result {
|
||||||
|
bindings::MagickBooleanType_MagickTrue => Ok(()),
|
||||||
|
_ => Err("failed to flip image"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn flop_image(&self) -> Result<(), &'static str> {
|
pub fn flop_image(&self) -> Result<(), &'static str> {
|
||||||
let result = unsafe { bindings::MagickFlopImage(self.wand) };
|
let result = unsafe { bindings::MagickFlopImage(self.wand) };
|
||||||
match result {
|
match result {
|
||||||
|
|||||||
15
tests/lib.rs
15
tests/lib.rs
@ -346,3 +346,18 @@ fn test_clut_image() {
|
|||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_negate_image() {
|
||||||
|
START.call_once(|| {
|
||||||
|
magick_wand_genesis();
|
||||||
|
});
|
||||||
|
let wand = MagickWand::new();
|
||||||
|
assert!(wand.read_image("tests/data/rust.png").is_ok());
|
||||||
|
wand.negate_image().unwrap();
|
||||||
|
let pixel_color = wand.get_image_pixel_color(0, 0).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
"srgb(255,255,255)",
|
||||||
|
pixel_color.get_color_as_string().unwrap()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user