$theColorBegin = (isset($_REQUEST['cbegin'])) ? hexdec($_REQUEST['cbegin']) : 0x000000; $theColorEnd = (isset($_REQUEST['cend'])) ? hexdec($_REQUEST['cend']) : 0xffffff; $theNumSteps = (isset($_REQUEST['steps'])) ? intval($_REQUEST['steps']) : 16; $theColorBegin = (($theColorBegin >= 0x000000) && ($theColorBegin <= 0xffffff)) ? $theColorBegin : 0x000000; $theColorEnd = (($theColorEnd >= 0x000000) && ($theColorEnd <= 0xffffff)) ? $theColorEnd : 0xffffff; $theNumSteps = (($theNumSteps > 0) && ($theNumSteps < 256)) ? $theNumSteps : 16; ?>
printf("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 "", $theVal); $theTDARTag = sprintf(" | ", $theVal);
$theFC0Tag = "";
$theFC1Tag = "";
printf(" |