[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-08 10:06:18
[Download RAW message or body]


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?)?

2. What is the easiest way to convert a 32-bit BMP (stored in a QByteArray) to 
a 16-bit BMP (QT doesn't support 24?)?  I mean QImage::convertDepth works but 
QImage::save can't write to a QByteArray and I don't want to write to a 
temporary file...

3. How do I find out the original width/height of a WMF?  I don't understand 
the code in ExportFilter.cc starting from "// d7cdc69a is metaheader magic 
id" because IIRC, the magic for a WMF is not d7cdc69a (at least not for 
"Standard WMFs")?

Thanks,
Clarence

On Fri, 3 Jan 2003 03:41 pm, Nicolas Goutte wrote:
> Good question! ;-)
>
> The KOffice WMF source files are at
> koffice/lib/kwmf/*
> koffice/ib/kofficecore/koPictureWmf.*
>
> For anything QImage-based, I suppose that it should be not too difficult.
> You have to reverse QWinMetaFile::dibBitBlt (in the file
> koffice/kwmf/qwmf.cc)
>
> (See the KWord's AbiWord, HTML and RTF export filters for picture code,
> mostly to PNG, JPEG and SVG.)
>
> The problems are as always: EPS, QPicture and SVG.
>
> For EPS, you can convert it to a bitmap easily. For the other metafile
> formats, you can use KoPicture::generatePixmap. (A new method for KoPicture
> to get a QImage whetever the internal file format of KoPicture is planned
> but not yet done.)
>
> If you want to convert the metafiles 1:1, it gets more complex. For EPS, I
> have no idea how to do it (probably a new driver for GhostScript.) For
> QPIcture (and therefore also for SVG), you would probably have to use the
> same trick as for saving SVG from QPicture. The problem is that QSvgDevice
> uses many non-document features of QT to be able to work. .-(
>
> So that is what I know about exporting to WMF. May be I have missed easier
> ways.
>
> Have a nice day/evening/night!
>
> On Saturday 04 January 2003 00:00, Clarence Dang wrote:
> > Hi,
> >
> > How do I convert a picture to a "Standard Windows Metafile" for a KWord
> > export filter (in code, not via the GUI)?
> >
> > 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