add drawing and pixel wands; add some methods to MagickWand

This commit is contained in:
Mattis Marjak
2016-05-11 22:12:42 +03:00
parent 4c7cebe628
commit 9e2285a4aa
7 changed files with 545 additions and 18 deletions

27
src/conversions.rs Normal file
View File

@ -0,0 +1,27 @@
use super::bindings;
pub trait FromRust<T> {
fn from_rust(t: T) -> Self;
}
impl FromRust<bool> for bindings::MagickBooleanType {
fn from_rust(b: bool) -> Self {
if b {
bindings::MagickTrue
} else {
bindings::MagickFalse
}
}
}
pub trait ToMagick<T> {
fn to_magick(self) -> T;
}
impl<T, E> ToMagick<T> for E
where T: FromRust<E>
{
fn to_magick(self) -> T {
<T as FromRust<E>>::from_rust(self)
}
}