Author | Topic: XbpMetaFile | |
---|---|---|
Frans Vermeulen | XbpMetaFile on Thu, 25 Feb 2021 10:15:59 +0100 Dear Colleagues, Using the XbpMetaFile, i noticed something odd. (build 1360) When I do: cMetaData :=<some_windows_wmf_data> oMetaFile :=XbpMetaFile():New():Create() oMetaFile:SetBuffer(cMetaData) the content of the buffer is Nil If I do: cMetaData :=<some_windows_wmf_data> oMetaFile :=XbpMetaFile():New():Create() oMetaFile:Load("picture.wmf") oMetaFile:SetBuffer(cMetaData) the content of the buffer is <some_windows_wmf_data> but only if the file "picture.wmf" exists, and contains wmf-data. If I do the following: cMetaData :=<some_windows_wmf_data> oFileDev :=XbpFileDef():New():Create() oMetaFile :=oFileDev:MetaFile() oFileDev:Destroy() oMetaFile:SetBuffer(cMetaData) the content of the buffer is <some_windows_wmf_data> What is the reason, the buffer does not get set in the first oMetaFile:SetBuffer(cMetaData) scenario? I attached 2 files, one can be used to load a wmf-file, the other can be used to read the <some_windows_wmf_data> from. Regards, Frans Vermeulen metafile.zip | |
Frans Vermeulen | Re: XbpMetaFile on Fri, 26 Feb 2021 15:33:16 +0100 I digged deeper into the issue, and from the docs: === The initial creation of a metafile always uses an XbpFileDev object that generates an XbpMetaFile object. === Which means (as far as I read it) that for creating an actual wmf-file on disk, you need the XbpFileDev-route. A bit odd, because AFAICS, you can use any enhanced-metafile (EMF, not WMF nor EMF+) to load into the XbpMetaFile. From the setBuffer()-documentation: === This allows graphic data to be exchanged between different XbpMetaFile objects. === which confuses me into believing, that what I do is not illegal, and is supposed to work. Can anyone shed some light on this? Frans Vermeulen > Dear Colleagues, > > Using the XbpMetaFile, i noticed something odd. (build 1360) > > When I do: > cMetaData :=<some_windows_wmf_data> > > oMetaFile :=XbpMetaFile():New():Create() > oMetaFile:SetBuffer(cMetaData) > > the content of the buffer is Nil > > If I do: > cMetaData :=<some_windows_wmf_data> > > oMetaFile :=XbpMetaFile():New():Create() > oMetaFile:Load("picture.wmf") > oMetaFile:SetBuffer(cMetaData) > > the content of the buffer is <some_windows_wmf_data> > but only if the file "picture.wmf" exists, and contains wmf-data. > > If I do the following: > cMetaData :=<some_windows_wmf_data> > > oFileDev :=XbpFileDef():New():Create() > oMetaFile :=oFileDev:MetaFile() > oFileDev:Destroy() > oMetaFile:SetBuffer(cMetaData) > > the content of the buffer is <some_windows_wmf_data> > > What is the reason, the buffer does not get set in the first > oMetaFile:SetBuffer(cMetaData) scenario? > > I attached 2 files, one can be used to load a wmf-file, the other > can be used to read the <some_windows_wmf_data> from. > > Regards, > Frans Vermeulen > > Frans Vermeulen <fv@gbor.nl> |