 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Digistencil Guest
|
Posted: Sat Jun 26, 2004 10:58 am Post subject: Read bitmap |
|
|
Hi,
I have a function that returns a pointer that contains the header and the
bitmap:
hoGetImage_VD104L(1,0,pImage1,@i)
When i use StretchDIBBits to draw it i get nothing but blank image:
StretchDIBits(Bitmap.Canvas.Handle,0,0,768,576,0,0,768,576,pImage1,bih,DIB_R
GB_COLORS,SRCCOPY);
Is it because i must read the header first? How can i do that? can someone
help me to display the bitmap?
Thanks,
Mario
|
|
| Back to top |
|
 |
Joris Van Damme Guest
|
Posted: Sat Jun 26, 2004 12:11 pm Post subject: Re: Read bitmap |
|
|
"Digistencil" <digistencil (AT) mail (DOT) telepac.pt> wrote
| Quote: | I have a function that returns a pointer that contains the header and the
bitmap:
hoGetImage_VD104L(1,0,pImage1,@i)
When i use StretchDIBBits to draw it i get nothing but blank image:
StretchDIBits(Bitmap.Canvas.Handle,0,0,768,576,0,0,768,576,pImage1,bih,DIB_R
GB_COLORS,SRCCOPY);
Is it because i must read the header first? How can i do that? can someone
help me to display the bitmap?
|
Let's assume the function returns something along those lines and such and
that the protocol of all calls is correct. In that case, I can see only one
obvious possible cause. A bitmap file format is, in short, the bitmap file
header, the bitmap header, the palette, and the pixel color raster data. A
windows bitmap memory structure, as used in windows calls like
StretchDIBits, is the same except that it doesn't include the bitmap file
header. So the cause may be that this function of yours sets up a block
containing this file header. Thus, the obvious thing to try next may be
StretchDIBits(Bitmap.Canvas.Handle,0,0,768,576,0,0,768,576,
Pointer(Cardinal(pImage1)+SizeOf(TBitmapFileHeader)),
Pointer(Cardinal(bih)+SizeOf(TBitmapFileHeader)),
DIB_RGB_COLORS,SRCCOPY);
If that yields something other then a blank image, but does not yet seem
visually correct, chances are the
Pointer(Cardinal(pImage1)+SizeOf(TBitmapFileHeader)) parameter is now
correct, but the Pointer(Cardinal(bih)+SizeOf(TBitmapFileHeader)) parameter
still isn't.
Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
|
|
| Back to top |
|
 |
Joris Van Damme Guest
|
Posted: Sat Jun 26, 2004 12:50 pm Post subject: Re: Read bitmap |
|
|
| Quote: | Let's assume the function returns something along those lines and such and
that the protocol of all calls is correct.
|
I should have checked first... but now I have.
The first of the two parameters of StretchDIBits that I modified in previous
mail is the pointer to the raster bits, the second is a pointer to the
bitmap header as a var parameter. I always mix 'em up, too, I'm lost without
F1 and CTRL-SHIFT-spacebar...
So probably your 'bih' parameter is a TBitmapHeader procedure local var? But
then passing pImage1 is way off... Well, I'm in the dark, I don't know what
the function returns, don't know what bih is, don't know what pixel
depth(s?) you expect and whether or not you expect a palette which is a
factor in calculating bits offset if indeed the function returns a bitmap
structure... I should have kept my mout shut, or should have asked for more
details.
Sorry. Ignore me.
Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|