header ("Content-type: image/png");
#$currimage = imagecreate (100, 100);
#$background_color = imagecolorallocate ($currimage, 255, 255, 255);
$xcorner = -1.5;
$y2corner = 1.5;
$x2corner = 1.5;
$ycorner = -1.5;
$max = rand(70,190);
$xsize = 400;#imagesx($currimage);# 200;#
$ysize = 400;#imagesy($currimage);# 200;#
$xgap = 0;
$ygap = 0;
$r = rand(0,255);
$g = rand(0,255);
$b = rand(0,255);
#$currimage = imagecreatefrompng("wallpaper_blank.png");
$currimage = imagecreatetruecolor($xsize, $ysize);
imagefill ($currimage, 1, 1, imagecolorallocate($currimage, 255, 255, 255));
ImageColorTransparent($currimage, imagecolorallocate($currimage, 255, 255, 255));
ImageColorTransparent($currimage, imagecolorallocate($currimage, $r, $g, $b));
imagealphablending($currimage, true);
#echo "max=$max rgb = $r $g $b\n";
#echo "test "."0.".rand(100000,999999)."\n";
#flush();
#str_pad(rand(1,399999), 6, "0", STR_PAD_LEFT);
$ca = floatval("0.".str_pad(rand(1,399999), 6, "0", STR_PAD_LEFT));#rand(0.000,0.999); #0.360284;#
$cb = floatval("0.".rand(100000,999999));#rand(0.000,0.999); #0.100376;#
for ($k=$ysize;$k>1;$k--){
for($i=1;$i < $xsize;$i++){
$za = ($i / $xsize) * ($x2corner - $xcorner) + $xcorner;
$zb = ($k / $ysize) * ($y2corner - $ycorner) + $ycorner;
$count = 0;
$za2 = $za;
$alpha = 0;
while (1){
$za1 = $za2;
$za2 = ($za1 * $za1 - $zb * $zb) + $ca;
$zb = $za1 * $zb * 2 + $cb;
if(($za2 * $za2 + $zb * $zb) > 4){ break; }
$count++;
if($count > $max){ break; }
}
# dragon - do later
#f(z)=z^2 1/2 e i*e
#x'=x^2-y^2 r/(1 r)
#y'=2*x*y 1/(1 r)
if($count > $max){ $count = 0; }
$scale =(($count * 100)/5);
$col = (($scale / 100)*255);
if($col == 0){ $col = 1; }
$rscale = (($r * 100)/($col));
$R = (($rscale / 100)*255);
$gscale = (($g * 100)/($col));
$G = (($gscale / 100)*255);
$bscale = (($b * 100)/($col));
$B = (($bscale / 100)*255);
$color = imagecolorallocatealpha($currimage, $R, $G, $B, 0);
#echo 255-$count."\n";
imageline ($currimage, $xgap + $i, $ygap + $ysize-$k, $xgap + $i, $ygap + $ysize-$k,$color);
}
}
#echo "ca = $ca, cb = $cb\n";
#imagestring ($currimage, int font, int x, int y, string s, int col);
$FONT = "/usr/X11R6/lib/X11/fonts/truetype/trebucit.ttf";
$fontcolor = ImageColorAllocatealpha ($currimage, 0, 0, 0, 40);
imagefttext($currimage, 8, 0, 3 + 1, $ysize-10 + 1, $fontcolor, $FONT, "joeldg (iter-$max, ca-$ca, cb-$cb)", $back);
$fontcolor = ImageColorAllocatealpha ($currimage, 255, 255, 255, 40);
imagefttext($currimage, 8, 0, 3, $ysize-10, $fontcolor, $FONT, "joeldg (iter-$max, ca-$ca, cb-$cb)", $back);
if(!imagepng($currimage)){
echo "shit screwed up\n";
}