Esempio n. 1
0
if($_GET["theme"] != "") {
	$iconName = $_GET["theme"] . ".png";
}
elseif($_GET["layer"] != "") {
	$iconName = $_GET["layer"] . ".png";
}
elseif($_GET["icon"] != "") {
	$iconName = $_GET["icon"] . ".png";
}

if(! file_exists($iconDirectoryPath . $iconName)) {
	$iconName = "proto.png";
}

if($_GET["fill"] != "") {
	$fill = hex2int($_GET["fill"]);
}

// Compute the dark and light shades
/*$darkBorder['r'] = $fill['r'] - $step;
if($darkBorderBorder['r'] < 0){
	$darkBorder['r'] = 0;
}
$darkBorder['g'] = $fill['g'] - $step;
if($darkBorderBorder['g'] < 0){
	$darkBorder['g'] = 0;
}
$darkBorder['b'] = $fill['b'] - $step;
if($darkBorderBorder['b'] < 0){
	$darkBorder['b'] = 0;
}*/
Esempio n. 2
0
function grad($im, $width, $height, $step, $basewidth, $baseheight, $end, $base)
{
    // from http://usalug.com/phpBB3//viewtopic.php?p=58019
    // $im is passed as @$im for the image to draw it on
    // $height is the Height of the box to draw
    // $width is the width of the box to draw
    // $step is the steps to take, a step of 10 would change the colour every 10 pixels
    // $baseheight is where to place the bottom of the rectangle
    // $basewidth is the right side of the location for the rectangle
    // $base is the start colour in hex (ffffff)
    // $end is the colour to end at in hex (000000)
    // Break colours into RGB components
    //sscanf($base, "%2x%2x%2x", $rbase, $gbase, $bbase);
    //sscanf($end, "%2x%2x%2x", $rend, $gend, $bend);
    $basecolors = hex2int($base);
    $rbase = $basecolors["r"];
    $gbase = $basecolors["g"];
    $bbase = $basecolors["b"];
    $endcolors = hex2int($end);
    $rend = $endcolors["r"];
    $gend = $endcolors["g"];
    $bend = $endcolors["b"];
    ////////////////////////////////////////////////////
    // This color retrieval broken on server. replace with hex2int
    ////////////////////////////////////////////////////
    // Set the Variable to step to use height
    //$varstep=$height;
    $varstep = $width;
    // Remove potential divide by 0 errors.
    if ($rbase == $rend) {
        $rend = $rend - 1;
    }
    if ($gbase == $gend) {
        $gend = $gend - 1;
    }
    if ($bbase == $bend) {
        $bend = $bend - 1;
    }
    // Make sure the height is at least 1 pixel
    if ($varstep == 0) {
        $varstep = 1;
    }
    // Set up step modifiers for each colour
    $rmod = ($rend - $rbase) / $varstep;
    $gmod = ($gend - $gbase) / $varstep;
    $bmod = ($bend - $bbase) / $varstep;
    // Serves no real purpose.
    $white = imagecolorallocate($im, 255, 255, 255);
    // Loop for the height at a rate equal to the steps.
    for ($i = 1; $i < $varstep; $i = $i + $step + 1) {
        //Adjust the colours
        $clour1 = $i * $rmod + $rbase;
        $clour2 = $i * $gmod + $gbase;
        $clour3 = $i * $bmod + $bbase;
        $col = imagecolorallocate($im, $clour1, $clour2, $clour3);
        //Paint the rectangle at current colour.
        //imagefilledrectangle ( resource $image, int $x1, int $y1, int $x2, int $y2, int $color )
        //This was breaking online because numbers out of range were being passed because I did a hacky job modifying this from vert to horiz originally. Fixed -gmm 092807
        $x1 = $basewidth - $i - 1;
        $y1 = $baseheight - $height;
        $x2 = $basewidth - $i + $step - 1;
        $y2 = $baseheight;
        imagefilledrectangle($im, $x1, $y1, $x2, $y2, $col);
    }
    // Return the image
    return $im;
}