add color-related getters and mutations
This commit is contained in:
@ -83,6 +83,16 @@ macro_rules! wand_common {
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! get {
|
||||
($($get:ident, $c_get:ident, $typ:ty )*) => {
|
||||
$(
|
||||
pub fn $get(&self) -> $typ {
|
||||
unsafe { ::bindings::$c_get(self.wand) }
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! set_get {
|
||||
($($get:ident, $set:ident, $c_get:ident, $c_set:ident, $typ:ty )*) => {
|
||||
$(
|
||||
@ -227,3 +237,17 @@ macro_rules! color_set_get {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! mutations {
|
||||
($($(#[$attr:meta])* $c_fun:ident => $fun:ident($($arg:ident: $ty:ty),*))*) => {
|
||||
$(
|
||||
$(#[$attr])*
|
||||
pub fn $fun(&self $(, $arg: $ty)*) -> Result<(), &'static str> {
|
||||
match unsafe { bindings::$c_fun(self.wand $(, $arg)*) } {
|
||||
bindings::MagickBooleanType::MagickTrue => Ok(()),
|
||||
_ => Err(concat!(stringify!($c_fun), " invocation failed"))
|
||||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user