#matrix #canvas #matrix-operations #pixel #simple

simple-canvas

A simple generic 2 dimensional canvas struct

2 releases

0.1.1 Jan 30, 2024
0.1.0 Jan 30, 2024

#1771 in Data structures


Used in 2 crates

MIT license

6KB

simple-canvas

This crate provides a Canvas struct that is constructed of a single vector, but act as a 2 dimensional matrix. Along with the struct are functions to access its elements by row and column, as well as access to iterators over all elements.

Motivation

I needed a simple struct to act as a 2 dimensional array, mostly for image creation and manipulation. After some testing, I found that using a single vector, as opposed to a vector of vector, is faster, even with the added operations needed to abstract away the access by column and row. This crate provides just this.


lib.rs:

A simple canvas struct that act as a 2 dimensional array.

No runtime deps