[pstricks] [Programming] Lens

Denis Girou Denis.Girou at idris.fr
Thu Jan 11 18:42:26 CET 2001


>>>>> "Maurice.Diamantini" == Maurice DIAMANTINI <diam at ensta.fr> writes:

    Maurice.Diamantini> What an powerfull and easy-to-use macro for pstricks!!!!

  But it was a stupid idea (from me!) to introduce a dependancy with the `fp'
package for only few basic calculations on real numbers. It is obviously
better here to make these calculations in PostScript. So, the macro become:

\SpecialCoor

\def\PstLens#1#2#3#4#5#6{%
% #1 and #2 = coordinates of the center of the len, #3 = size of the len
% #4 = magnification, #5 = angle of the len, #6 = text to magnify
% Handle of the len
\rput{#5}(#1,#2){%
  \scalebox{#3}{%
    \psframe[fillstyle=gradient,framearc=0.6,linewidth=0.5\pslinewidth,
             gradmidpoint=0.5,gradangle=#5,gradbegin=Brown,gradend=Salmon]
            (0.2,-2.5)}}
% Glass of the len
\psclip{\pscircle[shadow=true,shadowcolor=lightgray,shadowsize=0.15,
                  shadowangle=#5](#1,#2){#3}}
  \rput(! 1 #4\space sub #1\space mul 1 #4\space sub #2\space mul){%
    \scalebox{#4}{#6}}%
\endpsclip}

  I will update later the source file on the server.

    Maurice.Diamantini> Should be rename "pst-lens" and provide as a standard
    Maurice.Diamantini> package for psTricks!!!

  Of course, I can do it. Perhaps that this is to give too much importance
to a 10 lines macro, but packaged things are always better...

D.G.



More information about the PSTricks mailing list