Lines"; global $image; // $output.="\n"; $output.=" "; /* find the boundaries of the image in sinusoidal space */ $corner1=P2S(0,0,$params); $corner2=P2S($Width,0,$params); $corner3=P2S($Width,$Height,$params); $corner4=P2S(0,$Height,$params); $output.="\n"; $output.="\n"; $output.="\n"; $output.="\n"; $minX=min($corner1[0],$corner2[0],$corner3[0],$corner4[0]); $minY=min($corner1[1],$corner2[1],$corner3[1],$corner4[1]); $maxX=max($corner1[0],$corner2[0],$corner3[0],$corner4[0]); $maxY=max($corner1[1],$corner2[1],$corner3[1],$corner4[1]); // from the min/max bounding box, we know which sines to draw $stepx=2; global $LineHeight; $stepy=$LineHeight; global $wiggleAmplitude; for ($y=$minY-$wiggleAmplitude ;$y<$maxY+$wiggleAmplitude;$y+=$stepy) { for ($x=$minX;$x<$maxX;$x+=$stepx) { $imageP=S2P($x,$y+wiggle($x),$params); $rx=$imageP[0]; $ry=$imageP[1]; // rx2,ry2 is the point ahead, to which we draw a segment $imageP2=S2P($x+$stepx,$y+wiggle($x+$stepx),$params); $rx2=$imageP2[0]; $ry2=$imageP2[1]; if (($rx >= 0 && $rx < $Width && $ry >= 0 && $ry < $Height)|| ($rx2 >= 0 && $rx2 < $Width && $ry2 >= 0 && $ry2 < $Height)) { // $output.=sprintf("\n",pixelAverageAt($img, (int)floor($rx), (int)floor($ry), 2, $Width, $Height)); $radius=100/(10+pixelAverageAt($img, (int)floor($rx), (int)floor($ry), 1, $Width, $Height)); $radius2=100/(10+pixelAverageAt($img, (int)floor($rx2), (int)floor($ry2), 1, $Width, $Height)); $sidePoints=sidePoints($rx,$ry,$rx2,$ry2,$radius); $sidePoints2=sidePoints($rx2,$ry2,$rx,$ry,$radius2); $output.=sprintf("\n", $sidePoints[0],$sidePoints[1], $sidePoints[2],$sidePoints[3], $sidePoints2[0],$sidePoints2[1], $sidePoints2[2],$sidePoints2[3], 'black'); //$rt3++%2==0?'red':'black'); } } } // framing rectangle. Should be a clipping path, but no FF support $outerFrameWidth=200; $innerFrameWidth=2; $r=($outerFrameWidth-$innerFrameWidth)/2; $output.=" "; return $output; } function sidePoints($x1,$y1,$x2,$y2,$r) { $L=sqrt(($x2-$x1)*($x2-$x1) + ($y2-$y1)*($y2-$y1)); $px=($x2-$x1)*$r/$L; $py=($y2-$y1)*$r/$L; return array($x1-$py-($px/20),$y1+$px-($py/20), $x1+$py-($px/20),$y1-$px-($py/20)); } ?>