[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: How to convert to Standard WMF?
From: Clarence Dang <dang () kde ! org>
Date: 2003-01-16 5:04:11
[Download RAW message or body]
On Wed, 8 Jan 2003 04:40 pm, Nicolas Goutte wrote:
> On Wednesday 08 January 2003 22:04, Clarence Dang wrote:
> > Hi Nicolas,
> >
> > Thanks for the source code pointers on WMF. I've managed to write a
> > BMP-to-WMF converter function. But I still have a few questions about
> > the RTF export filter (ExportFilter.cc) and image manipulation in
> > general:
> >
> > 1. Given a BMP, how do I make sure that it's a DIB, not a DDB (is there
> > an easy conversion function or are all QT BMPs DIBs?)?
>
> Device-depedent bitmap were for BMP of Windows 1.X and 2.X and should not
> exist much anymore.
>
> As far as I could see from the code, QT only writes standard uncompressed
> Windows 3.x BMP files (in the QT's file src/kernel/qimage.cpp.)
>
No, I mean suppose the user puts a DDB in a KWord file and then saves to .WRI.
Would loadSubFile() give the .WRI export filter a DDB or a DIB?
> 2a: in 32 bit mode, QT write 24 bit BMP images. As 16 bit BMP is
> non-standard ("multimedia extensions"), QT does not seem to support it.
>
But the HTML doc for QImage::convertDepth says "The depth argument must be 1,
8, 16, 32"... The qimage code is very hard to read so I might be wrong
here...
> > 3. How do I find out the original width/height of a WMF?
>
(...)
> - low level: load the picture qo a QWinMetaFile (QWinMetaFile::load) and
> use QWinMetaFile::bbox (I have no idea if it really works if the WMF file
> has no special header.)
>
Yes, I just checked and it's valid (for Standard, Placeable and
Enhanced...although EMFs aren't supported by QWmf, it seems) but may return
negative values (for upside-down WMFs etc.). I'm worried about this code
in ExportFilter.cc though:
// grab bounding box, find original size
unsigned left = data[6]+(data[7]<<8);
unsigned top = data[8]+(data[9]<<8);
unsigned right = data[10]+(data[11]<<8);
unsigned bottom = data[12]+(data[13]<<8);
origWidth = (long) (MM_TO_TWIP(right-left)/100);
origHeight = (long) (MM_TO_TWIP(bottom-top)/100);
According to a O'Reilly, for Placeable Metafiles, "Left, Top, Right, and
Bottom contain the coordinates of the upper-left and lower-right corners of
the image on the output device. These are measured in twips", not
millimetres.
Thanks,
Clarence
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic