diff --git a/crates/processing_core/src/constants.rs b/crates/processing_core/src/constants.rs index 3fb7ba0..443af6e 100644 --- a/crates/processing_core/src/constants.rs +++ b/crates/processing_core/src/constants.rs @@ -1,6 +1,7 @@ pub const CORNER: &str = "corner"; pub const CORNERS: &str = "corners"; pub const RADIUS: &str = "radius"; +pub const DIAMETER: &str = CENTER; // ellipse_mode alias for CENTER pub const CENTER: &str = "center"; // also the middle mouse button pub const ROUND: &str = "round"; // caps and joins @@ -46,8 +47,10 @@ pub const MIRROR: &str = "mirror"; pub const SRGB: &str = "srgb"; pub const LINEAR: &str = "linear"; // also the Sampler filter +pub const RGB: &str = SRGB; // color_mode alias pub const HSL: &str = "hsl"; pub const HSV: &str = "hsv"; +pub const HSB: &str = HSV; // color_mode alias pub const HWB: &str = "hwb"; pub const OKLAB: &str = "oklab"; pub const OKLCH: &str = "oklch"; @@ -134,10 +137,17 @@ pub const PI: f32 = std::f32::consts::PI; pub const TWO_PI: f32 = std::f32::consts::TAU; pub const HALF_PI: f32 = std::f32::consts::FRAC_PI_2; pub const QUARTER_PI: f32 = std::f32::consts::FRAC_PI_4; +pub const THIRD_PI: f32 = std::f32::consts::FRAC_PI_3; pub const TAU: f32 = std::f32::consts::TAU; pub const DEG_TO_RAD: f32 = std::f32::consts::PI / 180.0; pub const RAD_TO_DEG: f32 = 180.0 / std::f32::consts::PI; +pub const EPSILON: f32 = 0.0001; +pub const MAX_FLOAT: f32 = f32::MAX; +pub const MIN_FLOAT: f32 = -f32::MAX; +pub const MAX_INT: i32 = i32::MAX; +pub const MIN_INT: i32 = i32::MIN; + // Key codes stay numeric (compared against `key_code`); values must match `key_code_to_u32`. pub const KEY_A: u32 = 65; @@ -192,7 +202,9 @@ pub const BRACKET_RIGHT: u32 = 93; pub const BACKQUOTE: u32 = 96; pub const ESCAPE: u32 = 256; +pub const ESC: u32 = ESCAPE; pub const ENTER: u32 = 257; +pub const RETURN: u32 = ENTER; pub const TAB: u32 = 258; pub const BACKSPACE: u32 = 259; pub const INSERT: u32 = 260; diff --git a/crates/processing_pyo3/src/constants.rs b/crates/processing_pyo3/src/constants.rs index 99486f8..d576090 100644 --- a/crates/processing_pyo3/src/constants.rs +++ b/crates/processing_pyo3/src/constants.rs @@ -25,7 +25,7 @@ pub fn register(m: &Bound<'_, PyModule>) -> PyResult<()> { QUAD_STRIP, LINE_STRIP ); - add!(m, CORNER, CORNERS, CENTER, RADIUS); + add!(m, CORNER, CORNERS, CENTER, RADIUS, DIAMETER); add!(m, OPEN, CHORD, PIE, CLOSE); m.add("INVERT", crate::filter::INVERT_U8)?; @@ -43,7 +43,9 @@ pub fn register(m: &Bound<'_, PyModule>) -> PyResult<()> { add!(m, NORMAL, ITALIC, BOLD, BOLD_ITALIC); add!(m, WORD, CHAR); add!(m, NEAREST, CLAMP, REPEAT, MIRROR); - add!(m, SRGB, LINEAR, HSL, HSV, HWB, OKLAB, OKLCH, LAB, LCH, XYZ); + add!( + m, SRGB, RGB, LINEAR, HSL, HSV, HSB, HWB, OKLAB, OKLCH, LAB, LCH, XYZ + ); add!( m, PBR_NEUTRAL, @@ -56,8 +58,9 @@ pub fn register(m: &Bound<'_, PyModule>) -> PyResult<()> { SOMEWHAT_BORING_DISPLAY_TRANSFORM ); add!( - m, PI, TWO_PI, HALF_PI, QUARTER_PI, TAU, DEG_TO_RAD, RAD_TO_DEG + m, PI, TWO_PI, HALF_PI, QUARTER_PI, THIRD_PI, TAU, DEG_TO_RAD, RAD_TO_DEG ); + add!(m, EPSILON, MAX_FLOAT, MIN_FLOAT, MAX_INT, MIN_INT); add!( m, MAP, COMBINE, MIX, LOOKUP, REDUCE, EXTRACT, PACK, GENERATE @@ -121,7 +124,9 @@ pub fn register(m: &Bound<'_, PyModule>) -> PyResult<()> { add!( m, ESCAPE, + ESC, ENTER, + RETURN, TAB, BACKSPACE, INSERT,