Comment 7 for bug 818539

Revision history for this message
David Mathog (mathog) wrote :

I have been trying to get this going, and found that adding the few lines in the attached text file (NOT A PATCH!) causes EMF
files with embedded images to place the fake images at the appropriate sizes, but not at the right places (some scale issue). I can work onward from this if somebody can give me a clue how to get from the bitmap data stored in the EMF to the base64 format expected in the SVG. This section of code is a bit bizarre since the way the EMF import works is that it constructs a pseudo SVG file on the fly (minus certain parts, like the ID's in this section) and then when that is done it
converts the whole thing to a document with SPDocument::createNewDocFromMem.

I looked all over the Inkscape code and could not find an example that showed how to get from A (the EMF bitmap) to B (the base64 encoded PNG). The closest was, I guess, when a gdkpixbuf is loaded from a clipboard, saved to a PNG file, and then loaded into a document from that file. (This is the "paste" operation for an image.) The MSDN documentation indicates that various types of bitmaps can be in the EMF - presumably somewhere MS has a function that converts all of them to a full size RGB array, and from there it is just a hop skip and a jump to the base64 PNG. But I could not find that MS function.

Note in the attachment the first "xlink" line - until that was added the pseudo SVG was loading "xlink:href" as just "href", with the resulting bitmaps being invisible and unusable.