Mitya
Mitya

Reputation: 34556

PHP GD: draw filled path?

Does anyone know a way to draw a filled path in PHP GD?

I can draw the outline no problem, with iterative calls to imageline joining up the path points:

enter image description here

Filling it, though, so it looks like the below, I'm not sure GD provides any obvious means of filling non-trivial shapes:

enter image description here

Upvotes: 0

Views: 516

Answers (1)

kraysak
kraysak

Reputation: 1756

you should use imagefilledpolygon

imagefilledpolygon — Draw a filled polygon
Description 

bool imagefilledpolygon ( resource $image , array $points , int $num_points , int $color )

imagefilledpolygon() creates a filled polygon in the given image.

Upvotes: 1

Related Questions