diff options
author | marion | 2007-05-21 10:07:58 +0000 |
---|---|---|
committer | marion | 2007-05-21 10:07:58 +0000 |
commit | e74eb17d058632da2c872451cc5e3d93113d1975 (patch) | |
tree | 51e999e933f3d4f2abe9d9e293c38ff0c6343b32 /src/MTools.pm | |
parent | 75af82ee4c38998ad822327c4ac01d0e9053970a (diff) | |
download | mtc-e74eb17d058632da2c872451cc5e3d93113d1975.zip mtc-e74eb17d058632da2c872451cc5e3d93113d1975.tar.gz mtc-e74eb17d058632da2c872451cc5e3d93113d1975.tar.bz2 mtc-e74eb17d058632da2c872451cc5e3d93113d1975.tar.xz |
Ajout des methodes width, height de MTools.pm
Diffstat (limited to 'src/MTools.pm')
-rw-r--r-- | src/MTools.pm | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/MTools.pm b/src/MTools.pm index 91306ad..d47d81e 100644 --- a/src/MTools.pm +++ b/src/MTools.pm @@ -75,6 +75,8 @@ package MTools; # - rotate # - coords # - bbox +# - width +# - height # - type # - tset # - treset @@ -93,7 +95,7 @@ BEGIN @ISA = qw / Exporter/; @EXPORT = qw / %fonts $zinc translate rotate executer mconfigure binding unbinding raise mget scale getGradient chggroup plink plisten mplaying minstance mrun minstanciate - propertyExists bbox mdelete mfind coords type tset treset tget clone unplisten/; + propertyExists bbox width height mdelete mfind coords type tset treset tget clone unplisten/; } use strict; @@ -454,13 +456,25 @@ sub treset { } sub bbox { - my ($obj) = @_; - return $zinc -> bbox (ref ($obj) eq '' ? $obj : $obj -> {instance}); + my ($obj) = @_; + return $zinc -> bbox (ref ($obj) eq '' ? $obj : $obj -> {instance}); +} + +sub width { + my ($obj) = @_; + my ($x1,$y1,$x2,$y2) = bbox($obj); + return ($x2 - $x1); +} + +sub height { + my ($obj) = @_; + my ($x1,$y1,$x2,$y2) = bbox($obj); + return ($y2 - $y1); } sub coords { - my ($obj, @args) = @_; - return $zinc -> coords (ref ($obj) eq '' ? $obj : $obj -> {instance}, @args); + my ($obj, @args) = @_; + return $zinc -> coords (ref ($obj) eq '' ? $obj : $obj -> {instance}, @args); } sub type { |