Add the Image Color Palette node (#1311)

* Add image color palette node

* Add max size of palette

* Code review cleanup

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Henry Barreto
2023-12-09 20:21:41 -03:00
committed by GitHub
parent fe4b9ef8bb
commit cbda811480
10 changed files with 148 additions and 0 deletions

View File

@@ -1128,4 +1128,12 @@ mod index_node {
ImageFrame::empty()
}
}
#[node_macro::node_impl(IndexNode)]
pub fn index_node(input: Vec<Color>, index: u32) -> Option<Color> {
if index as usize >= input.len() {
warn!("Index of colors is out of range: index is {index} and length is {}", input.len());
}
input.into_iter().nth(index as usize)
}
}