Add a `transformed()` method to `Outline` and `Contour`.
This commit is contained in:
parent
981677976e
commit
4dea6aa258
|
@ -178,6 +178,11 @@ impl Outline {
|
||||||
self.bounds = new_bounds.unwrap_or_else(|| RectF::default());
|
self.bounds = new_bounds.unwrap_or_else(|| RectF::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn transformed(mut self, transform: &Transform2F) -> Outline {
|
||||||
|
self.transform(transform);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn apply_perspective(&mut self, perspective: &Perspective) {
|
pub fn apply_perspective(&mut self, perspective: &Perspective) {
|
||||||
let mut new_bounds = None;
|
let mut new_bounds = None;
|
||||||
for contour in &mut self.contours {
|
for contour in &mut self.contours {
|
||||||
|
@ -614,6 +619,12 @@ impl Contour {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn transformed(mut self, transform: &Transform2F) -> Contour {
|
||||||
|
self.transform(transform);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn apply_perspective(&mut self, perspective: &Perspective) {
|
pub fn apply_perspective(&mut self, perspective: &Perspective) {
|
||||||
for (point_index, point) in self.points.iter_mut().enumerate() {
|
for (point_index, point) in self.points.iter_mut().enumerate() {
|
||||||
*point = *perspective * *point;
|
*point = *perspective * *point;
|
||||||
|
|
Loading…
Reference in New Issue