diff options
author | gennyble <gen@nyble.dev> | 2023-09-11 20:09:33 -0500 |
---|---|---|
committer | gennyble <gen@nyble.dev> | 2023-09-11 20:09:33 -0500 |
commit | d451c304b76ce525cf9dfc9e2e2fee13f1b0f135 (patch) | |
tree | f040d58331f0e6861e946d930b4d3645926a6dfb /prism/src/rotate.rs | |
parent | 22b07838e7d83998bc9d46e219410d1431527687 (diff) | |
download | lri-rs-d451c304b76ce525cf9dfc9e2e2fee13f1b0f135.tar.gz lri-rs-d451c304b76ce525cf9dfc9e2e2fee13f1b0f135.zip |
ahh2
Diffstat (limited to 'prism/src/rotate.rs')
-rw-r--r-- | prism/src/rotate.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/prism/src/rotate.rs b/prism/src/rotate.rs new file mode 100644 index 0000000..82f29d1 --- /dev/null +++ b/prism/src/rotate.rs @@ -0,0 +1,11 @@ +pub fn rotate_180<T: Copy>(data: &mut [T]) { + let mut rat = vec![data[0]; data.len()]; + + for (idx, px) in data.chunks(3).rev().enumerate() { + rat[idx * 3] = px[0]; + rat[idx * 3 + 1] = px[1]; + rat[idx * 3 + 2] = px[2]; + } + + data.copy_from_slice(&rat); +} |