Add color converter and debug node to use graphic

This commit is contained in:
YohYamasaki
2026-05-19 13:16:31 +09:00
parent 3fd61169ae
commit 746d78364c
3 changed files with 34 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
use core_types::Context;
use core_types::list::{ATTR_FILL_GRAPHIC, List};
use core_types::list::{ATTR_FILL_GRAPHIC, ATTR_STROKE_PAINT_GRAPHIC, List};
use core_types::registry::types::{Fraction, Percentage, PixelSize};
use core_types::transform::Footprint;
use core_types::{Color, Ctx, num_traits};
@@ -1008,6 +1008,29 @@ fn fill_graphic<P: IntoGraphicList + 'n + Send>(
vectors
}
/// Sets the `stroke_paint_graphic` attribute on each item of the input vector list.
/// Used for testing of gradient and clipping-based stroke rendering until the proper Stroke node refactor lands.
#[node_macro::node(category("Debug"))]
fn stroke_paint_graphic<P: IntoGraphicList + 'n + Send>(
_: impl Ctx,
mut vectors: List<Vector>,
#[implementations(
List<Graphic>,
List<Vector>,
List<Raster<CPU>>,
List<Raster<GPU>>,
List<Color>,
List<GradientStops>,
)]
stroke_paint_graphic: P,
) -> List<Vector> {
let paint_list = stroke_paint_graphic.into_graphic_list();
for row_idx in 0..vectors.len() {
vectors.set_attribute(ATTR_STROKE_PAINT_GRAPHIC, row_idx, paint_list.clone());
}
vectors
}
#[cfg(test)]
mod test {
use super::*;