= 0x000000) && ($theColorBegin <= 0xffffff)) ? $theColorBegin : 0x000000; $theColorEnd = (($theColorEnd >= 0x000000) && ($theColorEnd <= 0xffffff)) ? $theColorEnd : 0xffffff; $theNumSteps = (($theNumSteps > 0) && ($theNumSteps < 256)) ? $theNumSteps : 16; ?>
variable: number type minimum maximum value
color begin: hex 0x000000 0xFFFFFF ">
color end: hex 0x000000 0xFFFFFF ">
number of steps: dec 1 255
values are: (color begin: 0x%06X), (color end: 0x%06X), (number of steps: %d)

\n", $theColorBegin, $theColorEnd, $theNumSteps); $theR0 = ($theColorBegin & 0xff0000) >> 16; $theG0 = ($theColorBegin & 0x00ff00) >> 8; $theB0 = ($theColorBegin & 0x0000ff) >> 0; $theR1 = ($theColorEnd & 0xff0000) >> 16; $theG1 = ($theColorEnd & 0x00ff00) >> 8; $theB1 = ($theColorEnd & 0x0000ff) >> 0; // return the interpolated value between pBegin and pEnd function interpolate($pBegin, $pEnd, $pStep, $pMax) { if ($pBegin < $pEnd) { return (($pEnd - $pBegin) * ($pStep / $pMax)) + $pBegin; } else { return (($pBegin - $pEnd) * (1 - ($pStep / $pMax))) + $pEnd; } } // generate gradient swathe now echo "\n"; for ($i = 0; $i <= $theNumSteps; $i++) { $theR = interpolate($theR0, $theR1, $i, $theNumSteps); $theG = interpolate($theG0, $theG1, $i, $theNumSteps); $theB = interpolate($theB0, $theB1, $i, $theNumSteps); $theVal = ((($theR << 8) | $theG) << 8) | $theB; $theTDTag = sprintf("$theTDTag$theFC0Tag%d$theTDTag$theFC0Tag%d%%$theTDARTag$theFC0Tag%d$theTDARTag$theFC0Tag%06X", $i, ($i/$theNumSteps) * 100, $theVal, $theVal); printf("$theTDTag$theFC1Tag%06X$theTDTag$theFC1Tag%d$theTDARTag$theFC1Tag%d%%$theTDARTag$theFC1Tag%d\n", $theVal, $theVal, ($i/$theNumSteps) * 100, $i); } echo "
", $theVal); $theTDARTag = sprintf("", $theVal); $theFC0Tag = ""; $theFC1Tag = ""; printf("
\n"; ?>