[cairo-commit] rcairo/packages/cairo/ext extconf.rb, 1.8, 1.9 rb_cairo_constants.c, 1.9, 1.10 rb_cairo_context.c, 1.25, 1.26 rb_cairo_font_face.c, 1.7, 1.8 rb_cairo_pattern.c, 1.14, 1.15 rb_cairo_scaled_font.c, 1.3, 1.4 rb_cairo_surface.c, 1.22, 1.23

Kouhei Sutou commit at pdx.freedesktop.org
Mon May 1 22:37:04 PDT 2006


Committed by: kou

Update of /cvs/cairo/rcairo/packages/cairo/ext
In directory kemper:/tmp/cvs-serv21324/packages/cairo/ext

Modified Files:
	extconf.rb rb_cairo_constants.c rb_cairo_context.c 
	rb_cairo_font_face.c rb_cairo_pattern.c rb_cairo_scaled_font.c 
	rb_cairo_surface.c 
Log Message:
* packages/cairo/ext/extconf.rb: supported only 1.1.2 or higher.

* packages/cairo/ext/rb_cairo_surface.c: supported
  cairo_surface_get_type().

* packages/cairo/ext/rb_cairo_scaled_font.c: supported
  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().

* packages/cairo/ext/rb_cairo_pattern.c: supported
  cairo_pattern_get_type().

* packages/cairo/ext/rb_cairo_font_face.c: supported
  cairo_font_face_get_type().

* packages/cairo/ext/rb_cairo_context.c: supported
  cairo_new_sub_path() and cr_set_scaled_font().

* packages/cairo/ext/rb_cairo_constants.c: supported new enums.
  - cairo_font_type_t
  - cairo_surface_type_t
  - cairo_pattern_type_t
  - CAIRO_EXTEND_PAD


Index: extconf.rb
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/extconf.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- extconf.rb	5 Oct 2005 15:52:21 -0000	1.8
+++ extconf.rb	2 May 2006 05:37:02 -0000	1.9
@@ -10,7 +10,7 @@
 STDOUT.flush
 if macro_defined?("__GNUC__", "")
   STDOUT.print "yes\n"
-  $CFLAGS += ' -Wall' 
+  $CFLAGS += ' -Wall'
   $cc_is_gcc = true
 else
   STDOUT.print "no\n"
@@ -51,7 +51,7 @@
       filename = "libruby-#{target_name}.lib"
       $DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
       $DLDFLAGS.gsub!(/ \/IMPLIB:[^ ]+/, '')
-      $DLDFLAGS << " /IMPLIB:#{filename}" if filename    
+      $DLDFLAGS << " /IMPLIB:#{filename}" if filename
   end
 end
 
@@ -63,7 +63,7 @@
 
 pkg = "cairo"
 modname = "cairo"
-major, minor, micro = 1, 0, 0
+major, minor, micro = 1, 1, 2
 
 PKGConfig.have_package(pkg, major, minor, micro) or exit 1
 

Index: rb_cairo_constants.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_constants.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- rb_cairo_constants.c	16 Oct 2005 03:57:01 -0000	1.9
+++ rb_cairo_constants.c	2 May 2006 05:37:02 -0000	1.10
@@ -150,7 +150,7 @@
   rb_define_const (rb_mCairo,    "FILL_RULE_EVEN_ODD",
                    INT2FIX (CAIRO_FILL_RULE_EVEN_ODD));
 
-                   
+
   /* cairo_line_cap_t */
   rb_define_const (rb_mCairo,    "LINE_CAP_BUTT",
                    INT2FIX (CAIRO_LINE_CAP_BUTT));
@@ -220,6 +220,15 @@
                    INT2FIX (CAIRO_HINT_METRICS_OFF));
 
 
+  /* cairo_font_type_t */
+  rb_define_const (rb_mCairo, "FONT_TYPE_TOY", INT2FIX(CAIRO_FONT_TYPE_TOY));
+  rb_define_const (rb_mCairo, "FONT_TYPE_FT", INT2FIX(CAIRO_FONT_TYPE_FT));
+  rb_define_const (rb_mCairo, "FONT_TYPE_WIN32",
+                   INT2FIX(CAIRO_FONT_TYPE_WIN32));
+  rb_define_const (rb_mCairo, "FONT_TYPE_ATSUI",
+                   INT2FIX(CAIRO_FONT_TYPE_ATSUI));
+
+
   /* cairo_path_data_type_t */
   rb_define_const (rb_mCairo,    "PATH_MOVE_TO",
                    INT2FIX (CAIRO_PATH_MOVE_TO));
@@ -240,6 +249,30 @@
                    INT2FIX (CAIRO_CONTENT_COLOR_ALPHA));
 
 
+  /* cairo_surface_type_t */
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_IMAGE",
+                   INT2FIX (CAIRO_SURFACE_TYPE_IMAGE));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_PDF",
+                   INT2FIX (CAIRO_SURFACE_TYPE_PDF));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_PS",
+                   INT2FIX (CAIRO_SURFACE_TYPE_PS));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_XLIB",
+                   INT2FIX (CAIRO_SURFACE_TYPE_XLIB));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_XCB",
+                   INT2FIX (CAIRO_SURFACE_TYPE_XCB));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_GLITZ",
+                   INT2FIX (CAIRO_SURFACE_TYPE_GLITZ));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_QUARTZ",
+                   INT2FIX (CAIRO_SURFACE_TYPE_QUARTZ));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_WIN32",
+                   INT2FIX (CAIRO_SURFACE_TYPE_WIN32));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_BEOS",
+                   INT2FIX (CAIRO_SURFACE_TYPE_BEOS));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_DIRECTFB",
+                   INT2FIX (CAIRO_SURFACE_TYPE_DIRECTFB));
+  rb_define_const (rb_mCairo, "SURFACE_TYPE_SVG",
+                   INT2FIX (CAIRO_SURFACE_TYPE_SVG));
+
   /* cairo_format_t */
   rb_define_const (rb_mCairo,    "FORMAT_ARGB32",
                    INT2FIX (CAIRO_FORMAT_ARGB32));
@@ -251,6 +284,16 @@
                    INT2FIX (CAIRO_FORMAT_A1));
 
 
+  /* cairo_pattern_type_t */
+  rb_define_const (rb_mCairo, "PATTERN_TYPE_SOLID",
+                   INT2FIX (CAIRO_PATTERN_TYPE_SOLID));
+  rb_define_const (rb_mCairo, "PATTERN_TYPE_SURFACE",
+                   INT2FIX (CAIRO_PATTERN_TYPE_SURFACE));
+  rb_define_const (rb_mCairo, "PATTERN_TYPE_LINEAR",
+                   INT2FIX (CAIRO_PATTERN_TYPE_LINEAR));
+  rb_define_const (rb_mCairo, "PATTERN_TYPE_RADIAL",
+                   INT2FIX (CAIRO_PATTERN_TYPE_RADIAL));
+
   /* cairo_extend_t */
   rb_define_const (rb_mCairo,    "EXTEND_NONE",
                    INT2FIX (CAIRO_EXTEND_NONE));
@@ -258,8 +301,10 @@
                    INT2FIX (CAIRO_EXTEND_REPEAT));
   rb_define_const (rb_mCairo,    "EXTEND_REFLECT",
                    INT2FIX (CAIRO_EXTEND_REFLECT));
+  rb_define_const (rb_mCairo,    "EXTEND_PAD",
+                   INT2FIX (CAIRO_EXTEND_PAD));
+
 
-  
   /* cairo_filter_t */
   rb_define_const (rb_mCairo,    "FILTER_FAST",
                    INT2FIX (CAIRO_FILTER_FAST));

Index: rb_cairo_context.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_context.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- rb_cairo_context.c	17 Oct 2005 09:40:51 -0000	1.25
+++ rb_cairo_context.c	2 May 2006 05:37:02 -0000	1.26
@@ -449,6 +449,14 @@
 }
 
 static VALUE
+cr_new_sub_path (VALUE self)
+{
+  cairo_new_sub_path (_SELF);
+  cr_check_status (_SELF);
+  return self;
+}
+
+static VALUE
 cr_line_to (VALUE self, VALUE x, VALUE y)
 {
   cairo_line_to (_SELF, NUM2DBL (x), NUM2DBL (y));
@@ -807,6 +815,14 @@
 }
 
 static VALUE
+cr_set_scaled_font (VALUE self, VALUE scaled_font)
+{
+  cairo_set_scaled_font (_SELF, RVAL2CRSCALEDFONT (scaled_font));
+  cr_check_status (_SELF);
+  return self;
+}
+
+static VALUE
 cr_show_text (VALUE self, VALUE utf8)
 {
   cairo_show_text (_SELF, StringValuePtr (utf8));
@@ -1066,6 +1082,7 @@
   /* Path creation functions */
   rb_define_method (rb_cCairo_Context, "new_path", cr_new_path, 0);
   rb_define_method (rb_cCairo_Context, "move_to", cr_move_to, 2);
+  rb_define_method (rb_cCairo_Context, "new_sub_path", cr_new_sub_path, 0);
   rb_define_method (rb_cCairo_Context, "line_to", cr_line_to, 2);
   rb_define_method (rb_cCairo_Context, "curve_to", cr_curve_to, 6);
   rb_define_method (rb_cCairo_Context, "arc", cr_arc, 5);
@@ -1110,6 +1127,8 @@
   rb_define_method (rb_cCairo_Context, "set_font_options",
                     cr_set_font_options, 1);
   rb_define_method (rb_cCairo_Context, "font_options", cr_get_font_options, 0);
+  rb_define_method (rb_cCairo_Context, "set_scaled_font",
+                    cr_set_scaled_font, 1);
   rb_define_method (rb_cCairo_Context, "show_text", cr_show_text, 1);
   rb_define_method (rb_cCairo_Context, "show_glyphs", cr_show_glyphs, 1);
   rb_define_method (rb_cCairo_Context, "font_face", cr_get_font_face, 0);

Index: rb_cairo_font_face.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_font_face.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rb_cairo_font_face.c	10 Oct 2005 15:40:26 -0000	1.7
+++ rb_cairo_font_face.c	2 May 2006 05:37:02 -0000	1.8
@@ -46,10 +46,18 @@
     }
 }
 
+static VALUE
+cr_font_face_get_type (VALUE self)
+{
+  return INT2NUM ( cairo_font_face_get_type (_SELF));
+}
+
 
 void
 Init_cairo_font (void)
 {
   rb_cCairo_FontFace =
     rb_define_class_under (rb_mCairo, "FontFace", rb_cObject);
+
+  rb_define_method (rb_cCairo_FontFace, "type", cr_font_face_get_type, 0);
 }

Index: rb_cairo_pattern.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_pattern.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- rb_cairo_pattern.c	12 Oct 2005 15:21:56 -0000	1.14
+++ rb_cairo_pattern.c	2 May 2006 05:37:02 -0000	1.15
@@ -78,6 +78,12 @@
 }
 
 static VALUE
+cr_pattern_get_type (VALUE self)
+{
+  return INT2NUM (cairo_pattern_get_type (_SELF (self)));
+}
+
+static VALUE
 cr_solid_pattern_initialize (int argc, VALUE *argv, VALUE self)
 {
   VALUE red, green, blue, alpha;
@@ -311,7 +317,8 @@
   rb_define_alloc_func (rb_cCairo_Pattern, cr_pattern_allocate);
 
   rb_define_method (rb_cCairo_Pattern, "initialize", cr_pattern_initialize, 0);
-  
+  rb_define_method (rb_cCairo_Pattern, "type", cr_pattern_get_type, 0);
+
   rb_define_method (rb_cCairo_Pattern, "set_matrix", cr_pattern_set_matrix, 1);
   rb_define_method (rb_cCairo_Pattern, "matrix", cr_pattern_get_matrix, 0);
   

Index: rb_cairo_scaled_font.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_scaled_font.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rb_cairo_scaled_font.c	10 Oct 2005 15:40:26 -0000	1.3
+++ rb_cairo_scaled_font.c	2 May 2006 05:37:02 -0000	1.4
@@ -83,6 +83,12 @@
 }
 
 static VALUE
+cr_scaled_font_get_type (VALUE self)
+{
+  return INT2NUM (cairo_scaled_font_get_type ( _SELF (self)));
+}
+
+static VALUE
 cr_scaled_font_extents (VALUE self)
 {
   cairo_font_extents_t extents;
@@ -92,6 +98,16 @@
 }
 
 static VALUE
+cr_scaled_font_text_extents (VALUE self, VALUE utf8)
+{
+  cairo_text_extents_t extents;
+  cairo_scaled_font_text_extents (_SELF (self), StringValueCStr (utf8),
+                                  &extents);
+  cr_scaled_font_check_status (_SELF (self));
+  return CRTEXTEXTENTS2RVAL (&extents);
+}
+
+static VALUE
 cr_scaled_font_glyph_extents (VALUE self, VALUE rb_glyphs)
 {
   cairo_text_extents_t extents;
@@ -104,6 +120,43 @@
   return CRTEXTEXTENTS2RVAL (&extents);
 }
 
+static VALUE
+cr_scaled_font_get_font_face (VALUE self)
+{
+  cairo_font_face_t *face;
+  face = cairo_scaled_font_get_font_face (_SELF (self));
+  cr_scaled_font_check_status (_SELF (self));
+  return CRFONTFACE2RVAL (face);
+}
+
+static VALUE
+cr_scaled_font_get_font_matrix (VALUE self)
+{
+  cairo_matrix_t font_matrix;
+  cairo_scaled_font_get_font_matrix (_SELF (self), &font_matrix);
+  cr_scaled_font_check_status (_SELF (self));
+  return CRMATRIX2RVAL (&font_matrix);
+}
+
+static VALUE
+cr_scaled_font_get_ctm (VALUE self)
+{
+  cairo_matrix_t ctm;
+  cairo_scaled_font_get_font_matrix (_SELF (self), &ctm);
+  cr_scaled_font_check_status (_SELF (self));
+  return CRMATRIX2RVAL (&ctm);
+}
+
+static VALUE
+cr_scaled_font_get_font_options (VALUE self)
+{
+  cairo_font_options_t *options = cairo_font_options_create();
+  cairo_scaled_font_get_font_options (_SELF (self), options);
+  cr_scaled_font_check_status (_SELF (self));
+  rb_cairo_check_status (cairo_font_options_status (options));
+  return CRFONTOPTIONS2RVAL (options);
+}
+
 void
 Init_cairo_scaled_font (void)
 {
@@ -115,8 +168,17 @@
   rb_define_method (rb_cCairo_ScaledFont, "initialize",
                     cr_scaled_font_initialize, 4);
 
-  rb_define_method (rb_cCairo_ScaledFont, "extents",
-                    cr_scaled_font_extents, 0);
+  rb_define_method (rb_cCairo_ScaledFont, "type", cr_scaled_font_get_type, 0);
+  rb_define_method (rb_cCairo_ScaledFont, "extents", cr_scaled_font_extents, 0);
+  rb_define_method (rb_cCairo_ScaledFont, "text_extents",
+                    cr_scaled_font_text_extents, 1);
   rb_define_method (rb_cCairo_ScaledFont, "glyph_extents",
                     cr_scaled_font_glyph_extents, 1);
+  rb_define_method (rb_cCairo_ScaledFont, "font_face",
+                    cr_scaled_font_get_font_face, 0);
+  rb_define_method (rb_cCairo_ScaledFont, "font_matrix",
+                    cr_scaled_font_get_font_matrix, 0);
+  rb_define_method (rb_cCairo_ScaledFont, "ctm", cr_scaled_font_get_ctm, 0);
+  rb_define_method (rb_cCairo_ScaledFont, "font_options",
+                    cr_scaled_font_get_font_options, 0);
 }

Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_surface.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- rb_cairo_surface.c	1 May 2006 07:44:41 -0000	1.22
+++ rb_cairo_surface.c	2 May 2006 05:37:02 -0000	1.23
@@ -342,6 +342,13 @@
   return self;
 }
 
+static VALUE
+cr_surface_get_type (VALUE self)
+{
+  return INT2NUM (cairo_surface_get_type (_SELF));
+}
+
+
 #if CAIRO_HAS_PNG_FUNCTIONS
 static VALUE
 cr_image_surface_write_to_png_stream (VALUE self, VALUE target)
@@ -396,7 +403,6 @@
   cairo_font_options_t *options = cairo_font_options_create();
   cairo_surface_get_font_options (_SELF, options);
   cr_surface_check_status (_SELF);
-  options = cairo_font_options_copy (options);
   rb_cairo_check_status (cairo_font_options_status (options));
   return CRFONTOPTIONS2RVAL (options);
 }
@@ -636,13 +642,13 @@
   
   rb_cCairo_Surface =
     rb_define_class_under (rb_mCairo, "Surface", rb_cObject);
-
   rb_define_alloc_func (rb_cCairo_Surface, cr_surface_allocate);
   
   rb_define_method (rb_cCairo_Surface, "create_similar",
                     cr_surface_create_similar, 3);
   rb_define_method (rb_cCairo_Surface, "finish", cr_surface_finish, 0);
-  
+  rb_define_method (rb_cCairo_Surface, "type", cr_surface_get_type, 0);
+
   rb_define_method (rb_cCairo_Surface, "font_options",
                     cr_surface_get_font_options, 0);
   rb_define_method (rb_cCairo_Surface, "flush", cr_surface_flush, 0);



More information about the cairo-commit mailing list