如何使用gd在两个或多个椭圆之间创建渐变?
以下为椭圆:

<?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
不切割

最佳答案

虽然我还没有测试过,但这门课有可能对你有所帮助。

关于php - 如何使用GD在2个或更多个椭圆之间进行渐变?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6996611/

10-10 10:56