[cairo-commit] rcairo/packages/cairo/ext rb_cairo_matrix.c, 1.12, 1.13

Kouhei Sutou commit at pdx.freedesktop.org
Sun Oct 9 08:56:40 PDT 2005


Committed by: kou

Update of /cvs/cairo/rcairo/packages/cairo/ext
In directory gabe:/tmp/cvs-serv29106/packages/cairo/ext

Modified Files:
	rb_cairo_matrix.c 
Log Message:
* packages/cairo/ext/rb_cairo_matrix.c: Added a utility method.


Index: rb_cairo_matrix.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_matrix.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- rb_cairo_matrix.c	9 Oct 2005 15:37:33 -0000	1.12
+++ rb_cairo_matrix.c	9 Oct 2005 15:56:38 -0000	1.13
@@ -186,7 +186,7 @@
 }
 
 static VALUE
-cr_matrix_get (VALUE self)
+cr_matrix_to_a (VALUE self)
 {
   cairo_matrix_t *matrix = _SELF;
   double affine[6];
@@ -199,6 +199,22 @@
   return cr__float_array (affine, 6);
 }
 
+static VALUE
+cr_matrix_to_s(VALUE self)
+{
+  cairo_matrix_t *matrix;
+  VALUE ret;
+
+  matrix = _SELF;
+
+  ret = rb_str_new2 ("<");
+  rb_str_cat2 (ret, rb_class2name (CLASS_OF (self)));
+  rb_str_cat2 (ret, ":");
+  rb_str_concat (ret, rb_inspect (cr_matrix_to_a (self)));
+  rb_str_cat2 (ret, ">");
+  return ret;
+}
+
 
 void
 Init_cairo_matrix (void)
@@ -232,5 +248,6 @@
 
   /* Utilities */
   rb_define_method (rb_cCairo_Matrix, "set", cr_matrix_set, 6);
-  rb_define_method (rb_cCairo_Matrix, "to_a", cr_matrix_get, 0);
+  rb_define_method (rb_cCairo_Matrix, "to_a", cr_matrix_to_a, 0);
+  rb_define_method (rb_cCairo_Matrix, "to_s", cr_matrix_to_s, 0);
 }



More information about the cairo-commit mailing list