[cairo-commit] cairo-perl .cvsignore, 1.1, 1.2 Cairo.pm, 1.10, 1.11 Cairo.xs, 1.8, 1.9 CairoFont.xs, 1.4, 1.5 CairoMatrix.xs, 1.5, 1.6 CairoPattern.xs, 1.6, 1.7 CairoSurface.xs, 1.8, 1.9 ChangeLog, 1.17, 1.18 MANIFEST, 1.6, 1.7 MANIFEST.SKIP, 1.5, 1.6 MakeHelper.pm, 1.4, 1.5 Makefile.PL, 1.12, 1.13 cairo-perl-private.h, NONE, 1.1 cairo-perl.h, 1.8, 1.9

Torsten Schoenfeld commit at pdx.freedesktop.org
Sun May 7 07:17:41 PDT 2006


Committed by: tsch

Update of /cvs/cairo/cairo-perl
In directory kemper:/tmp/cvs-serv11703

Modified Files:
	.cvsignore Cairo.pm Cairo.xs CairoFont.xs CairoMatrix.xs 
	CairoPattern.xs CairoSurface.xs ChangeLog MANIFEST 
	MANIFEST.SKIP MakeHelper.pm Makefile.PL cairo-perl.h 
Added Files:
	cairo-perl-private.h 
Log Message:
	* .cvsignore, MANIFEST.SKIP: Update.
	
	* Cairo.pm: Update copyright notice.
	
	* MANIFEST, cairo-perl-private.h: Add a private header file for
	non-public declarations that are used in more than one place.
	
	* MakeHelper.pm: Improve the enum converters to produce more useful
	error messages.
	
	* Makefile.PL: Incorporate a slightly modified patch from  Christopher
	Oezbek to prompt the user if he wants to install EU::Depends and
	EU::PkgConfig if they can't be found.  Require cairo >= 1.1.6.  Update
	and rearrange enums.
	
	* cairo-perl.h, Cairo.xs: Move CAIRO_PERL_CALL_BOOT to Cairo.xs.
	
	* cairo-perl.h, CairoSurface.xs, CairoPattern.xs, Makefile.PL: Use
	cairo_surface_get_type and cairo_pattern_get_type to redo the sub-type
	handling for surfaces and patterns.
	
	* cairo-perl-private.h, Cairo.xs, CairoMatrix.xs, CairoPattern.xs: Add
	pcairo_copy_matrix and use it all over the place to make matrix handling
	more robust.

	* Cairo.xs, t/Cairo.t: Wrap cairo_version, cairo_version_string,
	cairo_push_group, cairo_push_group_with_content, cairo_pop_group,
	cairo_pop_group_to_source, cairo_new_sub_path, cairo_set_scaled_font,
	and cairo_get_group_target.

	* CairoFont.xs, t/CairoFont.t: Wrap cairo_font_face_get_type,
	cairo_scaled_font_get_type, cairo_scaled_font_text_extents,
	cairo_scaled_font_get_font_face, cairo_scaled_font_get_font_matrix,
	cairo_scaled_font_get_ctm, and cairo_scaled_font_get_font_options.

	* CairoPattern.xs, t/CairoPattern.t: Wrap cairo_pattern_get_type.

	* CairoSurface.xs, t/CairoSurface.t: Wrap
	cairo_surface_get_device_offset, cairo_surface_get_type,
	cairo_pdf_surface_set_size, cairo_ps_surface_set_dpi,
	cairo_ps_surface_set_size, cairo_ps_surface_dsc_comment,
	cairo_ps_surface_dsc_begin_setup, and cairo_ps_surface_dsc_begin_setup.


Index: .cvsignore
===================================================================
RCS file: /cvs/cairo/cairo-perl/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- .cvsignore	9 Nov 2004 03:05:48 -0000	1.1
+++ .cvsignore	7 May 2006 14:17:39 -0000	1.2
@@ -3,6 +3,7 @@
 build
 Cairo.bs
 Cairo*.c
-CairoEnums.xs
+cairo-perl-enums.*
 Makefile
 pm_to_blib
+.project

Index: Cairo.pm
===================================================================
RCS file: /cvs/cairo/cairo-perl/Cairo.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Cairo.pm	29 Jan 2006 19:30:17 -0000	1.10
+++ Cairo.pm	7 May 2006 14:17:39 -0000	1.11
@@ -923,6 +923,6 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2005 by the cairo perl team
+Copyright (C) 2005-2006 by the cairo perl team
 
 =cut

Index: Cairo.xs
===================================================================
RCS file: /cvs/cairo/cairo-perl/Cairo.xs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Cairo.xs	8 Jan 2006 17:06:29 -0000	1.8
+++ Cairo.xs	7 May 2006 14:17:39 -0000	1.9
@@ -8,11 +8,12 @@
  */
 
 #include <cairo-perl.h>
+#include <cairo-perl-private.h>
 
 /* ------------------------------------------------------------------------- */
 
-void
-_cairo_perl_call_XS (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark)
+static void
+call_xs (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark)
 {
 	dSP;
 	PUSHMARK (mark);
@@ -20,6 +21,12 @@
 	PUTBACK;	/* forget return values */
 }
 
+#define CAIRO_PERL_CALL_BOOT(name)				\
+	{							\
+		extern XS(name);				\
+		call_xs (aTHX_ name, cv, mark);	\
+	}
+
 /* ------------------------------------------------------------------------- */
 
 /* XXX: these need extensive testing */
@@ -212,6 +219,14 @@
 
 /* ------------------------------------------------------------------------- */
 
+MODULE = Cairo	PACKAGE = Cairo	PREFIX = cairo_
+
+int cairo_version ();
+
+const char* cairo_version_string ();
+
+# ---------------------------------------------------------------------------- #
+
 MODULE = Cairo	PACKAGE = Cairo::Context	PREFIX = cairo_
 
 BOOT:
@@ -229,6 +244,14 @@
 
 void cairo_restore (cairo_t * cr);
 
+void cairo_push_group (cairo_t *cr);
+
+void cairo_push_group_with_content (cairo_t *cr, cairo_content_t content);
+
+cairo_pattern_t * cairo_pop_group (cairo_t *cr);
+
+void cairo_pop_group_to_source (cairo_t *cr);
+
 void cairo_set_operator (cairo_t * cr, cairo_operator_t op);
 
 void cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue);
@@ -285,6 +308,8 @@
 
 void cairo_new_path (cairo_t * cr);
 
+void cairo_new_sub_path (cairo_t *cr);
+
 void cairo_move_to (cairo_t * cr, double x, double y);
 
 void cairo_line_to (cairo_t * cr, double x, double y);
@@ -347,9 +372,11 @@
 
 ##void cairo_get_font_matrix (cairo_t *cr, cairo_matrix_t *matrix);
 cairo_matrix_t * cairo_get_font_matrix (cairo_t *cr)
+    PREINIT:
+	cairo_matrix_t matrix;
     CODE:
-	RETVAL = malloc (sizeof (cairo_matrix_t));
-	cairo_get_font_matrix (cr, RETVAL);
+	cairo_get_font_matrix (cr, &matrix);
+	RETVAL = pcairo_copy_matrix (&matrix);
     OUTPUT:
 	RETVAL
 
@@ -363,6 +390,8 @@
     OUTPUT:
 	RETVAL
 
+void cairo_set_scaled_font (cairo_t *cr, const cairo_scaled_font_t *scaled_font);
+
 void cairo_show_text (cairo_t * cr, const char * utf8);
 
 ##void cairo_show_glyphs (cairo_t * cr, cairo_glyph_t * glyphs, int num_glyphs);
@@ -456,14 +485,18 @@
 
 ##void cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix);
 cairo_matrix_t * cairo_get_matrix (cairo_t *cr)
+    PREINIT:
+	cairo_matrix_t matrix;
     CODE:
-	RETVAL = malloc (sizeof (cairo_matrix_t));
-	cairo_get_matrix (cr, RETVAL);
+	cairo_get_matrix (cr, &matrix);
+	RETVAL = pcairo_copy_matrix (&matrix);
     OUTPUT:
 	RETVAL
 
 cairo_surface_t * cairo_get_target (cairo_t *cr);
 
+cairo_surface_t * cairo_get_group_target (cairo_t *cr);
+
 cairo_path_t * cairo_copy_path (cairo_t *cr);
 
 cairo_path_t * cairo_copy_path_flat (cairo_t *cr);

Index: CairoFont.xs
===================================================================
RCS file: /cvs/cairo/cairo-perl/CairoFont.xs,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CairoFont.xs	29 Jul 2005 17:19:55 -0000	1.4
+++ CairoFont.xs	7 May 2006 14:17:39 -0000	1.5
@@ -7,11 +7,14 @@
  */
 
 #include <cairo-perl.h>
+#include <cairo-perl-private.h>
 
 MODULE = Cairo::Font	PACKAGE = Cairo::FontFace	PREFIX = cairo_font_face_
 
 cairo_status_t cairo_font_face_status (cairo_font_face_t * font);
 
+cairo_font_type_t cairo_font_face_get_type (cairo_font_face_t *font_face);
+
 void DESTROY (cairo_font_face_t * font)
     CODE:
 	cairo_font_face_destroy (font);
@@ -25,6 +28,8 @@
 
 cairo_status_t cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
 
+cairo_font_type_t cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
+
 ##cairo_status_t cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font, cairo_font_extents_t *extents);
 cairo_font_extents_t * cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font)
     PREINIT:
@@ -35,6 +40,16 @@
     OUTPUT:
 	RETVAL
 
+##void cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font, const char *utf8, cairo_text_extents_t *extents);
+cairo_text_extents_t * cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font, const char *utf8)
+    PREINIT:
+	cairo_text_extents_t extents;
+    CODE:
+	cairo_scaled_font_text_extents (scaled_font, utf8, &extents);
+	RETVAL = &extents;
+    OUTPUT:
+	RETVAL
+
 ##void cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents);
 cairo_text_extents_t * cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font, ...)
     PREINIT:
@@ -52,6 +67,36 @@
     OUTPUT:
 	RETVAL
 
+cairo_font_face_t * cairo_scaled_font_get_font_face (cairo_scaled_font_t *scaled_font);
+
+##void cairo_scaled_font_get_font_matrix (cairo_scaled_font_t *scaled_font, cairo_matrix_t *font_matrix);
+cairo_matrix_t * cairo_scaled_font_get_font_matrix (cairo_scaled_font_t *scaled_font)
+    PREINIT:
+	cairo_matrix_t font_matrix;
+    CODE:
+	cairo_scaled_font_get_font_matrix (scaled_font, &font_matrix);
+	RETVAL = pcairo_copy_matrix (&font_matrix);
+    OUTPUT:
+	RETVAL
+
+##void cairo_scaled_font_get_ctm (cairo_scaled_font_t *scaled_font, cairo_matrix_t *ctm);
+cairo_matrix_t * cairo_scaled_font_get_ctm (cairo_scaled_font_t *scaled_font)
+    PREINIT:
+	cairo_matrix_t ctm;
+    CODE:
+	cairo_scaled_font_get_ctm (scaled_font, &ctm);
+	RETVAL = pcairo_copy_matrix (&ctm);
+    OUTPUT:
+	RETVAL
+
+##void cairo_scaled_font_get_font_options (cairo_scaled_font_t *scaled_font, cairo_font_options_t *options);
+cairo_font_options_t * cairo_scaled_font_get_font_options (cairo_scaled_font_t *scaled_font)
+    CODE:
+	RETVAL = cairo_font_options_create ();
+	cairo_scaled_font_get_font_options (scaled_font, RETVAL);
+    OUTPUT:
+	RETVAL
+
 void DESTROY (cairo_scaled_font_t * font)
     CODE:
 	cairo_scaled_font_destroy (font);

Index: CairoMatrix.xs
===================================================================
RCS file: /cvs/cairo/cairo-perl/CairoMatrix.xs,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CairoMatrix.xs	12 Jul 2005 20:29:47 -0000	1.5
+++ CairoMatrix.xs	7 May 2006 14:17:39 -0000	1.6
@@ -8,45 +8,70 @@
 
 #include <cairo-perl.h>
 
+cairo_matrix_t *
+pcairo_copy_matrix (cairo_matrix_t *src)
+{
+	cairo_matrix_t *dst = malloc (sizeof (cairo_matrix_t));
+
+	dst->xx = src->xx;
+	dst->xy = src->xy;
+	dst->x0 = src->x0;
+	dst->yx = src->yx;
+	dst->yy = src->yy;
+	dst->y0 = src->y0;
+
+	return dst;
+}
+
 MODULE = Cairo::Matrix	PACKAGE = Cairo::Matrix PREFIX = cairo_matrix_
 
 ##void cairo_matrix_init (cairo_matrix_t *matrix, double xx, double yx, double xy, double yy, double x0, double y0);
 cairo_matrix_t * cairo_matrix_init (class, double xx, double yx, double xy, double yy, double x0, double y0)
+    PREINIT:
+	cairo_matrix_t matrix;
     CODE:
-	RETVAL = malloc (sizeof (cairo_matrix_t));
-	cairo_matrix_init (RETVAL, xx, yx, xy, yy, x0, y0);
+	cairo_matrix_init (&matrix, xx, yx, xy, yy, x0, y0);
+	RETVAL = pcairo_copy_matrix (&matrix);
     OUTPUT:
 	RETVAL
 
 ##void cairo_matrix_init_identity (cairo_matrix_t *matrix);
 cairo_matrix_t * cairo_matrix_init_identity (class)
+    PREINIT:
+	cairo_matrix_t matrix;
     CODE:
-	RETVAL = malloc (sizeof (cairo_matrix_t));
-	cairo_matrix_init_identity (RETVAL);
+	cairo_matrix_init_identity (&matrix);
+	RETVAL = pcairo_copy_matrix (&matrix);
     OUTPUT:
 	RETVAL
 
 ##void cairo_matrix_init_translate (cairo_matrix_t *matrix, double tx, double ty);
 cairo_matrix_t * cairo_matrix_init_translate (class, double tx, double ty)
+    PREINIT:
+	cairo_matrix_t matrix;
     CODE:
-	RETVAL = malloc (sizeof (cairo_matrix_t));
-	cairo_matrix_init_translate (RETVAL, tx, ty);
+	cairo_matrix_init_translate (&matrix, tx, ty);
+	RETVAL = pcairo_copy_matrix (&matrix);
     OUTPUT:
 	RETVAL
 
 ##void cairo_matrix_init_scale (cairo_matrix_t *matrix, double sx, double sy);
 cairo_matrix_t * cairo_matrix_init_scale (class, double sx, double sy)
+    PREINIT:
+	cairo_matrix_t matrix;
     CODE:
-	RETVAL = malloc (sizeof (cairo_matrix_t));
-	cairo_matrix_init_scale (RETVAL, sx, sy);
+	cairo_matrix_init_scale (&matrix, sx, sy);
+	RETVAL = pcairo_copy_matrix (&matrix);
     OUTPUT:
 	RETVAL
 
 ##void cairo_matrix_init_rotate (cairo_matrix_t *matrix, double radians);
 cairo_matrix_t * cairo_matrix_init_rotate (class, double radians)
+    PREINIT:
+	cairo_matrix_t matrix;
     CODE:
-	RETVAL = malloc (sizeof (cairo_matrix_t));
-	cairo_matrix_init_rotate (RETVAL, radians);
+	cairo_matrix_init_rotate (&matrix, radians);
+	RETVAL = pcairo_copy_matrix (&matrix);
     OUTPUT:
 	RETVAL
 
@@ -59,10 +84,12 @@
 cairo_status_t cairo_matrix_invert (cairo_matrix_t * matrix);
 
 ##void cairo_matrix_multiply (cairo_matrix_t * result, const cairo_matrix_t * a, const cairo_matrix_t * b);
-cairo_matrix_t * cairo_matrix_multiply (cairo_matrix_t * a, cairo_matrix_t * b);
+cairo_matrix_t * cairo_matrix_multiply (cairo_matrix_t * a, cairo_matrix_t * b)
+    PREINIT:
+	cairo_matrix_t matrix;
     CODE:
-	RETVAL = malloc (sizeof (cairo_matrix_t));
-	cairo_matrix_multiply (RETVAL, a, b);
+	cairo_matrix_multiply (&matrix, a, b);
+	RETVAL = pcairo_copy_matrix (&matrix);
     OUTPUT:
 	RETVAL
 

Index: CairoPattern.xs
===================================================================
RCS file: /cvs/cairo/cairo-perl/CairoPattern.xs,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CairoPattern.xs	29 Jan 2006 19:27:21 -0000	1.6
+++ CairoPattern.xs	7 May 2006 14:17:39 -0000	1.7
@@ -7,6 +7,48 @@
  */
 
 #include <cairo-perl.h>
+#include <cairo-perl-private.h>
+
+static const char *
+get_package (cairo_pattern_t *pattern)
+{
+	cairo_pattern_type_t type;
+	const char *package;
+
+	type = cairo_pattern_get_type (pattern);
+	switch (type) {
+	    case CAIRO_PATTERN_TYPE_SOLID:
+		package = "Cairo::SolidPattern";
+		break;
+
+	    case CAIRO_PATTERN_TYPE_SURFACE:
+		package = "Cairo::SurfacePattern";
+		break;
+
+	    case CAIRO_PATTERN_TYPE_LINEAR:
+		package = "Cairo::LinearGradient";
+		break;
+
+	    case CAIRO_PATTERN_TYPE_RADIAL:
+		package = "Cairo::RadialGradient";
+		break;
+
+	    default:
+		warn ("unknown pattern type %d encountered", type);
+		package = "Cairo::Pattern";
+		break;
+	}
+	
+	return package;
+}
+
+SV *
+cairo_pattern_to_sv (cairo_pattern_t *pattern)
+{
+	SV *sv = newSV (0);
+	sv_setref_pv(sv, get_package (pattern), pattern);
+	return sv;
+}
 
 MODULE = Cairo::Pattern	PACKAGE = Cairo::Pattern PREFIX = cairo_pattern_
 
@@ -18,25 +60,29 @@
 
 ## void cairo_pattern_get_matrix (cairo_pattern_t * pattern, cairo_matrix_t * matrix);
 cairo_matrix_t * cairo_pattern_get_matrix (cairo_pattern_t * pattern);
+    PREINIT:
+	cairo_matrix_t matrix;
     CODE:
-	RETVAL = malloc (sizeof (cairo_matrix_t));
-	cairo_pattern_get_matrix (pattern, RETVAL);
+	cairo_pattern_get_matrix (pattern, &matrix);
+	RETVAL = pcairo_copy_matrix (&matrix);
     OUTPUT:
 	RETVAL
 
 cairo_status_t cairo_pattern_status (cairo_pattern_t *pattern);
 
+cairo_pattern_type_t cairo_pattern_get_type (cairo_pattern_t *pattern);
+
 # --------------------------------------------------------------------------- #
 
 MODULE = Cairo::Pattern	PACKAGE = Cairo::SolidPattern	PREFIX = cairo_pattern_
 
 # cairo_pattern_t* cairo_pattern_create_rgb (double red, double green, double blue);
-cairo_solid_pattern_t_noinc * cairo_pattern_create_rgb (class, double red, double green, double blue)
+cairo_pattern_t_noinc * cairo_pattern_create_rgb (class, double red, double green, double blue)
     C_ARGS:
 	red, green, blue
 
 # cairo_pattern_t* cairo_pattern_create_rgba (double red, double green, double blue, double alpha);
-cairo_solid_pattern_t_noinc * cairo_pattern_create_rgba (class, double red, double green, double blue, double alpha)
+cairo_pattern_t_noinc * cairo_pattern_create_rgba (class, double red, double green, double blue, double alpha)
     C_ARGS:
 	red, green, blue, alpha
 
@@ -44,7 +90,7 @@
 
 MODULE = Cairo::Pattern	PACKAGE = Cairo::SurfacePattern	PREFIX = cairo_pattern_
 
-cairo_surface_pattern_t_noinc * create (class, cairo_surface_t * surface);
+cairo_pattern_t_noinc * create (class, cairo_surface_t * surface);
     CODE:
 	RETVAL = cairo_pattern_create_for_surface (surface);
     OUTPUT:
@@ -70,7 +116,7 @@
 
 MODULE = Cairo::Pattern	PACKAGE = Cairo::LinearGradient	PREFIX = cairo_pattern_
 
-cairo_linear_gradient_t_noinc * create (class, double x0, double y0, double x1, double y1);
+cairo_pattern_t_noinc * create (class, double x0, double y0, double x1, double y1);
     CODE:
 	RETVAL = cairo_pattern_create_linear (x0, y0, x1, y1);
     OUTPUT:
@@ -80,7 +126,7 @@
 
 MODULE = Cairo::Pattern	PACKAGE = Cairo::RadialGradient	PREFIX = cairo_pattern_
 
-cairo_radial_gradient_t_noinc * create (class, double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
+cairo_pattern_t_noinc * create (class, double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
     CODE:
 	RETVAL = cairo_pattern_create_radial (cx0, cy0, radius0, cx1, cy1, radius1);
     OUTPUT:

Index: CairoSurface.xs
===================================================================
RCS file: /cvs/cairo/cairo-perl/CairoSurface.xs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CairoSurface.xs	10 Aug 2005 17:01:53 -0000	1.8
+++ CairoSurface.xs	7 May 2006 14:17:39 -0000	1.9
@@ -8,28 +8,61 @@
 
 #include <cairo-perl.h>
 
+static const char *
+get_package (cairo_surface_t *surface)
+{
+	cairo_surface_type_t type;
+	const char *package;
+
+	type = cairo_surface_get_type (surface);
+	switch (type) {
+	    case CAIRO_SURFACE_TYPE_IMAGE:
+		package = "Cairo::ImageSurface";
+		break;
+
+	    case CAIRO_SURFACE_TYPE_PDF:
+		package = "Cairo::PdfSurface";
+		break;
+
+	    case CAIRO_SURFACE_TYPE_PS:
+		package = "Cairo::PsSurface";
+		break;
+
+	    case CAIRO_SURFACE_TYPE_XLIB:
+	    case CAIRO_SURFACE_TYPE_XCB:
+	    case CAIRO_SURFACE_TYPE_GLITZ:
+	    case CAIRO_SURFACE_TYPE_QUARTZ:
+	    case CAIRO_SURFACE_TYPE_WIN32:
+	    case CAIRO_SURFACE_TYPE_BEOS:
+	    case CAIRO_SURFACE_TYPE_DIRECTFB:
+	    case CAIRO_SURFACE_TYPE_SVG:
+		package = "Cairo::Surface";
+		break;
+
+	    default:
+		warn ("unknown surface type %d encountered", type);
+		package = "Cairo::Surface";
+		break;
+	}
+	
+	return package;
+}
+
+SV *
+cairo_surface_to_sv (cairo_surface_t *surface)
+{
+	SV *sv = newSV (0);
+	sv_setref_pv(sv, get_package (surface), surface);
+	return sv;
+}
+
 MODULE = Cairo::Surface	PACKAGE = Cairo::Surface	PREFIX = cairo_surface_
 
 void DESTROY (cairo_surface_t * surface);
     CODE:
 	cairo_surface_destroy (surface);
 
-##cairo_surface_t * cairo_surface_create_similar (cairo_surface_t * other, cairo_content_t content, int width, int height);
-SV * cairo_surface_create_similar (SV * other, cairo_content_t content, int width, int height)
-    PREINIT:
-	char *package;
-	IV pointer;
-	cairo_surface_t *other_surface, *surface;
-    CODE:
-	package = sv_reftype (SvRV (other), TRUE);
-	pointer = SvIV ((SV *) SvRV (other));
-	other_surface = INT2PTR (cairo_surface_t *, pointer);
-
-	surface = cairo_surface_create_similar (other_surface, content, width, height);
-	RETVAL = newSV (0);
-	sv_setref_pv (RETVAL, package, (void *) surface);
-    OUTPUT:
-	RETVAL
+cairo_surface_t * cairo_surface_create_similar (cairo_surface_t * other, cairo_content_t content, int width, int height);
 
 cairo_status_t cairo_surface_status (cairo_surface_t *surface);
 
@@ -37,6 +70,18 @@
 
 void cairo_surface_set_device_offset (cairo_surface_t *surface, double x_offset, double y_offset);
 
+##void cairo_surface_get_device_offset (cairo_surface_t *surface, double *x_offset, double *y_offset);
+void
+cairo_surface_get_device_offset (cairo_surface_t *surface)
+    PREINIT:
+	double x_offset;
+	double y_offset;
+    PPCODE:
+	cairo_surface_get_device_offset (surface, &x_offset, &y_offset);
+	EXTEND (sp, 2);
+	PUSHs (sv_2mortal (newSVnv (x_offset)));
+	PUSHs (sv_2mortal (newSVnv (y_offset)));
+
 ##void cairo_surface_get_font_options (cairo_surface_t *surface, cairo_font_options_t *options);
 cairo_font_options_t * cairo_surface_get_font_options (cairo_surface_t *surface)
     CODE:
@@ -51,11 +96,13 @@
 
 void cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface, int x, int y, int width, int height);
 
+cairo_surface_type_t cairo_surface_get_type (cairo_surface_t *surface);
+
 #ifdef CAIRO_HAS_PNG_FUNCTIONS
 
 cairo_status_t cairo_surface_write_to_png (cairo_surface_t *surface, const char *filename);
 
-# FIXME?
+# FIXME
 ##cairo_status_t cairo_surface_write_to_png_stream (cairo_surface_t *surface, cairo_write_func_t write_func, void *closure);
 
 #endif
@@ -65,12 +112,12 @@
 MODULE = Cairo::Surface	PACKAGE = Cairo::ImageSurface	PREFIX = cairo_image_surface_
 
 ##cairo_surface_t * cairo_image_surface_create (cairo_format_t format, int width, int height);
-cairo_image_surface_t_noinc * cairo_image_surface_create (class, cairo_format_t format, int width, int height)
+cairo_surface_t_noinc * cairo_image_surface_create (class, cairo_format_t format, int width, int height)
     C_ARGS:
 	format, width, height
 
 ##cairo_surface_t * cairo_image_surface_create_for_data (unsigned char *data, cairo_format_t format, int width, int height, int stride);
-cairo_image_surface_t_noinc * cairo_image_surface_create_for_data (class, unsigned char *data, cairo_format_t format, int width, int height, int stride)
+cairo_surface_t_noinc * cairo_image_surface_create_for_data (class, unsigned char *data, cairo_format_t format, int width, int height, int stride)
     C_ARGS:
 	data, format, width, height, stride
 
@@ -81,11 +128,11 @@
 #ifdef CAIRO_HAS_PNG_FUNCTIONS
 
 ##cairo_surface_t * cairo_image_surface_create_from_png (const char *filename);
-cairo_image_surface_t_noinc * cairo_image_surface_create_from_png (class, const char *filename)
+cairo_surface_t_noinc * cairo_image_surface_create_from_png (class, const char *filename)
     C_ARGS:
 	filename
 
-# FIXME?
+# FIXME
 ##cairo_surface_t * cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func, void *closure);
 
 #endif
@@ -97,15 +144,17 @@
 MODULE = Cairo::Surface	PACKAGE = Cairo::PdfSurface	PREFIX = cairo_pdf_surface_
 
 ##cairo_surface_t * cairo_pdf_surface_create (const char *filename, double width_in_points, double height_in_points);
-cairo_pdf_surface_t_noinc * cairo_pdf_surface_create (class, const char *filename, double width_in_points, double height_in_points)
+cairo_surface_t_noinc * cairo_pdf_surface_create (class, const char *filename, double width_in_points, double height_in_points)
     C_ARGS:
 	filename, width_in_points, height_in_points
 
-# FIXME?
+# FIXME
 ##cairo_surface_t * cairo_pdf_surface_create_for_stream (cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points);
 
 void cairo_pdf_surface_set_dpi (cairo_surface_t *surface, double x_dpi, double y_dpi);
 
+void cairo_pdf_surface_set_size (cairo_surface_t *surface, double width_in_points, double height_in_points);
+
 #endif
 
 # --------------------------------------------------------------------------- #
@@ -115,14 +164,21 @@
 MODULE = Cairo::Surface	PACKAGE = Cairo::PsSurface	PREFIX = cairo_ps_surface_
 
 ##cairo_surface_t * cairo_ps_surface_create (const char *filename, double width_in_points, double height_in_points);
-cairo_ps_surface_t_noinc * cairo_ps_surface_create (class, const char *filename, double width_in_points, double height_in_points)
+cairo_surface_t_noinc * cairo_ps_surface_create (class, const char *filename, double width_in_points, double height_in_points)
     C_ARGS:
 	filename, width_in_points, height_in_points
 
-# FIXME?
+# FIXME
 ##cairo_surface_t * cairo_ps_surface_create_for_stream (cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points);
 
-# FIXME: this is listed in the header but apparently not implemented yet.
-##void cairo_ps_surface_set_dpi (cairo_surface_t *surface, double x_dpi, double y_dpi);
+void cairo_ps_surface_set_dpi (cairo_surface_t *surface, double x_dpi, double y_dpi);
+
+void cairo_ps_surface_set_size (cairo_surface_t	*surface, double width_in_points, double height_in_points);
+
+void cairo_ps_surface_dsc_comment (cairo_surface_t *surface, const char *comment);
+
+void cairo_ps_surface_dsc_begin_setup (cairo_surface_t *surface);
+
+void cairo_ps_surface_dsc_begin_page_setup (cairo_surface_t *surface);
 
 #endif

Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-perl/ChangeLog,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- ChangeLog	29 Jan 2006 19:30:17 -0000	1.17
+++ ChangeLog	7 May 2006 14:17:39 -0000	1.18
@@ -1,3 +1,48 @@
+2006/05/07	tsch
+
+	* .cvsignore, MANIFEST.SKIP: Update.
+	
+	* Cairo.pm: Update copyright notice.
+	
+	* MANIFEST, cairo-perl-private.h: Add a private header file for
+	non-public declarations that are used in more than one place.
+	
+	* MakeHelper.pm: Improve the enum converters to produce more useful
+	error messages.
+	
+	* Makefile.PL: Incorporate a slightly modified patch from  Christopher
+	Oezbek to prompt the user if he wants to install EU::Depends and
+	EU::PkgConfig if they can't be found.  Require cairo >= 1.1.6.  Update
+	and rearrange enums.
+	
+	* cairo-perl.h, Cairo.xs: Move CAIRO_PERL_CALL_BOOT to Cairo.xs.
+	
+	* cairo-perl.h, CairoSurface.xs, CairoPattern.xs, Makefile.PL: Use
+	cairo_surface_get_type and cairo_pattern_get_type to redo the sub-type
+	handling for surfaces and patterns.
+	
+	* cairo-perl-private.h, Cairo.xs, CairoMatrix.xs, CairoPattern.xs: Add
+	pcairo_copy_matrix and use it all over the place to make matrix handling
+	more robust.
+	
+	* Cairo.xs, t/Cairo.t: Wrap cairo_version, cairo_version_string,
+	cairo_push_group, cairo_push_group_with_content, cairo_pop_group,
+	cairo_pop_group_to_source, cairo_new_sub_path, cairo_set_scaled_font,
+	and cairo_get_group_target.
+	
+	* CairoFont.xs, t/CairoFont.t: Wrap cairo_font_face_get_type,
+	cairo_scaled_font_get_type, cairo_scaled_font_text_extents,
+	cairo_scaled_font_get_font_face, cairo_scaled_font_get_font_matrix,
+	cairo_scaled_font_get_ctm, and cairo_scaled_font_get_font_options.
+	
+	* CairoPattern.xs, t/CairoPattern.t: Wrap cairo_pattern_get_type.
+	
+	* CairoSurface.xs, t/CairoSurface.t: Wrap
+	cairo_surface_get_device_offset, cairo_surface_get_type,
+	cairo_pdf_surface_set_size, cairo_ps_surface_set_dpi,
+	cairo_ps_surface_set_size, cairo_ps_surface_dsc_comment,
+	cairo_ps_surface_dsc_begin_setup, and cairo_ps_surface_dsc_begin_setup.
+
 2006/01/29	tsch
 
 	* Cairo.pm, NEWS, README: Release 0.03.

Index: MANIFEST
===================================================================
RCS file: /cvs/cairo/cairo-perl/MANIFEST,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- MANIFEST	31 Aug 2005 22:32:09 -0000	1.6
+++ MANIFEST	7 May 2006 14:17:39 -0000	1.7
@@ -15,6 +15,7 @@
 README
 TODO
 cairo-perl.h
+cairo-perl-private.h
 cairo-perl.typemap
 examples/png/README
 examples/png/caps_joins.pl

Index: MANIFEST.SKIP
===================================================================
RCS file: /cvs/cairo/cairo-perl/MANIFEST.SKIP,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- MANIFEST.SKIP	15 Aug 2005 18:59:17 -0000	1.5
+++ MANIFEST.SKIP	7 May 2006 14:17:39 -0000	1.6
@@ -11,3 +11,4 @@
 .*\.png
 .*\.swp
 .*\.tar\.gz
+.project

Index: MakeHelper.pm
===================================================================
RCS file: /cvs/cairo/cairo-perl/MakeHelper.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- MakeHelper.pm	8 Jan 2006 17:06:29 -0000	1.4
+++ MakeHelper.pm	7 May 2006 14:17:39 -0000	1.5
@@ -278,6 +278,15 @@
 
 ";
 
+	sub canonicalize
+	{
+		my ($name, $prefix) = @_;
+		$name =~ s/$prefix//;
+		$name =~ tr/_/-/;
+		$name = lc ($name);
+		return $name;
+	}
+
 	sub if_tree_from
 	{
 		my @enums = @_;
@@ -285,27 +294,23 @@
 		my $prefix = shift @enums;
 
 		my $full = shift @enums;
-		my $name = $full;
-		$name =~ s/$prefix//;
-		$name =~ tr/_/-/;
-		$name = lc ($name);
+		my $name = canonicalize($full, $prefix);
 		my $len = length ($name);
 
-		my $str = "	if (strncmp (str, \"$name\", $len) == 0)
+		my $str = <<"EOS";
+	if (strncmp (str, "$name", $len) == 0)
 		return $full;
-";
+EOS
 
 		foreach $full (@enums)
 		{
-			$name = $full;
-			$name =~ s/$prefix//;
-			$name =~ tr/_/-/;
-			$name = lc ($name);
+			my $name = canonicalize($full, $prefix);
 			$len = length ($name);
 
-			$str .= "	else if (strncmp (str, \"$name\", $len) == 0)
+			$str .= <<"EOS";
+	else if (strncmp (str, "$name", $len) == 0)
 		return $full;
-";
+EOS
 		}
 
 		$str;
@@ -317,24 +322,20 @@
 
 		my $prefix = shift @enums;
 		my $full = shift @enums;
-		my $name = $full;
-		$name =~ s/$prefix//;
-		$name =~ tr/_/-/;
-		$name = lc ($name);
+		my $name = canonicalize($full, $prefix);
 
-		my $str = "	if (val == $full)
-		return newSVpv (\"$name\", 0);
-";
+		my $str = <<"EOS";
+	if (val == $full)
+		return newSVpv ("$name", 0);
+EOS
 
 		foreach $full (@enums)
 		{
-			$name = $full;
-			$name =~ s/$prefix//;
-			$name =~ tr/_/-/;
-			$name = lc ($name);
-			$str .= "	else if (val == $full)
-		return newSVpv (\"$name\", 0);
-";
+			my $name = canonicalize($full, $prefix);
+			$str .= <<"EOS";
+	else if (val == $full)
+		return newSVpv ("$name", 0);
+EOS
 		}
 
 		$str;
@@ -342,28 +343,34 @@
 
 	foreach (keys %enums)
 	{
-		my $name = name ($_);
+		my $name = name($_);
+		my @enum_values = @{$enums{$_}};
+		my $value_list = join ", ", map { canonicalize($_, $enum_values[0]) } @enum_values[1..$#enum_values];
+		
+		my $tree_from = if_tree_from (@enum_values);
+		my $tree_to = if_tree_to (@enum_values);
 
-		print ENUMS 'int
-cairo_'.$name.'_from_sv (SV * '.$name.')
+		print ENUMS <<"EOS";
+int
+cairo_${name}_from_sv (SV * $name)
 {
-	char * str = SvPV_nolen ('.$name.');
+	char * str = SvPV_nolen ($name);
 
-'.if_tree_from (@{$enums{$_}}).'
-	croak ("bad value for '.$name.' (%s)\n", str);
+	$tree_from
+	croak ("`%s' is not a valid $_ value; valid values are: $value_list\\n", str);
 
-	free (str);
 	return 0;
 }
 
 SV *
-cairo_'.$name.'_to_sv (int val)
+cairo_${name}_to_sv (int val)
 {
-'.if_tree_to (@{$enums{$_}}).'
-	return newSVpv ("unknown/invalid", 0);
+	$tree_to
+	warn ("unknown $_ value %d encountered", val);
+	return &PL_sv_undef;
 }
 
-';
+EOS
 	}
 
 	close ENUMS;

Index: Makefile.PL
===================================================================
RCS file: /cvs/cairo/cairo-perl/Makefile.PL,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Makefile.PL	29 Jan 2006 19:27:21 -0000	1.12
+++ Makefile.PL	7 May 2006 14:17:39 -0000	1.13
@@ -8,50 +8,118 @@
 
 use strict;
 use warnings;
-use ExtUtils::Depends;
-use ExtUtils::PkgConfig;
 use ExtUtils::MakeMaker;
-
 use MakeHelper;
 
-my $autogen_dir = 'build';
-mkdir $autogen_dir unless (-d $autogen_dir);
-$MakeHelper::autogen_dir = $autogen_dir;
-
-our %prereqs = (
+# Unfortunately we already need these prereqs for writing the Makefile ...
+my %prereqs = (
 	'ExtUtils::Depends'   => 0.2,
 	'ExtUtils::PkgConfig' => 1.0,
 );
 
-my %cairo_cfg = ExtUtils::PkgConfig->find ('cairo >= 1.0.0');
+# ... thus we have to make sure they are installed.
+while ((my $module, my $version) = each(%prereqs)) {
+	unless (eval "use $module $version; 1" ) {
+		print "This module requires $module to install itself.\n";
+		my $yn = ExtUtils::MakeMaker::prompt("  Install $module from CPAN?", 'y');
+      
+		unless ($yn =~ /^y/i) {
+			die " *** Cannot install without $module.  Exiting ...\n";
+		}
+
+		require Cwd;
+		require File::Spec;
+		require CPAN;
+
+		# Save this 'cause CPAN will chdir all over the place.
+		my $cwd = Cwd::cwd();
+		my $makefile = File::Spec->rel2abs($0);
+
+		CPAN::Shell->install($module);
+
+		chdir $cwd 
+			or die "Cannot chdir() back to $cwd: $!";
+	}
+	eval "use $module $version; 1" or die $@;
+}
+
+my $autogen_dir = 'build';
+mkdir $autogen_dir unless (-d $autogen_dir);
+$MakeHelper::autogen_dir = $autogen_dir;
+
+my %cairo_cfg = ExtUtils::PkgConfig->find ('cairo >= 1.1.6');
 
 my %backend_macros = (
-	'cairo_ps_surface_t'  => 'CAIRO_HAS_PS_SURFACE',
 	'cairo_pdf_surface_t' => 'CAIRO_HAS_PDF_SURFACE',
+	'cairo_ps_surface_t'  => 'CAIRO_HAS_PS_SURFACE',
 );
 
 my %objects = (
 	'cairo_t *'                 => 'Cairo::Context',
-	'cairo_surface_t *'         => 'Cairo::Surface',
-	'cairo_image_surface_t *'   => 'Cairo::ImageSurface',
-	'cairo_pdf_surface_t *'     => 'Cairo::PdfSurface',
-	'cairo_ps_surface_t *'      => 'Cairo::PsSurface',
-	'cairo_pattern_t *'         => 'Cairo::Pattern',
-	'cairo_solid_pattern_t *'   => 'Cairo::SolidPattern',
-	'cairo_surface_pattern_t *' => 'Cairo::SurfacePattern',
-	'cairo_gradient_t *'        => 'Cairo::Gradient',
-	'cairo_linear_gradient_t *' => 'Cairo::LinearGradient',
-	'cairo_radial_gradient_t *' => 'Cairo::RadialGradient',
 	'cairo_font_face_t *'       => 'Cairo::FontFace',
+	'cairo_pattern_t *'         => 'Cairo::Pattern',
 	'cairo_scaled_font_t *'     => 'Cairo::ScaledFont',
+	'cairo_surface_t *'         => 'Cairo::Surface',
 );
 
 my %structs = (
-	'cairo_matrix_t *' => 'Cairo::Matrix',
 	'cairo_font_options_t *' => 'Cairo::FontOptions',
+	'cairo_matrix_t *'       => 'Cairo::Matrix',
 );
 
 my %enums = (
+	cairo_antialias_t => [qw/
+			CAIRO_ANTIALIAS_
+			CAIRO_ANTIALIAS_DEFAULT
+			CAIRO_ANTIALIAS_NONE
+			CAIRO_ANTIALIAS_GRAY
+			CAIRO_ANTIALIAS_SUBPIXEL
+	/],
+	cairo_content_t => [qw/
+			CAIRO_CONTENT_
+			CAIRO_CONTENT_COLOR
+			CAIRO_CONTENT_ALPHA
+			CAIRO_CONTENT_COLOR_ALPHA
+	/],
+	cairo_extend_t => [qw/
+			CAIRO_EXTEND_
+			CAIRO_EXTEND_NONE
+			CAIRO_EXTEND_REPEAT
+			CAIRO_EXTEND_REFLECT
+			CAIRO_EXTEND_PAD
+	/],
+	cairo_fill_rule_t => [qw/
+			CAIRO_FILL_RULE_
+			CAIRO_FILL_RULE_WINDING
+			CAIRO_FILL_RULE_EVEN_ODD
+	/],
+	cairo_filter_t => [qw/
+			CAIRO_FILTER_
+			CAIRO_FILTER_FAST
+			CAIRO_FILTER_GOOD
+			CAIRO_FILTER_BEST
+			CAIRO_FILTER_NEAREST
+			CAIRO_FILTER_BILINEAR
+			CAIRO_FILTER_GAUSSIAN
+	/],
+	cairo_font_slant_t => [qw/
+			CAIRO_FONT_SLANT_
+			CAIRO_FONT_SLANT_NORMAL
+			CAIRO_FONT_SLANT_ITALIC
+			CAIRO_FONT_SLANT_OBLIQUE
+	/],
+	cairo_font_type_t => [qw/
+			CAIRO_FONT_TYPE_
+			CAIRO_FONT_TYPE_TOY
+			CAIRO_FONT_TYPE_FT
+			CAIRO_FONT_TYPE_WIN32
+			CAIRO_FONT_TYPE_ATSUI
+	/],
+	cairo_font_weight_t => [qw/
+			CAIRO_FONT_WEIGHT_
+			CAIRO_FONT_WEIGHT_NORMAL
+			CAIRO_FONT_WEIGHT_BOLD
+	/],
 	cairo_format_t => [qw/
 			CAIRO_FORMAT_
 			CAIRO_FORMAT_ARGB32
@@ -59,6 +127,32 @@
 			CAIRO_FORMAT_A8
 			CAIRO_FORMAT_A1
 	/],
+	cairo_hint_metrics_t => [qw/
+			CAIRO_HINT_METRICS_
+			CAIRO_HINT_METRICS_DEFAULT
+			CAIRO_HINT_METRICS_OFF
+			CAIRO_HINT_METRICS_ON
+	/],
+	cairo_hint_style_t => [qw/
+			CAIRO_HINT_STYLE_
+			CAIRO_HINT_STYLE_DEFAULT
+			CAIRO_HINT_STYLE_NONE
+			CAIRO_HINT_STYLE_SLIGHT
+			CAIRO_HINT_STYLE_MEDIUM
+			CAIRO_HINT_STYLE_FULL
+	/],
+	cairo_line_cap_t => [qw/
+			CAIRO_LINE_CAP_
+			CAIRO_LINE_CAP_BUTT
+			CAIRO_LINE_CAP_ROUND
+			CAIRO_LINE_CAP_SQUARE
+	/],
+	cairo_line_join_t => [qw/
+			CAIRO_LINE_JOIN_
+			CAIRO_LINE_JOIN_MITER
+			CAIRO_LINE_JOIN_ROUND
+			CAIRO_LINE_JOIN_BEVEL
+	/],
 	cairo_operator_t => [qw/
 			CAIRO_OPERATOR_
 			CAIRO_OPERATOR_CLEAR
@@ -76,33 +170,19 @@
 			CAIRO_OPERATOR_ADD
 			CAIRO_OPERATOR_SATURATE
 	/],
-	cairo_fill_rule_t => [qw/
-			CAIRO_FILL_RULE_
-			CAIRO_FILL_RULE_WINDING
-			CAIRO_FILL_RULE_EVEN_ODD
-	/],
-	cairo_line_cap_t => [qw/
-			CAIRO_LINE_CAP_
-			CAIRO_LINE_CAP_BUTT
-			CAIRO_LINE_CAP_ROUND
-			CAIRO_LINE_CAP_SQUARE
-	/],
-	cairo_line_join_t => [qw/
-			CAIRO_LINE_JOIN_
-			CAIRO_LINE_JOIN_MITER
-			CAIRO_LINE_JOIN_ROUND
-			CAIRO_LINE_JOIN_BEVEL
-	/],
-	cairo_font_slant_t => [qw/
-			CAIRO_FONT_SLANT_
-			CAIRO_FONT_SLANT_NORMAL
-			CAIRO_FONT_SLANT_ITALIC
-			CAIRO_FONT_SLANT_OBLIQUE
+	cairo_path_data_type_t => [qw/
+			CAIRO_PATH_
+			CAIRO_PATH_MOVE_TO
+			CAIRO_PATH_LINE_TO
+			CAIRO_PATH_CURVE_TO
+			CAIRO_PATH_CLOSE_PATH
 	/],
-	cairo_font_weight_t => [qw/
-			CAIRO_FONT_WEIGHT_
-			CAIRO_FONT_WEIGHT_NORMAL
-			CAIRO_FONT_WEIGHT_BOLD
+	cairo_pattern_type_t => [qw/
+			CAIRO_PATTERN_TYPE_
+			CAIRO_PATTERN_TYPE_SOLID
+			CAIRO_PATTERN_TYPE_SURFACE
+			CAIRO_PATTERN_TYPE_LINEAR
+			CAIRO_PATTERN_TYPE_RADIAL
 	/],
 	cairo_status_t => [qw/
 			CAIRO_STATUS_
@@ -126,41 +206,7 @@
 			CAIRO_STATUS_INVALID_VISUAL
 			CAIRO_STATUS_FILE_NOT_FOUND
 			CAIRO_STATUS_INVALID_DASH
-	/],
-	cairo_filter_t => [qw/
-			CAIRO_FILTER_
-			CAIRO_FILTER_FAST
-			CAIRO_FILTER_GOOD
-			CAIRO_FILTER_BEST
-			CAIRO_FILTER_NEAREST
-			CAIRO_FILTER_BILINEAR
-			CAIRO_FILTER_GAUSSIAN
-	/],
-	cairo_extend_t => [qw/
-			CAIRO_EXTEND_
-			CAIRO_EXTEND_NONE
-			CAIRO_EXTEND_REPEAT
-			CAIRO_EXTEND_REFLECT
-	/],
-	cairo_path_data_type_t => [qw/
-			CAIRO_PATH_
-			CAIRO_PATH_MOVE_TO
-			CAIRO_PATH_LINE_TO
-			CAIRO_PATH_CURVE_TO
-			CAIRO_PATH_CLOSE_PATH
-	/],
-	cairo_content_t => [qw/
-			CAIRO_CONTENT_
-			CAIRO_CONTENT_COLOR
-			CAIRO_CONTENT_ALPHA
-			CAIRO_CONTENT_COLOR_ALPHA
-	/],
-	cairo_antialias_t => [qw/
-			CAIRO_ANTIALIAS_
-			CAIRO_ANTIALIAS_DEFAULT
-			CAIRO_ANTIALIAS_NONE
-			CAIRO_ANTIALIAS_GRAY
-			CAIRO_ANTIALIAS_SUBPIXEL
+			CAIRO_STATUS_INVALID_DSC_COMMENT
 	/],
 	cairo_subpixel_order_t => [qw/
 			CAIRO_SUBPIXEL_ORDER_
@@ -170,19 +216,19 @@
 			CAIRO_SUBPIXEL_ORDER_VRGB
 			CAIRO_SUBPIXEL_ORDER_VBGR
 	/],
-	cairo_hint_style_t => [qw/
-			CAIRO_HINT_STYLE_
-			CAIRO_HINT_STYLE_DEFAULT
-			CAIRO_HINT_STYLE_NONE
-			CAIRO_HINT_STYLE_SLIGHT
-			CAIRO_HINT_STYLE_MEDIUM
-			CAIRO_HINT_STYLE_FULL
-	/],
-	cairo_hint_metrics_t => [qw/
-			CAIRO_HINT_METRICS_
-			CAIRO_HINT_METRICS_DEFAULT
-			CAIRO_HINT_METRICS_OFF
-			CAIRO_HINT_METRICS_ON
+	cairo_surface_type_t => [qw/
+			CAIRO_SURFACE_TYPE_
+			CAIRO_SURFACE_TYPE_IMAGE
+			CAIRO_SURFACE_TYPE_PDF
+			CAIRO_SURFACE_TYPE_PS
+			CAIRO_SURFACE_TYPE_XLIB
+			CAIRO_SURFACE_TYPE_XCB
+			CAIRO_SURFACE_TYPE_GLITZ
+			CAIRO_SURFACE_TYPE_QUARTZ
+			CAIRO_SURFACE_TYPE_WIN32
+			CAIRO_SURFACE_TYPE_BEOS
+			CAIRO_SURFACE_TYPE_DIRECTFB
+			CAIRO_SURFACE_TYPE_SVG
 	/],
 );
 
@@ -222,12 +268,10 @@
 	$dep->get_makefile_vars,
 );
 
-package MY;
-
-sub postamble
+sub MY::postamble
 {
 	my $autogen_dir = $MakeHelper::autogen_dir;
 
 	"realclean ::
-	-\$(RM_RF) $autogen_dir cairo-perl-enums.c";
+	-\$(RM_RF) $autogen_dir cairo-perl-enums.*";
 }

--- NEW FILE: cairo-perl-private.h ---
/*
 * Copyright (c) 2004-2005 by the cairo perl team (see the file README)
 *
 * Licensed under the LGPL, see LICENSE file for more information.
 *
 * $Header: /cvs/cairo/cairo-perl/cairo-perl-private.h,v 1.1 2006/05/07 14:17:39 tsch Exp $
 *
 */

#ifndef _CAIRO_PERL_PRIVATE_H_
#define _CAIRO_PERL_PRIVATE_H_

#define CAIRO_PERL_UNUSED(var) if (0) { (var) = (var); }

cairo_matrix_t * pcairo_copy_matrix (cairo_matrix_t *matrix);

#endif /* _CAIRO_PERL_PRIVATE_H_ */

Index: cairo-perl.h
===================================================================
RCS file: /cvs/cairo/cairo-perl/cairo-perl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cairo-perl.h	29 Jan 2006 19:27:21 -0000	1.8
+++ cairo-perl.h	7 May 2006 14:17:39 -0000	1.9
@@ -28,6 +28,8 @@
 # include <cairo-pdf.h>
 #endif
 
+#include <cairo-perl-auto.h>
+
 /*
  * standard object and struct handling
  */
@@ -51,65 +53,21 @@
 cairo_path_t * SvCairoPath (SV * sv);
 
 /*
- * support for custom surface types
+ * special treatment for surfaces
  */
-typedef cairo_surface_t cairo_image_surface_t;
-#define cairo_image_surface_reference cairo_surface_reference
-#define cairo_image_surface_destroy cairo_surface_destroy
-
-#ifdef CAIRO_HAS_PDF_SURFACE
-  typedef cairo_surface_t cairo_pdf_surface_t;
-# define cairo_pdf_surface_reference cairo_surface_reference
-# define cairo_pdf_surface_destroy cairo_surface_destroy
-#endif
-
-#ifdef CAIRO_HAS_PS_SURFACE
-  typedef cairo_surface_t cairo_ps_surface_t;
-# define cairo_ps_surface_reference cairo_surface_reference
-# define cairo_ps_surface_destroy cairo_surface_destroy
-#endif
+SV * cairo_surface_to_sv (cairo_surface_t *surface);
+#undef newSVCairoSurface
+#undef newSVCairoSurface_noinc
+#define newSVCairoSurface(object)	(cairo_surface_to_sv (cairo_surface_reference (object)))
+#define newSVCairoSurface_noinc(object)	(cairo_surface_to_sv (object))
 
 /*
- * support for custom pattern types
- */
-typedef cairo_pattern_t cairo_solid_pattern_t;
-#define cairo_solid_pattern_reference cairo_pattern_reference
-#define cairo_solid_pattern_destroy cairo_pattern_destroy
-
-typedef cairo_pattern_t cairo_surface_pattern_t;
-#define cairo_surface_pattern_reference cairo_pattern_reference
-#define cairo_surface_pattern_destroy cairo_pattern_destroy
-
-typedef cairo_pattern_t cairo_gradient_t;
-#define cairo_gradient_reference cairo_pattern_reference
-#define cairo_gradient_destroy cairo_pattern_destroy
-
-typedef cairo_pattern_t cairo_linear_gradient_t;
-#define cairo_linear_gradient_reference cairo_pattern_reference
-#define cairo_linear_gradient_destroy cairo_pattern_destroy
-
-typedef cairo_pattern_t cairo_radial_gradient_t;
-#define cairo_radial_gradient_reference cairo_pattern_reference
-#define cairo_radial_gradient_destroy cairo_pattern_destroy
-
-#include <cairo-perl-auto.h>
-
-/* call the boot code of a module by symbol rather than by name.
- *
- * in a perl extension which uses several xs files but only one pm, you
- * need to bootstrap the other xs files in order to get their functions
- * exported to perl.  if the file has MODULE = Foo::Bar, the boot symbol
- * would be boot_Foo__Bar.
- *
- * copied/borrowed from gtk2-perl.
+ * special treatment for patterns
  */
-void _cairo_perl_call_XS (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark);
-#define CAIRO_PERL_CALL_BOOT(name)				\
-	{							\
-		extern XS(name);				\
-		_cairo_perl_call_XS (aTHX_ name, cv, mark);	\
-	}
-
-#define CAIRO_PERL_UNUSED(var) if (0) { (var) = (var); }
+SV * cairo_pattern_to_sv (cairo_pattern_t *surface);
+#undef newSVCairoPattern
+#undef newSVCairoPattern_noinc
+#define newSVCairoPattern(object)	(cairo_pattern_to_sv (cairo_pattern_reference (object)))
+#define newSVCairoPattern_noinc(object)	(cairo_pattern_to_sv (object))
 
 #endif /* _CAIRO_PERL_H_ */



More information about the cairo-commit mailing list