mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Move the gradient-focused nodes from the Color category to a new Gradient category (#4403)
This commit is contained in:
committed by
Dennis Kobert
parent
c5cb466e28
commit
27f1e8a65b
@@ -556,7 +556,7 @@ pub fn flatten_gradient<'e>(
|
||||
}
|
||||
|
||||
/// Constructs a gradient from a `Color[]`, where the colors are evenly distributed as gradient stops across the range from 0 to 1.
|
||||
#[node_macro::node(category("Color"), name("Colors to Gradient"))]
|
||||
#[node_macro::node(category("Gradient"), name("Colors to Gradient"))]
|
||||
pub fn colors_to_gradient(_: impl Ctx, colors: IList<Color>) -> Gradient {
|
||||
Gradient::from(colors.iter().collect::<Vec<_>>())
|
||||
}
|
||||
|
||||
@@ -1203,13 +1203,13 @@ fn gradient_value(_: impl Ctx, _primary: (), #[default(Color::BLACK, Color::WHIT
|
||||
}
|
||||
|
||||
/// Sets the type (linear or radial) of each gradient in the input list.
|
||||
#[node_macro::node(category("Color"))]
|
||||
#[node_macro::node(category("Gradient"))]
|
||||
fn gradient_type(_: impl Ctx, gradient: Gradient, gradient_type: vector_types::GradientType) -> (Gradient, Attr<GradientTypeAttr>) {
|
||||
(gradient, Attr(gradient_type))
|
||||
}
|
||||
|
||||
/// Sets how each gradient in the input list extends past its endpoints: Pad, Reflect, or Repeat.
|
||||
#[node_macro::node(category("Color"))]
|
||||
#[node_macro::node(category("Gradient"))]
|
||||
fn spread_method(_: impl Ctx, gradient: Gradient, spread_method: vector_types::GradientSpreadMethod) -> (Gradient, Attr<SpreadMethodAttr>) {
|
||||
(gradient, Attr(spread_method))
|
||||
}
|
||||
@@ -1217,7 +1217,7 @@ fn spread_method(_: impl Ctx, gradient: Gradient, spread_method: vector_types::G
|
||||
/// Sets the position of each of a gradient's stops, a factor from 0 to 1 along the gradient.
|
||||
///
|
||||
/// A list shorter than the stop count repeats its last value, a longer list is truncated, and an empty list sets each stop to its default evenly spaced position.
|
||||
#[node_macro::node(category("Color"))]
|
||||
#[node_macro::node(category("Gradient"))]
|
||||
fn gradient_positions(_: impl Ctx, mut gradient: Gradient, positions: IList<f64>) -> Gradient {
|
||||
let positions: Vec<f64> = positions.iter().collect();
|
||||
gradient.set_positions(&positions);
|
||||
@@ -1229,7 +1229,7 @@ fn gradient_positions(_: impl Ctx, mut gradient: Gradient, positions: IList<f64>
|
||||
/// The final stop belongs to no interval so its midpoint is ignored.
|
||||
///
|
||||
/// A list shorter than the stop count repeats its last value, a longer list is truncated, and an empty list sets each midpoint to its default of 0.5.
|
||||
#[node_macro::node(category("Color"))]
|
||||
#[node_macro::node(category("Gradient"))]
|
||||
fn gradient_midpoints(_: impl Ctx, mut gradient: Gradient, midpoints: IList<f64>) -> Gradient {
|
||||
let midpoints: Vec<f64> = midpoints.iter().collect();
|
||||
gradient.set_midpoints(&midpoints);
|
||||
|
||||
Reference in New Issue
Block a user