mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 14:58:05 +08:00
Update #[min/max] node macro attributes to #[soft/hard]_[min/max] and make them clamp their input data (#2464)
* Fix min and max macro not enforcing limits when data flows * Use trait based clamping * Remove min/max from testing * cargo fmt * Resolve into min, and hard_min * cargo fmt * fix traits * cargo fmt * fix tests * rename as soft_x * Add validation code * Clean up (not compiling because of DVec2 clamping) * Avoid needing to add trait bounds to node definitions * Code review --------- Co-authored-by: Dennis Kobert <dennis@kobert.dev> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -12,6 +12,7 @@ async fn blur(
|
||||
image_frame: ImageFrameTable<Color>,
|
||||
/// The radius of the blur kernel.
|
||||
#[range((0., 100.))]
|
||||
#[hard_min(0.)]
|
||||
radius: PixelLength,
|
||||
/// Use a lower-quality box kernel instead of a circular Gaussian kernel. This is faster but produces boxy artifacts.
|
||||
box_blur: bool,
|
||||
|
||||
@@ -5,8 +5,8 @@ use graphene_core::{Color, Ctx};
|
||||
async fn image_color_palette(
|
||||
_: impl Ctx,
|
||||
image: ImageFrameTable<Color>,
|
||||
#[min(1.)]
|
||||
#[max(28.)]
|
||||
#[hard_min(1.)]
|
||||
#[soft_max(28.)]
|
||||
max_size: u32,
|
||||
) -> Vec<Color> {
|
||||
const GRID: f32 = 3.;
|
||||
|
||||
Reference in New Issue
Block a user