how set line thickness of arc

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tcloud
Forum Newbie
Posts: 6
Joined: Fri May 07, 2010 6:11 am

how set line thickness of arc

Post 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
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: how set line thickness of arc

Post by mikosiko »

imagesetthickness() maybe ?
tcloud
Forum Newbie
Posts: 6
Joined: Fri May 07, 2010 6:11 am

Re: how set line thickness of arc

Post 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 472 times
Tom
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: how set line thickness of arc

Post by John Cartwright »

GD isn't exactly my strength, so I'll leave you to a user comment.
tcloud
Forum Newbie
Posts: 6
Joined: Fri May 07, 2010 6:11 am

Re: how set line thickness of arc

Post 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
Post Reply