aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarion2007-05-21 10:07:58 +0000
committermarion2007-05-21 10:07:58 +0000
commite74eb17d058632da2c872451cc5e3d93113d1975 (patch)
tree51e999e933f3d4f2abe9d9e293c38ff0c6343b32
parent75af82ee4c38998ad822327c4ac01d0e9053970a (diff)
downloadmtc-e74eb17d058632da2c872451cc5e3d93113d1975.zip
mtc-e74eb17d058632da2c872451cc5e3d93113d1975.tar.gz
mtc-e74eb17d058632da2c872451cc5e3d93113d1975.tar.bz2
mtc-e74eb17d058632da2c872451cc5e3d93113d1975.tar.xz
Ajout des methodes width, height de MTools.pm
-rw-r--r--debian/changelog4
-rw-r--r--src/MTools.pm24
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 {