image-rs / image

Encoding and decoding images in Rust
Apache License 2.0
4.87k stars 602 forks source link

Is it garanteed that `ImageBuffer::new()` returns a buffer filled with `zero()`s of the corresponding type ? #2216

Closed Morgane55440 closed 4 months ago

Morgane55440 commented 4 months ago

i'm working on a feature in imageproc, and for optimization reasons, i would like to rely on the fact that ImageBuffer::new() returns a buffer filled with zero()s.

but the documentation of ImageBuffer::new() only states

Creates a new image buffer based on a Vec. Panics Panics when the resulting image is larger than the maximum size of a vector

Therefore, i am looking for confirmation outside of the current implementation that this is an intended feature that will most likely not be changed in the future rather than an implementation detail that could be changed for any and all reasons at any moment.