Comment { Helpfiles / Fichiers d'aide: http://www.pruniermei.ca/mde-help.zip Pour me contacter / To contact me: http://www.pruniermei.ca } md-glyphia-b2004-11-27 { ; Michèle Dessureault, 2004/11/27 ; Modified Glyph formula from Samuel Monnier, 19.3.00 ; Modified Vine formula (from Mark Townsend) init: z = (0.0,0.0) x = 0 y = 0 newx = 0 newy = 0 int iter = 0 int i = 0 float xx = 0 float yy = 0 float bi = real(@bornes) float bs = imag(@bornes) loop: iter = iter + 1 _init = @fni(#z) x = real(_init) + flip(real(@start/100)) y = imag(_init) + flip(imag(@start/100)) newx = y newy = x i = 0 while i < @flavor i = i + 1 newx = y + real(@h2)*@fn1(@a * newx) + imag(@h2)*@fn2(@a * newx) newy = x + real(@h2)*@fn1(@a * newy) + imag(@h2)*@fn2(@a * newy) endwhile x = x - real(@h1)*@fn1(newx) - imag(@h1)*@fn2(newx) y = y + real(@h1)*@fn1(newy) + imag(@h1)*@fn2(newy) z = @fnx(x) + flip(@fny(y)) xx = real(z) yy = imag(z) if ((((xx-yy)>bi) && ((xx-yy)bi) && ((xx+yy)= @teinte_min && _h <= @teinte_max flag_mask = true endif if @satur_min != -1 && @satur_max != -1 && _s >= @satur_min && _s <= @satur_max flag_mask = true endif if @lumin_min != -1 && @lumin_max != -1 && _l >= @lumin_min && _l <= @lumin_max flag_mask = true endif if flag_mask if @pick_hsl == 0 _alpha = _hue6 elseif @pick_hsl == 1 _alpha = _satur elseif @pick_hsl == 2 _alpha = _lumin elseif @pick_hsl == 3 _alpha = (_hue6+_satur)/2 elseif @pick_hsl == 4 _alpha = (_hue6+_lumin)/2 elseif @pick_hsl == 5 _alpha = (_satur+_lumin)/2 elseif @pick_hsl == 6 _alpha = (_hue6+_satur+_lumin)/3 elseif @pick_hsl == 7 if _hue6>_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 8 if _hue6>_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 9 if _satur>_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 10 if _hue6>_satur && _hue6 > _lumin _alpha = _hue6 elseif _satur > _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 11 if _hue6<_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 12 if _hue6<_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 13 if _satur<_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 14 if _hue6<_satur && _hue6 < _lumin _alpha = _hue6 elseif _satur < _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 15 _alpha = @val_hsl/255 endif endif if @inv _alpha = 1-_alpha endif if @gscale if @gapply == 0 flag_mask = true endif if @gapply == 2 flag_mask = !flag_mask endif if flag_mask _satur = @gsatur/255 endif endif #color = hsla(_hue,_satur,_lumin,@autom_amt*_alpha) endif if @clspace == 1 float _rouge = red(_color) float _vert = green(_color) float _bleu = blue(_color) int _r =round(_rouge*255) int _g =round(_vert *255) int _b =round(_bleu *255) if @rouge_min != -1 && @rouge_max != -1 && _r >= @rouge_min && _r <= @rouge_max flag_mask = true endif if @vert_min != -1 && @vert_max != -1 && _g >= @vert_min && _g <= @vert_max flag_mask = true endif if @bleu_min != -1 && @bleu_max != -1 && _b >= @bleu_min && _b <= @bleu_max flag_mask = true endif if flag_mask if @pick_rgb == 0 _alpha = _rouge elseif @pick_rgb == 1 _alpha = _vert elseif @pick_rgb == 2 _alpha = _bleu elseif @pick_rgb == 3 _alpha = (_rouge+_vert)/2 elseif @pick_rgb == 4 _alpha = (_rouge+_bleu)/2 elseif @pick_rgb == 5 _alpha = (_vert+_bleu)/2 elseif @pick_rgb == 6 _alpha = (_rouge+_vert+_bleu)/3 elseif @pick_rgb == 7 if _rouge>_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 8 if _rouge>_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 9 if _vert>_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 10 if _rouge>_vert && _rouge > _bleu _alpha = _rouge elseif _vert > _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 11 if _rouge<_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 12 if _rouge<_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 13 if _vert<_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 14 if _rouge<_vert && _rouge < _bleu _alpha = _rouge elseif _vert < _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 15 _alpha = @val_rgb/255 endif endif if @inv _alpha = 1-_alpha endif if @negat if @napply == 0 flag_mask = true endif if @napply == 2 flag_mask = !flag_mask endif if flag_mask _rouge = 1- _rouge _vert = 1 - _vert _bleu = 1 - _bleu endif endif #color = rgba(_rouge,_vert,_bleu,@autom_amt*_alpha) endif default: title = "Glyphia with Automask" helpfile = "mde-help/mde3-glyphia-ucl.htm" float param version default = 27112004.1 visible = false endparam int param flavor caption = "Flavor" default = 6 min = 0 endparam float param a caption = "Alpha" default = 2.7 endparam param start caption = "Starting Point" endparam param h1 caption = "Step size I" default = (.05,.05) endparam param h2 caption = "Step size II" default = (.8,.8) endparam func fni caption = "Initial Function" default = ident() endfunc func fn1 caption = "First Function" default = sin() endfunc func fn2 caption = "Second Function" default = cos() endfunc heading caption = "Epsilon Range" endheading param bornes caption = "Epsilon Range" default = (0.0,0.0) endparam heading caption = "Function Application" endheading func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc heading caption = "Automask Toolbox" endheading bool param corrected caption = "Corrected?" default = false endparam bool param automask caption = "Show automask?" default = false endparam float param autom_amt caption = "Automask Amount" default = 1.0 min = 0.0 max = 1.0 visible = @automask endparam int param clspace caption = "Colorspace" enum = "HSL" "RGB" visible = @automask endparam Heading caption = "Hue Range" visible = (@clspace == 0 && @automask) endheading int param teinte_min caption="Minimum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param teinte_max caption="Maximum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Saturation Range" visible = (@clspace == 0 && @automask) endheading int param satur_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param satur_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Luminance Range" visible = (@clspace == 0 && @automask) endheading int param lumin_min caption = "Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param lumin_max caption = "Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 0 && @automask) endheading int param pick_hsl caption= "Use" enum = "H value" "S value" "L value" "Average HS" "Average HL" "Average SL" \ "Average HSL" "Max H/S" "Max H/L" "Max S/L" "Max H/S/L" "Min H/S" "Min H/L" \ "Min S/L" "Min H/S/L" "Custom" default = 2 visible = (@clspace == 0 && @automask) endparam int param val_hsl caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @pick_hsl == 15 && @automask) endparam Heading caption = "Red Range" visible = (@clspace == 1 && @automask) endheading int param rouge_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param rouge_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Green Range" visible = (@clspace == 1 && @automask) endheading int param vert_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param vert_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Blue Range" visible = (@clspace == 1 && @automask) endheading int param bleu_min caption="Minimum" default = -1 min= -1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param bleu_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 1 && @automask) endheading int param pick_rgb caption= "Use" enum = "R value" "G value" "B value" "Average RG" "Average RB" "Average GB" \ "Average RGB" "Max R/G" "Max R/B" "Max G/B" "Max R/G/B" "Min R/G" "Min R/B" \ "Min G/B" "Min R/G/B" "Custom" visible = (@clspace == 1 && @automask) endparam int param val_rgb caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 1 && @pick_rgb == 15 && @automask) endparam bool param inv caption = "Invert" default = false visible = @automask endparam heading caption = "Color Settings" visible = @automask endheading bool param gscale caption = "Turn Greyscale" default = false visible = (@clspace == 0 && @automask) endparam int param gsatur caption = "Saturation Level" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @gscale == true && @automask) endparam int param gapply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 0 && @gscale && @automask) endparam bool param negat caption = "Turn Negative" default = false visible = (@clspace == 1 && @automask) endparam int param napply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 1 && @negat && @automask) endparam } md-sinus-b2004-11-27 { ; Michèle Dessureault, 22 mars 2000 ; D'après la méthode de coloration 'Sinus' ; de Mark Townsend ; ; See also comments in the comments part of this file ; update november 2004 to add automask ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x =(0.0,0.0) y =(0.0,0.0) w =(0.0,0.0) float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float phi=0.0 float trap_a=0.0 float ro =0 float teta =0 p=(0.0,0.0) float pd=0.0 trap_p = 0 bool do_trap = true bool est_pair = true int temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif loop: if @var == 0 x = @ha * real(@fn3(@ht * imag(@fn1(#z))+0i)) y = @va * real(@fn3(@vt * real(@fn2(#z))+0i)) elseif @var == 1 x = @ha * real(@fn1(@ht * imag(@fn3(#z))+0i)) y = @va * real(@fn2(@vt * real(@fn3(#z))+0i)) elseif @var == 2 x = @ha * real(@fn1(@ht * imag(@fn3(#z))+0i)) y = @va * real(@fn3(@vt * real(@fn2(#z))+0i)) elseif @var == 3 x = @ha * real(@fn3(@ht * imag(@fn2(#z))+0i)) y = @va * real(@fn1(@vt * real(@fn3(#z))+0i)) elseif @var == 4 x = cabs(@fn1(#z)) y = atan2(@fn2(#z)) elseif @var == 5 ro = cabs(@fn1(#z)) teta = atan2(@fn2(#z)) if teta < 0 teta = teta + 2 * #pi endif float or = ro ro = ro + @ha * sin(@ht * teta) teta = teta + @va * cos(@vt * or) x = ro * cos(teta) y = ro * sin(teta) endif w = x + flip(y) if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif z= @fnx(x * (1.0,0.0)) + @fny(y * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif color _color = gradient(_index + texture) float _alpha = 1 if @corrected _alpha = alpha(_color) endif bool flag_mask = false if @clspace == 0 float _hue = hue(_color) float _hue6 = _hue/6 float _satur = sat(_color) float _lumin = lum(_color) int _h =round(_hue*60) int _s =round(_satur *255) int _l =round(_lumin *255) if @teinte_min != -1 && @teinte_max != -1 && _h >= @teinte_min && _h <= @teinte_max flag_mask = true endif if @satur_min != -1 && @satur_max != -1 && _s >= @satur_min && _s <= @satur_max flag_mask = true endif if @lumin_min != -1 && @lumin_max != -1 && _l >= @lumin_min && _l <= @lumin_max flag_mask = true endif if flag_mask if @pick_hsl == 0 _alpha = _hue6 elseif @pick_hsl == 1 _alpha = _satur elseif @pick_hsl == 2 _alpha = _lumin elseif @pick_hsl == 3 _alpha = (_hue6+_satur)/2 elseif @pick_hsl == 4 _alpha = (_hue6+_lumin)/2 elseif @pick_hsl == 5 _alpha = (_satur+_lumin)/2 elseif @pick_hsl == 6 _alpha = (_hue6+_satur+_lumin)/3 elseif @pick_hsl == 7 if _hue6>_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 8 if _hue6>_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 9 if _satur>_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 10 if _hue6>_satur && _hue6 > _lumin _alpha = _hue6 elseif _satur > _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 11 if _hue6<_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 12 if _hue6<_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 13 if _satur<_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 14 if _hue6<_satur && _hue6 < _lumin _alpha = _hue6 elseif _satur < _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 15 _alpha = @val_hsl/255 endif endif if @inv _alpha = 1-_alpha endif if @gscale if @gapply == 0 flag_mask = true endif if @gapply == 2 flag_mask = !flag_mask endif if flag_mask _satur = @gsatur/255 endif endif #color = hsla(_hue,_satur,_lumin,@autom_amt*_alpha) endif if @clspace == 1 float _rouge = red(_color) float _vert = green(_color) float _bleu = blue(_color) int _r =round(_rouge*255) int _g =round(_vert *255) int _b =round(_bleu *255) if @rouge_min != -1 && @rouge_max != -1 && _r >= @rouge_min && _r <= @rouge_max flag_mask = true endif if @vert_min != -1 && @vert_max != -1 && _g >= @vert_min && _g <= @vert_max flag_mask = true endif if @bleu_min != -1 && @bleu_max != -1 && _b >= @bleu_min && _b <= @bleu_max flag_mask = true endif if flag_mask if @pick_rgb == 0 _alpha = _rouge elseif @pick_rgb == 1 _alpha = _vert elseif @pick_rgb == 2 _alpha = _bleu elseif @pick_rgb == 3 _alpha = (_rouge+_vert)/2 elseif @pick_rgb == 4 _alpha = (_rouge+_bleu)/2 elseif @pick_rgb == 5 _alpha = (_vert+_bleu)/2 elseif @pick_rgb == 6 _alpha = (_rouge+_vert+_bleu)/3 elseif @pick_rgb == 7 if _rouge>_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 8 if _rouge>_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 9 if _vert>_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 10 if _rouge>_vert && _rouge > _bleu _alpha = _rouge elseif _vert > _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 11 if _rouge<_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 12 if _rouge<_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 13 if _vert<_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 14 if _rouge<_vert && _rouge < _bleu _alpha = _rouge elseif _vert < _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 15 _alpha = @val_rgb/255 endif endif if @inv _alpha = 1-_alpha endif if @negat if @napply == 0 flag_mask = true endif if @napply == 2 flag_mask = !flag_mask endif if flag_mask _rouge = 1- _rouge _vert = 1 - _vert _bleu = 1 - _bleu endif endif #color = rgba(_rouge,_vert,_bleu,@autom_amt*_alpha) endif default: title="Autre sinus with Automask" helpfile="mde-help\mde-autre-sinus.htm" float param version default = 27112004.1 visible = false endparam int param var caption = "Flavour" enum = "1st" "2nd" "3rd" "4th" "5th" "6th" endparam float param ht caption = "Horizontal Frequency" default = 10.0 endparam float param ha caption = "Horizontal Amplitude" default = 0.5 endparam float param vt caption = "Vertical Frequency" default = 10.0 endparam float param va caption = "Vertical Amplitude" default = 0.5 endparam func fn1 caption = "First Function" default = ident() endfunc func fn2 caption = "Second Function" default = ident() endfunc func fn3 caption = "Third Function" default = tan() endfunc heading caption = "Coordinates Toolbox" endheading int param coord caption = "Coordinates" enum="cartesian" "polar" "hyperbolic" default = 0 endparam heading caption = "Colorby Toolbox" endheading int param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam int param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam heading caption = "Barnsley Toolbox" endheading int param barn caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam float param barn_offset caption = "Offset" default = 0.0 visible = (@barn != 0) endparam func fnb caption = "Function" default = flip() visible = (@barn != 0) endfunc heading caption = "Odd-even Toolbox" endheading int param pairimp caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam bool param sgn caption = "Apply Sign?" default = false visible = (@pairimp != 0) endparam int param intf caption = "Factor" enum = "ceil" "floor" "trunc" "round" visible = (@pairimp != 0) endparam func fnpi caption = "Function" default = flip() visible = (@pairimp != 0) endfunc heading caption = "Random Texture Toolbox" endheading float param rnd caption = "Texture Amount" default = 0.0 endparam heading caption = "fBm Texture Toolbox" endheading float param fbmtxt caption = "Texture Amount" default = 0.0 endparam int param fbminit caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" visible = (@fbmtxt != 0.0) endparam float param fbmscale caption = "Scale" default = 1.0 visible = (@fbmtxt != 0.0) endparam param fbmoffset caption = "Offset" default = (0,0) visible = (@fbmtxt != 0.0) endparam float param fbmangle caption = "Rotation" default = 0.0 visible = (@fbmtxt != 0.0) endparam float param fbmstep caption = "Scale Step" default = 0.5 visible = (@fbmtxt != 0.0) endparam float param fbmastep caption = "Rotation Step" default = 37.0 visible = (@fbmtxt != 0.0) endparam int param fbmoct caption = "Octaves" default = 7 min = 1 visible = (@fbmtxt != 0.0) endparam float param fbmpower caption = "Exponent" default = 2.0 visible = (@fbmtxt != 0.0) endparam heading caption = "Decimal Texture Toolbox" endheading float param dectxt caption = "Texture Amount" default = 0.0 endparam int param dec_init caption = "Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" visible = (@dectxt != 0.0) endparam bool param dec_sgn caption = "Apply Sign?" default = true visible = (@dectxt != 0.0) endparam int param dec_type caption = "Type" enum = "Ceil" "Floor" "Trunc" "Round" visible = (@dectxt != 0.0) endparam float param dec_scale caption = "Scale" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_size caption = "Size" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@dectxt != 0.0) endparam heading caption = "Popgnarl Texture Toolbox" endheading float param txtr_gnarl caption = "Texture Amount" default = 0.0 endparam int param gnarl_init caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" default = 1 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_type caption = "Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" visible = (@txtr_gnarl != 0.0) endparam int param gnarl_form caption = "Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_scale caption = "Scale" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_scaling caption = "Scaling" enum = "Ceil" "Floor" "trunc" "round" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_size caption = "Size" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam float param gnarl_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_octaves caption = "Octaves" default = 5 min = 1 visible = (@txtr_gnarl != 0.0) endparam heading caption = "Trap Toolbox" endheading int param trapping caption = "Trapping" enum = "lower" "upper" endparam int param trp caption = "Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam float param trap_min caption = "Threshold" default = 1.0 min = 0.0 endparam heading caption = "Function Application Toolbox" endheading func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc heading caption = "Automask Toolbox" endheading bool param corrected caption = "Corrected?" default = false endparam bool param automask caption = "Show automask?" default = false endparam float param autom_amt caption = "Automask Amount" default = 1.0 min = 0.0 max = 1.0 visible = @automask endparam int param clspace caption = "Colorspace" enum = "HSL" "RGB" visible = @automask endparam Heading caption = "Hue Range" visible = (@clspace == 0 && @automask) endheading int param teinte_min caption="Minimum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param teinte_max caption="Maximum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Saturation Range" visible = (@clspace == 0 && @automask) endheading int param satur_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param satur_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Luminance Range" visible = (@clspace == 0 && @automask) endheading int param lumin_min caption = "Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param lumin_max caption = "Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 0 && @automask) endheading int param pick_hsl caption= "Use" enum = "H value" "S value" "L value" "Average HS" "Average HL" "Average SL" \ "Average HSL" "Max H/S" "Max H/L" "Max S/L" "Max H/S/L" "Min H/S" "Min H/L" \ "Min S/L" "Min H/S/L" "Custom" default = 2 visible = (@clspace == 0 && @automask) endparam int param val_hsl caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @pick_hsl == 15 && @automask) endparam Heading caption = "Red Range" visible = (@clspace == 1 && @automask) endheading int param rouge_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param rouge_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Green Range" visible = (@clspace == 1 && @automask) endheading int param vert_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param vert_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Blue Range" visible = (@clspace == 1 && @automask) endheading int param bleu_min caption="Minimum" default = -1 min= -1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param bleu_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 1 && @automask) endheading int param pick_rgb caption= "Use" enum = "R value" "G value" "B value" "Average RG" "Average RB" "Average GB" \ "Average RGB" "Max R/G" "Max R/B" "Max G/B" "Max R/G/B" "Min R/G" "Min R/B" \ "Min G/B" "Min R/G/B" "Custom" visible = (@clspace == 1 && @automask) endparam int param val_rgb caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 1 && @pick_rgb == 15 && @automask) endparam bool param inv caption = "Invert" default = false visible = @automask endparam heading caption = "Color Settings" visible = @automask endheading bool param gscale caption = "Turn Greyscale" default = false visible = (@clspace == 0 && @automask) endparam int param gsatur caption = "Saturation Level" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @gscale == true && @automask) endparam int param gapply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 0 && @gscale && @automask) endparam bool param negat caption = "Turn Negative" default = false visible = (@clspace == 1 && @automask) endparam int param napply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 1 && @negat && @automask) endparam } md-courbes-b2004-11-27 { ; Michèle Dessureault, 12 décembre 1999 ; d'après les pages 390 des Standard Mathematical Tables ; 22ème édition ; ; See also comments in the comments part of this file. ; Update october 2004 to add automask ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x =(0.0,0.0) y =(0.0,0.0) w =(0.0,0.0) float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float phi=0.0 float trap_a=0.0 p=(0.0,0.0) float pd=0.0 trap_p = 0 bool do_trap = true bool est_pair = true int temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif loop: if @courbe == 0 ;lissajou x = real(@fn1(@a*#z)) y = imag(@fn2(@b*#z)) elseif @courbe == 1 ;épicycloïde x = real((@a+@b)*@fn1(#z)- @b*@fn1(((@a+@b)/@b)*#z)) y = imag((@a+@b)*@fn2(#z)- @b*@fn2(((@a+@b)/@b)*#z)) elseif @courbe == 2 ;compagnon du cycloïde x = real(@a*#z) y = imag(@a*(1-@fn1(#z))) elseif @courbe == 3 ;cycloïde x = real(@a*#z - @b*@fn2(#z)) y = imag(@a*-@b*@fn1(#z)) elseif @courbe == 4 x = real(@a*@fn1(#z)) ;ellipse y = imag(@b*@fn2(#z)) elseif @courbe == 5 x = real(@a*@fn1(#z)*@fn1(#z)*@fn1(#z)) ;évolute de l'ellipse y = imag(@b*@fn2(#z)*@fn2(#z)*@fn2(#z)) elseif @courbe == 6 x = real(@b*@a*#z / (1+#z^3)) ;folium de Descartes y = imag(@b*@a+#z^2 / (1+#z^3)) elseif @courbe == 7 ;involute du cercle x = real(@a*@fn1(#z) + @a*#z*@fn2(#z)) y = imag(@a*@fn2(#z) - @a*#z*@fn1(#z)) elseif @courbe == 8 ;nephroïde x = real(@a*.5*(@b*@fn1(#z) - @fn1(@b*#z))) y = imag(@a*.5*(@b*@fn2(#z) - @fn2(@b*#z))) elseif @courbe == 9 ;courbe serpentine x = real(@a*@fn1(#z)/@fn2(#z)) y = imag(@b*@fn2(#z)*@fn1(#z)) elseif @courbe == 10 ;sorcière d'Agnesi x = real(@a*@fn1(#z)/@fn2(#z)) y = imag(@b*@fn2(#z)*@fn2(#z)) elseif @courbe == 11 ;tractrice x = real(#z-@a*@fn2(#z/@a)/@fn1(#z/@a)) y = imag(@a/@fn2(#z/@a)) elseif @courbe == 12 ;lissajou 2 x = @fn1(@a*#z) y = @fn2(@b*#z) elseif @courbe == 13 ;épicycloïde 2 x = (@a+@b)*@fn1(#z)- @b*@fn1(((@a+@b)/@b)*#z) y = (@a+@b)*@fn2(#z)- @b*@fn2(((@a+@b)/@b)*#z) elseif @courbe == 14 ;compagnon du cycloïde 2 x = @a*#z y = @a*(1-@fn1(#z)) elseif @courbe == 15 ;cycloïde 2 x = @a*#z - @b*@fn2(#z) y = @a*-@b*@fn1(#z) elseif @courbe == 16 x = @a*@fn1(#z) ;ellipse 2 y = @b*@fn2(#z) elseif @courbe == 17 x = @a*@fn1(#z)*@fn1(#z)*@fn1(#z) ;évolute de l'ellipse 2 y = @b*@fn2(#z)*@fn2(#z)*@fn2(#z) elseif @courbe == 18 x = @b*@a*#z / (1+#z^3) ;folium de Descartes 2 y = @b*@a+#z^2 / (1+#z^3) elseif @courbe == 19 ;involute du cercle 2 x = @a*@fn1(#z) + @a*#z*@fn2(#z) y = @a*@fn2(#z) - @a*#z*@fn1(#z) elseif @courbe == 20 ;nephroïde 2 x = @a*.5*(@b*@fn1(#z) - @fn1(@b*#z)) y = @a*.5*(@b*@fn2(#z) - @fn2(@b*#z)) elseif @courbe == 21 ;courbe serpentine 2 x = @a*@fn1(#z)/@fn2(#z) y = @b*@fn2(#z)*@fn1(#z) elseif @courbe == 22 ;sorcière d'Agnesi 2 x = @a*@fn1(#z)/@fn2(#z) y = @b*@fn2(#z)*@fn2(#z) elseif @courbe == 23 ;tractrice 2 x = #z-@a*@fn2(#z/@a)/@fn1(#z/@a) y = @a/@fn2(#z/@a) endif if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif z= @fnx(x * (1.0,0.0)) + @fny(y * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif color _color = gradient(_index + texture) float _alpha = 1 if @corrected _alpha = alpha(_color) endif bool flag_mask = false if @clspace == 0 float _hue = hue(_color) float _hue6 = _hue/6 float _satur = sat(_color) float _lumin = lum(_color) int _h =round(_hue*60) int _s =round(_satur *255) int _l =round(_lumin *255) if @teinte_min != -1 && @teinte_max != -1 && _h >= @teinte_min && _h <= @teinte_max flag_mask = true endif if @satur_min != -1 && @satur_max != -1 && _s >= @satur_min && _s <= @satur_max flag_mask = true endif if @lumin_min != -1 && @lumin_max != -1 && _l >= @lumin_min && _l <= @lumin_max flag_mask = true endif if flag_mask if @pick_hsl == 0 _alpha = _hue6 elseif @pick_hsl == 1 _alpha = _satur elseif @pick_hsl == 2 _alpha = _lumin elseif @pick_hsl == 3 _alpha = (_hue6+_satur)/2 elseif @pick_hsl == 4 _alpha = (_hue6+_lumin)/2 elseif @pick_hsl == 5 _alpha = (_satur+_lumin)/2 elseif @pick_hsl == 6 _alpha = (_hue6+_satur+_lumin)/3 elseif @pick_hsl == 7 if _hue6>_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 8 if _hue6>_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 9 if _satur>_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 10 if _hue6>_satur && _hue6 > _lumin _alpha = _hue6 elseif _satur > _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 11 if _hue6<_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 12 if _hue6<_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 13 if _satur<_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 14 if _hue6<_satur && _hue6 < _lumin _alpha = _hue6 elseif _satur < _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 15 _alpha = @val_hsl/255 endif endif if @inv _alpha = 1-_alpha endif if @gscale if @gapply == 0 flag_mask = true endif if @gapply == 2 flag_mask = !flag_mask endif if flag_mask _satur = @gsatur/255 endif endif #color = hsla(_hue,_satur,_lumin,@autom_amt*_alpha) endif if @clspace == 1 float _rouge = red(_color) float _vert = green(_color) float _bleu = blue(_color) int _r =round(_rouge*255) int _g =round(_vert *255) int _b =round(_bleu *255) if @rouge_min != -1 && @rouge_max != -1 && _r >= @rouge_min && _r <= @rouge_max flag_mask = true endif if @vert_min != -1 && @vert_max != -1 && _g >= @vert_min && _g <= @vert_max flag_mask = true endif if @bleu_min != -1 && @bleu_max != -1 && _b >= @bleu_min && _b <= @bleu_max flag_mask = true endif if flag_mask if @pick_rgb == 0 _alpha = _rouge elseif @pick_rgb == 1 _alpha = _vert elseif @pick_rgb == 2 _alpha = _bleu elseif @pick_rgb == 3 _alpha = (_rouge+_vert)/2 elseif @pick_rgb == 4 _alpha = (_rouge+_bleu)/2 elseif @pick_rgb == 5 _alpha = (_vert+_bleu)/2 elseif @pick_rgb == 6 _alpha = (_rouge+_vert+_bleu)/3 elseif @pick_rgb == 7 if _rouge>_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 8 if _rouge>_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 9 if _vert>_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 10 if _rouge>_vert && _rouge > _bleu _alpha = _rouge elseif _vert > _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 11 if _rouge<_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 12 if _rouge<_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 13 if _vert<_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 14 if _rouge<_vert && _rouge < _bleu _alpha = _rouge elseif _vert < _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 15 _alpha = @val_rgb/255 endif endif if @inv _alpha = 1-_alpha endif if @negat if @napply == 0 flag_mask = true endif if @napply == 2 flag_mask = !flag_mask endif if flag_mask _rouge = 1- _rouge _vert = 1 - _vert _bleu = 1 - _bleu endif endif #color = rgba(_rouge,_vert,_bleu,@autom_amt*_alpha) endif default: title="Courbes ++ with automask" helpfile="mde-help\mde-courbes++.htm" float param version default = 27112004.1 visible = false endparam int param courbe caption = "Curve" enum="lissajou" "epicycloid" "companion" "cycloid" \ "ellipse" "evolute" "folium" "involute" \ "nephroid" "serpentine" "agnesi" "tractrix" \ "lissajou 2" "epicycloïde 2" "companion 2" "cycloid 2" \ "ellipse 2" "evolute 2" "folium 2" "involute 2" \ "nephroid 2" "serpentine 2" "agnesi 2" "tractrix 2" endparam float param a caption = "a" default = 1.0 endparam float param b caption = "b" default = 1.0 visible = (@courbe != 2 && @courbe!= 7 && @courbe!= 11 && @courbe!= 14 && \ @courbe!= 19 && @courbe!= 23) endparam func fn1 caption = "First Function" default = cos() visible = !(@courbe == 6 || @courbe == 18) endfunc func fn2 caption = "Second Function" default = sin() visible = !(@courbe == 6 || @courbe == 18 || @courbe == 2 || @courbe == 14) endfunc heading caption = "Coordinates Toolbox" endheading int param coord caption = "Coordinates" enum="cartesian" "polar" "hyperbolic" default = 0 endparam heading caption = "Colorby Toolbox" endheading int param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam int param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam heading caption = "Barnsley Toolbox" endheading int param barn caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam float param barn_offset caption = "Offset" default = 0.0 visible = (@barn != 0) endparam func fnb caption = "Function" default = flip() visible = (@barn != 0) endfunc heading caption = "Odd-even Toolbox" endheading int param pairimp caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam bool param sgn caption = "Apply Sign?" default = false visible = (@pairimp != 0) endparam int param intf caption = "Factor" enum = "ceil" "floor" "trunc" "round" visible = (@pairimp != 0) endparam func fnpi caption = "Function" default = flip() visible = (@pairimp != 0) endfunc heading caption = "Random Texture Toolbox" endheading float param rnd caption = "Texture Amount" default = 0.0 endparam heading caption = "fBm Texture Toolbox" endheading float param fbmtxt caption = "Texture Amount" default = 0.0 endparam int param fbminit caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" visible = (@fbmtxt != 0.0) endparam float param fbmscale caption = "Scale" default = 1.0 visible = (@fbmtxt != 0.0) endparam param fbmoffset caption = "Offset" default = (0,0) visible = (@fbmtxt != 0.0) endparam float param fbmangle caption = "Rotation" default = 0.0 visible = (@fbmtxt != 0.0) endparam float param fbmstep caption = "Scale Step" default = 0.5 visible = (@fbmtxt != 0.0) endparam float param fbmastep caption = "Rotation Step" default = 37.0 visible = (@fbmtxt != 0.0) endparam int param fbmoct caption = "Octaves" default = 7 min = 1 visible = (@fbmtxt != 0.0) endparam float param fbmpower caption = "Exponent" default = 2.0 visible = (@fbmtxt != 0.0) endparam heading caption = "Decimal Texture Toolbox" endheading float param dectxt caption = "Texture Amount" default = 0.0 endparam int param dec_init caption = "Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" visible = (@dectxt != 0.0) endparam bool param dec_sgn caption = "Apply Sign?" default = true visible = (@dectxt != 0.0) endparam int param dec_type caption = "Type" enum = "Ceil" "Floor" "Trunc" "Round" visible = (@dectxt != 0.0) endparam float param dec_scale caption = "Scale" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_size caption = "Size" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@dectxt != 0.0) endparam heading caption = "Popgnarl Texture Toolbox" endheading float param txtr_gnarl caption = "Texture Amount" default = 0.0 endparam int param gnarl_init caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" default = 1 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_type caption = "Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" visible = (@txtr_gnarl != 0.0) endparam int param gnarl_form caption = "Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_scale caption = "Scale" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_scaling caption = "Scaling" enum = "Ceil" "Floor" "trunc" "round" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_size caption = "Size" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam float param gnarl_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_octaves caption = "Octaves" default = 5 min = 1 visible = (@txtr_gnarl != 0.0) endparam heading caption = "Trap Toolbox" endheading int param trapping caption = "Trapping" enum = "lower" "upper" endparam int param trp caption = "Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam float param trap_min caption = "Threshold" default = 1.0 min = 0.0 endparam heading caption = "Function Application Toolbox" endheading func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc heading caption = "Automask Toolbox" endheading bool param corrected caption = "Corrected?" default = false endparam bool param automask caption = "Show automask?" default = false endparam float param autom_amt caption = "Automask Amount" default = 1.0 min = 0.0 max = 1.0 visible = @automask endparam int param clspace caption = "Colorspace" enum = "HSL" "RGB" visible = @automask endparam Heading caption = "Hue Range" visible = (@clspace == 0 && @automask) endheading int param teinte_min caption="Minimum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param teinte_max caption="Maximum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Saturation Range" visible = (@clspace == 0 && @automask) endheading int param satur_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param satur_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Luminance Range" visible = (@clspace == 0 && @automask) endheading int param lumin_min caption = "Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param lumin_max caption = "Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 0 && @automask) endheading int param pick_hsl caption= "Use" enum = "H value" "S value" "L value" "Average HS" "Average HL" "Average SL" \ "Average HSL" "Max H/S" "Max H/L" "Max S/L" "Max H/S/L" "Min H/S" "Min H/L" \ "Min S/L" "Min H/S/L" "Custom" default = 2 visible = (@clspace == 0 && @automask) endparam int param val_hsl caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @pick_hsl == 15 && @automask) endparam Heading caption = "Red Range" visible = (@clspace == 1 && @automask) endheading int param rouge_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param rouge_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Green Range" visible = (@clspace == 1 && @automask) endheading int param vert_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param vert_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Blue Range" visible = (@clspace == 1 && @automask) endheading int param bleu_min caption="Minimum" default = -1 min= -1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param bleu_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 1 && @automask) endheading int param pick_rgb caption= "Use" enum = "R value" "G value" "B value" "Average RG" "Average RB" "Average GB" \ "Average RGB" "Max R/G" "Max R/B" "Max G/B" "Max R/G/B" "Min R/G" "Min R/B" \ "Min G/B" "Min R/G/B" "Custom" visible = (@clspace == 1 && @automask) endparam int param val_rgb caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 1 && @pick_rgb == 15 && @automask) endparam bool param inv caption = "Invert" default = false visible = @automask endparam heading caption = "Color Settings" visible = @automask endheading bool param gscale caption = "Turn Greyscale" default = false visible = (@clspace == 0 && @automask) endparam int param gsatur caption = "Saturation Level" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @gscale == true && @automask) endparam int param gapply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 0 && @gscale && @automask) endparam bool param negat caption = "Turn Negative" default = false visible = (@clspace == 1 && @automask) endparam int param napply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 1 && @negat && @automask) endparam } md-courbes-polaires-b2004-12-03 { ; Michèle Dessureault, 20 avril 2000 ; d'après les pages 390 des Standard Mathematical Tables ; 22ème édition ; Comme la méthode 'Courbes', mais celles en coordonnées ; polaires de ce manuel ; ; See also comments in the comments part of this file ; update october 2001 ; update in 2004-12 to include automask ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x=(0.0,0.0) y=(0.0,0.0) rho=(0.0,0.0) float texture=0.0 float phi=0.0 p=(0.0,0.0) float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 trap_p = (0.0,0.0) temp2 = (0.0,0.0) temp3 = (0.0,0.0) float pd = 0.0 bool do_trap = true bool est_pair = true float trap_a = 0.0 float signe = 1.0 int temp1= 0 trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif loop: if @courbe == 0 ;bifolium rho = @a*@fn2(#z)*@fn1(#z)*@fn1(#z) elseif @courbe == 1 ;limaçon de Pascal ; si a=b-> cardioïde rho = @a*@fn1(#z)+@b elseif @courbe == 2 ;cissoïde de Dioclès rho = @a*@fn2(#z)*@fn2(#z)/@fn1(#z) elseif @courbe == 3 ;cochléoïde rho = @a*@fn2(#z)/#z elseif @courbe == 4 ;conchoïde de Nicomède rho = @a/@fn2(#z)+@b elseif @courbe == 5 rho = (@a^2*@fn1(2*#z))^.5 ;lemniscate de Bernouilli elseif @courbe == 6 rho = (@a^2/#z)^.5 ;lituus elseif @courbe == 7 ;pétales rho = @a*@fn1(@b*#z) elseif @courbe == 8 ;parabole rho = 2*@a/(1-@fn1(#z)) elseif @courbe == 9 ;spirale d'Archimède rho = @a*#z elseif @courbe == 10 ;spirale hyperbolique rho = @a/#z elseif @courbe == 11 ;spirale logarithmique rho = exp(@a*#z) elseif @courbe == 12 ;strophoïde rho = @a*@fn1(2*#z)/@fn1(#z) endif x = real(rho) y = imag(rho) if @coord == 1 x = rho * cos(real(#z)) y = rho * sin(imag(#z)) elseif @coord ==2 x = rho * cosh(real(#z)) y = rho * sinh(imag(#z)) endif z= @fnx(x * (1.0,0.0)) + @fny(y * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif color _color = gradient(_index + texture) float _alpha = 1 if @corrected _alpha = alpha(_color) endif bool flag_mask = false if @clspace == 0 float _hue = hue(_color) float _hue6 = _hue/6 float _satur = sat(_color) float _lumin = lum(_color) int _h =round(_hue*60) int _s =round(_satur *255) int _l =round(_lumin *255) if @teinte_min != -1 && @teinte_max != -1 && _h >= @teinte_min && _h <= @teinte_max flag_mask = true endif if @satur_min != -1 && @satur_max != -1 && _s >= @satur_min && _s <= @satur_max flag_mask = true endif if @lumin_min != -1 && @lumin_max != -1 && _l >= @lumin_min && _l <= @lumin_max flag_mask = true endif if flag_mask if @pick_hsl == 0 _alpha = _hue6 elseif @pick_hsl == 1 _alpha = _satur elseif @pick_hsl == 2 _alpha = _lumin elseif @pick_hsl == 3 _alpha = (_hue6+_satur)/2 elseif @pick_hsl == 4 _alpha = (_hue6+_lumin)/2 elseif @pick_hsl == 5 _alpha = (_satur+_lumin)/2 elseif @pick_hsl == 6 _alpha = (_hue6+_satur+_lumin)/3 elseif @pick_hsl == 7 if _hue6>_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 8 if _hue6>_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 9 if _satur>_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 10 if _hue6>_satur && _hue6 > _lumin _alpha = _hue6 elseif _satur > _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 11 if _hue6<_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 12 if _hue6<_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 13 if _satur<_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 14 if _hue6<_satur && _hue6 < _lumin _alpha = _hue6 elseif _satur < _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 15 _alpha = @val_hsl/255 endif endif if @inv _alpha = 1-_alpha endif if @gscale if @gapply == 0 flag_mask = true endif if @gapply == 2 flag_mask = !flag_mask endif if flag_mask _satur = @gsatur/255 endif endif #color = hsla(_hue,_satur,_lumin,@autom_amt*_alpha) endif if @clspace == 1 float _rouge = red(_color) float _vert = green(_color) float _bleu = blue(_color) int _r =round(_rouge*255) int _g =round(_vert *255) int _b =round(_bleu *255) if @rouge_min != -1 && @rouge_max != -1 && _r >= @rouge_min && _r <= @rouge_max flag_mask = true endif if @vert_min != -1 && @vert_max != -1 && _g >= @vert_min && _g <= @vert_max flag_mask = true endif if @bleu_min != -1 && @bleu_max != -1 && _b >= @bleu_min && _b <= @bleu_max flag_mask = true endif if flag_mask if @pick_rgb == 0 _alpha = _rouge elseif @pick_rgb == 1 _alpha = _vert elseif @pick_rgb == 2 _alpha = _bleu elseif @pick_rgb == 3 _alpha = (_rouge+_vert)/2 elseif @pick_rgb == 4 _alpha = (_rouge+_bleu)/2 elseif @pick_rgb == 5 _alpha = (_vert+_bleu)/2 elseif @pick_rgb == 6 _alpha = (_rouge+_vert+_bleu)/3 elseif @pick_rgb == 7 if _rouge>_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 8 if _rouge>_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 9 if _vert>_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 10 if _rouge>_vert && _rouge > _bleu _alpha = _rouge elseif _vert > _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 11 if _rouge<_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 12 if _rouge<_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 13 if _vert<_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 14 if _rouge<_vert && _rouge < _bleu _alpha = _rouge elseif _vert < _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 15 _alpha = @val_rgb/255 endif endif if @inv _alpha = 1-_alpha endif if @negat if @napply == 0 flag_mask = true endif if @napply == 2 flag_mask = !flag_mask endif if flag_mask _rouge = 1- _rouge _vert = 1 - _vert _bleu = 1 - _bleu endif endif #color = rgba(_rouge,_vert,_bleu,@autom_amt*_alpha) endif default: title="Courbes polaires ++ with Automask" helpfile="mde-help\mde-courbes-polaires++.htm" float param version default = 20041203.1 visible = false endparam int param courbe caption = "Curve" enum="bifolium" "limacon" "cissoid" "cochleoid" \ "conchoid" "lemniscate" "lituus" "petals" "parabola" \ "Archimedes spiral" "hyperbolic spiral" \ "logarithmic spiral" "strophoid" endparam float param a caption = "a" default = 1.0 endparam float param b caption = "b" default = 1.0 visible = (@courbe == 1 || @courbe == 4 || @courbe == 7) endparam func fn1 caption = "First Function" default = cos() visible = (@courbe == 0 || @courbe == 2 || @courbe == 1 || @courbe == 5 || \ @courbe == 7 || @courbe == 8 || @courbe == 12) endfunc func fn2 caption = "Second Function" default = sin() visible = (@courbe == 0 || @courbe == 2 || @courbe == 3 || @courbe == 4) endfunc heading caption = "Coordinates Toolbox" endheading int param coord caption = "Coordinates" enum="cartesian" "polar" "hyperbolic" default = 0 endparam heading caption = "Colorby Toolbox" endheading int param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam int param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam heading caption = "Barnsley Toolbox" endheading int param barn caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam float param barn_offset caption = "Offset" default = 0.0 visible = (@barn != 0) endparam func fnb caption = "Function" default = flip() visible = (@barn != 0) endfunc heading caption = "Odd-even Toolbox" endheading int param pairimp caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam bool param sgn caption = "Apply Sign?" default = false visible = (@pairimp != 0) endparam int param intf caption = "Factor" enum = "ceil" "floor" "trunc" "round" visible = (@pairimp != 0) endparam func fnpi caption = "Function" default = flip() visible = (@pairimp != 0) endfunc heading caption = "Random Texture Toolbox" endheading float param rnd caption = "Texture Amount" default = 0.0 endparam heading caption = "fBm Texture Toolbox" endheading float param fbmtxt caption = "Texture Amount" default = 0.0 endparam int param fbminit caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" visible = (@fbmtxt != 0.0) endparam float param fbmscale caption = "Scale" default = 1.0 visible = (@fbmtxt != 0.0) endparam param fbmoffset caption = "Offset" default = (0,0) visible = (@fbmtxt != 0.0) endparam float param fbmangle caption = "Rotation" default = 0.0 visible = (@fbmtxt != 0.0) endparam float param fbmstep caption = "Scale Step" default = 0.5 visible = (@fbmtxt != 0.0) endparam float param fbmastep caption = "Rotation Step" default = 37.0 visible = (@fbmtxt != 0.0) endparam int param fbmoct caption = "Octaves" default = 7 min = 1 visible = (@fbmtxt != 0.0) endparam float param fbmpower caption = "Exponent" default = 2.0 visible = (@fbmtxt != 0.0) endparam heading caption = "Decimal Texture Toolbox" endheading float param dectxt caption = "Texture Amount" default = 0.0 endparam int param dec_init caption = "Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" visible = (@dectxt != 0.0) endparam bool param dec_sgn caption = "Apply Sign?" default = true visible = (@dectxt != 0.0) endparam int param dec_type caption = "Type" enum = "Ceil" "Floor" "Trunc" "Round" visible = (@dectxt != 0.0) endparam float param dec_scale caption = "Scale" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_size caption = "Size" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@dectxt != 0.0) endparam heading caption = "Popgnarl Texture Toolbox" endheading float param txtr_gnarl caption = "Texture Amount" default = 0.0 endparam int param gnarl_init caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" default = 1 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_type caption = "Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" visible = (@txtr_gnarl != 0.0) endparam int param gnarl_form caption = "Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_scale caption = "Scale" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_scaling caption = "Scaling" enum = "Ceil" "Floor" "trunc" "round" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_size caption = "Size" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam float param gnarl_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_octaves caption = "Octaves" default = 5 min = 1 visible = (@txtr_gnarl != 0.0) endparam heading caption = "Trap Toolbox" endheading int param trapping caption = "Trapping" enum = "lower" "upper" endparam int param trp caption = "Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam float param trap_min caption = "Threshold" default = 1.0 min = 0.0 endparam heading caption = "Function Application Toolbox" endheading func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc heading caption = "Automask Toolbox" endheading bool param corrected caption = "Corrected?" default = false endparam bool param automask caption = "Show automask?" default = false endparam float param autom_amt caption = "Automask Amount" default = 1.0 min = 0.0 max = 1.0 visible = @automask endparam int param clspace caption = "Colorspace" enum = "HSL" "RGB" visible = @automask endparam Heading caption = "Hue Range" visible = (@clspace == 0 && @automask) endheading int param teinte_min caption="Minimum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param teinte_max caption="Maximum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Saturation Range" visible = (@clspace == 0 && @automask) endheading int param satur_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param satur_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Luminance Range" visible = (@clspace == 0 && @automask) endheading int param lumin_min caption = "Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param lumin_max caption = "Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 0 && @automask) endheading int param pick_hsl caption= "Use" enum = "H value" "S value" "L value" "Average HS" "Average HL" "Average SL" \ "Average HSL" "Max H/S" "Max H/L" "Max S/L" "Max H/S/L" "Min H/S" "Min H/L" \ "Min S/L" "Min H/S/L" "Custom" default = 2 visible = (@clspace == 0 && @automask) endparam int param val_hsl caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @pick_hsl == 15 && @automask) endparam Heading caption = "Red Range" visible = (@clspace == 1 && @automask) endheading int param rouge_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param rouge_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Green Range" visible = (@clspace == 1 && @automask) endheading int param vert_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param vert_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Blue Range" visible = (@clspace == 1 && @automask) endheading int param bleu_min caption="Minimum" default = -1 min= -1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param bleu_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 1 && @automask) endheading int param pick_rgb caption= "Use" enum = "R value" "G value" "B value" "Average RG" "Average RB" "Average GB" \ "Average RGB" "Max R/G" "Max R/B" "Max G/B" "Max R/G/B" "Min R/G" "Min R/B" \ "Min G/B" "Min R/G/B" "Custom" visible = (@clspace == 1 && @automask) endparam int param val_rgb caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 1 && @pick_rgb == 15 && @automask) endparam bool param inv caption = "Invert" default = false visible = @automask endparam heading caption = "Color Settings" visible = @automask endheading bool param gscale caption = "Turn Greyscale" default = false visible = (@clspace == 0 && @automask) endparam int param gsatur caption = "Saturation Level" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @gscale == true && @automask) endparam int param gapply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 0 && @gscale && @automask) endparam bool param negat caption = "Turn Negative" default = false visible = (@clspace == 1 && @automask) endparam int param napply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 1 && @negat && @automask) endparam } md-Fourier-b2004-12-03 { ; Michèle Dessureault, août 2000 ; update octobre 2001 ; update 2004-12 to include automask ; ; - D'après les pages 474 & suivantes des Standard Mathematical Tables ; - From the Standard Mathematical Tables, 22nd edition, pp474- ; ; 4 premiers termes de l'équation générale des séries de Fourier ; 4 first terms of Fourier Series general equation: ; a0/2 + a1*cos(pi*#z/L)+ b1*sin(#pi*#z/L) + ; a2*cos(2*pi*#z/L)+ b2*sin(2*#pi*#z/L) + ; a3*cos(3*pi*#z/L)+ b3*sin(3*#pi*#z/L) + ; a4*cos(4*pi*#z/L)+ b4*sin(4*#pi*#z/L) ; init: float r=0.0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float _index = 0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 float pd=0.0 int iter=0 int trp_iter = 0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) w=(0.0,0.0) float x=0.0 float y=0.0 float rho = 0.0 float theta = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float texture_pri = 0.0 float phi=0.0 r1 = (0.0,0.0) r2 = (0.0,0.0) p=(0.0,0.0) float trap_a=0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 trap_p = 0 bool do_trap = true bool est_pair = true float temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif loop: w= @a0/2 + @a1*@fn1(#pi*#z/@l)+ @b1*@fn2(#pi*#z/@L) w= w+@a2*@fn1(2*#pi*#z/@L)+ @b2*@fn2(2*#pi*#z/@L) w= w+@a3*@fn1(3*#pi*#z/@L)+ @b3*@fn2(3*#pi*#z/@L) w= w+@a4*@fn1(4*#pi*#z/@L)+ @b4*@fn2(4*#pi*#z/@L) x= real(w) y= imag(w) if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif z= @fnx(((0.0,0.0)+ x) * (1.0,0.0)) + @fny(((0.0,0.0)+y) * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #Z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif x = real(p) y = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = x if @gnarl_form == 0 x = x - sin(y + sin(y)) y = y - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 x = x - sin(y + log(y + cos(y))) y = y - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 x = x - sin(y + cos(y)) y = y - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 x = x - sin(y + log(y + tan(y))) y = y - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 x = x - sin(y + log(y + sin(y))) y = y - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(x) elseif (@gnarl_type == 1) texture_gna = abs(y) elseif (@gnarl_type == 2) texture_gna = abs(x+y) elseif (@gnarl_type == 3) texture_gna = abs(x*y) elseif (@gnarl_type == 4) texture_gna = abs(x-y) elseif (@gnarl_type == 5) texture_gna = abs(x/y) elseif (@gnarl_type == 6) texture_gna = abs(y/x) elseif (@gnarl_type == 7) texture_gna = abs(x^y) elseif (@gnarl_type == 8) texture_gna = abs(y^x) elseif (@gnarl_type == 9) texture_gna = abs(1/x) elseif (@gnarl_type == 10) texture_gna = abs(1/y) elseif (@gnarl_type == 11) texture_gna = atan2(x+1i*y)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |x+1i*y| elseif (@gnarl_type == 13) texture_gna = (x+y+|x+1i*y|)/3 elseif (@gnarl_type == 14) texture_gna = (x*y*|x+1i*y|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna + \ texture_pri if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif x = real(zmin) y = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif x = real(zmax) y = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif x = real(z) y = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif x = real(z) y = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif x = real(trap_p) y = imag(trap_p) endif if @colorby == 5 _index = (x+y+|x+1i*y|)/3 ; arith.mean elseif @colorby == 6 _index = (x*y*|x+1i*y|)^(1/3) ; geom.mean elseif @colorby == 7 _index = x ; réel elseif @colorby == 8 _index = y ; imaginaire elseif @colorby == 9 _index = x + y ; real+imag elseif @colorby == 10 _index = x * y ; real*imag elseif @colorby == 11 _index = x - y ; real-imag elseif @colorby == 12 _index = y - x ; imag-real elseif @colorby == 13 _index = x / y ; real/imag elseif @colorby ==14 _index = y / x ; imag/real elseif @colorby == 15 _index = x ^ y ; real^imag elseif @colorby == 16 _index = y ^ x ; imag^real elseif @colorby == 17 _index = 1/x ; 1/real elseif @colorby == 18 _index = 1/y ; 1/imag endif color _color = gradient(_index + texture) float _alpha = 1 if @corrected _alpha = alpha(_color) endif bool flag_mask = false if @clspace == 0 float _hue = hue(_color) float _hue6 = _hue/6 float _satur = sat(_color) float _lumin = lum(_color) int _h =round(_hue*60) int _s =round(_satur *255) int _l =round(_lumin *255) if @teinte_min != -1 && @teinte_max != -1 && _h >= @teinte_min && _h <= @teinte_max flag_mask = true endif if @satur_min != -1 && @satur_max != -1 && _s >= @satur_min && _s <= @satur_max flag_mask = true endif if @lumin_min != -1 && @lumin_max != -1 && _l >= @lumin_min && _l <= @lumin_max flag_mask = true endif if flag_mask if @pick_hsl == 0 _alpha = _hue6 elseif @pick_hsl == 1 _alpha = _satur elseif @pick_hsl == 2 _alpha = _lumin elseif @pick_hsl == 3 _alpha = (_hue6+_satur)/2 elseif @pick_hsl == 4 _alpha = (_hue6+_lumin)/2 elseif @pick_hsl == 5 _alpha = (_satur+_lumin)/2 elseif @pick_hsl == 6 _alpha = (_hue6+_satur+_lumin)/3 elseif @pick_hsl == 7 if _hue6>_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 8 if _hue6>_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 9 if _satur>_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 10 if _hue6>_satur && _hue6 > _lumin _alpha = _hue6 elseif _satur > _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 11 if _hue6<_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 12 if _hue6<_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 13 if _satur<_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 14 if _hue6<_satur && _hue6 < _lumin _alpha = _hue6 elseif _satur < _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 15 _alpha = @val_hsl/255 endif endif if @inv _alpha = 1-_alpha endif if @gscale if @gapply == 0 flag_mask = true endif if @gapply == 2 flag_mask = !flag_mask endif if flag_mask _satur = @gsatur/255 endif endif #color = hsla(_hue,_satur,_lumin,@autom_amt*_alpha) endif if @clspace == 1 float _rouge = red(_color) float _vert = green(_color) float _bleu = blue(_color) int _r =round(_rouge*255) int _g =round(_vert *255) int _b =round(_bleu *255) if @rouge_min != -1 && @rouge_max != -1 && _r >= @rouge_min && _r <= @rouge_max flag_mask = true endif if @vert_min != -1 && @vert_max != -1 && _g >= @vert_min && _g <= @vert_max flag_mask = true endif if @bleu_min != -1 && @bleu_max != -1 && _b >= @bleu_min && _b <= @bleu_max flag_mask = true endif if flag_mask if @pick_rgb == 0 _alpha = _rouge elseif @pick_rgb == 1 _alpha = _vert elseif @pick_rgb == 2 _alpha = _bleu elseif @pick_rgb == 3 _alpha = (_rouge+_vert)/2 elseif @pick_rgb == 4 _alpha = (_rouge+_bleu)/2 elseif @pick_rgb == 5 _alpha = (_vert+_bleu)/2 elseif @pick_rgb == 6 _alpha = (_rouge+_vert+_bleu)/3 elseif @pick_rgb == 7 if _rouge>_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 8 if _rouge>_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 9 if _vert>_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 10 if _rouge>_vert && _rouge > _bleu _alpha = _rouge elseif _vert > _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 11 if _rouge<_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 12 if _rouge<_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 13 if _vert<_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 14 if _rouge<_vert && _rouge < _bleu _alpha = _rouge elseif _vert < _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 15 _alpha = @val_rgb/255 endif endif if @inv _alpha = 1-_alpha endif if @negat if @napply == 0 flag_mask = true endif if @napply == 2 flag_mask = !flag_mask endif if flag_mask _rouge = 1- _rouge _vert = 1 - _vert _bleu = 1 - _bleu endif endif #color = rgba(_rouge,_vert,_bleu,@autom_amt*_alpha) endif default: title="Fourier with Automask" helpfile="mde-help\mde-fourier-ucl.htm" float param version default = 20041203.1 visible = false endparam float param a0 caption = "A0" default = 1.0 endparam float param a1 caption = "A1" default = 1.0 endparam float param b1 caption = "B1" default = 1.0 endparam float param a2 caption = "A2" default = 0.0 endparam float param b2 caption = "B2" default = 0.0 endparam float param a3 caption = "A3" default = 0.0 endparam float param b3 caption = "B3" default = 0.0 endparam float param a4 caption = "A4" default = 0.0 endparam float param b4 caption = "B4" default = 0.0 endparam float param l caption = "Wavelength" default = 1.0 endparam func fn1 caption = "First Function" default = cos() endfunc func fn2 caption = "Second Function" default = sin() endfunc heading caption = "Coordinates Toolbox" endheading int param coord caption = "Coordinates" enum="cartesian" "polar" "hyperbolic" default = 0 endparam heading caption = "Colorby Toolbox" endheading int param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam int param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam heading caption = "Barnsley Toolbox" endheading int param barn caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam float param barn_offset caption = "Offset" default = 0.0 visible = (@barn != 0) endparam func fnb caption = "Function" default = flip() visible = (@barn != 0) endfunc heading caption = "Odd-even Toolbox" endheading int param pairimp caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam bool param sgn caption = "Apply Sign?" default = false visible = (@pairimp != 0) endparam int param intf caption = "Factor" enum = "ceil" "floor" "trunc" "round" visible = (@pairimp != 0) endparam func fnpi caption = "Function" default = flip() visible = (@pairimp != 0) endfunc heading caption = "Random Texture Toolbox" endheading float param rnd caption = "Texture Amount" default = 0.0 endparam heading caption = "fBm Texture Toolbox" endheading float param fbmtxt caption = "Texture Amount" default = 0.0 endparam int param fbminit caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" visible = (@fbmtxt != 0.0) endparam float param fbmscale caption = "Scale" default = 1.0 visible = (@fbmtxt != 0.0) endparam param fbmoffset caption = "Offset" default = (0,0) visible = (@fbmtxt != 0.0) endparam float param fbmangle caption = "Rotation" default = 0.0 visible = (@fbmtxt != 0.0) endparam float param fbmstep caption = "Scale Step" default = 0.5 visible = (@fbmtxt != 0.0) endparam float param fbmastep caption = "Rotation Step" default = 37.0 visible = (@fbmtxt != 0.0) endparam int param fbmoct caption = "Octaves" default = 7 min = 1 visible = (@fbmtxt != 0.0) endparam float param fbmpower caption = "Exponent" default = 2.0 visible = (@fbmtxt != 0.0) endparam heading caption = "Decimal Texture Toolbox" endheading float param dectxt caption = "Texture Amount" default = 0.0 endparam int param dec_init caption = "Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" visible = (@dectxt != 0.0) endparam bool param dec_sgn caption = "Apply Sign?" default = true visible = (@dectxt != 0.0) endparam int param dec_type caption = "Type" enum = "Ceil" "Floor" "Trunc" "Round" visible = (@dectxt != 0.0) endparam float param dec_scale caption = "Scale" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_size caption = "Size" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@dectxt != 0.0) endparam heading caption = "Popgnarl Texture Toolbox" endheading float param txtr_gnarl caption = "Texture Amount" default = 0.0 endparam int param gnarl_init caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" default = 1 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_type caption = "Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" visible = (@txtr_gnarl != 0.0) endparam int param gnarl_form caption = "Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_scale caption = "Scale" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_scaling caption = "Scaling" enum = "Ceil" "Floor" "trunc" "round" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_size caption = "Size" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam float param gnarl_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_octaves caption = "Octaves" default = 5 min = 1 visible = (@txtr_gnarl != 0.0) endparam heading caption = "Trap Toolbox" endheading int param trapping caption = "Trapping" enum = "lower" "upper" endparam int param trp caption = "Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam float param trap_min caption = "Threshold" default = 1.0 min = 0.0 endparam heading caption = "Function Application Toolbox" endheading func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc heading caption = "Automask Toolbox" endheading bool param corrected caption = "Corrected?" default = false endparam bool param automask caption = "Show automask?" default = false endparam float param autom_amt caption = "Automask Amount" default = 1.0 min = 0.0 max = 1.0 visible = @automask endparam int param clspace caption = "Colorspace" enum = "HSL" "RGB" visible = @automask endparam Heading caption = "Hue Range" visible = (@clspace == 0 && @automask) endheading int param teinte_min caption="Minimum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param teinte_max caption="Maximum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Saturation Range" visible = (@clspace == 0 && @automask) endheading int param satur_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param satur_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Luminance Range" visible = (@clspace == 0 && @automask) endheading int param lumin_min caption = "Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param lumin_max caption = "Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 0 && @automask) endheading int param pick_hsl caption= "Use" enum = "H value" "S value" "L value" "Average HS" "Average HL" "Average SL" \ "Average HSL" "Max H/S" "Max H/L" "Max S/L" "Max H/S/L" "Min H/S" "Min H/L" \ "Min S/L" "Min H/S/L" "Custom" default = 2 visible = (@clspace == 0 && @automask) endparam int param val_hsl caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @pick_hsl == 15 && @automask) endparam Heading caption = "Red Range" visible = (@clspace == 1 && @automask) endheading int param rouge_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param rouge_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Green Range" visible = (@clspace == 1 && @automask) endheading int param vert_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param vert_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Blue Range" visible = (@clspace == 1 && @automask) endheading int param bleu_min caption="Minimum" default = -1 min= -1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param bleu_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 1 && @automask) endheading int param pick_rgb caption= "Use" enum = "R value" "G value" "B value" "Average RG" "Average RB" "Average GB" \ "Average RGB" "Max R/G" "Max R/B" "Max G/B" "Max R/G/B" "Min R/G" "Min R/B" \ "Min G/B" "Min R/G/B" "Custom" visible = (@clspace == 1 && @automask) endparam int param val_rgb caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 1 && @pick_rgb == 15 && @automask) endparam bool param inv caption = "Invert" default = false visible = @automask endparam heading caption = "Color Settings" visible = @automask endheading bool param gscale caption = "Turn Greyscale" default = false visible = (@clspace == 0 && @automask) endparam int param gsatur caption = "Saturation Level" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @gscale == true && @automask) endparam int param gapply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 0 && @gscale && @automask) endparam bool param negat caption = "Turn Negative" default = false visible = (@clspace == 1 && @automask) endparam int param napply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 1 && @negat && @automask) endparam } md-ifs-b2004-12-03 { ; Michèle Dessureault, octobre 2001 ; update december 2004 to include automask ; ; D'après Roger Stevens, "Fractal programming in C", ; p.394 à 397 ; ; Mark Townsend m'a inspiré pour les modes de coloration ; Le code de masquage vient de Andreas Lober, 11 juin 2000 ; Merci pour la permission de publier ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x =(0.0,0.0) y =(0.0,0.0) w =(0.0,0.0) p =(0.0,0.0) trap_p =(0.0,0.0) float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float phi=0.0 float trap_a=0.0 float pd=0.0 bool do_trap = true bool est_pair = true int temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif float a1=0 float a2=0 float a3=0 float a4=0 float b1=0 float b2=0 float b3=0 float b4=0 float c1=0 float c2=0 float c3=0 float c4=0 float d1=0 float d2=0 float d3=0 float d4=0 float e1=0 float e2=0 float e3=0 float e4=0 float f1=0 float f2=0 float f3=0 float f4=0 float a=0 float b=0 float c=0 float d=0 float e0=0 float f=0 float pr=0 float r1=0 float r2=0 float r3=0 float r4=0 if @figure == 0 ;Sierpinsky a1=a2=a3=d1=d2=d3=e3=f3=0.5 e2=1.0 r1=10813.0 r2=21626.0 r3=32767.0 endif if @figure == 1 ;fougère a2=f2=f3=f4=0.2 a3=-0.15 a4=d4=0.85 b2=-0.26 b3=0.28 b4=0.04 c2=0.23 c3=0.26 c4=-0.04 d1=0.16 d2=0.22 d3=0.24 r1=328.0 r2=2621.0 r3=4915.0 r4=32767.0 endif if @figure == 2 ; arbre a2=d2=0.1 a3=b4=c3=d3=d4=0.42 a4=b3=c4=-0.42 d1=0.5 f2=f3=f4=0.2 r1=1638.0 r2=6553.0 r3=19660.0 r4=32767.0 endif if @figure == 3 ; arbre de Cantor a1=a2=d1=d2=0.333 a3=d3=0.667 e2=1.0 e3=f3=0.5 r1=10813.0 r2=21626.0 r3=32767.0 endif loop: if @hasard == 1 pr = real(#random*#z)*32767.0 elseif @hasard == 2 pr = imag(#random*#z)*32767.0 elseif @hasard == 0 ; pas de hasard pr = (real(#z)+imag(#z)) % 32767 elseif @hasard == 3 pr = (real(#random*#z)+imag(#random*#z)) *32767.0 elseif @hasard == 4 pr = (real(#random*#z)-imag(#random*#z)) *32767.0 elseif @hasard == 5 pr = (real(#random*#z)*imag(#random*#z)) *32767.0 elseif @hasard == 6 pr = (real(#random*#z)/imag(#random*#z)) *32767.0 elseif @hasard == 7 pr = (imag(#random*#z)/real(#random*#z)) *32767.0 elseif @hasard == 8 pr = (real(#random*#z)^imag(#random*#z)) *32767.0 elseif @hasard == 9 pr = (imag(#random*#z)^real(#random*#z)) *32767.0 elseif @hasard == 10 ; multi pr = (real(z)+imag(z)) * 32767 endif if @wrp == true && pr > 32767 pr = pr % 32767 endif if pr <= r1 a = a1 b = b1 c = c1 d = d1 e0 = e1 f = f1 endif if pr > r1 && pr <= r2 a = a2 b = b2 c = c2 d = d2 e0 = e2 f = f2 endif if pr > r2 && pr <= r3 a = a3 b = b3 c = c3 d = d3 e0 = e3 f = f3 endif if pr > r3 && pr <= r4 && (@figure == 1 || @figure == 2) a = a4 b = b4 c = c4 d = d4 e0 = e4 f = f4 endif x = real(a*real(#z) + b*imag(#z) + e0) y = imag(c*real(#z) + d*imag(#z) + f) w = x + flip(y) if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif z= @fnx(x * (1.0,0.0)) + @fny(y * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif endif remain=#z-z r=cabs(remain) path = path + r phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r11 = (0,1) ^ (@fbmangle / 90.0) r22 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r11 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r11 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r11 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r11 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r11 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r11 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r11 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r11 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r11 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r11 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r11 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r11 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r22 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif color _color = gradient(_index + texture) float _alpha = 1 if @corrected _alpha = alpha(_color) endif bool flag_mask = false if @clspace == 0 float _hue = hue(_color) float _hue6 = _hue/6 float _satur = sat(_color) float _lumin = lum(_color) int _h =round(_hue*60) int _s =round(_satur *255) int _l =round(_lumin *255) if @teinte_min != -1 && @teinte_max != -1 && _h >= @teinte_min && _h <= @teinte_max flag_mask = true endif if @satur_min != -1 && @satur_max != -1 && _s >= @satur_min && _s <= @satur_max flag_mask = true endif if @lumin_min != -1 && @lumin_max != -1 && _l >= @lumin_min && _l <= @lumin_max flag_mask = true endif if flag_mask if @pick_hsl == 0 _alpha = _hue6 elseif @pick_hsl == 1 _alpha = _satur elseif @pick_hsl == 2 _alpha = _lumin elseif @pick_hsl == 3 _alpha = (_hue6+_satur)/2 elseif @pick_hsl == 4 _alpha = (_hue6+_lumin)/2 elseif @pick_hsl == 5 _alpha = (_satur+_lumin)/2 elseif @pick_hsl == 6 _alpha = (_hue6+_satur+_lumin)/3 elseif @pick_hsl == 7 if _hue6>_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 8 if _hue6>_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 9 if _satur>_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 10 if _hue6>_satur && _hue6 > _lumin _alpha = _hue6 elseif _satur > _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 11 if _hue6<_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 12 if _hue6<_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 13 if _satur<_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 14 if _hue6<_satur && _hue6 < _lumin _alpha = _hue6 elseif _satur < _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 15 _alpha = @val_hsl/255 endif endif if @inv _alpha = 1-_alpha endif if @gscale if @gapply == 0 flag_mask = true endif if @gapply == 2 flag_mask = !flag_mask endif if flag_mask _satur = @gsatur/255 endif endif #color = hsla(_hue,_satur,_lumin,@autom_amt*_alpha) endif if @clspace == 1 float _rouge = red(_color) float _vert = green(_color) float _bleu = blue(_color) int _r =round(_rouge*255) int _g =round(_vert *255) int _b =round(_bleu *255) if @rouge_min != -1 && @rouge_max != -1 && _r >= @rouge_min && _r <= @rouge_max flag_mask = true endif if @vert_min != -1 && @vert_max != -1 && _g >= @vert_min && _g <= @vert_max flag_mask = true endif if @bleu_min != -1 && @bleu_max != -1 && _b >= @bleu_min && _b <= @bleu_max flag_mask = true endif if flag_mask if @pick_rgb == 0 _alpha = _rouge elseif @pick_rgb == 1 _alpha = _vert elseif @pick_rgb == 2 _alpha = _bleu elseif @pick_rgb == 3 _alpha = (_rouge+_vert)/2 elseif @pick_rgb == 4 _alpha = (_rouge+_bleu)/2 elseif @pick_rgb == 5 _alpha = (_vert+_bleu)/2 elseif @pick_rgb == 6 _alpha = (_rouge+_vert+_bleu)/3 elseif @pick_rgb == 7 if _rouge>_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 8 if _rouge>_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 9 if _vert>_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 10 if _rouge>_vert && _rouge > _bleu _alpha = _rouge elseif _vert > _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 11 if _rouge<_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 12 if _rouge<_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 13 if _vert<_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 14 if _rouge<_vert && _rouge < _bleu _alpha = _rouge elseif _vert < _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 15 _alpha = @val_rgb/255 endif endif if @inv _alpha = 1-_alpha endif if @negat if @napply == 0 flag_mask = true endif if @napply == 2 flag_mask = !flag_mask endif if flag_mask _rouge = 1- _rouge _vert = 1 - _vert _bleu = 1 - _bleu endif endif #color = rgba(_rouge,_vert,_bleu,@autom_amt*_alpha) endif default: title = "Ifs ++ with Automask" helpfile="mde-help\mde-IFS++.htm" float param version default = 20041203.1 visible = false endparam int param figure caption = "Figure" enum = "Sierpinsky" "fern" "tree" "Cantor tree" endparam int param hasard caption ="Chaos" enum="no" "real" "imaginary" "real+imag" "real-imag" "real*imag" \ "real/imag" "imag/real" "real^imag" "imag^real" "multi" endparam bool param wrp caption = "Apply wrap around?" default = false endparam heading caption = "Coordinates Toolbox" endheading int param coord caption = "Coordinates" enum="cartesian" "polar" "hyperbolic" default = 0 endparam heading caption = "Colorby Toolbox" endheading int param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam int param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam heading caption = "Barnsley Toolbox" endheading int param barn caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam float param barn_offset caption = "Offset" default = 0.0 visible = (@barn != 0) endparam func fnb caption = "Function" default = flip() visible = (@barn != 0) endfunc heading caption = "Odd-even Toolbox" endheading int param pairimp caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam bool param sgn caption = "Apply Sign?" default = false visible = (@pairimp != 0) endparam int param intf caption = "Factor" enum = "ceil" "floor" "trunc" "round" visible = (@pairimp != 0) endparam func fnpi caption = "Function" default = flip() visible = (@pairimp != 0) endfunc heading caption = "Random Texture Toolbox" endheading float param rnd caption = "Texture Amount" default = 0.0 endparam heading caption = "fBm Texture Toolbox" endheading float param fbmtxt caption = "Texture Amount" default = 0.0 endparam int param fbminit caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" visible = (@fbmtxt != 0.0) endparam float param fbmscale caption = "Scale" default = 1.0 visible = (@fbmtxt != 0.0) endparam param fbmoffset caption = "Offset" default = (0,0) visible = (@fbmtxt != 0.0) endparam float param fbmangle caption = "Rotation" default = 0.0 visible = (@fbmtxt != 0.0) endparam float param fbmstep caption = "Scale Step" default = 0.5 visible = (@fbmtxt != 0.0) endparam float param fbmastep caption = "Rotation Step" default = 37.0 visible = (@fbmtxt != 0.0) endparam int param fbmoct caption = "Octaves" default = 7 min = 1 visible = (@fbmtxt != 0.0) endparam float param fbmpower caption = "Exponent" default = 2.0 visible = (@fbmtxt != 0.0) endparam heading caption = "Decimal Texture Toolbox" endheading float param dectxt caption = "Texture Amount" default = 0.0 endparam int param dec_init caption = "Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" visible = (@dectxt != 0.0) endparam bool param dec_sgn caption = "Apply Sign?" default = true visible = (@dectxt != 0.0) endparam int param dec_type caption = "Type" enum = "Ceil" "Floor" "Trunc" "Round" visible = (@dectxt != 0.0) endparam float param dec_scale caption = "Scale" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_size caption = "Size" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@dectxt != 0.0) endparam heading caption = "Popgnarl Texture Toolbox" endheading float param txtr_gnarl caption = "Texture Amount" default = 0.0 endparam int param gnarl_init caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" default = 1 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_type caption = "Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" visible = (@txtr_gnarl != 0.0) endparam int param gnarl_form caption = "Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_scale caption = "Scale" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_scaling caption = "Scaling" enum = "Ceil" "Floor" "trunc" "round" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_size caption = "Size" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam float param gnarl_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_octaves caption = "Octaves" default = 5 min = 1 visible = (@txtr_gnarl != 0.0) endparam heading caption = "Trap Toolbox" endheading int param trapping caption = "Trapping" enum = "lower" "upper" endparam int param trp caption = "Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam float param trap_min caption = "Threshold" default = 1.0 min = 0.0 endparam heading caption = "Function Application Toolbox" endheading func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc heading caption = "Automask Toolbox" endheading bool param corrected caption = "Corrected?" default = false endparam bool param automask caption = "Show automask?" default = false endparam float param autom_amt caption = "Automask Amount" default = 1.0 min = 0.0 max = 1.0 visible = @automask endparam int param clspace caption = "Colorspace" enum = "HSL" "RGB" visible = @automask endparam Heading caption = "Hue Range" visible = (@clspace == 0 && @automask) endheading int param teinte_min caption="Minimum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param teinte_max caption="Maximum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Saturation Range" visible = (@clspace == 0 && @automask) endheading int param satur_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param satur_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Luminance Range" visible = (@clspace == 0 && @automask) endheading int param lumin_min caption = "Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param lumin_max caption = "Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 0 && @automask) endheading int param pick_hsl caption= "Use" enum = "H value" "S value" "L value" "Average HS" "Average HL" "Average SL" \ "Average HSL" "Max H/S" "Max H/L" "Max S/L" "Max H/S/L" "Min H/S" "Min H/L" \ "Min S/L" "Min H/S/L" "Custom" default = 2 visible = (@clspace == 0 && @automask) endparam int param val_hsl caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @pick_hsl == 15 && @automask) endparam Heading caption = "Red Range" visible = (@clspace == 1 && @automask) endheading int param rouge_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param rouge_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Green Range" visible = (@clspace == 1 && @automask) endheading int param vert_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param vert_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Blue Range" visible = (@clspace == 1 && @automask) endheading int param bleu_min caption="Minimum" default = -1 min= -1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param bleu_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 1 && @automask) endheading int param pick_rgb caption= "Use" enum = "R value" "G value" "B value" "Average RG" "Average RB" "Average GB" \ "Average RGB" "Max R/G" "Max R/B" "Max G/B" "Max R/G/B" "Min R/G" "Min R/B" \ "Min G/B" "Min R/G/B" "Custom" visible = (@clspace == 1 && @automask) endparam int param val_rgb caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 1 && @pick_rgb == 15 && @automask) endparam bool param inv caption = "Invert" default = false visible = @automask endparam heading caption = "Color Settings" visible = @automask endheading bool param gscale caption = "Turn Greyscale" default = false visible = (@clspace == 0 && @automask) endparam int param gsatur caption = "Saturation Level" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @gscale == true && @automask) endparam int param gapply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 0 && @gscale && @automask) endparam bool param negat caption = "Turn Negative" default = false visible = (@clspace == 1 && @automask) endparam int param napply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 1 && @negat && @automask) endparam } mde-gauss-automask { ; Kerry Mitchell 20sep98, updated 02apr99 ; Michèle Dessureault - novembre 1999, avril 2000, décembre 2004 ; ; Thanks to Damien Jones, Kerry Mitchell & Mark Townsend for the ; permission to publish. ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float rave = 0.0 float total=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) float texture=0.0 float phi=0.0 float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float trap_a=0.0 float pd=0.0 trap_p = 0 int temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) bool do_trap = true bool est_pair = true p=(0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif if(@norm==1) ; pixel normalization normfac=#pixel elseif(@norm==2) ; z normalization normfac=#z elseif(@norm==3) ; factor normalization normfac=@fac else ; no normalization normfac=(1.0,0.0) endif normfac=@fn(normfac) loop: iter=iter+1 if(@inttype==1) ; trunc temp=trunc(#z/normfac) elseif(@inttype==2) ; floor temp=floor(#z/normfac) elseif(@inttype==3) ; ceil temp=ceil(#z/normfac) else ; round temp=round(#z/normfac) endif w = temp*normfac if @coord > 0 x = real(w) y = imag(w) if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif w = x + flip(y) endif z=@fnx(w) ;z=temp*normfac if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif endif remain=#z-z r=cabs(remain) total=total+r rave=total/iter phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif color _color = gradient(_index + texture) float _alpha = alpha(_color) bool flag_mask = false if @clspace == 0 float _hue = hue(_color) float _hue6 = _hue/6 float _satur = sat(_color) float _lumin = lum(_color) int _h =round(_hue*60) int _s =round(_satur *255) int _l =round(_lumin *255) if @teinte_min != -1 && @teinte_max != -1 && _h >= @teinte_min && _h <= @teinte_max flag_mask = true endif if @satur_min != -1 && @satur_max != -1 && _s >= @satur_min && _s <= @satur_max flag_mask = true endif if @lumin_min != -1 && @lumin_max != -1 && _l >= @lumin_min && _l <= @lumin_max flag_mask = true endif if flag_mask if @pick_hsl == 0 _alpha = _hue6 elseif @pick_hsl == 1 _alpha = _satur elseif @pick_hsl == 2 _alpha = _lumin elseif @pick_hsl == 3 _alpha = (_hue6+_satur)/2 elseif @pick_hsl == 4 _alpha = (_hue6+_lumin)/2 elseif @pick_hsl == 5 _alpha = (_satur+_lumin)/2 elseif @pick_hsl == 6 _alpha = (_hue6+_satur+_lumin)/3 elseif @pick_hsl == 7 if _hue6>_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 8 if _hue6>_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 9 if _satur>_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 10 if _hue6>_satur && _hue6 > _lumin _alpha = _hue6 elseif _satur > _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 11 if _hue6<_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 12 if _hue6<_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 13 if _satur<_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 14 if _hue6<_satur && _hue6 < _lumin _alpha = _hue6 elseif _satur < _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 15 _alpha = @val_hsl/255 endif endif if @inv _alpha = 1-_alpha endif if @gscale if @gapply == 0 flag_mask = true endif if @gapply == 2 flag_mask = !flag_mask endif if flag_mask _satur = @gsatur/255 endif endif #color = hsla(_hue,_satur,_lumin,@autom_amt*_alpha) endif if @clspace == 1 float _rouge = red(_color) float _vert = green(_color) float _bleu = blue(_color) int _r =round(_rouge*255) int _g =round(_vert *255) int _b =round(_bleu *255) if @rouge_min != -1 && @rouge_max != -1 && _r >= @rouge_min && _r <= @rouge_max flag_mask = true endif if @vert_min != -1 && @vert_max != -1 && _g >= @vert_min && _g <= @vert_max flag_mask = true endif if @bleu_min != -1 && @bleu_max != -1 && _b >= @bleu_min && _b <= @bleu_max flag_mask = true endif if flag_mask if @pick_rgb == 0 _alpha = _rouge elseif @pick_rgb == 1 _alpha = _vert elseif @pick_rgb == 2 _alpha = _bleu elseif @pick_rgb == 3 _alpha = (_rouge+_vert)/2 elseif @pick_rgb == 4 _alpha = (_rouge+_bleu)/2 elseif @pick_rgb == 5 _alpha = (_vert+_bleu)/2 elseif @pick_rgb == 6 _alpha = (_rouge+_vert+_bleu)/3 elseif @pick_rgb == 7 if _rouge>_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 8 if _rouge>_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 9 if _vert>_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 10 if _rouge>_vert && _rouge > _bleu _alpha = _rouge elseif _vert > _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 11 if _rouge<_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 12 if _rouge<_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 13 if _vert<_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 14 if _rouge<_vert && _rouge < _bleu _alpha = _rouge elseif _vert < _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 15 _alpha = @val_rgb/255 endif endif if @inv _alpha = 1-_alpha endif if @negat if @napply == 0 flag_mask = true endif if @napply == 2 flag_mask = !flag_mask endif if flag_mask _rouge = 1- _rouge _vert = 1 - _vert _bleu = 1 - _bleu endif endif #color = rgba(_rouge,_vert,_bleu,@autom_amt*_alpha) endif default: title="fBm Gauss with Automask" float param version default = 20041231.1 visible = false endparam int param inttype caption="integer type" default=0 enum="round(z)" "trunc(z)" "floor(z)" "ceil(z)" endparam int param norm caption="normalization" default=0 enum="none" "pixel" "#z" "factor" endparam param fac caption="normalizing factor" default=(2.0,1.0) visible = (@norm==3) endparam func fn caption="Function" default= ident() endfunc heading caption = "Coordinates Toolbox" endheading int param coord caption = "Coordinates" enum="Cartesian" "Polar" "Hyperbolic" default = 0 endparam heading caption = "Colorby Toolbox" endheading int param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam int param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam heading caption = "Barnsley Toolbox" endheading int param barn caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam float param barn_offset caption = "Offset" default = 0.0 visible = (@barn != 0) endparam func fnb caption = "Function" default = flip() visible = (@barn != 0) endfunc heading caption = "Odd-even Toolbox" endheading int param pairimp caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam bool param sgn caption = "Apply Sign?" default = false visible = (@pairimp != 0) endparam int param intf caption = "Factor" enum = "ceil" "floor" "trunc" "round" visible = (@pairimp != 0) endparam func fnpi caption = "Function" default = flip() visible = (@pairimp != 0) endfunc heading caption = "Random Texture Toolbox" endheading float param rnd caption = "Texture Amount" default = 0.0 endparam heading caption = "fBm Texture Toolbox" endheading float param fbmtxt caption = "Texture Amount" default = 0.0 endparam int param fbminit caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" visible = (@fbmtxt != 0.0) endparam float param fbmscale caption = "Scale" default = 1.0 visible = (@fbmtxt != 0.0) endparam param fbmoffset caption = "Offset" default = (0,0) visible = (@fbmtxt != 0.0) endparam float param fbmangle caption = "Rotation" default = 0.0 visible = (@fbmtxt != 0.0) endparam float param fbmstep caption = "Scale Step" default = 0.5 visible = (@fbmtxt != 0.0) endparam float param fbmastep caption = "Rotation Step" default = 37.0 visible = (@fbmtxt != 0.0) endparam int param fbmoct caption = "Octaves" default = 7 min = 1 visible = (@fbmtxt != 0.0) endparam float param fbmpower caption = "Exponent" default = 2.0 visible = (@fbmtxt != 0.0) endparam heading caption = "Decimal Texture Toolbox" endheading float param dectxt caption = "Texture Amount" default = 0.0 endparam int param dec_init caption = "Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" visible = (@dectxt != 0.0) endparam bool param dec_sgn caption = "Apply Sign?" default = true visible = (@dectxt != 0.0) endparam int param dec_type caption = "Type" enum = "Ceil" "Floor" "Trunc" "Round" visible = (@dectxt != 0.0) endparam float param dec_scale caption = "Scale" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_size caption = "Size" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@dectxt != 0.0) endparam heading caption = "Popgnarl Texture Toolbox" endheading float param txtr_gnarl caption = "Texture Amount" default = 0.0 endparam int param gnarl_init caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" default = 1 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_type caption = "Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" visible = (@txtr_gnarl != 0.0) endparam int param gnarl_form caption = "Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_scale caption = "Scale" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_scaling caption = "Scaling" enum = "Ceil" "Floor" "trunc" "round" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_size caption = "Size" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam float param gnarl_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_octaves caption = "Octaves" default = 5 min = 1 visible = (@txtr_gnarl != 0.0) endparam heading caption = "Trap Toolbox" endheading int param trapping caption = "Trapping" enum = "lower" "upper" endparam int param trp caption = "Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam float param trap_min caption = "Threshold" default = 1.0 min = 0.0 endparam heading caption = "Function Application Toolbox" endheading func fnx caption = "Apply F(x)" default = ident() endfunc heading caption = "Automask Toolbox" endheading bool param automask caption = "Show automask?" default = false endparam float param autom_amt caption = "Automask Amount" default = 1.0 min = 0.0 max = 1.0 visible = @automask endparam int param clspace caption = "Colorspace" enum = "HSL" "RGB" visible = @automask endparam Heading caption = "Hue Range" visible = (@clspace == 0 && @automask) endheading int param teinte_min caption="Minimum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param teinte_max caption="Maximum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Saturation Range" visible = (@clspace == 0 && @automask) endheading int param satur_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param satur_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Luminance Range" visible = (@clspace == 0 && @automask) endheading int param lumin_min caption = "Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param lumin_max caption = "Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 0 && @automask) endheading int param pick_hsl caption= "Use" enum = "H value" "S value" "L value" "Average HS" "Average HL" "Average SL" \ "Average HSL" "Max H/S" "Max H/L" "Max S/L" "Max H/S/L" "Min H/S" "Min H/L" \ "Min S/L" "Min H/S/L" "Custom" default = 2 visible = (@clspace == 0 && @automask) endparam int param val_hsl caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @pick_hsl == 15 && @automask) endparam Heading caption = "Red Range" visible = (@clspace == 1 && @automask) endheading int param rouge_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param rouge_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Green Range" visible = (@clspace == 1 && @automask) endheading int param vert_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param vert_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Blue Range" visible = (@clspace == 1 && @automask) endheading int param bleu_min caption="Minimum" default = -1 min= -1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param bleu_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 1 && @automask) endheading int param pick_rgb caption= "Use" enum = "R value" "G value" "B value" "Average RG" "Average RB" "Average GB" \ "Average RGB" "Max R/G" "Max R/B" "Max G/B" "Max R/G/B" "Min R/G" "Min R/B" \ "Min G/B" "Min R/G/B" "Custom" visible = (@clspace == 1 && @automask) endparam int param val_rgb caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 1 && @pick_rgb == 15 && @automask) endparam bool param inv caption = "Invert" default = false visible = @automask endparam heading caption = "Color Settings" visible = @automask endheading bool param gscale caption = "Turn Greyscale" default = false visible = (@clspace == 0 && @automask) endparam int param gsatur caption = "Saturation Level" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @gscale == true && @automask) endparam int param gapply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 0 && @gscale && @automask) endparam bool param negat caption = "Turn Negative" default = false visible = (@clspace == 1 && @automask) endparam int param napply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 1 && @negat && @automask) endparam } mde-potpourri{ ; Michèle Dessureault, 2 mars 2007 ; Une formule qui s'est enrichie avec les années ; A formula that grew with the years ; See also comments in the comments part of this file ; init: float r=0.0 float rmin=1.0e12 float rmax=0.0 float t=0.0 int iter=0 int itermin=0 int itermax=0 zmin=(0.0,0.0) zmax=(0.0,0.0) z=(0.0,0.0) x =(0.0,0.0) y =(0.0,0.0) w =(0.0,0.0) float xx =0 float yy =0 float path = 0.0 float pathmin = 0.0 float pathmax = 0.0 float trap_path = 0.0 float trap_dist = 0.0 float trap_magn = 0.0 float trap_iter = 0.0 float _index = 0.0 float texture=0.0 float texture_rnd = 0.0 float texture_fbm = 0.0 float texture_dec = 0.0 float texture_gna = 0.0 float phi=0.0 float trap_a=0.0 float ro =0 float teta =0 p=(0.0,0.0) float pd=0.0 trap_p = 0 bool do_trap = true bool est_pair = true int temp1 = 0 temp2 = (0.0,0.0) float signe = 1.0 temp3 = (0.0,0.0) trp_iter = trunc(@trap_min) if trp_iter > #maxiter trp_iter = #maxiter elseif trp_iter < 1 trp_iter = 1 endif loop: if @var == 0 z= #z^@power x = real(z - real(z) + abs(real(z) - @offset)) y = imag(z - imag(z) + abs(imag(z) - @offset)) elseif @var == 1 z= #z^@power x = real(z + @offset) y = imag (1/z + @offset) elseif @var == 2 z = @fn1( (#z^@power + @offset - 1) / (2*#z + @offset - 2) ) x = real(z) y = imag(z) endif if @coord == 1 rho = sqrt(sqr(x)+sqr(y)) theta = atan2(y/x) if theta < 0 theta = theta + 2 * #pi endif x = rho y = theta elseif @coord ==2 rho = sqrt(sqr(x)+sqr(y)) x = rho * cosh(real(w)) y = rho * sinh(imag(w)) endif z= @fnx(x * (1.0,0.0)) + @fny(y * (0.0,1.0)) iter=iter+1 if @barn > 0 if @barn == 1 && real(z) >= @barn_offset z = @fnb(z) endif if @barn == 2 && imag(z) >= @barn_offset z = @fnb(z) endif if @barn == 3 && (real(z) * imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 4 && (real(z) + imag(z)) >= @barn_offset z = @fnb(z) endif if @barn == 5 && r >= @barn_offset z = @fnb(z) endif if @barn == 6 && phi >= @barn_offset z = @fnb(z) endif if @barn == 7 && cabs(z) >= @barn_offset z = @fnb(z) endif if @barn == 8 && path >= @barn_offset z = @fnb(z) endif if @barn == 9 && real(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 10 && imag(trap_p) >= @barn_offset z = @fnb(z) endif if @barn == 11 && (real(trap_p)*imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 12 && (real(trap_p)+imag(trap_p)) >= @barn_offset z = @fnb(z) endif if @barn == 13 && trap_dist >= @barn_offset z = @fnb(z) endif if @barn == 14 && trap_a >= @barn_offset z = @fnb(z) endif if @barn == 15 && trap_magn >= @barn_offset z = @fnb(z) endif if @barn == 16 && trap_path >= @barn_offset z = @fnb(z) endif if @barn == 17 && iter >= @barn_offset z = @fnb(z) endif if @barn == 18 && trap_iter >= @barn_offset z = @fnb(z) endif endif if @pairimp > 0 if @pairimp == 1 temp2 = real(z) elseif @pairimp == 2 temp2 = imag(z) elseif @pairimp == 3 temp2 = real(z) * imag(z) elseif @pairimp == 4 temp2 = real(z) + imag(z) elseif @pairimp == 5 temp2 = r elseif @pairimp == 6 temp2 = phi elseif @pairimp == 7 temp2 = cabs(z) elseif @pairimp == 8 temp2 = path elseif @pairimp == 9 temp2 = real(trap_p) elseif @pairimp == 10 temp2 = imag(trap_p) elseif @pairimp == 11 temp2 = real(trap_p)*imag(trap_p) elseif @pairimp == 12 temp2 = real(trap_p)+imag(trap_p) elseif @pairimp == 13 temp2 = trap_dist elseif @pairimp == 14 temp2 = trap_a elseif @pairimp == 15 temp2 = trap_magn elseif @pairimp == 16 temp2 = trap_path elseif @pairimp == 17 temp2 = iter elseif @pairimp == 18 temp2 = trap_iter endif if @sgn == true temp3 = real(z) * imag(z) if temp3 < 0 signe = -1.0 endif endif if @intf == 0 temp1 = ceil(signe*cabs(temp2)) elseif @intf == 1 temp1 = floor(signe*cabs(temp2)) elseif @intf == 2 temp1 = trunc(signe*cabs(temp2)) elseif @intf == 3 temp1 = round(signe*cabs(temp2)) endif if temp1 % 2 == 0 est_pair = true else est_pair = false endif IF est_pair z = @fnpi(z) endif endif remain=#z-z r=cabs(remain) total=total+r rave=total/iter phi = atan2(#z) phi = phi/#pi if phi < 0.0 phi = phi + 2.0 endif if(rrmax) rmax=r zmax=#z itermax=iter pathmax = path endif ; trappes if do_trap && \ ((@trp==0 && @trapping == 0 && iter<=trp_iter) || \ (@trp==0 && @trapping == 1 && iter>trp_iter) || \ (@trp==1 && @trapping == 0 && |z|<=@trap_min) || \ (@trp==1 && @trapping == 1 && |z|>@trap_min) || \ (@trp==2 && @trapping == 0 && r<=@trap_min) || \ (@trp==2 && @trapping == 1 && r>@trap_min) || \ (@trp==3 && @trapping == 0 && phi<=@trap_min) || \ (@trp==3 && @trapping == 1 && phi>@trap_min) || \ (@trp==4 && @trapping == 0 && real(z)<=@trap_min) || \ (@trp==4 && @trapping == 1 && real(z)>@trap_min) || \ (@trp==5 && @trapping == 0 && imag(z)<=@trap_min) || \ (@trp==5 && @trapping == 1 && imag(z)>@trap_min) || \ (@trp==6 && @trapping == 0 && path<=@trap_min) || \ (@trp==6 && @trapping == 1 && path>@trap_min)) do_trap = false trap_dist = r ; trap distance trap_p = z ;trap trap_a = phi ;trap angle trap_iter = iter trap_magn = cabs(z) trap_path = path endif final: ;Random complex hasard = #random texture_rnd = @rnd * (real(hasard)+ imag(hasard)) ; fBm if (@fbmtxt != 0) r1 = (0,1) ^ (@fbmangle / 90.0) r2 = (0,1) ^ (@fbmastep / 90.0) if @fbminit == 0 p = #pixel * @fbmscale * r1 + @fbmoffset elseif @fbminit == 1 p = z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 2 p = r * @fbmscale * r1 + @fbmoffset elseif @fbminit == 3 p = phi * @fbmscale * r1 + @fbmoffset elseif @fbminit == 4 p = cabs(z) * @fbmscale * r1 + @fbmoffset elseif @fbminit == 5 p = path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 6 p = trap_p * @fbmscale * r1 + @fbmoffset elseif @fbminit == 7 p = trap_dist * @fbmscale * r1 + @fbmoffset elseif @fbminit == 8 p = trap_a * @fbmscale * r1 + @fbmoffset elseif @fbminit == 9 p = trap_magn * @fbmscale * r1 + @fbmoffset elseif @fbminit == 10 p = trap_path * @fbmscale * r1 + @fbmoffset elseif @fbminit == 11 p = #z * @fbmscale * r1 + @fbmoffset elseif @fbminit == 12 p = texture_rnd * @fbmscale * r1 + @fbmoffset endif float sum = 0.0 float freq = 1.0 int i = @fbmoct while (i > 0) ; determine integer coordinate for corners of square ; surrounding p float bx0 = floor(real(p)) % 256 float by0 = floor(imag(p)) % 256 IF (bx0 < 0) bx0 = bx0 + 256 ENDIF IF (by0 < 0) by0 = by0 + 256 ENDIF float bx1 = (bx0 + 1) % 256 float by1 = (by0 + 1) % 256 float rx0 = real(p) - floor(real(p)) float ry0 = imag(p) - floor(imag(p)) float rx1 = rx0 - 1 float ry1 = ry0 - 1 float b00 = (bx0^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b10 = (bx1^@fbmpower % 65536 + by0)^@fbmpower % 65536 float b01 = (bx0^@fbmpower % 65536 + by1)^@fbmpower % 65536 float b11 = (bx1^@fbmpower % 65536 + by1)^@fbmpower % 65536 float g_b00_0 = (b00)^@fbmpower*0.25 % 512 - 256 float g_b10_0 = (b10)^@fbmpower*0.25 % 512 - 256 float g_b01_0 = (b01)^@fbmpower*0.25 % 512 - 256 float g_b11_0 = (b11)^@fbmpower*0.25 % 512 - 256 float g_b00_1 = (b00+1)^@fbmpower*0.25 % 512 - 256 float g_b10_1 = (b10+1)^@fbmpower*0.25 % 512 - 256 float g_b01_1 = (b01+1)^@fbmpower*0.25 % 512 - 256 float g_b11_1 = (b11+1)^@fbmpower*0.25 % 512 - 256 float d = 0.0; d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1)) g_b00_0 = g_b00_0 * d g_b00_1 = g_b00_1 * d d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1)) g_b10_0 = g_b10_0 * d g_b10_1 = g_b10_1 * d d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1)) g_b01_0 = g_b01_0 * d g_b01_1 = g_b01_1 * d d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1)) g_b11_0 = g_b11_0 * d g_b11_1 = g_b11_1 * d float u1 = rx0 * g_b00_0 + ry0 * g_b00_1 float v1 = rx1 * g_b10_0 + ry0 * g_b10_1 float u2 = rx0 * g_b01_0 + ry1 * g_b01_1 float v2 = rx1 * g_b11_0 + ry1 * g_b11_1 float sx = sqr(rx0) * (3 - rx0*2) float sy = sqr(ry0) * (3 - ry0*2) float a = u1 + sx*(v1-u1) float b = u2 + sx*(v2-u2) sum = sum + (a + sy*(b-a))*freq freq = freq * @fbmstep p = p * r2 / @fbmstep i = i - 1 endwhile texture_fbm = @fbmtxt * sum endif ;decimal if @dectxt > 0 if @dec_init == 0 pd = real(#z) elseif @dec_init == 1 pd = imag(#z) elseif @dec_init == 2 pd = r elseif @dec_init == 3 pd = phi elseif @dec_init == 4 pd = cabs(z) elseif @dec_init == 5 pd = path elseif @dec_init == 6 pd = real(trap_p) elseif @dec_init == 7 pd = imag(trap_p) elseif @dec_init == 8 pd = trap_dist elseif @dec_init == 9 pd = trap_a elseif @dec_init == 10 pd = trap_magn elseif @dec_init == 11 pd = trap_path elseif @dec_init == 12 pd = texture_rnd+texture_fbm endif if @dec_type == 0 pd = pd-ceil(pd*@dec_scale)/@dec_scale elseif @dec_type == 1 pd = pd-floor(pd*@dec_scale)/@dec_scale elseif @dec_type == 2 pd = pd-trunc(pd*@dec_scale)/@dec_scale elseif @dec_type == 3 pd = pd-round(pd*@dec_scale)/@dec_scale endif if @dec_size != 0 pd = pd/@dec_size endif texture_dec = @dectxt*pd if @dec_limit !=0 texture_dec= texture_dec%@dec_limit endif if @dec_sgn == true texture_dec = abs(texture_dec) endif endif if (@txtr_gnarl != 0) if @gnarl_init == 0 p = #pixel elseif @gnarl_init == 1 p = z elseif @gnarl_init == 2 p = r elseif @gnarl_init == 3 p = phi elseif @gnarl_init == 4 p = cabs(z) elseif @gnarl_init == 5 p = path elseif @gnarl_init == 6 p = trap_p elseif @gnarl_init == 7 p = trap_dist elseif @gnarl_init == 8 p = trap_a elseif @gnarl_init == 9 p = trap_magn elseif @gnarl_init == 10 p = trap_path elseif @gnarl_init == 11 p = #z elseif @gnarl_init == 12 p = texture_rnd+texture_fbm+texture_dec endif ; p = p-trunc(p*@gnarl_scale)/@gnarl_scale if @gnarl_scaling == 0 p = p-ceil(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 1 p = p-floor(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 2 p = p-trunc(p*@gnarl_scale)/@gnarl_scale elseif @gnarl_scaling == 3 p = p-round(p*@gnarl_scale)/@gnarl_scale endif if @gnarl_size != 0 p = p/@gnarl_size endif xx = real(p) yy = imag(p) float xOld = 0 int iter3 = @gnarl_octaves while (iter3 > 0) iter3 = iter3-1 xOld = xx if @gnarl_form == 0 xx = xx - sin(yy + sin(yy)) yy = yy - sin(xOld + sin(xOld)) elseif @gnarl_form == 1 xx = xx - sin(yy + log(yy + cos(yy))) yy = yy - sin(xOld + log(xOld + cos(xOld))) elseif @gnarl_form == 2 xx = xx - sin(yy + cos(yy)) yy = yy - sin(xOld + cos(xOld)) elseif @gnarl_form == 3 xx = xx - sin(yy + log(yy + tan(yy))) yy = yy - sin(xOld + log(xOld + tan(xOld))) elseif @gnarl_form == 4 xx = xx - sin(yy + log(yy + sin(yy))) yy = yy - sin(xOld + log(xOld + sin(xOld))) endif endwhile if (@gnarl_type == 0) texture_gna = abs(xx) elseif (@gnarl_type == 1) texture_gna = abs(yy) elseif (@gnarl_type == 2) texture_gna = abs(xx+yy) elseif (@gnarl_type == 3) texture_gna = abs(xx*yy) elseif (@gnarl_type == 4) texture_gna = abs(xx-yy) elseif (@gnarl_type == 5) texture_gna = abs(xx/yy) elseif (@gnarl_type == 6) texture_gna = abs(yy/xx) elseif (@gnarl_type == 7) texture_gna = abs(xx^yy) elseif (@gnarl_type == 8) texture_gna = abs(yy^xx) elseif (@gnarl_type == 9) texture_gna = abs(1/xx) elseif (@gnarl_type == 10) texture_gna = abs(1/yy) elseif (@gnarl_type == 11) texture_gna = atan2(xx+1i*yy)/(2*#pi) if (texture_gna < 0) texture_gna = texture_gna + 1 endif elseif (@gnarl_type == 12) texture_gna = |xx+1i*yy| elseif (@gnarl_type == 13) texture_gna = (xx+yy+|xx+1i*yy|)/3 elseif (@gnarl_type == 14) texture_gna = (xx*yy*|xx+1i*yy|)^(1/3) endif if @gnarl_limit !=0 texture_gna= texture_gna%@gnarl_limit endif endif texture = texture_rnd + texture_fbm + texture_dec + texture_gna if @colorfix ==0 if(@colorby==0) ; minimum distance _index=rmin elseif @colorby==1 ; iteration @ min _index=0.01*itermin elseif(@colorby==2) ; angle @ min t=atan2(zmin) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmin) ; magnitude @min elseif(@colorby==4) _index = pathmin ; path @min endif xx = real(zmin) yy = imag(zmin) endif if @colorfix == 1 if(@colorby==0) ; maximum distance _index=rmax elseif(@colorby==1) ; iteration @ max _index=0.01*itermax elseif(@colorby==2) ; angle @ max t=atan2(zmax) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(zmax) ; magnitude @max elseif(@colorby==4) _index = pathmax ; path @max endif xx = real(zmax) yy = imag(zmax) endif if @colorfix == 2 z = (zmin + zmax)/2 if(@colorby==0) ; average distance _index=path/iter elseif(@colorby==1) ; iteration @ average _index=0.01*iter/2 elseif(@colorby==2) ; angle @ average t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @average elseif(@colorby==4) _index = (pathmin + pathmax)/2 ; path @average endif xx = real(z) yy = imag(z) endif if @colorfix == 3 if(@colorby==0) ; last distance _index=r elseif(@colorby==1) ; iteration @ last _index=0.01*iter elseif(@colorby==2) ; angle @ last t=atan2(z) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = cabs(z) ; magnitude @last elseif(@colorby==4) _index = path ; path @last endif xx = real(z) yy = imag(z) endif if @colorfix == 4 if(@colorby==0) ; distance @trap _index=trap_dist elseif(@colorby==1) ; iteration @ trap _index=0.01*trap_iter elseif(@colorby==2) ; angle @ trap t=atan2(trap_p) t=t/pi if(t<0.0) t=t+2.0 endif _index=0.5*t elseif(@colorby==3) _index = trap_magn ; magnitude @trap elseif(@colorby==4) _index = trap_path ; path @trap endif xx = real(trap_p) yy = imag(trap_p) endif if @colorby == 5 _index = (xx+yy+|xx+1i*yy|)/3 ; arith.mean elseif @colorby == 6 _index = (xx*yy*|xx+1i*yy|)^(1/3) ; geom.mean elseif @colorby == 7 _index = xx ; réel elseif @colorby == 8 _index = yy ; imaginaire elseif @colorby == 9 _index = xx + yy ; real+imag elseif @colorby == 10 _index = xx * yy ; real*imag elseif @colorby == 11 _index = xx - yy ; real-imag elseif @colorby == 12 _index = yy - xx ; imag-real elseif @colorby == 13 _index = xx / yy ; real/imag elseif @colorby ==14 _index = yy / xx ; imag/real elseif @colorby == 15 _index = xx ^ yy ; real^imag elseif @colorby == 16 _index = yy ^ xx ; imag^real elseif @colorby == 17 _index = 1/xx ; 1/real elseif @colorby == 18 _index = 1/yy ; 1/imag endif color _color = gradient(_index + texture) float _alpha = alpha(_color) bool flag_mask = false if @clspace == 0 float _hue = hue(_color) float _hue6 = _hue/6 float _satur = sat(_color) float _lumin = lum(_color) int _h =round(_hue*60) int _s =round(_satur *255) int _l =round(_lumin *255) if @teinte_min != -1 && @teinte_max != -1 && _h >= @teinte_min && _h <= @teinte_max flag_mask = true endif if @satur_min != -1 && @satur_max != -1 && _s >= @satur_min && _s <= @satur_max flag_mask = true endif if @lumin_min != -1 && @lumin_max != -1 && _l >= @lumin_min && _l <= @lumin_max flag_mask = true endif if flag_mask if @pick_hsl == 0 _alpha = _hue6 elseif @pick_hsl == 1 _alpha = _satur elseif @pick_hsl == 2 _alpha = _lumin elseif @pick_hsl == 3 _alpha = (_hue6+_satur)/2 elseif @pick_hsl == 4 _alpha = (_hue6+_lumin)/2 elseif @pick_hsl == 5 _alpha = (_satur+_lumin)/2 elseif @pick_hsl == 6 _alpha = (_hue6+_satur+_lumin)/3 elseif @pick_hsl == 7 if _hue6>_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 8 if _hue6>_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 9 if _satur>_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 10 if _hue6>_satur && _hue6 > _lumin _alpha = _hue6 elseif _satur > _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 11 if _hue6<_satur _alpha = _hue6 else _alpha = _satur endif elseif @pick_hsl == 12 if _hue6<_lumin _alpha = _hue6 else _alpha = _lumin endif elseif @pick_hsl == 13 if _satur<_lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 14 if _hue6<_satur && _hue6 < _lumin _alpha = _hue6 elseif _satur < _lumin _alpha = _satur else _alpha = _lumin endif elseif @pick_hsl == 15 _alpha = @val_hsl/255 endif endif if @inv _alpha = 1-_alpha endif if @gscale if @gapply == 0 flag_mask = true endif if @gapply == 2 flag_mask = !flag_mask endif if flag_mask _satur = @gsatur/255 endif endif #color = hsla(_hue,_satur,_lumin,@autom_amt*_alpha) endif if @clspace == 1 float _rouge = red(_color) float _vert = green(_color) float _bleu = blue(_color) int _r =round(_rouge*255) int _g =round(_vert *255) int _b =round(_bleu *255) if @rouge_min != -1 && @rouge_max != -1 && _r >= @rouge_min && _r <= @rouge_max flag_mask = true endif if @vert_min != -1 && @vert_max != -1 && _g >= @vert_min && _g <= @vert_max flag_mask = true endif if @bleu_min != -1 && @bleu_max != -1 && _b >= @bleu_min && _b <= @bleu_max flag_mask = true endif if flag_mask if @pick_rgb == 0 _alpha = _rouge elseif @pick_rgb == 1 _alpha = _vert elseif @pick_rgb == 2 _alpha = _bleu elseif @pick_rgb == 3 _alpha = (_rouge+_vert)/2 elseif @pick_rgb == 4 _alpha = (_rouge+_bleu)/2 elseif @pick_rgb == 5 _alpha = (_vert+_bleu)/2 elseif @pick_rgb == 6 _alpha = (_rouge+_vert+_bleu)/3 elseif @pick_rgb == 7 if _rouge>_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 8 if _rouge>_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 9 if _vert>_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 10 if _rouge>_vert && _rouge > _bleu _alpha = _rouge elseif _vert > _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 11 if _rouge<_vert _alpha = _rouge else _alpha = _vert endif elseif @pick_rgb == 12 if _rouge<_bleu _alpha = _rouge else _alpha = _bleu endif elseif @pick_rgb == 13 if _vert<_bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 14 if _rouge<_vert && _rouge < _bleu _alpha = _rouge elseif _vert < _bleu _alpha = _vert else _alpha = _bleu endif elseif @pick_rgb == 15 _alpha = @val_rgb/255 endif endif if @inv _alpha = 1-_alpha endif if @negat if @napply == 0 flag_mask = true endif if @napply == 2 flag_mask = !flag_mask endif if flag_mask _rouge = 1- _rouge _vert = 1 - _vert _bleu = 1 - _bleu endif endif #color = rgba(_rouge,_vert,_bleu,@autom_amt*_alpha) endif default: title="Pot-Pourri with Automask" helpfile="mde-help\mde3-pot-pourri.htm" int param var caption = "Flavour" enum = "Celtique" "Pokorny" "Magnet" endparam complex param power caption = "Power" default = (2.0,0.0) endparam complex param offset caption = "Offset" default = (0.0, 0.0) endparam func fn1 caption = "Function" default = flip() visible = (@var == 2) endfunc heading caption = "Coordinates Toolbox" endheading int param coord caption = "Coordinates" enum="Cartesian" "Polar" "Hyperbolic" default = 0 endparam heading caption = "Colorby Toolbox" endheading int param colorby caption="Colouring Mode" default=0 enum="distance" "iteration" "angle" "magnitude" "path" \ "arith. mean" "geom. mean" \ "real" "imag" "real+imag" "real*imag" "real-imag" \ "imag-real" "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" endparam int param colorfix caption ="Colouring Fix" enum = "@minimum" "@maximum" "average" "@last Z" "@trap" endparam heading caption = "Barnsley Toolbox" endheading int param barn caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam float param barn_offset caption = "Offset" default = 0.0 visible = (@barn != 0) endparam func fnb caption = "Function" default = flip() visible = (@barn != 0) endfunc heading caption = "Odd-even Toolbox" endheading int param pairimp caption = "Type" enum = "none" "real" "imag" "real*imag" "real+imag" \ "distance" "angle" "magnitude" "path" "trap real" \ "trap imag" "trap r*i" "trap r+i" "trap distance" \ "trap angle" "trap magnitude" "trap path" "iteration" \ "trap iter" endparam bool param sgn caption = "Apply Sign?" default = false visible = (@pairimp != 0) endparam int param intf caption = "Factor" enum = "ceil" "floor" "trunc" "round" visible = (@pairimp != 0) endparam func fnpi caption = "Function" default = flip() visible = (@pairimp != 0) endfunc heading caption = "Random Texture Toolbox" endheading float param rnd caption = "Texture Amount" default = 0.0 endparam heading caption = "fBm Texture Toolbox" endheading float param fbmtxt caption = "Texture Amount" default = 0.0 endparam int param fbminit caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" visible = (@fbmtxt != 0.0) endparam float param fbmscale caption = "Scale" default = 1.0 visible = (@fbmtxt != 0.0) endparam param fbmoffset caption = "Offset" default = (0,0) visible = (@fbmtxt != 0.0) endparam float param fbmangle caption = "Rotation" default = 0.0 visible = (@fbmtxt != 0.0) endparam float param fbmstep caption = "Scale Step" default = 0.5 visible = (@fbmtxt != 0.0) endparam float param fbmastep caption = "Rotation Step" default = 37.0 visible = (@fbmtxt != 0.0) endparam int param fbmoct caption = "Octaves" default = 7 min = 1 visible = (@fbmtxt != 0.0) endparam float param fbmpower caption = "Exponent" default = 2.0 visible = (@fbmtxt != 0.0) endparam heading caption = "Decimal Texture Toolbox" endheading float param dectxt caption = "Texture Amount" default = 0.0 endparam int param dec_init caption = "Initialisation" enum = "real z" "imag z" "distance" "angle" "magnitude" "path" \ "real trap" "imag trap" "trap distance" "trap angle" \ "trap magnitude" "trap path" "hand over" visible = (@dectxt != 0.0) endparam bool param dec_sgn caption = "Apply Sign?" default = true visible = (@dectxt != 0.0) endparam int param dec_type caption = "Type" enum = "Ceil" "Floor" "Trunc" "Round" visible = (@dectxt != 0.0) endparam float param dec_scale caption = "Scale" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_size caption = "Size" default = 1.0 visible = (@dectxt != 0.0) endparam float param dec_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@dectxt != 0.0) endparam heading caption = "Popgnarl Texture Toolbox" endheading float param txtr_gnarl caption = "Texture Amount" default = 0.0 endparam int param gnarl_init caption = "Initialization" enum = "pixel" "z" "distance" "angle" "magnitude" "path" "trap z" \ "trap distance" "trap angle" "trap magnitude" "trap path" \ "#Z" "hand over" default = 1 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_type caption = "Mode" enum = "real" "imag" "real+imag" "real*imag" "real-imag" \ "real/imag" "imag/real" "real^imag" "imag^real" \ "1/real" "1/imag" "angle" "magnitude" "arith. mean" \ "geom. mean" visible = (@txtr_gnarl != 0.0) endparam int param gnarl_form caption = "Formula" enum = "gnarl" "popcorn" "popsicle" "tannous" "narlog" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_scale caption = "Scale" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_scaling caption = "Scaling" enum = "Ceil" "Floor" "trunc" "round" visible = (@txtr_gnarl != 0.0) endparam float param gnarl_size caption = "Size" default = 1.0 visible = (@txtr_gnarl != 0.0) endparam float param gnarl_limit caption = "Limit" default = 1.0 min = 0.0 visible = (@txtr_gnarl != 0.0) endparam int param gnarl_octaves caption = "Octaves" default = 5 min = 1 visible = (@txtr_gnarl != 0.0) endparam heading caption = "Trap Toolbox" endheading int param trapping caption = "Trapping" enum = "lower" "upper" endparam int param trp caption = "Type" enum = "iteration" "magnitude" "distance" "angle" "real" "imag" "path" endparam float param trap_min caption = "Threshold" default = 1.0 min = 0.0 endparam heading caption = "Function Application Toolbox" endheading func fnx caption = "Apply F(x)" default = ident() endfunc func fny caption = "Apply F(y)" default = ident() endfunc heading caption = "Automask Toolbox" endheading bool param automask caption = "Show automask?" default = false endparam float param autom_amt caption = "Automask Amount" default = 1.0 min = 0.0 max = 1.0 visible = @automask endparam int param clspace caption = "Colorspace" enum = "HSL" "RGB" visible = @automask endparam Heading caption = "Hue Range" visible = (@clspace == 0 && @automask) endheading int param teinte_min caption="Minimum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param teinte_max caption="Maximum" default = -1 min=-1 max=359 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Saturation Range" visible = (@clspace == 0 && @automask) endheading int param satur_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param satur_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Luminance Range" visible = (@clspace == 0 && @automask) endheading int param lumin_min caption = "Minimum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne inférieure de l'intervalle endparam int param lumin_max caption = "Maximum" default = -1 min=-1 max=255 visible = (@clspace == 0 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 0 && @automask) endheading int param pick_hsl caption= "Use" enum = "H value" "S value" "L value" "Average HS" "Average HL" "Average SL" \ "Average HSL" "Max H/S" "Max H/L" "Max S/L" "Max H/S/L" "Min H/S" "Min H/L" \ "Min S/L" "Min H/S/L" "Custom" default = 2 visible = (@clspace == 0 && @automask) endparam int param val_hsl caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @pick_hsl == 15 && @automask) endparam Heading caption = "Red Range" visible = (@clspace == 1 && @automask) endheading int param rouge_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param rouge_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Green Range" visible = (@clspace == 1 && @automask) endheading int param vert_min caption="Minimum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param vert_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Blue Range" visible = (@clspace == 1 && @automask) endheading int param bleu_min caption="Minimum" default = -1 min= -1 max=255 visible = (@clspace == 1 && @automask) ; borne inférieure de l'intervalle endparam int param bleu_max caption="Maximum" default = -1 min=-1 max=255 visible = (@clspace == 1 && @automask) ; borne supérieure de l'intervalle endparam Heading caption = "Use for Mask" visible = (@clspace == 1 && @automask) endheading int param pick_rgb caption= "Use" enum = "R value" "G value" "B value" "Average RG" "Average RB" "Average GB" \ "Average RGB" "Max R/G" "Max R/B" "Max G/B" "Max R/G/B" "Min R/G" "Min R/B" \ "Min G/B" "Min R/G/B" "Custom" visible = (@clspace == 1 && @automask) endparam int param val_rgb caption = "Value" default = 0 min = 0 max = 255 visible = (@clspace == 1 && @pick_rgb == 15 && @automask) endparam bool param inv caption = "Invert" default = false visible = @automask endparam heading caption = "Color Settings" visible = @automask endheading bool param gscale caption = "Turn Greyscale" default = false visible = (@clspace == 0 && @automask) endparam int param gsatur caption = "Saturation Level" default = 0 min = 0 max = 255 visible = (@clspace == 0 && @gscale == true && @automask) endparam int param gapply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 0 && @gscale && @automask) endparam bool param negat caption = "Turn Negative" default = false visible = (@clspace == 1 && @automask) endparam int param napply caption = "Apply on" enum = "All Image" "Above Range" "Above Range Inverted" visible = (@clspace == 1 && @negat && @automask) endparam }