This commit is contained in:
David Tschumperle 2023-10-02 15:26:40 +02:00
parent 9c2743d9a6
commit 8740134a97
1 changed files with 34 additions and 34 deletions

View File

@ -1618,7 +1618,7 @@ clean_cluts :
if "ref(crop(#0,0,0,0,3,1,h,1,1),R);
ref(crop(#0,0,0,0,4,1,h,1,1),G);
ref(crop(#0,0,0,0,5,1,h,1,1),B);
R==G && G==B?1:0"
R==G && G==B"
channels 0,3
fi
}
@ -6470,7 +6470,7 @@ _parse_cli_images : l[] { check "isbool(${1=1})" is_arg=1 arg1=$1 onfail is_arg=
else # Regular 1D,2D or 3D image
label2="("{w}x{h}x{d}x{s}")"
if s>4 channels 0,2 fi
r 100%,100%,100%,{max(s,3)},{s==1?1:0}
r 100%,100%,100%,{max(s,3)},{s==1}
if d>1 # Volumetric image -> Render as a 2D image
+slices 50%
@ -12917,7 +12917,7 @@ noise_poissondisk : check "${1=8}>0 && isint(${2=30}) && $2>0 && ${3=2}>0"
R0,K,P=${1-3}
foreach {
W,H,D:=[w,h,d]
value:=iM+(im==iM?1:0)
value:=iM+(im==iM)
R:=ispercentage($R0)?max(w,h,d)*$R0:$R0
C:=$R/sqrt(sum([$W,$H,$D]>1)) # Cell size
@ -14060,7 +14060,7 @@ ipremula :
#@cli : Convert color representation of selected images from RGB to Jzazbz.
#@cli : Default value: 'illuminant=2'.
jzazbz2rgb : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from Jzazbz to RGB, using the "${arg0\ $illu,D50,D65,E}" illuminant."
jzazbz2xyz xyz2rgb $illu
@ -14117,7 +14117,7 @@ lab2lch :
#@cli : Default value: 'illuminant=2'.
#@cli : $ (50,50;50,50^-3,3;-3,3^-3,-3;3,3) resize 400,400,1,3,3 lab2rgb
lab2rgb : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from Lab to RGB, using the "${arg0\ $illu,D50,D65,E}" illuminant."
lab2xyz $illu xyz2rgb $illu
@ -14126,7 +14126,7 @@ lab2rgb : skip "${1=,}"
#@cli : Default value: 'illuminant=2'.
#@cli : $ (50,50;50,50^-3,3;-3,3^-3,-3;3,3) resize 400,400,1,3,3 lab2rgb
lab2srgb : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from Lab to sRGB, using the "${arg0\ $illu,D50,D65,E}" illuminant."
lab2rgb $illu rgb2srgb
@ -14135,7 +14135,7 @@ lab2srgb : skip "${1=,}"
#@cli : Default value: 'illuminant=2'.
#@cli : $ (50,50;50,50^-3,3;-3,3^-3,-3;3,3) resize 400,400,1,3,3 lab2rgb
lab82srgb : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from Lab8 to sRGB, using the "${arg0\ $illu,D50,D65,E}" illuminant."
lab82rgb $illu rgb2srgb
@ -14143,7 +14143,7 @@ lab82srgb : skip "${1=,}"
#@cli : Convert color representation of selected images from Lab to XYZ.
#@cli : Default value: 'illuminant=2'.
lab2xyz : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from Lab to XYZ, using the "${arg0\ $illu,D50,D65,E}" illuminant."
to_color
f "
@ -14176,7 +14176,7 @@ lab2xyz : skip "${1=,}"
#@cli : Convert color representation of selected images from Lab8 to RGB.
#@cli : Default value: 'illuminant=2'.
lab82rgb : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from Lab8 to RGB, using the "${arg0\ $illu,D50,D65,E}" illuminant."
foreach {
sh[0] 0 /. 2.55 rm.
@ -14195,7 +14195,7 @@ lch2lab :
#@cli : Convert color representation of selected images from Lch to RGB.
#@cli : Default value: 'illuminant=2'.
lch2rgb : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from Lch to RGB, using the "${arg0\ $illu,D50,D65,E}" illuminant."
lch2lab lab2rgb $illu
@ -14203,7 +14203,7 @@ lch2rgb : skip "${1=,}"
#@cli : Convert color representation of selected images from Lch8 to RGB.
#@cli : Default value: 'illuminant=2'.
lch82rgb : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from Lch8 to RGB, using the "${arg0\ $illu,D50,D65,E}" illuminant."
pi,facth:=[pi,255/(2*pi)]
foreach {
@ -15314,7 +15314,7 @@ rgb2int :
#@cli : Convert color representation of selected images from RGB to Jzazbz.
#@cli : Default value: 'illuminant=2'.
rgb2jzazbz : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from RGB to Jzazbz, using the "${arg0\ $illu,D50,D65,E}" illuminant."
rgb2xyz $illu xyz2jzazbz
@ -15322,7 +15322,7 @@ rgb2jzazbz : skip "${1=,}"
#@cli : Convert color representation of selected images from RGB to Lab.
#@cli : Default value: 'illuminant=2'.
rgb2lab : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from RGB to Lab, using the "${arg0\ $illu,D50,D65,E}" illuminant."
rgb2xyz $illu xyz2lab $illu
@ -15331,7 +15331,7 @@ rgb2lab : skip "${1=,}"
#@cli : Default value: 'illuminant=2'.
#@cli : $ image.jpg rgb2lab8 split c
rgb2lab8 : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from RGB to Lab8, using the "${arg0\ $illu,D50,D65,E}" illuminant."
rgb2lab $illu
foreach {
@ -15346,7 +15346,7 @@ rgb2lab8 : skip "${1=,}"
#@cli : Default value: 'illuminant=2'.
#@cli : $ image.jpg rgb2lch split c
rgb2lch : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from RGB to Lch, using the "${arg0\ $illu,D50,D65,E}" illuminant."
rgb2lab $illu lab2lch
@ -15355,7 +15355,7 @@ rgb2lch : skip "${1=,}"
#@cli : Default value: 'illuminant=2'.
#@cli : $ image.jpg rgb2lch8 split c
rgb2lch8 : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from RGB to Lch8, using the "${arg0\ $illu,D50,D65,E}" illuminant."
pi,facth:=[pi,255/(2*pi)]
rgb2lch $illu
@ -15440,7 +15440,7 @@ rgb2srgb :
#@cli : Default value: 'illuminant=2'.
#@cli : $ image.jpg rgb2xyz split c
rgb2xyz : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from RGB to XYZ, using the "${arg0\ $illu,D50,D65,E}" illuminant."
if $illu==2 # E
mix_rgb {[0.488718,0.3106803,0.2006017,\
@ -15461,7 +15461,7 @@ rgb2xyz : skip "${1=,}"
#@cli : Default value: 'illuminant=2'.
#@cli : $ image.jpg rgb2xyz8 split c
rgb2xyz8 : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from RGB to XYZ8, using the "${arg0\ $illu,D50,D65,E}" illuminant."
rgb2xyz $illu
foreach {
@ -15629,7 +15629,7 @@ split_opacity :
#@cli : $ image.jpg srgb2lab split c
#@cli : $ image.jpg srgb2lab +split c mul[-2,-1] 2.5 append[-3--1] c lab2srgb
srgb2lab : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from sRGB to Lab, using the "${arg0\ $illu,D50,D65,E}" illuminant."
srgb2rgb rgb2lab $illu
@ -15637,7 +15637,7 @@ srgb2lab : skip "${1=,}"
#@cli : Convert color representation of selected images from sRGB to Lab8.
#@cli : Default value: 'illuminant=2'.
srgb2lab8 : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from sRGB to Lab8, using the "${arg0\ $illu,D50,D65,E}" illuminant."
srgb2rgb rgb2lab8 $illu
@ -15801,7 +15801,7 @@ xyz2jzazbz :
#@cli : Convert color representation of selected images from XYZ to Lab.
#@cli : Default value: 'illuminant=2'.
xyz2lab : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from XYZ to Lab, using the "${arg0\ $illu,D50,D65,E}" illuminant."
to_color
f "
@ -15832,7 +15832,7 @@ xyz2lab : skip "${1=,}"
#@cli : Convert color representation of selected images from XYZ to RGB.
#@cli : Default value: 'illuminant=2'.
xyz2rgb : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from XYZ to RGB, using the "${arg0\ $illu,D50,D65,E}" illuminant."
if $illu==2 # E
mix_rgb {[2.3706743,-0.9000405,-0.4706338,\
@ -15853,7 +15853,7 @@ xyz2rgb : skip "${1=,}"
#@cli : Convert color representation of selected images from XYZ8 to RGB.
#@cli : Default value: 'illuminant=2'.
xyz82rgb : skip "${1=,}"
l[] { if isnum("$1") illu:="$1>1?2:$1>0?1:0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
l[] { if isnum("$1") illu:="$1>1?2:$1>0" else if ["'$1'"]!=',' noarg fi illu=2 fi onfail noarg illu=2 }
e[^-1] "Convert color representation of image$? from XYZ8 to RGB, using the "${arg0\ $illu,D50,D65,E}" illuminant."
foreach {
sh[0] 0 /. 255 rm.
@ -20395,7 +20395,7 @@ patches : check "isint($1) && $1>0 && isint($2) && $2>0 && isint($3) && $3>0"
#@cli plot2value
#@cli : Retrieve values from selected 2D graph plots.
#@cli : $ 400,300,1,1,'y>300*abs(cos(x/10+2*u))?1:0' +plot2value +display_graph[-1] 400,300
#@cli : $ 400,300,1,1,'y>300*abs(cos(x/10+2*u))' +plot2value +display_graph[-1] 400,300
plot2value :
e[^-1] "Retrieve values from 2D graph plot$?."
foreach {
@ -33000,7 +33000,7 @@ _dec2bin :
const N = (isinf($1) || isnan($1)?1:1 + floor(log2(max(1,abs($1))))) + (sgn>=0?0:1);
res = vectorN();
sgn>=0?0:(res[0] = _'-');
for (val = abs($1); k = size(res) - 1, k>=(sgn<0?1:0), --k, res[k] = _'0' + (val&1); val>>=1); res"`}
for (val = abs($1); k = size(res) - 1, k>=(sgn<0), --k, res[k] = _'0' + (val&1); val>>=1); res"`}
#@cli dec2hex : decimal_int1,...
#@cli : Convert specified decimal integers into their hexadecimal representations.
@ -33013,7 +33013,7 @@ _dec2hex :
const N = (isinf($1) || isnan($1)?1:1 + floor(log2(max(1,abs($1)))/4)) + (sgn>=0?0:1);
res = vectorN();
sgn>=0?0:(res[0] = _'-');
for (val = abs($1); k = size(res) - 1, k>=(sgn<0?1:0), --k, res[k] = tab[val&15]; val>>=4); res"`}
for (val = abs($1); k = size(res) - 1, k>=(sgn<0), --k, res[k] = tab[val&15]; val>>=4); res"`}
#@cli dec2oct : decimal_int1,...
#@cli : Convert specified decimal integers into their octal representations.
@ -33025,7 +33025,7 @@ _dec2oct :
const N = (isinf($1) || isnan($1)?1:1 + floor(log2(max(1,abs($1)))/3)) + (sgn>=0?0:1);
res = vectorN();
sgn>=0?0:(res[0] = _'-');
for (val = abs($1); k = size(res) - 1, k>=(sgn<0?1:0), --k, res[k] = _'0' + (val&7); val>>=3); res"`}
for (val = abs($1); k = size(res) - 1, k>=(sgn<0), --k, res[k] = _'0' + (val&7); val>>=3); res"`}
#@cli fibonacci : N>=0
#@cli : Return the Nth number of the Fibonacci sequence.
@ -36273,7 +36273,7 @@ x_connect4 : check_display $0
rgb2hsv. sh. 1,2 +. {0.4*sin(5*$|)} c. 0,1 rm. hsv2rgb.
j. [cache],0,0,0,0,1,[cachem],255
j[tmpvisu] .,{$R*[$x,$y]},0,0,1 rm.
x+=$c!=2?1:0 y+=$c==1?0:$c==4?-1:1
x+=$c!=2 y+=$c==1?0:$c==4?-1:1
}
fi
w[tmpvisu] 100%,100% rm[tmpvisu] wait 20
@ -36289,7 +36289,7 @@ x_connect4 : check_display $0
yM:=i("#"$ymax,$x)
if {board,$x<0" || "$x>=w} w[visu] 100%,100%
else
[visu] $R,100%,1,3,($yM>=0?1:0)*($turn?[255,255,0]:[255,0,0])
[visu] $R,100%,1,3,($yM>=0)*($turn?[255,255,0]:[255,0,0])
j.. .,{$x*$R},0,0,0,{$yM>=0?0.15:0.3} rm.
w. 100%,100% rm.
fi
@ -38002,7 +38002,7 @@ x_morph : check "isint(${1=16}) && isint(${2=3}) && $2>=0 && $2<=4" check_displa
elif $mouse_over" && "$selected_keypoint>=0" && ("{*,-DELETE}" || "$mb==4") && "h#$keypoints>4 # Delete keypoint
1,1,1,5,-1 j[keypoints] .,0,$selected_keypoint rm. discard[keypoints] -1 r[keypoints] 1,{keypoints,h/5},1,5,-1
N0-=$selected_keypoint<$N0?1:0 selected_keypoint=-1
N0-=$selected_keypoint<$N0 selected_keypoint=-1
rmn warp0,warp1,imgr
elif !{*,b}" && "$selected_keypoint>=0
@ -40080,7 +40080,7 @@ x_warp : check "isint(${1=2}) && $1>=2 && isint(${2=$1}) && $2>=2 && isint(${3=0
elif $mouse_over" && "$mb==2" && "$selected_keypoint>=0" && "h#$keypoints>4 # Remove keypoint
1,1,1,4,-1 j[keypoints] .,0,$selected_keypoint rm. discard[keypoints] -1 r[keypoints] 1,{keypoints,h/4},1,4,-1
N0-={$selected_keypoint<$N0?1:0} selected_keypoint=-1
N0-={$selected_keypoint<$N0} selected_keypoint=-1
rmn warp
elif !$mb selected_keypoint=-1
@ -44600,7 +44600,7 @@ _fx_colorize_lineart_smart :
repeat $1?1:$! { inds=${arg0\ !!$1,$<,0--1} l[$inds] {
ind_lineart:=$1==1?1:0
ind_lineart:=$1==1
nm=${gui_layer_name[$ind_lineart]} =>[$ind_lineart] lineart
if $!>1 ind_colors:=$1==1?0:1 nmc={$ind_colors,n} =>[$ind_colors] colors fi
@ -44690,7 +44690,7 @@ _fx_colorize_lineart_smart :
if $-1==-1 # Rendering : Lineart and color layers
if !$is_alpha gui_set_layer_mode[$ind_lineart] multiply fi
if $3 l[{$1==1?1:0}] { # Discard contour guides
if $3 l[{$1==1}] { # Discard contour guides
if $is_alpha
100%,100%,1,3,255 blend. [0],alpha,1 rgb2hsv. channels. 2 *. 255 negate.
channels.. 0,{0,s-2} s={0,s} luminance[0] to_colormode[0] $s a c
@ -49553,7 +49553,7 @@ fx_quadrangle_preview :
foreach {
if !$10 to_a fi
if $11 +fx_quadrangle $* rr2d. {0,[w,h]},2,3 fi
polygon[{$11==1?1:0}] 4,$1%,$2%,$3%,$4%,$5%,$6%,$7%,$8%,0.25,255
polygon[{$11==1}] 4,$1%,$2%,$3%,$4%,$5%,$6%,$7%,$8%,0.25,255
if $11>=2
circle[0] $1%,$2%,4,1,0 circle[0] $1%,$2%,3,1,255,0,0
circle[0] $3%,$4%,4,1,0 circle[0] $3%,$4%,3,1,0,255,0