#matrix #canvas #matrix-operations #pixel #simple #row-column

simple-canvas

A simple generic 2 dimensional canvas struct

2 releases

0.1.1 Jan 30, 2024
0.1.0 Jan 30, 2024

#791 in Data structures

Download history 15/week @ 2024-01-28 7/week @ 2024-02-04 15/week @ 2024-02-18 26/week @ 2024-02-25 3/week @ 2024-03-03 79/week @ 2024-03-10 3/week @ 2024-03-17 23/week @ 2024-03-31

106 downloads per month
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