From c5f58e4ece94a1a181c7d5384d0d6e18d882f7f2 Mon Sep 17 00:00:00 2001 From: Daniel Martinek Date: Mon, 30 Mar 2026 22:07:49 +0200 Subject: [PATCH] add int to rgb and rgb to int --- more_math/Parser/MathExpr.g4 | 7 ++++++- web/script_text_input.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/more_math/Parser/MathExpr.g4 b/more_math/Parser/MathExpr.g4 index e1b5470..e69ef0a 100644 --- a/more_math/Parser/MathExpr.g4 +++ b/more_math/Parser/MathExpr.g4 @@ -208,7 +208,10 @@ func2: | SUBSTRING LPAREN expr COMMA expr (COMMA expr)? RPAREN # SubstringFunc | SUBSTR LPAREN expr COMMA expr (COMMA expr)? RPAREN # SubstringFunc | FIND LPAREN expr COMMA expr RPAREN # FindFunc - | REPLACE LPAREN expr COMMA expr COMMA expr RPAREN # ReplaceFunc; + | REPLACE LPAREN expr COMMA expr COMMA expr RPAREN # ReplaceFunc + | INT_TO_RGB LPAREN expr RPAREN # Int_to_rgbFunc + | RGB_TO_INT LPAREN expr ( COMMA expr COMMA expr)? RPAREN # Rgb_to_intFunc + ; func3: CLAMP LPAREN expr COMMA expr COMMA expr RPAREN # ClampFunc @@ -391,6 +394,8 @@ MORPH_OPEN: 'morph_open'; MORPH_CLOSE: 'morph_close'; RGB_TO_HSV: 'rgb_to_hsv'; HSV_TO_RGB: 'hsv_to_rgb'; +INT_TO_RGB: 'int_to_rgb'; +RGB_TO_INT: 'rgb_to_int'; IF: 'if'; ELSE: 'else'; diff --git a/web/script_text_input.js b/web/script_text_input.js index aafb7ba..4fcd0da 100644 --- a/web/script_text_input.js +++ b/web/script_text_input.js @@ -20,7 +20,7 @@ const FUNCTIONS = new Set([ "bnot", "bitwise_not", "bitcount", "popcount", "popcnt", "shape", "band", "bitwise_and", "bxor", "bitwise_xor", "bor", "bitwise_or", "tensor", "stack_push", "stack_pop", "stack_clear", "stack_has", "stack_get", "timestamp", "sort", "argsort", "argmin", "argmax", "softmax", "softmin", "unique", "flip", "cov", "corr", "correlation", "entropy", - "crop", "cat", "concatenate", "concat", + "crop", "cat", "concatenate", "concat", "float","int", "noise", "randn", "random_normal", "rand", "randu", "random_uniform", "randc", "random_cauchy", "rande", "random_exponential", "randln", "random_log_normal", "randb", "random_bernoulli", "randp", "random_poisson", "randg", "random_gamma", "randbeta", "random_beta", "randl", "random_laplace", "randgumbel", "random_gumbel", "randw", @@ -28,7 +28,7 @@ const FUNCTIONS = new Set([ "worley", "cellular_noise", "voronoi_noise", "plasma", "turbulence", "plasma_noise", "upper", "lower", "split", "join", "substring", "substr", "find", "trim", "replace", "dilate", "erode", "morph_open", "morph_close", - "rgb_to_hsv", "hsv_to_rgb" + "rgb_to_hsv", "hsv_to_rgb", "int_to_rgb", "rgb_to_int" ]); const BRACKET_PAIRS = {