fast image operations
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib.rs7
2 files changed, 8 insertions, 1 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 21a9af8..da0a8aa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "fimg"
-version = "0.4.14"
+version = "0.4.15"
authors = ["bend-n <[email protected]>"]
license = "MIT"
edition = "2021"
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> {