[cl-cairo2-cvs] r8 - tutorial

tpapp at common-lisp.net tpapp at common-lisp.net
Sat Jul 21 13:41:55 UTC 2007


Author: tpapp
Date: Sat Jul 21 09:41:55 2007
New Revision: 8

Modified:
   context.lisp
   surface.lisp
   tables.lisp
   tutorial/example.lisp
   tutorial/tutorial.tex
Log:
changed to longer property names to avoid name clashes

Modified: context.lisp
==============================================================================
--- context.lisp	(original)
+++ context.lisp	Sat Jul 21 09:41:55 2007
@@ -66,7 +66,7 @@
 	   (multiple-value-prog1 (progn , at body)
 	     (let ((,status 
 		    (lookup-cairo-enum (cairo_status ,pointer-name) table-status)))
-	       (unless (eq ,status 'success)
+	       (unless (eq ,status 'status-success)
 		 (warn "function returned with status ~a." ,status))))
 	   (warn "context is not alive")))))
 

Modified: surface.lisp
==============================================================================
--- surface.lisp	(original)
+++ surface.lisp	Sat Jul 21 09:41:55 2007
@@ -30,7 +30,7 @@
     `(multiple-value-prog1 (progn , at body)
        (let ((,status 
 	      (lookup-cairo-enum (cairo_surface_status ,pointer) table-status)))
-	 (unless (eq ,status 'success)
+	 (unless (eq ,status 'status-success)
 	   (warn "function returned with status ~a." ,status))))))
 
 (defmacro with-surface ((surface pointer) &body body)

Modified: tables.lisp
==============================================================================
--- tables.lisp	(original)
+++ tables.lisp	Sat Jul 21 09:41:55 2007
@@ -9,99 +9,99 @@
        (export (cdr i)))))
 
 (exporting-table table-format
-  '((:CAIRO_FORMAT_ARGB32 . argb32)
-    (:CAIRO_FORMAT_RGB24 . rgb24)
-    (:CAIRO_FORMAT_A8 . a8)
-    (:CAIRO_FORMAT_A1 . a1)))
+  '((:CAIRO_FORMAT_ARGB32 . format-argb32)
+    (:CAIRO_FORMAT_RGB24 . format-rgb24)
+    (:CAIRO_FORMAT_A8 . format-a8)
+    (:CAIRO_FORMAT_A1 . format-a1)))
 
 (exporting-table table-antialias
-  '((:CAIRO_ANTIALIAS_DEFAULT . default)
-    (:CAIRO_ANTIALIAS_NONE . none)
-    (:CAIRO_ANTIALIAS_GRAY . gray)
-    (:CAIRO_ANTIALIAS_SUBPIXEL . subpixel)))
+  '((:CAIRO_ANTIALIAS_DEFAULT . antialias-default)
+    (:CAIRO_ANTIALIAS_NONE . antialias-none)
+    (:CAIRO_ANTIALIAS_GRAY . antialias-gray)
+    (:CAIRO_ANTIALIAS_SUBPIXEL . antialias-subpixel)))
 
 (exporting-table table-fill-rule
-  '((:CAIRO_FILL_RULE_WINDING . winding)
-    (:CAIRO_FILL_RULE_EVEN_ODD . odd)))
+  '((:CAIRO_FILL_RULE_WINDING . fill-rule-winding)
+    (:CAIRO_FILL_RULE_EVEN_ODD . fill-rule-odd)))
 
 (exporting-table table-line-cap
-  '((:CAIRO_LINE_CAP_BUTT . butt)
-    (:CAIRO_LINE_CAP_ROUND . round)
-    (:CAIRO_LINE_CAP_SQUARE . square)))
+  '((:CAIRO_LINE_CAP_BUTT . line-cap-butt)
+    (:CAIRO_LINE_CAP_ROUND . line-cap-round)
+    (:CAIRO_LINE_CAP_SQUARE . line-cap-square)))
 
 (exporting-table table-line-join
-  '((:CAIRO_LINE_JOIN_MITER . miter)
-    (:CAIRO_LINE_JOIN_ROUND . round)
-    (:CAIRO_LINE_JOIN_BEVEL . bevel)))
+  '((:CAIRO_LINE_JOIN_MITER . line-join-miter)
+    (:CAIRO_LINE_JOIN_ROUND . line-join-round)
+    (:CAIRO_LINE_JOIN_BEVEL . line-join-bevel)))
 
 (exporting-table table-operator
-  '((:CAIRO_OPERATOR_CLEAR . clear)
-    (:CAIRO_OPERATOR_SOURCE . source)
-     (:CAIRO_OPERATOR_OVER . over)
-     (:CAIRO_OPERATOR_IN . in)
-     (:CAIRO_OPERATOR_OUT . out)
-     (:CAIRO_OPERATOR_ATOP . atop)
-     (:CAIRO_OPERATOR_DEST . dest)
-     (:CAIRO_OPERATOR_DEST_OVER . dest-over)
-     (:CAIRO_OPERATOR_DEST_IN . dest-in)
-     (:CAIRO_OPERATOR_DEST_OUT . dest-out)
-     (:CAIRO_OPERATOR_DEST_ATOP . dest-atop)
-     (:CAIRO_OPERATOR_XOR . xor)
-     (:CAIRO_OPERATOR_ADD . add)
-     (:CAIRO_OPERATOR_SATURATE . saturate)))
+  '((:CAIRO_OPERATOR_CLEAR . operator-clear)
+    (:CAIRO_OPERATOR_SOURCE . operator-source)
+     (:CAIRO_OPERATOR_OVER . operator-over)
+     (:CAIRO_OPERATOR_IN . operator-in)
+     (:CAIRO_OPERATOR_OUT . operator-out)
+     (:CAIRO_OPERATOR_ATOP . operator-atop)
+     (:CAIRO_OPERATOR_DEST . operator-dest)
+     (:CAIRO_OPERATOR_DEST_OVER . operator-dest-over)
+     (:CAIRO_OPERATOR_DEST_IN . operator-dest-in)
+     (:CAIRO_OPERATOR_DEST_OUT . operator-dest-out)
+     (:CAIRO_OPERATOR_DEST_ATOP . operator-dest-atop)
+     (:CAIRO_OPERATOR_XOR . operator-xor)
+     (:CAIRO_OPERATOR_ADD . operator-add)
+     (:CAIRO_OPERATOR_SATURATE . operator-saturate)))
 
 (exporting-table table-font-slant
-  '((:CAIRO_FONT_SLANT_NORMAL . normal)
-    (:CAIRO_FONT_SLANT_ITALIC . italic)
-    (:CAIRO_FONT_SLANT_OBLIQUE . oblique)))
+  '((:CAIRO_FONT_SLANT_NORMAL . font-slant-normal)
+    (:CAIRO_FONT_SLANT_ITALIC . font-slant-italic)
+    (:CAIRO_FONT_SLANT_OBLIQUE . font-slant-oblique)))
 
 (exporting-table table-font-weight
-  '((:CAIRO_FONT_WEIGHT_NORMAL . normal)
-    (:CAIRO_FONT_WEIGHT_BOLD . bold)))
+  '((:CAIRO_FONT_WEIGHT_NORMAL . font-weight-normal)
+    (:CAIRO_FONT_WEIGHT_BOLD . font-weight-bold)))
 
 (exporting-table table-subpixel-order
-  '((:CAIRO_SUBPIXEL_ORDER_DEFAULT . default)
-    (:CAIRO_SUBPIXEL_ORDER_RGB . rgb)
-    (:CAIRO_SUBPIXEL_ORDER_BGR .bgr)
-    (:CAIRO_SUBPIXEL_ORDER_VRGB . vrgb)
-    (:CAIRO_SUBPIXEL_ORDER_VBGR . vbgr)))
+  '((:CAIRO_SUBPIXEL_ORDER_DEFAULT . subpixel-order-default)
+    (:CAIRO_SUBPIXEL_ORDER_RGB . subpixel-order-rgb)
+    (:CAIRO_SUBPIXEL_ORDER_BGR . subpixel-order-bgr)
+    (:CAIRO_SUBPIXEL_ORDER_VRGB . subpixel-order-vrgb)
+    (:CAIRO_SUBPIXEL_ORDER_VBGR . subpixel-order-vbgr)))
 
 (exporting-table table-hint-style
-  '((:CAIRO_HINT_STYLE_DEFAULT . default)
-    (:CAIRO_HINT_STYLE_NONE . none)
-    (:CAIRO_HINT_STYLE_SLIGHT . slight)
-    (:CAIRO_HINT_STYLE_MEDIUM . medium)
-    (:CAIRO_HINT_STYLE_FULL . full)))
+  '((:CAIRO_HINT_STYLE_DEFAULT . hint-style-default)
+    (:CAIRO_HINT_STYLE_NONE . hint-style-none)
+    (:CAIRO_HINT_STYLE_SLIGHT . hint-style-slight)
+    (:CAIRO_HINT_STYLE_MEDIUM . hint-style-medium)
+    (:CAIRO_HINT_STYLE_FULL . hint-style-full)))
 
 (exporting-table table-hint-metrics
- '((:CAIRO_HINT_METRICS_DEFAULT . default)
-   (:CAIRO_HINT_METRICS_OFF . off)
-   (:CAIRO_HINT_METRICS_ON . on)))
+ '((:CAIRO_HINT_METRICS_DEFAULT . hint-metrics-default)
+   (:CAIRO_HINT_METRICS_OFF . hint-metrics-off)
+   (:CAIRO_HINT_METRICS_ON . hint-metrics-on)))
 
 (exporting-table table-status
-  '((:CAIRO_STATUS_SUCCESS . success)
-    (:CAIRO_STATUS_NO_MEMORY . no-memory)
-    (:CAIRO_STATUS_INVALID_RESTORE . invalid-restore)
-    (:CAIRO_STATUS_INVALID_POP_GROUP . invalid-pop-group)
-    (:CAIRO_STATUS_NO_CURRENT_POINT . no-current-point)
-    (:CAIRO_STATUS_INVALID_MATRIX . invalid-matrix)
-    (:CAIRO_STATUS_INVALID_STATUS . invalid-status)
-    (:CAIRO_STATUS_NULL_POINTER . null-pointer)
-    (:CAIRO_STATUS_INVALID_STRING . invalid-string)
-    (:CAIRO_STATUS_INVALID_PATH_DATA . invalid-path-data)
-    (:CAIRO_STATUS_READ_ERROR . read-error)
-    (:CAIRO_STATUS_WRITE_ERROR . write-error)
-    (:CAIRO_STATUS_SURFACE_FINISHED . surface-finished)
-    (:CAIRO_STATUS_SURFACE_TYPE_MISMATCH . surface-type-mismatch)
-    (:CAIRO_STATUS_PATTERN_TYPE_MISMATCH . pattern-type-mismatch)
-    (:CAIRO_STATUS_INVALID_CONTENT . invalid-content)
-    (:CAIRO_STATUS_INVALID_FORMAT . invalid-format)
-    (:CAIRO_STATUS_INVALID_VISUAL . invalid-visual)
-    (:CAIRO_STATUS_FILE_NOT_FOUND . file-not-found)
-    (:CAIRO_STATUS_INVALID_DASH . invalid-dash)
-    (:CAIRO_STATUS_INVALID_DSC_COMMENT . invalid-dsc-comment)
-    (:CAIRO_STATUS_INVALID_INDEX . invalid-index)
-    (:CAIRO_STATUS_CLIP_NOT_REPRESENTABLE . clip-not-representable)))
+  '((:CAIRO_STATUS_SUCCESS . status-success)
+    (:CAIRO_STATUS_NO_MEMORY . status-no-memory)
+    (:CAIRO_STATUS_INVALID_RESTORE . status-invalid-restore)
+    (:CAIRO_STATUS_INVALID_POP_GROUP . status-invalid-pop-group)
+    (:CAIRO_STATUS_NO_CURRENT_POINT . status-no-current-point)
+    (:CAIRO_STATUS_INVALID_MATRIX . status-invalid-matrix)
+    (:CAIRO_STATUS_INVALID_STATUS . status-invalid-status)
+    (:CAIRO_STATUS_NULL_POINTER . status-null-pointer)
+    (:CAIRO_STATUS_INVALID_STRING . status-invalid-string)
+    (:CAIRO_STATUS_INVALID_PATH_DATA . status-invalid-path-data)
+    (:CAIRO_STATUS_READ_ERROR . status-read-error)
+    (:CAIRO_STATUS_WRITE_ERROR . status-write-error)
+    (:CAIRO_STATUS_SURFACE_FINISHED . status-surface-finished)
+    (:CAIRO_STATUS_SURFACE_TYPE_MISMATCH . status-surface-type-mismatch)
+    (:CAIRO_STATUS_PATTERN_TYPE_MISMATCH . status-pattern-type-mismatch)
+    (:CAIRO_STATUS_INVALID_CONTENT . status-invalid-content)
+    (:CAIRO_STATUS_INVALID_FORMAT . status-invalid-format)
+    (:CAIRO_STATUS_INVALID_VISUAL . status-invalid-visual)
+    (:CAIRO_STATUS_FILE_NOT_FOUND . status-file-not-found)
+    (:CAIRO_STATUS_INVALID_DASH . status-invalid-dash)
+    (:CAIRO_STATUS_INVALID_DSC_COMMENT . status-invalid-dsc-comment)
+    (:CAIRO_STATUS_INVALID_INDEX . status-invalid-index)
+    (:CAIRO_STATUS_CLIP_NOT_REPRESENTABLE . status-clip-not-representable)))
 
 (defun lookup-cairo-enum (cairo-enum table)
   (let ((enum (cdr (assoc cairo-enum table))))

Modified: tutorial/example.lisp
==============================================================================
--- tutorial/example.lisp	(original)
+++ tutorial/example.lisp	Sat Jul 21 09:41:55 2007
@@ -75,7 +75,7 @@
 (set-source-rgb 1 1 1)
 (fill-path)
 ;; setup font
-(select-font-face "Arial" 'normal 'normal)
+(select-font-face "Arial" 'font-slant-normal 'font-weight-normal)
 (set-font-size size)
 ;; starting point
 (mark-at x y 2 1 0 0)			; red
@@ -129,7 +129,7 @@
 (set-source-rgb 0 0 1)
 (stroke)
 ;; "cl-cairo2" in Arial bold to the center
-(select-font-face "Arial" 'normal 'bold)
+(select-font-face "Arial" 'font-slant-normal 'font-weight-bold)
 (set-font-size 100)
 (set-source-rgba 1 0.75 0 0.5)		; orange
 (show-text-aligned "cl-cairo2" (/ size 2) (/ size 2))
@@ -159,7 +159,7 @@
 (defparameter width 1024)
 (defparameter height 768)
 (defparameter max-angle 40d0)
-(with-png-file ("hearts.png" 'rgb24 width height)
+(with-png-file ("hearts.png" 'format-rgb24 width height)
   ;; fill with white
   (rectangle 0 0 width height)
   (set-source-rgb 1 1 1)

Modified: tutorial/tutorial.tex
==============================================================================
--- tutorial/tutorial.tex	(original)
+++ tutorial/tutorial.tex	Sat Jul 21 09:41:55 2007
@@ -54,10 +54,10 @@
 
 \href{http://cairographics.org/}{Cairo} is a 2D graphics library with
 support for multiple output devices.  The \lstinline!cl-cairo2!
-package provides Common Lisp bindings for the Cairo API.  Alternatives
+package provides Common Lisp bindings for the Cairo API.\footnote{Alternatives
 are \href{http://www.cliki.net/cl-cairo}{cl-cairo}, written by Lars
-Nostdal and others (which appears to be dormant), and Christian
-Haselbach's \href{http://www.cliki.net/cffi-cairo}{cffi-cairo}.
+Nostdal and others (this project appears to be dormant), and Christian
+Haselbach's \href{http://www.cliki.net/cffi-cairo}{cffi-cairo}.}
 
 \lstinline!cl-cairo2! is written with the following principles in mind:
 
@@ -159,7 +159,7 @@
 write this to the bitmap file when you are done.  The macro
 \lstinline!with-png-file! will take care of these details: use it like
 \begin{lstlisting}
-(with-png-file ("example.png" 'rgb24 200 100)
+(with-png-file ("example.png" 'format-rgb24 200 100)
   ;; drawing commands
   ...)
 \end{lstlisting}
@@ -171,10 +171,10 @@
 lookup tables (assoc lists) for this purpose, which are defined in
 \verb!tables.lisp!.  Cairo constants
 \texttt{CAIRO\_\textsl{PROPERTY}\_\textsl{SOMETHING}} usually map to
-the Lisp symbol \lstinline!something!, and can only be used in setting
-or querying \texttt{PROPERTY}.  For example, \verb!CAIRO_FORMAT_RGB24!
-is mapped to \lstinline!rgb24!, and using it for some other property
-will create an error.
+the Lisp symbol \lstinline!property-something!, and can only be used
+in setting or querying \texttt{PROPERTY}.  For example,
+\verb!CAIRO_FORMAT_RGB24!  is mapped to \lstinline!format-rgb24!, and
+using it for some other property will create an error.
 
 Likewise, names of the Lisp function are easy to deduce from the name
 of the C function in the Cairo API: just drop the \verb!cairo_! prefix
@@ -290,7 +290,7 @@
 \verb!text.lisp! for an enumeration of what is missing).  You can
 select font face and size using commands like
 \begin{lstlisting}
-  (select-font-face "Arial" 'italic 'bold)
+  (select-font-face "Arial" 'font-slant-italic 'font-weight-bold)
   (select-font-size 12)
 \end{lstlisting}
 and use \lstinline!(show-text "hello world")! to draw it.  You can



More information about the Cl-cairo2-cvs mailing list