3

如何使用 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 没有切割

4

1 回答 1

0

尽管我还没有测试过,但这里的课程可能会对您有所帮助。

于 2011-08-11T11:14:13.093 回答