mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-05 19:12:08 -10:00
Rename the 'Image to Channels' node to 'Into Channels' and defer its channels on any graphic
This commit is contained in:
1 parent
c465a3ebea
commit
12daaf8ab0
16 files changed
+279
-48
No files matched your search
@@ -109,6 +109,7 @@ fn step_function(kind: StepKind) -> (&'static str, Option<[Encoding; 2]>) {
|
||||
StepKind::ColorLookup => ("color_lookup", Some([Gamma, Gamma])),
|
||||
StepKind::ColorOverlay => ("color_overlay", Some([Gamma, Gamma])),
|
||||
StepKind::Solarize => ("solarize", Some([Gamma, Gamma])),
|
||||
StepKind::AlphaToGray => ("alpha_to_gray", Some([Gamma, Gamma])),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -365,6 +365,11 @@ fn solarize(color: vec4<f32>, at: u32) -> vec4<f32> {
|
||||
return vec4<f32>(min(color.rgb, 1. - color.rgb), color.a);
|
||||
}
|
||||
|
||||
// The alpha as a gray of the same gamma-encoded level, keeping the alpha
|
||||
fn alpha_to_gray(color: vec4<f32>, at: u32) -> vec4<f32> {
|
||||
return vec4<f32>(vec3<f32>(color.a), color.a);
|
||||
}
|
||||
|
||||
// Matches `apply_levels` with the gamma of 1 that every caller here passes, so its power is left out
|
||||
fn apply_levels(value: f32, input_shadows: f32, input_highlights: f32, output_minimum: f32, output_maximum: f32) -> f32 {
|
||||
let highlights_minus_shadows = clamp(input_highlights - input_shadows, F32_EPSILON, 1.);
|
||||
|
||||
@@ -5279,9 +5279,20 @@ fn gpu_color_adjustments_match_the_cpu_kernels() {
|
||||
("Photo Filter", photo_filter(warming, 25., true)),
|
||||
("Photo Filter at full density", photo_filter(cooling, 100., false)),
|
||||
("Photo Filter at full density preserving luminosity", photo_filter(cooling, 100., true)),
|
||||
("Alpha to Gray", Adjustment::AlphaToGray),
|
||||
];
|
||||
let mut runs: Vec<(String, Vec<Adjustment>)> = runs.into_iter().map(|(name, adjustment)| (name.to_string(), vec![adjustment])).collect();
|
||||
|
||||
// The opaque grays of one channel each that 'Into Channels' outputs
|
||||
let opaque = Adjustment::MakeOpaque { strength: 100. };
|
||||
let green_gray = Adjustment::ChannelMixer(Box::new(ChannelMixerSettings {
|
||||
monochrome: true,
|
||||
monochrome_mix: row(0., 100., 0., 0.),
|
||||
..Default::default()
|
||||
}));
|
||||
runs.push(("Green as an opaque gray".to_string(), vec![green_gray, opaque.clone()]));
|
||||
runs.push(("Alpha as an opaque gray".to_string(), vec![Adjustment::AlphaToGray, opaque]));
|
||||
|
||||
// Every blend mode, overlaying an opaque color and a translucent one, each with a luma apart from every test color's, which Darker Color and Lighter Color compare, and off Hard Mix's steep ramp over them
|
||||
for blend_mode in BlendMode::list().into_iter().flatten().chain(&[BlendMode::Erase, BlendMode::Restore, BlendMode::MultiplyAlpha]) {
|
||||
for (color, opacity) in [
|
||||
|
||||
Reference in new issue
Block a user