From b190cc787a502adc6613730c71951a5211b00a61 Mon Sep 17 00:00:00 2001 From: Magic Len Date: Sun, 12 Aug 2018 23:28:32 +0800 Subject: [PATCH] Binding for set_sampling_factors --- src/wand/magick.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wand/magick.rs b/src/wand/magick.rs index 4888ed3..14dcba7 100644 --- a/src/wand/magick.rs +++ b/src/wand/magick.rs @@ -349,6 +349,16 @@ impl MagickWand { } } + /// Sets the image sampling factors. + /// + /// samplingFactors: An array of floats representing the sampling factor for each color component (in RGB order). + pub fn set_sampling_factors(&self, samplingFactors: &[f64]) -> Result<(), &'static str> { + match unsafe { bindings::MagickSetSamplingFactors(self.wand, samplingFactors.len(), &samplingFactors[0]) } { + bindings::MagickBooleanType::MagickTrue => Ok(()), + _ => Err("SetSamplingFactors returned false") + } + } + /// Returns the image histogram as a vector of `PixelWand` instances for every unique color. pub fn get_image_histogram(&self) -> Option> { let mut color_count: size_t = 0;