나는이 PHP의 GD 사용하여 사다리꼴 이미지 변환이 기능 :이미지 등변 사다리꼴 PHP GD
function perspective($i,$gradient=0.9,$rightdown=true,$background=0xFFFFFF) {
$mult=3;
$w=imagesx($i);
$h=imagesy($i);
$image=imagecreatetruecolor($w*$mult,$h*$mult);
imagecopyresized($image,$i,0,0,0,0,$w*$mult,$h*$mult,$w,$h);
imagedestroy($i);
$w*=$mult;
$h*=$mult;
$im=imagecreatetruecolor($w,$h);
$background=imagecolorallocate($im,($background>>16)&0xFF,($background>>8)&0xFF,$background&0xFF);
imagefill($im,0,0,$background);
imageantialias($im,true);
$nh=$h-($h*$gradient);
for ($x=0; $x<$w; $x++) {
$ni=(($rightdown) ? $x : $w-$x);
$p=intval($h-(($ni/$w)*$nh));
if (($p%2)<>0)
$p-=1;
$nx=intval(($p-$h)/2);
imagecopyresampled($im,$image,$x,0,$x,$nx,1,$p,1,$h-1);
imageline($im,$x,$h-1,$x,$h+$nx,$background);
imageline($im,$x,0,$x,-$nx-1,$background);
}
imagedestroy($image);
imagefilter($im,IMG_FILTER_SMOOTH,10);
$i=imagecreatetruecolor($w/$mult,$h/$mult);
imageantialias($i,true);
imagecopyresampled($i,$im,0,0,0,0,$w,$h,$w*$mult,$h*$mult);
imagedestroy($im);
return $i;
}
하지만 난이 등변 사다리꼴을 생산하기 위해 수정 캔트, 난 그냥 하나의 작은 수정이 필요하다고 생각을하지만 난 캔트는 그것을 outh (나는 많은 것을 시도했다) 계산한다.
누군가 도움을 줄 수 있습니까?
아마도 현재 코드에서 사다리꼴이 어떻게 생성되었는지 알 수 없을 것입니다. – Orbling
글쎄, 어떻게 만들어 졌는지 이해할 수 있지만, 다른 방법으로 작동시키기에 충분한 php (gd) 지식이 없다. – SomeoneS