🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages Started by Asger Joergensen Mon, 17 Dec 2007 14:53
How to use BitBlt with a HBITMAP handle ?
#919
Author: Asger Joergensen
Date: Mon, 17 Dec 2007 14:53
13 lines
1121 bytes
Hi there

I have a situation where I have a HBITMAP handle
and I would like to paint this Bitmap to a Canvas,
but BitBlt takes a HDC.

So how do I get a HDC from a HBITMAP ?

I know I can assign the HBITMAP to a TBitmap->Handle
but I'm not interested in an extra copy of the bitmap.

Thanks in advance
Asger
Re: How to use BitBlt with a HBITMAP handle ?
#920
Author: Bruce Salzman
Date: Mon, 17 Dec 2007 17:25
16 lines
1461 bytes
"Asger Joergensen" <junk@Asger-P.dk> wrote in message 
news:MPG.21d0abd3ce2daf26989982@newsgroups.borland.com...
> Hi there
>
> I have a situation where I have a HBITMAP handle
> and I would like to paint this Bitmap to a Canvas,
> but BitBlt takes a HDC.
>
> So how do I get a HDC from a HBITMAP ?
>

You need to create a memory dc and select the HBITMAP into it first.

-- 
Bruce
Re: How to use BitBlt with a HBITMAP handle ?
#921
Author: Remy Lebeau (TeamB)
Date: Mon, 17 Dec 2007 17:38
17 lines
1477 bytes
"Asger Joergensen" <junk@Asger-P.dk> wrote in message 
news:MPG.21d0abd3ce2daf26989982@newsgroups.borland.com...

> So how do I get a HDC from a HBITMAP ?

CreateCompatibleDC(), SelectObject(), and SelectPalette(), and 
RealizePalette().

> I know I can assign the HBITMAP to a TBitmap->Handle
> but I'm not interested in an extra copy of the bitmap.

Assigning an HBITMAP to a TBitmap does not make a copy.  The TBitmap takes 
ownership of the HBITMAP instead.


Gambit 
Re: How to use BitBlt with a HBITMAP handle ?
#923
Author: Asger Joergensen
Date: Tue, 18 Dec 2007 02:27
52 lines
2806 bytes
Thanks Remy
 
 Remy Lebeau (TeamB) says:
> 
> "Asger Joergensen" <junk@Asger-P.dk> wrote in message 
> news:MPG.21d0abd3ce2daf26989982@newsgroups.borland.com...
> 
> > So how do I get a HDC from a HBITMAP ?
> 
> CreateCompatibleDC(), SelectObject(), and SelectPalette(), and 
> RealizePalette().

Do I  need the palette in 24bit ?
> 
> > I know I can assign the HBITMAP to a TBitmap->Handle
> > but I'm not interested in an extra copy of the bitmap.
> 
> Assigning an HBITMAP to a TBitmap does not make a copy.  The TBitmap takes 
> ownership of the HBITMAP instead.

I tried using the TBitmap Handle and it works, but I'm not sure 
if it will work corectly.

The thing is that I an using a TImageList to hold some bitmaps, 
but I don't like the ImageList:Draw function, it makes some 
realy bad looking blended images + it is extremly slow.

So I have written my own Draw function, but I need to get the 
bitmaps, since I use the scanlines in my draw function.

Imagelist::GetBitmap uses Draw to return the image, so that would 
eat the speed I gained.

I was thinking that I could use GetImageBitmap() but I would like 
it to work with the System Imagelist as well as with a user filled 
Imagelist.

Do You know if the HBITMAP returned from GetImageBitmap() is valid 
when images are aded to the System Imagelist after a call to 
SHGetFileInfo() ?
By valid I mean containing all images in the list.

When You mentioned that TBitmap takes ownership I got my doubts.

I have tried adding an OnChange event to the ImageList but
that isn't called when the system adds images.

Do You have some suggestions ?

Thanks in advance
Asger 
Re: How to use BitBlt with a HBITMAP handle ?
#924
Author: Remy Lebeau (TeamB)
Date: Tue, 18 Dec 2007 04:10
28 lines
1882 bytes
"Asger Joergensen" <junk@Asger-P.dk> wrote in message
news:MPG.21d14e86b29b3fb5989988@newsgroups.borland.com...

> Do I  need the palette in 24bit ?

No.

> Do You know if the HBITMAP returned from GetImageBitmap()
> is valid when images are aded to the System Imagelist after a call
> to SHGetFileInfo() ?

I doubt it.

> I have tried adding an OnChange event to the ImageList but
> that isn't called when the system adds images.

Of course not.  It is only triggered when you resize or change the
TImageList itself, assign its Handle property, or add/remove images.  There
are no system-generated notifications for ImageList modifications that occur
outside of the TImageList.

> Do You have some suggestions ?

What exactly are you having a problem with?


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads