Dynamic replacement of metafiles records not possible when playing back with GDI



Hi!
I'm working on a document export facility which is supposed to be
backed up by EMF files.
The idea is to optimize an EMF so that no bitmaps are stored internally
(for now, say, in the StretchDIBits records), but rather a reference to
the image is kept in a private comment block and a dummy StretchDIBits
is stored in the metafile that has a kind of a banner to give an idea
of an image that might've been stored here (for instance, a bitmapped
name of the external file).
Later, these files comprise part of the document history thus a
requirement to keep them as small and well-behaved as possible. (The
magnitude of information stored in the document can easily blow an
ordinary EMF to be several 10s of MBs in size - which is hopefully
remedied with such a links-only solution which would still keep EMFs
conform)
The problem I'm facing is when I'm playing back such EMFs and replace
the dummy StretchDIBits with the actuall data (that I collect elsewhere
based on the links stored in the commented block), and that data is
naturally bigger than the dummy data that originally comes from the
metafile, GDI refuses to play back such a record. I figured the reason
for that is the GDI validates the sizes of the provided actual image
buffer and the size of the meta file (here, size of the metafile is
either physical metafile size or size of the metafile bits set with
SetEnhMetaFileBits())
Now, I can probably consider that a security measure which I would love
to turn off as we're not set to "misuse" the metafiles.
If there's another reason, I would love to hear a rationale.
To Feng Yuan : thanks for your great book; perhaps you would have the
answer for me?

Thanks all for your help in advance,
dmitri.

.



Relevant Pages

  • Re: Cutlines im Report
    ... Vektordaten - aber nicht die von VFP erzeugten.< ... Aus der Microsoft EMF Specification ... This is a specification of the Enhanced Metafile Format structure, ...
    (microsoft.public.de.fox)
  • Re: Serious GDI Multithreading bug while printing to metafiles
    ... GDI calls end up in the EMF. ... metafile DC and the printer DC. ... Strange is, the CreateFont(), SelectFont, ..., DeleteFontis ...
    (microsoft.public.win32.programmer.gdi)
  • Re: KB835732 EMF-problem status and info?
    ... > You cannot view enhanced metafile format graphics files (or EMF image ... > Contact Product Support Services for the hotfix and to answer any ... metafile validation, or even a tool for checking ... now hundreds of images suddenly became unusable. ...
    (microsoft.public.windowsupdate)
  • Re: Cutlines im Report
    ... Eine EMF ist definitiv keine Vektordatei, den Du mit einem Plotter schneiden kannst. ... This is a specification of the Enhanced Metafile Format structure, ...
    (microsoft.public.de.fox)
  • Re: Vector format images
    ... What version of Illy are you using to create the EMF? ... can do that - which is one reason I don't prefer them. ... CS3 with no problem inserting EMFs generated from it. ... Another oddity which I include just in case it's related: the imported images ...
    (microsoft.public.mac.office.word)