mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Convert the node catalog to rank-polymorphic Item and List kernels, materialize stored values as ranked wires, and display wire rank in the graph
This commit is contained in:
committed by
Dennis Kobert
parent
ead622b969
commit
d63ea46bd4
@@ -458,6 +458,7 @@ pub fn blend_stamp_closure(foreground: BrushStampGenerator<Color>, mut backgroun
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::brush_stroke::BrushStroke;
|
||||
use core_types::transform::Transform;
|
||||
use glam::DAffine2;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use core_types::CacheHash;
|
||||
use core_types::blending::BlendMode;
|
||||
use core_types::color::Color;
|
||||
use core_types::list::{Item, List};
|
||||
use core_types::math::bbox::AxisAlignedBbox;
|
||||
use dyn_any::DynAny;
|
||||
use glam::DVec2;
|
||||
@@ -57,6 +58,22 @@ pub struct BrushStroke {
|
||||
pub trace: Vec<BrushInputSample>,
|
||||
}
|
||||
|
||||
/// One Brush layer's full sequence of strokes, treated as a single rank-0 value rather than a frame of independent strokes.
|
||||
#[derive(Default, Debug, Clone, PartialEq, CacheHash, DynAny)]
|
||||
pub struct BrushTrace(pub List<BrushStroke>);
|
||||
|
||||
impl From<List<BrushStroke>> for BrushTrace {
|
||||
fn from(strokes: List<BrushStroke>) -> Self {
|
||||
Self(strokes)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Vec<BrushStroke>> for BrushTrace {
|
||||
fn from(strokes: Vec<BrushStroke>) -> Self {
|
||||
Self(strokes.into_iter().map(Item::new_from_element).collect())
|
||||
}
|
||||
}
|
||||
|
||||
impl BrushStroke {
|
||||
pub fn bounding_box(&self) -> AxisAlignedBbox {
|
||||
let radius = self.style.diameter / 2.;
|
||||
|
||||
Reference in New Issue
Block a user