2011-08-09 16 views
3

我如何使GD与2或更多的椭圆之间的梯度?如何使用GD在2个或更多的椭圆之间建立梯度?

下面是一个椭圆形:

<?php 

header("Content-type: image/gif"); 

$imagen = imagecreatefrompng('tras.png'); 


$morado = array('r' => 186, 'g' => 0, 'b' => 255); 
$amarillo = array('r' => 255, 'g' => 220, 'b' => 0); 

$pasos = 2000; 

$incr_r = ($amarillo['r'] - $morado['r'])/$pasos; 
$incr_g = ($amarillo['g'] - $morado['g'])/$pasos; 
$incr_b = ($amarillo['b'] - $morado['b'])/$pasos; 

$cx = imagesx($imagen)/3; 
$cy = imagesy($imagen)/3; 

$ancho = 240; 
$alto = 140; 

$incr_x = $ancho/$pasos; 
$incr_y = $alto/$pasos; 

$r = $morado['r']; 
$g = $morado['g']; 
$b = $morado['b']; 

for($i = 0; $i < $pasos; $i++){ 
$color = imagecolorallocate($imagen, $r, $g, $b); 
imagefilledellipse($imagen, $cx, $cy, $ancho, $alto, $color); 
imagefilledellipse($imagen, $ñ, $k, $ancho, $alto, $color); 

$r += $incr_r; 
$g += $incr_g; 
$b += $incr_b; 

$ancho -= $incr_x; 
$alto -= $incr_y; 
} 

imagegif($imagen); 

imagedestroy($imagen); 

?> 

型号... 这... http://img88.imageshack.us/img88/11/capturazv.png 无切削

+2

你能告诉我们一个你想要的模型图吗? – Bojangles

+0

我只想要两个椭圆,而这两者之间有一个渐变。我没有模特。 – Bcl00

+1

我无法真正理解“中间有一个渐变的椭圆”是什么意思,你能向我们展示一个你想要的模型吗? – Precursor

回答

0

这可能是类here会帮助你,虽然我还没有”对它进行测试。

+0

感谢您的链接,但不完全是我所需要的。 – Bcl00