@David_Tschumperle
I have been trying to access vectors outside of eval and fill. Can this be a new feature so that I wouldn’t have to create images to do this?
foo:
channel_order=[0,1,2]
repeat 3
echo {$channel_order[$>]}
done
This gives me a error
The reason I need something like that is that I can make this command work without needing to create new image.
#@cli rep_tg3: eq. to 'rep_trigometric_three_channel_gradient' : (+)
rep_tg3: rep_trigometric_three_channel_gradient $*
#@cli rep_trigometric_three_channel_gradient: _resolution,_chan_order={ 0=abc | 1=acb | 2=bac | 3=bca | 4=cab | 5=cba },_chan_form_a={ 0=sinusoidal | 1=cosinusoidal | 2=cubic-sinusoidal | 3=cubic-cosinusoidal | 4=cubic-sinusoidal-cosinusoidal },_multiplier_a>0,_valueshift_a,0>=_midgray_expf_a>=1,_lightness_merge_factor_a>=1,_lightness_end_expf_a>0,0>=_gray2col_end_a>=1,_chan_form_b={ 0=sinusoidal | 1=cosinusoidal | 2=cubic-sinusoidal | 3=cubic-cosinusoidal | 4=cubic-sinusoidal-cosinusoidal },_multiplier_b>0,_valueshift_b,0>=_midgray_expf_b>=1,_lightness_merge_factor_b>=1,_lightness_end_expf_b>0,0>=_gray2col_end_b>=1,_chan_form_c={ 0=sinusoidal | 1=cosinusoidal | 2=cubic-sinusoidal | 3=cubic-cosinusoidal | 4=cubic-sinusoidal-cosinusoidal },_multiplier_c>0,_valueshift_c,0>=_midgray_expf_c>=1,_lightness_merge_factor_c>=1,_lightness_end_expf_c>0,0>=_gray2col_end_c>=1
#@cli : Creates trigometric gradients or map images with trigometric coloring.
#@cli : (eq. to 'rep_tg3').\n
#@cli : '_resolution' defines the length of gradient or the way it is going to be mapped. See below for more information on _resolution.
#@cli : '_chan_order' defines the order of channel of gradient
#@cli : '_chan_form' refers to the formula each channels use
#@cli : '_multiplier' defines the multiplication of base gradient used to map trigometric formula.
#@cli : '_valueshift' refers to the value shift of base gradient
#@cli : '_midgray_expf' refers to the middle-point of base gradient used to map trigometric formula relative to middle.
#@cli : '_lightness_merge_factor' refers to the merging of lightness gradient with color gradient. Used to add white and black to gradient ends.
#@cli : '_lightness_end_expf' defines the magnitude of shades and tind of each end of end gradient
#@cli : '_gray2col_end' defines how much the end gradient overrides the base gradient\n
#@cli : '_resolution' values and processing info
#@cli : -----
#@cli : Info #1: If '_resolution' is a number: If _resolution is negative, create a 3-channel trigometric vertical gradient, else create 3-channel trigometric horizontal gradient.
#@cli : Info #2: If '_resolution' is "8i", then map trigometric function by first dividing by 255, then perform trigometric function, finally multiply by 255.
#@cli : Info #3: If '_resolution' is "8l", then map trigometric using luminosity of images using 8-bit values.
#@cli : Info #3: If '_resolution' is "l", then map trigometric using luminosity of images.
#@cli : Info #4: If '_resolution' is "m", then divide by the maximum value, then perform trigometric function.
#@cli : Info #4: If '_resolution' is "", then directly map trigometric function.
#@cli : -----\n
#@cli : Default values: 'resolution=256','_chan_order=0','_chan_form_a=0','_multiplier_a=1','_valueshift_a=0','_midgray_expf_a=1','_lightness_merge_factor_a=1','_lightness_end_expf_a=0','_gray2col_end_a=1','_chan_form_b=_chan_form_a','_multiplier_b=_multiplier_a','_valueshift_b=_valueshift_a','_midgray_expf_b=_midgray_expf_a','_lightness_merge_factor_b=_lightness_merge_factor_a','_lightness_end_expf_b=_lightness_end_expf_a','_gray2col_end_b=_gray2col_end_a','_chan_form_c=_chan_form_b','_multiplier_c=_multiplier_b','_valueshift_c=_valueshift_b','_midgray_expf_c=_midgray_expf_b','_lightness_merge_factor_c=_lightness_merge_factor_b','_lightness_end_expf_c=_lightness_end_expf_b','_gray2col_end_c=_gray2col_end_b'
rep_trigometric_three_channel_gradient:
skip ${1=256},${2=0},${3=},${4=},${5=},${6=},${7=},${8=},${9=},${10=},${11=},${12=},${13=},${14=},${15=},${16=},${17=},${18=},${19=},${20=},${21=},${22=},${23=}
val=$1
if narg($3) channel_formula=vector3($3) else channel_formula=vector3(0) fi
if narg($4) multiplier=vector3($4) else multiplier=vector3(1) fi
if narg($5) valueshift=vector3($5) else valueshift=vector3(0) fi
if narg($6) midgray_expf=vector3($6) else midgray_expf=vector3(1) fi
if narg($7) lightness_merge_factor=vector3($7) else lightness_merge_factor=vector3(1) fi
if narg($8) lightness_end_expf=vector3($8) else lightness_end_expf=vector3(0) fi
if narg($9) gray2col_end=vector3($9) else gray2col_end=vector3(1) fi
if narg($10) channel_formula[1,2]=$10 fi
if narg($11) multiplier[1,2]=$11 fi
if narg($12) valueshift[1,2]=$12 fi
if narg($13) midgray_expf[1,2]=$13 fi
if narg($14) lightness_merge_factor[1,2]=$14 fi
if narg($15) lightness_end_expf[1,2]=$15 fi
if narg($16) gray2col_end[1,2]=$16 fi
if narg($17) channel_formula[2]=$17 fi
if narg($18) multiplier[2]=$18 fi
if narg($19) valueshift[2]=$19 fi
if narg($20) midgray_expf[2]=$20 fi
if narg($21) lightness_merge_factor[2]=$21 fi
if narg($22) lightness_end_expf[2]=$22 fi
if narg($23) gray2col_end[2]=$23 fi
if $2==0 channel_order=[0,1,2]
elif $2==1 channel_order=[0,2,1]
elif $2==2 channel_order=[1,0,2]
elif $2==3 channel_order=[1,2,0]
elif $2==4 channel_order=[2,0,1]
elif $2==5 channel_order=[2,1,0]
fi
if isnum($1)
if $1>0 $1,1,1,3,"begin(ww=w-1;);x/ww"
elif $1<0 1,abs($1),1,3,"begin(hh=h-1;);y/hh"
else error "_resolution!=0==F"
fi
e $channel_order
repeat 3
sh. {$channel_order[$>]}
rep_trigmap. 1,{$channel_formula[$>]},{$multiplier[$>]},{$valueshift[$>]},{$midgray_expf[$>]},{$lightness_merge_factor[$>]},{$lightness_end_expf[$>]},{$gray2col_end[$>]}
rm.
done
fi
#@cli rep_trigmap: eq. to 'rep_trigometric_map' : (+)
rep_trigmap: rep_trigometric_map $*
#@cli rep_trigometric_map: _image_value_divide,_level_formula={ 0=sinusoidal | 1=cosinusoidal | 2=cubic-sinusoidal | 3=cubic-cosinusoidal | 4=cubic-sinusoidal-cosinusoidal },_multiplier>0,_valueshift,0>=_midgray_expf>=1,_lightness_merge_factor>=1,_lightness_end_expf>0,0>=_gray2col_end>=1
#@cli : Map trigometric function into image.
#@cli : (eq. to 'rep_trigmap').\n
#@cli : '_chan_form' refers to the formula each channels use
#@cli : '_multiplier' defines the multiplication of base gradient used to map trigometric formula.
#@cli : '_valueshift' refers to the value shift of base gradient
#@cli : '_midgray_expf' refers to the middle-point of base gradient used to map trigometric formula relative to middle.
#@cli : '_lightness_merge_factor' refers to the merging of lightness gradient with color gradient. Used to add white and black to gradient ends.
#@cli : '_lightness_end_expf' defines the magnitude of shades and tind of each end of end gradient
#@cli : '_gray2col_end' defines how much the end gradient overrides the base gradient\n
#@cli : Default values: '_image_value_divide=1','_multiplier_a=1','_valueshift_a=0','_midgray_expf_a=1','_lightness_merge_factor_a=1','_lightness_end_expf_a=0','_gray2col_end_a=1'
rep_trigometric_map:
skip ${1=1},${2=0},${3=1},${4=0},${5=1},${6=1},${7=0},${8=1}
if $1==0 error ""$"1!=0==f" fi
f "
begin(
if($2==0,level_formula(a)=(sin(a*pi)+1)/2;,
if($2==1,level_formula(a)=(cos(a*pi)+1)/2;,
if($2==2,level_formula(a)=(sin(a*pi+pi)^3+1)/2;,
if($2==3,level_formula(a)=(cos(a*pi+pi)^3+1)/2;,
level_formula(a)=((cos(a*pi+pi/2)*sin(a*pi+pi/2))^3+.125)*4;
);
);
);
);
);
slope=i/$1;
midslope=(max(1-slope,slope)-.5)*2;
col_chan_zero=level_formula($3*(slope^$5+$4));
mul_chan_zero=lerp(col_chan_zero,lerp(slope*col_chan_zero,slope,midslope^(abs($7+1))) ,midslope^(abs($7+1))*$6);
lerp(slope,mul_chan_zero,$8)*$1;
"