A
Alexander Landa
Hi together!
I've wrote some code to rotate enhanced metafile by 270 degree.
It works fine and graphic programms show correct result,
also correct size of rotaded metafile.
But I got the problem I can't solve:
Word and WordPad shows no correct size of rotaded metafile,
also printed output has some artefacts.
For the original metafile I see the size (at 82% scaling) as followed:
Height 9.37 cm x Width 14.63 cm
For the rotated
Height 14.61 cm x Width 9.34 cm
I do no operation with rounding.
Original metafile is transformed record by record without WINAPI,
transformed records are content of new metafile. New metafile will
be created by WINAPI SetEnhMetaFileBits(emfLength, (const BYTE*)emh);
emf is the header of original metafile except some records are also
transformed:
// transform bounds rectangle
TransformBounds32(emh->rclBounds);
TransformBounds32(emh->rclFrame);
swap32(emh->szlDevice.cx, emh->szlDevice.cy);
swap32(emh->szlMillimeters.cx, emh->szlMillimeters.cy);
swap32(emh->szlMicrometers.cx, emh->szlMicrometers.cy);
// Bounds transformation (32-Bit)
void TEnhMetaTransformation::TransformBounds32(RECTL& Bounds)const
{
swap32(Bounds.left, Bounds.top);
swap32(Bounds.right, Bounds.bottom);
};
But the result looks also not very correct because of after printing
I get always rotated height 1mm smaller as original width and
rotated width 1mm bigger as original height, independent
from original size.
For test I wrote procedure to rotate old plain metafile.
Also I convert EMF to WMF and rotate them and got exactly
the same result.
It's also no difference if I generate RTF directly with my metafiles
or insert this as pictured from files.
Please help.
Sincerely yours,
Alexander Landa
I've wrote some code to rotate enhanced metafile by 270 degree.
It works fine and graphic programms show correct result,
also correct size of rotaded metafile.
But I got the problem I can't solve:
Word and WordPad shows no correct size of rotaded metafile,
also printed output has some artefacts.
For the original metafile I see the size (at 82% scaling) as followed:
Height 9.37 cm x Width 14.63 cm
For the rotated
Height 14.61 cm x Width 9.34 cm
I do no operation with rounding.
Original metafile is transformed record by record without WINAPI,
transformed records are content of new metafile. New metafile will
be created by WINAPI SetEnhMetaFileBits(emfLength, (const BYTE*)emh);
emf is the header of original metafile except some records are also
transformed:
// transform bounds rectangle
TransformBounds32(emh->rclBounds);
TransformBounds32(emh->rclFrame);
swap32(emh->szlDevice.cx, emh->szlDevice.cy);
swap32(emh->szlMillimeters.cx, emh->szlMillimeters.cy);
swap32(emh->szlMicrometers.cx, emh->szlMicrometers.cy);
// Bounds transformation (32-Bit)
void TEnhMetaTransformation::TransformBounds32(RECTL& Bounds)const
{
swap32(Bounds.left, Bounds.top);
swap32(Bounds.right, Bounds.bottom);
};
But the result looks also not very correct because of after printing
I get always rotated height 1mm smaller as original width and
rotated width 1mm bigger as original height, independent
from original size.
For test I wrote procedure to rotate old plain metafile.
Also I convert EMF to WMF and rotate them and got exactly
the same result.
It's also no difference if I generate RTF directly with my metafiles
or insert this as pictured from files.
Please help.
Sincerely yours,
Alexander Landa