Вопрос

I draw some paths from svg to pdf using iTextSharp.text.pdf.PdfContentByte methods: moveTo, LineTo and CurveTo. It's works fine for simple paths, but some paths has a cutted square. For example

<path
   style="fill:#1034ff;fill-opacity:1;fill-rule:evenodd;stroke:none"
   d="m 128.5625,106.65625 c -54.285714,37.14286 -54.285714,174.28571 0,260 100,51.42857 434.29464,34.28571 511.4375,0 31.42857,-31.42857 25.71429,-217.14286 0,-260 -31.42857,-34.285714 -460.00893,-42.857143 -511.4375,0 z M 611.4375,232.375 c -1.10965,39.4333 -70.01443,99.97768 -150,71.40625 -78.01486,-27.86748 -164.28571,16.61409 -150,-71.40625 6.31987,-38.93939 67.15729,-71.4375 150,-71.4375 75.65298,0.52477 151.5294,17.08767 150,71.4375 z"
   id="rect3774"
   inkscape:connector-curvature="0"
   sodipodi:nodetypes="cccccssccs" />

current path has a m=moveto and c=curveto points finished by z=closepath. Next M, C and Z cut a hole in the figure.

How I can draw it in PDF using iTextSharp? How I can cut some inner path from existing path for filling it by ContentByte.Fill();?

Это было полезно?

Решение

Please take a look at the star shapes on the first row of figure 14.2 of my book.

The first shape is filled using the Fill() method. This method uses the nonzero winding number rule to determine whether or not a shape should be filled. Reading your question, I assume that you want to use the even-odd rule, in which case you need to use the EoFill() method instead of the Fill() method.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top