Zero-cost 2D grids focused on memory consumption and performance.
Grixy provides a set of traits and types for working with 2D grids, including
traits for reading and writing to grids, as well as implementations for common
buffer types based on linear arrays or vectors. The crate is no_std
compatible, and operates without a dynamic memory allocator; as a result
most1 APIs are lazily evaluated, returning or operating on iterators or
references rather than copying data around.
Possible use-cases include:
- 2D games, where grids can represent tile maps, collision detection, or game state
- Simulations, where grids can represent physical systems, cellular automata, or spatial data
- Pixel rasterization, where grids can represent images, textures, or graphical data
- Any other 2D grid-based data structure, such as matrices, graphs, or spatial indexing
Grixy can be used for more complex operations like software blending or scaling:
cargo run --example mono-font-rasterThis example:
- loads a bitmap font, and views it as a grid of glyphs;
- creates an in-memory buffer of rgba pixels;
- draws the glyphs into the pixel buffer;
- (using the
pngcrate) saves the pixel buffer as a PNG file, seen below.
This project uses just to run commands the same way as the CI:
cargo just checkto check formatting and lints.cargo just coverageto generate and preview code coverage.cargo just docto generate and preview docs.cargo just testto run tests.
For a full list of commands, see the Justfile.