如何用GD制作2个或更多椭圆之间的渐变?

时间:2011-08-09 13:06:18

标签: php image gd ellipse

如何用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 没有削减

1 个答案:

答案 0 :(得分:0)

虽然我没有对它进行测试,但here课可能会对你有帮助。