[cairo-commit] cairo-5c ChangeLog, 1.5, 1.6 Makefile.am, 1.2, 1.3 autogen.sh, 1.1.1.1, 1.2 cairo-5c.h, 1.3, 1.4 cairo.5c, NONE, 1.1 configure.in, 1.2, 1.3 draw.c, 1.2, 1.3 gstate.c, 1.2, 1.3 gtk.c, 1.2, 1.3 init.c, 1.4, 1.5 surface.c, 1.3, 1.4 text.c, 1.2, 1.3

Keith Packard commit at pdx.freedesktop.org
Thu Dec 16 18:09:48 PST 2004


Committed by: keithp

Update of /cvs/cairo/cairo-5c
In directory gabe:/tmp/cvs-serv8846

Modified Files:
	ChangeLog Makefile.am autogen.sh cairo-5c.h configure.in 
	draw.c gstate.c gtk.c init.c surface.c text.c 
Added Files:
	cairo.5c 
Log Message:
2004-12-16  Keith Packard  <keithp at keithp.com>

	* Makefile.am:
	* autogen.sh:
	* cairo.5c:
	* configure.in:
	Add cairo.5c and install it to nickle libary
	
	* cairo-5c.h:
	* draw.c: (do_Cairo_rectangle), (do_Cairo_in_stroke),
	(do_Cairo_in_fill), (do_Cairo_stroke_extents),
	(do_Cairo_fill_extents), (cairo_5c_move_to),
	(do_Cairo_current_path), (do_Cairo_current_path_flat):
	* gstate.c: (do_Cairo_set_operator), (do_Cairo_set_fill_rule),
	(do_Cairo_set_line_cap), (do_Cairo_set_line_join),
	(do_Cairo_set_dash), (do_Cairo_set_miter_limit),
	(do_Cairo_default_matrix), (do_Cairo_transform_point),
	(do_Cairo_transform_distance), (do_Cairo_inverse_transform_point),
	(do_Cairo_inverse_transform_distance), (do_Cairo_init_clip),
	(do_Cairo_clip), (do_Cairo_current_operator),
	(do_Cairo_current_rgb_color), (do_Cairo_current_alpha),
	(do_Cairo_current_tolerance), (do_Cairo_current_point),
	(do_Cairo_current_fill_rule), (do_Cairo_current_line_width),
	(do_Cairo_current_line_cap), (do_Cairo_current_line_join),
	(do_Cairo_current_miter_limit):
	* init.c: (make_typedef), (init_types), (EnumIntPart), (IntToEnum),
	(nickle_init):
	* text.c: (do_Cairo_select_font), (do_Cairo_text_extents),
	(do_Cairo_select_ft_font):
	Add a bunch more bindings.  Still more to do, especially the
	path walkers.
	Switch from int constants to enums for enumerated types.
	
	* gtk.c: (motion_notify_event), (button_press_event),
	(button_release_event), (cairo_5c_window_new):
	* surface.c: (do_Cairo_new):
	Add mouse input support.

	* examples/animate.5c:
	* examples/cairo.5c:
	* examples/draw.5c:
	* examples/graph.5c:
	* examples/pie.5c:
	* examples/rottext.5c:
	* examples/sin.5c:
	* examples/test.5c:
	Change examples to use cairo.5c file with autoimport


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-5c/ChangeLog,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ChangeLog	15 Dec 2004 07:04:50 -0000	1.5
+++ ChangeLog	17 Dec 2004 02:09:45 -0000	1.6
@@ -1,3 +1,51 @@
+2004-12-16  Keith Packard  <keithp at keithp.com>
+
+	* Makefile.am:
+	* autogen.sh:
+	* cairo.5c:
+	* configure.in:
+	Add cairo.5c and install it to nickle libary
+	
+	* cairo-5c.h:
+	* draw.c: (do_Cairo_rectangle), (do_Cairo_in_stroke),
+	(do_Cairo_in_fill), (do_Cairo_stroke_extents),
+	(do_Cairo_fill_extents), (cairo_5c_move_to),
+	(do_Cairo_current_path), (do_Cairo_current_path_flat):
+	* gstate.c: (do_Cairo_set_operator), (do_Cairo_set_fill_rule),
+	(do_Cairo_set_line_cap), (do_Cairo_set_line_join),
+	(do_Cairo_set_dash), (do_Cairo_set_miter_limit),
+	(do_Cairo_default_matrix), (do_Cairo_transform_point),
+	(do_Cairo_transform_distance), (do_Cairo_inverse_transform_point),
+	(do_Cairo_inverse_transform_distance), (do_Cairo_init_clip),
+	(do_Cairo_clip), (do_Cairo_current_operator),
+	(do_Cairo_current_rgb_color), (do_Cairo_current_alpha),
+	(do_Cairo_current_tolerance), (do_Cairo_current_point),
+	(do_Cairo_current_fill_rule), (do_Cairo_current_line_width),
+	(do_Cairo_current_line_cap), (do_Cairo_current_line_join),
+	(do_Cairo_current_miter_limit):
+	* init.c: (make_typedef), (init_types), (EnumIntPart), (IntToEnum),
+	(nickle_init):
+	* text.c: (do_Cairo_select_font), (do_Cairo_text_extents),
+	(do_Cairo_select_ft_font):
+	Add a bunch more bindings.  Still more to do, especially the
+	path walkers.
+	Switch from int constants to enums for enumerated types.
+	
+	* gtk.c: (motion_notify_event), (button_press_event),
+	(button_release_event), (cairo_5c_window_new):
+	* surface.c: (do_Cairo_new):
+	Add mouse input support.
+
+	* examples/animate.5c:
+	* examples/cairo.5c:
+	* examples/draw.5c:
+	* examples/graph.5c:
+	* examples/pie.5c:
+	* examples/rottext.5c:
+	* examples/sin.5c:
+	* examples/test.5c:
+	Change examples to use cairo.5c file with autoimport
+	
 2004-12-14  Keith Packard  <keithp at keithp.com>
 
 	* cairo-5c.h:

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo-5c/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.am	14 Dec 2004 08:34:27 -0000	1.2
+++ Makefile.am	17 Dec 2004 02:09:45 -0000	1.3
@@ -33,14 +33,26 @@
 #       Keith Packard <keithp at keithp.com>
 #
 
+SUBDIRS = examples
+
 libcairo_5c_la_SOURCES = \
-	cairo-5c.h init.c \
+	cairo-5c.h \
 	draw.c \
+	event.c \
 	gstate.c \
-	surface.c \
 	gtk.c \
+	init.c \
+	surface.c \
 	text.c
 
+NICKLEFILES= cairo.5c
+
+EXTRA_DIST = $(NICKLEFILES) ChangeLog autogen.sh
+
+nicklelibdir=$(NICKLE_LIBDIR)
+
+nicklelib_DATA = $(NICKLEFILES)
+
 lib_LTLIBRARIES = libcairo-5c.la
 
 libcairo_5c_la_LIBADD = $(CAIRO_5C_LIBS)

Index: autogen.sh
===================================================================
RCS file: /cvs/cairo/cairo-5c/autogen.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- autogen.sh	11 Dec 2004 06:26:52 -0000	1.1.1.1
+++ autogen.sh	17 Dec 2004 02:09:45 -0000	1.2
@@ -1,3 +1,3 @@
 #! /bin/sh
-autoreconf -Wall -v --install || exit 1
+autoreconf -v --install || exit 1
 ./configure --enable-maintainer-mode "$@"

Index: cairo-5c.h
===================================================================
RCS file: /cvs/cairo/cairo-5c/cairo-5c.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo-5c.h	15 Dec 2004 07:04:50 -0000	1.3
+++ cairo-5c.h	17 Dec 2004 02:09:45 -0000	1.4
@@ -39,6 +39,8 @@
 #include <nickle/builtin.h>
 #define Atom XAtom
 #include <cairo.h>
+#include <stdio.h>
+#include <unistd.h>
 #undef Atom
 
 typedef enum { CAIRO_5C_WINDOW, CAIRO_5C_PNG } cairo_5c_kind_t;
@@ -48,6 +50,7 @@
     Pixmap	pixmap;
     int		width;
     int		height;
+    FILE	*send_events;
 } cairo_5c_x_t;
 
 typedef struct {
@@ -56,6 +59,7 @@
     int	    width;
     int	    height;
     Bool    dirty;
+    Value   recv_events;
     union {
 	struct {
 	    Pixmap	    pix;
@@ -67,7 +71,19 @@
     } u;
 } cairo_5c_t;
 
-extern Type	*typeTextExtents;
+extern Type		*typeCairo;
+extern Type		*typeCairoStatus;
+extern Type		*typeCairoOperator;
+extern Type		*typeCairoFillRule;
+extern Type		*typeCairoLineCap;
+extern Type		*typeCairoLineJoin;
+extern Type		*typeCairoFontSlant;
+extern Type		*typeCairoFontWeight;
+extern Type		*typeCairoTextExtents;
+extern Type		*typeCairoMatrix;
+extern Type		*typeCairoPoint;
+extern Type		*typeCairoRect;
+extern Type		*typeCairoRgbColor;
 
 /* surface.c */
 cairo_5c_t *
@@ -106,10 +122,20 @@
 Value
 do_Cairo_disable (Value cv);
 
+/* event.c */
+Value
+do_Cairo_open_event (Value cv);
+
 /* init.c */
 Value
 nickle_init (void);
 
+int
+EnumIntPart (Value ev, char *err);
+    
+Value
+IntToEnum (Type *type, int i);
+
 /* gstate.c */
 
 Value
@@ -119,6 +145,12 @@
 do_Cairo_restore (Value cv);
 
 Value
+do_Cairo_set_operator (Value cv, Value ov);
+
+Value
+do_Cairo_default_matrix (Value cv);
+
+Value
 do_Cairo_identity_matrix (Value cv);
 
 Value
@@ -131,6 +163,9 @@
 do_Cairo_set_tolerance (Value cv, Value tv);
 
 Value
+do_Cairo_set_fill_rule (Value cv, Value fv);
+
+Value
 do_Cairo_set_line_width (Value cv, Value lv);
 
 Value
@@ -140,6 +175,12 @@
 do_Cairo_set_line_join (Value cv, Value lv);
 
 Value
+do_Cairo_set_dash (Value cv, Value dv, Value ov);
+
+Value
+do_Cairo_set_miter_limit (Value cv, Value mv);
+
+Value
 do_Cairo_translate (Value cv, Value xv, Value yv);
 
 Value
@@ -154,6 +195,54 @@
 Value
 do_Cairo_set_matrix (Value cv, Value mv);
 
+Value
+do_Cairo_transform_point (Value cv, Value pv);
+
+Value
+do_Cairo_transform_distance (Value cv, Value pv);
+
+Value
+do_Cairo_inverse_transform_point (Value cv, Value pv);
+
+Value
+do_Cairo_inverse_transform_distance (Value cv, Value pv);
+
+Value
+do_Cairo_init_clip (Value cv);
+
+Value
+do_Cairo_clip (Value cv);
+
+Value
+do_Cairo_current_operator (Value cv);
+
+Value
+do_Cairo_current_rgb_color (Value cv);
+
+Value
+do_Cairo_current_alpha (Value cv);
+
+Value
+do_Cairo_current_tolerance (Value cv);
+
+Value
+do_Cairo_current_point (Value cv);
+
+Value
+do_Cairo_current_fill_rule (Value cv);
+
+Value
+do_Cairo_current_line_width (Value cv);
+
+Value
+do_Cairo_current_line_cap (Value cv);
+
+Value
+do_Cairo_current_line_join (Value cv);
+
+Value
+do_Cairo_current_miter_limit (Value cv);
+
 /* draw.c */
 Value
 do_Cairo_new_path (Value cv);
@@ -195,8 +284,10 @@
 		   Value x3v, Value y3v);
 
 Value
-do_Cairo_close_path (Value cv);
+do_Cairo_rectangle (Value cv, Value xv, Value yv, Value wv, Value hv);
 
+Value
+do_Cairo_close_path (Value cv);
 
 Value
 do_Cairo_fill (Value cv);
@@ -204,6 +295,24 @@
 Value
 do_Cairo_stroke (Value cv);
 
+Value
+do_Cairo_in_stroke (Value cv, Value xv, Value yv);
+
+Value
+do_Cairo_in_fill (Value cv, Value xv, Value yv);
+
+Value
+do_Cairo_stroke_extents (Value cv);
+
+Value
+do_Cairo_fill_extents (Value cv);
+
+Value
+do_Cairo_current_path (Value cv, Value mv, Value lv, Value cuv, Value clp);
+
+Value
+do_Cairo_current_path_flat (Value cv, Value mv, Value lv, Value np);
+
 /* text.c */
 Value
 do_Cairo_select_font (Value cv, Value fv, Value sv, Value wv);
@@ -220,6 +329,9 @@
 Value
 do_Cairo_text_extents (Value cv, Value uv);
     
+Value
+do_Cairo_select_ft_font (Value pv);
+
 /* gtk+.c */
 cairo_5c_x_t *
 start_x (int width, int height);

--- NEW FILE: cairo.5c ---
(This appears to be a binary file; contents omitted.)

Index: configure.in
===================================================================
RCS file: /cvs/cairo/cairo-5c/configure.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- configure.in	14 Dec 2004 08:34:27 -0000	1.2
+++ configure.in	17 Dec 2004 02:09:45 -0000	1.3
@@ -5,6 +5,8 @@
 AM_INIT_AUTOMAKE(cairo-5c, 0.0.0)
 AM_MAINTAINER_MODE
 
+dnl libtool versioning
+
 LT_CURRENT=0
 LT_REVISION=0
 AC_SUBST(LT_CURRENT)
@@ -17,12 +19,18 @@
 LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
 AC_SUBST(LT_CURRENT_MINUS_AGE)
 
-AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_HEADER(config.h)
 
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_LN_S
-AM_PROG_LIBTOOL
+AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL
+AC_PROG_MAKE_SET
+
+NICKLE_LIBDIR=`nickle -e 'printf ("%s\n", Command::nickle_libdir);'`
+
+AC_SUBST(NICKLE_LIBDIR)
 
 WARN_CFLAGS=""
 
@@ -37,5 +45,8 @@
 
 PKG_CHECK_MODULES(CAIRO_5C, $CAIRO_5C_PC_MODULES)
 
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile
+		 examples/Makefile
+		])
+		
 AC_OUTPUT

Index: draw.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/draw.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- draw.c	14 Dec 2004 08:34:27 -0000	1.2
+++ draw.c	17 Dec 2004 02:09:45 -0000	1.3
@@ -167,6 +167,20 @@
 }
 
 Value
+do_Cairo_rectangle (Value cv, Value xv, Value yv, Value wv, Value hv)
+{
+    cairo_5c_t	*c5c = get_cairo_5c (cv);
+    double	x = DoublePart (xv, "invalid x value");
+    double	y = DoublePart (yv, "invalid y value");
+    double	w = DoublePart (wv, "invalid width value");
+    double	h = DoublePart (hv, "invalid height value");
+    
+    if (!aborting)
+	cairo_rectangle (c5c->cr, x, y, w, h);
+    return Void;
+}
+
+Value
 do_Cairo_close_path (Value cv)
 {
     cairo_5c_t	*c5c = get_cairo_5c (cv);
@@ -200,3 +214,92 @@
     }
     return Void;
 }
+
+Value
+do_Cairo_in_stroke (Value cv, Value xv, Value yv)
+{
+    cairo_5c_t	*c5c = get_cairo_5c (cv);
+    double	x = DoublePart (xv, "invalid X value");
+    double	y = DoublePart (yv, "invalid Y value");
+
+    if (aborting)
+	return Void;
+    
+    return cairo_in_stroke (c5c->cr, x, y) ? TrueVal : FalseVal;
+}
+
+Value
+do_Cairo_in_fill (Value cv, Value xv, Value yv)
+{
+    cairo_5c_t	*c5c = get_cairo_5c (cv);
+    double	x = DoublePart (xv, "invalid X value");
+    double	y = DoublePart (yv, "invalid Y value");
+
+    if (aborting)
+	return Void;
+    
+    return cairo_in_fill (c5c->cr, x, y) ? TrueVal : FalseVal;
+}
+
+Value
+do_Cairo_stroke_extents (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	*c5c = get_cairo_5c (cv);
+    double	x, y, w, h;
+    Value	ret;
+    static int	dims[2] = { 2, 2 };
+    
+    if (aborting)
+	RETURN(Void);
+    cairo_stroke_extents (c5c->cr, &x, &y, &w, &h);
+    ret = NewArray (False, False, typePrim[rep_float], 2, dims);
+    ArrayValueSet(&ret->array, 0, NewDoubleFloat (x));
+    ArrayValueSet(&ret->array, 1, NewDoubleFloat (y));
+    ArrayValueSet(&ret->array, 2, NewDoubleFloat (w));
+    ArrayValueSet(&ret->array, 3, NewDoubleFloat (h));
+    RETURN (ret);
+}
+
+Value
+do_Cairo_fill_extents (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	*c5c = get_cairo_5c (cv);
+    double	x, y, w, h;
+    Value	ret;
+    static int	dims[2] = { 2, 2 };
+    
+    if (aborting)
+	RETURN(Void);
+    cairo_fill_extents (c5c->cr, &x, &y, &w, &h);
+    ret = NewArray (False, False, typePrim[rep_float], 2, dims);
+    ArrayValueSet(&ret->array, 0, NewDoubleFloat (x));
+    ArrayValueSet(&ret->array, 1, NewDoubleFloat (y));
+    ArrayValueSet(&ret->array, 2, NewDoubleFloat (w));
+    ArrayValueSet(&ret->array, 3, NewDoubleFloat (h));
+    RETURN (ret);
+}
+
+#if 0
+static void
+cairo_5c_move_to (void *closure, double x, double y)
+{
+    ENTER ();
+    EXIT ();
+}
+#endif
+
+Value
+do_Cairo_current_path (Value cv, Value mv, Value lv, Value cuv, Value clp)
+{
+    /* XXX */
+    return Void;
+}
+
+Value
+do_Cairo_current_path_flat (Value cv, Value mv, Value lv, Value clp)
+{
+    /* XXX */
+    return Void;
+}

Index: gstate.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/gstate.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gstate.c	14 Dec 2004 08:34:27 -0000	1.2
+++ gstate.c	17 Dec 2004 02:09:45 -0000	1.3
@@ -54,6 +54,17 @@
 }
 
 Value
+do_Cairo_set_operator (Value cv, Value ov)
+{
+    cairo_5c_t	*c5c = get_cairo_5c (cv);
+    int		o = EnumIntPart (ov, "invalid operator");
+
+    if (!aborting)
+	cairo_set_operator (c5c->cr, o);
+    return Void;
+}
+
+Value
 do_Cairo_set_rgb_color (Value cv, Value rv, Value gv, Value bv)
 {
     cairo_5c_t	*c5c = get_cairo_5c (cv);
@@ -89,6 +100,17 @@
 }
 
 Value
+do_Cairo_set_fill_rule (Value cv, Value fv)
+{
+    cairo_5c_t	*c5c = get_cairo_5c (cv);
+    int		f = EnumIntPart (fv, "invalid fill rule");
+
+    if (!aborting)
+	cairo_set_fill_rule (c5c->cr, f);
+    return Void;
+}
+
+Value
 do_Cairo_set_line_width (Value cv, Value lv)
 {
     cairo_5c_t	*c5c = get_cairo_5c (cv);
@@ -103,7 +125,7 @@
 do_Cairo_set_line_cap (Value cv, Value lv)
 {
     cairo_5c_t		*c5c = get_cairo_5c (cv);
-    cairo_line_cap_t	l = IntPart (lv, "invalid line_cap");
+    cairo_line_cap_t	l = EnumIntPart (lv, "invalid line_cap");
 
     if (!aborting)
 	cairo_set_line_cap (c5c->cr, l);
@@ -114,7 +136,7 @@
 do_Cairo_set_line_join (Value cv, Value lv)
 {
     cairo_5c_t		*c5c = get_cairo_5c (cv);
-    cairo_line_join_t	l = IntPart (lv, "invalid line_join");
+    cairo_line_join_t	l = EnumIntPart (lv, "invalid line_join");
 
     if (!aborting)
 	cairo_set_line_join (c5c->cr, l);
@@ -122,6 +144,39 @@
 }
 
 Value
+do_Cairo_set_dash (Value cv, Value dv, Value ov)
+{
+    ENTER ();
+    cairo_5c_t		*c5c = get_cairo_5c (cv);
+    double		o = DoublePart (ov, "invalid dash offset");
+    int			ndash = ArrayLimits (&dv->array)[0];
+    double		*d = AllocateTemp (ndash * sizeof (double));
+    int			i;
+
+    if (aborting)
+	RETURN (Void);
+    for (i = 0; i < ndash; i++)
+    {
+	d[i] = DoublePart (ArrayValueGet(&dv->array, i), "invalid dash length");
+	if (aborting)
+	    RETURN (Void);
+    }
+    cairo_set_dash (c5c->cr, d, ndash, o);
+    RETURN(Void);
+}
+
+Value
+do_Cairo_set_miter_limit (Value cv, Value mv)
+{
+    cairo_5c_t		*c5c = get_cairo_5c (cv);
+    double		m = DoublePart (mv, "invalid miter limit");
+    
+    if (!aborting)
+	cairo_set_miter_limit (c5c->cr, m);
+    return Void;
+}
+
+Value
 do_Cairo_identity_matrix (Value cv)
 {
     cairo_5c_t		*c5c = get_cairo_5c (cv);
@@ -131,6 +186,17 @@
 }
 
 Value
+do_Cairo_default_matrix (Value cv)
+{
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+
+    if (aborting)
+	return Void;
+    cairo_default_matrix (c5c->cr);
+    return Void;
+}
+    
+Value
 do_Cairo_translate (Value cv, Value xv, Value yv)
 {
     cairo_5c_t	*c5c = get_cairo_5c (cv);
@@ -231,3 +297,230 @@
     RETURN (Void);
 }
 
+Value
+do_Cairo_transform_point (Value cv, Value pv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    double	    x, y;
+    Value	    ret;
+    static int	dims[1] = { 2 };
+
+    if (aborting)
+	RETURN(Void);
+    
+    x = DoublePart (ArrayValueGet (&pv->array, 0), "invalid coordinate");
+    y = DoublePart (ArrayValueGet (&pv->array, 1), "invalid coordinate");
+    cairo_transform_point (c5c->cr, &x, &y);
+    ret = NewArray (False, False, typePrim[rep_float], 1, dims);
+    ArrayValueSet(&ret->array, 0, NewDoubleFloat (x));
+    ArrayValueSet(&ret->array, 1, NewDoubleFloat (y));
+    RETURN (ret);
+}
+
+Value
+do_Cairo_transform_distance (Value cv, Value pv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    double	    x, y;
+    Value	    ret;
+    static int	dims[1] = { 2 };
+
+    if (aborting)
+	RETURN(Void);
+    
+    x = DoublePart (ArrayValueGet (&pv->array, 0), "invalid coordinate");
+    y = DoublePart (ArrayValueGet (&pv->array, 1), "invalid coordinate");
+    cairo_transform_distance (c5c->cr, &x, &y);
+    ret = NewArray (False, False, typePrim[rep_float], 1, dims);
+    ArrayValueSet(&ret->array, 0, NewDoubleFloat (x));
+    ArrayValueSet(&ret->array, 1, NewDoubleFloat (y));
+    RETURN (ret);
+}
+
+Value
+do_Cairo_inverse_transform_point (Value cv, Value pv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    double	    x, y;
+    Value	    ret;
+    static int	dims[1] = { 2 };
+
+    if (aborting)
+	RETURN(Void);
+    
+    x = DoublePart (ArrayValueGet (&pv->array, 0), "invalid coordinate");
+    y = DoublePart (ArrayValueGet (&pv->array, 1), "invalid coordinate");
+    cairo_inverse_transform_point (c5c->cr, &x, &y);
+    ret = NewArray (False, False, typePrim[rep_float], 1, dims);
+    ArrayValueSet(&ret->array, 0, NewDoubleFloat (x));
+    ArrayValueSet(&ret->array, 1, NewDoubleFloat (y));
+    RETURN (ret);
+}
+
+Value
+do_Cairo_inverse_transform_distance (Value cv, Value pv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    double	    x, y;
+    Value	    ret;
+    static int	dims[1] = { 2 };
+
+    if (aborting)
+	RETURN(Void);
+    
+    x = DoublePart (ArrayValueGet (&pv->array, 0), "invalid coordinate");
+    y = DoublePart (ArrayValueGet (&pv->array, 1), "invalid coordinate");
+    cairo_inverse_transform_distance (c5c->cr, &x, &y);
+    ret = NewArray (False, False, typePrim[rep_float], 1, dims);
+    ArrayValueSet(&ret->array, 0, NewDoubleFloat (x));
+    ArrayValueSet(&ret->array, 1, NewDoubleFloat (y));
+    RETURN (ret);
+}
+
+Value
+do_Cairo_init_clip (Value cv)
+{
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    if (!aborting)
+	cairo_init_clip (c5c->cr);
+    return Void;
+}
+
+Value
+do_Cairo_clip (Value cv)
+{
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    if (!aborting)
+	cairo_clip (c5c->cr);
+    return Void;
+}
+
+Value
+do_Cairo_current_operator (Value cv)
+{
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    
+    if (aborting)
+	return Void;
+    return IntToEnum (typeCairoOperator, cairo_current_operator (c5c->cr));
+}
+
+Value
+do_Cairo_current_rgb_color (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    double	    r, g, b;
+    Value	    ret;
+    BoxPtr	    box;
+    
+    if (aborting)
+	return Void;
+    cairo_current_rgb_color (c5c->cr, &r, &g, &b);
+    ret = NewStruct (TypeCanon (typeCairoRgbColor)->structs.structs, False);
+    box = ret->structs.values;
+    BoxValueSet (box, 0, NewDoubleFloat (r));
+    BoxValueSet (box, 1, NewDoubleFloat (g));
+    BoxValueSet (box, 2, NewDoubleFloat (b));
+    RETURN (ret);
+}
+
+Value
+do_Cairo_current_alpha (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    
+    if (aborting)
+	RETURN(Void);
+    RETURN (NewDoubleFloat (cairo_current_alpha (c5c->cr)));
+}
+
+Value
+do_Cairo_current_tolerance (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    
+    if (aborting)
+	RETURN(Void);
+    RETURN (NewDoubleFloat (cairo_current_tolerance (c5c->cr)));
+}
+
+Value
+do_Cairo_current_point (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    double	    x, y;
+    Value	    ret;
+    BoxPtr	    box;
+    
+    if (aborting)
+	return Void;
+    cairo_current_point (c5c->cr, &x, &y);
+    ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False);
+    box = ret->structs.values;
+    BoxValueSet (box, 0, NewDoubleFloat (x));
+    BoxValueSet (box, 1, NewDoubleFloat (y));
+    RETURN (ret);
+}
+
+Value
+do_Cairo_current_fill_rule (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    
+    if (aborting)
+	RETURN(Void);
+    RETURN(IntToEnum (typeCairoFillRule, cairo_current_fill_rule (c5c->cr)));
+}
+
+Value
+do_Cairo_current_line_width (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    
+    if (aborting)
+	RETURN(Void);
+    RETURN(NewDoubleFloat (cairo_current_line_width (c5c->cr)));
+}
+
+Value
+do_Cairo_current_line_cap (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    
+    if (aborting)
+	RETURN(Void);
+    RETURN(IntToEnum (typeCairoLineCap, cairo_current_line_cap (c5c->cr)));
+}
+
+Value
+do_Cairo_current_line_join (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    
+    if (aborting)
+	RETURN(Void);
+    RETURN(IntToEnum (typeCairoLineJoin, cairo_current_line_join (c5c->cr)));
+}
+
+Value
+do_Cairo_current_miter_limit (Value cv)
+{
+    ENTER ();
+    cairo_5c_t	    *c5c = get_cairo_5c (cv);
+    
+    if (aborting)
+	RETURN(Void);
+    RETURN(NewDoubleFloat (cairo_current_miter_limit (c5c->cr)));
+}

Index: gtk.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/gtk.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gtk.c	15 Dec 2004 07:04:50 -0000	1.2
+++ gtk.c	17 Dec 2004 02:09:45 -0000	1.3
@@ -95,6 +95,50 @@
     return FALSE;
 }
 
+static gboolean
+motion_notify_event( GtkWidget *widget, GdkEventMotion *event )
+{
+    cairo_5c_gtk_t	*c5cg = GTK_DRAWING_AREA (widget)->draw_data;
+    
+    if (c5cg->x.send_events)
+    {
+	fprintf (c5cg->x.send_events, "%d motion %g %g\n",
+		 event->time, event->x, event->y);
+	fflush (c5cg->x.send_events);
+    }
+    return FALSE;
+}
+
+
+static gboolean
+button_press_event( GtkWidget *widget, GdkEventButton *event )
+{
+    cairo_5c_gtk_t	*c5cg = GTK_DRAWING_AREA (widget)->draw_data;
+    
+    if (c5cg->x.send_events)
+    {
+	fprintf (c5cg->x.send_events, "%d press %d %g %g\n",
+		 event->time, event->button, event->x, event->y);
+	fflush (c5cg->x.send_events);
+    }
+    return FALSE;
+}
+
+static gboolean
+button_release_event( GtkWidget *widget, GdkEventButton *event )
+{
+    cairo_5c_gtk_t	*c5cg = GTK_DRAWING_AREA (widget)->draw_data;
+    
+    if (c5cg->x.send_events)
+    {
+	fprintf (c5cg->x.send_events, "%d release %d %g %g\n",
+		 event->time, event->button, event->x, event->y);
+	fflush (c5cg->x.send_events);
+    }
+    return FALSE;
+}
+
+
 static cairo_5c_gtk_t *
 cairo_5c_window_new (int width, int height)
 {
@@ -102,6 +146,7 @@
     Display		*dpy;
 
     c5cg->pixmap = 0;
+    c5cg->x.send_events = 0;
     c5cg->x.dpy = gdk_x11_get_default_xdisplay ();
     dpy = c5cg->x.dpy;
     if (!width)
@@ -122,18 +167,18 @@
 		      (GtkSignalFunc) expose_event, NULL);
     g_signal_connect (GTK_OBJECT(c5cg->drawing_area),"configure_event",
 		      (GtkSignalFunc) configure_event, NULL);
-#if 0
-    gtk_signal_connect (GTK_OBJECT (c5cg->drawing_area), "motion_notify_event",
-			(GtkSignalFunc) motion_notify_event, NULL);
-    gtk_signal_connect (GTK_OBJECT (c5cg->drawing_area), "button_press_event",
-			(GtkSignalFunc) button_press_event, NULL);
-#endif
+    g_signal_connect (GTK_OBJECT (c5cg->drawing_area), "motion_notify_event",
+		      (GtkSignalFunc) motion_notify_event, NULL);
+    g_signal_connect (GTK_OBJECT (c5cg->drawing_area), "button_press_event",
+		      (GtkSignalFunc) button_press_event, NULL);
+    g_signal_connect (GTK_OBJECT (c5cg->drawing_area), "button_release_event",
+		      (GtkSignalFunc) button_release_event, NULL);
 
     gtk_widget_set_events (c5cg->drawing_area, GDK_EXPOSURE_MASK
 			   | GDK_LEAVE_NOTIFY_MASK
 			   | GDK_BUTTON_PRESS_MASK
-			   | GDK_POINTER_MOTION_MASK
-			   | GDK_POINTER_MOTION_HINT_MASK);
+			   | GDK_BUTTON_RELEASE_MASK
+			   | GDK_POINTER_MOTION_MASK);
 
     gtk_widget_realize (c5cg->window);
     gtk_widget_realize (c5cg->drawing_area);

Index: init.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/init.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- init.c	15 Dec 2004 07:04:50 -0000	1.4
+++ init.c	17 Dec 2004 02:09:45 -0000	1.5
@@ -36,248 +36,543 @@
 #include "cairo-5c.h"
 
 NamespacePtr	CairoNamespace;
-Type		*typeTextExtents;
+Type		*typeCairo;
+Type		*typeCairoStatus;
+Type		*typeCairoOperator;
+Type		*typeCairoFillRule;
+Type		*typeCairoLineCap;
+Type		*typeCairoLineJoin;
+Type		*typeCairoFontSlant;
+Type		*typeCairoFontWeight;
+Type		*typeCairoTextExtents;
+Type		*typeCairoMatrix;
+Type		*typeCairoPoint;
+Type		*typeCairoRect;
+Type		*typeCairoRgbColor;
+
+#define CAIRO_I		0
+#define CAIRO_S		"00"
+#define STATUS_I	1
+#define STATUS_S	"01"
+#define OPERATOR_I	2
+#define OPERATOR_S	"02"
+#define FILL_RULE_I	3
+#define FILL_RULE_S	"03"
+#define LINE_CAP_I	4
+#define LINE_CAP_S	"04"
+#define LINE_JOIN_I	5
+#define LINE_JOIN_S	"05"
+#define FONT_SLANT_I	6
+#define FONT_SLANT_S	"06"
+#define FONT_WEIGHT_I	7
+#define FONT_WEIGHT_S	"07"
+#define	TEXT_EXTENTS_I	8
+#define TEXT_EXTENTS_S	"08"
+#define MATRIX_I	9
+#define MATRIX_S	"09"
+#define POINT_I		10
+#define POINT_S		"10"
+#define RECT_I		11
+#define RECT_S		"11"
+#define RGB_COLOR_I	12
+#define RGB_COLOR_S	"12"
+
+static Type *
+make_typedef (char  *name_str,
+	      int   usertype_id,
+	      Type  *type)
+{
+    ENTER ();
+    Atom    name = AtomId (name_str);
+    Symbol  *sym = NewSymbolType (name, type);
+    Type    *typed = NewTypeName (NewExprAtom (name, 0, False),
+				  sym);
+    
+    NamespaceAddName (CairoNamespace, sym, publish_public);
+    
+    BuiltinSetUserdefType (typed, usertype_id);
+    MemAddRoot (typed);
+    RETURN (typed);
+}
+
+static void
+init_types (void)
+{
+    ENTER ();
+
+    CairoNamespace = BuiltinNamespace (/* parent */ 0, "Cairo")->namespace.namespace;
+
+    typeCairo = make_typedef ("cairo_t",
+			      CAIRO_I,
+			      typePrim[rep_foreign]);
+
+    typeCairoStatus = make_typedef ("status_t",
+				    STATUS_I,
+				    BuildEnumType (8,
+						   "SUCCESS",
+						   "NO_MEMORY",
+						   "INVALID_RESTORE",
+						   "INVALID_POP_GROUP",
+						   "NO_CURRENT_POINT",
+						   "INVALID_MATRIX",
+						   "NO_TARGET_SURFACE",
+						   "NULL_POINTER"));
+    typeCairoOperator = make_typedef ("operator_t",
+				      OPERATOR_I,
+				      BuildEnumType (14,
+						     "CLEAR",
+						     "SRC",
+						     "DST",
+						     "OVER",
+						     "OVER_REVERSE",
+						     "IN",
+						     "IN_REVERSE",
+						     "OUT",
+						     "OUT_REVERSE",
+						     "ATOP",
+						     "ATOP_REVERSE",
+						     "XOR",
+						     "ADD",
+						     "SATURATE"));
+
+    typeCairoFillRule = make_typedef ("fill_rule_t",
+				      FILL_RULE_I,
+				      BuildEnumType (2,
+						     "WINDING",
+						     "EVEN_ODD"));
+
+    typeCairoLineCap = make_typedef ("line_cap_t",
+				     LINE_CAP_I,
+				     BuildEnumType (3,
+						    "BUTT",
+						    "ROUND",
+						    "SQUARE"));
+
+    typeCairoLineJoin = make_typedef ("line_join_t",
+				      LINE_JOIN_I,
+				      BuildEnumType (3,
+						     "MITER",
+						     "ROUND",
+						     "BEVEL"));
+
+    typeCairoFontSlant = make_typedef ("font_slant_t",
+				       FONT_SLANT_I,
+				       BuildEnumType (3,
+						      "NORMAL",
+						      "ITALIC",
+						      "OBLIQUE"));
+    typeCairoFontWeight = make_typedef ("font_weight_t",
+					FONT_WEIGHT_I,
+					BuildEnumType (2,
+						       "NORMAL",
+						       "BOLD"));
+
+    typeCairoTextExtents = make_typedef ("text_extents_t",
+					 TEXT_EXTENTS_I,
+					 BuildStructType (6, 
+							  typePrim[rep_float], "x_bearing",
+							  typePrim[rep_float], "y_bearing",
+							  typePrim[rep_float], "width",
+							  typePrim[rep_float], "height",
+							  typePrim[rep_float], "x_advance",
+							  typePrim[rep_float], "y_advance"));
+    typeCairoMatrix = make_typedef ("matrix_t",
+				    MATRIX_I,
+				    BuildArrayType (typePrim[rep_float],
+						    2, 2, 3));
+
+    typeCairoPoint = make_typedef ("point_t",
+				   POINT_I,
+				   BuildStructType (2,
+						    typePrim[rep_float], "x",
+						    typePrim[rep_float], "y"));
+
+    typeCairoRect = make_typedef ("rect_t",
+				  RECT_I,
+				  BuildStructType (4,
+						   typePrim[rep_float], "x",
+						   typePrim[rep_float], "y",
+						   typePrim[rep_float], "width",
+						   typePrim[rep_float], "height"));
+
+    typeCairoRgbColor = make_typedef ("rgb_color_t",
+				      RGB_COLOR_I,
+				      BuildStructType (3,
+						       typePrim[rep_float], "red",
+						       typePrim[rep_float], "green",
+						       typePrim[rep_float], "blue"));
+    
+    EXIT();
+}
+
+int
+EnumIntPart (Value ev, char *err)
+{
+    Union	*u = &ev->unions;
+    StructType	*st = u->type;
+    int		i;
+
+    for (i = 0; i < st->nelements; i++)
+	if (StructTypeAtoms(st)[i] == u->tag)
+	    return i;
+    RaiseStandardException (exception_invalid_argument,
+			    err,
+			    2, ev);
+    return -1;
+}
+
+Value
+IntToEnum (Type *type, int i)
+{
+    ENTER ();
+    Type	*ctype = TypeCanon (type);
+    StructType	*st = ctype->structs.structs;
+    Value	v = NewUnion (st, False);
+
+    if (i < 0 || st->nelements <= i)
+    {
+	RaiseStandardException (exception_invalid_argument,
+				"invalid enum index",
+				2, NewInt (i), v);
+	RETURN (Void);
+    }
+    
+    v->unions.tag = StructTypeAtoms(st)[i];
+    BoxValueSet (v->unions.value, 0, Void);
+    RETURN (v);
+}
 
 Value
 nickle_init (void)
 {
     ENTER ();
     static const struct fbuiltin_v funcs_v[] = {
-	{ do_Cairo_new, "new", "F", ".i", "\n"
-	    " foreign new (int...)\n"
+	{ do_Cairo_new, "new", CAIRO_S, ".i", "\n"
+	    " cairo_t new (int...)\n"
 	    "\n"
 	    " Create a cairo window. Optional arguments are width, height\n" },
 	{ 0 }
     };
 	
     static const struct fbuiltin_1 funcs_1[] = {
-	{ do_Cairo_width, "width", "i", "F", "\n"
-	    " void width (foreign cairo)\n"
+	{ do_Cairo_width, "width", "i", CAIRO_S, "\n"
+	    " void width (cairo_t cairo)\n"
 	    "\n"
 	    " Return the width of a cairo surface\n" },
-	{ do_Cairo_height, "height", "i", "F", "\n"
-	    " void height (foreign cairo)\n"
+	{ do_Cairo_height, "height", "i", CAIRO_S, "\n"
+	    " void height (cairo_t cairo)\n"
 	    "\n"
 	    " Return the height of a cairo surface\n" },
-	{ do_Cairo_status, "status", "i", "F", "\n"
-	    " void status (foreign cairo)\n"
+	{ do_Cairo_status, "status", STATUS_S, CAIRO_S, "\n"
+	    " void status (cairo_t cairo)\n"
 	    "\n"
 	    " Return the status of a cairo surface\n" },
-	{ do_Cairo_status_string, "status_string", "s", "F", "\n"
-	    " void status_string (foreign cairo)\n"
+	{ do_Cairo_status_string, "status_string", "s", CAIRO_S, "\n"
+	    " void status_string (cairo_t cairo)\n"
 	    "\n"
 	    " Return the status string of a cairo surface\n" },
-	{ do_Cairo_dispose, "dispose", "v", "F", "\n"
-	    " void dispose (foreign cairo)\n"
+	{ do_Cairo_dispose, "dispose", "v", CAIRO_S, "\n"
+	    " void dispose (cairo_t cairo)\n"
 	    "\n"
 	    " Dispose a cairo surface\n" },
-	{ do_Cairo_enable, "enable", "v", "F", "\n"
-	    " void enable (foreign cairo)\n"
+	{ do_Cairo_enable, "enable", "v", CAIRO_S, "\n"
+	    " void enable (cairo_t cairo)\n"
 	    "\n"
 	    " Enable screen updates from a cairo surface\n" },
-	{ do_Cairo_disable, "disable", "v", "F", "\n"
-	    " void disable (foreign cairo)\n"
+	{ do_Cairo_disable, "disable", "v", CAIRO_S, "\n"
+	    " void disable (cairo_t cairo)\n"
 	    "\n"
 	    " Disable screen updates from a cairo surface\n" },
-	{ do_Cairo_save, "save", "v", "F", "\n"
-	    " void save (foreign cairo)\n"
+	{ do_Cairo_save, "save", "v", CAIRO_S, "\n"
+	    " void save (cairo_t cairo)\n"
 	    "\n"
 	    " Save graphics state\n" },
-	{ do_Cairo_restore, "restore", "v", "F", "\n"
-	    " void restore (foreign cairo)\n"
+	{ do_Cairo_restore, "restore", "v", CAIRO_S, "\n"
+	    " void restore (cairo_t cairo)\n"
 	    "\n"
 	    " Restore graphics state\n" },
-	{ do_Cairo_identity_matrix, "identity_matrix", "v", "F", "\n"
-	    " void identity_matrix (foreign cairo)\n"
+	{ do_Cairo_identity_matrix, "identity_matrix", "v", CAIRO_S, "\n"
+	    " void identity_matrix (cairo_t cairo)\n"
 	    "\n"
 	    " Set transformation matrix to identity\n" },
-	{ do_Cairo_new_path, "new_path", "v", "F", "\n"
-	    " void new_path (foreign cairo)\n"
+	{ do_Cairo_default_matrix, "default_matrix", "v", CAIRO_S, "\n"
+	    " void default_matrix (cairo_t cairo)\n"
+	    "\n"
+	    " Set transformation matrix to default\n" },
+	{ do_Cairo_new_path, "new_path", "v", CAIRO_S, "\n"
+	    " void new_path (cairo_t cairo)\n"
 	    "\n"
 	    " Starts a new path\n" },
-	{ do_Cairo_close_path, "close_path", "v", "F", "\n"
-	    " void close_path (foreign cairo)\n"
+	{ do_Cairo_close_path, "close_path", "v", CAIRO_S, "\n"
+	    " void close_path (cairo_t cairo)\n"
 	    "\n"
 	    " Closes the current path\n" },
-	{ do_Cairo_fill, "fill", "v", "F", "\n"
-	    " void fill (foreign cairo)\n"
+	{ do_Cairo_fill, "fill", "v", CAIRO_S, "\n"
+	    " void fill (cairo_t cairo)\n"
 	    "\n"
 	    " Fill the current path\n" },
-	{ do_Cairo_stroke, "stroke", "v", "F", "\n"
-	    " void stroke (foreign cairo)\n"
+	
+	{ do_Cairo_stroke, "stroke", "v", CAIRO_S, "\n"
+	    " void stroke (cairo_t cairo)\n"
 	    "\n"
 	    " Stroke the current path\n" },
-	{ do_Cairo_current_matrix, "current_matrix", "A**n", "F", "\n"
-	    " real[3,2] current_matrix (foreign cairo)\n"
+	
+	{ do_Cairo_init_clip, "init_clip", "v", CAIRO_S, "\n"
+	    " void init_clip (cairo_t cairo)\n"
+	    "\n"
+	    " Resets clip list to whole surface\n" },
+	
+	{ do_Cairo_clip, "clip", "v", CAIRO_S, "\n"
+	    " void clip (cairo_t cairo)\n"
+	    "\n"
+	    " Clip to current path.  Does not empty path.\n" },
+
+	{ do_Cairo_stroke_extents, "stroke_extents", RECT_S, CAIRO_S, "\n"
+	    " rect_t stroke_extents (cairo_t cairo)\n"
+	    "\n"
+	    " Returns bounding box of stroking current path\n" },
+	
+	{ do_Cairo_fill_extents, "fill_extents", RECT_S, CAIRO_S, "\n"
+	    " rect_t fill_extents (cairo_t cairo)\n"
+	    "\n"
+	    " Returns bounding box of filling current path\n" },
+	
+	{ do_Cairo_current_operator, "current_operator", OPERATOR_S, CAIRO_S, "\n"
+	    " operator_t current_operator (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current operator\n" },
+	
+	{ do_Cairo_current_rgb_color, "current_rgb_color", RGB_COLOR_S, CAIRO_S, "\n"
+	    " rgb_color_t current_rgb_color (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current rgb color\n" },
+	
+	{ do_Cairo_current_alpha, "current_alpha", "n", CAIRO_S, "\n"
+	    " real current_alpha (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current alpha\n" },
+	
+	{ do_Cairo_current_tolerance, "current_tolerance", "n", CAIRO_S, "\n"
+	    " real current_tolerance (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current tolerance\n" },
+	
+	{ do_Cairo_current_point, "current_point", RGB_COLOR_S, CAIRO_S, "\n"
+	    " point_t current_point (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current point\n" },
+	
+	{ do_Cairo_current_fill_rule, "current_fill_rule", FILL_RULE_S, CAIRO_S, "\n"
+	    " fill_rule_t current_fill_rule (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current fill rule\n" },
+	
+	{ do_Cairo_current_line_width, "current_line_width", "n", CAIRO_S, "\n"
+	    " real current_line_width (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current line width\n" },
+	
+	{ do_Cairo_current_line_cap, "current_line_cap", LINE_CAP_S, CAIRO_S, "\n"
+	    " line_cap_t current_line_cap (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current line_cap\n" },
+	
+	{ do_Cairo_current_line_join, "current_line_join", LINE_JOIN_S, CAIRO_S, "\n"
+	    " line_join_t current_line_join (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current line join\n" },
+	
+	{ do_Cairo_current_miter_limit, "current_miter_limit", "n", CAIRO_S, "\n"
+	    " real current_miter_limit (cairo_t cairo)\n"
+	    "\n"
+	    " Returns the current miter limit\n" },
+	
+	{ do_Cairo_current_matrix, "current_matrix", MATRIX_S, CAIRO_S, "\n"
+	    " matrix_t current_matrix (cairo_t cairo)\n"
 	    "\n"
 	    " Returns the current transformation matrix\n" },
+	
+	{ do_Cairo_open_event, "open_event", "f", CAIRO_S, "\n"
+	    " file open_event (cairo_t cairo)\n"
+	    "\n"
+	    " Returns a file which will receive events\n" },
 	{ 0 }
     };
     
     static const struct fbuiltin_2 funcs_2[] = {
-	{ do_Cairo_set_alpha, "set_alpha", "v", "Fn", "\n"
-	    " void set_alpha (foreign cr, real alpha)\n"
+	{ do_Cairo_set_operator, "set_alpha", "v", CAIRO_S OPERATOR_S, "\n"
+	    " void set_operator (cairo_t cr, operator_t operator)\n"
+	    "\n"
+	    " Set current operator\n" },
+	{ do_Cairo_set_alpha, "set_alpha", "v", CAIRO_S "n", "\n"
+	    " void set_alpha (cairo_t cr, real alpha)\n"
 	    "\n"
 	    " Set current alpha\n" },
-	{ do_Cairo_set_tolerance, "set_tolerance", "v", "Fn", "\n"
-	    " void set_tolerance (foreign cr, real alpha)\n"
+	{ do_Cairo_set_tolerance, "set_tolerance", "v", CAIRO_S "n", "\n"
+	    " void set_tolerance (cairo_t cr, real alpha)\n"
 	    "\n"
 	    " Set current tolerance\n" },
-	{ do_Cairo_set_line_width, "set_line_width", "v", "Fn", "\n"
-	    " void set_line_width (foreign cr, real alpha)\n"
+	{ do_Cairo_set_fill_rule, "set_fill_rule", "v", CAIRO_S FILL_RULE_S, "\n"
+	    " void set_fill_rule (cairo_t cr, fill_rule_t rule)\n"
+	    "\n"
+	    " Set current fill rule\n" },
+	{ do_Cairo_set_line_width, "set_line_width", "v", CAIRO_S "n", "\n"
+	    " void set_line_width (cairo_t cr, real alpha)\n"
 	    "\n"
 	    " Set current line width\n" },
-	{ do_Cairo_set_line_cap, "set_line_cap", "v", "Fi", "\n"
-	    " void set_line_cap (foreign cr, int cap)\n"
+	{ do_Cairo_set_line_cap, "set_line_cap", "v", CAIRO_S LINE_CAP_S, "\n"
+	    " void set_line_cap (cairo_t cr, line_cap_t cap)\n"
 	    "\n"
 	    " Set current line cap style\n" },
-	{ do_Cairo_set_line_join, "set_line_join", "v", "Fi", "\n"
-	    " void set_line_join (foreign cr, int join)\n"
+	{ do_Cairo_set_line_join, "set_line_join", "v", CAIRO_S LINE_JOIN_S, "\n"
+	    " void set_line_join (cairo_t cr, line_join_t join)\n"
 	    "\n"
 	    " Set current line join style\n" },
-	{ do_Cairo_rotate, "rotate", "v", "Fn", "\n"
-	    " void rotate (foreign cr, real radians)\n"
+	{ do_Cairo_set_miter_limit, "set_miter_limit", "v", CAIRO_S "n", "\n"
+	    " void set_miter_limit (cairo_t cr, real limit)\n"
+	    "\n"
+	    " Set current miter join limit\n" },
+	{ do_Cairo_rotate, "rotate", "v", CAIRO_S "n", "\n"
+	    " void rotate (cairo_t cr, real radians)\n"
 	    "\n"
 	    " Rotate current transformation matrix by specified amount\n" },
-	{ do_Cairo_scale_font, "scale_font", "v", "Fn", "\n"
-	    " void scale_font (foreign cr, real scale)\n"
+	{ do_Cairo_scale_font, "scale_font", "v", CAIRO_S "n", "\n"
+	    " void scale_font (cairo_t cr, real scale)\n"
 	    "\n"
 	    " Scales current font by specified amount\n" },
-	{ do_Cairo_show_text, "show_text", "v", "Fs", "\n"
-	    " void show_text (foreign cr, string text)\n"
+	{ do_Cairo_show_text, "show_text", "v", CAIRO_S "s", "\n"
+	    " void show_text (cairo_t cr, string text)\n"
 	    "\n"
 	    " Shows text at current position\n" },
-	{ do_Cairo_text_path, "text_path", "v", "Fs", "\n"
-	    " void text_path (foreign cr, string text)\n"
+	{ do_Cairo_text_path, "text_path", "v", CAIRO_S "s", "\n"
+	    " void text_path (cairo_t cr, string text)\n"
 	    "\n"
 	    " Appends text to current path\n" },
-	{ do_Cairo_text_extents, "text_extents", "u", "Fs", "\n"
-	    " text_extents_t text_extents (foreign cr, string text)\n"
+	{ do_Cairo_text_extents, "text_extents", TEXT_EXTENTS_S, CAIRO_S "s", "\n"
+	    " text_extents_t text_extents (cairo_t cr, string text)\n"
 	    "\n"
 	    " Appends text to current path\n" },
-	{ do_Cairo_set_matrix, "set_matrix", "v", "FA**n", "\n"
-	    " void set_matrix (foreign cr, real[3,2] matrix)\n"
+	{ do_Cairo_set_matrix, "set_matrix", "v", CAIRO_S "A**n", "\n"
+	    " void set_matrix (cairo_t cr, matrix_t matrix)\n"
 	    "\n"
 	    " Sets the transformation matrix\n" },
+	{ do_Cairo_transform_point, "transform_point", POINT_S, CAIRO_S POINT_S, "\n"
+	    " point_t transform_point (cairo_t cr, point_t)\n"
+	    "\n"
+	    " Transform a point from user to device space\n" },
+	{ do_Cairo_transform_distance, "transform_distance", POINT_S, CAIRO_S POINT_S, "\n"
+	    " point_t transform_distance (cairo_t cr, point_t point)\n"
+	    "\n"
+	    " Transform a distance from user to device space\n" },
+	{ do_Cairo_inverse_transform_point, "inverse_transform_point", POINT_S, CAIRO_S POINT_S, "\n"
+	    " point_t inverse_transform_point (cairo_t cr, point_t point)\n"
+	    "\n"
+	    " Transform a point from device to user space\n" },
+	{ do_Cairo_inverse_transform_distance, "inverse_transform_distance", POINT_S, CAIRO_S POINT_S, "\n"
+	    " point_t inverse_transform_distance (cairo_t cr, point_t point)\n"
+	    "\n"
+	    " Transform a distance from device to user space\n" },
 	{ 0 }
     };
 
     static const struct fbuiltin_3 funcs_3[] = {
-	{ do_Cairo_new_png, "new_png", "F", "sii", "\n"
-	    " foreign new_png (string filename, int width, int height)\n"
+	{ do_Cairo_new_png, "new_png", CAIRO_S, "sii", "\n"
+	    " cairo_t new_png (string filename, int width, int height)\n"
 	    "\n"
 	    " Create a cairo png file.\n" },
-	{ do_Cairo_move_to, "move_to", "v", "Fnn", "\n"
-	    " void move_to (foreign cr, real x, real y)\n"
+	{ do_Cairo_move_to, "move_to", "v", CAIRO_S "nn", "\n"
+	    " void move_to (cairo_t cr, real x, real y)\n"
 	    "\n"
 	    " Move to specified position\n" },
-	{ do_Cairo_line_to, "line_to", "v", "Fnn", "\n"
-	    " void line_to (foreign cr, real x, real y)\n"
+	{ do_Cairo_line_to, "line_to", "v", CAIRO_S "nn", "\n"
+	    " void line_to (cairo_t cr, real x, real y)\n"
 	    "\n"
 	    " Draw line to specified position\n" },
-	{ do_Cairo_rel_move_to, "rel_move_to", "v", "Fnn", "\n"
-	    " void rel_move_to (foreign cr, real x, real y)\n"
+	{ do_Cairo_rel_move_to, "rel_move_to", "v", CAIRO_S "nn", "\n"
+	    " void rel_move_to (cairo_t cr, real x, real y)\n"
 	    "\n"
 	    " Move to specified offset from the current position\n" },
-	{ do_Cairo_rel_line_to, "rel_line_to", "v", "Fnn", "\n"
-	    " void rel_line_to (foreign cr, real x, real y)\n"
+	{ do_Cairo_rel_line_to, "rel_line_to", "v", CAIRO_S "nn", "\n"
+	    " void rel_line_to (cairo_t cr, real x, real y)\n"
 	    "\n"
 	    " Draw line to specified offset from the current position\n" },
-	{ do_Cairo_translate, "translate", "v", "Fnn", "\n"
-	    " void translate (foreign cr, real x, real y)\n"
+	{ do_Cairo_translate, "translate", "v", CAIRO_S "nn", "\n"
+	    " void translate (cairo_t cr, real x, real y)\n"
 	    "\n"
 	    " Offset current transformation matrix by specified amount\n" },
-	{ do_Cairo_scale, "scale", "v", "Fnn", "\n"
-	    " void scale (foreign cr, real x, real y)\n"
+	{ do_Cairo_scale, "scale", "v", CAIRO_S "nn", "\n"
+	    " void scale (cairo_t cr, real x, real y)\n"
 	    "\n"
 	    " Scale current transformation matrix by specified amount\n" },
+	{ do_Cairo_set_dash, "set_dash", "v", CAIRO_S "A*nn", "\n"
+	    " void set_dash (cairo_t cr, real[*] dashes, real dash_offset)\n"
+	    "\n"
+	    " Sets current dash pattern and offset\n" },
+	{ do_Cairo_in_fill, "in_fill", "b", CAIRO_S "nn", "\n"
+	    " bool in_fill (cairo_t cairo, real x, real y)\n"
+	    "\n"
+	    " Test whether (x,y) would be covered by filling the current path\n" },
+	{ do_Cairo_in_stroke, "in_stroke", "b", CAIRO_S "nn", "\n"
+	    " bool in_stroke (cairo_t cairo, real x, real y)\n"
+	    "\n"
+	    " Test whether (x,y) would be covered by stroking the current path\n" },
 	{ 0 }
     };
 
     static const struct fbuiltin_4 funcs_4[] = {
-	{ do_Cairo_set_rgb_color, "set_rgb_color", "v", "Fnnn", "\n"
-	    " void set_rgb_color (foreign cr, real red, real green, real blue)\n"
+	{ do_Cairo_set_rgb_color, "set_rgb_color", "v", CAIRO_S "nnn", "\n"
+	    " void set_rgb_color (cairo_t cr, real red, real green, real blue)\n"
 	    "\n"
 	    " Set current color\n" },
-	{ do_Cairo_select_font, "select_font", "v", "Fsii", "\n"
-	    " void select_font (foreign cr, string family, int slant, int weight)\n"
+	{ do_Cairo_select_font, "select_font", "v", CAIRO_S "s" FONT_SLANT_S FONT_WEIGHT_S, "\n"
+	    " void select_font (cairo_t cr, string family, slant_t slant, weight_t weight)\n"
 	    "\n"
 	    " Set current font\n" },
 	{ 0 }
     };
 
+    static const struct fbuiltin_5 funcs_5[] = {
+	{ do_Cairo_rectangle, "rectangle", "v", CAIRO_S "nnnn", "\n"
+	    " void rectangle (cairo_t cr, real x, real y, real width, real height)\n"
+	    "\n"
+	    " Adds the specified rectangle to the current path\n" },
+	{ 0 }
+    };
+    
     static const struct fbuiltin_6 funcs_6[] = {
-	{ do_Cairo_arc, "arc", "v", "Fnnnnn", "\n"
-	    " void arc (foreign cr, real x1, real y1, real x2, real y2, real radius)\n"
+	{ do_Cairo_arc, "arc", "v", CAIRO_S "nnnnn", "\n"
+	    " void arc (cairo_t cr, real x1, real y1, real x2, real y2, real radius)\n"
 	    "\n"
 	    " Draw a clockwise arc from x1,y1 to x2,y2 with the given radius\n" },
-	{ do_Cairo_arc_negative, "arc_negative", "v", "Fnnnnn", "\n"
-	    " void arc (foreign cr, real x1, real y1, real x2, real y2, real radius)\n"
+	{ do_Cairo_arc_negative, "arc_negative", "v", CAIRO_S "nnnnn", "\n"
+	    " void arc (cairo_t cr, real x1, real y1, real x2, real y2, real radius)\n"
 	    "\n"
 	    " Draw a counter-clockwise arc from x1,y1 to x2,y2 with the given radius\n" },
 	{ 0 }
     };
 
     static const struct fbuiltin_7 funcs_7[] = {
-	{ do_Cairo_curve_to, "curve_to", "v", "Fnnnnnn", "\n"
-	    " void curve_to (foreign cr, real x1, real y1, real x2, real y2, real x3, real y3)\n"
+	{ do_Cairo_curve_to, "curve_to", "v", CAIRO_S "nnnnnn", "\n"
+	    " void curve_to (cairo_t cr, real x1, real y1, real x2, real y2, real x3, real y3)\n"
 	    "\n"
 	    " Draw Bézier spline to specified position\n" },
-	{ do_Cairo_rel_curve_to, "rel_curve_to", "v", "Fnnnnnn", "\n"
-	    " void curve_to (foreign cr, real x1, real y1, real x2, real y2, real x3, real y3)\n"
+	{ do_Cairo_rel_curve_to, "rel_curve_to", "v", CAIRO_S "nnnnnn", "\n"
+	    " void curve_to (cairo_t cr, real x1, real y1, real x2, real y2, real x3, real y3)\n"
 	    "\n"
 	    " Draw Bézier spline to specified offset from the current position\n" },
 	{ 0 }
     };
 
-    static const struct ibuiltin ivars[] = {
-	{ CAIRO_LINE_CAP_BUTT, "CAP_BUTT", &CairoNamespace },
-	{ CAIRO_LINE_CAP_ROUND, "CAP_ROUND", &CairoNamespace },
-	{ CAIRO_LINE_CAP_SQUARE, "CAP_SQUARE", &CairoNamespace },
-	{ CAIRO_LINE_JOIN_MITER, "JOIN_MITER", &CairoNamespace },
-	{ CAIRO_LINE_JOIN_ROUND, "JOIN_ROUND", &CairoNamespace },
-	{ CAIRO_LINE_JOIN_BEVEL, "JOIN_BEVEL", &CairoNamespace },
-	{ CAIRO_FILL_RULE_WINDING, "RULE_WINDING", &CairoNamespace },
-	{ CAIRO_FILL_RULE_EVEN_ODD, "RULE_EVEN_ODD", &CairoNamespace },
-	{ CAIRO_FONT_WEIGHT_NORMAL, "WEIGHT_NORMAL", &CairoNamespace },
-	{ CAIRO_FONT_WEIGHT_BOLD, "WEIGHT_BOLD", &CairoNamespace },
-	{ CAIRO_FONT_SLANT_NORMAL, "SLANT_NORMAL", &CairoNamespace },
-	{ CAIRO_FONT_SLANT_ITALIC, "SLANT_ITALIC", &CairoNamespace },
-	{ CAIRO_FONT_SLANT_OBLIQUE, "SLANT_OBLIQUE", &CairoNamespace },
-	{ 0 }
-    };
-
-    SymbolPtr	sym;
-    Type    *type;
-
-    CairoNamespace = BuiltinNamespace (/* parent */ 0, "Cairo")->namespace.namespace;
-
-    type = BuildStructType (6, 
-			    typePrim[rep_float], "x_bearing",
-			    typePrim[rep_float], "y_bearing",
-			    typePrim[rep_float], "width",
-			    typePrim[rep_float], "height",
-			    typePrim[rep_float], "x_advance",
-			    typePrim[rep_float], "y_advance");
-    
-    sym = NewSymbolType (AtomId ("text_extents_t"), type);
-
-    typeTextExtents = NewTypeName (NewExprAtom (AtomId ("text_extents_t"), 0, False),
-				   sym);
+    init_types ();
     
-    BuiltinSetUserdefType (typeTextExtents);
-
-    NamespaceAddName (CairoNamespace, sym, publish_public);
-
     BuiltinFuncsV (&CairoNamespace, funcs_v);
     BuiltinFuncs1 (&CairoNamespace, funcs_1);
     BuiltinFuncs2 (&CairoNamespace, funcs_2);
     BuiltinFuncs3 (&CairoNamespace, funcs_3);
     BuiltinFuncs4 (&CairoNamespace, funcs_4);
+    BuiltinFuncs5 (&CairoNamespace, funcs_5);
     BuiltinFuncs6 (&CairoNamespace, funcs_6);
     BuiltinFuncs7 (&CairoNamespace, funcs_7);
 
-    BuiltinIntegers (ivars);
-
     RETURN(TrueVal);
 }

Index: surface.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- surface.c	15 Dec 2004 07:04:50 -0000	1.3
+++ surface.c	17 Dec 2004 02:09:45 -0000	1.4
@@ -156,6 +156,7 @@
 	RETURN (Void);
     }
     
+    c5c->recv_events = 0;
     c5c->u.window.x = start_x (width, height);
     c5c->width = c5c->u.window.x->width;
     c5c->height = c5c->u.window.x->height;

Index: text.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/text.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- text.c	14 Dec 2004 08:34:27 -0000	1.2
+++ text.c	17 Dec 2004 02:09:45 -0000	1.3
@@ -40,8 +40,8 @@
 {
     cairo_5c_t		*c5c = get_cairo_5c (cv);
     char		*family = StrzPart (fv, "invalid family");
-    cairo_font_slant_t	slant = IntPart (sv, "invalid slant");
-    cairo_font_weight_t	weight = IntPart (wv, "invalid weight");
+    cairo_font_slant_t	slant = EnumIntPart (sv, "invalid slant");
+    cairo_font_weight_t	weight = EnumIntPart (wv, "invalid weight");
 
     if (!aborting)
 	cairo_select_font (c5c->cr, family, slant, weight);
@@ -97,7 +97,7 @@
     if (aborting)
 	return Void;
     cairo_text_extents (c5c->cr, utf8, &extents);
-    ret = NewStruct (TypeCanon (typeTextExtents)->structs.structs, False);
+    ret = NewStruct (TypeCanon (typeCairoTextExtents)->structs.structs, False);
     box = ret->structs.values;
     BoxValueSet (box, 0, NewDoubleFloat (extents.x_bearing));
     BoxValueSet (box, 1, NewDoubleFloat (extents.y_bearing));
@@ -107,3 +107,10 @@
     BoxValueSet (box, 5, NewDoubleFloat (extents.y_advance));
     RETURN (ret);
 }
+
+Value
+do_Cairo_select_ft_font (Value pv)
+{
+    /* XXX */
+    return Void;
+}




More information about the cairo-commit mailing list