Add MetricType type

This commit is contained in:
5ohue
2024-05-09 21:04:39 +03:00
parent 53fb3069ed
commit d6c617ebce
4 changed files with 77 additions and 6 deletions

View File

@ -29,7 +29,7 @@ use {size_t, ssize_t};
use crate::result::Result;
use super::{DrawingWand, PixelWand};
use crate::{CompositeOperator, ResourceType};
use crate::{CompositeOperator, MetricType, ResourceType};
wand_common!(
MagickWand,
@ -202,11 +202,11 @@ impl MagickWand {
pub fn compare_images(
&self,
reference: &MagickWand,
metric: bindings::MetricType,
metric: MetricType,
) -> (f64, Option<MagickWand>) {
let mut distortion: f64 = 0.0;
let result = unsafe {
bindings::MagickCompareImages(self.wand, reference.wand, metric, &mut distortion)
bindings::MagickCompareImages(self.wand, reference.wand, metric.into(), &mut distortion)
};
let wand = if result.is_null() {
None