[英]How to draw a filled polygon in PDFBOX?
我想繪制一個填充的多邊形。 我研究了文檔和方法:
fillPolygon(float[] x, float[] y)
Deprecated.
Use moveTo(float, float) and lineTo(float, float) methods instead.
我找不到其他方法來填充pdfbox中的多邊形。
源自PDFBox源代碼:
public void fillPolygon(PDPageContentStream cs, float[] x, float[] y) throws IOException
{
if (x.length != y.length)
{
throw new IllegalArgumentException("Error: some points are missing coordinate");
}
for (int i = 0; i < x.length; i++)
{
if (i == 0)
{
cs.moveTo(x[i], y[i]);
}
else
{
cs.lineTo(x[i], y[i]);
}
}
cs.closePath();
cs.fill();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.