From 2af9d16b3495916d1ee83a9dd4f39e37131126b1 Mon Sep 17 00:00:00 2001 From: ribet Date: Tue, 15 May 2007 16:59:41 +0000 Subject: Ajoute la possibilité d'utiliser une texture sur un groupe. Ce code contourne l'impossibilité de zinc de faire du clipping sur un groupe. --- src/MTools/GUI/MTexture.pm | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/MTools/GUI') diff --git a/src/MTools/GUI/MTexture.pm b/src/MTools/GUI/MTexture.pm index 82c7d2d..13ad4aa 100644 --- a/src/MTools/GUI/MTexture.pm +++ b/src/MTools/GUI/MTexture.pm @@ -56,18 +56,34 @@ sub new { mdelete ($image); + my @images_list; for (my $x = 0; $x < $w; $x += $img_w) { for (my $y = 0; $y < $h; $y += $img_h) { - $image = new MTools::GUI::MImage ($self, $image_name); - $image -> translate ($x + $bb [0], $y + $bb [1]); + $image = new MTools::GUI::MImage ($self, $image_name); + $image -> translate ($x + $bb [0], $y + $bb [1]); + push @images_list, $image; } } my $clip = clone ($target); mconfigure ($clip, -visible => 0); - new MTools::GUI::MClip ($self, $clip); + if (type ($clip) eq 'group') { + my $texture = new MTools::GUI::MGroup($self); + foreach (@images_list) { + chggroup($_, $texture); + } + foreach ($zinc->find('withtag', ".$clip*")) { + if (type ($_) ne 'group') { + mconfigure ($_, -visible => 0); + new MTools::GUI::MClip (clone($texture), $_); + } + } + mdelete($texture); + } else { + new MTools::GUI::MClip ($self, $clip); + } return $self; } -- cgit v1.1