Page 1 of 1

how set line thickness of arc

Posted: Fri May 07, 2010 6:19 am
by tcloud
I need to draw simple arcs on an image -- and the line thickness needs to be adjustable.

Drawing the ImageArc() function repeatedly while decrementing the size variable creates a thick line but not all pixels are filled and the background color bleeds through.

Any suggestions appreciated.

Tom

Re: how set line thickness of arc

Posted: Fri May 07, 2010 7:43 am
by mikosiko
imagesetthickness() maybe ?

Re: how set line thickness of arc

Posted: Fri May 07, 2010 4:50 pm
by tcloud
thanks -- I knew I had to be missing something -- and thank you for taking the time to reply.

But -- the line now looks really bad.

The code I used for a thickness of 15 is:

Code: Select all

imagesetthickness($img, 15);
ImageArc($img, $center, $center, $size, $size, 166, 0, $black) ;
It looks much better if I just draw the arc 15 times with it being 1 pixel smaller each time -- but still doesn't look very good.

Code: Select all

$thickness = 15 ;
for ($sizet = $size ; $sizet > $size - $thickness ; $sizet = $sizet - 1) {
	ImageArc($img, $center, $center, $sizet, $sizet, 166, 0, $black) ;
}
Image with example of each method attached.
arcexa.png
arcexa.png (67.74 KiB) Viewed 471 times
Tom

Re: how set line thickness of arc

Posted: Fri May 07, 2010 5:31 pm
by John Cartwright
GD isn't exactly my strength, so I'll leave you to a user comment.

Re: how set line thickness of arc

Posted: Fri May 07, 2010 5:57 pm
by tcloud
I already tried that -- it looks like my own solution, except his centers the width on the arc and mine builds the line width inside the arc.
Neither returns a pixel width equal to the chosen width value, and both look ragged with the background bleeding through.

thanks,
Tom