fast image operations
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index d59f652..1427562 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -251,6 +251,13 @@ impl<const CHANNELS: usize, const N: usize> Image<[u8; N], CHANNELS> {
}
}
+impl<const CHANNELS: usize> Image<&[u8], CHANNELS> {
+ /// Box this image.
+ pub fn boxed(self) -> Image<Box<[u8]>, CHANNELS> {
+ unsafe { Image::new(self.width, self.height, self.buffer.into()) }
+ }
+}
+
impl<const CHANNELS: usize> Image<Vec<u8>, CHANNELS> {
/// Box this owned image.
pub fn boxed(self) -> Image<Box<[u8]>, CHANNELS> {