9

Based on the following taken from pstricks.tex,

\def\solid@star{%
  \if@star
    \pslinewidth=\z@
    \psdoublelinefalse
    \def\pslinestyle{none}%
    \def\psk@fillstyle{\psfs@solid}%
    \let\psfillcolor\pslinecolor
  \fi}

starred object

\xxx*[linecolor=<color>]

is similar to

\xxx[fillstyle=solid,fillcolor=<color>,linestyle=none,linewidth=0]

However, this similarity is no longer held when we use them as the clipping path. In the following example, a red solid rectangle will be clipped by a circle.

The first clipping uses the starred version \pscircle*[linecolor=blue] and produces a blue circle. But the second clipping uses its dual \pscircle[fillstyle=solid,fillcolor=blue,linestyle=none,linewidth=0] and produces a red circle. So the second clipping produces the expected result.

enter image description here

\documentclass[border=12pt]{standalone}
\usepackage{pstricks}

\begin{document}

\begin{pspicture}[showgrid=top](4,4)
    \psclip{\pscircle*[linecolor=blue](2,2){1}}
        \psframe*[linecolor=red](4,4)
    \endpsclip
\end{pspicture}
\qquad
\begin{pspicture}[showgrid=top](4,4)
    \psclip{\pscircle[fillstyle=solid,fillcolor=blue,linestyle=none,linewidth=0](2,2){1}}
        \psframe*[linecolor=red](4,4)
    \endpsclip
\end{pspicture}

\end{document}

What makes this difference?

5
+50

You are right, both \pscircle*[linecolor=blue](2,2){1} and \pscircle[fillstyle=solid,fillcolor=blue,linestyle=none,linewidth=0](2,2){1} result in the same closed blue circle. However, the order of corresponding postscript commands is somehow different. Command \pscircle
...

0 360 arc closepath gsave 0 0 1  setrgbcolor
1. .setopacityalpha fill  grestore clip

builds the circular path first, saves the current graphic state with gsave, sets sets current color and alpha, fills the circle and restores the graphic state with grestore just before the clip, thus the color/filling commands are filtered out from the clipping path.

on the other hand, command \pscircle* generates different postscript sequence:

...

0 0 1  setrgbcolor 56.90549 56.90549 28.45274
1. .setopacityalpha  SD  clip

where SD stands for 0 360 arc fill, thus the color/filling commands stay in the clipping path and apparently, they are applied after clipping.

  • important is only when stroke is called. However, it has nothing to do with a correct clipping path. – user2478 Sep 10 '13 at 11:06
  • @Herbert: Compare postscript image newpath 0 200 moveto 200 200 lineto 100 380 lineto closepath gsave 1 0 0 setrgbcolor fill grestore gsave clip grestore 0 0 1 setrgbcolor fill with the same image, but without first gsave/grestore pair. – g.kov Sep 10 '13 at 13:44
3

a clipping path is a closed curve and not a filled area. Using a star version for the clipping path produces an unexpected behaviour

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.