如何使用 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 无需切割
How I can make a gradient between 2 or more ellipses with GD?
The following is an ellipse:
<?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 );
?>
Model...
This...
http://img88.imageshack.us/img88/11/capturazv.png
without cutting
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此处的课程可能会帮助您,虽然我还没有测试过。
It is possible that the class here will help you, although I haven't tested it.