mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Improve type handling for ints/floats with the #[hard/soft_min/max(...)] node macro parameter attributes (#4041)
This commit is contained in:
@@ -962,7 +962,7 @@ fn posterize<T: Adjust<Color>>(
|
||||
#[gpu_image]
|
||||
mut input: T,
|
||||
#[default(4)]
|
||||
#[hard_min(2.)]
|
||||
#[hard_min(2)]
|
||||
levels: u32,
|
||||
) -> T {
|
||||
input.adjust(|color| {
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
use core_types::color::Color;
|
||||
use core_types::context::Ctx;
|
||||
use core_types::registry::types::IntegerCount;
|
||||
use core_types::table::{Table, TableRow};
|
||||
use raster_types::{CPU, Raster};
|
||||
|
||||
#[node_macro::node(category("Color"))]
|
||||
async fn image_color_palette(_: impl Ctx, image: Table<Raster<CPU>>, #[default(4)] count: IntegerCount) -> Table<Color> {
|
||||
async fn image_color_palette(
|
||||
_: impl Ctx,
|
||||
image: Table<Raster<CPU>>,
|
||||
#[default(4)]
|
||||
#[hard_min(1)]
|
||||
count: u32,
|
||||
) -> Table<Color> {
|
||||
const GRID: f32 = 3.;
|
||||
|
||||
let bins = GRID * GRID * GRID;
|
||||
|
||||
Reference in New Issue
Block a user