Takuro Ashie
makei****@users*****
2006年 11月 22日 (水) 15:19:19 JST
Index: tomoe/ext/ruby/tomoe-rb-handwrite.c diff -u tomoe/ext/ruby/tomoe-rb-handwrite.c:1.2 tomoe/ext/ruby/tomoe-rb-handwrite.c:1.3 --- tomoe/ext/ruby/tomoe-rb-handwrite.c:1.2 Wed Nov 22 11:20:36 2006 +++ tomoe/ext/ruby/tomoe-rb-handwrite.c Wed Nov 22 15:19:19 2006 @@ -2,40 +2,40 @@ #include "tomoe-rb.h" -#define _SELF(obj) RVAL2TGLYPH(obj) +#define _SELF(obj) RVAL2TWRITING(obj) static VALUE tg_move_to(VALUE self, VALUE x, VALUE y) { - tomoe_glyph_move_to(_SELF(self), NUM2INT(x), NUM2INT(y)); + tomoe_writing_move_to(_SELF(self), NUM2INT(x), NUM2INT(y)); return Qnil; } static VALUE tg_line_to(VALUE self, VALUE x, VALUE y) { - tomoe_glyph_line_to(_SELF(self), NUM2INT(x), NUM2INT(y)); + tomoe_writing_line_to(_SELF(self), NUM2INT(x), NUM2INT(y)); return Qnil; } static VALUE tg_clear(VALUE self) { - tomoe_glyph_clear(_SELF(self)); + tomoe_writing_clear(_SELF(self)); return Qnil; } static VALUE tg_get_number_of_strokes(VALUE self) { - return UINT2NUM(tomoe_glyph_get_number_of_strokes(_SELF(self))); + return UINT2NUM(tomoe_writing_get_number_of_strokes(_SELF(self))); } static VALUE tg_get_number_of_points(VALUE self, VALUE stroke) { - return UINT2NUM(tomoe_glyph_get_number_of_points(_SELF(self), - NUM2UINT(stroke))); + return UINT2NUM(tomoe_writing_get_number_of_points(_SELF(self), + NUM2UINT(stroke))); } static VALUE @@ -43,7 +43,7 @@ { gint x, y; - if (tomoe_glyph_get_point(_SELF(self), NUM2UINT(stroke), NUM2UINT(point), + if (tomoe_writing_get_point(_SELF(self), NUM2UINT(stroke), NUM2UINT(point), &x, &y)) { return rb_ary_new3(2, INT2NUM(x), INT2NUM(y)); } else { @@ -56,7 +56,7 @@ { gint x, y; - if (tomoe_glyph_get_last_point(_SELF(self), &x, &y)) { + if (tomoe_writing_get_last_point(_SELF(self), &x, &y)) { return rb_ary_new3(2, INT2NUM(x), INT2NUM(y)); } else { return Qnil; @@ -66,7 +66,7 @@ static VALUE tg_remove_last_stroke(VALUE self) { - tomoe_glyph_remove_last_stroke(_SELF(self)); + tomoe_writing_remove_last_stroke(_SELF(self)); return Qnil; } @@ -75,18 +75,18 @@ { int i, j; guint number_of_strokes, number_of_points; - TomoeGlyph *glyph; + TomoeWriting *writing; - glyph = _SELF(self); - number_of_strokes = tomoe_glyph_get_number_of_strokes(glyph); + writing = _SELF(self); + number_of_strokes = tomoe_writing_get_number_of_strokes(writing); for (i = 0; i < number_of_strokes; i++) { VALUE points; - number_of_points = tomoe_glyph_get_number_of_points(glyph, i); + number_of_points = tomoe_writing_get_number_of_points(writing, i); points = rb_ary_new2(number_of_points); for (j = 0; j < number_of_points; j++) { gint x, y; - if (tomoe_glyph_get_point(glyph, i, j, &x, &y)) + if (tomoe_writing_get_point(writing, i, j, &x, &y)) rb_ary_push(points, rb_ary_new3(2, INT2NUM(x), INT2NUM(y))); } rb_yield(points); @@ -98,23 +98,23 @@ void Init_tomoe_handwrite(VALUE mTomoe) { - VALUE cTomoeGlyph; + VALUE cTomoeWriting; - cTomoeGlyph = G_DEF_CLASS(TOMOE_TYPE_GLYPH, "Glyph", mTomoe); + cTomoeWriting = G_DEF_CLASS(TOMOE_TYPE_WRITING, "Writing", mTomoe); - rb_include_module(cTomoeGlyph, rb_mEnumerable); + rb_include_module(cTomoeWriting, rb_mEnumerable); - rb_define_method(cTomoeGlyph, "move_to", tg_move_to, 2); - rb_define_method(cTomoeGlyph, "line_to", tg_line_to, 2); - rb_define_method(cTomoeGlyph, "clear", tg_clear, 0); - rb_define_method(cTomoeGlyph, "number_of_strokes", + rb_define_method(cTomoeWriting, "move_to", tg_move_to, 2); + rb_define_method(cTomoeWriting, "line_to", tg_line_to, 2); + rb_define_method(cTomoeWriting, "clear", tg_clear, 0); + rb_define_method(cTomoeWriting, "number_of_strokes", tg_get_number_of_strokes, 0); - rb_define_method(cTomoeGlyph, "get_number_of_points", + rb_define_method(cTomoeWriting, "get_number_of_points", tg_get_number_of_points, 1); - rb_define_method(cTomoeGlyph, "[]", tg_get_point, 2); - rb_define_method(cTomoeGlyph, "last_point", tg_get_last_point, 0); - rb_define_method(cTomoeGlyph, "remove_last_stroke", + rb_define_method(cTomoeWriting, "[]", tg_get_point, 2); + rb_define_method(cTomoeWriting, "last_point", tg_get_last_point, 0); + rb_define_method(cTomoeWriting, "remove_last_stroke", tg_remove_last_stroke, 0); - rb_define_method(cTomoeGlyph, "each", tg_each, 0); + rb_define_method(cTomoeWriting, "each", tg_each, 0); }