diff options
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | src/MTools.pm | 24 |
2 files changed, 23 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog index 057287c..46d45f9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,7 @@ +mtools-perl (1.1-1) unstable; urgency=low + + * Ajout des methodes width, height de MTools.pm + mtools-perl (1.0-1) unstable; urgency=low * Initial Debian release 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 { |