<?
// corner stone/icon version 1.0, free for no commercial usage
// [url]http://www.tjgy.com[/url]
// [email]info@tjgy.com[/email]
// Thu Mar 28 16:44:17 PST 2002
//
// Taking 6 inputs:
// 0. Which Corner: lt(Left Top), lb(Left Bottom), rt(Right Top), rb(Right Bottom) [1/0]
// 1. Corner gemetory: s(size)
// 2. Corner Inside color: ci
// 3. Corner Outside color: co
// 4. transparent ci: ti [1/0]
// 5. transparent co: to [1/0]
//
// Examples:
// a. corner.html?lt=1&s=20&ci=ffffff&co=330000 (20x20 left top corner)
// b. corner.html?rb=1&s=20&ci=ffffff&co=330000&ti=1 (20x20 right bottom corner transparnet)
// initial some default values
if ( !$s || $s < 5)
$s=5;
if ( !$ci )
$ci="ffffff";
if ( !$co )
$co="996666";
// hex rgb translation, don't put #
function hex2rgb($hex) {
for($i=0; $i<3; $i++) {
$temp = substr($hex,2*$i,2);
$rgb[$i] = 16 * hexdec(substr($temp,0,1)) +
hexdec(substr($temp,1,1));
}
return $rgb;
}
$myrgbi = hex2rgb($ci);
$myrgbo = hex2rgb($co);
if ( $lt ) {
$fill=$s-1;
$center_x = $s-1;
$center_y = $s-1;
$start = 180;
$end = 270;
}
if ( $lb ) {
$fill=$s/2;
$center_x = $s-1;
$center_y = 0;
$start = 90;
$end = 0;
}
if ( $rt ) {
$fill=$s/2;
$center_x = 0;
$center_y = $s-1;
$start = 270;
$end = 360;
}
if ( $rb ) {
$fill=$s/2;
$center_x = 0;
$center_y = 0;
$start = 180;
$end = 90;
}
$im = ImageCreate($s, $s);
$ci = ImageColorAllocate($im, $myrgbi[0], $myrgbi[1], $myrgbi[2]);
$co = ImageColorAllocate($im, $myrgbo[0], $myrgbo[1], $myrgbo[2]);
$width = $s*2;
$height = $s*2;
ImageFill($im, 0, 0, $co);
ImageArc($im, $center_x, $center_y, $width, $height, $start, $end, $ci);
ImageFillToBorder($im, $fill,$fill, $ci, $ci);
if ( $ti )
imagecolortransparent( $im, $ci);
if ( $to )
imagecolortransparent( $im, $co);
// output to browser
// Header("Content-Type: image/png");
// ImagePng($im);
Header("Content-Type: image/gif");
ImageGif($im);
?>