#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

#2050 in Data structures

Download history 2/week @ 2024-11-27 10/week @ 2024-12-04 22/week @ 2024-12-11 1/week @ 2024-12-18 8/week @ 2025-01-15 9/week @ 2025-01-22 14/week @ 2025-02-05 22/week @ 2025-02-12 3/week @ 2025-02-19 13/week @ 2025-02-26

52 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