WMF.Top failure in Delphi?

Please discuss general Delphi programming topics here.

WMF.Top failure in Delphi?

Postby norbert » May 28th, 2006, 9:22 pm

Here a bug ocurring with WMF files with meta header:

The hex header structure of a WMF file reads like this in C++:

Code: Select all
// special treatment for WMF file with metaheader
// d7cdc69a is metaheader id:
uint8* data = (quint8*) image.data();
if( ( data[0] == 0xd7 ) && ( data[1] == 0xcd ) &&
( data[2] == 0xc6 ) && ( data[3] == 0x9a ) &&
( image.size() > 22 ) )
{
// 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);


The results from the code above are alway OK.

Let's suppose the values for LEFT and TOP are '00' & '00' hex both.
Debugging the value of LEFT corresponds to the Delphi 7 value of WMF.LEFT, but debugging the value of TOP results in a huge integer like 554839629 which is not correct. It should be '00' & '00', too.

Is there anybody in this forum dealing with the same bug? Well, the solution is to simply read the binary values from file. My intention is to find out why the result fails with Delphi 7.

Norbert
norbert
Active Member
Active Member
 
Posts: 17
Joined: May 13th, 2006, 8:49 am
Location: Germany

Return to Delphi Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron