[cl-cairo2-cvs] r3 - tutorial
tpapp at common-lisp.net
tpapp at common-lisp.net
Wed May 30 02:23:33 UTC 2007
Author: tpapp
Date: Tue May 29 22:23:32 2007
New Revision: 3
Removed:
tutorial/tutorial.lisp
Modified:
Makefile
README
tutorial/Makefile
tutorial/example.lisp
tutorial/tutorial.tex
Log:
Cleaned up examples
Modified: Makefile
==============================================================================
--- Makefile (original)
+++ Makefile Tue May 29 22:23:32 2007
@@ -3,3 +3,10 @@
test-swig.lisp: test.i
swig -cffi -generate-typedef test.i
+
+asdf:
+ rm -Rf /tmp/cl-cairo2-latest
+ mkdir /tmp/cl-cairo2-latest
+ cp * -R /tmp/cl-cairo2-latest
+ tar -cvzf /tmp/cl-cairo2-latest.tar.gz -C /tmp cl-cairo2-latest
+ gpg -b -a /tmp/cl-cairo2-latest.tar.gz
\ No newline at end of file
Modified: README
==============================================================================
--- README (original)
+++ README Tue May 29 22:23:32 2007
@@ -1,6 +1,6 @@
Please read the tutorial to get started. To compile the tutorial from
source, you will need a reasonably complete LaTeX installation with
-dvipdfm, and the pdftops utility.
+dvipdfm.
The project webpage is at http://common-lisp.net/project/cl-cairo2,
where you will find the repository, mailing lists, contact information
Modified: tutorial/Makefile
==============================================================================
--- tutorial/Makefile (original)
+++ tutorial/Makefile Tue May 29 22:23:32 2007
@@ -1,12 +1,5 @@
tutorial.pdf: tutorial.dvi
dvipdfm tutorial
-tutorial.dvi: tutorial.tex hearts.png lissajous.eps text.eps
+tutorial.dvi: tutorial.tex hearts.png lissajous.ps text.ps example.ps
latex tutorial.tex
-
-lissajous.eps: lissajous.pdf
- pdftops -eps lissajous.pdf lissajous.eps
-
-text.eps: ../text.pdf
- pdftops -eps text.pdf text.eps
-
Modified: tutorial/example.lisp
==============================================================================
--- tutorial/example.lisp (original)
+++ tutorial/example.lisp Tue May 29 22:23:32 2007
@@ -47,7 +47,7 @@
(defparameter size 50)
(defparameter x 20)
(defparameter y 50)
-(setf *context* (create-pdf-context "text.pdf" width height))
+(setf *context* (create-ps-context "text.ps" width height))
;; white background
(rectangle 0 0 width height)
(set-source-rgb 1 1 1)
@@ -89,7 +89,7 @@
(defparameter b 8)
(defparameter delta (/ pi 2))
(defparameter density 2000)
-(setf *context* (create-pdf-context "lissajous.pdf" size size))
+(setf *context* (create-ps-context "lissajous.ps" size size))
;; pastel blue background
(rectangle 0 0 width height)
(set-source-rgb 0.9 0.9 1)
@@ -150,3 +150,25 @@
(scale scaling scaling) ; scale
(rotate (deg-to-rad (- (random (* 2 max-angle)) max-angle 180))) ; rotate
(heart (+ 0.1 (random 0.7))))))
+
+
+;;;;
+;;;; short example for the tutorial
+;;;;
+
+(defparameter *surface* (create-ps-surface "example.ps" 200 100))
+(setf *context* (create-context *surface*))
+(destroy *surface*)
+;; clear the whole canvas with blue
+(rectangle 0 0 200 100)
+(set-source-rgb 0.2 0.2 1)
+(fill-path)
+;; draw a white diagonal line
+(move-to 0 0)
+(line-to 200 100)
+(set-source-rgb 1 1 1)
+(set-line-width 5)
+(stroke)
+;; destroy context, this also destroys the surface and closes the file
+(destroy *context*)
+
Modified: tutorial/tutorial.tex
==============================================================================
--- tutorial/tutorial.tex (original)
+++ tutorial/tutorial.tex Tue May 29 22:23:32 2007
@@ -39,6 +39,7 @@
breaklines=true,
% frame=single,
columns=fullflexible,
+ literate={-}{}{0\discretionary{-}{}{-}},
}
\begin{document}
@@ -134,7 +135,7 @@
on a blue background, using a Postscript file -- the result is shown
in Figure~\ref{fig:example}.
-\lstinputlisting[firstline=3,lastline=17]{tutorial.lisp}
+\lstinputlisting[firstline=159,lastline=173]{example.lisp}
\begin{figure}[htbp]
\centering
@@ -346,18 +347,18 @@
\texttt{example.lisp}. Figures~\ref{fig:text}--\ref{fig:hearts} show
the results.
-\lstinputlisting{../example.lisp}
+\lstinputlisting{example.lisp}
\begin{figure}[htbp]
\centering
- \includegraphics[height=8cm]{text.eps}
+ \includegraphics[height=8cm]{text.ps}
\caption{text.pdf}
\label{fig:text}
\end{figure}
\begin{figure}[htbp]
\centering
- \includegraphics[height=8cm]{lissajous.eps}
+ \includegraphics[height=8cm]{lissajous.ps}
\caption{lissajous.pdf}
\label{fig:lissajous}
\end{figure}
More information about the Cl-cairo2-cvs
mailing list