diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index fd22ecd..3d62176 100644 Binary files a/cpdfmanual.pdf and b/cpdfmanual.pdf differ diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 3d70a61..1aaa6d8 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -4199,7 +4199,7 @@ We can draw on an existing PDF (or a new one created with \texttt{-create-pdf} f \noindent The first example builds a new A4 portrait PDF with one page, and writes Hello in the default 12pt Times Roman font at the bottom left. The second does the same, but for every page of an existing PDF. -Coordinates in a PDF file have the origin $(0, 0)$ at the bottom-left of the page. +Coordinates in a PDF file have the origin $(0, 0)$ at the bottom-left of the page. All units are in points (1/72 inch). \section{Building and showing paths} @@ -4289,22 +4289,64 @@ To avoid calculating the Bezier curves for a circle manually, \texttt{cpdf} can \section{Clipping with paths} {\small\begin{framed} \noindent\verb!-clip! Clip\\ - \noindent\verb!-clipeo! Clip, even odd\\ + \noindent\verb!-clipeo! Clip, even odd \end{framed}} - - \section{Path parameters} {\small\begin{framed} - \noindent\verb!-strokecol! Set stroke colour\\ - \noindent\verb!-fillcol! Set fill colour\\ - \noindent\verb!-thick! Set stroke thickness\\ - \noindent\verb!-cap! Set cap\\ - \noindent\verb!-join! Set join\\ - \noindent\verb!-miter! Set miter limit\\ - \noindent\verb!-dash! Set dash pattern + \noindent\verb!-strokecol "g" | "r g b" | "c y m k"! Set stroke colour\\ + \noindent\verb!-fillcol "g" | "r g b" | "c y m k"! Set fill colour\\ + \noindent\verb!-thick n! Set stroke thickness\\ + \noindent\verb!-cap butt | round | square! Set cap\\ + \noindent\verb!-join miter | round | bevel! Set join\\ + \noindent\verb!-miter n! Set miter limit\\ + \noindent\verb!-dash ! Set dash pattern \end{framed}} +We can set stroke and fill colours for our paths, either as greyscale (one component), RGB (three components) or CYMK (four components): + +\begin{framed} + \noindent\small\verb?cpdf -create-pdf AND -draw -circle "200 200 100" -thick 20?\\ + \noindent\small\verb? -strokecol 0.5 -fillcol "0.2 0.7 0.2" -stroke -o out.pdf? +\end{framed} + +\noindent Here is the result: + +\bigskip +\fbox{\includegraphics[width=0.3\textwidth]{manualimages/colfill.pdf}} +\bigskip + +\noindent We can set line caps and joins with \texttt{-cap}, \texttt{-join}: + +\begin{framed} + \noindent\small\verb?cpdf -create-pdf AND -draw -to "100 100"?\\ + \noindent\small\verb?-join round -cap round -thick 40?\\ + \noindent\small\verb?-line "200 200" -line "220 100" -stroke?\\ + \noindent\small\verb?-o out.pdf? +\end{framed} + +\noindent Then we see: + +\bigskip +\fbox{\includegraphics[width=0.3\textwidth]{manualimages/capjoins.pdf}} +\bigskip + +\noindent The miter limit (see PDF reference for details) may be set with \texttt{-miter}. + +Lines may have dash patterns. A dash pattern consists of one or more numbers. All save the last form the list of dash lengths and gap lengths. The last is the phase, which defines how far along the pattern we start. For example, using a dash pattern of "30 20 0" i.e black 30, white 20, phase 0: + +\begin{framed} + \noindent\small\verb?cpdf -create-pdf AND -draw -to "100 100"?\\ + \noindent\small\verb?-dash "30 20 0" -thick 20 -line "400 300" -stroke?\\ + \noindent\small\verb?-o out.pdf? +\end{framed} + +\noindent Here is the result: + +\bigskip +\fbox{\includegraphics[width=0.3\textwidth]{manualimages/dash.pdf}} +\bigskip + \section{The graphics stack and matrices} {\small\begin{framed} \noindent\verb!-push! Push graphics stack\\ diff --git a/manualimages/capjoins.pdf b/manualimages/capjoins.pdf new file mode 100644 index 0000000..284d7cf --- /dev/null +++ b/manualimages/capjoins.pdf @@ -0,0 +1,29 @@ +%PDF-2.0 +% +1 0 obj +<> +endobj +2 0 obj +<> +endobj +3 0 obj +<>/MediaBox[0 0 595.2765 841.89105]/Contents[4 0 R]>> +endobj +4 0 obj +<> +stream +100 100 m 1 j 1 J 1 M 40 w 200 200 l 220 100 l S +endstream +endobj +xref +0 5 +0000000000 65535 f +0000000015 00000 n +0000000060 00000 n +0000000111 00000 n +0000000217 00000 n +trailer +<]>> +startxref +313 +%%EOF diff --git a/manualimages/colfill.pdf b/manualimages/colfill.pdf new file mode 100644 index 0000000..ed68534 --- /dev/null +++ b/manualimages/colfill.pdf @@ -0,0 +1,32 @@ +%PDF-2.0 +% +1 0 obj +<> +endobj +2 0 obj +<> +endobj +3 0 obj +<>/MediaBox[0 0 595.2765 841.89105]/Contents[4 0 R]>> +endobj +4 0 obj +<> +stream +xeN10 +/QWXpI!/3CK-6`Utg#hAaZ9sM +;vB-xzڬ+ + +endstream +endobj +xref +0 5 +0000000000 65535 f +0000000015 00000 n +0000000060 00000 n +0000000111 00000 n +0000000217 00000 n +trailer +<<4ba93f9e60c81a25903b75d279047af4>]>> +startxref +383 +%%EOF diff --git a/manualimages/dash.pdf b/manualimages/dash.pdf new file mode 100644 index 0000000..6ba080e --- /dev/null +++ b/manualimages/dash.pdf @@ -0,0 +1,29 @@ +%PDF-2.0 +% +1 0 obj +<> +endobj +2 0 obj +<> +endobj +3 0 obj +<>/MediaBox[0 0 595.2765 841.89105]/Contents[4 0 R]>> +endobj +4 0 obj +<> +stream +100 100 m 20 w[30 20]0 d 400 300 l S +endstream +endobj +xref +0 5 +0000000000 65535 f +0000000015 00000 n +0000000060 00000 n +0000000111 00000 n +0000000217 00000 n +trailer +<<4736f799ac58f6aab465f1cbd5579a19>]>> +startxref +301 +%%EOF