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