mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Convert the raster std and adjustments families to element kernels and keep the unit primary's slot
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
//! Not immediately shader compatible due to needing [`GradientStops`] as a param, which needs [`Vec`]
|
||||
|
||||
use crate::adjust::Adjust;
|
||||
use core_types::list::List;
|
||||
use core_types::{Color, Ctx};
|
||||
use core_types::{Color, Ctx, ExtractIndex, InjectIndex};
|
||||
use raster_types::{CPU, Raster};
|
||||
use vector_types::GradientStops;
|
||||
|
||||
@@ -10,18 +9,21 @@ use vector_types::GradientStops;
|
||||
// https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=%27grdm%27%20%3D%20Gradient%20Map
|
||||
// https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=Gradient%20settings%20(Photoshop%206.0)
|
||||
#[node_macro::node(category("Raster: Adjustment"))]
|
||||
fn gradient_map<T: Adjust<Color>>(
|
||||
_: impl Ctx,
|
||||
fn gradient_map<T: Adjust<Color> + Clone + Send + Sync + core_types::CacheHash + 'static>(
|
||||
_: impl Ctx + ExtractIndex + InjectIndex + Copy,
|
||||
#[implementations(
|
||||
List<Raster<CPU>>,
|
||||
List<Color>,
|
||||
List<GradientStops>,
|
||||
Raster<CPU>,
|
||||
Color,
|
||||
GradientStops,
|
||||
)]
|
||||
mut image: T,
|
||||
gradient: List<GradientStops>,
|
||||
gradient: IList<GradientStops>,
|
||||
reverse: bool,
|
||||
) -> T {
|
||||
let Some(gradient) = gradient.element(0) else { return image };
|
||||
if gradient.is_empty() {
|
||||
return image;
|
||||
}
|
||||
let gradient = gradient.element_ref(0);
|
||||
|
||||
image.adjust(|color| {
|
||||
let intensity = color.luminance_rec_709();
|
||||
|
||||
Reference in New Issue
Block a user