⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jpgraph_gradient.php

📁 极限网络智能办公系统 - Office Automation 2.8 100% 源码
💻 PHP
字号:
<?php

class gradient
{

	var $img = null;
	var $numcolors = 100;

	function gradient( &$img )
	{
		$this->img = $img;
	}

	function setnumcolors( $aNum )
	{
		$this->numcolors = $aNum;
	}

	function filledrectangle( $xl, $yt, $xr, $yb, $from_color, $to_color, $style = 1 )
	{
		switch ( $style )
		{
		case GRAD_VER :
			$steps = round( abs( $xr - $xl ) );
			$delta = $xl <= $xr ? 1 : -1;
			$this->getcolarray( $from_color, $to_color, $steps, $colors, $this->numcolors );
			$i = 0;
			$x = $xl;
			for ( ;	$i < $steps;	++$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $x, $yt, $x, $yb );
				$x += $delta;
				break;
			}
		case GRAD_HOR :
			$steps = round( abs( $yb - $yt ) );
			$delta = $yt <= $yb ? 1 : -1;
			$this->getcolarray( $from_color, $to_color, $steps, $colors, $this->numcolors );
			$i = 0;
			$y = $yt;
			for ( ;	$i < $steps;	++$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $xl, $y, $xr, $y );
				$y += $delta;
				break;
			}
		case GRAD_MIDHOR :
			$steps = round( abs( $yb - $yt ) / 2 );
			$delta = $yt <= $yb ? 1 : -1;
			$this->getcolarray( $from_color, $to_color, $steps, $colors, $this->numcolors );
			$y = $yt;
			$i = 0;
			for ( ;	$i < $steps;	++$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $xl, $y, $xr, $y );
				$y += $delta;
			}
			--$i;
			if ( abs( $yb - $yt ) % 2 == 1 )
			{
				--$steps;
			}
			$j = 0;
			for ( ;	$j < $steps;	++$j,	--$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $xl, $y, $xr, $y );
				$y += $delta;
			}
			$this->img->line( $xl, $y, $xr, $y );
			break;
		case GRAD_MIDVER :
			$steps = round( abs( $xr - $xl ) / 2 );
			$delta = $xl <= $xr ? 1 : -1;
			$this->getcolarray( $from_color, $to_color, $steps, $colors, $this->numcolors );
			$x = $xl;
			$i = 0;
			for ( ;	$i < $steps;	++$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $x, $yb, $x, $yt );
				$x += $delta;
			}
			--$i;
			if ( abs( $xr - $xl ) % 2 == 1 )
			{
				--$steps;
			}
			$j = 0;
			for ( ;	$j < $steps;	++$j,	--$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $x, $yb, $x, $yt );
				$x += $delta;
			}
			$this->img->line( $x, $yb, $x, $yt );
			break;
		case GRAD_WIDE_MIDVER :
			$diff = round( abs( $xr - $xl ) );
			$steps = floor( abs( $diff ) / 3 );
			$firststep = $diff - 2 * $steps;
			$delta = $xl <= $xr ? 1 : -1;
			$this->getcolarray( $from_color, $to_color, $firststep, $colors, $this->numcolors );
			$x = $xl;
			$i = 0;
			for ( ;	$i < $firststep;	++$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $x, $yb, $x, $yt );
				$x += $delta;
			}
			--$i;
			$this->img->current_color = $colors[$i];
			$j = 0;
			for ( ;	$j < $steps;	++$j	)
			{
				$this->img->line( $x, $yb, $x, $yt );
				$x += $delta;
			}
			$j = 0;
			for ( ;	$j < $steps;	++$j,	--$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $x, $yb, $x, $yt );
				$x += $delta;
				break;
			}
		case GRAD_WIDE_MIDHOR :
			$diff = round( abs( $yb - $yt ) );
			$steps = floor( abs( $diff ) / 3 );
			$firststep = $diff - 2 * $steps;
			$delta = $yt <= $yb ? 1 : -1;
			$this->getcolarray( $from_color, $to_color, $firststep, $colors, $this->numcolors );
			$y = $yt;
			$i = 0;
			for ( ;	$i < $firststep;	++$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $xl, $y, $xr, $y );
				$y += $delta;
			}
			--$i;
			$this->img->current_color = $colors[$i];
			$j = 0;
			for ( ;	$j < $steps;	++$j	)
			{
				$this->img->line( $xl, $y, $xr, $y );
				$y += $delta;
			}
			$j = 0;
			for ( ;	$j < $steps;	++$j,	--$i	)
			{
				$this->img->current_color = $colors[$i];
				$this->img->line( $xl, $y, $xr, $y );
				$y += $delta;
				break;
			}
		case GRAD_LEFT_REFLECTION :
			$steps1 = round( 0.3 * abs( $xr - $xl ) );
			$delta = $xl <= $xr ? 1 : -1;
			$from_color = $this->img->rgb->color( $from_color );
			$adj = 1.4;

[exception occured]

================================
Exception code[ C0000005 ]
Compiler[ 00385B28 ]
Executor[ 00386030 ]
OpArray[ 0096F520 ]
File< D:\MYOA08\php-de\Dezender28\inc\jpgraph\jpgraph_gradient.php >
Class< gradient >
Function< filledrectangle >
Stack[ 00145AC8 ]
Step[ 7 ]
Offset[ 588 ]
LastOffset[ 1142 ]
   588  MUL                          [-]   0[0] $Tmp_1 - $Tmp_2 - $Tmp_3
================================
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -