chiark / gitweb /
Added then function NEW-SUB-PATH and some ,inor API changes
authorespen <espen>
Sun, 24 Dec 2006 14:28:20 +0000 (14:28 +0000)
committerespen <espen>
Sun, 24 Dec 2006 14:28:20 +0000 (14:28 +0000)
cairo/cairo.lisp

index 9d6aaed99b28a4cafc88ae8cddae5451f5a2fc95..276d60379ce614c45589395759f7364239a633c6 100644 (file)
@@ -20,7 +20,7 @@
 ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-;; $Id: cairo.lisp,v 1.6 2006/04/26 12:37:48 espen Exp $
+;; $Id: cairo.lisp,v 1.7 2006/12/24 14:28:20 espen Exp $
 
 (in-package "CAIRO")
 
@@ -303,12 +303,17 @@ (defmacro with-context ((cr) &body body)
 (defbinding status () status
   (cr context))
 
+(defun ensure-color-component (component)
+  (etypecase component
+    (float component)
+    (integer (/ component 256.0))))
+
 (defbinding (set-source-color "cairo_set_source_rgba") (cr red green blue &optional (alpha 1.0)) nil
   (cr context)
-  (red double-float)
-  (green double-float)
-  (blue double-float)
-  (alpha double-float))
+  ((ensure-color-component red) double-float)
+  ((ensure-color-component green) double-float)
+  ((ensure-color-component blue) double-float)
+  ((ensure-color-component alpha) double-float))
 
 (defbinding set-source-surface () nil
   (cr context)
@@ -387,6 +392,10 @@ (defbinding get-current-point () nil
 (defbinding new-path () nil
   (cr context))
 
+#?(pkg-exists-p "cairo" :atleast-version "1.2")
+(defbinding new-sub-path () nil
+  (cr context))
+
 (defbinding close-path () nil
   (cr context))
 
@@ -531,7 +540,7 @@ (defbinding user-to-device () nil
   (x double-float :in/out)
   (y double-float :in/out))
 
-(defbinding user-to-device-distance () nil
+(defbinding user-to-device-distance (cr dx &optional (dy 0.0)) nil
   (cr context)
   (dx double-float :in/out)
   (dy double-float :in/out))
@@ -541,7 +550,7 @@ (defbinding device-to-user () nil
   (x double-float :in/out)
   (y double-float :in/out))
 
-(defbinding device-to-user-distance () nil
+(defbinding device-to-user-distance (cr dx &optional (dy 0.0)) nil
   (cr context)
   (dx double-float :in/out)
   (dy double-float :in/out))