Lews Therin
Lews Therin

Reputation: 10995

How to remove ImageFilledPolygon php jagged edges?

I have a function that fills a part of the bitmap created by imagecreatetruecolor($h,$w) ; But the result is the drawing looking jagged and not smooth which sucks. I tried the php antialias(resource,boolean) function and there is no difference. I can only guess it isn't supported. Any gurus know of any neat trick to make the edges smooth? If you look at the image http://www.php.net/manual/en/images/21009b70229598c6a80eef8b45bf282b-imagefilledpolygon.png from the php manual, that is exactly what I mean. Any ideas how to remove it (the jagged edges)? Thanks a lot in advanced.

Upvotes: 1

Views: 1128

Answers (2)

Daryl
Daryl

Reputation: 21

@trimbo pointed out in 2006 on php.net:

You can still draw antialiased filled polygons by drawing a hollow polygon on top of a filled one with the same dimensions:

$points=array($x,$y, $x2,$y2, $x3,$y3);
imageFilledPolygon($im, $points, 3, $gray );
imagePolygon($im, $points, 3, $gray );

Upvotes: 2

Lews Therin
Lews Therin

Reputation: 10995

To make the edges smooth, you can try the resizeimage function and add a blur parameter.

Upvotes: 3

Related Questions