Changeset 4104
- Timestamp:
- Dec 7, 2009, 6:06:04 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/ruby/caca-canvas.c
r4103 r4104 631 631 get_singleton_double_list(export) 632 632 get_singleton_double_list(import) 633 634 /****/ 635 636 simple_func(disable_dirty_rect) 637 simple_func(enable_dirty_rect) 638 get_int(dirty_rect_count) 639 640 static VALUE dirty_rect(VALUE self, VALUE n) 641 { 642 int x, y, width, height; 643 VALUE ary; 644 ary = rb_ary_new(); 645 caca_get_dirty_rect(_SELF, NUM2INT(n), &x, &y, &width, &height); 646 rb_ary_push(ary, INT2NUM(x)); 647 rb_ary_push(ary, INT2NUM(y)); 648 rb_ary_push(ary, INT2NUM(width)); 649 rb_ary_push(ary, INT2NUM(height)); 650 return ary; 651 } 652 653 static VALUE dirty_rects(VALUE self) 654 { 655 int n = caca_get_dirty_rect_count(_SELF), i; 656 VALUE ary; 657 ary = rb_ary_new(); 658 for(i=0; i<n; i++) 659 { 660 rb_ary_push(ary, dirty_rect(self, INT2NUM(i))); 661 } 662 return ary; 663 } 664 665 /*FIXME Handle an array for the rect */ 666 static VALUE add_dirty_rect(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) 667 { 668 caca_add_dirty_rect(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h)); 669 return self; 670 } 671 672 static VALUE remove_dirty_rect(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) 673 { 674 caca_remove_dirty_rect(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h)); 675 return self; 676 } 677 678 simple_func(clear_dirty_rect_list) 633 679 634 680 /****/ … … 713 759 rb_define_singleton_method(cCanvas, "export_list", export_list, 0); 714 760 rb_define_singleton_method(cCanvas, "import_list", import_list, 0); 715 } 716 761 762 rb_define_method(cCanvas, "disable_dirty_rect", disable_dirty_rect, 0); 763 rb_define_method(cCanvas, "enable_dirty_rect", enable_dirty_rect, 0); 764 rb_define_method(cCanvas, "dirty_rect_count", get_dirty_rect_count, 0); 765 rb_define_method(cCanvas, "dirty_rect", dirty_rect, 1); 766 rb_define_method(cCanvas, "dirty_rects", dirty_rects, 0); 767 rb_define_method(cCanvas, "add_dirty_rect", add_dirty_rect, 4); 768 rb_define_method(cCanvas, "remove_dirty_rect", remove_dirty_rect, 4); 769 rb_define_method(cCanvas, "clear_dirty_rect_list", clear_dirty_rect_list, 0); 770 771 } 772
Note: See TracChangeset
for help on using the changeset viewer.