0 && $newX < $width) { $dis_x = $newX; } else { $dis_x = $x; } $newY = ($height/2) + ($radius * sin($theta + ($fDegree * $radius))); if ($newY > 0 && $newY < $height) { $dis_y = $newY; } else { $dis_y = $y; } $dis_x = ($dis_x < 0) ? $dis_x + $width : $dis_x; $dis_x = ($dis_x >= $width) ? $dis_x - $width : $dis_x; $dis_y = ($dis_y < 0) ? $dis_y + $height : $dis_y; $dis_y = ($dis_y >= $height) ? $dis_y - $height : $dis_y; $displacement['x'][$x][$y] = $dis_x; $displacement['y'][$x][$y] = $dis_y; } } return $displacement; } function imagedisplace($i,$displacement) { $width = imagesx($i); $height = imagesy($i); $temp = imagecreatetruecolor($width,$height); imagecopy($temp,$i,0,0,0,0,$width,$height); for ($y=0;$y<$height;$y++) { for ($x=0;$x<$width;$x++) { $rgb = imagecolorat($temp,$displacement['x'][$x][$y],$displacement['y'][$x][$y]); $a = ($rgb >> 24) & 0xFF; $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; $col = imagecolorallocatealpha($i,$r,$g,$b,$a); imagesetpixel($i,$x,$y,$col); } } imagedestroy($temp); return $i; } ?>