UiImage helper functions (#8199)

# Objective

Add helper functions to `UiImage` for creating flipped images.

## Changelog

* Added `with_flip_x` and `with_flip_y` methods to `UiImage` that return
the `UiImage` flipped along the respective axis.
This commit is contained in:
ickshonpe 2023-04-05 23:19:46 +01:00 committed by GitHub
parent 28046d5142
commit ff9f2234f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -758,6 +758,20 @@ impl UiImage {
..Default::default()
}
}
/// flip the image along its x-axis
#[must_use]
pub const fn with_flip_x(mut self) -> Self {
self.flip_x = true;
self
}
/// flip the image along its y-axis
#[must_use]
pub const fn with_flip_y(mut self) -> Self {
self.flip_y = true;
self
}
}
impl From<Handle<Image>> for UiImage {