diff options
author | ribet | 2007-05-15 16:59:41 +0000 |
---|---|---|
committer | ribet | 2007-05-15 16:59:41 +0000 |
commit | 2af9d16b3495916d1ee83a9dd4f39e37131126b1 (patch) | |
tree | 9843ff185e93e6cdcfb77aee798c9e39df76ae99 | |
parent | b8f54421e18968143014d031d71f4d371caa4fe8 (diff) | |
download | mtc-2af9d16b3495916d1ee83a9dd4f39e37131126b1.zip mtc-2af9d16b3495916d1ee83a9dd4f39e37131126b1.tar.gz mtc-2af9d16b3495916d1ee83a9dd4f39e37131126b1.tar.bz2 mtc-2af9d16b3495916d1ee83a9dd4f39e37131126b1.tar.xz |
Ajoute la possibilité d'utiliser une texture sur un groupe. Ce code contourne l'impossibilité de zinc de faire du clipping sur un groupe.
-rw-r--r-- | src/MTools/GUI/MTexture.pm | 22 |
1 files changed, 19 insertions, 3 deletions
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; } |