chore: run cargo fmt on everything
This commit is contained in:
@ -37,13 +37,13 @@ use libc::size_t;
|
||||
pub use conversions::ToMagick;
|
||||
pub use result::MagickError;
|
||||
use result::Result;
|
||||
pub use wand::*;
|
||||
pub use types::*;
|
||||
pub use wand::*;
|
||||
|
||||
mod conversions;
|
||||
mod result;
|
||||
mod wand;
|
||||
mod types;
|
||||
mod wand;
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
/// This function must be called before any other ImageMagick operations
|
||||
@ -73,7 +73,9 @@ pub fn magick_query_fonts(pattern: &str) -> Result<Vec<String>> {
|
||||
let ptr =
|
||||
unsafe { bindings::MagickQueryFonts(c_string.as_ptr(), &mut number_fonts as *mut size_t) };
|
||||
if ptr.is_null() {
|
||||
Err(MagickError("null ptr returned by magick_query_fonts".to_string()))
|
||||
Err(MagickError(
|
||||
"null ptr returned by magick_query_fonts".to_string(),
|
||||
))
|
||||
} else {
|
||||
let mut v = Vec::new();
|
||||
let c_str_ptr_slice = unsafe { ::std::slice::from_raw_parts(ptr, number_fonts as usize) };
|
||||
|
||||
@ -4,9 +4,9 @@ use crate::bindings;
|
||||
#[repr(u32)]
|
||||
pub enum AlignType {
|
||||
Undefined = bindings::AlignType_UndefinedAlign,
|
||||
Left = bindings::AlignType_LeftAlign,
|
||||
Center = bindings::AlignType_CenterAlign,
|
||||
Right = bindings::AlignType_RightAlign,
|
||||
Left = bindings::AlignType_LeftAlign,
|
||||
Center = bindings::AlignType_CenterAlign,
|
||||
Right = bindings::AlignType_RightAlign,
|
||||
}
|
||||
|
||||
impl Default for AlignType {
|
||||
|
||||
@ -3,23 +3,23 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum AlphaChannelOption {
|
||||
Undefined = bindings::AlphaChannelOption_UndefinedAlphaChannel,
|
||||
Activate = bindings::AlphaChannelOption_ActivateAlphaChannel,
|
||||
Associate = bindings::AlphaChannelOption_AssociateAlphaChannel,
|
||||
Background = bindings::AlphaChannelOption_BackgroundAlphaChannel,
|
||||
Copy = bindings::AlphaChannelOption_CopyAlphaChannel,
|
||||
Deactivate = bindings::AlphaChannelOption_DeactivateAlphaChannel,
|
||||
Discrete = bindings::AlphaChannelOption_DiscreteAlphaChannel,
|
||||
Undefined = bindings::AlphaChannelOption_UndefinedAlphaChannel,
|
||||
Activate = bindings::AlphaChannelOption_ActivateAlphaChannel,
|
||||
Associate = bindings::AlphaChannelOption_AssociateAlphaChannel,
|
||||
Background = bindings::AlphaChannelOption_BackgroundAlphaChannel,
|
||||
Copy = bindings::AlphaChannelOption_CopyAlphaChannel,
|
||||
Deactivate = bindings::AlphaChannelOption_DeactivateAlphaChannel,
|
||||
Discrete = bindings::AlphaChannelOption_DiscreteAlphaChannel,
|
||||
Disassociate = bindings::AlphaChannelOption_DisassociateAlphaChannel,
|
||||
Extract = bindings::AlphaChannelOption_ExtractAlphaChannel,
|
||||
Off = bindings::AlphaChannelOption_OffAlphaChannel,
|
||||
On = bindings::AlphaChannelOption_OnAlphaChannel,
|
||||
Opaque = bindings::AlphaChannelOption_OpaqueAlphaChannel,
|
||||
Remove = bindings::AlphaChannelOption_RemoveAlphaChannel,
|
||||
Set = bindings::AlphaChannelOption_SetAlphaChannel,
|
||||
Shape = bindings::AlphaChannelOption_ShapeAlphaChannel,
|
||||
Transparent = bindings::AlphaChannelOption_TransparentAlphaChannel,
|
||||
OffIfOpaque = bindings::AlphaChannelOption_OffIfOpaqueAlphaChannel,
|
||||
Extract = bindings::AlphaChannelOption_ExtractAlphaChannel,
|
||||
Off = bindings::AlphaChannelOption_OffAlphaChannel,
|
||||
On = bindings::AlphaChannelOption_OnAlphaChannel,
|
||||
Opaque = bindings::AlphaChannelOption_OpaqueAlphaChannel,
|
||||
Remove = bindings::AlphaChannelOption_RemoveAlphaChannel,
|
||||
Set = bindings::AlphaChannelOption_SetAlphaChannel,
|
||||
Shape = bindings::AlphaChannelOption_ShapeAlphaChannel,
|
||||
Transparent = bindings::AlphaChannelOption_TransparentAlphaChannel,
|
||||
OffIfOpaque = bindings::AlphaChannelOption_OffIfOpaqueAlphaChannel,
|
||||
}
|
||||
|
||||
impl Default for AlphaChannelOption {
|
||||
|
||||
@ -4,9 +4,9 @@ use crate::bindings;
|
||||
#[repr(u32)]
|
||||
pub enum AutoThresholdMethod {
|
||||
Undefined = bindings::AutoThresholdMethod_UndefinedThresholdMethod,
|
||||
Kapur = bindings::AutoThresholdMethod_KapurThresholdMethod,
|
||||
OTSU = bindings::AutoThresholdMethod_OTSUThresholdMethod,
|
||||
Triangle = bindings::AutoThresholdMethod_TriangleThresholdMethod,
|
||||
Kapur = bindings::AutoThresholdMethod_KapurThresholdMethod,
|
||||
OTSU = bindings::AutoThresholdMethod_OTSUThresholdMethod,
|
||||
Triangle = bindings::AutoThresholdMethod_TriangleThresholdMethod,
|
||||
}
|
||||
|
||||
impl Default for AutoThresholdMethod {
|
||||
|
||||
@ -39,32 +39,32 @@ impl Default for ChannelType {
|
||||
impl From<ChannelType> for bindings::ChannelType {
|
||||
fn from(value: ChannelType) -> Self {
|
||||
match value {
|
||||
ChannelType::Undefined => { bindings::ChannelType_UndefinedChannel },
|
||||
ChannelType::RedChannel => { bindings::ChannelType_RedChannel },
|
||||
ChannelType::GrayChannel => { bindings::ChannelType_GrayChannel },
|
||||
ChannelType::CyanChannel => { bindings::ChannelType_CyanChannel },
|
||||
ChannelType::LChannel => { bindings::ChannelType_LChannel },
|
||||
ChannelType::GreenChannel => { bindings::ChannelType_GreenChannel },
|
||||
ChannelType::MagentaChannel => { bindings::ChannelType_MagentaChannel },
|
||||
ChannelType::aChannel => { bindings::ChannelType_aChannel },
|
||||
ChannelType::BlueChannel => { bindings::ChannelType_BlueChannel },
|
||||
ChannelType::bChannel => { bindings::ChannelType_bChannel },
|
||||
ChannelType::YellowChannel => { bindings::ChannelType_YellowChannel },
|
||||
ChannelType::BlackChannel => { bindings::ChannelType_BlackChannel },
|
||||
ChannelType::AlphaChannel => { bindings::ChannelType_AlphaChannel },
|
||||
ChannelType::OpacityChannel => { bindings::ChannelType_OpacityChannel },
|
||||
ChannelType::IndexChannel => { bindings::ChannelType_IndexChannel },
|
||||
ChannelType::ReadMaskChannel => { bindings::ChannelType_ReadMaskChannel },
|
||||
ChannelType::WriteMaskChannel => { bindings::ChannelType_WriteMaskChannel },
|
||||
ChannelType::MetaChannel => { bindings::ChannelType_MetaChannel },
|
||||
ChannelType::CompositeMaskChannel => { bindings::ChannelType_CompositeMaskChannel },
|
||||
ChannelType::CompositeChannels => { bindings::ChannelType_CompositeChannels },
|
||||
ChannelType::AllChannels => { bindings::ChannelType_AllChannels },
|
||||
ChannelType::TrueAlphaChannel => { bindings::ChannelType_TrueAlphaChannel },
|
||||
ChannelType::RGBChannels => { bindings::ChannelType_RGBChannels },
|
||||
ChannelType::GrayChannels => { bindings::ChannelType_GrayChannels },
|
||||
ChannelType::SyncChannels => { bindings::ChannelType_SyncChannels },
|
||||
ChannelType::DefaultChannels => { bindings::ChannelType_DefaultChannels },
|
||||
ChannelType::Undefined => bindings::ChannelType_UndefinedChannel,
|
||||
ChannelType::RedChannel => bindings::ChannelType_RedChannel,
|
||||
ChannelType::GrayChannel => bindings::ChannelType_GrayChannel,
|
||||
ChannelType::CyanChannel => bindings::ChannelType_CyanChannel,
|
||||
ChannelType::LChannel => bindings::ChannelType_LChannel,
|
||||
ChannelType::GreenChannel => bindings::ChannelType_GreenChannel,
|
||||
ChannelType::MagentaChannel => bindings::ChannelType_MagentaChannel,
|
||||
ChannelType::aChannel => bindings::ChannelType_aChannel,
|
||||
ChannelType::BlueChannel => bindings::ChannelType_BlueChannel,
|
||||
ChannelType::bChannel => bindings::ChannelType_bChannel,
|
||||
ChannelType::YellowChannel => bindings::ChannelType_YellowChannel,
|
||||
ChannelType::BlackChannel => bindings::ChannelType_BlackChannel,
|
||||
ChannelType::AlphaChannel => bindings::ChannelType_AlphaChannel,
|
||||
ChannelType::OpacityChannel => bindings::ChannelType_OpacityChannel,
|
||||
ChannelType::IndexChannel => bindings::ChannelType_IndexChannel,
|
||||
ChannelType::ReadMaskChannel => bindings::ChannelType_ReadMaskChannel,
|
||||
ChannelType::WriteMaskChannel => bindings::ChannelType_WriteMaskChannel,
|
||||
ChannelType::MetaChannel => bindings::ChannelType_MetaChannel,
|
||||
ChannelType::CompositeMaskChannel => bindings::ChannelType_CompositeMaskChannel,
|
||||
ChannelType::CompositeChannels => bindings::ChannelType_CompositeChannels,
|
||||
ChannelType::AllChannels => bindings::ChannelType_AllChannels,
|
||||
ChannelType::TrueAlphaChannel => bindings::ChannelType_TrueAlphaChannel,
|
||||
ChannelType::RGBChannels => bindings::ChannelType_RGBChannels,
|
||||
ChannelType::GrayChannels => bindings::ChannelType_GrayChannels,
|
||||
ChannelType::SyncChannels => bindings::ChannelType_SyncChannels,
|
||||
ChannelType::DefaultChannels => bindings::ChannelType_DefaultChannels,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,33 +73,33 @@ impl From<bindings::ChannelType> for ChannelType {
|
||||
fn from(value: bindings::ChannelType) -> Self {
|
||||
// Unreachable match arms commented out
|
||||
match value {
|
||||
bindings::ChannelType_UndefinedChannel => { ChannelType::Undefined },
|
||||
bindings::ChannelType_RedChannel => { ChannelType::RedChannel },
|
||||
bindings::ChannelType_UndefinedChannel => ChannelType::Undefined,
|
||||
bindings::ChannelType_RedChannel => ChannelType::RedChannel,
|
||||
// bindings::ChannelType_GrayChannel => { ChannelType::GrayChannel },
|
||||
// bindings::ChannelType_CyanChannel => { ChannelType::CyanChannel },
|
||||
// bindings::ChannelType_LChannel => { ChannelType::LChannel },
|
||||
bindings::ChannelType_GreenChannel => { ChannelType::GreenChannel },
|
||||
bindings::ChannelType_GreenChannel => ChannelType::GreenChannel,
|
||||
// bindings::ChannelType_MagentaChannel => { ChannelType::MagentaChannel },
|
||||
// bindings::ChannelType_aChannel => { ChannelType::aChannel },
|
||||
bindings::ChannelType_BlueChannel => { ChannelType::BlueChannel },
|
||||
bindings::ChannelType_BlueChannel => ChannelType::BlueChannel,
|
||||
// bindings::ChannelType_bChannel => { ChannelType::bChannel },
|
||||
// bindings::ChannelType_YellowChannel => { ChannelType::YellowChannel },
|
||||
bindings::ChannelType_BlackChannel => { ChannelType::BlackChannel },
|
||||
bindings::ChannelType_AlphaChannel => { ChannelType::AlphaChannel },
|
||||
bindings::ChannelType_BlackChannel => ChannelType::BlackChannel,
|
||||
bindings::ChannelType_AlphaChannel => ChannelType::AlphaChannel,
|
||||
// bindings::ChannelType_OpacityChannel => { ChannelType::OpacityChannel },
|
||||
bindings::ChannelType_IndexChannel => { ChannelType::IndexChannel },
|
||||
bindings::ChannelType_ReadMaskChannel => { ChannelType::ReadMaskChannel },
|
||||
bindings::ChannelType_WriteMaskChannel => { ChannelType::WriteMaskChannel },
|
||||
bindings::ChannelType_MetaChannel => { ChannelType::MetaChannel },
|
||||
bindings::ChannelType_CompositeMaskChannel => { ChannelType::CompositeMaskChannel },
|
||||
bindings::ChannelType_CompositeChannels => { ChannelType::CompositeChannels },
|
||||
bindings::ChannelType_AllChannels => { ChannelType::AllChannels },
|
||||
bindings::ChannelType_IndexChannel => ChannelType::IndexChannel,
|
||||
bindings::ChannelType_ReadMaskChannel => ChannelType::ReadMaskChannel,
|
||||
bindings::ChannelType_WriteMaskChannel => ChannelType::WriteMaskChannel,
|
||||
bindings::ChannelType_MetaChannel => ChannelType::MetaChannel,
|
||||
bindings::ChannelType_CompositeMaskChannel => ChannelType::CompositeMaskChannel,
|
||||
bindings::ChannelType_CompositeChannels => ChannelType::CompositeChannels,
|
||||
bindings::ChannelType_AllChannels => ChannelType::AllChannels,
|
||||
// bindings::ChannelType_TrueAlphaChannel => { ChannelType::TrueAlphaChannel },
|
||||
// bindings::ChannelType_RGBChannels => { ChannelType::RGBChannels },
|
||||
bindings::ChannelType_GrayChannels => { ChannelType::GrayChannels },
|
||||
bindings::ChannelType_SyncChannels => { ChannelType::SyncChannels },
|
||||
bindings::ChannelType_GrayChannels => ChannelType::GrayChannels,
|
||||
bindings::ChannelType_SyncChannels => ChannelType::SyncChannels,
|
||||
// bindings::ChannelType_DefaultChannels => { ChannelType::DefaultChannels },
|
||||
_ => { ChannelType::Undefined },
|
||||
_ => ChannelType::Undefined,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum ClipPathUnits {
|
||||
Undefined = bindings::ClipPathUnits_UndefinedPathUnits,
|
||||
UserSpace = bindings::ClipPathUnits_UserSpace,
|
||||
UserSpaceOnUse = bindings::ClipPathUnits_UserSpaceOnUse,
|
||||
Undefined = bindings::ClipPathUnits_UndefinedPathUnits,
|
||||
UserSpace = bindings::ClipPathUnits_UserSpace,
|
||||
UserSpaceOnUse = bindings::ClipPathUnits_UserSpaceOnUse,
|
||||
ObjectBoundingBox = bindings::ClipPathUnits_ObjectBoundingBox,
|
||||
}
|
||||
|
||||
|
||||
@ -3,46 +3,46 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum ColorspaceType {
|
||||
Undefined = bindings::ColorspaceType_UndefinedColorspace,
|
||||
CMY = bindings::ColorspaceType_CMYColorspace,
|
||||
CMYK = bindings::ColorspaceType_CMYKColorspace,
|
||||
GRAY = bindings::ColorspaceType_GRAYColorspace,
|
||||
HCL = bindings::ColorspaceType_HCLColorspace,
|
||||
HCLp = bindings::ColorspaceType_HCLpColorspace,
|
||||
HSB = bindings::ColorspaceType_HSBColorspace,
|
||||
HSI = bindings::ColorspaceType_HSIColorspace,
|
||||
HSL = bindings::ColorspaceType_HSLColorspace,
|
||||
HSV = bindings::ColorspaceType_HSVColorspace,
|
||||
HWB = bindings::ColorspaceType_HWBColorspace,
|
||||
Lab = bindings::ColorspaceType_LabColorspace,
|
||||
LCH = bindings::ColorspaceType_LCHColorspace,
|
||||
LCHab = bindings::ColorspaceType_LCHabColorspace,
|
||||
LCHuv = bindings::ColorspaceType_LCHuvColorspace,
|
||||
Log = bindings::ColorspaceType_LogColorspace,
|
||||
LMS = bindings::ColorspaceType_LMSColorspace,
|
||||
Luv = bindings::ColorspaceType_LuvColorspace,
|
||||
OHTA = bindings::ColorspaceType_OHTAColorspace,
|
||||
Undefined = bindings::ColorspaceType_UndefinedColorspace,
|
||||
CMY = bindings::ColorspaceType_CMYColorspace,
|
||||
CMYK = bindings::ColorspaceType_CMYKColorspace,
|
||||
GRAY = bindings::ColorspaceType_GRAYColorspace,
|
||||
HCL = bindings::ColorspaceType_HCLColorspace,
|
||||
HCLp = bindings::ColorspaceType_HCLpColorspace,
|
||||
HSB = bindings::ColorspaceType_HSBColorspace,
|
||||
HSI = bindings::ColorspaceType_HSIColorspace,
|
||||
HSL = bindings::ColorspaceType_HSLColorspace,
|
||||
HSV = bindings::ColorspaceType_HSVColorspace,
|
||||
HWB = bindings::ColorspaceType_HWBColorspace,
|
||||
Lab = bindings::ColorspaceType_LabColorspace,
|
||||
LCH = bindings::ColorspaceType_LCHColorspace,
|
||||
LCHab = bindings::ColorspaceType_LCHabColorspace,
|
||||
LCHuv = bindings::ColorspaceType_LCHuvColorspace,
|
||||
Log = bindings::ColorspaceType_LogColorspace,
|
||||
LMS = bindings::ColorspaceType_LMSColorspace,
|
||||
Luv = bindings::ColorspaceType_LuvColorspace,
|
||||
OHTA = bindings::ColorspaceType_OHTAColorspace,
|
||||
Rec601YCbCr = bindings::ColorspaceType_Rec601YCbCrColorspace,
|
||||
Rec709YCbCr = bindings::ColorspaceType_Rec709YCbCrColorspace,
|
||||
RGB = bindings::ColorspaceType_RGBColorspace,
|
||||
scRGB = bindings::ColorspaceType_scRGBColorspace,
|
||||
sRGB = bindings::ColorspaceType_sRGBColorspace,
|
||||
RGB = bindings::ColorspaceType_RGBColorspace,
|
||||
scRGB = bindings::ColorspaceType_scRGBColorspace,
|
||||
sRGB = bindings::ColorspaceType_sRGBColorspace,
|
||||
Transparent = bindings::ColorspaceType_TransparentColorspace,
|
||||
xyY = bindings::ColorspaceType_xyYColorspace,
|
||||
XYZ = bindings::ColorspaceType_XYZColorspace,
|
||||
YCbCr = bindings::ColorspaceType_YCbCrColorspace,
|
||||
YCC = bindings::ColorspaceType_YCCColorspace,
|
||||
YDbDr = bindings::ColorspaceType_YDbDrColorspace,
|
||||
YIQ = bindings::ColorspaceType_YIQColorspace,
|
||||
YPbPr = bindings::ColorspaceType_YPbPrColorspace,
|
||||
YUV = bindings::ColorspaceType_YUVColorspace,
|
||||
LinearGRAY = bindings::ColorspaceType_LinearGRAYColorspace,
|
||||
Jzazbz = bindings::ColorspaceType_JzazbzColorspace,
|
||||
DisplayP3 = bindings::ColorspaceType_DisplayP3Colorspace,
|
||||
Adobe98 = bindings::ColorspaceType_Adobe98Colorspace,
|
||||
ProPhoto = bindings::ColorspaceType_ProPhotoColorspace,
|
||||
Oklab = bindings::ColorspaceType_OklabColorspace,
|
||||
Oklch = bindings::ColorspaceType_OklchColorspace,
|
||||
xyY = bindings::ColorspaceType_xyYColorspace,
|
||||
XYZ = bindings::ColorspaceType_XYZColorspace,
|
||||
YCbCr = bindings::ColorspaceType_YCbCrColorspace,
|
||||
YCC = bindings::ColorspaceType_YCCColorspace,
|
||||
YDbDr = bindings::ColorspaceType_YDbDrColorspace,
|
||||
YIQ = bindings::ColorspaceType_YIQColorspace,
|
||||
YPbPr = bindings::ColorspaceType_YPbPrColorspace,
|
||||
YUV = bindings::ColorspaceType_YUVColorspace,
|
||||
LinearGRAY = bindings::ColorspaceType_LinearGRAYColorspace,
|
||||
Jzazbz = bindings::ColorspaceType_JzazbzColorspace,
|
||||
DisplayP3 = bindings::ColorspaceType_DisplayP3Colorspace,
|
||||
Adobe98 = bindings::ColorspaceType_Adobe98Colorspace,
|
||||
ProPhoto = bindings::ColorspaceType_ProPhotoColorspace,
|
||||
Oklab = bindings::ColorspaceType_OklabColorspace,
|
||||
Oklch = bindings::ColorspaceType_OklchColorspace,
|
||||
}
|
||||
|
||||
impl Default for ColorspaceType {
|
||||
|
||||
@ -3,88 +3,88 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum CompositeOperator {
|
||||
Undefined = bindings::CompositeOperator_UndefinedCompositeOp,
|
||||
Alpha = bindings::CompositeOperator_AlphaCompositeOp,
|
||||
Atop = bindings::CompositeOperator_AtopCompositeOp,
|
||||
Blend = bindings::CompositeOperator_BlendCompositeOp,
|
||||
Blur = bindings::CompositeOperator_BlurCompositeOp,
|
||||
Bumpmap = bindings::CompositeOperator_BumpmapCompositeOp,
|
||||
ChangeMask = bindings::CompositeOperator_ChangeMaskCompositeOp,
|
||||
Clear = bindings::CompositeOperator_ClearCompositeOp,
|
||||
ColorBurn = bindings::CompositeOperator_ColorBurnCompositeOp,
|
||||
ColorDodge = bindings::CompositeOperator_ColorDodgeCompositeOp,
|
||||
Colorize = bindings::CompositeOperator_ColorizeCompositeOp,
|
||||
CopyBlack = bindings::CompositeOperator_CopyBlackCompositeOp,
|
||||
CopyBlue = bindings::CompositeOperator_CopyBlueCompositeOp,
|
||||
Copy = bindings::CompositeOperator_CopyCompositeOp,
|
||||
CopyCyan = bindings::CompositeOperator_CopyCyanCompositeOp,
|
||||
CopyGreen = bindings::CompositeOperator_CopyGreenCompositeOp,
|
||||
CopyMagenta = bindings::CompositeOperator_CopyMagentaCompositeOp,
|
||||
CopyAlpha = bindings::CompositeOperator_CopyAlphaCompositeOp,
|
||||
CopyRed = bindings::CompositeOperator_CopyRedCompositeOp,
|
||||
CopyYellow = bindings::CompositeOperator_CopyYellowCompositeOp,
|
||||
Darken = bindings::CompositeOperator_DarkenCompositeOp,
|
||||
DarkenIntensity = bindings::CompositeOperator_DarkenIntensityCompositeOp,
|
||||
Difference = bindings::CompositeOperator_DifferenceCompositeOp,
|
||||
Displace = bindings::CompositeOperator_DisplaceCompositeOp,
|
||||
Dissolve = bindings::CompositeOperator_DissolveCompositeOp,
|
||||
Distort = bindings::CompositeOperator_DistortCompositeOp,
|
||||
DivideDst = bindings::CompositeOperator_DivideDstCompositeOp,
|
||||
DivideSrc = bindings::CompositeOperator_DivideSrcCompositeOp,
|
||||
DstAtop = bindings::CompositeOperator_DstAtopCompositeOp,
|
||||
Dst = bindings::CompositeOperator_DstCompositeOp,
|
||||
DstIn = bindings::CompositeOperator_DstInCompositeOp,
|
||||
DstOut = bindings::CompositeOperator_DstOutCompositeOp,
|
||||
DstOver = bindings::CompositeOperator_DstOverCompositeOp,
|
||||
Exclusion = bindings::CompositeOperator_ExclusionCompositeOp,
|
||||
HardLight = bindings::CompositeOperator_HardLightCompositeOp,
|
||||
HardMix = bindings::CompositeOperator_HardMixCompositeOp,
|
||||
Hue = bindings::CompositeOperator_HueCompositeOp,
|
||||
In = bindings::CompositeOperator_InCompositeOp,
|
||||
Intensity = bindings::CompositeOperator_IntensityCompositeOp,
|
||||
Lighten = bindings::CompositeOperator_LightenCompositeOp,
|
||||
Undefined = bindings::CompositeOperator_UndefinedCompositeOp,
|
||||
Alpha = bindings::CompositeOperator_AlphaCompositeOp,
|
||||
Atop = bindings::CompositeOperator_AtopCompositeOp,
|
||||
Blend = bindings::CompositeOperator_BlendCompositeOp,
|
||||
Blur = bindings::CompositeOperator_BlurCompositeOp,
|
||||
Bumpmap = bindings::CompositeOperator_BumpmapCompositeOp,
|
||||
ChangeMask = bindings::CompositeOperator_ChangeMaskCompositeOp,
|
||||
Clear = bindings::CompositeOperator_ClearCompositeOp,
|
||||
ColorBurn = bindings::CompositeOperator_ColorBurnCompositeOp,
|
||||
ColorDodge = bindings::CompositeOperator_ColorDodgeCompositeOp,
|
||||
Colorize = bindings::CompositeOperator_ColorizeCompositeOp,
|
||||
CopyBlack = bindings::CompositeOperator_CopyBlackCompositeOp,
|
||||
CopyBlue = bindings::CompositeOperator_CopyBlueCompositeOp,
|
||||
Copy = bindings::CompositeOperator_CopyCompositeOp,
|
||||
CopyCyan = bindings::CompositeOperator_CopyCyanCompositeOp,
|
||||
CopyGreen = bindings::CompositeOperator_CopyGreenCompositeOp,
|
||||
CopyMagenta = bindings::CompositeOperator_CopyMagentaCompositeOp,
|
||||
CopyAlpha = bindings::CompositeOperator_CopyAlphaCompositeOp,
|
||||
CopyRed = bindings::CompositeOperator_CopyRedCompositeOp,
|
||||
CopyYellow = bindings::CompositeOperator_CopyYellowCompositeOp,
|
||||
Darken = bindings::CompositeOperator_DarkenCompositeOp,
|
||||
DarkenIntensity = bindings::CompositeOperator_DarkenIntensityCompositeOp,
|
||||
Difference = bindings::CompositeOperator_DifferenceCompositeOp,
|
||||
Displace = bindings::CompositeOperator_DisplaceCompositeOp,
|
||||
Dissolve = bindings::CompositeOperator_DissolveCompositeOp,
|
||||
Distort = bindings::CompositeOperator_DistortCompositeOp,
|
||||
DivideDst = bindings::CompositeOperator_DivideDstCompositeOp,
|
||||
DivideSrc = bindings::CompositeOperator_DivideSrcCompositeOp,
|
||||
DstAtop = bindings::CompositeOperator_DstAtopCompositeOp,
|
||||
Dst = bindings::CompositeOperator_DstCompositeOp,
|
||||
DstIn = bindings::CompositeOperator_DstInCompositeOp,
|
||||
DstOut = bindings::CompositeOperator_DstOutCompositeOp,
|
||||
DstOver = bindings::CompositeOperator_DstOverCompositeOp,
|
||||
Exclusion = bindings::CompositeOperator_ExclusionCompositeOp,
|
||||
HardLight = bindings::CompositeOperator_HardLightCompositeOp,
|
||||
HardMix = bindings::CompositeOperator_HardMixCompositeOp,
|
||||
Hue = bindings::CompositeOperator_HueCompositeOp,
|
||||
In = bindings::CompositeOperator_InCompositeOp,
|
||||
Intensity = bindings::CompositeOperator_IntensityCompositeOp,
|
||||
Lighten = bindings::CompositeOperator_LightenCompositeOp,
|
||||
LightenIntensity = bindings::CompositeOperator_LightenIntensityCompositeOp,
|
||||
LinearBurn = bindings::CompositeOperator_LinearBurnCompositeOp,
|
||||
LinearDodge = bindings::CompositeOperator_LinearDodgeCompositeOp,
|
||||
LinearLight = bindings::CompositeOperator_LinearLightCompositeOp,
|
||||
Luminize = bindings::CompositeOperator_LuminizeCompositeOp,
|
||||
Mathematics = bindings::CompositeOperator_MathematicsCompositeOp,
|
||||
MinusDst = bindings::CompositeOperator_MinusDstCompositeOp,
|
||||
MinusSrc = bindings::CompositeOperator_MinusSrcCompositeOp,
|
||||
Modulate = bindings::CompositeOperator_ModulateCompositeOp,
|
||||
ModulusAdd = bindings::CompositeOperator_ModulusAddCompositeOp,
|
||||
ModulusSubtract = bindings::CompositeOperator_ModulusSubtractCompositeOp,
|
||||
Multiply = bindings::CompositeOperator_MultiplyCompositeOp,
|
||||
No = bindings::CompositeOperator_NoCompositeOp,
|
||||
Out = bindings::CompositeOperator_OutCompositeOp,
|
||||
Over = bindings::CompositeOperator_OverCompositeOp,
|
||||
Overlay = bindings::CompositeOperator_OverlayCompositeOp,
|
||||
PegtopLight = bindings::CompositeOperator_PegtopLightCompositeOp,
|
||||
PinLight = bindings::CompositeOperator_PinLightCompositeOp,
|
||||
Plus = bindings::CompositeOperator_PlusCompositeOp,
|
||||
Replace = bindings::CompositeOperator_ReplaceCompositeOp,
|
||||
Saturate = bindings::CompositeOperator_SaturateCompositeOp,
|
||||
Screen = bindings::CompositeOperator_ScreenCompositeOp,
|
||||
SoftLight = bindings::CompositeOperator_SoftLightCompositeOp,
|
||||
SrcAtop = bindings::CompositeOperator_SrcAtopCompositeOp,
|
||||
Src = bindings::CompositeOperator_SrcCompositeOp,
|
||||
SrcIn = bindings::CompositeOperator_SrcInCompositeOp,
|
||||
SrcOut = bindings::CompositeOperator_SrcOutCompositeOp,
|
||||
SrcOver = bindings::CompositeOperator_SrcOverCompositeOp,
|
||||
Threshold = bindings::CompositeOperator_ThresholdCompositeOp,
|
||||
VividLight = bindings::CompositeOperator_VividLightCompositeOp,
|
||||
Xor = bindings::CompositeOperator_XorCompositeOp,
|
||||
Stereo = bindings::CompositeOperator_StereoCompositeOp,
|
||||
Freeze = bindings::CompositeOperator_FreezeCompositeOp,
|
||||
Interpolate = bindings::CompositeOperator_InterpolateCompositeOp,
|
||||
Negate = bindings::CompositeOperator_NegateCompositeOp,
|
||||
Reflect = bindings::CompositeOperator_ReflectCompositeOp,
|
||||
SoftBurn = bindings::CompositeOperator_SoftBurnCompositeOp,
|
||||
SoftDodge = bindings::CompositeOperator_SoftDodgeCompositeOp,
|
||||
Stamp = bindings::CompositeOperator_StampCompositeOp,
|
||||
RMSE = bindings::CompositeOperator_RMSECompositeOp,
|
||||
SaliencyBlend = bindings::CompositeOperator_SaliencyBlendCompositeOp,
|
||||
SeamlessBlend = bindings::CompositeOperator_SeamlessBlendCompositeOp,
|
||||
LinearBurn = bindings::CompositeOperator_LinearBurnCompositeOp,
|
||||
LinearDodge = bindings::CompositeOperator_LinearDodgeCompositeOp,
|
||||
LinearLight = bindings::CompositeOperator_LinearLightCompositeOp,
|
||||
Luminize = bindings::CompositeOperator_LuminizeCompositeOp,
|
||||
Mathematics = bindings::CompositeOperator_MathematicsCompositeOp,
|
||||
MinusDst = bindings::CompositeOperator_MinusDstCompositeOp,
|
||||
MinusSrc = bindings::CompositeOperator_MinusSrcCompositeOp,
|
||||
Modulate = bindings::CompositeOperator_ModulateCompositeOp,
|
||||
ModulusAdd = bindings::CompositeOperator_ModulusAddCompositeOp,
|
||||
ModulusSubtract = bindings::CompositeOperator_ModulusSubtractCompositeOp,
|
||||
Multiply = bindings::CompositeOperator_MultiplyCompositeOp,
|
||||
No = bindings::CompositeOperator_NoCompositeOp,
|
||||
Out = bindings::CompositeOperator_OutCompositeOp,
|
||||
Over = bindings::CompositeOperator_OverCompositeOp,
|
||||
Overlay = bindings::CompositeOperator_OverlayCompositeOp,
|
||||
PegtopLight = bindings::CompositeOperator_PegtopLightCompositeOp,
|
||||
PinLight = bindings::CompositeOperator_PinLightCompositeOp,
|
||||
Plus = bindings::CompositeOperator_PlusCompositeOp,
|
||||
Replace = bindings::CompositeOperator_ReplaceCompositeOp,
|
||||
Saturate = bindings::CompositeOperator_SaturateCompositeOp,
|
||||
Screen = bindings::CompositeOperator_ScreenCompositeOp,
|
||||
SoftLight = bindings::CompositeOperator_SoftLightCompositeOp,
|
||||
SrcAtop = bindings::CompositeOperator_SrcAtopCompositeOp,
|
||||
Src = bindings::CompositeOperator_SrcCompositeOp,
|
||||
SrcIn = bindings::CompositeOperator_SrcInCompositeOp,
|
||||
SrcOut = bindings::CompositeOperator_SrcOutCompositeOp,
|
||||
SrcOver = bindings::CompositeOperator_SrcOverCompositeOp,
|
||||
Threshold = bindings::CompositeOperator_ThresholdCompositeOp,
|
||||
VividLight = bindings::CompositeOperator_VividLightCompositeOp,
|
||||
Xor = bindings::CompositeOperator_XorCompositeOp,
|
||||
Stereo = bindings::CompositeOperator_StereoCompositeOp,
|
||||
Freeze = bindings::CompositeOperator_FreezeCompositeOp,
|
||||
Interpolate = bindings::CompositeOperator_InterpolateCompositeOp,
|
||||
Negate = bindings::CompositeOperator_NegateCompositeOp,
|
||||
Reflect = bindings::CompositeOperator_ReflectCompositeOp,
|
||||
SoftBurn = bindings::CompositeOperator_SoftBurnCompositeOp,
|
||||
SoftDodge = bindings::CompositeOperator_SoftDodgeCompositeOp,
|
||||
Stamp = bindings::CompositeOperator_StampCompositeOp,
|
||||
RMSE = bindings::CompositeOperator_RMSECompositeOp,
|
||||
SaliencyBlend = bindings::CompositeOperator_SaliencyBlendCompositeOp,
|
||||
SeamlessBlend = bindings::CompositeOperator_SeamlessBlendCompositeOp,
|
||||
}
|
||||
|
||||
impl Default for CompositeOperator {
|
||||
|
||||
@ -3,35 +3,35 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum CompressionType {
|
||||
Undefined = bindings::CompressionType_UndefinedCompression,
|
||||
B44A = bindings::CompressionType_B44ACompression,
|
||||
B44 = bindings::CompressionType_B44Compression,
|
||||
BZip = bindings::CompressionType_BZipCompression,
|
||||
DXT1 = bindings::CompressionType_DXT1Compression,
|
||||
DXT3 = bindings::CompressionType_DXT3Compression,
|
||||
DXT5 = bindings::CompressionType_DXT5Compression,
|
||||
Fax = bindings::CompressionType_FaxCompression,
|
||||
Group4 = bindings::CompressionType_Group4Compression,
|
||||
JBIG1 = bindings::CompressionType_JBIG1Compression,
|
||||
JBIG2 = bindings::CompressionType_JBIG2Compression,
|
||||
JPEG2000 = bindings::CompressionType_JPEG2000Compression,
|
||||
JPEG = bindings::CompressionType_JPEGCompression,
|
||||
Undefined = bindings::CompressionType_UndefinedCompression,
|
||||
B44A = bindings::CompressionType_B44ACompression,
|
||||
B44 = bindings::CompressionType_B44Compression,
|
||||
BZip = bindings::CompressionType_BZipCompression,
|
||||
DXT1 = bindings::CompressionType_DXT1Compression,
|
||||
DXT3 = bindings::CompressionType_DXT3Compression,
|
||||
DXT5 = bindings::CompressionType_DXT5Compression,
|
||||
Fax = bindings::CompressionType_FaxCompression,
|
||||
Group4 = bindings::CompressionType_Group4Compression,
|
||||
JBIG1 = bindings::CompressionType_JBIG1Compression,
|
||||
JBIG2 = bindings::CompressionType_JBIG2Compression,
|
||||
JPEG2000 = bindings::CompressionType_JPEG2000Compression,
|
||||
JPEG = bindings::CompressionType_JPEGCompression,
|
||||
LosslessJPEG = bindings::CompressionType_LosslessJPEGCompression,
|
||||
LZMA = bindings::CompressionType_LZMACompression,
|
||||
LZW = bindings::CompressionType_LZWCompression,
|
||||
No = bindings::CompressionType_NoCompression,
|
||||
Piz = bindings::CompressionType_PizCompression,
|
||||
Pxr24 = bindings::CompressionType_Pxr24Compression,
|
||||
RLE = bindings::CompressionType_RLECompression,
|
||||
Zip = bindings::CompressionType_ZipCompression,
|
||||
ZipS = bindings::CompressionType_ZipSCompression,
|
||||
Zstd = bindings::CompressionType_ZstdCompression,
|
||||
WebP = bindings::CompressionType_WebPCompression,
|
||||
DWAA = bindings::CompressionType_DWAACompression,
|
||||
DWAB = bindings::CompressionType_DWABCompression,
|
||||
BC7 = bindings::CompressionType_BC7Compression,
|
||||
BC5 = bindings::CompressionType_BC5Compression,
|
||||
LERC = bindings::CompressionType_LERCCompression,
|
||||
LZMA = bindings::CompressionType_LZMACompression,
|
||||
LZW = bindings::CompressionType_LZWCompression,
|
||||
No = bindings::CompressionType_NoCompression,
|
||||
Piz = bindings::CompressionType_PizCompression,
|
||||
Pxr24 = bindings::CompressionType_Pxr24Compression,
|
||||
RLE = bindings::CompressionType_RLECompression,
|
||||
Zip = bindings::CompressionType_ZipCompression,
|
||||
ZipS = bindings::CompressionType_ZipSCompression,
|
||||
Zstd = bindings::CompressionType_ZstdCompression,
|
||||
WebP = bindings::CompressionType_WebPCompression,
|
||||
DWAA = bindings::CompressionType_DWAACompression,
|
||||
DWAB = bindings::CompressionType_DWABCompression,
|
||||
BC7 = bindings::CompressionType_BC7Compression,
|
||||
BC5 = bindings::CompressionType_BC5Compression,
|
||||
LERC = bindings::CompressionType_LERCCompression,
|
||||
}
|
||||
|
||||
impl Default for CompressionType {
|
||||
|
||||
@ -3,10 +3,10 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum DecorationType {
|
||||
Undefined = bindings::DecorationType_UndefinedDecoration,
|
||||
No = bindings::DecorationType_NoDecoration,
|
||||
Underline = bindings::DecorationType_UnderlineDecoration,
|
||||
Overline = bindings::DecorationType_OverlineDecoration,
|
||||
Undefined = bindings::DecorationType_UndefinedDecoration,
|
||||
No = bindings::DecorationType_NoDecoration,
|
||||
Underline = bindings::DecorationType_UnderlineDecoration,
|
||||
Overline = bindings::DecorationType_OverlineDecoration,
|
||||
LineThrough = bindings::DecorationType_LineThroughDecoration,
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum DirectionType {
|
||||
Undefined = bindings::DirectionType_UndefinedDirection,
|
||||
Undefined = bindings::DirectionType_UndefinedDirection,
|
||||
RightToLeft = bindings::DirectionType_RightToLeftDirection,
|
||||
LeftToRight = bindings::DirectionType_LeftToRightDirection,
|
||||
TopToBottom = bindings::DirectionType_TopToBottomDirection,
|
||||
|
||||
@ -7,10 +7,10 @@ pub enum DisposeType {
|
||||
* Identical to `Undefined`
|
||||
*/
|
||||
// Unrecognized = bindings::DisposeType_UnrecognizedDispose,
|
||||
Undefined = bindings::DisposeType_UndefinedDispose,
|
||||
None = bindings::DisposeType_NoneDispose,
|
||||
Background = bindings::DisposeType_BackgroundDispose,
|
||||
Previous = bindings::DisposeType_PreviousDispose,
|
||||
Undefined = bindings::DisposeType_UndefinedDispose,
|
||||
None = bindings::DisposeType_NoneDispose,
|
||||
Background = bindings::DisposeType_BackgroundDispose,
|
||||
Previous = bindings::DisposeType_PreviousDispose,
|
||||
}
|
||||
|
||||
impl Default for DisposeType {
|
||||
|
||||
@ -3,9 +3,9 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum DitherMethod {
|
||||
Undefined = bindings::DitherMethod_UndefinedDitherMethod,
|
||||
No = bindings::DitherMethod_NoDitherMethod,
|
||||
Riemersma = bindings::DitherMethod_RiemersmaDitherMethod,
|
||||
Undefined = bindings::DitherMethod_UndefinedDitherMethod,
|
||||
No = bindings::DitherMethod_NoDitherMethod,
|
||||
Riemersma = bindings::DitherMethod_RiemersmaDitherMethod,
|
||||
FloydSteinberg = bindings::DitherMethod_FloydSteinbergDitherMethod,
|
||||
}
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@ use crate::bindings;
|
||||
#[repr(u32)]
|
||||
pub enum EndianType {
|
||||
Undefined = bindings::EndianType_UndefinedEndian,
|
||||
LSB = bindings::EndianType_LSBEndian,
|
||||
MSB = bindings::EndianType_MSBEndian,
|
||||
LSB = bindings::EndianType_LSBEndian,
|
||||
MSB = bindings::EndianType_MSBEndian,
|
||||
}
|
||||
|
||||
impl Default for EndianType {
|
||||
|
||||
@ -4,8 +4,8 @@ use crate::bindings;
|
||||
#[repr(u32)]
|
||||
pub enum FillRule {
|
||||
Undefined = bindings::FillRule_UndefinedRule,
|
||||
EvenOdd = bindings::FillRule_EvenOddRule,
|
||||
NonZero = bindings::FillRule_NonZeroRule,
|
||||
EvenOdd = bindings::FillRule_EvenOddRule,
|
||||
NonZero = bindings::FillRule_NonZeroRule,
|
||||
}
|
||||
|
||||
impl Default for FillRule {
|
||||
|
||||
@ -3,39 +3,39 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum FilterType {
|
||||
Undefined = bindings::FilterType_UndefinedFilter,
|
||||
Point = bindings::FilterType_PointFilter,
|
||||
Box = bindings::FilterType_BoxFilter,
|
||||
Triangle = bindings::FilterType_TriangleFilter,
|
||||
Hermite = bindings::FilterType_HermiteFilter,
|
||||
Hann = bindings::FilterType_HannFilter,
|
||||
Hamming = bindings::FilterType_HammingFilter,
|
||||
Blackman = bindings::FilterType_BlackmanFilter,
|
||||
Gaussian = bindings::FilterType_GaussianFilter,
|
||||
Quadratic = bindings::FilterType_QuadraticFilter,
|
||||
Cubic = bindings::FilterType_CubicFilter,
|
||||
Catrom = bindings::FilterType_CatromFilter,
|
||||
Mitchell = bindings::FilterType_MitchellFilter,
|
||||
Jinc = bindings::FilterType_JincFilter,
|
||||
Sinc = bindings::FilterType_SincFilter,
|
||||
SincFast = bindings::FilterType_SincFastFilter,
|
||||
Kaiser = bindings::FilterType_KaiserFilter,
|
||||
Welch = bindings::FilterType_WelchFilter,
|
||||
Parzen = bindings::FilterType_ParzenFilter,
|
||||
Bohman = bindings::FilterType_BohmanFilter,
|
||||
Bartlett = bindings::FilterType_BartlettFilter,
|
||||
Lagrange = bindings::FilterType_LagrangeFilter,
|
||||
Lanczos = bindings::FilterType_LanczosFilter,
|
||||
LanczosSharp = bindings::FilterType_LanczosSharpFilter,
|
||||
Lanczos2 = bindings::FilterType_Lanczos2Filter,
|
||||
Undefined = bindings::FilterType_UndefinedFilter,
|
||||
Point = bindings::FilterType_PointFilter,
|
||||
Box = bindings::FilterType_BoxFilter,
|
||||
Triangle = bindings::FilterType_TriangleFilter,
|
||||
Hermite = bindings::FilterType_HermiteFilter,
|
||||
Hann = bindings::FilterType_HannFilter,
|
||||
Hamming = bindings::FilterType_HammingFilter,
|
||||
Blackman = bindings::FilterType_BlackmanFilter,
|
||||
Gaussian = bindings::FilterType_GaussianFilter,
|
||||
Quadratic = bindings::FilterType_QuadraticFilter,
|
||||
Cubic = bindings::FilterType_CubicFilter,
|
||||
Catrom = bindings::FilterType_CatromFilter,
|
||||
Mitchell = bindings::FilterType_MitchellFilter,
|
||||
Jinc = bindings::FilterType_JincFilter,
|
||||
Sinc = bindings::FilterType_SincFilter,
|
||||
SincFast = bindings::FilterType_SincFastFilter,
|
||||
Kaiser = bindings::FilterType_KaiserFilter,
|
||||
Welch = bindings::FilterType_WelchFilter,
|
||||
Parzen = bindings::FilterType_ParzenFilter,
|
||||
Bohman = bindings::FilterType_BohmanFilter,
|
||||
Bartlett = bindings::FilterType_BartlettFilter,
|
||||
Lagrange = bindings::FilterType_LagrangeFilter,
|
||||
Lanczos = bindings::FilterType_LanczosFilter,
|
||||
LanczosSharp = bindings::FilterType_LanczosSharpFilter,
|
||||
Lanczos2 = bindings::FilterType_Lanczos2Filter,
|
||||
Lanczos2Sharp = bindings::FilterType_Lanczos2SharpFilter,
|
||||
Robidoux = bindings::FilterType_RobidouxFilter,
|
||||
Robidoux = bindings::FilterType_RobidouxFilter,
|
||||
RobidouxSharp = bindings::FilterType_RobidouxSharpFilter,
|
||||
Cosine = bindings::FilterType_CosineFilter,
|
||||
Spline = bindings::FilterType_SplineFilter,
|
||||
Cosine = bindings::FilterType_CosineFilter,
|
||||
Spline = bindings::FilterType_SplineFilter,
|
||||
LanczosRadius = bindings::FilterType_LanczosRadiusFilter,
|
||||
CubicSpline = bindings::FilterType_CubicSplineFilter,
|
||||
Sentinel = bindings::FilterType_SentinelFilter,
|
||||
CubicSpline = bindings::FilterType_CubicSplineFilter,
|
||||
Sentinel = bindings::FilterType_SentinelFilter,
|
||||
}
|
||||
|
||||
impl From<FilterType> for bindings::FilterType {
|
||||
|
||||
@ -9,13 +9,13 @@ pub enum GravityType {
|
||||
*/
|
||||
// Forget = bindings::GravityType_ForgetGravity,
|
||||
NorthWest = bindings::GravityType_NorthWestGravity,
|
||||
North = bindings::GravityType_NorthGravity,
|
||||
North = bindings::GravityType_NorthGravity,
|
||||
NorthEast = bindings::GravityType_NorthEastGravity,
|
||||
West = bindings::GravityType_WestGravity,
|
||||
Center = bindings::GravityType_CenterGravity,
|
||||
East = bindings::GravityType_EastGravity,
|
||||
West = bindings::GravityType_WestGravity,
|
||||
Center = bindings::GravityType_CenterGravity,
|
||||
East = bindings::GravityType_EastGravity,
|
||||
SouthWest = bindings::GravityType_SouthWestGravity,
|
||||
South = bindings::GravityType_SouthGravity,
|
||||
South = bindings::GravityType_SouthGravity,
|
||||
SouthEast = bindings::GravityType_SouthEastGravity,
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ impl Image<'_> {
|
||||
pub unsafe fn new(img: *mut bindings::Image) -> Self {
|
||||
Image {
|
||||
image: img,
|
||||
phantom_data: PhantomData
|
||||
phantom_data: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,18 +3,18 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum ImageType {
|
||||
Undefined = bindings::ImageType_UndefinedType,
|
||||
Bilevel = bindings::ImageType_BilevelType,
|
||||
Grayscale = bindings::ImageType_GrayscaleType,
|
||||
GrayscaleAlpha = bindings::ImageType_GrayscaleAlphaType,
|
||||
Palette = bindings::ImageType_PaletteType,
|
||||
PaletteAlpha = bindings::ImageType_PaletteAlphaType,
|
||||
TrueColor = bindings::ImageType_TrueColorType,
|
||||
TrueColorAlpha = bindings::ImageType_TrueColorAlphaType,
|
||||
ColorSeparation = bindings::ImageType_ColorSeparationType,
|
||||
Undefined = bindings::ImageType_UndefinedType,
|
||||
Bilevel = bindings::ImageType_BilevelType,
|
||||
Grayscale = bindings::ImageType_GrayscaleType,
|
||||
GrayscaleAlpha = bindings::ImageType_GrayscaleAlphaType,
|
||||
Palette = bindings::ImageType_PaletteType,
|
||||
PaletteAlpha = bindings::ImageType_PaletteAlphaType,
|
||||
TrueColor = bindings::ImageType_TrueColorType,
|
||||
TrueColorAlpha = bindings::ImageType_TrueColorAlphaType,
|
||||
ColorSeparation = bindings::ImageType_ColorSeparationType,
|
||||
ColorSeparationAlpha = bindings::ImageType_ColorSeparationAlphaType,
|
||||
Optimize = bindings::ImageType_OptimizeType,
|
||||
PaletteBilevelAlpha = bindings::ImageType_PaletteBilevelAlphaType,
|
||||
Optimize = bindings::ImageType_OptimizeType,
|
||||
PaletteBilevelAlpha = bindings::ImageType_PaletteBilevelAlphaType,
|
||||
}
|
||||
|
||||
impl Default for ImageType {
|
||||
|
||||
@ -4,13 +4,13 @@ use crate::bindings;
|
||||
#[repr(u32)]
|
||||
pub enum InterlaceType {
|
||||
Undefined = bindings::InterlaceType_UndefinedInterlace,
|
||||
No = bindings::InterlaceType_NoInterlace,
|
||||
Line = bindings::InterlaceType_LineInterlace,
|
||||
Plane = bindings::InterlaceType_PlaneInterlace,
|
||||
No = bindings::InterlaceType_NoInterlace,
|
||||
Line = bindings::InterlaceType_LineInterlace,
|
||||
Plane = bindings::InterlaceType_PlaneInterlace,
|
||||
Partition = bindings::InterlaceType_PartitionInterlace,
|
||||
GIF = bindings::InterlaceType_GIFInterlace,
|
||||
JPEG = bindings::InterlaceType_JPEGInterlace,
|
||||
PNG = bindings::InterlaceType_PNGInterlace,
|
||||
GIF = bindings::InterlaceType_GIFInterlace,
|
||||
JPEG = bindings::InterlaceType_JPEGInterlace,
|
||||
PNG = bindings::InterlaceType_PNGInterlace,
|
||||
}
|
||||
|
||||
impl Default for InterlaceType {
|
||||
|
||||
@ -1,49 +1,49 @@
|
||||
use std::ffi::CString;
|
||||
|
||||
use crate::bindings;
|
||||
use crate::{Result, MagickError};
|
||||
use crate::{MagickError, Result};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum KernelInfoType {
|
||||
Undefined = bindings::KernelInfoType_UndefinedKernel,
|
||||
Unity = bindings::KernelInfoType_UnityKernel,
|
||||
Gaussian = bindings::KernelInfoType_GaussianKernel,
|
||||
DoG = bindings::KernelInfoType_DoGKernel,
|
||||
LoG = bindings::KernelInfoType_LoGKernel,
|
||||
Blur = bindings::KernelInfoType_BlurKernel,
|
||||
Comet = bindings::KernelInfoType_CometKernel,
|
||||
Binomial = bindings::KernelInfoType_BinomialKernel,
|
||||
Laplacian = bindings::KernelInfoType_LaplacianKernel,
|
||||
Sobel = bindings::KernelInfoType_SobelKernel,
|
||||
FreiChen = bindings::KernelInfoType_FreiChenKernel,
|
||||
Roberts = bindings::KernelInfoType_RobertsKernel,
|
||||
Prewitt = bindings::KernelInfoType_PrewittKernel,
|
||||
Compass = bindings::KernelInfoType_CompassKernel,
|
||||
Kirsch = bindings::KernelInfoType_KirschKernel,
|
||||
Diamond = bindings::KernelInfoType_DiamondKernel,
|
||||
Square = bindings::KernelInfoType_SquareKernel,
|
||||
Rectangle = bindings::KernelInfoType_RectangleKernel,
|
||||
Octagon = bindings::KernelInfoType_OctagonKernel,
|
||||
Disk = bindings::KernelInfoType_DiskKernel,
|
||||
Plus = bindings::KernelInfoType_PlusKernel,
|
||||
Cross = bindings::KernelInfoType_CrossKernel,
|
||||
Ring = bindings::KernelInfoType_RingKernel,
|
||||
Peaks = bindings::KernelInfoType_PeaksKernel,
|
||||
Edges = bindings::KernelInfoType_EdgesKernel,
|
||||
Corners = bindings::KernelInfoType_CornersKernel,
|
||||
Diagonals = bindings::KernelInfoType_DiagonalsKernel,
|
||||
LineEnds = bindings::KernelInfoType_LineEndsKernel,
|
||||
Undefined = bindings::KernelInfoType_UndefinedKernel,
|
||||
Unity = bindings::KernelInfoType_UnityKernel,
|
||||
Gaussian = bindings::KernelInfoType_GaussianKernel,
|
||||
DoG = bindings::KernelInfoType_DoGKernel,
|
||||
LoG = bindings::KernelInfoType_LoGKernel,
|
||||
Blur = bindings::KernelInfoType_BlurKernel,
|
||||
Comet = bindings::KernelInfoType_CometKernel,
|
||||
Binomial = bindings::KernelInfoType_BinomialKernel,
|
||||
Laplacian = bindings::KernelInfoType_LaplacianKernel,
|
||||
Sobel = bindings::KernelInfoType_SobelKernel,
|
||||
FreiChen = bindings::KernelInfoType_FreiChenKernel,
|
||||
Roberts = bindings::KernelInfoType_RobertsKernel,
|
||||
Prewitt = bindings::KernelInfoType_PrewittKernel,
|
||||
Compass = bindings::KernelInfoType_CompassKernel,
|
||||
Kirsch = bindings::KernelInfoType_KirschKernel,
|
||||
Diamond = bindings::KernelInfoType_DiamondKernel,
|
||||
Square = bindings::KernelInfoType_SquareKernel,
|
||||
Rectangle = bindings::KernelInfoType_RectangleKernel,
|
||||
Octagon = bindings::KernelInfoType_OctagonKernel,
|
||||
Disk = bindings::KernelInfoType_DiskKernel,
|
||||
Plus = bindings::KernelInfoType_PlusKernel,
|
||||
Cross = bindings::KernelInfoType_CrossKernel,
|
||||
Ring = bindings::KernelInfoType_RingKernel,
|
||||
Peaks = bindings::KernelInfoType_PeaksKernel,
|
||||
Edges = bindings::KernelInfoType_EdgesKernel,
|
||||
Corners = bindings::KernelInfoType_CornersKernel,
|
||||
Diagonals = bindings::KernelInfoType_DiagonalsKernel,
|
||||
LineEnds = bindings::KernelInfoType_LineEndsKernel,
|
||||
LineJunctions = bindings::KernelInfoType_LineJunctionsKernel,
|
||||
Ridges = bindings::KernelInfoType_RidgesKernel,
|
||||
ConvexHull = bindings::KernelInfoType_ConvexHullKernel,
|
||||
ThinSE = bindings::KernelInfoType_ThinSEKernel,
|
||||
Skeleton = bindings::KernelInfoType_SkeletonKernel,
|
||||
Chebyshev = bindings::KernelInfoType_ChebyshevKernel,
|
||||
Manhattan = bindings::KernelInfoType_ManhattanKernel,
|
||||
Octagonal = bindings::KernelInfoType_OctagonalKernel,
|
||||
Euclidean = bindings::KernelInfoType_EuclideanKernel,
|
||||
UserDefined = bindings::KernelInfoType_UserDefinedKernel,
|
||||
Ridges = bindings::KernelInfoType_RidgesKernel,
|
||||
ConvexHull = bindings::KernelInfoType_ConvexHullKernel,
|
||||
ThinSE = bindings::KernelInfoType_ThinSEKernel,
|
||||
Skeleton = bindings::KernelInfoType_SkeletonKernel,
|
||||
Chebyshev = bindings::KernelInfoType_ChebyshevKernel,
|
||||
Manhattan = bindings::KernelInfoType_ManhattanKernel,
|
||||
Octagonal = bindings::KernelInfoType_OctagonalKernel,
|
||||
Euclidean = bindings::KernelInfoType_EuclideanKernel,
|
||||
UserDefined = bindings::KernelInfoType_UserDefinedKernel,
|
||||
}
|
||||
|
||||
impl Default for KernelInfoType {
|
||||
@ -58,35 +58,32 @@ impl From<KernelInfoType> for bindings::KernelInfoType {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum MorphologyMethod {
|
||||
Undefined = bindings::MorphologyMethod_UndefinedMorphology,
|
||||
Convolve = bindings::MorphologyMethod_ConvolveMorphology,
|
||||
Correlate = bindings::MorphologyMethod_CorrelateMorphology,
|
||||
Erode = bindings::MorphologyMethod_ErodeMorphology,
|
||||
Dilate = bindings::MorphologyMethod_DilateMorphology,
|
||||
ErodeIntensity = bindings::MorphologyMethod_ErodeIntensityMorphology,
|
||||
DilateIntensity = bindings::MorphologyMethod_DilateIntensityMorphology,
|
||||
Undefined = bindings::MorphologyMethod_UndefinedMorphology,
|
||||
Convolve = bindings::MorphologyMethod_ConvolveMorphology,
|
||||
Correlate = bindings::MorphologyMethod_CorrelateMorphology,
|
||||
Erode = bindings::MorphologyMethod_ErodeMorphology,
|
||||
Dilate = bindings::MorphologyMethod_DilateMorphology,
|
||||
ErodeIntensity = bindings::MorphologyMethod_ErodeIntensityMorphology,
|
||||
DilateIntensity = bindings::MorphologyMethod_DilateIntensityMorphology,
|
||||
IterativeDistance = bindings::MorphologyMethod_IterativeDistanceMorphology,
|
||||
Open = bindings::MorphologyMethod_OpenMorphology,
|
||||
Close = bindings::MorphologyMethod_CloseMorphology,
|
||||
OpenIntensity = bindings::MorphologyMethod_OpenIntensityMorphology,
|
||||
CloseIntensity = bindings::MorphologyMethod_CloseIntensityMorphology,
|
||||
Smooth = bindings::MorphologyMethod_SmoothMorphology,
|
||||
EdgeIn = bindings::MorphologyMethod_EdgeInMorphology,
|
||||
EdgeOut = bindings::MorphologyMethod_EdgeOutMorphology,
|
||||
Edge = bindings::MorphologyMethod_EdgeMorphology,
|
||||
TopHat = bindings::MorphologyMethod_TopHatMorphology,
|
||||
BottomHat = bindings::MorphologyMethod_BottomHatMorphology,
|
||||
HitAndMiss = bindings::MorphologyMethod_HitAndMissMorphology,
|
||||
Thinning = bindings::MorphologyMethod_ThinningMorphology,
|
||||
Thicken = bindings::MorphologyMethod_ThickenMorphology,
|
||||
Distance = bindings::MorphologyMethod_DistanceMorphology,
|
||||
Voronoi = bindings::MorphologyMethod_VoronoiMorphology,
|
||||
Open = bindings::MorphologyMethod_OpenMorphology,
|
||||
Close = bindings::MorphologyMethod_CloseMorphology,
|
||||
OpenIntensity = bindings::MorphologyMethod_OpenIntensityMorphology,
|
||||
CloseIntensity = bindings::MorphologyMethod_CloseIntensityMorphology,
|
||||
Smooth = bindings::MorphologyMethod_SmoothMorphology,
|
||||
EdgeIn = bindings::MorphologyMethod_EdgeInMorphology,
|
||||
EdgeOut = bindings::MorphologyMethod_EdgeOutMorphology,
|
||||
Edge = bindings::MorphologyMethod_EdgeMorphology,
|
||||
TopHat = bindings::MorphologyMethod_TopHatMorphology,
|
||||
BottomHat = bindings::MorphologyMethod_BottomHatMorphology,
|
||||
HitAndMiss = bindings::MorphologyMethod_HitAndMissMorphology,
|
||||
Thinning = bindings::MorphologyMethod_ThinningMorphology,
|
||||
Thicken = bindings::MorphologyMethod_ThickenMorphology,
|
||||
Distance = bindings::MorphologyMethod_DistanceMorphology,
|
||||
Voronoi = bindings::MorphologyMethod_VoronoiMorphology,
|
||||
}
|
||||
|
||||
impl Default for MorphologyMethod {
|
||||
@ -101,9 +98,6 @@ impl From<MorphologyMethod> for bindings::KernelInfoType {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// Builder, that creates instances of [KernelInfo](self::KernelInfo)
|
||||
///
|
||||
/// # Examples
|
||||
@ -197,28 +191,25 @@ impl KernelBuilder {
|
||||
}
|
||||
|
||||
pub fn build(&self) -> Result<KernelInfo> {
|
||||
let size = self.size.ok_or(MagickError("no kernel size given".to_string()))?;
|
||||
let values = self.values.as_ref().ok_or(MagickError("no kernel values given".to_string()))?;
|
||||
let size = self
|
||||
.size
|
||||
.ok_or(MagickError("no kernel size given".to_string()))?;
|
||||
let values = self
|
||||
.values
|
||||
.as_ref()
|
||||
.ok_or(MagickError("no kernel values given".to_string()))?;
|
||||
|
||||
if values.len() != size.0 * size.1 {
|
||||
return Err(MagickError("kernel size doesn't match kernel values size".to_string()));
|
||||
return Err(MagickError(
|
||||
"kernel size doesn't match kernel values size".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
// Create kernel string
|
||||
let mut kernel_string = if let Some(center) = self.center {
|
||||
format!(
|
||||
"{}x{}+{}+{}:",
|
||||
size.0,
|
||||
size.1,
|
||||
center.0,
|
||||
center.1
|
||||
)
|
||||
format!("{}x{}+{}+{}:", size.0, size.1, center.0, center.1)
|
||||
} else {
|
||||
format!(
|
||||
"{}x{}:",
|
||||
size.0,
|
||||
size.1,
|
||||
)
|
||||
format!("{}x{}:", size.0, size.1,)
|
||||
};
|
||||
|
||||
// Add values
|
||||
@ -233,12 +224,8 @@ impl KernelBuilder {
|
||||
let c_kernel_string = CString::new(kernel_string).expect("CString::new() has failed");
|
||||
|
||||
// Create kernel info
|
||||
let kernel_info = unsafe {
|
||||
bindings::AcquireKernelInfo(
|
||||
c_kernel_string.as_ptr(),
|
||||
std::ptr::null_mut()
|
||||
)
|
||||
};
|
||||
let kernel_info =
|
||||
unsafe { bindings::AcquireKernelInfo(c_kernel_string.as_ptr(), std::ptr::null_mut()) };
|
||||
|
||||
if kernel_info.is_null() {
|
||||
return Err(MagickError("failed to acquire kernel info".to_string()));
|
||||
@ -260,20 +247,22 @@ impl KernelBuilder {
|
||||
}
|
||||
|
||||
pub fn build_builtin(&self) -> Result<KernelInfo> {
|
||||
let info_type = self.info_type.ok_or(MagickError("no info type given".to_string()))?;
|
||||
let mut geom_info = self.geom_info.ok_or(MagickError("no geometry info given".to_string()))?;
|
||||
let info_type = self
|
||||
.info_type
|
||||
.ok_or(MagickError("no info type given".to_string()))?;
|
||||
let mut geom_info = self
|
||||
.geom_info
|
||||
.ok_or(MagickError("no geometry info given".to_string()))?;
|
||||
|
||||
// Create kernel info
|
||||
let kernel_info = unsafe {
|
||||
bindings::AcquireKernelBuiltIn(
|
||||
info_type.into(),
|
||||
&mut geom_info,
|
||||
std::ptr::null_mut()
|
||||
)
|
||||
bindings::AcquireKernelBuiltIn(info_type.into(), &mut geom_info, std::ptr::null_mut())
|
||||
};
|
||||
|
||||
if kernel_info.is_null() {
|
||||
return Err(MagickError("failed to acquire builtin kernel info".to_string()));
|
||||
return Err(MagickError(
|
||||
"failed to acquire builtin kernel info".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
Ok(KernelInfo::new(kernel_info))
|
||||
@ -286,20 +275,12 @@ pub struct KernelInfo {
|
||||
|
||||
impl KernelInfo {
|
||||
fn new(kernel_info: *mut bindings::KernelInfo) -> KernelInfo {
|
||||
return KernelInfo {
|
||||
kernel_info
|
||||
};
|
||||
return KernelInfo { kernel_info };
|
||||
}
|
||||
|
||||
/// The values within the kernel is scaled directly using given scaling factor without change.
|
||||
pub fn scale(&mut self, factor: f64) {
|
||||
unsafe {
|
||||
bindings::ScaleKernelInfo(
|
||||
self.kernel_info,
|
||||
factor,
|
||||
0
|
||||
)
|
||||
}
|
||||
unsafe { bindings::ScaleKernelInfo(self.kernel_info, factor, 0) }
|
||||
}
|
||||
|
||||
/// Kernel normalization is designed to ensure that any use of the kernel scaling factor with
|
||||
@ -323,7 +304,7 @@ impl KernelInfo {
|
||||
bindings::ScaleKernelInfo(
|
||||
self.kernel_info,
|
||||
1.0,
|
||||
bindings::GeometryFlags_NormalizeValue
|
||||
bindings::GeometryFlags_NormalizeValue,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -337,7 +318,7 @@ impl KernelInfo {
|
||||
bindings::ScaleKernelInfo(
|
||||
self.kernel_info,
|
||||
1.0,
|
||||
bindings::GeometryFlags_CorrelateNormalizeValue
|
||||
bindings::GeometryFlags_CorrelateNormalizeValue,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -350,12 +331,7 @@ impl KernelInfo {
|
||||
/// The resulting effect is to convert the defined kernels into blended soft-blurs, unsharp
|
||||
/// kernels or into sharpening kernels.
|
||||
pub fn unity_add(&mut self, scale: f64) {
|
||||
unsafe {
|
||||
bindings::UnityAddKernelInfo(
|
||||
self.kernel_info,
|
||||
scale
|
||||
)
|
||||
}
|
||||
unsafe { bindings::UnityAddKernelInfo(self.kernel_info, scale) }
|
||||
}
|
||||
|
||||
pub unsafe fn get_ptr(&self) -> *mut bindings::KernelInfo {
|
||||
@ -371,9 +347,7 @@ impl Drop for KernelInfo {
|
||||
|
||||
impl Clone for KernelInfo {
|
||||
fn clone(&self) -> Self {
|
||||
let kernel_info = unsafe {
|
||||
bindings::CloneKernelInfo(self.kernel_info)
|
||||
};
|
||||
let kernel_info = unsafe { bindings::CloneKernelInfo(self.kernel_info) };
|
||||
|
||||
if kernel_info.is_null() {
|
||||
panic!("failed to clone kernel info");
|
||||
|
||||
@ -3,23 +3,23 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum LayerMethod {
|
||||
Undefined = bindings::LayerMethod_UndefinedLayer,
|
||||
Coalesce = bindings::LayerMethod_CoalesceLayer,
|
||||
CompareAny = bindings::LayerMethod_CompareAnyLayer,
|
||||
CompareClear = bindings::LayerMethod_CompareClearLayer,
|
||||
Undefined = bindings::LayerMethod_UndefinedLayer,
|
||||
Coalesce = bindings::LayerMethod_CoalesceLayer,
|
||||
CompareAny = bindings::LayerMethod_CompareAnyLayer,
|
||||
CompareClear = bindings::LayerMethod_CompareClearLayer,
|
||||
CompareOverlay = bindings::LayerMethod_CompareOverlayLayer,
|
||||
Dispose = bindings::LayerMethod_DisposeLayer,
|
||||
Optimize = bindings::LayerMethod_OptimizeLayer,
|
||||
OptimizeImage = bindings::LayerMethod_OptimizeImageLayer,
|
||||
OptimizePlus = bindings::LayerMethod_OptimizePlusLayer,
|
||||
OptimizeTrans = bindings::LayerMethod_OptimizeTransLayer,
|
||||
RemoveDups = bindings::LayerMethod_RemoveDupsLayer,
|
||||
RemoveZero = bindings::LayerMethod_RemoveZeroLayer,
|
||||
Composite = bindings::LayerMethod_CompositeLayer,
|
||||
Merge = bindings::LayerMethod_MergeLayer,
|
||||
Flatten = bindings::LayerMethod_FlattenLayer,
|
||||
Mosaic = bindings::LayerMethod_MosaicLayer,
|
||||
TrimBounds = bindings::LayerMethod_TrimBoundsLayer,
|
||||
Dispose = bindings::LayerMethod_DisposeLayer,
|
||||
Optimize = bindings::LayerMethod_OptimizeLayer,
|
||||
OptimizeImage = bindings::LayerMethod_OptimizeImageLayer,
|
||||
OptimizePlus = bindings::LayerMethod_OptimizePlusLayer,
|
||||
OptimizeTrans = bindings::LayerMethod_OptimizeTransLayer,
|
||||
RemoveDups = bindings::LayerMethod_RemoveDupsLayer,
|
||||
RemoveZero = bindings::LayerMethod_RemoveZeroLayer,
|
||||
Composite = bindings::LayerMethod_CompositeLayer,
|
||||
Merge = bindings::LayerMethod_MergeLayer,
|
||||
Flatten = bindings::LayerMethod_FlattenLayer,
|
||||
Mosaic = bindings::LayerMethod_MosaicLayer,
|
||||
TrimBounds = bindings::LayerMethod_TrimBoundsLayer,
|
||||
}
|
||||
|
||||
impl Default for LayerMethod {
|
||||
|
||||
@ -4,9 +4,9 @@ use crate::bindings;
|
||||
#[repr(u32)]
|
||||
pub enum LineCap {
|
||||
Undefined = bindings::LineCap_UndefinedCap,
|
||||
Butt = bindings::LineCap_ButtCap,
|
||||
Round = bindings::LineCap_RoundCap,
|
||||
Square = bindings::LineCap_SquareCap,
|
||||
Butt = bindings::LineCap_ButtCap,
|
||||
Round = bindings::LineCap_RoundCap,
|
||||
Square = bindings::LineCap_SquareCap,
|
||||
}
|
||||
|
||||
impl Default for LineCap {
|
||||
|
||||
@ -4,9 +4,9 @@ use crate::bindings;
|
||||
#[repr(u32)]
|
||||
pub enum LineJoin {
|
||||
Undefined = bindings::LineJoin_UndefinedJoin,
|
||||
Miter = bindings::LineJoin_MiterJoin,
|
||||
Round = bindings::LineJoin_RoundJoin,
|
||||
Bevel = bindings::LineJoin_BevelJoin,
|
||||
Miter = bindings::LineJoin_MiterJoin,
|
||||
Round = bindings::LineJoin_RoundJoin,
|
||||
Bevel = bindings::LineJoin_BevelJoin,
|
||||
}
|
||||
|
||||
impl Default for LineJoin {
|
||||
|
||||
@ -3,40 +3,40 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum MagickEvaluateOperator {
|
||||
Undefined = bindings::MagickEvaluateOperator_UndefinedEvaluateOperator,
|
||||
Abs = bindings::MagickEvaluateOperator_AbsEvaluateOperator,
|
||||
Add = bindings::MagickEvaluateOperator_AddEvaluateOperator,
|
||||
AddModulus = bindings::MagickEvaluateOperator_AddModulusEvaluateOperator,
|
||||
And = bindings::MagickEvaluateOperator_AndEvaluateOperator,
|
||||
Cosine = bindings::MagickEvaluateOperator_CosineEvaluateOperator,
|
||||
Divide = bindings::MagickEvaluateOperator_DivideEvaluateOperator,
|
||||
Exponential = bindings::MagickEvaluateOperator_ExponentialEvaluateOperator,
|
||||
GaussianNoise = bindings::MagickEvaluateOperator_GaussianNoiseEvaluateOperator,
|
||||
ImpulseNoise = bindings::MagickEvaluateOperator_ImpulseNoiseEvaluateOperator,
|
||||
LaplacianNoise = bindings::MagickEvaluateOperator_LaplacianNoiseEvaluateOperator,
|
||||
LeftShift = bindings::MagickEvaluateOperator_LeftShiftEvaluateOperator,
|
||||
Log = bindings::MagickEvaluateOperator_LogEvaluateOperator,
|
||||
Max = bindings::MagickEvaluateOperator_MaxEvaluateOperator,
|
||||
Mean = bindings::MagickEvaluateOperator_MeanEvaluateOperator,
|
||||
Median = bindings::MagickEvaluateOperator_MedianEvaluateOperator,
|
||||
Min = bindings::MagickEvaluateOperator_MinEvaluateOperator,
|
||||
Undefined = bindings::MagickEvaluateOperator_UndefinedEvaluateOperator,
|
||||
Abs = bindings::MagickEvaluateOperator_AbsEvaluateOperator,
|
||||
Add = bindings::MagickEvaluateOperator_AddEvaluateOperator,
|
||||
AddModulus = bindings::MagickEvaluateOperator_AddModulusEvaluateOperator,
|
||||
And = bindings::MagickEvaluateOperator_AndEvaluateOperator,
|
||||
Cosine = bindings::MagickEvaluateOperator_CosineEvaluateOperator,
|
||||
Divide = bindings::MagickEvaluateOperator_DivideEvaluateOperator,
|
||||
Exponential = bindings::MagickEvaluateOperator_ExponentialEvaluateOperator,
|
||||
GaussianNoise = bindings::MagickEvaluateOperator_GaussianNoiseEvaluateOperator,
|
||||
ImpulseNoise = bindings::MagickEvaluateOperator_ImpulseNoiseEvaluateOperator,
|
||||
LaplacianNoise = bindings::MagickEvaluateOperator_LaplacianNoiseEvaluateOperator,
|
||||
LeftShift = bindings::MagickEvaluateOperator_LeftShiftEvaluateOperator,
|
||||
Log = bindings::MagickEvaluateOperator_LogEvaluateOperator,
|
||||
Max = bindings::MagickEvaluateOperator_MaxEvaluateOperator,
|
||||
Mean = bindings::MagickEvaluateOperator_MeanEvaluateOperator,
|
||||
Median = bindings::MagickEvaluateOperator_MedianEvaluateOperator,
|
||||
Min = bindings::MagickEvaluateOperator_MinEvaluateOperator,
|
||||
MultiplicativeNoise = bindings::MagickEvaluateOperator_MultiplicativeNoiseEvaluateOperator,
|
||||
Multiply = bindings::MagickEvaluateOperator_MultiplyEvaluateOperator,
|
||||
Or = bindings::MagickEvaluateOperator_OrEvaluateOperator,
|
||||
PoissonNoise = bindings::MagickEvaluateOperator_PoissonNoiseEvaluateOperator,
|
||||
Pow = bindings::MagickEvaluateOperator_PowEvaluateOperator,
|
||||
RightShift = bindings::MagickEvaluateOperator_RightShiftEvaluateOperator,
|
||||
RootMeanSquare = bindings::MagickEvaluateOperator_RootMeanSquareEvaluateOperator,
|
||||
Set = bindings::MagickEvaluateOperator_SetEvaluateOperator,
|
||||
Sine = bindings::MagickEvaluateOperator_SineEvaluateOperator,
|
||||
Subtract = bindings::MagickEvaluateOperator_SubtractEvaluateOperator,
|
||||
Sum = bindings::MagickEvaluateOperator_SumEvaluateOperator,
|
||||
ThresholdBlack = bindings::MagickEvaluateOperator_ThresholdBlackEvaluateOperator,
|
||||
Threshold = bindings::MagickEvaluateOperator_ThresholdEvaluateOperator,
|
||||
ThresholdWhite = bindings::MagickEvaluateOperator_ThresholdWhiteEvaluateOperator,
|
||||
UniformNoise = bindings::MagickEvaluateOperator_UniformNoiseEvaluateOperator,
|
||||
Xor = bindings::MagickEvaluateOperator_XorEvaluateOperator,
|
||||
InverseLog = bindings::MagickEvaluateOperator_InverseLogEvaluateOperator,
|
||||
Multiply = bindings::MagickEvaluateOperator_MultiplyEvaluateOperator,
|
||||
Or = bindings::MagickEvaluateOperator_OrEvaluateOperator,
|
||||
PoissonNoise = bindings::MagickEvaluateOperator_PoissonNoiseEvaluateOperator,
|
||||
Pow = bindings::MagickEvaluateOperator_PowEvaluateOperator,
|
||||
RightShift = bindings::MagickEvaluateOperator_RightShiftEvaluateOperator,
|
||||
RootMeanSquare = bindings::MagickEvaluateOperator_RootMeanSquareEvaluateOperator,
|
||||
Set = bindings::MagickEvaluateOperator_SetEvaluateOperator,
|
||||
Sine = bindings::MagickEvaluateOperator_SineEvaluateOperator,
|
||||
Subtract = bindings::MagickEvaluateOperator_SubtractEvaluateOperator,
|
||||
Sum = bindings::MagickEvaluateOperator_SumEvaluateOperator,
|
||||
ThresholdBlack = bindings::MagickEvaluateOperator_ThresholdBlackEvaluateOperator,
|
||||
Threshold = bindings::MagickEvaluateOperator_ThresholdEvaluateOperator,
|
||||
ThresholdWhite = bindings::MagickEvaluateOperator_ThresholdWhiteEvaluateOperator,
|
||||
UniformNoise = bindings::MagickEvaluateOperator_UniformNoiseEvaluateOperator,
|
||||
Xor = bindings::MagickEvaluateOperator_XorEvaluateOperator,
|
||||
InverseLog = bindings::MagickEvaluateOperator_InverseLogEvaluateOperator,
|
||||
}
|
||||
|
||||
impl Default for MagickEvaluateOperator {
|
||||
|
||||
@ -3,11 +3,11 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum MagickFunction {
|
||||
Undefined = bindings::MagickFunction_UndefinedFunction,
|
||||
Arcsin = bindings::MagickFunction_ArcsinFunction,
|
||||
Arctan = bindings::MagickFunction_ArctanFunction,
|
||||
Undefined = bindings::MagickFunction_UndefinedFunction,
|
||||
Arcsin = bindings::MagickFunction_ArcsinFunction,
|
||||
Arctan = bindings::MagickFunction_ArctanFunction,
|
||||
Polynomial = bindings::MagickFunction_PolynomialFunction,
|
||||
Sinusoid = bindings::MagickFunction_SinusoidFunction,
|
||||
Sinusoid = bindings::MagickFunction_SinusoidFunction,
|
||||
}
|
||||
|
||||
impl Default for MagickFunction {
|
||||
|
||||
@ -1,19 +1,20 @@
|
||||
use crate::bindings;
|
||||
|
||||
pub enum MetricType {
|
||||
Undefined = bindings::MetricType_UndefinedErrorMetric as isize,
|
||||
Absolute = bindings::MetricType_AbsoluteErrorMetric as isize,
|
||||
Fuzz = bindings::MetricType_FuzzErrorMetric as isize,
|
||||
MeanAbsolute = bindings::MetricType_MeanAbsoluteErrorMetric as isize,
|
||||
MeanErrorPerPixel = bindings::MetricType_MeanErrorPerPixelErrorMetric as isize,
|
||||
MeanSquared = bindings::MetricType_MeanSquaredErrorMetric as isize,
|
||||
NormalizedCrossCorrelation = bindings::MetricType_NormalizedCrossCorrelationErrorMetric as isize,
|
||||
PeakAbsolute = bindings::MetricType_PeakAbsoluteErrorMetric as isize,
|
||||
PeakSignalToNoiseRatio = bindings::MetricType_PeakSignalToNoiseRatioErrorMetric as isize,
|
||||
PerceptualHash = bindings::MetricType_PerceptualHashErrorMetric as isize,
|
||||
RootMeanSquared = bindings::MetricType_RootMeanSquaredErrorMetric as isize,
|
||||
StructuralSimilarity = bindings::MetricType_StructuralSimilarityErrorMetric as isize,
|
||||
StructuralDissimilarity = bindings::MetricType_StructuralDissimilarityErrorMetric as isize,
|
||||
Undefined = bindings::MetricType_UndefinedErrorMetric as isize,
|
||||
Absolute = bindings::MetricType_AbsoluteErrorMetric as isize,
|
||||
Fuzz = bindings::MetricType_FuzzErrorMetric as isize,
|
||||
MeanAbsolute = bindings::MetricType_MeanAbsoluteErrorMetric as isize,
|
||||
MeanErrorPerPixel = bindings::MetricType_MeanErrorPerPixelErrorMetric as isize,
|
||||
MeanSquared = bindings::MetricType_MeanSquaredErrorMetric as isize,
|
||||
NormalizedCrossCorrelation =
|
||||
bindings::MetricType_NormalizedCrossCorrelationErrorMetric as isize,
|
||||
PeakAbsolute = bindings::MetricType_PeakAbsoluteErrorMetric as isize,
|
||||
PeakSignalToNoiseRatio = bindings::MetricType_PeakSignalToNoiseRatioErrorMetric as isize,
|
||||
PerceptualHash = bindings::MetricType_PerceptualHashErrorMetric as isize,
|
||||
RootMeanSquared = bindings::MetricType_RootMeanSquaredErrorMetric as isize,
|
||||
StructuralSimilarity = bindings::MetricType_StructuralSimilarityErrorMetric as isize,
|
||||
StructuralDissimilarity = bindings::MetricType_StructuralDissimilarityErrorMetric as isize,
|
||||
}
|
||||
|
||||
impl Default for MetricType {
|
||||
|
||||
@ -3,15 +3,15 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum OrientationType {
|
||||
Undefined = bindings::OrientationType_UndefinedOrientation,
|
||||
TopLeft = bindings::OrientationType_TopLeftOrientation,
|
||||
TopRight = bindings::OrientationType_TopRightOrientation,
|
||||
Undefined = bindings::OrientationType_UndefinedOrientation,
|
||||
TopLeft = bindings::OrientationType_TopLeftOrientation,
|
||||
TopRight = bindings::OrientationType_TopRightOrientation,
|
||||
BottomRight = bindings::OrientationType_BottomRightOrientation,
|
||||
BottomLeft = bindings::OrientationType_BottomLeftOrientation,
|
||||
LeftTop = bindings::OrientationType_LeftTopOrientation,
|
||||
RightTop = bindings::OrientationType_RightTopOrientation,
|
||||
BottomLeft = bindings::OrientationType_BottomLeftOrientation,
|
||||
LeftTop = bindings::OrientationType_LeftTopOrientation,
|
||||
RightTop = bindings::OrientationType_RightTopOrientation,
|
||||
RightBottom = bindings::OrientationType_RightBottomOrientation,
|
||||
LeftBottom = bindings::OrientationType_LeftBottomOrientation,
|
||||
LeftBottom = bindings::OrientationType_LeftBottomOrientation,
|
||||
}
|
||||
|
||||
impl Default for OrientationType {
|
||||
|
||||
@ -3,18 +3,18 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum PixelInterpolateMethod {
|
||||
Undefined = bindings::PixelInterpolateMethod_UndefinedInterpolatePixel,
|
||||
Average = bindings::PixelInterpolateMethod_AverageInterpolatePixel,
|
||||
Average9 = bindings::PixelInterpolateMethod_Average9InterpolatePixel,
|
||||
Average16 = bindings::PixelInterpolateMethod_Average16InterpolatePixel,
|
||||
Undefined = bindings::PixelInterpolateMethod_UndefinedInterpolatePixel,
|
||||
Average = bindings::PixelInterpolateMethod_AverageInterpolatePixel,
|
||||
Average9 = bindings::PixelInterpolateMethod_Average9InterpolatePixel,
|
||||
Average16 = bindings::PixelInterpolateMethod_Average16InterpolatePixel,
|
||||
Background = bindings::PixelInterpolateMethod_BackgroundInterpolatePixel,
|
||||
Bilinear = bindings::PixelInterpolateMethod_BilinearInterpolatePixel,
|
||||
Blend = bindings::PixelInterpolateMethod_BlendInterpolatePixel,
|
||||
Catrom = bindings::PixelInterpolateMethod_CatromInterpolatePixel,
|
||||
Integer = bindings::PixelInterpolateMethod_IntegerInterpolatePixel,
|
||||
Mesh = bindings::PixelInterpolateMethod_MeshInterpolatePixel,
|
||||
Nearest = bindings::PixelInterpolateMethod_NearestInterpolatePixel,
|
||||
Spline = bindings::PixelInterpolateMethod_SplineInterpolatePixel,
|
||||
Bilinear = bindings::PixelInterpolateMethod_BilinearInterpolatePixel,
|
||||
Blend = bindings::PixelInterpolateMethod_BlendInterpolatePixel,
|
||||
Catrom = bindings::PixelInterpolateMethod_CatromInterpolatePixel,
|
||||
Integer = bindings::PixelInterpolateMethod_IntegerInterpolatePixel,
|
||||
Mesh = bindings::PixelInterpolateMethod_MeshInterpolatePixel,
|
||||
Nearest = bindings::PixelInterpolateMethod_NearestInterpolatePixel,
|
||||
Spline = bindings::PixelInterpolateMethod_SplineInterpolatePixel,
|
||||
}
|
||||
|
||||
impl Default for PixelInterpolateMethod {
|
||||
|
||||
@ -4,8 +4,8 @@ use crate::bindings;
|
||||
#[repr(u32)]
|
||||
pub enum PixelMask {
|
||||
Undefined = bindings::PixelMask_UndefinedPixelMask,
|
||||
Read = bindings::PixelMask_ReadPixelMask,
|
||||
Write = bindings::PixelMask_WritePixelMask,
|
||||
Read = bindings::PixelMask_ReadPixelMask,
|
||||
Write = bindings::PixelMask_WritePixelMask,
|
||||
Composite = bindings::PixelMask_CompositePixelMask,
|
||||
}
|
||||
|
||||
|
||||
@ -3,11 +3,11 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum RenderingIntent {
|
||||
Undefined = bindings::RenderingIntent_UndefinedIntent,
|
||||
Undefined = bindings::RenderingIntent_UndefinedIntent,
|
||||
Saturation = bindings::RenderingIntent_SaturationIntent,
|
||||
Perceptual = bindings::RenderingIntent_PerceptualIntent,
|
||||
Absolute = bindings::RenderingIntent_AbsoluteIntent,
|
||||
Relative = bindings::RenderingIntent_RelativeIntent,
|
||||
Absolute = bindings::RenderingIntent_AbsoluteIntent,
|
||||
Relative = bindings::RenderingIntent_RelativeIntent,
|
||||
}
|
||||
|
||||
impl Default for RenderingIntent {
|
||||
|
||||
@ -3,8 +3,8 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum ResolutionType {
|
||||
Undefined = bindings::ResolutionType_UndefinedResolution,
|
||||
PixelsPerInch = bindings::ResolutionType_PixelsPerInchResolution,
|
||||
Undefined = bindings::ResolutionType_UndefinedResolution,
|
||||
PixelsPerInch = bindings::ResolutionType_PixelsPerInchResolution,
|
||||
PixelsPerCentimeter = bindings::ResolutionType_PixelsPerCentimeterResolution,
|
||||
}
|
||||
|
||||
|
||||
@ -3,17 +3,17 @@ use crate::bindings;
|
||||
/// Resource type to use with [set_resource_limit](crate::MagickWand::set_resource_limit)
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ResourceType {
|
||||
Undefined = bindings::ResourceType_UndefinedResource as isize,
|
||||
Area = bindings::ResourceType_AreaResource as isize,
|
||||
Disk = bindings::ResourceType_DiskResource as isize,
|
||||
File = bindings::ResourceType_FileResource as isize,
|
||||
Height = bindings::ResourceType_HeightResource as isize,
|
||||
Map = bindings::ResourceType_MapResource as isize,
|
||||
Memory = bindings::ResourceType_MemoryResource as isize,
|
||||
Thread = bindings::ResourceType_ThreadResource as isize,
|
||||
Throttle = bindings::ResourceType_ThrottleResource as isize,
|
||||
Time = bindings::ResourceType_TimeResource as isize,
|
||||
Width = bindings::ResourceType_WidthResource as isize,
|
||||
Undefined = bindings::ResourceType_UndefinedResource as isize,
|
||||
Area = bindings::ResourceType_AreaResource as isize,
|
||||
Disk = bindings::ResourceType_DiskResource as isize,
|
||||
File = bindings::ResourceType_FileResource as isize,
|
||||
Height = bindings::ResourceType_HeightResource as isize,
|
||||
Map = bindings::ResourceType_MapResource as isize,
|
||||
Memory = bindings::ResourceType_MemoryResource as isize,
|
||||
Thread = bindings::ResourceType_ThreadResource as isize,
|
||||
Throttle = bindings::ResourceType_ThrottleResource as isize,
|
||||
Time = bindings::ResourceType_TimeResource as isize,
|
||||
Width = bindings::ResourceType_WidthResource as isize,
|
||||
ListLength = bindings::ResourceType_ListLengthResource as isize,
|
||||
}
|
||||
|
||||
|
||||
@ -3,17 +3,17 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum StatisticType {
|
||||
Undefined = bindings::StatisticType_UndefinedStatistic,
|
||||
Gradient = bindings::StatisticType_GradientStatistic,
|
||||
Maximum = bindings::StatisticType_MaximumStatistic,
|
||||
Mean = bindings::StatisticType_MeanStatistic,
|
||||
Median = bindings::StatisticType_MedianStatistic,
|
||||
Minimum = bindings::StatisticType_MinimumStatistic,
|
||||
Mode = bindings::StatisticType_ModeStatistic,
|
||||
Nonpeak = bindings::StatisticType_NonpeakStatistic,
|
||||
RootMeanSquare = bindings::StatisticType_RootMeanSquareStatistic,
|
||||
Undefined = bindings::StatisticType_UndefinedStatistic,
|
||||
Gradient = bindings::StatisticType_GradientStatistic,
|
||||
Maximum = bindings::StatisticType_MaximumStatistic,
|
||||
Mean = bindings::StatisticType_MeanStatistic,
|
||||
Median = bindings::StatisticType_MedianStatistic,
|
||||
Minimum = bindings::StatisticType_MinimumStatistic,
|
||||
Mode = bindings::StatisticType_ModeStatistic,
|
||||
Nonpeak = bindings::StatisticType_NonpeakStatistic,
|
||||
RootMeanSquare = bindings::StatisticType_RootMeanSquareStatistic,
|
||||
StandardDeviation = bindings::StatisticType_StandardDeviationStatistic,
|
||||
Contrast = bindings::StatisticType_ContrastStatistic,
|
||||
Contrast = bindings::StatisticType_ContrastStatistic,
|
||||
}
|
||||
|
||||
impl Default for StatisticType {
|
||||
|
||||
@ -3,17 +3,17 @@ use crate::bindings;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum StretchType {
|
||||
Undefined = bindings::StretchType_UndefinedStretch,
|
||||
Normal = bindings::StretchType_NormalStretch,
|
||||
Undefined = bindings::StretchType_UndefinedStretch,
|
||||
Normal = bindings::StretchType_NormalStretch,
|
||||
UltraCondensed = bindings::StretchType_UltraCondensedStretch,
|
||||
ExtraCondensed = bindings::StretchType_ExtraCondensedStretch,
|
||||
Condensed = bindings::StretchType_CondensedStretch,
|
||||
SemiCondensed = bindings::StretchType_SemiCondensedStretch,
|
||||
SemiExpanded = bindings::StretchType_SemiExpandedStretch,
|
||||
Expanded = bindings::StretchType_ExpandedStretch,
|
||||
ExtraExpanded = bindings::StretchType_ExtraExpandedStretch,
|
||||
UltraExpanded = bindings::StretchType_UltraExpandedStretch,
|
||||
Any = bindings::StretchType_AnyStretch,
|
||||
Condensed = bindings::StretchType_CondensedStretch,
|
||||
SemiCondensed = bindings::StretchType_SemiCondensedStretch,
|
||||
SemiExpanded = bindings::StretchType_SemiExpandedStretch,
|
||||
Expanded = bindings::StretchType_ExpandedStretch,
|
||||
ExtraExpanded = bindings::StretchType_ExtraExpandedStretch,
|
||||
UltraExpanded = bindings::StretchType_UltraExpandedStretch,
|
||||
Any = bindings::StretchType_AnyStretch,
|
||||
}
|
||||
|
||||
impl Default for StretchType {
|
||||
|
||||
@ -4,11 +4,11 @@ use crate::bindings;
|
||||
#[repr(u32)]
|
||||
pub enum StyleType {
|
||||
Undefined = bindings::StyleType_UndefinedStyle,
|
||||
Normal = bindings::StyleType_NormalStyle,
|
||||
Italic = bindings::StyleType_ItalicStyle,
|
||||
Oblique = bindings::StyleType_ObliqueStyle,
|
||||
Any = bindings::StyleType_AnyStyle,
|
||||
Bold = bindings::StyleType_BoldStyle,
|
||||
Normal = bindings::StyleType_NormalStyle,
|
||||
Italic = bindings::StyleType_ItalicStyle,
|
||||
Oblique = bindings::StyleType_ObliqueStyle,
|
||||
Any = bindings::StyleType_AnyStyle,
|
||||
Bold = bindings::StyleType_BoldStyle,
|
||||
}
|
||||
|
||||
impl Default for StyleType {
|
||||
|
||||
@ -21,16 +21,8 @@ use bindings;
|
||||
use crate::result::MagickError;
|
||||
use crate::result::Result;
|
||||
use crate::{
|
||||
AlignType,
|
||||
ClipPathUnits,
|
||||
DecorationType,
|
||||
DirectionType,
|
||||
FillRule,
|
||||
GravityType,
|
||||
LineCap,
|
||||
LineJoin,
|
||||
StretchType,
|
||||
StyleType,
|
||||
AlignType, ClipPathUnits, DecorationType, DirectionType, FillRule, GravityType, LineCap,
|
||||
LineJoin, StretchType, StyleType,
|
||||
};
|
||||
|
||||
wand_common!(
|
||||
|
||||
@ -40,11 +40,9 @@ macro_rules! wand_common {
|
||||
pub fn clear_exception(&mut self) -> Result<()> {
|
||||
match unsafe { ::bindings::$clear_exc(self.wand) } {
|
||||
::bindings::MagickBooleanType_MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(concat!(
|
||||
"failed to clear",
|
||||
stringify!($wand),
|
||||
"exception"
|
||||
).to_string())),
|
||||
_ => Err(MagickError(
|
||||
concat!("failed to clear", stringify!($wand), "exception").to_string(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,17 +56,14 @@ macro_rules! wand_common {
|
||||
|
||||
let ptr = unsafe { ::bindings::$get_exc(self.wand, &mut severity as *mut _) };
|
||||
if ptr.is_null() {
|
||||
Err(MagickError(concat!(
|
||||
"null ptr returned by",
|
||||
stringify!($wand),
|
||||
"get_exception"
|
||||
).to_string()))
|
||||
Err(MagickError(
|
||||
concat!("null ptr returned by", stringify!($wand), "get_exception")
|
||||
.to_string(),
|
||||
))
|
||||
} else {
|
||||
let c_str = unsafe { CStr::from_ptr(ptr) };
|
||||
let exception = c_str.to_string_lossy().into_owned();
|
||||
unsafe {
|
||||
::bindings::RelinquishMagickMemory(ptr as *mut ::libc::c_void)
|
||||
};
|
||||
unsafe { ::bindings::RelinquishMagickMemory(ptr as *mut ::libc::c_void) };
|
||||
Ok((exception, severity))
|
||||
}
|
||||
}
|
||||
@ -76,7 +71,9 @@ macro_rules! wand_common {
|
||||
pub fn is_wand(&self) -> Result<()> {
|
||||
match unsafe { ::bindings::$is_wand(self.wand) } {
|
||||
::bindings::MagickBooleanType_MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(concat!(stringify!($wand), " not a wand").to_string())),
|
||||
_ => Err(MagickError(
|
||||
concat!(stringify!($wand), " not a wand").to_string(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,10 +156,9 @@ macro_rules! string_get {
|
||||
pub fn $get(&self) -> Result<String> {
|
||||
let ptr = unsafe { ::bindings::$c_get(self.wand) };
|
||||
if ptr.is_null() {
|
||||
Err(MagickError(concat!(
|
||||
"null ptr returned by ",
|
||||
stringify!($get)
|
||||
).to_string()))
|
||||
Err(MagickError(
|
||||
concat!("null ptr returned by ", stringify!($get)).to_string(),
|
||||
))
|
||||
} else {
|
||||
let c_str = unsafe { ::std::ffi::CStr::from_ptr(ptr) };
|
||||
let result: String = c_str.to_string_lossy().into_owned();
|
||||
|
||||
@ -26,38 +26,16 @@ use result::MagickError;
|
||||
#[cfg(not(target_os = "freebsd"))]
|
||||
use size_t;
|
||||
|
||||
use super::{MagickFalse, MagickTrue};
|
||||
use crate::result::Result;
|
||||
use super::{MagickTrue, MagickFalse};
|
||||
|
||||
use super::{DrawingWand, PixelWand};
|
||||
use crate::{
|
||||
AlphaChannelOption,
|
||||
AutoThresholdMethod,
|
||||
ChannelType,
|
||||
ColorspaceType,
|
||||
CompositeOperator,
|
||||
CompressionType,
|
||||
DisposeType,
|
||||
DitherMethod,
|
||||
EndianType,
|
||||
FilterType,
|
||||
GravityType,
|
||||
Image,
|
||||
ImageType,
|
||||
InterlaceType,
|
||||
KernelInfo,
|
||||
LayerMethod,
|
||||
MagickEvaluateOperator,
|
||||
MagickFunction,
|
||||
MetricType,
|
||||
MorphologyMethod,
|
||||
OrientationType,
|
||||
PixelInterpolateMethod,
|
||||
PixelMask,
|
||||
RenderingIntent,
|
||||
ResolutionType,
|
||||
ResourceType,
|
||||
StatisticType,
|
||||
AlphaChannelOption, AutoThresholdMethod, ChannelType, ColorspaceType, CompositeOperator,
|
||||
CompressionType, DisposeType, DitherMethod, EndianType, FilterType, GravityType, Image,
|
||||
ImageType, InterlaceType, KernelInfo, LayerMethod, MagickEvaluateOperator, MagickFunction,
|
||||
MetricType, MorphologyMethod, OrientationType, PixelInterpolateMethod, PixelMask,
|
||||
RenderingIntent, ResolutionType, ResourceType, StatisticType,
|
||||
};
|
||||
|
||||
wand_common!(
|
||||
@ -83,19 +61,21 @@ impl MagickWand {
|
||||
///
|
||||
/// * `img`: the image.
|
||||
pub fn new_from_image(img: &Image<'_>) -> Result<MagickWand> {
|
||||
let result = unsafe {
|
||||
bindings::NewMagickWandFromImage(img.get_ptr())
|
||||
};
|
||||
let result = unsafe { bindings::NewMagickWandFromImage(img.get_ptr()) };
|
||||
|
||||
return if result.is_null() {
|
||||
Err(MagickError("failed to create magick wand from image".to_string()))
|
||||
Err(MagickError(
|
||||
"failed to create magick wand from image".to_string(),
|
||||
))
|
||||
} else {
|
||||
Ok(MagickWand { wand: result })
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub fn new_image(&self, columns: usize, rows: usize, background: &PixelWand) -> Result<()> {
|
||||
match unsafe { bindings::MagickNewImage(self.wand, columns.into(), rows.into(), background.wand) } {
|
||||
match unsafe {
|
||||
bindings::MagickNewImage(self.wand, columns.into(), rows.into(), background.wand)
|
||||
} {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -105,10 +85,7 @@ impl MagickWand {
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
pub fn set_resource_limit(resource: ResourceType, limit: u64) -> Result<()> {
|
||||
let result = unsafe {
|
||||
bindings::SetMagickResourceLimit(
|
||||
resource.into(),
|
||||
limit as bindings::MagickSizeType,
|
||||
)
|
||||
bindings::SetMagickResourceLimit(resource.into(), limit as bindings::MagickSizeType)
|
||||
};
|
||||
match result {
|
||||
MagickTrue => Ok(()),
|
||||
@ -261,9 +238,7 @@ impl MagickWand {
|
||||
/// MosaicLayer: Start with the virtual canvas of the first image, enlarging left and right
|
||||
/// edges to contain all images. Images with negative offsets will be clipped.
|
||||
pub fn merge_image_layers(&self, method: LayerMethod) -> Result<MagickWand> {
|
||||
let result = unsafe {
|
||||
bindings::MagickMergeImageLayers(self.wand, method.into())
|
||||
};
|
||||
let result = unsafe { bindings::MagickMergeImageLayers(self.wand, method.into()) };
|
||||
if result.is_null() {
|
||||
return Err(MagickError("failed to merge image layers".to_string()));
|
||||
}
|
||||
@ -357,11 +332,7 @@ impl MagickWand {
|
||||
}
|
||||
|
||||
// Replaces colors in the image from a color lookup table.
|
||||
pub fn clut_image(
|
||||
&self,
|
||||
clut_wand: &MagickWand,
|
||||
method: PixelInterpolateMethod,
|
||||
) -> Result<()> {
|
||||
pub fn clut_image(&self, clut_wand: &MagickWand, method: PixelInterpolateMethod) -> Result<()> {
|
||||
let result = unsafe { bindings::MagickClutImage(self.wand, clut_wand.wand, method.into()) };
|
||||
match result {
|
||||
MagickTrue => Ok(()),
|
||||
@ -378,7 +349,8 @@ impl MagickWand {
|
||||
}
|
||||
|
||||
pub fn fx(&mut self, expression: &str) -> Result<MagickWand> {
|
||||
let c_expression = CString::new(expression).map_err(|_| "expression string contains null byte")?;
|
||||
let c_expression =
|
||||
CString::new(expression).map_err(|_| "expression string contains null byte")?;
|
||||
let wand = unsafe { bindings::MagickFxImage(self.wand, c_expression.as_ptr()) };
|
||||
if wand.is_null() {
|
||||
Err(MagickError("failed to fx the image".to_string()))
|
||||
@ -411,7 +383,9 @@ impl MagickWand {
|
||||
16 => Ok(65535.0f64),
|
||||
32 => Ok(4294967295.0f64),
|
||||
64 => Ok(18446744073709551615.0f64),
|
||||
_ => Err(MagickError("Quantum depth must be one of 8, 16, 32 or 64".to_string())),
|
||||
_ => Err(MagickError(
|
||||
"Quantum depth must be one of 8, 16, 32 or 64".to_string(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -456,14 +430,8 @@ impl MagickWand {
|
||||
|
||||
//MagickNormalizeImage enhances the contrast of a color image by adjusting the pixels color
|
||||
//to span the entire range of colors available
|
||||
pub fn normalize_image(
|
||||
&self,
|
||||
) -> Result<()> {
|
||||
let result = unsafe {
|
||||
bindings::MagickNormalizeImage(
|
||||
self.wand,
|
||||
)
|
||||
};
|
||||
pub fn normalize_image(&self) -> Result<()> {
|
||||
let result = unsafe { bindings::MagickNormalizeImage(self.wand) };
|
||||
match result {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
@ -473,18 +441,12 @@ impl MagickWand {
|
||||
//MagickOrderedDitherImage performs an ordered dither based on a number of pre-defined
|
||||
//dithering threshold maps, but over multiple intensity levels, which can be different for
|
||||
//different channels, according to the input arguments.
|
||||
pub fn ordered_dither_image(
|
||||
&self,
|
||||
threshold_map: &str,
|
||||
) -> Result<()> {
|
||||
let c_threshold_map = CString::new(threshold_map).map_err(|_| "threshold_map string contains null byte")?;
|
||||
pub fn ordered_dither_image(&self, threshold_map: &str) -> Result<()> {
|
||||
let c_threshold_map =
|
||||
CString::new(threshold_map).map_err(|_| "threshold_map string contains null byte")?;
|
||||
|
||||
let result = unsafe {
|
||||
bindings::MagickOrderedDitherImage(
|
||||
self.wand,
|
||||
c_threshold_map.as_ptr(),
|
||||
)
|
||||
};
|
||||
let result =
|
||||
unsafe { bindings::MagickOrderedDitherImage(self.wand, c_threshold_map.as_ptr()) };
|
||||
match result {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
@ -576,9 +538,7 @@ impl MagickWand {
|
||||
}
|
||||
|
||||
pub fn negate_image(&self) -> Result<()> {
|
||||
let result = unsafe {
|
||||
bindings::MagickNegateImage(self.wand, MagickTrue)
|
||||
};
|
||||
let result = unsafe { bindings::MagickNegateImage(self.wand, MagickTrue) };
|
||||
match result {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
@ -625,7 +585,7 @@ impl MagickWand {
|
||||
self.wand,
|
||||
statistic_type.into(),
|
||||
width.into(),
|
||||
height.into()
|
||||
height.into(),
|
||||
)
|
||||
} {
|
||||
MagickTrue => Ok(()),
|
||||
@ -687,12 +647,11 @@ impl MagickWand {
|
||||
|
||||
/// Reset the Wand page canvas and position.
|
||||
pub fn reset_image_page(&self, page_geometry: &str) -> Result<()> {
|
||||
let c_page_geometry = CString::new(page_geometry).map_err(|_| "page_geometry contains null byte")?;
|
||||
match unsafe {
|
||||
bindings::MagickResetImagePage(self.wand, c_page_geometry.as_ptr())
|
||||
} {
|
||||
let c_page_geometry =
|
||||
CString::new(page_geometry).map_err(|_| "page_geometry contains null byte")?;
|
||||
match unsafe { bindings::MagickResetImagePage(self.wand, c_page_geometry.as_ptr()) } {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0))
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -700,20 +659,18 @@ impl MagickWand {
|
||||
///
|
||||
/// * `artifact`: the artifact.
|
||||
pub fn get_image_artifact(&self, artifact: &str) -> Result<String> {
|
||||
let c_artifact = CString::new(artifact).map_err(|_| "artifact string contains null byte")?;
|
||||
let c_artifact =
|
||||
CString::new(artifact).map_err(|_| "artifact string contains null byte")?;
|
||||
|
||||
let c_value = unsafe {
|
||||
bindings::MagickGetImageArtifact(
|
||||
self.wand,
|
||||
c_artifact.as_ptr()
|
||||
)
|
||||
};
|
||||
let c_value = unsafe { bindings::MagickGetImageArtifact(self.wand, c_artifact.as_ptr()) };
|
||||
|
||||
if c_value.is_null() {
|
||||
return Err(MagickError(format!("missing artifact: {}", artifact)));
|
||||
}
|
||||
// convert (and copy) the C string to a Rust string
|
||||
let value = unsafe { CStr::from_ptr(c_value) }.to_string_lossy().into_owned();
|
||||
let value = unsafe { CStr::from_ptr(c_value) }
|
||||
.to_string_lossy()
|
||||
.into_owned();
|
||||
|
||||
unsafe {
|
||||
bindings::MagickRelinquishMemory(c_value as *mut c_void);
|
||||
@ -723,15 +680,12 @@ impl MagickWand {
|
||||
}
|
||||
|
||||
pub fn get_image_artifacts(&self, pattern: &str) -> Result<Vec<String>> {
|
||||
let c_pattern = CString::new(pattern).map_err(|_| MagickError("artifact string contains null byte".to_string()))?;
|
||||
let c_pattern = CString::new(pattern)
|
||||
.map_err(|_| MagickError("artifact string contains null byte".to_string()))?;
|
||||
let mut num_of_artifacts: size_t = 0;
|
||||
|
||||
let c_values = unsafe {
|
||||
bindings::MagickGetImageArtifacts(
|
||||
self.wand,
|
||||
c_pattern.as_ptr(),
|
||||
&mut num_of_artifacts
|
||||
)
|
||||
bindings::MagickGetImageArtifacts(self.wand, c_pattern.as_ptr(), &mut num_of_artifacts)
|
||||
};
|
||||
|
||||
if c_values.is_null() {
|
||||
@ -782,20 +736,13 @@ impl MagickWand {
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// ```
|
||||
pub fn set_image_artifact(
|
||||
&mut self,
|
||||
artifact: &str,
|
||||
value: &str
|
||||
) -> Result<()> {
|
||||
let c_artifact = CString::new(artifact).map_err(|_| "artifact string contains null byte")?;
|
||||
pub fn set_image_artifact(&mut self, artifact: &str, value: &str) -> Result<()> {
|
||||
let c_artifact =
|
||||
CString::new(artifact).map_err(|_| "artifact string contains null byte")?;
|
||||
let c_value = CString::new(value).map_err(|_| "value string contains null byte")?;
|
||||
|
||||
let result = unsafe {
|
||||
bindings::MagickSetImageArtifact(
|
||||
self.wand,
|
||||
c_artifact.as_ptr(),
|
||||
c_value.as_ptr()
|
||||
)
|
||||
bindings::MagickSetImageArtifact(self.wand, c_artifact.as_ptr(), c_value.as_ptr())
|
||||
};
|
||||
|
||||
match result {
|
||||
@ -808,14 +755,10 @@ impl MagickWand {
|
||||
///
|
||||
/// * `artifact`: the artifact.
|
||||
pub fn delete_image_artifact(&mut self, artifact: &str) -> Result<()> {
|
||||
let c_artifact = CString::new(artifact).map_err(|_| "artifact string contains null byte")?;
|
||||
let c_artifact =
|
||||
CString::new(artifact).map_err(|_| "artifact string contains null byte")?;
|
||||
|
||||
match unsafe {
|
||||
bindings::MagickDeleteImageArtifact(
|
||||
self.wand,
|
||||
c_artifact.as_ptr()
|
||||
)
|
||||
} {
|
||||
match unsafe { bindings::MagickDeleteImageArtifact(self.wand, c_artifact.as_ptr()) } {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(format!("missing artifact: {}", artifact))),
|
||||
}
|
||||
@ -831,7 +774,9 @@ impl MagickWand {
|
||||
}
|
||||
|
||||
// convert (and copy) the C string to a Rust string
|
||||
let value = unsafe { CStr::from_ptr(c_value) }.to_string_lossy().into_owned();
|
||||
let value = unsafe { CStr::from_ptr(c_value) }
|
||||
.to_string_lossy()
|
||||
.into_owned();
|
||||
|
||||
unsafe {
|
||||
bindings::MagickRelinquishMemory(c_value as *mut c_void);
|
||||
@ -841,15 +786,12 @@ impl MagickWand {
|
||||
}
|
||||
|
||||
pub fn get_image_properties(&self, pattern: &str) -> Result<Vec<String>> {
|
||||
let c_pattern = CString::new(pattern).map_err(|_| MagickError("artifact string contains null byte".to_string()))?;
|
||||
let c_pattern = CString::new(pattern)
|
||||
.map_err(|_| MagickError("artifact string contains null byte".to_string()))?;
|
||||
let mut num_of_artifacts: size_t = 0;
|
||||
|
||||
let c_values = unsafe {
|
||||
bindings::MagickGetImageProperties(
|
||||
self.wand,
|
||||
c_pattern.as_ptr(),
|
||||
&mut num_of_artifacts
|
||||
)
|
||||
bindings::MagickGetImageProperties(self.wand, c_pattern.as_ptr(), &mut num_of_artifacts)
|
||||
};
|
||||
|
||||
if c_values.is_null() {
|
||||
@ -886,9 +828,7 @@ impl MagickWand {
|
||||
pub fn get_image_pixel_color(&self, x: isize, y: isize) -> Option<PixelWand> {
|
||||
let pw = PixelWand::new();
|
||||
|
||||
match unsafe {
|
||||
bindings::MagickGetImagePixelColor(self.wand, x, y, pw.wand)
|
||||
} {
|
||||
match unsafe { bindings::MagickGetImagePixelColor(self.wand, x, y, pw.wand) } {
|
||||
MagickTrue => Some(pw),
|
||||
_ => None,
|
||||
}
|
||||
@ -972,9 +912,7 @@ impl MagickWand {
|
||||
|
||||
/// Sets the image resolution
|
||||
pub fn set_image_resolution(&self, x_resolution: f64, y_resolution: f64) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickSetImageResolution(self.wand, x_resolution, y_resolution)
|
||||
} {
|
||||
match unsafe { bindings::MagickSetImageResolution(self.wand, x_resolution, y_resolution) } {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -982,9 +920,7 @@ impl MagickWand {
|
||||
|
||||
/// Sets the wand resolution
|
||||
pub fn set_resolution(&self, x_resolution: f64, y_resolution: f64) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickSetResolution(self.wand, x_resolution, y_resolution)
|
||||
} {
|
||||
match unsafe { bindings::MagickSetResolution(self.wand, x_resolution, y_resolution) } {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -1085,7 +1021,8 @@ impl MagickWand {
|
||||
&self,
|
||||
width_scale: f64,
|
||||
height_scale: f64,
|
||||
filter: FilterType) -> Result<()> {
|
||||
filter: FilterType,
|
||||
) -> Result<()> {
|
||||
if width_scale < 0.0 {
|
||||
return Err(MagickError("negative width scale given".to_string()));
|
||||
}
|
||||
@ -1106,9 +1043,7 @@ impl MagickWand {
|
||||
/// 'thumbnail' optimizations which remove a lot of image meta-data with the goal
|
||||
/// of producing small low cost images suited for display on the web.
|
||||
pub fn thumbnail_image(&self, width: usize, height: usize) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickThumbnailImage(self.wand, width.into(), height.into())
|
||||
} {
|
||||
match unsafe { bindings::MagickThumbnailImage(self.wand, width.into(), height.into()) } {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -1218,9 +1153,7 @@ impl MagickWand {
|
||||
///
|
||||
/// Returns `true` if successful or `false` if an error occurred.
|
||||
pub fn auto_orient(&self) -> bool {
|
||||
unsafe {
|
||||
bindings::MagickAutoOrientImage(self.wand) == MagickTrue
|
||||
}
|
||||
unsafe { bindings::MagickAutoOrientImage(self.wand) == MagickTrue }
|
||||
}
|
||||
|
||||
/// Write the current image to the provided path.
|
||||
@ -1309,28 +1242,16 @@ impl MagickWand {
|
||||
///
|
||||
/// * `pixel_mask`: type of mask, Read or Write.
|
||||
/// * `clip_mask`: the clip_mask wand.
|
||||
pub fn set_image_mask(
|
||||
&mut self,
|
||||
pixel_mask: PixelMask,
|
||||
clip_mask: &MagickWand
|
||||
) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickSetImageMask(
|
||||
self.wand,
|
||||
pixel_mask.into(),
|
||||
clip_mask.wand
|
||||
)
|
||||
} {
|
||||
pub fn set_image_mask(&mut self, pixel_mask: PixelMask, clip_mask: &MagickWand) -> Result<()> {
|
||||
match unsafe { bindings::MagickSetImageMask(self.wand, pixel_mask.into(), clip_mask.wand) }
|
||||
{
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Set image channel mask
|
||||
pub fn set_image_channel_mask(
|
||||
&mut self,
|
||||
option: ChannelType,
|
||||
) -> ChannelType {
|
||||
pub fn set_image_channel_mask(&mut self, option: ChannelType) -> ChannelType {
|
||||
unsafe { bindings::MagickSetImageChannelMask(self.wand, option.into()).into() }
|
||||
}
|
||||
|
||||
@ -1365,9 +1286,7 @@ impl MagickWand {
|
||||
|
||||
/// Simulate an image shadow
|
||||
pub fn shadow_image(&self, alpha: f64, sigma: f64, x: isize, y: isize) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickShadowImage(self.wand, alpha, sigma, x, y)
|
||||
} {
|
||||
match unsafe { bindings::MagickShadowImage(self.wand, alpha, sigma, x, y) } {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -1471,14 +1390,18 @@ impl MagickWand {
|
||||
colorspace: ColorspaceType,
|
||||
tree_depth: usize,
|
||||
dither_method: DitherMethod,
|
||||
measure_error: bool) -> Result<()> {
|
||||
match unsafe { bindings::MagickQuantizeImage(
|
||||
measure_error: bool,
|
||||
) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickQuantizeImage(
|
||||
self.wand,
|
||||
number_of_colors.into(),
|
||||
colorspace.into(),
|
||||
tree_depth.into(),
|
||||
dither_method.into(),
|
||||
measure_error.to_magick()) } {
|
||||
measure_error.to_magick(),
|
||||
)
|
||||
} {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -1491,14 +1414,18 @@ impl MagickWand {
|
||||
colorspace: ColorspaceType,
|
||||
tree_depth: usize,
|
||||
dither_method: DitherMethod,
|
||||
measure_error: bool) -> Result<()> {
|
||||
match unsafe { bindings::MagickQuantizeImages(
|
||||
measure_error: bool,
|
||||
) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickQuantizeImages(
|
||||
self.wand,
|
||||
number_of_colors.into(),
|
||||
colorspace.into(),
|
||||
tree_depth.into(),
|
||||
dither_method.into(),
|
||||
measure_error.to_magick()) } {
|
||||
measure_error.to_magick(),
|
||||
)
|
||||
} {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -1529,19 +1456,10 @@ impl MagickWand {
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// ```
|
||||
pub fn function_image(
|
||||
&self,
|
||||
function: MagickFunction,
|
||||
args: &[f64]
|
||||
) -> Result<()> {
|
||||
pub fn function_image(&self, function: MagickFunction, args: &[f64]) -> Result<()> {
|
||||
let num_of_args: size_t = args.len().into();
|
||||
match unsafe {
|
||||
bindings::MagickFunctionImage(
|
||||
self.wand,
|
||||
function.into(),
|
||||
num_of_args,
|
||||
args.as_ptr()
|
||||
)
|
||||
bindings::MagickFunctionImage(self.wand, function.into(), num_of_args, args.as_ptr())
|
||||
} {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
@ -1557,13 +1475,7 @@ impl MagickWand {
|
||||
return Err(MagickError("no constant coefficient given".to_string()));
|
||||
}
|
||||
let num_of_terms: size_t = (terms.len() >> 1).into();
|
||||
match unsafe {
|
||||
bindings::MagickPolynomialImage(
|
||||
self.wand,
|
||||
num_of_terms,
|
||||
terms.as_ptr()
|
||||
)
|
||||
} {
|
||||
match unsafe { bindings::MagickPolynomialImage(self.wand, num_of_terms, terms.as_ptr()) } {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -1573,12 +1485,7 @@ impl MagickWand {
|
||||
///
|
||||
/// * `kernel_info`: An array of doubles representing the convolution kernel.
|
||||
pub fn convolve_image(&self, kernel_info: &KernelInfo) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickConvolveImage(
|
||||
self.wand,
|
||||
kernel_info.get_ptr()
|
||||
)
|
||||
} {
|
||||
match unsafe { bindings::MagickConvolveImage(self.wand, kernel_info.get_ptr()) } {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -1593,14 +1500,14 @@ impl MagickWand {
|
||||
&self,
|
||||
morphology_method: MorphologyMethod,
|
||||
iterations: isize,
|
||||
kernel_info: &KernelInfo
|
||||
kernel_info: &KernelInfo,
|
||||
) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickMorphologyImage(
|
||||
self.wand,
|
||||
morphology_method.into(),
|
||||
iterations.into(),
|
||||
kernel_info.get_ptr()
|
||||
kernel_info.get_ptr(),
|
||||
)
|
||||
} {
|
||||
MagickTrue => Ok(()),
|
||||
@ -1617,12 +1524,7 @@ impl MagickWand {
|
||||
///
|
||||
/// * `color_matrix`: the color matrix.
|
||||
pub fn color_matrix_image(&self, color_matrix: &KernelInfo) -> Result<()> {
|
||||
match unsafe {
|
||||
bindings::MagickColorMatrixImage(
|
||||
self.wand,
|
||||
color_matrix.get_ptr()
|
||||
)
|
||||
} {
|
||||
match unsafe { bindings::MagickColorMatrixImage(self.wand, color_matrix.get_ptr()) } {
|
||||
MagickTrue => Ok(()),
|
||||
_ => Err(MagickError(self.get_exception()?.0)),
|
||||
}
|
||||
@ -1640,19 +1542,15 @@ impl MagickWand {
|
||||
///
|
||||
/// * `expression`: the expression.
|
||||
pub fn channel_fx_image(&self, expression: &str) -> Result<MagickWand> {
|
||||
let c_expression = CString::new(expression).map_err(|_| "artifact string contains null byte")?;
|
||||
let c_expression =
|
||||
CString::new(expression).map_err(|_| "artifact string contains null byte")?;
|
||||
|
||||
let result = unsafe {
|
||||
bindings::MagickChannelFxImage(
|
||||
self.wand,
|
||||
c_expression.as_ptr()
|
||||
)
|
||||
};
|
||||
let result = unsafe { bindings::MagickChannelFxImage(self.wand, c_expression.as_ptr()) };
|
||||
|
||||
return if result.is_null() {
|
||||
Err(MagickError(self.get_exception()?.0))
|
||||
} else {
|
||||
Ok(MagickWand{ wand: result })
|
||||
Ok(MagickWand { wand: result })
|
||||
};
|
||||
}
|
||||
|
||||
@ -1662,28 +1560,24 @@ impl MagickWand {
|
||||
///
|
||||
/// * `colorspace`: the colorspace.
|
||||
pub fn combine_images(&self, colorspace: ColorspaceType) -> Result<MagickWand> {
|
||||
let result = unsafe {
|
||||
bindings::MagickCombineImages(self.wand, colorspace.into())
|
||||
};
|
||||
let result = unsafe { bindings::MagickCombineImages(self.wand, colorspace.into()) };
|
||||
|
||||
return if result.is_null() {
|
||||
Err(MagickError(self.get_exception()?.0))
|
||||
} else {
|
||||
Ok(MagickWand{ wand: result })
|
||||
}
|
||||
Ok(MagickWand { wand: result })
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns the current image from the magick wand.
|
||||
pub fn get_image<'wand>(&'wand self) -> Result<Image<'wand>> {
|
||||
let result = unsafe {
|
||||
bindings::GetImageFromMagickWand(self.wand)
|
||||
};
|
||||
let result = unsafe { bindings::GetImageFromMagickWand(self.wand) };
|
||||
|
||||
return if result.is_null() {
|
||||
Err(MagickError(self.get_exception()?.0))
|
||||
} else {
|
||||
unsafe { Ok(Image::new(result)) }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
mutations!(
|
||||
|
||||
@ -23,5 +23,5 @@ pub use self::drawing::DrawingWand;
|
||||
pub use self::magick::MagickWand;
|
||||
pub use self::pixel::{PixelWand, HSL};
|
||||
|
||||
use bindings::MagickBooleanType_MagickTrue as MagickTrue;
|
||||
use bindings::MagickBooleanType_MagickFalse as MagickFalse;
|
||||
use bindings::MagickBooleanType_MagickTrue as MagickTrue;
|
||||
|
||||
@ -19,8 +19,8 @@ use std::fmt;
|
||||
use bindings;
|
||||
use result::MagickError;
|
||||
|
||||
use crate::result::Result;
|
||||
use super::MagickTrue;
|
||||
use crate::result::Result;
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct HSL {
|
||||
|
||||
19
tests/lib.rs
19
tests/lib.rs
@ -22,8 +22,8 @@ use std::io::Read;
|
||||
use std::path::Path;
|
||||
use std::sync::Once;
|
||||
|
||||
use magick_rust::{magick_wand_genesis, MagickWand, PixelWand};
|
||||
use magick_rust::MagickError;
|
||||
use magick_rust::{magick_wand_genesis, MagickWand, PixelWand};
|
||||
|
||||
// Used to make sure MagickWand is initialized exactly once. Note that we
|
||||
// do not bother shutting down, we simply exit when the tests are done.
|
||||
@ -54,7 +54,9 @@ fn test_resize_image() {
|
||||
1 => 1,
|
||||
height => height / 2,
|
||||
};
|
||||
assert!(wand.resize_image(halfwidth, halfheight, magick_rust::FilterType::Lanczos).is_ok());
|
||||
assert!(wand
|
||||
.resize_image(halfwidth, halfheight, magick_rust::FilterType::Lanczos)
|
||||
.is_ok());
|
||||
assert_eq!(256, wand.get_image_width());
|
||||
assert_eq!(192, wand.get_image_height());
|
||||
}
|
||||
@ -171,7 +173,10 @@ fn test_get_image_property() {
|
||||
// retrieve a property that does not exist
|
||||
let missing_value = wand.get_image_property("exif:Foobar");
|
||||
assert!(missing_value.is_err());
|
||||
assert_eq!(MagickError("missing property: exif:Foobar".to_string()), missing_value.unwrap_err());
|
||||
assert_eq!(
|
||||
MagickError("missing property: exif:Foobar".to_string()),
|
||||
missing_value.unwrap_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -208,8 +213,7 @@ fn test_compare_images() {
|
||||
assert!(wand2.read_image("tests/data/IMG_5745_rotl.JPG").is_ok());
|
||||
wand2.auto_orient();
|
||||
|
||||
let (distortion, diff) =
|
||||
wand1.compare_images(&wand2, magick_rust::MetricType::RootMeanSquared);
|
||||
let (distortion, diff) = wand1.compare_images(&wand2, magick_rust::MetricType::RootMeanSquared);
|
||||
assert!(distortion < 0.01);
|
||||
assert!(diff.is_some());
|
||||
}
|
||||
@ -362,10 +366,7 @@ fn test_clut_image() {
|
||||
assert!(gradient.read_image("gradient:black-yellow").is_ok());
|
||||
|
||||
assert!(wand
|
||||
.clut_image(
|
||||
&gradient,
|
||||
magick_rust::PixelInterpolateMethod::Bilinear
|
||||
)
|
||||
.clut_image(&gradient, magick_rust::PixelInterpolateMethod::Bilinear)
|
||||
.is_ok());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user