Skip to content

Commit

Permalink
add: deref impl for Edges
Browse files Browse the repository at this point in the history
  • Loading branch information
salam99823 committed Dec 13, 2024
1 parent 83fdfec commit 3a99c04
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ where
#[must_use]
pub fn single_translated(&self) -> Option<Vec<Vec2>> {
self.single_raw()
.map(|polygon| translate(polygon, self.0.width(), self.0.height()))
.map(|polygon| translate(polygon, self.width(), self.height()))
}

/// Retrieves the raw edge points of a single image.
Expand All @@ -57,7 +57,7 @@ where
#[inline]
#[must_use]
pub fn multi_translated(&self) -> Vec<Vec<Vec2>> {
translate_objects(self.iter(), self.0.width(), self.0.height())
translate_objects(self.iter(), self.width(), self.height())
}

/// Retrieves the raw edge points of multiple images.
Expand Down Expand Up @@ -111,6 +111,16 @@ where
}
}

impl<I> std::ops::Deref for Edges<I>
where
I: GenericImageView<Pixel = Bit>,
{
type Target = I;
fn deref(&self) -> &Self::Target {
&self.0
}
}

impl<'a, I> IntoIterator for &'a Edges<I>
where
I: GenericImageView<Pixel = Bit>,
Expand Down

0 comments on commit 3a99c04

Please sign in to comment.