 |
Forum Newbie |
Joined: Tue Aug 16, 2005 1:22 pm Posts: 2
|
Hello,
I am tryign to create a transparent image and draw a white line that has to me smooth.
This should be a problem right?
Well I got serious problems with it.
Let me show you:
This url has my example images and the code below (I couldn't use the [img] tag to show the php generated images.
http://www.zacay.se/image/
Method 1:
<?
header("content-type: image/png");
// Create empty image
$image = imagecreatetruecolor(500, 500);
// The image background transparent
imagealphablending($image, false);
imagesavealpha($image, true);
$bgcolor = imagecolorallocatealpha($image, 255, 255, 255, 127);
imagefill($image, 0, 0, $bgcolor);
// Drawing the lines
imageantialias($image, true);
$white = imagecolorallocate($image, 255, 255, 255);
imageline($image, 0, 0, 250, 500, $white);
imageline($image, 0, 100, 500, 500, $white);
imageline($image, 0, 300, 500, 400, $white);
imageline($image, 0, 400, 500, 450, $white);
// Output the image
imagepng($image);
?>
Method 2:
<?
header("content-type: image/png");
// Create empty image
$image = imagecreatetruecolor(500, 500);
// The image background transparent
imagealphablending($image, true);
imagecolortransparent($image, 0); // 0 = black, the default color then create an image
// Drawing the lines
imageantialias($image, true);
$white = imagecolorallocate($image, 255, 255, 255);
imageline($image, 0, 0, 250, 500, $white);
imageline($image, 0, 100, 500, 500, $white);
imageline($image, 0, 300, 500, 400, $white);
imageline($image, 0, 400, 500, 450, $white);
// Output the image
imagepng($image);
?>
So any ideas?
Am I doing this the wrong way?
|
|