fast image operations
Diffstat (limited to 'src/indexed/builder.rs')
-rw-r--r--src/indexed/builder.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/indexed/builder.rs b/src/indexed/builder.rs
index b00c12f..e8b5ad1 100644
--- a/src/indexed/builder.rs
+++ b/src/indexed/builder.rs
@@ -57,6 +57,16 @@ impl<B, P> Builder<B, P> {
.unwrap()
}
+ pub unsafe fn buf_unchecked<I>(self, buffer: B) -> Image<B, P>
+ where
+ B: AsRef<[I]>,
+ {
+ Image {
+ buffer: crate::Image::build(self.width, self.height).buf(buffer),
+ palette: self.palette.expect("require palette"),
+ }
+ }
+
/// Allocates a zeroed buffer.
#[track_caller]
#[must_use]