BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Read bitmap

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Digistencil
Guest





PostPosted: Sat Jun 26, 2004 10:58 am    Post subject: Read bitmap Reply with quote



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





PostPosted: Sat Jun 26, 2004 12:11 pm    Post subject: Re: Read bitmap Reply with quote



"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





PostPosted: Sat Jun 26, 2004 12:50 pm    Post subject: Re: Read bitmap Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.