From 6ba084db4ba375eacaa1677fd75de318c12170c7 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 6 Jul 2020 23:04:10 -0400 Subject: Bump acap to 0.2.0 This requires adapting to the new k-d trees, which are significantly faster. --- src/frontier/image.rs | 10 ++++++++-- src/frontier/mean.rs | 15 ++++++++++++--- src/frontier/min.rs | 15 ++++++++++++--- 3 files changed, 32 insertions(+), 8 deletions(-) (limited to 'src/frontier') diff --git a/src/frontier/image.rs b/src/frontier/image.rs index 18bf620..8b4c233 100644 --- a/src/frontier/image.rs +++ b/src/frontier/image.rs @@ -19,7 +19,10 @@ pub struct ImageFrontier { deleted: usize, } -impl ImageFrontier { +impl ImageFrontier +where + C::Value: PartialOrd, +{ /// Create an ImageFrontier from an image. pub fn new(img: &RgbImage) -> Self { let width = img.width(); @@ -39,7 +42,10 @@ impl ImageFrontier { } } -impl Frontier for ImageFrontier { +impl Frontier for ImageFrontier +where + C::Value: PartialOrd, +{ fn width(&self) -> u32 { self.width } diff --git a/src/frontier/mean.rs b/src/frontier/mean.rs index 3c441b8..e59e45c 100644 --- a/src/frontier/mean.rs +++ b/src/frontier/mean.rs @@ -17,7 +17,10 @@ enum MeanPixel { Filled(C), } -impl MeanPixel { +impl MeanPixel +where + C::Value: PartialOrd, +{ fn filled_color(&self) -> Option { match self { Self::Filled(color) => Some(*color), @@ -37,7 +40,10 @@ pub struct MeanFrontier { deleted: usize, } -impl MeanFrontier { +impl MeanFrontier +where + C::Value: PartialOrd, +{ /// Create a MeanFrontier with the given dimensions and initial pixel location. pub fn new(width: u32, height: u32, x0: u32, y0: u32) -> Self { let size = (width as usize) * (height as usize); @@ -117,7 +123,10 @@ impl MeanFrontier { } } -impl Frontier for MeanFrontier { +impl Frontier for MeanFrontier +where + C::Value: PartialOrd, +{ fn width(&self) -> u32 { self.width } diff --git a/src/frontier/min.rs b/src/frontier/min.rs index 95b3321..5c298e7 100644 --- a/src/frontier/min.rs +++ b/src/frontier/min.rs @@ -16,7 +16,10 @@ struct MinPixel { filled: bool, } -impl MinPixel { +impl MinPixel +where + C::Value: PartialOrd, +{ fn new() -> Self { Self { pixel: None, @@ -39,7 +42,10 @@ pub struct MinFrontier { deleted: usize, } -impl MinFrontier { +impl MinFrontier +where + C::Value: PartialOrd, +{ /// Create a MinFrontier with the given dimensions and initial pixel location. pub fn new(rng: R, width: u32, height: u32, x0: u32, y0: u32) -> Self { let size = (width as usize) * (height as usize); @@ -122,7 +128,10 @@ impl MinFrontier { } } -impl Frontier for MinFrontier { +impl Frontier for MinFrontier +where + C::Value: PartialOrd, +{ fn width(&self) -> u32 { self.width } -- cgit v1.2.3