Crate imgref [−] [src]
In graphics code it's very common to pass width
and height
along with a Vec
of pixels, all as separate arguments. This is tedious, and can lead to errors.
This crate is a simple struct that adds dimensions to the underlying buffer. This makes it easier to correctly keep track of the image size and allows passing images with just one function argument instead three or four.
Additionally, it has a concept of a stride
, which allows defining sub-regions of images without copying, as well as padding (e.g. buffers for video frames may require to be a multiple of 8, regardless of logical image size).
For convenience, indexing with img[(x,y)]
is supported.
Structs
Img |
Basic struct used for both owned (alias |
Traits
ImgExt |
Additional methods that depend on buffer size |
Type Definitions
ImgRef |
Reference to pixels inside another image.
Pass this structure by value (i.e. |
ImgVec |
Image owning its pixels. |