kornelski / imgref

A trivial Rust struct for interchange of pixel buffers with width, height & stride
https://lib.rs/crates/imgref
Apache License 2.0
59 stars 6 forks source link

Add buf(), buf_mut() and into_buf() #8

Closed yoanlcq closed 5 years ago

yoanlcq commented 5 years ago

Hello,

This adds accessors to Img's buf member and deprecates direct access to it.

I "need" this because I'm using ImgRef as a container to transfer image data to OpenGL, which requires a pointer to the pixels.
This cannot be done efficiently with iterators (technically it can, but it's hacky), and I don't feel comfortable about directly using the buf member knowing it will be private someday.
In short, it feels like Img "steals" the container from me, and I'd like it back :)

Thanks in advance :) I acknowledge that this is probably a bit petty and the newly introduced deprecated warnings may annoy a bunch of people.

kornelski commented 5 years ago

Thank you