# How to reverse the path direction of \psframe?

I think there is a bug in \psframe that behaves differently when we compare it with other closed curves in PSTricks.

The path direction of \psframe seems to be clockwise while that of other closed curves are counter-clockwise.

This phenomenon only occurs when fillstyle=solid. If I change to fillstyle=eofill then all the closed curves behave the same.

# MWE

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

\begin{document}
\begin{pspicture}(-6,-6)(6,6)
\pscustom
[
%fillstyle=eofill,
fillstyle=solid,
fillcolor=yellow
]
{
\pscircle{6}
\psframe(-3,2)(-1,4)
\psccurve(1,2)(3,2)(3,4)(2,3)(1,4)
\pspolygon(-5,-1)(-3,-1)(-4,1)
\pswedge(-1,0){1}{45}{360}
\psellipticwedge(3,0)(2,1){45}{360}
\pscircle(-2,-3){1}
\psellipse(2,-3)(2,1)
}
\end{pspicture}
\end{document}


# Question

How to reverse the path direction of \psframe?

Note: Swapping the point in \psframe(-3,2)(-1,4), i.e., \psframe(-1,4)(-3,2) does not help as well.

Use \code{reversepath}

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

\begin{document}
\begin{pspicture}[showgrid=top](-6,-6)(6,6)
\pscustom[fillstyle=solid,fillcolor=yellow]{%
\pscircle{6}
\code{reversepath}
\psframe(-3,4)(-1,2)
\psccurve(1,2)(3,2)(3,4)(2,3)(1,4)
\pswedge(-1,0){1}{45}{360}
\psellipticwedge(3,0)(2,1){45}{360}
\pscircle(-2,-3){1}
\psellipse(2,-3)(2,1)
}
\end{pspicture}
\end{document}


• Then write your own \psFrame, for example – user2478 Sep 13 '17 at 6:49
• Create your own pstricks.pro. Search for the /Rect ... def function and change the order of the lines. – user2478 Sep 13 '17 at 7:00
• \reversepath in your code must be placed right after \psframe. – Money Oriented Programmer Sep 14 '17 at 8:43
• yes, but I thought you wanted all vice versa filled. – user2478 Sep 14 '17 at 8:48

Based on Herbert's hint in his comment.

\documentclass[pstricks,border=12pt]{standalone}
\pstVerb
{
tx@Dict begin
/Rect {
x1 y2 moveto
x1 y1 lineto
x2 y1 lineto
x2 y2 lineto
x1 y2 lineto
closepath
} def end
}
\begin{document}
\begin{pspicture}[showgrid=top](-6,-6)(6,6)
\pscustom[fillstyle=solid,fillcolor=yellow]{%
\pscircle{6}
\psframe(-3,4)(-1,2)
\psccurve(1,2)(3,2)(3,4)(2,3)(1,4)
\pswedge(-1,0){1}{45}{360}
\psellipticwedge(3,0)(2,1){45}{360}
\pscircle(-2,-3){1}
\psellipse(2,-3)(2,1)}
\end{pspicture}
\end{document}


Or by using \reversepath.

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

\begin{document}
\begin{pspicture}[showgrid=top](-6,-6)(6,6)
\pscustom[fillstyle=solid,fillcolor=yellow]{%
\pscircle{6}
\psframe(-3,4)(-1,2)
\reversepath
\psccurve(1,2)(3,2)(3,4)(2,3)(1,4)
\pswedge(-1,0){1}{45}{360}
\psellipticwedge(3,0)(2,1){45}{360}
\pscircle(-2,-3){1}
\psellipse(2,-3)(2,1)
}
\end{pspicture}
\end{document}

• Write it into the preamble with: \pstVerb{tx@Dict begin /Rect { x1 y2 moveto x1 y1 lineto x2 y1 lineto x2 y2 lineto x1 y2 lineto closepath } def end} – user2478 Sep 13 '17 at 8:05
• @Herbert: Could you add a new object named \psRectangle with counter clockwise path to pstricks.pro? In addition, \psRectangle seems to be a better name than \psframe because frame is not a term used in geometry. I really appreciate if you can add it. Thank you! – Money Oriented Programmer Sep 17 '17 at 1:40
• I must think about it. Maybe that changing the Direktion in /Rect make more sense – user2478 Sep 17 '17 at 6:10
• @Herbert: Thank you very much for considering this issue. – Money Oriented Programmer Sep 17 '17 at 6:13