Jump to content

Recommended Posts

Good morning experts one and all!

 

I am trying to draw an arc 20 pixels wide. Unfortunately, imagearc() only draws a one pixel line while imagefilledarc() does not fill the arc to a specified depth (just various "pie" fillings).

 

So I tried a loop to draw 20 one-pixel lines. For some reason however, it appears that some pixels are dropped. This makes for a messy fill leaving black spots (or any background color) in the line. Attached is an example and the code is below.

 

What is the best way to draw a "thick" arc?

 

Thank you in advance for your kindness  :)

PS. How do you insert an image into messages on this board using the img tags?

[/img]

$img = imagecreatetruecolor(214, 345);
$white = imagecolorallocate($img, 255, 255, 255);
$red   = imagecolorallocate($img, 255,   0,   0);
for ($Cnt = 1; $Cnt <= 20; $Cnt++) {
$Measure = 300 + $Cnt;
imagearc($img, 20, 172, $Measure, $Measure, 315, 45, $red);
}

 

[attachment deleted by admin]

Humm

Well ImageSetThickness($img, 25); should do it but i think its a little buggy..

 

try saving as gif instead of png and use imagefilledarc twice, one with the foreground color then the background color

ie

<?php
header("Content-Type: image/gif");
$img = imagecreatetruecolor(350, 350);
$black = imagecolorallocate($img, 0, 0, 0);
$red   = imagecolorallocate($img, 255,   0,   0);
imagefill($img,0, 0,$black);
imagefilledarc($img, 70, 175, 300, 300, 315, 45, $red,IMG_COLOR_STYLEDBRUSHED);
imagefilledarc($img, 60, 175, 300, 300, 315, 45, $black,IMG_COLOR_STYLEDBRUSHED);
imagegif($img);
?>

 

[attachment deleted by admin]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.