Hi, This is probably a no brainer for the math wizards out there. Can anyone see how the folowing code ( originally posted on phpbuilder titled "RE: dynamic corners" as a responce to Rasmus's article on image creation with php & GD : http://www.phpbuilder.com/annotate/message.php3?id=1003041 ) can be modified to change the "curve" of the arc. I would like to be able to modify the code so it can display and arc with a curve inbetween the arc the code produces now: ################# # ## # ##### # ######## # ########## # ############ # ############## # ############### ################# ################# and a triange like below: ################# # ## # ### # #### # ##### # ###### # ####### # ######## # ######### # ########## # ########### # ############ # ############# # ############## # ############### ################# ( pretend this image is the same height as the one above ;) In otherwords I would like to be able to modify the "height" of the arc ( not to be confused with the height of the image ) as one is able to modify the height of the arc produced using the GD ImageArc() function. You may be wondering why I am not using the ImageArc() function in the first place. Well check it out and see... this code produces a beautifully antialiassed curve, and the ImageArc() does not. Looking forward to your ideas. Thanks, Sam <? # test arguments $cnr='tl'; $inc='ff0000'; $outc='00ff00'; $side='40'; ######## $corner=ImageCreate($side,$side); ### set palette $bg['r']=hexdec(substr($outc,0,2)); $bg['g']=hexdec(substr($outc,2,2)); $bg['b']=hexdec(substr($outc,4,2)); $fg['r']=hexdec(substr($inc,0,2)); $fg['g']=hexdec(substr($inc,2,2)); $fg['b']=hexdec(substr($inc,4,2)); $dcolor['r']=$fg['r']-$bg['r']; $dcolor['g']=$fg['g']-$bg['g']; $dcolor['b']=$fg['b']-$bg['b']; for ($i=0;$i<256;$i++) { $ind[$i]=ImageColorAllocate($corner, round($bg['r']+($dcolor['r']*$i/255)), round($bg['g']+($dcolor['g']*$i/255)), round($bg['b']+($dcolor['b']*$i/255))); } ### colorise function function colorise($x,$y,$area) { global $dcolor,$bg,$corner; $col= ImageColorClosest($corner, round($bg['r']+($dcolor['r']*$area)), round($bg['g']+($dcolor['g']*$area)), round($bg['b']+($dcolor['b']*$area))); imagesetpixel ($corner, $x, $y, $col); } ### getarea function function getarea($x,$y) { global $r; #distances $d1=pow( ( pow($x,2) + pow($y,2) ), 0.5 ); if ($d1>=$r) return 0; $d3=pow( ( pow(($x+1),2) + pow(($y+1),2) ), 0.5 ); if ($d3<=$r) return 1; $d2=pow( ( pow(($x+1),2) + pow(($y),2) ), 0.5 ); $d4=pow( ( pow(($x),2) + pow(($y+1),2) ), 0.5 ); # p or t if ($d2==$r) $p=1; elseif ($d2>$r) $p = ( pow( ( pow($r,2) - pow($y,2) ), 0.5 ) - $x ); else $t = ( pow( ( pow($r,2) - pow(($x+1),2) ), 0.5 ) - $y ); # q or s if ($d4==$r) $q=1; else if ($d4>$r) $q = ( pow( ( pow($r,2) - pow($x,2) ), 0.5 ) - $y ); else $s = ( pow( ( pow($r,2) - pow(($y+1),2) ), 0.5 ) - $x ); # area if ($p&&$q) return (0.5*$p*$q); else if ($q&&$t) return (0.5*($q+$t)); else if ($s&&$p) return (0.5*($p+$s)); else if ($t&&$s) return ( 0.5*(2+($s-1)*(1-$t)) ); } ### scan gif $r=$side; for($x=0;$x<$r;$x++) { for($y=0;$y<$r;$y++) { $area=getarea($x,$y); ### flip image (strchr($cnr,'b')) ? ($ty=$y) : ($ty=$side-$y-1); (strchr($cnr,'r')) ? ($tx=$x) : ($tx=$side-$x-1); colorise($tx,$ty,$area); } } Header("Content-type: image/gif"); ImageGif($corner); ?> ---------------------------------------------------------------- Get your free email from AltaVista at http://altavista.iname.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]