% \iffalse meta-comment, etc. %% %% Package `pst-fill.dtx' %% %% Denis Girou (CNRS/IDRIS - France) %% Herbert Voss %% %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN archives %% in directory macros/latex/base/lppl.txt. %% %% DESCRIPTION: %% `pst-fill' is a PSTricks package for filling and tiling areas %% % \fi % \changes{v1.01}{2007/03/10}{bugfix for incomplete ifx (hv)} % \changes{v1.00}{2006/11/06}{use pst-xkey for extend keys (hv)} % \changes{v0.99}{2004/08/17}{merge the VTeX and TeX versions (patch 4) (hv)} % \changes{v0.98}{2004/06/22}{delete the Pst@Debug option and use the % the one from pstricks to prevent a clash with pst-gr3d (hv)} % \changes{v0.97}{2001/10/09}{make it work with VTeX (mv)} % \changes{v0.94}{1997/04/08}{With a \PstTiling macro defined (or "tiling" optional parameter % on \textbackslash usepackage[tiling]{pst-fill}), this file run exactly as % the original boxfill.tex file from Timothy, version 0.94, % except a correction in \textbackslash pst@ManualFillCycle to avoid a division by 0. % It's the default.} % \changes{v0.93}{1997/04/07}{With a \textbackslash PstTiling macro defined (or "tiling" optional parameter % on \textbackslash usepackage[tiling]{pst-fill}) there are several add-ons % and changes to do `tiling' rather than `filling' in "automatic" mode : % - we fix the position of the beginning of tiling, % - we allow normally the framing of the area as expected, using % the line.... parameters % - we define move parameters fillmovex, fillmovey and fillmove, % - we define fillcyclex as previous fillcycle parameter, and add the % fillcycley and fillcycle (both fillcyclex and fillcycley) ones % - we can extend the tiling area using fillloopaddx, fillloopaddy and % fillloopadd parameters, % - we can debug and see the whole tiling area without clipping using % PstDebug parameter, % - for names consistancy, we can use fillangle in place of boxfillangle % and fillsize in place of boxfillsize, % - default value for fillsep is 0 and for fillsize is auto.} % % \DoNotIndex{\!,\",\#,\$,\%,\&,\',\(,\+,\*,\,,\-,\.,\/,\:,\;,\<,\=,\>,\?} % \DoNotIndex{\@,\@B,\@K,\@cTq,\@f,\@fPl,\@ifnextchar,\@nameuse,\@oVk} % \DoNotIndex{\[,\\,\],\^,\_,\ } % \DoNotIndex{\^,\\^,\\\^,$\^$,$\\^$,$\\^$} % \DoNotIndex{\0,\2,\4,\5,\6,\7,\8,} % \DoNotIndex{\A,\a} % \DoNotIndex{\B,\b,\Bc,\begin,\Bq,\Bqc} % \DoNotIndex{\C,\c,\catcode,\cJA,\CodelineIndex,\csname} % \DoNotIndex{\D,\def,\define@key,\Df,\divide,\DocInput,\documentclass,\pst@addfams} % \DoNotIndex{\eCN,\edef,\else,\eHd,\eMcj,\EnableCrossrefs,\end,\endcsname} % \DoNotIndex{\endCenterExample,\endExample,\endinput,\endpsclip} % \DoNotIndex{\PrintIndex,\PrintChanges,\ProvidesFile} % \DoNotIndex{\endpspicture,\endSideBySideExample,\Example} % \DoNotIndex{\F,\f,\FdUrr,\fi,\filedate,\fileversion,\FV@Environment} % \DoNotIndex{\FV@UseKeyValues,\FV@XRightMargin,\FVB@Example,\fvset} % \DoNotIndex{\G,\g,\GetFileInfo,\gr,\GradientLoaded,\gsFKrbK@o,\gsj,\gsOX} % \DoNotIndex{\hbadness,\hfuzz,\HLEmphasize,\HLMacro,\HLMacro@i} % \DoNotIndex{\HLReverse,\HLReverse@i,\hqcu,\HqY} % \DoNotIndex{\I,\i,\ifx,\input,\Ir,\IU} % \DoNotIndex{\j,\jl,\JT,\JVodH} % \DoNotIndex{\K,\k,\kfSlL} % \DoNotIndex{\L,\let} % \DoNotIndex{\message,\mHNa,\mIU} % \DoNotIndex{\N,\nB,\newcmykcolor,\newdimen,\newif,\nW} % \DoNotIndex{\O,\oCDJDo,\ocQhVI,\OnlyDescription,\oRKJ} % \DoNotIndex{\P,\p,\ProvidesPackage,\psframe,\pslinewidth,\psset} % \DoNotIndex{\PstAtCode,\PSTricksLoaded} % \DoNotIndex{\q,\Qr,\qssRXq,\qu,\qXjFQp,\qYL} % \DoNotIndex{\R,\r,\RecordChanges,\relax,\RlaYI,\rN,\Rp,\rp,\RPDXNn,\rput} % \DoNotIndex{\S,\scalebox,\SgY,\SideBySide@Example,\SideBySideExample} % \DoNotIndex{\SgY,\sk,\Sp,\space,\sZb} % \DoNotIndex{\T,\the,\tw@} % \DoNotIndex{\u,\UiSWGEf@,\uJi,\usepackage,\uVQdMM,\UYj} % \DoNotIndex{\VerbatimEnvironment,\VerbatimInput,\VrC@} % \DoNotIndex{\WhZ,\WjKCYb,\WNs} % \DoNotIndex{\XkN,\XW} % \DoNotIndex{\Z,\ZCM,\Ze} % \DoNotIndex{\addtocounter,\advance,\alph,\arabic,\AtBeginDocument,\AtEndDocument} % \DoNotIndex{\AtEndOfPackage,\begingroup,\bfseries,\bgroup,\box,\csname} % \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\expandafter,\fi} % \DoNotIndex{\TeX,\z@,\p@,\@one,\xdef,\thr@@,\string,\sixt@@n,\reset,\or,\multiply,\repeat,\RequirePackage} % \DoNotIndex{\@cclvi,\@ne,\@ehpa,\@nil,\copy,\dp,\global,\hbox,\hss,\ht,\ifodd,\ifdim,\ifcase,\kern} % \DoNotIndex{\chardef,\loop,\leavevmode,\ifnum,\lower} % \setcounter{IndexColumns}{2} % % ^^A To extend the height used for the text % % ^^A Aligned labels in a description environment %\newenvironment{Description}[1]{% %\begin{list}{nothing}{\setlength{\leftmargin}{#1} %\setlength{\labelwidth}{\leftmargin}\setlength{\labelsep}{1mm}}} %{\end{list}} % % ^^A For macro names %\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} % % % ^^A From ltugboat.cls % ^^A For references %\makeatletter %\newcommand\acro[1]{\textsc{#1}\@} %\def\CTAN{\acro{CTAN}} %\let\texttub\textsl % ^^A redefined in other situations %\def\TUB{\texttub{TUGboat}} %\def\TUG{\TeX\ \UG} %\def\tug{\acro{TUG}} %\def\UG{Users Group} % ^^A For the bibliography %\let\@internalcite\cite %\def\cite{\def\@citeseppen{-1000}% % \def\@cite##1##2{(##1\if@tempswa , ##2\fi)}% % \def\citeauthoryear##1##2##3{##1, ##3}\@internalcite} %\def\etal{et\,al.\@} %\newcommand\CTANdirectory[1]{\expandafter\urldef % \csname CTAN@#1\endcsname\path} %\newcommand\CTANfile[1]{\expandafter\urldef % \csname CTAN@#1\endcsname\path} %\newcommand\CTANref[1]{\expandafter\@setref\csname CTAN@#1\endcsname % \relax{#1}} %\makeatother % ^^A Define CTAN addresses %\CTANdirectory{mpattern}{graphics/metapost/macros/mpattern} %\CTANdirectory{pstricks}{graphics/pstricks} %\CTANdirectory{pst-fill.sty}{graphics/pstricks/latex/pst-fill.sty} %\CTANdirectory{pst-fill}{graphics/pstricks/generic/pst-fill.tex} %\CTANdirectory{Roegel}{graphics/metapost/contrib/macros/truchet} %\CTANdirectory{xypic}{macros/generic/diagrams/xypic} % % ^^A Personal macros (D.G.) % ^^A ---------------------- % % ^^A Some colors used %\definecolor{LemonChiffon}{rgb}{1.,0.98,0.8} %\definecolor{LightBlue} {rgb}{0.8,0.85,0.95} %\definecolor{PaleGreen} {rgb}{0.88,1,0.88} %\definecolor{PeachPuff} {rgb}{1.0,0.85,0.73} % % ^^A To define a unique string for TeX and LaTeX %\newcommand{\AllTeX}{% %{\rm(L\kern-.36em\raise.3ex\hbox{\sc a}\kern-.15em)% %T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}} % % ^^A Bibliography style %\bibliographystyle{ltugbib} % % ^^A Name macros %\newcommand{\FillPackage}{\textsf{`pst-fill'}} %\newcommand{\XYpic}{% %\leavevmode\hbox{\kern-.1em X\kern-.3em\lower.4ex\hbox{Y\kern-.15em}-pic}} % %\makeatletter % % ^^A Example environments % ^^A (do not use in them the four JXYZ characters, that we will use % ^^A as escape characters!) % % ^^A Default PSTricks parameters % \psset{dimen=middle} % % ^^A Translation in PSTricks from the one drawn by Emmanuel Chailloux and % ^^A Guy Cousineau for the MLgraph system % ^^A (see /ftp.ens.fr:/pub/unix/lang/MLgraph/version-2.1/MLgraph-refman.ps.gz) % ^^A The kangaroo itself is reproduce from an original picture from Raoul Raba % \newcommand{\DimX}{2.47} % \newcommand{\DimY}{4.8} % \newcommand{\DimXDivTwo}{1.235} % % \newcommand{\KangarooItself}[1]{% % ^^A Body % \pspolygon[fillstyle=solid,fillcolor=#1]% % (52.5,68)(55,72.5)(55.8,76.5)(56.8,79.8)(58.2,83)(60,85.8)(61.5,86.5) % (64,87)(66,87.5)(67.8,87.3)(70,87)(71.5,87.3)(73,88)(74.7,88.5) % (76,90.3)(77,91.5)(72.8,93.8)(69,96)(64.5,99)(59.4,103)(56.2,106.3) % (53,110.5)(49.5,115.5)(47.2,119.9)(45.7,126)(43.2,123)(41.5,121)(37.5,125) % (37,122.5)(36.8,120)(37,117)(37.6,113.5)(38.6,110)(40,106.3)(42,102.3) % (43.5,99.5)(45,97)(46.2,94)(46.8,91.7)(47.2,88)(47,83.5)(46.3,80.8) % (45.3,78.5)(42.5,76.5)(39.5,75.8)(36,75.9)(33,75.9)(29,76.2)(26,77) % (22.3,77.5)(18,78.4)(12.8,79.3)(8.6,80)(5.5,80.3)(3,80.5)(0,80) % (-5.2,78.5)(-9,76.3)(-11.2,74.8)(-13,72.5)(-16.5,68)(-16.5,68)(-19.5,62.5) % (-22,58)(-25.5,53)(-29,48.5)(-32.5,45)(-36,42)(-39,39.5)(-44,37) % (-49,35)(-51,34)(-53.5,34.5)(-55.5,36)(-56.5,38)(-56.5,40.5)(-55,41.5) % (-53.5,41)(-51.5,41)(-50.5,43)(-50.5,44.5)(-51,47)(-51.5,47.2)(-56.5,47) % (-58.5,46.5)(-60,44.7)(-62,42.3)(-63,39.5)(-63.5,36.3)(-63.5,33)(-63.1,29.5) % (-61.5,26)(-58,23.6)(-54,22.2)(-50.7,22)(-47.5,22)(-44.5,22.3)(-41,23.5) % (-36.8,25.8)(-33,28)(-28.5,31)(-23.4,35)(-20.2,38.3)(-17,42.5)(-13.5,47.5) % (-11.2,51.9)(-9.7,58)(-7.2,55)(-5.5,53)(-1.5,57)(-1,54.5)(-0.8,52) % (-1,49)(-1.6,45.5)(-2.6,42)(-4,38.3)(-6,34.3)(-7.5,31.5)(-9,29) % (-10.2,26)(-10.8,23.7)(-11.2,20)(-11,15.5)(-10.3,12.8)(-9.3,10.5)(-6.5,8.5) % (-3.5,7.8)(0,7.9)(3,7.9)(7,8.2)(10,9)(13.7,9.5)(18,10.4) % (23.2,11.3)(27.4,12)(30.5,12.3)(33,12.5)(36,12)(41.2,10.5)(45,8.3) % (47.2,6.8)(49,4.5)(52.5,0)(50,4.5)(49.2,8.5)(48.2,11.8)(46.8,15) % (45,17.8)(43.5,18.5)(41,19)(39,19.5)(37.2,19.3)(35,19)(33.5,19.3) % (32,20)(30.3,20.5)(29,22.3)(28,23.5)(28,23.5)(24.5,22.3)(21.5,22) % (18.3,22)(15,22.2)(11,23.6)(7.5,26)(5.9,29.5)(5.5,33)(5.5,36.3) % (6,39.5)(7,42.3)(9,44.7)(10.5,46.5)(12.5,47)(17.5,47.2)(18,47) % (18.5,44.5)(18.5,43)(17.5,41)(15.5,41)(14,41.5)(12.5,40.5)(12.5,38) % (13.5,36)(15.5,34.5)(18,34)(20,35)(25,37)(30,39.5)(33,42) % (36.5,45)(40,48.5)(43.5,53)(47,58)(49.5,62.5)(52.5,68) % ^^A Eye % \pscircle*[linecolor=white](58.2,98.3){2\psxunit} % \pscircle*(58.2,97.3){\psxunit} % ^^A Mouth % \psline(71.5,88)(70,89.3)(68.5,90.3)(67,91.9) % ^^A Tear % \psline(42,121)(45,118)(47,115.3)(48.5,112.7)(50,110)(51.8,106.5) % (52.5,103.7)(53,100.5) % \pspolygon(41.2,115.8)(43.2,114.7)(45,112.5)(47,109.8)(48,107)(49.5,104.2)% % (50.5,101.6)(51,98.5)(47.7,100.6)(46,102.2)(44.8,104)(43.5,106) % (42.5,108)(41.7,110.5)(41,113.2)} % % \newcommand{\Kangaroo}[1]{% % \begin{pspicture}(\DimX,\DimY) % \psset{unit=0.035278} % \KangarooItself{#1} % \end{pspicture}} % % \newcommand{\KangarooPstChart}[1]{{% % \psset{xunit=0.006784,yunit=0.00735,linewidth=0.01} % \begin{pspicture}(-65.5,0)(82,126) % \KangarooItself{#1} % \end{pspicture}}} % % % ^^A For the possible index and changes log % \setlength{\columnseprule}{0.6pt} % % ^^A Beginning of the documentation itself %\title{\texttt{pst-fill}\\A PSTricks package for filling and tiling areas} %\author{Timothy Van Zandt\thanks{\protect\url{tvz@econ.insead.fr}. (documentation by % Denis Girou (\protect\url{Denis.Girou@idris.fr}) and Herbert Vo\ss (\protect\url{hvoss@tug.org}).}} % %\date{\shortstack{\today --- Version 1.00\\ % {\small Documentation revised \today}}} % \maketitle % \tableofcontents % %\begin{abstract} % \FillPackage{} is a PSTricks \cite{vanZandt93},\cite{Girou94},\cite{vanZandtGirou94}, %\cite{Hoenig97},\cite{LGC97} package to draw easily % various kinds of filling and tiling of areas. It is also a good example of % the great power and flexibility of PSTricks, as in fact it is a very short % program (it body is around 200~lines long) but nevertheless really powerful. % % \hspace{5mm} It was written in 1994 by Timothy \textsc{van Zandt} but % publicly available only in PSTricks 97 and without any documentation. % We describe here the version \emph{97 patch 2} of December 12, 1997, which % is the original one modified by myself to manage \emph{tilings} in the % so-called \emph{automatic} mode. This article would like to serve both of % reference manual and of user's guide. % %This package is available on \CTAN{} in the % \texttt{graphics/pstricks} directory (files \texttt{latex/pst-fill.sty} and % \texttt{generic/pst-fill.tex}). %\end{abstract} % %\section{Introduction} % % Here we will refer as \emph{filling} as the operation which consist to fill %a defined area by a pattern (or a composition of patterns). We will refer as %\emph{tiling} as the operation which consist to do the same thing, but with %the control of the starting point, which is here the upper left corner. %The pattern is positioned relatively to this point. This make an essential %difference between the two modes, as without control of the starting point we %can't draw \emph{tilings} (sometimes called \emph{tesselations}) as used in %many fields of Art and Science% %\footnote{For an extensive presentation of tilings, in their history and usage %in many fields, see the reference book \cite{GS87}. % % In the \TeX{} world, few work was done on tilings. You can look at the %\emph{tile} extension of the \XYpic{} package \cite{XYpic}, at the articles of %Kees \textsc{van der Laan} \cite[paragraph 7]{LAAN96} (the tiling was in %fact directly done in PostScript) and \cite{LAAN97}, at the \MP{} program %(available on \CTANref{Roegel}) by Denis \textsc{Roegel} for the %\textsc{Truchet} contest in 1995 \cite{EsperetGirou98} and at the \MP{} %package \cite{Bolek98} to draw patterns, which have a strong connection with %tilings.}. % % Nevertheless, as tilings are a wide and difficult field in mathematics, this %package is limited to simple ones, mainly \emph{monohedral} tilings with one %prototile (which can be composite, see section \ref{sec:KindTiles}). With some %experience and wiliness we can do more and obtained easily rather %sophisticated results, but obviously hyperbolic tilings like the famous %\textsc{Escher} ones or aperiodic tilings like the \textsc{Penrose} ones are %not in the capabilities of this package. For more complex needs, we must used %low level and more painfull technics, with the basic \cs{multido} %and \cs{multirput} macros. % %\section{Package history and description of it two different modes} % % As already said, this package was written in 1994 by Timothy \textsc{van %Zandt}. Two modes were defined, called respectively \emph{manual} and %\emph{automatic}. For both, the pattern is generated on contiguous positions in %a rather large area which include the region to fill, later cut to the %required dimensions by clipping mechanism. In the first mode, the pattern is %explicitely inserted in the PostScript file each time. In the second one, the %result is the same but with an unique explicit insertion of the pattern and a %repetition done by PostScript. Nevertheless, in this method, the control of %the starting point was loosed, so it allowed only to \emph{fill} a region and %not to \emph{tile} it. % % See the difference between the two modes, \emph{tiling}: % {\psset{unit=0.5cm}% % \psboxfill{\begin{pspicture}(1,1)\psframe[dimen=middle](1,1)\end{pspicture}} % \begin{pspicture}(3,3.3) % \psframe[fillstyle=boxfill](3,3) % \end{pspicture}} % and \emph{filling}: %{% % \makeatletter %\pst@def{BoxFill}< % gsave % gsave \tx@STV CM grestore dtransform CM idtransform % abs /h ED abs /w ED % pathbbox % h div round 2 add cvi /y2 ED % w div round 2 add cvi /x2 ED % h div round 2 sub cvi /y1 ED % w div round 2 sub cvi /x1 ED % /y2 y2 y1 sub def % /x2 x2 x1 sub def % CP % y1 h mul sub neg /y1 ED % x1 w mul sub neg /x1 ED % clip % y2 { % /x x1 def % x2 { % save CP x y1 T moveto Box restore % /x x w add def % } repeat % /y1 y1 h add def % } repeat % currentpoint currentfont grestore setfont moveto> % \makeatother % % \psset{unit=0.5} % \psboxfill{\begin{pspicture}(1,1)\psframe[dimen=middle](1,1)\end{pspicture}} % \begin{pspicture}(3,3.3) % \psframe[fillstyle=boxfill](3,3) % \end{pspicture} % or % \begin{pspicture}(3,3.3) % \psframe[fillstyle=boxfill](3,3) % \end{pspicture} %} %as we can see that initial position is arbitrary and dependent of %the current point. % % % It's clear that usage of filling is very restrictive comparing to tiling, %as desired effects required very often the possibility to control the starting %point. So, this mode was of limited interest, but unfortunately the %\emph{manual} one has the very big disadvantage to require very huge amounts %of ressources, mainly in disk space and consequently in printing time. %A small tiling can require sometimes several megabytes in \emph{manual} mode! %So, it was very often not really usable in practice. % %It is why I modified the code, to allow tilings in \emph{automatic} mode, %controlling in this mode too the starting point. And most of the time, that is %to say if some special options are not used, the tiling is done exactly in the %region described, which make it faster. So there is no more reason to use the %\emph{manual} mode, apart very special cases where \emph{automatic} one cannot %work, as explained later -- currently, I know only one case. % % To load this modified \emph{automatic} mode, with \LaTeX{} use %simply:\newline %\verb+\usepackage[tiling]{pst-fill}+\newline %and in plain \TeX{} after:\newline %\verb+\input{pst-fill}+\newline %add the following definition:\newline %\verb+\def\PstTiling{true}+ % % To obtain the original behaviour, just don't use the \emph{tiling} optional %keyword at loading. % % Take care than in \emph{tiling} mode, I introduce also some other changes. %First I define aliases on some parameter names for consistancy (all specific %parameters will begin by the \texttt{fill} prefix in this case) and I change %some default values, which were not well adapted for tilings (\texttt{fillsep} %is set to 0 and as explained \texttt{fillsize} set to \texttt{auto}). I rename %\texttt{fillcycle} to \texttt{fillcyclex}. I also restore normal way so that %the frame of the area is drawn and all line (\texttt{linestyle}, %\texttt{linecolor}, \texttt{doubleline}, etc.) parameters are now active (but %there are not in non \emph{tiling} mode). And I also introduce new parameters %to control the tilings (see below). % % \textbf{In all the following examples, we will consider only the % \emph{tiling} mode.} % % To do a tiling, we have just to define the pattern with the % \verb+\psboxfill+ macro and to use the new \texttt{fillstyle} % \verb+boxfill+. % % Note that tilings are drawn from left to right and top to bottom, which can %have an importance in some circonstances. % % PostScript programmers can be also interested to know that, even in the %\emph{automatic} mode, the iterations of the pattern are managed directly by %the PostScript code of the package which used only PostScript Level 1 %operators. The special ones introduced in Level 2 for drawing of patterns %\cite[section 4.9]{PostScript95} are not used. % % And first, for conveniance, we define a simple \cs{Tiling} macro, which %will simplify our examples: % %\begin{verbatim} % \newcommand{\Tiling}[2][]{% % \edef\Temp{#1}% % \begin{pspicture}#2 % \ifx\Temp\empty % \psframe[fillstyle=boxfill]#2 % \else % \psframe[fillstyle=boxfill,#1]#2 % \fi % \end{pspicture}} %\end{verbatim} % % %\newcommand{\Tiling}[2][]{% % \edef\Temp{#1}% % \begin{pspicture}#2 % \ifx\Temp\empty % \psframe[fillstyle=boxfill]#2 % \else % \psframe[fillstyle=boxfill,#1]#2 % \fi % \end{pspicture}} % %\subsection{Parameters} % % There are \textbf{14} specific parameters available to change the way the % filling/tiling is defined, and one debugging option. % % \begin{Description}{2cm} % \item [fillangle (real)\hfill :] the value of the rotation % applied to the patterns (\emph{Default:~0}). % \end{Description} % % % In this case, we must force the tiling area to be notably larger than the % area to cover, to be sure that the defined area will be covered after rotation. % \lstset{gobble=2} % \begin{LTXexample} % \newcommand{\Square}{% % \begin{pspicture}(1,1) % \psframe[dimen=middle](1,1) % \end{pspicture}} % \psset{unit=0.5} % \psboxfill{\Square} % \Tiling[fillangle=45]{(3,3)}\quad % \Tiling[fillangle=-60]{(3,3)} % \end{LTXexample} % % \newcommand{\Square}{\begin{pspicture}(1,1)\psframe[dimen=middle](1,1)\end{pspicture}} % % \begin{Description}{2cm} % \setcounter{footnote}{1} % \item[\texttt{fillsepx} (real$\|$dim) :] value of the horizontal % separation between consecutive patterns (\emph{Default:~0 for % tilings\footnotemark, 2pt otherwise}). \footnotetext{This option was added % by me, is not part of the original package and is available only if the % \texttt{tiling} keyword is used when loading the package.} % \setcounter{footnote}{1} % \item [\texttt{fillsepy} (real$\|$dim)\hfill :] value of the vertical % separation between consecutive patterns (\emph{Default:~0 for % ti\-lings\footnotemark, 2pt otherwise}). % \setcounter{footnote}{1} % \item [\texttt{fillsep} (real$\|$dim)\hfill :] value of horizontal and % vertical separations between consecutive patterns (\emph{Default:~0 for % tilings\footnotemark, 2pt otherwise}). % \end{Description} % % These values can be negative, which allow the tiles to overlap. % % \begin{LTXexample} % \psset{unit=0.5} % \psboxfill{\Square} % \Tiling[fillsepx=2mm]{(3,3)} % \Tiling[fillsepy=1mm]{(3,3)}\\ % \Tiling[fillsep=0.5]{(3,3)} % \Tiling[fillsep=-0.5]{(3,3)} % \end{LTXexample} % % \begin{Description}{2cm} % \item [\texttt{fillcyclex}\footnotemark\ (integer)\hfill :] Shift % coefficient applied to each row (\emph{Default:~0}). % \footnotetext{It was \texttt{fillcycle} in the original version.} % \setcounter{footnote}{1} % \item [\texttt{fillcycley}\footnotemark\ (integer)\hfill :] Same thing for % columns (\emph{Default:~0}). % \setcounter{footnote}{1} % \item [\texttt{fillcycle}\footnotemark\ (integer)\hfill :] Allow to fix % both \texttt{fillcyclex} and \texttt{fillcycley} directly to the same value % (\emph{Default:~0}). % \end{Description} % % For instance, if \texttt{fillcyclex} is 2, the second row of patterns will % be horizontally shifted by a factor of $\frac{1}{2}=0.5$, and by a factor of % 0.333 if \texttt{fillcyclex} is 3, etc.). These values can be negative. % % \begin{LTXexample}[width=0.35\linewidth] % \psset{unit=0.5} % \psboxfill{\Square} % \newcommand{\TilingA}[1]{\Tiling[fillcyclex=#1]{(3,3)}} % \TilingA{0} \TilingA{1}\\ % \TilingA{2} \TilingA{3}\\[3mm] % \TilingA{4} \TilingA{5}\\ % \TilingA{6} \TilingA{-3}\\[3mm] % \Tiling[fillcycley=2]{(3,3)} % \Tiling[fillcycley=3]{(3,3)}\\ % \Tiling[fillcycley=-3]{(3,3)} % \Tiling[fillcycle=2]{(3,3)} % \end{LTXexample} % % \begin{Description}{2cm} % \setcounter{footnote}{1} % \item [\texttt{fillmovex}\footnotemark\ (real$\|$dim)\hfill :] value of the % horizontal moves between consecutive patterns (\emph{Default:~0}). % \setcounter{footnote}{1} % \item [\texttt{fillmovey}\footnotemark\ (real$\|$dim)\hfill :] value of the % vertical moves between consecutive patterns (\emph{Default:~0}). % \setcounter{footnote}{1} % \item [\texttt{fillmove}\footnotemark\ (real$\|$dim)\hfill :] value of % horizontal and vertical moves between consecutive patterns % (\emph{Default:~0}). % \end{Description} % % These parameters allow the patterns to overlap and to draw some special % kinds of tilings. They are implemented only for the \emph{automatic} and % \emph{tiling} modes and their values can be negative. % % In some cases, the effect of these parameters will be the same that with the % \texttt{fillcycle?} ones, but you can see that it is not true for some other % values. % % \begin{LTXexample} % \psset{unit=0.5} % \psboxfill{\Square} % \Tiling[fillmovex=0.5]{(3,3)} % \Tiling[fillmovey=0.5]{(3,3)}\\ % \Tiling[fillmove=0.5]{(3,3)} % \Tiling[fillmove=-0.5]{(3,3)} % \end{LTXexample} % % \begin{Description}{2cm} % \item [\texttt{fillsize} % (auto$\|$\{(real$\|$dim,real$\|$dim)(real$\|$dim,real$\|$dim)\}) :] The % choice of \emph{automatic} mode or the size of the area in \emph{manual} % mode. If first pair values are not given, (0,0) is used. (\emph{Default: % auto when \emph{tiling} mode is used, {(-15cm,-15cm)(15cm,15cm)} % otherwise}). % \end{Description} % % As explained in the introduction, the \emph{manual} mode can require very % huge amount of computer ressources. So, it usage is to discourage in front off % the \emph{automatic} mode. It seems only useful in special circonstances, in % fact when the \emph{automatic} mode failed, which is known only in one case, % for some kinds of EPS files, as the ones produce by dump of portions of % screens (see \ref{sec:GraphicFiles}). % % \begin{Description}{2cm} % \setcounter{footnote}{1} % \item [\texttt{fillloopaddx}\footnotemark\ (integer)\hfill :] number of % times the pattern is added on left and right positions (\emph{Default:~0}). % \setcounter{footnote}{1} % \item [\texttt{fillloopaddy}\footnotemark\ (integer)\hfill :] number of % times the pattern is added on top and bottom positions (\emph{Default:~0}). % \setcounter{footnote}{1} % \item [\texttt{fillloopadd}\footnotemark\ (integer)\hfill :] number of % times the pattern is added on left, right, top and bottom positions % (\emph{Default:~0}). % \end{Description} % % These parameters are only useful in special circonstances, as for complex % patterns when the size of the rectangular box used to tile the area doesn't % correspond to the pattern itself (see an example in Figure~\ref{fig:Sheeps}) % and also sometimes when the size of the pattern is not a divisor of the size % of the area to fill and that the number of loop repeats is not properly % computed, which can occur. % % They are implemented only for the \emph{tiling} mode. % % \begin{Description}{2cm} % \setcounter{footnote}{1} % \item [\texttt{PstDebug}\footnotemark\ (integer, 0 or 1)\hfill :] to % require to see the exact tiling done, without clipping (\emph{Default:~0}). % \end{Description} % % It's mainly useful for debugging or to understand better how the tilings % are done. It is implemented only for the \emph{tiling} mode. % % \begin{LTXexample} % \psset{unit=0.3,PstDebug=1} % \psboxfill{\Square} % \psset{linewidth=1mm} % \Tiling{(2,2)}\\[5mm] % \Tiling[fillcyclex=2]{(2,2)}\\[1cm] % \Tiling[fillmove=0.5]{(2,2)} % \end{LTXexample} % % \vspace{3cm} % \section{Examples} % % In fact this unique \cs{psboxfill} macro allow a lot a variations and % different usages. We will try here to demonstrate this. % % \subsection{Kind of tiles} % \label{sec:KindTiles} % % Of course, we can access to all the power of PSTricks macros to define the % \emph{tiles} (\emph{patterns}) used. So, we can define complicated ones. % % Here we give four other Archimedian tilings (those built with only some % regular polygons) among the twelve existing, first discovered completely by % Johanes \textsc{Kepler} at the beginning of 17th century \cite{GS87}, the two % other \emph{regular} ones with the tiling by squares, formed by a unique % regular polygon, and two other formed by two different regular polygons. % % \begin{LTXexample}[pos=t] % \newcommand{\Triangle}{% % \begin{pspicture}(1,1) % \pstriangle[dimen=middle](0.5,0)(1,1) % \end{pspicture}} % \newcommand{\Hexagon}{ % ^^A sin(60)=0.866 % \begin{pspicture}(0.866,0.75) % \SpecialCoor % ^^A Hexagon % \pspolygon[dimen=middle]% % (0.5;30)(0.5;90)(0.5;150)(0.5;210)(0.5;270)(0.5;330) % \end{pspicture}} % % \psset{unit=0.5} % \psboxfill{\Triangle} % \Tiling{(4,4)}\hfill % ^^A The two other regular tilings % \Tiling[fillcyclex=2]{(4,4)}\hfill % \psboxfill{\Hexagon} % \Tiling[fillcyclex=2,fillloopaddy=1]{(5,5)} % \end{LTXexample} % % \begin{LTXexample}[pos=t] % \newcommand{\ArchimedianA}{% % ^^A Archimedian tiling 3^2.4.3.4 % \psset{dimen=middle} % ^^A sin(60)=0.866 % \begin{pspicture}(1.866,1.866) % \psframe(1,1) % \psline(1,0)(1.866,0.5)(1,1)(0.5,1.866)(0,1)(-0.866,0.5) % \psline(0,0)(0.5,-0.866) % \end{pspicture}} % \newcommand{\ArchimedianB}{% % ^^A Archimedian tiling 4.8^2 % \psset{dimen=middle,unit=1.5} % ^^A sin(22.5)=0.3827 ; cos(22.5)=0.9239 % \begin{pspicture}(1.3066,0.6533) % \SpecialCoor % ^^A Octogon % \pspolygon(0.5;22.5)(0.5;67.5)(0.5;112.5)(0.5;157.5) % (0.5;202.5)(0.5;247.5)(0.5;292.5)(0.5;337.5) % \end{pspicture}} % % \psset{unit=0.5} % \psboxfill{\ArchimedianA} % \Tiling[fillmove=0.5]{(7,7)}\hfill % \psboxfill{\ArchimedianB} % \Tiling[fillcyclex=2,fillloopaddy=1]{(7,7)} % \end{LTXexample} % % \setcounter{footnote}{3} % We can of course tile an area arbitrarily defined. And with the % \texttt{addfillstyle} parameter\footnote{Introduced in PSTricks 97.}, we can % easily mix the \texttt{boxfill} style with another one. % % \begin{LTXexample}[width=6cm] % \psset{unit=0.5,dimen=middle} % \psboxfill{% % \begin{pspicture}(1,1) % \psframe(1,1) % \pscircle(0.5,0.5){0.25} % \end{pspicture}} % \begin{pspicture}(4,6) % \pspolygon[fillstyle=boxfill,fillsep=0.25](0,1)(1,4)(4,6)(4,0)(2,1) % \end{pspicture}\hspace{1em} % \begin{pspicture}(4,4) %% \pscircle[linestyle=none,fillstyle=solid,fillcolor=yellow,fillsep=0.5, %% addfillstyle=boxfill](2,2){2} % \end{pspicture} % \end{LTXexample} % % Various effects can be obtained, sometimes complicated ones very easily, as % in this example reproduced from one shown by Slavik \textsc{Jablan} in the % field of \emph{OpTiles}, inspired by the \emph{Op-art}: % % \begin{LTXexample}[pos=t] % \newcommand{\ProtoTile}{% % \begin{pspicture}(1,1)%%% 1/12=0.08333 % \psset{linestyle=none,linewidth=0, % hatchwidth=0.08333\psunit,hatchsep=0.08333\psunit} % \psframe[fillstyle=solid,fillcolor=black,addfillstyle=hlines,hatchcolor=white](1,1) % \pswedge[fillstyle=solid,fillcolor=white,addfillstyle=hlines]{1}{0}{90} % \end{pspicture}} % \newcommand{\BasicTile}{% % \begin{pspicture}(2,1) % \rput[lb](0,0){\ProtoTile}\rput[lb](1,0){\psrotateleft{\ProtoTile}} % \end{pspicture}} % \ProtoTile\hfill\BasicTile\hfill % \psboxfill{\BasicTile} % \Tiling[fillcyclex=2]{(4,4)} % \end{LTXexample} % % It is also directly possible to surimpose several different tilings. Here is % the splendid visual proof of the \textsc{Pytha\-gore} theorem done by the arab % mathematician \textsc{Annairizi} around the year 900, given by superposition % of two tilings by squares of different sizes. % % \begin{LTXexample}[pos=t] % \psset{unit=1.5,dimen=middle} % \begin{pspicture*}(3,3) % \psboxfill{\begin{pspicture}(1,1) % \psframe(1,1)\end{pspicture}} % \psframe[fillstyle=boxfill](3,3) % \psboxfill{\begin{pspicture}(1,1) % \rput{-37}{\psframe[linecolor=red](0.8,0.8)} % \end{pspicture}} % \psframe[fillstyle=boxfill](3,4) % \pspolygon[fillstyle=hlines,hatchangle=90](1,2)(1.64,1.53)(2,2) % \end{pspicture*} % \end{LTXexample} % % In a same way, it is possible to build tilings based on figurative patterns, % in the style of the famous \textsc{Escher} ones. Following an example of % Andr\'e \textsc{Deledicq} \cite{Deledicq97}, we first show a simple tiling of % the \emph{p1} category (according to the international classification of the % 17~symmetry groups of the plane first discovered by the russian % crystalographer Jevgraf \textsc{Fedorov} at the end of the 19th century): % % \begin{LTXexample}[pos=t] % \newcommand{\SheepHead}[1]{% % \begin{pspicture}(3,1.5) % \pscustom[liftpen=2,fillstyle=solid,fillcolor=#1]{% % \pscurve(0.5,-0.2)(0.6,0.5)(0.2,1.3)(0,1.5)(0,1.5) % (0.4,1.3)(0.8,1.5)(2.2,1.9)(3,1.5)(3,1.5)(3.2,1.3) % (3.6,0.5)(3.4,-0.3)(3,0)(2.2,0.4)(0.5,-0.2)} % \pscircle*(2.65,1.25){0.12\psunit} % Eye % \psccurve*(3.5,0.3)(3.35,0.45)(3.5,0.6)(3.6,0.4)% Muzzle % ^^A % Mouth % \pscurve(3,0.35)(3.3,0.1)(3.6,0.05) % ^^A % Ear % \pscurve(2.3,1.3)(2.1,1.5)(2.15,1.7)\pscurve(2.1,1.7)(2.35,1.6)(2.45,1.4) % \end{pspicture}} % \psboxfill{\psset{unit=0.5}\SheepHead{yellow}\SheepHead{cyan}} % \Tiling[fillcyclex=2,fillloopadd=1]{(10,5)} % \end{LTXexample} % \label{fig:Sheeps} % % Now a tiling of the \emph{pg} category (the code for the kangaroo itself is % too long to be shown here, but has no difficulties ; the kangaroo is reproduce % from an original picture from Raoul \textsc{Raba} and here is a translation in % PSTricks from the one drawn by Emmanuel \textsc{Chailloux} and Guy % \textsc{Cousineau} for their MLgraph system \cite{MLgraphTSI}): % % \begin{LTXexample}[pos=t] % \psboxfill{\psset{unit=0.4} % \Kangaroo{yellow}\Kangaroo{red}\Kangaroo{cyan}\Kangaroo{green}% % \psscalebox{-1 1}{% % \rput(1.235,4.8){\Kangaroo{green}\Kangaroo{cyan}\Kangaroo{red}\Kangaroo{yellow}}}} % \Tiling[fillloopadd=1]{(10,6)} % \end{LTXexample} % % And here a \textsc{Wang} tiling \cite{Wang65}, \cite[chapter % 11]{GS87}, based on very simple tiles of the form of a square and composed % of four colored triangles. Such tilings are built with only a matching color % constraint. Despite of it simplicity, it is an important kind of tilings, as % \textsc{Wang} and others used them to study the special class of % \emph{aperiodic} tilings, and also because it was shown that surprisingly this % tiling is similar to a \textsc{Turing} machine. % % \begin{LTXexample}[pos=t] % \newcommand{\WangTile}[4]{% % \begin{pspicture}(1,1) % \pspolygon*[linecolor=#1](0,0)(0,1)(0.5,0.5) % \pspolygon*[linecolor=#2](0,1)(1,1)(0.5,0.5) % \pspolygon*[linecolor=#3](1,1)(1,0)(0.5,0.5) % \pspolygon*[linecolor=#4](1,0)(0,0)(0.5,0.5) % \end{pspicture}} % \newcommand{\WangTileA}{\WangTile{cyan}{yellow}{cyan}{cyan}} % \newcommand{\WangTileB}{\WangTile{yellow}{cyan}{cyan}{red}} % \newcommand{\WangTileC}{\WangTile{cyan}{red}{yellow}{yellow}} % \newcommand{\WangTiles}[1][]{% % \begin{pspicture}(3,3) \psset{ref=lb} % \rput(0,2){\WangTileB} \rput(1,2){\WangTileA}% % \rput(2,2){\WangTileC} \rput(0,1){\WangTileC}% % \rput(1,1){\WangTileB} \rput(2,1){\WangTileA} % \rput(0,0){\WangTileA} \rput(1,0){\WangTileC}% % \rput(2,0){\WangTileB} % #1 % \end{pspicture}} % \WangTileA\hfill\WangTileB\hfill\WangTileC\hfill % \WangTiles[{\psgrid[subgriddiv=0,gridlabels=0](3,3)}]\hfill % \psset{unit=0.4} \psboxfill{\WangTiles} \Tiling{(12,12)} % \end{LTXexample} % % \subsection{External graphic files} % \label{sec:GraphicFiles} % % We can also fill an arbitrary area with an external image. We have only, % as usual, to matter of the \emph{BoundingBox} definition if there is no one % provided or if it is not the accurate one, as for the well known % \texttt{tiger} picture part of the \texttt{ghostscript} distribution. % % \begin{LTXexample}[pos=t] % \psboxfill{%% Strangely require x1=x2... % \begin{pspicture}(0,1)(0,4.1) % \includegraphics[bb=17 176 560 74,width=3cm]{tiger} % \end{pspicture}} % \Tiling{(6,6.2)} % \end{LTXexample} % % Nevertheless, there are some special files for which the \emph{automatic} % mode doesn't work, specially for some files obtained by a screen dump, as in % the next example, where a picture was reduced before it conversion in the % \emph{Encapsulated PostScript} format by a screen dump utility. In this case, % usage of the \emph{manual} mode is the only alternative, at the price of the % real multiple inclusion of the EPS file. We must take care to specify the % correct \texttt{fillsize} parameter, because otherwise the default values are % large and will load the file many times, perhaps just really using few % occurrences as the other ones would be clipped... % % \begin{LTXexample}[pos=t] % \psboxfill{\includegraphics{flowers}} % \begin{pspicture}(8,4) % \psellipse[fillstyle=boxfill,fillsize={(8,4)}](4,2)(4,2) % \end{pspicture} % \end{LTXexample} % % \subsection{Tiling of characters} % % We can also use the \cs{psboxfill} macro to fill the interior of characters % for special effects like these ones: % % \begin{LTXexample}[pos=t] % \DeclareFixedFont{\bigsf}{T1}{phv}{b}{n}{4.5cm} % \DeclareFixedFont{\smallrm}{T1}{ptm}{m}{n}{3mm} % \psboxfill{\smallrm Since 182 days...} % \begin{pspicture*}(8,4) % \centerline{% % \pscharpath[fillstyle=gradient,gradangle=-45, % gradmidpoint=0.5,addfillstyle=boxfill, % fillangle=45,fillsep=0.7mm] % {\rput[b](0,0.1){\bigsf 2000}}} % \end{pspicture*} % \end{LTXexample} % % \begin{LTXexample}[pos=t] % \DeclareFixedFont{\mediumrm}{T1}{ptm}{m}{n}{2cm} % \psboxfill{% % \psset{unit=0.1,linewidth=0.2pt} % \Kangaroo{PeachPuff}\Kangaroo{PaleGreen}% % \Kangaroo{LightBlue}\Kangaroo{LemonChiffon}% % \psscalebox{-1 1}{% % \rput(1.235,4.8){% % \Kangaroo{LemonChiffon}\Kangaroo{LightBlue}% % \Kangaroo{PaleGreen}\Kangaroo{PeachPuff}}}} % ^^A % A kangaroo of kangaroos... % \begin{pspicture}(8,2) % \pscharpath[linestyle=none,fillstyle=boxfill,fillloopadd=1] % {\rput[b](4,0){\mediumrm Kangaroo}} % \end{pspicture} % \end{LTXexample} % % \subsection{Other kinds of usage} % % Other kinds of usage can be imagined. For instance, we can use tilings in a % sort of degenerated way to draw some special lines made by a unique or % multiple repeating patterns. But it can be only a special dashed line, as here % with three different dashes: % % \begin{LTXexample}[pos=t] % \newcommand{\Dashes}{% % \psset{dimen=middle} % \begin{pspicture}(0,-0.5\pslinewidth)(1,0.5\pslinewidth) % \rput(0,0){\psline(0.4,0)}% % \rput(0.5,0){\psline(0.2,0)}% % \rput(0.8,0){\psline(0.1,0)} % \end{pspicture}} % % \newcommand{\SpecialDashedLine}[3]{% % \psboxfill{#3} % \Tiling[linestyle=none] % {(#1,-0.5\pslinewidth)(#2,0.5\pslinewidth)}} % % \SpecialDashedLine{0}{7}{\Dashes} % % \psset{unit=0.5,linewidth=1mm,linecolor=red} % \SpecialDashedLine{0}{10}{\Dashes} % \end{LTXexample} % % It allow also to use special patterns in business graphics, as in the % following example generated by \texttt{PstChart}\footnote{A personal % development to draw business charts with PSTricks, not distributed.}. % % \vspace{3mm} % \begin{figure}[!ht] % \centering % \psset{unit=0.75} % ^^A % Generated by pstchart.sh version 0.21 (11/28/97) % {\psset{dimen=middle} % \psset{xunit=2,yunit=0.005} % \begin{pspicture}(-0.6,-200)(6.6,2300) % ^^A % Title % \rput(3,2200){\shortstack{Fantaisist repartition of kangaroos\\ % in the world (in thousands)}} % ^^A % Frame background % \psframe[fillstyle=solid,fillcolor=LemonChiffon](0,0)(6,2000) % ^^A % Graduations % \multido{\n=0+500}{5}{\rput[r](-0.12,\n){\psscalebox{0.8}{\n}}} % ^^A % Minor ticks % \multips(0,100)(0,100){19}{\psline[unit=4.8pt](1,0)} % \multips(6,100)(0,100){19}{\psline[unit=4.8pt](-1,0)} % ^^A % Major ticks % \multips(0,500)(0,500){3}{\psline[unit=9.6pt](1,0)} % \multips(6,500)(0,500){3}{\psline[unit=9.6pt](-1,0)} % ^^A % Lines from major ticks marks % \multips(0,500)(0,500){3}{\psline[linestyle=dotted,linewidth=0.6pt](6,0)} % ^^A % Drawing for the data % \psboxfill{\psset{unit=0.78\psxunit}\KangarooPstChart{red}} % \psframe[linestyle=none,fillstyle=boxfill,fillloopaddy=1](0.61,0)(1.39,1800) % \psboxfill{\psset{unit=0.78\psxunit}\KangarooPstChart{yellow}} % \psframe[linestyle=none,fillstyle=boxfill,fillloopaddy=1](1.61,0)(2.39,800) % \psboxfill{\psset{unit=0.78\psxunit}\KangarooPstChart{cyan}} % \psframe[linestyle=none,fillstyle=boxfill,fillloopaddy=1](2.61,0)(3.39,550) % \psboxfill{\psset{unit=0.78\psxunit}\KangarooPstChart{magenta}} % \psframe[linestyle=none,fillstyle=boxfill,fillloopaddy=1](3.61,0)(4.39,500) % \psboxfill{\psset{unit=0.78\psxunit}\KangarooPstChart{green}} % \psframe[linestyle=none,fillstyle=boxfill,fillloopaddy=1](4.61,0)(5.39,200) % ^^A % Bottom labels % \uput{0.2}[270]{0}(1,0){\psscalebox{0.7}{Oceania}} % \uput{0.2}[270]{0}(2,0){\psscalebox{0.7}{Africa}} % \uput{0.2}[270]{0}(3,0){\psscalebox{0.7}{Asia}} % \uput{0.2}[270]{0}(4,0){\psscalebox{0.7}{America}} % \uput{0.2}[270]{0}(5,0){\psscalebox{0.7}{Europe}} % ^^A % Frame box around the chart % \psframe[linestyle=solid](0,0)(6,2000) % \end{pspicture}} % \caption{Bar chart generated by PstChart, with bars filled by patterns} % \label{fig:PstChart} % \end{figure} % % \section{``Dynamic'' tilings} % % In some cases, tilings used non \emph{static} tiles, that is to say that the % \emph{prototile(s)}, even if unique, can have several forms, by instance % specified by different colors or rotations, not fixed before generation or % varying each time. % % \subsection{Lewthwaite-Pickover-Truchet tiling} % % We give here for example the so-called \emph{Truchet} tiling, which much be % in fact better called \emph{Lewthwaite-Pick\-over-Truchet (LPT)} tiling% % \footnote{For description of the context, history and references about % S\'ebastien \textsc{Truchet} and this tiling, see \cite{EsperetGirou98}.}. % % The unique prototile is only a square with two opposite circle arcs. % This tile has obviously two positions, if we rotate it from 90 degrees (see % the two tiles on the next figure). A \emph{LPT tiling} is a tiling with % randomly oriented LPT tiles. We can see that even if it is very simple in it % principle, it draw sophisticated curves with strange properties. % % Nevertheless, in the straightforward way \FillPackage{} does not work, % because the \cs{psboxfill} macro store the content of the tile used in a % \TeX{} box, which is static. So the calling to the random function is done % only one time, which explain that only one rotation of the tile is used for % all the tiling. It's only the one of the two rotations which could differ from % one drawing to the next one... % % ^^A % Truchet (Lewthwaite-Pickover-Truchet) tiling % ^^A % -------------------------------------------- % % \begin{LTXexample}[pos=t] % ^^A % LPT prototile % \newcommand{\ProtoTileLPT}{% % \psset{dimen=middle} % \begin{pspicture}(1,1) % \psframe(1,1) % \psarc(0,0){0.5}{0}{90} % \psarc(1,1){0.5}{-180}{-90} % \end{pspicture}} % % ^^A % LPT tile % \newcount\Boolean % \newcommand{\BasicTileLPT}{% % ^^A % From random.tex by Donald Arseneau % \setrannum{\Boolean}{0}{1}% % \ifnum\Boolean=0 % \ProtoTileLPT% % \else % \psrotateleft{\ProtoTileLPT}% % \fi} % % \ProtoTileLPT\hfill\psrotateleft{\ProtoTileLPT}\hfill % \psset{unit=0.5} % \psboxfill{\BasicTileLPT} % \Tiling{(5,5)} % \end{LTXexample} % % But, for simple cases, there is a solution to this problem using a mixture % of PSTricks and PostScript programming. Here the PSTricks % construction \verb+\pscustom{\code{...}}+ allow to insert PostScript code % inside the \LaTeX{} + PSTricks one. % % Programmation is less straightforward, but it has also the advantage to be % notably faster, as all the tilings operations are done in PostScript, and % mainly to not be limited by \TeX{} memory (the \TeX{} + PSTricks solution % I wrote in 1995 for the colored problem was limited to small sizes for this % reason). Just note also that \cs{pslbrace} and \cs{psrbrace} are two % PSTricks macros to define and be able to insert the \verb+{+ and \verb+}+ % characters. % % \begin{LTXexample}[pos=t] % ^^A % LPT prototile % \newcommand{\ProtoTileLPT}{% % \psset{dimen=middle} % \psframe(1,1) % \psarc(0,0){0.5}{0}{90} % \psarc(1,1){0.5}{-180}{-90}} % % ^^A % Counter to change the random seed % \newcount\InitCounter % ^^A % LPT tile % \newcommand{\BasicTileLPT}{% % \InitCounter=\the\time % \pscustom{\code{% % rand \the\InitCounter\space sub 2 mod 0 eq \pslbrace}} % \begin{pspicture}(1,1) % \ProtoTileLPT % \end{pspicture}% % \pscustom{\code{\psrbrace \pslbrace}} % \psrotateleft{\ProtoTileLPT}% % \pscustom{\code{\psrbrace ifelse}}} % % \psset{unit=0.4,linewidth=0.4pt} % \psboxfill{\BasicTileLPT} % \Tiling{(15,15)} % \end{LTXexample} % % Using the very surprising fact (see \cite{EsperetGirou98}) that % coloration of these tiles do not depend of their neighbors (even if it is % difficult to believe as the opposite seems obvious!) but only of the parity of % the value of row and column positions, we can directly program in the same way % a colored version of the LPT tiling. % % \setcounter{footnote}{1} % We have also introduce in the \FillPackage{} code for \emph{tiling} mode two % new accessible Post\-Script variables, \texttt{row} and % \texttt{column}\footnotemark, which can be useful in some circonstances, like % this one. % % \begin{LTXexample}[pos=t] % ^^A % LPT prototile % \newcommand{\ProtoTileLPT}[2]{% % \psset{dimen=middle,linestyle=none,fillstyle=solid} % \psframe[fillcolor=#1](1,1) % \psset{fillcolor=#2} % \pswedge(0,0){0.5}{0}{90} \pswedge(1,1){0.5}{-180}{-90}} % ^^A % Counter to change the random seed % \newcount\InitCounter % ^^A % LPT tile % \newcommand{\BasicTileLPT}[2]{% % \InitCounter=\the\time % \pscustom{\code{% % rand \the\InitCounter\space sub 2 mod 0 eq \pslbrace % row column add 2 mod 0 eq \pslbrace}} % \begin{pspicture}(1,1)\ProtoTileLPT{#1}{#2}\end{pspicture}% % \pscustom{\code{\psrbrace \pslbrace}} % \ProtoTileLPT{#2}{#1}% % \pscustom{\code{% % \psrbrace ifelse \psrbrace \pslbrace row column add 2 mod 0 eq \pslbrace}} % \psrotateleft{\ProtoTileLPT{#2}{#1}}\pscustom{\code{\psrbrace \pslbrace}} % \psrotateleft{\ProtoTileLPT{#1}{#2}}\pscustom{\code{\psrbrace ifelse \psrbrace ifelse}}} % \psboxfill{\BasicTileLPT{red}{yellow}} % \Tiling{(4,4)}\hfill % \psset{unit=0.4}\psboxfill{\BasicTileLPT{blue}{cyan}} % \Tiling{(15,15)} % \end{LTXexample} % % Another classic example is to generate coordinates and numerotation for a % grid. Of course, it is possible to do it directly in PSTricks using nested % \cs{multido} commands. It would be clearly easy to program, but, nevertheless, % for users who have a little knowledge of PostScript programming, this offer % an alternative which is useful for large cases, because on this way it will % be notably faster and less computer ressources consuming. % % Remember here that the tiling is drawn from left to right, and top to % bottom, and note that the PostScript variable \texttt{x2} give the total % number of columns. % % \begin{LTXexample}[pos=t] % ^^A % \Escape will be the \ character % {\catcode`\!=0\catcode`\\=11!gdef!Escape{\}} % \newcommand{\ProtoTile}{% % \Square\pscustom{% % \moveto(-0.9,0.75) % In PSTricks units % \code{ /Times-Italic findfont 8 scalefont setfont % (\Escape() show row 3 string cvs show (,) show % column 3 string cvs show (\Escape)) show} % \moveto(-0.5,0.25) % In PSTricks units % \code{ /Times-Bold findfont 18 scalefont setfont % 1 0 0 setrgbcolor % Red color % /center {dup stringwidth pop 2 div neg 0 rmoveto} def % row 1 sub x2 mul column add 3 string cvs center show}}} % \psboxfill{\ProtoTile} % \Tiling{(6,4)} % \end{LTXexample} % % \subsection{A complete example: the Poisson equation} % % To finish, we will show a complete real example, a drawing to explain the % method used to solve the \textsc{Poisson} equation by a domain % decomposition method, adapted to distributed memory computers. The % objective is to show the communications required between processes and the % position of the data to exchange. This code also show some useful and powerful % technics for PSTricks programming (look specially at the way some higher level % macros are defined, and how the same object is used to draw the four % neighbors). % %\psset{unit=1cm} %\newcommand{\Pattern}[1]{% % \begin{pspicture}(-0.25,-0.25)(0.25,0.25)\rput{*0}{\psdot[dotstyle=#1]} % \end{pspicture}} %\newcommand{\West}{\Pattern{o}} \newcommand{\South}{\Pattern{x}} %\newcommand{\Central}{\Pattern{+}}\newcommand{\North}{\Pattern{square}} %\newcommand{\East}{\Pattern{triangle}} %\newcommand{\Cross}{% % \pspolygon[unit=0.5,linewidth=0.2,linecolor=red](0,0)(0,1)(1,1)(1,2)(2,2)(2,1)% % (3,1)(3,0)(2,0)(2,-1)(1,-1)(1,0)} %\newcommand{\StylePosition}[1]{\LARGE\textcolor{red}{\textbf{#1}}} %\newcommand{\SubDomain}[4]{% % \psboxfill{#4}\begin{psclip}{\psframe[linestyle=none]#1}% % \psframe[linestyle=#3](5,5)\psframe[fillstyle=boxfill]#2% % \end{psclip}} %\newcommand{\SendArea}[1]{\psframe[fillstyle=solid,fillcolor=cyan]#1} %\newcommand{\ReceiveData}[2]{% % \psboxfill{#2}\psframe[fillstyle=solid,fillcolor=yellow,addfillstyle=boxfill]#1}% %\newcommand{\Neighbor}[2]{% % \begin{pspicture}(5,5) % \rput{*0}(2.5,2.5){\StylePosition{#1}} % \ReceiveData{(0.5,0)(4.5,0.5)}{\Central}\SendArea{(0.5,0.5)(4.5,1)}% % \SubDomain{(5,2)}{(0.5,0.5)(4.5,3)}{dashed}{#2}% % \pcarc[arcangle=45,arrows=->](0.5,-1.25)(0.5,0.25)% % \pcarc[arcangle=45,arrows=->,linestyle=dotted,dotsep=2pt](4.5,0.75)(4.5,-0.75)% % \end{pspicture}}% % \psset{dimen=middle,dotscale=2,fillloopadd=2} %\begin{pspicture}(-5.7,-5.7)(5.7,5.7) % \rput(0,0){% % \begin{pspicture}(5,5) % \ReceiveData{(0,0.5)(0.5,4.5)}{\West} \ReceiveData{(4.5,0.5)(5,4.5)}{\East} % \ReceiveData{(0.5,4.5)(4.5,5)}{\North}\ReceiveData{(0.5,0)(4.5,0.5)}{\South} % \SendArea{(0.5,0.5)(1,4.5)}\SendArea{(4,0.5)(4.5,4.5)} % \SendArea{(0.5,0.5)(4.5,1)}\SendArea{(0.5,4)(4.5,4.5)} % \SubDomain{(5,5)}{(0.5,0.5)(4.5,4.5)}{solid}{\Central} % \psline(1,0.5)(1,4.5)\psline(4,0.5)(4,4.5)% % \rput(1.5,4){\Cross}\rput(2,2){\Cross}% % \end{pspicture}}% % \rput(0,5.5){\Neighbor{N}{\North}}\rput{-90}(5.5,0){\Neighbor{E}{\East}}% % \rput{90}(-5.5,0){\Neighbor{W}{\West}}\rput{180}(0,-5.5){\Neighbor{S}{\South}}% %\end{pspicture} % % \begin{lstlisting} % \newcommand{\Pattern}[1]{% % \begin{pspicture}(-0.25,-0.25)(0.25,0.25)\rput{*0}{\psdot[dotstyle=#1]} % \end{pspicture}} % \newcommand{\West}{\Pattern{o}} \newcommand{\South}{\Pattern{x}} % \newcommand{\Central}{\Pattern{+}}\newcommand{\North}{\Pattern{square}} % \newcommand{\East}{\Pattern{triangle}} % \newcommand{\Cross}{% % \pspolygon[unit=0.5,linewidth=0.2,linecolor=red](0,0)(0,1)(1,1)(1,2)(2,2)(2,1) % (3,1)(3,0)(2,0)(2,-1)(1,-1)(1,0)} % \newcommand{\StylePosition}[1]{\LARGE\textcolor{red}{\textbf{#1}}} % \newcommand{\SubDomain}[4]{% % \psboxfill{#4} % \begin{psclip}{\psframe[linestyle=none]#1} % \psframe[linestyle=#3](5,5)\psframe[fillstyle=boxfill]#2 % \end{psclip}} % \newcommand{\SendArea}[1]{\psframe[fillstyle=solid,fillcolor=cyan]#1} % \newcommand{\ReceiveData}[2]{% % \psboxfill{#2} % \psframe[fillstyle=solid,fillcolor=yellow,addfillstyle=boxfill]#1} % \newcommand{\Neighbor}[2]{% % \begin{pspicture}(5,5) % \rput{*0}(2.5,2.5){\StylePosition{#1}} % \ReceiveData{(0.5,0)(4.5,0.5)}{\Central}\SendArea{(0.5,0.5)(4.5,1)} % \SubDomain{(5,2)}{(0.5,0.5)(4.5,3)}{dashed}{#2}% % ^^A % Receive and send arrows % \pcarc[arcangle=45,arrows=->](0.5,-1.25)(0.5,0.25) % \pcarc[arcangle=45,arrows=->,linestyle=dotted,dotsep=2pt](4.5,0.75)(4.5,-0.75) % \end{pspicture}} % \psset{dimen=middle,dotscale=2,fillloopadd=2} % \begin{pspicture}(-5.7,-5.7)(5.7,5.7) % ^^A % Central domain % \rput(0,0){% % \begin{pspicture}(5,5) % ^^A % Receive from West, East, North and South % \ReceiveData{(0,0.5)(0.5,4.5)}{\West} \ReceiveData{(4.5,0.5)(5,4.5)}{\East} % \ReceiveData{(0.5,4.5)(4.5,5)}{\North}\ReceiveData{(0.5,0)(4.5,0.5)}{\South} % ^^A % send area for West, East, North and South % \SendArea{(0.5,0.5)(1,4.5)} \SendArea{(4,0.5)(4.5,4.5)} % \SendArea{(0.5,0.5)(4.5,1)} \SendArea{(0.5,4)(4.5,4.5)} % ^^A % Central domain % \SubDomain{(5,5)}{(0.5,0.5)(4.5,4.5)}{solid}{\Central} % ^^A % Redraw overlapped linesY % \psline(1,0.5)(1,4.5) \psline(4,0.5)(4,4.5) % ^^A % Two crossesY % \rput(1.5,4){\Cross} \rput(2,2){\Cross} % \end{pspicture}} % ^^A % The four neighborsY % \rput(0,5.5){\Neighbor{N}{\North}} \rput{-90}(5.5,0){\Neighbor{E}{\East}} % \rput{90}(-5.5,0){\Neighbor{W}{\West}} \rput{180}(0,-5.5){\Neighbor{S}{\South}} % \end{pspicture} % \end{lstlisting} % % % % Bibliography % \begin{thebibliography}{99} % \bibitem{PostScript95} Adobe, Systems~Incorporated, \emph{PostScript Language % Reference Manual}, Addison-Wesley, 2~edition, 1995. % % \bibitem{Bolek98} Piotr Bolek, \MP{} and patterns, \emph{\TUB}, Volume~19, % Number~3, pages 276--283, September 1998, \CTANref{mpattern}. % % \bibitem{MLgraphTSI} Emmanuel Chailloux, Guy Cousineau and Asc\'ander % Su\'arez, Programmation fonctionnelle de graphismes pour la production % d'illustrations techniques, \emph{Technique et science informatique}, % Volume~15, Number~7, pages 977--1007, 1996 (in french). % % \bibitem{Deledicq97} Andr\'e Deledicq, \emph{Le monde des pavages}, ACL % \'Editions, 1997 (in french). % % \bibitem{EsperetGirou98} Philippe Esperet and Denis Girou, % Coloriage du pavage dit de Truchet, Cahiers GUTenberg, Number~31, % pages 5--18, December~1998 (in french). % % \bibitem{Girou94} Denis Girou, Pr\'esentation de PSTricks, \emph{Cahiers % GUTenberg}, Number~16, pages 21--70, February~1994 (in french). % % \bibitem{LGC97} Michel Goossens, Sebastian Rahtz and Frank Mittelbach, % \emph{The \LaTeX{} Graphics Companion}, Addison-Wesley, 2005. % % \bibitem{GS87} Branko Gr\"unbaum and Geoffrey Shephard, \emph{Tilings and % Patterns}, Freeman and Company, 1987. % % \bibitem{Hoenig97} Alan Hoenig, \emph{\TeX{} Unbound: \LaTeX{} \& \TeX{} % Strategies, Fonts, Graphics, and More}, Oxford University Press, 1997. % % \bibitem{XYpic} Kristoffer~H. Rose and Ross Moore, \XYpic. Pattern and Tile % extension, available from \CTAN, 1991-1998, \CTANref{xypic}. % % \bibitem{LAAN96} Kees van der Laan, Paradigms: Just a little bit of PostScript, % \emph{MAPS}, Volume~17, pages 137--150, 1996. % % \bibitem{LAAN97} Kees van der Laan, Tiling in PostScript and \MF{} -- Escher's % wink, \emph{MAPS}, Volume~19, Number~2, pages 39--67, 1997. % % \bibitem{vanZandt93} Timothy Van Zandt, PSTricks. PostScript macros for % Generic \TeX, available from \CTAN, 1993, \CTANref{pstricks}. % % \bibitem{vanZandtGirou94} Timothy Van Zandt and Denis Girou, Inside PSTricks, % \emph{\TUB}, Volume~15, Number~3, pages 239--246, September 1994. % % % \bibitem{voss07} Herbert Vo\ss, PSTricks -- Graphics for \TeX\ and \LaTeX, DANTE/Lehmanns, 4th ed., 2007. % \bibitem{Wang65} Hao Wang, Games, Logic and Computers, \emph{Scientific % American}, pages 98--106, November 1965. % \end{thebibliography} % % % \StopEventually{} % % ^^A .................... End of the documentation part .................... % % \section{Driver file} % % The next bit of code contains the documentation driver file for \TeX{}, % i.e., the file that will produce the documentation you are currently % reading. It will be extracted from this file by the \texttt{docstrip} % program. % % \begin{macrocode} %<*driver> \documentclass{ltxdoc} \GetFileInfo{pst-fill.dtx} % \usepackage[T1]{fontenc} \usepackage{lmodern} % For PDF \usepackage{graphicx} % `graphicx' LaTeX standard package \usepackage{showexpl} \usepackage{mflogo} % For the MetaFont and MetaPost logos \input{random.tex} % Random macros from Donald Arseneau \usepackage{url} % URLs convenient typesetting \usepackage{multido} % General loop macro \usepackage[dvipsnames]{pstricks} % PSTricks with the `color' extension \usepackage{pst-text} % PSTricks package for character path \usepackage{pst-grad} % PSTricks package for gradient filling \usepackage{pst-node} % PSTricks package for nodes \usepackage[tiling]{pst-fill} % PSTricks package for filling/tiling % \AtBeginDocument{% % \OnlyDescription % comment out for implementation details \EnableCrossrefs \CodelineIndex \RecordChanges} \AtEndDocument{% \PrintIndex \setcounter{IndexColumns}{1} \PrintChanges} \hbadness=7000 % Over and under full box warnings \hfuzz=3pt \begin{document} \DocInput{pst-fill.dtx} \end{document} % % \end{macrocode} % % \section{\texttt{pst-fill} \LaTeX{} wrapper} % % \begin{macrocode} %<*latex-wrapper> \RequirePackage{pstricks} \ProvidesPackage{pst-fill}[2005/09/13 package wrapper for pst-fill.tex (hv)] \DeclareOption{tiling}{\def\PstTiling{true}} \ProcessOptions\relax \input{pst-fill.tex} \ProvidesFile{pst-fill.tex} [\filedate\space v\fileversion\space `PST-fill' (tvz,dg)] % % \end{macrocode} % % % \section{Pst-Fill Package{} code} % % \begin{macrocode} %<*pst-fill> % \end{macrocode} % % \subsection{Preamble} % % Who we are. % % \begin{macrocode} \def\fileversion{1.01} \def\filedate{2007/03/10} \message{`PST-Fill' v\fileversion, \filedate\space (tvz,dg,hv)} \csname PSTboxfillLoaded\endcsname \let\PSTboxfillLoaded\endinput % \end{macrocode} % % Require the main PSTricks package. % % \begin{macrocode} \ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi % \end{macrocode} % % interface to the extended `\textsf{keyval}' package. % % \begin{macrocode} \ifx\PSTXKeyLoaded\endinput\else\input pst-xkey\fi % % \end{macrocode} % % Catcodes changes and defining the family name for xkeyval. % % \begin{macrocode} \edef\PstAtCode{\the\catcode`\@}\catcode`\@=11\relax \pst@addfams{pst-fill} % % \end{macrocode} % % % \subsection{The size of the box} % \begin{macro}{pst@@boxfillsize} % \begin{macrocode} % \def\pst@@boxfillsize#1(#2,#3)#4(#5,#6)#7(#8\@nil{% \begingroup \ifx\@empty#7\relax \pst@dima\z@ \pst@dimb\z@ \pssetxlength\pst@dimc{#2}% \pssetylength\pst@dimd{#3}% \else \pssetxlength\pst@dima{#2}% \pssetylength\pst@dimb{#3}% \pssetxlength\pst@dimc{#5}% \pssetylength\pst@dimd{#6}% \fi \xdef\pst@tempg{% \pst@dima=\number\pst@dima sp \pst@dimb=\number\pst@dimb sp \pst@dimc=\number\pst@dimc sp \pst@dimd=\number\pst@dimd sp }% \endgroup \let\psk@boxfillsize\pst@tempg} % \end{macrocode} % \end{macro} % % \subsection{Definition of the parameters} % % \begin{macrocode} \define@key[psset]{pst-fill}{boxfillsize}{% \def\pst@tempg{#1}\def\pst@temph{auto}% \ifx\pst@tempg\pst@temph \let\psk@boxfillsize\relax \else \pst@@boxfillsize#1(\z@,\z@)\@empty(\z@,\z@)(\@nil \fi} \psset{boxfillsize={(-15cm,-15cm)(15cm,15cm)}} \define@key[psset]{pst-fill}{boxfillcolor}{\pst@getcolor{#1}\psboxfillcolor} \psset{boxfillcolor=black}% hv \define@key[psset]{pst-fill}{boxfillangle}{\pst@getangle{#1}\psk@boxfillangle} \psset{boxfillangle=0} \define@key[psset]{pst-fill}{fillsepx}{% \pst@getlength{#1}\psk@fillsepx} \define@key[psset]{pst-fill}{fillsepy}{% \pst@getlength{#1}\psk@fillsepy} \define@key[psset]{pst-fill}{fillsep}{% \pst@getlength{#1}\psk@fillsepx% \let\psk@fillsepy\psk@fillsepx} \psset{fillsep=2pt} \ifx\PstTiling\@undefined \define@key[psset]{pst-fill}{fillcycle}{\pst@getint{#1}\psk@fillcycle} \psset{fillcycle=0} \else \define@key[psset]{pst-fill}{fillangle}{\pst@getangle{#1}\psk@boxfillangle} \define@key[psset]{pst-fill}{fillsize}{% \def\pst@tempg{#1}\def\pst@temph{auto}% \ifx\pst@tempg\pst@temph\let\psk@boxfillsize\relax \else\pst@@boxfillsize#1(\z@,\z@)\@empty(\z@,\z@)(\@nil\fi} \psset{fillsep=0,fillsize=auto} \define@key[psset]{pst-fill}{fillcyclex}{\pst@getint{#1}\psk@fillcyclex} \define@key[psset]{pst-fill}{fillcycley}{\pst@getint{#1}\psk@fillcycley} \define@key[psset]{pst-fill}{fillcycle}{% \pst@getint{#1}\psk@fillcyclex\let\psk@fillcycley\psk@fillcyclex} \psset{fillcycle=0} \define@key[psset]{pst-fill}{fillmovex}{\pst@getlength{#1}\psk@fillmovex} \define@key[psset]{pst-fill}{fillmovey}{\pst@getlength{#1}\psk@fillmovey} \define@key[psset]{pst-fill}{fillmove}{% \pst@getlength{#1}\psk@fillmovex\let\psk@fillmovey\psk@fillmovex} \psset{fillmove=0pt} \define@key[psset]{pst-fill}{fillloopaddx}{\pst@getint{#1}\psk@fillloopaddx} \define@key[psset]{pst-fill}{fillloopaddy}{\pst@getint{#1}\psk@fillloopaddy} \define@key[psset]{pst-fill}{fillloopadd}{% \pst@getint{#1}\psk@fillloopaddx\let\psk@fillloopaddy\psk@fillloopaddx} \psset{fillloopadd=0} % \end{macrocode} % % \begin{macrocode} % For debugging (to debug, set PstDebug=1) % we now use the one from pstricks to prevent a clash with package % pstricks 2004-06-22 %% \define@key[psset]{pst-fill}{PstDebug}{\pst@getint{#1}\psk@PstDebug} \psset{PstDebug=0} \fi % DG addition end % \end{macrocode} % \subsection{Definition of the fill box} % \begin{macro}{psboxfill} % \begin{macrocode} \newbox\pst@fillbox \def\psboxfill{\pst@killglue\pst@makebox\psboxfill@i} \def\psboxfill@i{\setbox\pst@fillbox\box\pst@hbox\ignorespaces} % \end{macrocode} % \end{macro} % \subsection{The main macros} % % \begin{macro}{psfs@boxfill} % \begin{macrocode} \def\psfs@boxfill{% \ifvoid\pst@fillbox \@pstrickserr{Fill box is empty. Use \string\psboxfill\space first.}\@ehpa \else \ifx\psk@boxfillsize\relax \pst@AutoBoxFill \else\pst@ManualBoxFill\fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{pst@ManualBoxFill} % \begin{macrocode} \def\pst@ManualBoxFill{% \leavevmode \begingroup \pst@FlushCode \begin@psclip \pstVerb{clip}% \expandafter\pst@AddFillBox\psk@boxfillsize \end@psclip \endgroup} % \end{macrocode} % \end{macro} % % \begin{macro}{pst@FlushCode} % \begin{macrocode} \def\pst@FlushCode{% \pst@Verb{% /mtrxc CM def CP CP T \tx@STV \psk@origin \psk@swapaxes \pst@newpath \pst@code mtrxc setmatrix moveto 0 setgray}% \gdef\pst@code{}} % \end{macrocode} % \end{macro} % % \begin{macro}{pst@AddFillBox} % \begin{macrocode} \def\pst@AddFillBox#1 #2 #3 #4 {% \begingroup \setbox\pst@fillbox=\vbox{% \hbox{\unhcopy\pst@fillbox\kern\psk@fillsepx\p@}% \vskip\psk@fillsepy\p@}% \psk@boxfillsize \pst@cnta=\pst@dimc \advance\pst@cnta-\pst@dima \divide\pst@cnta\wd\pst@fillbox \pst@cntb=\pst@dimd \advance\pst@cntb-\pst@dimb \pst@dimd=\ht\pst@fillbox \divide\pst@cntb\pst@dimd \def\pst@tempa{% \pst@tempg \copy\pst@fillbox \advance\pst@cntc\@ne \ifnum\pst@cntc<\pst@cntd\expandafter\pst@tempa\fi}% \let\pst@tempg\relax \pst@cntc-\tw@ \pst@cntd\pst@cnta \setbox\pst@fillbox=\hbox to \z@{% \kern\pst@dima \kern-\wd\pst@fillbox \pst@tempa \hss}% \pst@cntd\pst@cntb %% DG modification begin - Dec. 11, 1997 - Patch 2 \ifx\PstTiling\@undefined \ifnum\psk@fillcycle=\z@\pst@ManualFillCycle\fi \else \ifnum\psk@fillcyclex=\z@\pst@ManualFillCycle\fi \fi %% DG modification end \global\setbox\pst@boxg=\vbox to\z@{% \offinterlineskip \vss \pst@tempa \vskip\pst@dimb}% \endgroup \setbox\pst@fillbox\box\pst@boxg \pst@rotate\psk@boxfillangle\pst@fillbox \box\pst@fillbox} % \end{macrocode} % \end{macro} % % \begin{macro}{pst@ManualFillCycle} % \begin{macrocode} \def\pst@ManualFillCycle{% \ifx\PstTiling\@undefined \pst@cntg=\psk@fillcycle \else \pst@cntg=\psk@fillcyclex \fi \pst@dimg=\wd\pst@fillbox \ifnum\pst@cntg=\z@ \else \divide\pst@dimg\pst@cntg \fi \ifnum\pst@cntg<\z@\pst@cntg=-\pst@cntg\fi \advance\pst@cntg\m@ne \pst@cnth=\pst@cntg \def\pst@tempg{% \ifnum\pst@cnth<\pst@cntg\advance\pst@cnth\@ne\else\pst@cnth\z@\fi \moveright\pst@cnth\pst@dimg}} % \end{macrocode} % \end{macro} % %% Auto box fill: !! Fix dictionary % % \subsection{The PostScript subroutines} % % \begin{macrocode} %% DG addition begin - Apr. 8, 1997 and Dec. 1997 - Patch 2 \ifx\PstTiling\@undefined \pst@def{AutoFillCycle}<% /c ED /n 0 def /s { /x x w c div n mul add def /n n c abs 1 sub lt { n 1 add } { 0 } ifelse def } def> \pst@def{BoxFill}<% gsave gsave \tx@STV CM grestore dtransform CM idtransform abs /h ED abs /w ED pathbbox h div round 2 add cvi /y2 ED w div round 2 add cvi /x2 ED h div round 2 sub cvi /y1 ED w div round 2 sub cvi /x1 ED /y2 y2 y1 sub def /x2 x2 x1 sub def CP y1 h mul sub neg /y1 ED x1 w mul sub neg /x1 ED clip y2 { /x x1 def s x2 { save CP x y1 %% patch 4 hv -------------- \ifx\VTeXversion\undefined \else %%============ mv: 09-10-01 ??? this is likely to be a right change neg %%============ \fi %% end patch 4 T moveto Box restore /x x w add def } repeat /y1 y1 h add def } repeat % Next line not useful... To see that, suppress clipping (DG) CP x y1 T moveto Box currentpoint currentfont grestore setfont moveto> \else %% DG modification begin - Apr. 8, 1997 and Nov. / Dec. 1997 - Patch 2 \pst@def{AutoFillCycleX}<% /cX ED /nX 0 def /CycleX { /x x w cX div nX mul add def /nX nX cX abs 1 sub lt { nX 1 add } { 0 } ifelse def } def> \pst@def{AutoFillCycleY}<% /cY ED /mY 0 def /nY 0 def /CycleY { /y1 y1 h cY div mY mul sub def nY cY abs 1 sub lt { /nY nY 1 add def /mY 1 def } { /nY 0 def /mY cY abs 1 sub neg def } ifelse } def> \pst@def{BoxFill}<% gsave gsave \tx@STV CM grestore dtransform CM idtransform abs /h ED abs /w ED pathbbox h div round 2 add cvi /y2 ED w div round 2 add cvi /x2 ED h div round 2 sub cvi /y1 ED w div round 2 sub cvi /x1 ED /CoefLoopX 0 def /CoefLoopY 0 def /CoefMoveX 0 def /CoefMoveY 0 def \psk@boxfillangle\space 0 ne {/CoefLoopX 8 def /CoefLoopY 8 def} if \psk@fillcyclex\space 0 ne {/CoefLoopX CoefLoopX 1 add def} if \psk@fillcycley\space 0 ne {/CoefLoopY CoefLoopY 1 add def} if \psk@fillmovex\space 0 ne {/CoefLoopX CoefLoopX 2 add def \psk@fillmovex\space 0 gt {/CoefMoveX CoefLoopX def} {/CoefMoveX CoefLoopX neg def} ifelse} if \psk@fillmovey\space 0 ne {/CoefLoopY CoefLoopY 2 add def \psk@fillmovey\space 0 gt {/CoefMoveY CoefLoopY def} {/CoefMoveY CoefLoopY neg def} ifelse} if \psk@fillsepx\space 0 ne {/CoefLoopX CoefLoopX 1 add def} if \psk@fillsepy\space 0 ne {/CoefLoopY CoefLoopY 1 add def} if /CoefLoopX CoefLoopX \psk@fillloopaddx\space add def /CoefLoopY CoefLoopY \psk@fillloopaddy\space add def /x2 x2 x1 sub 4 sub CoefLoopX 2 mul add def /y2 y2 y1 sub 4 sub CoefLoopY 2 mul add def %% We must fix the origin of tiling, as it must not vary according other stuff %% in the page! w x1 CoefLoopX add CoefMoveX add mul h y1 y2 add 1 sub CoefLoopY sub CoefMoveY sub mul moveto CP y1 h mul sub neg /y1 ED x1 w mul sub neg /x1 ED %% hv 2004-06-22 to prevent clash with pst-gr3d %% \psk@PstDebug 0 eq {clip} if \Pst@Debug 0 eq {clip} if %% end hv \psk@fillmovex\space \psk@fillmovey gsave \tx@STV CM grestore dtransform CM idtransform /hmove ED /wmove ED /row 0 def y2 { /row row 1 add def /column 0 def /x x1 def CycleX save x2 { /column column 1 add def CycleY save CP x y1 %% patch 4 hv -------------- \ifx\VTeXversion\undefined \else %%============ mv: 09-10-01 ??? this is likely to be a right change neg %%============ \fi T moveto Box restore /x x w add def 0 hmove translate } repeat restore /y1 y1 h add def wmove 0 translate } repeat currentpoint currentfont grestore setfont moveto> \fi % \end{macrocode} % \begin{macrocode} \def\pst@AutoBoxFill{% \leavevmode \begingroup \pst@stroke \pst@FlushCode \pst@Verb{\psk@boxfillangle\space \tx@RotBegin}% \pstVerb{\pst@dict /Box \pslbrace end}% \ifx\PstTiling\@undefined \else \ifx\pst@tempa\@undefined % Undefined for instance for \pscharpath \else\ifx\pst@tempa\@empty\else \def\pst@temph{0}% \ifx\pst@tempa\pst@temph \else \pstVerb{/TR {pop pop currentpoint translate \pst@tempa\space translate } def}% \fi \fi\fi \fi \hbox to \z@{\vbox to\z@{\vss\copy\pst@fillbox\vskip-\dp\pst@fillbox}\hss}% \ifx\PstTiling\@undefined \pstVerb{% tx@Dict begin \psrbrace def \ifnum\psk@fillcycle=\z@ /s {} def \else \psk@fillcycle \tx@AutoFillCycle \fi \pst@number{\wd\pst@fillbox}% \psk@fillsepx\space add \pst@number{\ht\pst@fillbox}% \pst@number{\dp\pst@fillbox}% \psk@fillsepy\space add add \tx@BoxFill end}% \else \pstVerb{% tx@Dict begin \psrbrace def \ifnum\psk@fillcyclex=\z@ /CycleX {} def \else \psk@fillcyclex\space \tx@AutoFillCycleX \fi \ifnum\psk@fillcycley=\z@ /CycleY {} def \else \psk@fillcycley\space \tx@AutoFillCycleY \fi \pst@number{\wd\pst@fillbox}% \psk@fillsepx\space add \pst@number{\ht\pst@fillbox}% \pst@number{\dp\pst@fillbox}% \psk@fillsepy\space add add \tx@BoxFill end}% \fi \pst@Verb{\tx@RotEnd}% \endgroup} % \end{macrocode} % \subsection{Closing} % % Catcodes restoration. % % \begin{macrocode} \catcode`\@=\PstAtCode\relax % \end{macrocode} % % \begin{macrocode} % % \end{macrocode} % % \Finale % \endinput %% %% End of file `pst-fill.dtx'