> On 28 Dec 2015, at 17:01, [email protected] wrote:
> 
> The methods addPolygon, drawPolygon and fillPolygon in PDPageContentStream is 
> depricated and I don't see why.

PDPageContentStream provides drawing methods which represent those available in 
the PDF format - polygon drawing isn't a native part of PDF so it was removed. 
AWT has its own drawing primitives and mixing those with PDF isn't desirable.

> Why is it better to write:
> 
> 
> 
> for (int i = 0; i < x.length; i++)
> {
>    if (i == 0)
>    {
>        contentStream.moveTo(x[i], y[i]);
>    }
>    else
>    {
>        contentStream.lineTo(x[i], y[i]);
>    }
> }
> contentStream.closeSubPath();
> contentStream.fill();
> 
> 
> 
> than simply write:
> 
> 
> 
> contentStream.fillPolygon(x, y);

In the second example you're missing the methods which build the polygon in the 
first place - so it's hardly a fair comparison.

> I ask since I want to understand the intention behind depricating these 
> methods. The result of depricating them is that you end up with a for loop 
> anywhere you want to draw a polygon

You can write a method to draw an AWT GeneralPath to a PDPageContentStream via 
a PathIterator and then simply call that once.

-- John

> Kind regards,
> Daniel
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to