mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user