[pstricks] Drawing "real" circle-like stain

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Sun Nov 14 13:40:28 CET 2004


Christophe Jorssen wrote:

> attach a pdf file. This is what I get with Illustrator's Ink Stain pencil
> that is exactly what I want.

only a first idea, but should be what you want.

Herbert


\documentclass[a4paper,10pt]{article}
\usepackage{pstricks}
\usepackage{pst-xkey}

\makeatletter
\define at key[psset]{}{stain}{\def\psk at stain{#1}}
\define at key[psset]{}{step}{\def\psk at step{#1}}
\psset{stain=20,step=0.25}%
%
\def\psCStain{\pst at object{psCStain}}
\def\psCStain at i(#1)#2{%
   \leavevmode
   \pst at killglue
   \begingroup
     \use at par
     \pscircle*(#1){#2}
     \init at pscode%
     \pst at getcoor{#1}\pst at tempa%
     \pssetlength\pst at dimc{#2}%
     \def\pst at linetype{4}%
     \addto at pscode{%
     rrand srand
     /getRandInt { rand 2147483647 div \psk at stain\space mul } def
     \pst at tempa\space translate pstack
     /radius \pst at number\pst at dimc \psk at dimen CLW mul sub def
     newpath
     0 radius moveto
     0 \psk at step\space 360 {
       /angle exch def
       radius getRandInt add dup angle cos mul exch angle sin mul
       lineto
     } for
     closepath fill
   }%
   \pst at stroke
   \use at pscode
   \endgroup
   \ignorespaces%
}
\makeatother
\begin{document}

\begin{pspicture}(5,5)\psgrid[griddots=5,subgriddiv=0]
\psCStain[linecolor=blue](2.5,2.5){0.5}
\psCStain[linecolor=blue](1,1){0.25}
\psCStain[linecolor=blue,step=1](4,4){0.25}
\end{pspicture}


\end{document}


-- 
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes




More information about the PSTricks mailing list