Subject: | Image-WMF-1.01: Map mode should be $MM_ANISOTROPIC |
Date: | Wed, 19 Dec 2007 16:16:08 +0600 |
To: | bug-Image-WMF [...] rt.cpan.org |
From: | "Tagir F. Valeev" <amaembo [...] gmail.com> |
When creating WMF using Image::WMF it looks ok, but when I try to
insert it into Microsoft Word document it refuses to resize properly
(crop instead of resize), because map mode is set to $MM_TEXT by
default. Usually graphical software generates setMapMode call with
$MM_ANISOTROPIC parameter, so the resulting WMF can be resized
properly when inserting into Microsoft Word document. I suggest to set
this mode by default or at least provide the official way to change
this (like one more parameter to the 'new' subroutine). I've fixed the
problem for myself in the following manner:
sub createWMF($$;$) {
my ($x, $y, $res) = @_;
use Image::WMF::Constants;
my $im = new Image::WMF($x, $y, $res);
if(!$im) {
$im->{'_wmf'}->{'_wmf'}="";
$im->{'_wmf'}->setROP2($R2_COPYPEN);
$im->{'_wmf'}->setWindowExt($x, $y);
$im->{'_wmf'}->setMapMode($MM_ANISOTROPIC);
$im->{'_wmf'}->setWindowOrg(0,0);
}
return $im;
}
Though it works perfectly, this solution violates incapsulation, thus
not so beautiful.
-- Lan (Tagir F. Valeev)