PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : [pstricks] Wie geht ein Rechteck mit gepunkteter Füllung



Hobbes
07-03-2007, 21:44
Hi allerseits,

ich möchte mit pstricks ein Rechteck machen, das eine gepunktete Füllung hat (siehe Anhang). Ich habe aber für fillstyle nur die Optionen


fillstyle=none/solid/vlines/hlines/crosshatch/boxfill

gefunden.

Hat jemand einen Vorschlag für mich?

EDIT

Ich habe einen Beispielcode gefunden unter http://tug.org/PSTricks/main.cgi?file=Examples/Box/boxfill#hatchstyles

Ich werde mich mal damit beschäftigen, denn auf die Schnelle verstehe ich es nicht. Wenn mir trotzdem jemand hilft, wäre ich dankbar :)


\documentclass{article}
\usepackage{pstricks}
\makeatletter
% D.G. addition begin - Sep. 1, 2002
% To define dashed and dotted hatched styles
\def\pshs@solid{0 setlinecap }
\def\pshs@dashed{[ \psk@dash ] 0 setdash }
\def\pshs@dotted{[ 0 \psk@dotsep CLW add ] 0 setdash 1 setlinecap }
\def\psset@hatchstyle#1{%
\@ifundefined{pshs@#1}%
{\@pstrickserr{Hatch style `#1' not defined}\@eha}%
{\edef\pshatchstyle{#1}}}

\psset@hatchstyle{solid}

\def\pst@linefill{%
% D.G. modification begin - Sep. 1, 2002
\@nameuse{pshs@\pshatchstyle}
% D.G. modification end
\psk@hatchangle rotate
\psk@hatchwidth SLW
\pst@usecolor\pshatchcolor
\psk@hatchsep
\tx@LineFill}

\pst@def{LineFill}<{%
gsave
abs CLW add
/a ED
a 0 dtransform
round exch round exch 2 copy idtransform
exch Atan rotate idtransform
pop
/a ED
.25 .25 itransform
pathbbox
/y2 ED
a Div ceiling cvi
/x2 ED
/y1 ED
a Div cvi
/x1 ED
/y2 y2 y1 sub def
clip
newpath
% D.G. modification begin - Sep. 1, 2002
% 2 setlinecap
% D.G. modification end
systemdict
/setstrokeadjust
known { true setstrokeadjust } if
x2 x1 sub 1 add
{ x1 a mul y1 moveto
0 y2 rlineto
stroke
/x1 x1 1 add def } repeat
grestore
pop pop}>

\makeatother
\pagestyle{empty}
\begin{document}
\noindent
\begin{pspicture}(3.5,0)(10,6.8)
\psframe[fillstyle=hlines](4.5,.5)(9.5,5.5)
\pscircle[fillstyle=solid,fillcolor=white](7,3){1.5}
\end{pspicture}
\begin{pspicture}(3.5,0)(10,6.8)
\psframe[fillstyle=hlines,hatchstyle=dotted](4.5,.5)(9.5,5.5)
\pscircle[fillstyle=solid,fillcolor=white](7,3){1.5}
\end{pspicture}
\begin{pspicture}(3.5,0)(10,6.8)
\psframe[fillstyle=hlines,hatchstyle=dashed,dash=0.3 0.15]
(4.5,.5)(9.5,5.5)
\pscircle[fillstyle=solid,fillcolor=white](7,3){1.5}
\end{pspicture}
\begin{pspicture}(3.5,0)(10,6.8)
\psframe[fillstyle=vlines,hatchstyle=dashed,hatchsep=0.4,ha tchcolor=red]
(4.5,.5)(9.5,5.5)
\pscircle[fillstyle=solid,fillcolor=white](7,3){1.5}
\end{pspicture}
\end{document}

voss
08-03-2007, 15:50
Hi allerseits,

ich möchte mit pstricks ein Rechteck machen, das eine gepunktete Füllung hat (siehe Anhang). Ich habe aber für fillstyle nur die Optionen


fillstyle=none/solid/vlines/hlines/crosshatch/boxfill

gefunden.

Hat jemand einen Vorschlag für mich?




\documentclass{minimal}
\usepackage{pst-fill}
\def\Punkt{\pspicture(6pt,6pt)\psdot(3pt,3pt)\endp spicture}

\begin{document}

\begin{pspicture}(5,5)
\psboxfill{\Punkt}
\psframe[fillstyle=boxfill](5,5)
\end{pspicture}

\end{document}


Herbert

Hobbes
08-03-2007, 19:35
Hi Herbert,

danke für das kurze Beispiel. Das ist schon deutlich verständlicher :) Damit werde ich ein bißchen rumspielen bis die Punkte kleiner sind.

Den Code aus dem ersten Beispiel verstehe ich zwar nicht, aber ich habe mir den komplett kopiert und es sieht auch einigermaßen gut aus.

Gruß
Hobbes