October 17th, 1999, 12:23 PM
Hi there,
I am looking for some code for doing my own bitblitting routine.
Ofcourse not just bitblitting but make routines for different
types of blitting:
* transparency
* alpha blending
* darkening
* multiplying.
etc..
So a transparency call should look like this::
Bool MyTransparentBlit(
HDC hDestDC, int xpos, int ypos,
HDC hSrcDC, int xoffs, int yoffs, int width, int height)
{
// Get bits from DestDC
// Get Bits from source DC
// Mix'em together
// set Bits to dest DC
}
One of the calls that I need are probably GetDIBits, which calls for a bitmap.
Bummer!! In my heading I have only HDC....
Thus time to convert the DC to a bitmap. I've tried some code using a MemDC
and a bitblit and then select a compatible bitmap object into it, giving a handle to the old bitmap...
I tried to do it like this, but a call GetDIBits did not get the bits...
The return value (nr. of scan lines read) returned 0..so some thing went
wrong. (BTW I did not found mutch of info on getDIBIts or SetDIBIts in the mSDN library)...
So...
here's the question...
How do I get a proper handle to the bitmap inside any DC
and
How do i get the bits into the correct array...
BTW...
The bitmap created from the screen DC (in most cases this is the DestDC)
always returns a resolution of 1024x768 using GetDeviceCaps(HORZRES), which
is the screen resolution of my monitor, though it is not the size of the client area of the window it is attached to.. How do I get that area ?
Thanks appreciated..
When the code is ready I will certainly post it so these tricks for transparent
blits (using 9 bitblits or masked blits) are banned to the past...
Greetings and hope to hear from you soon ..
Hans Stevens
loba_loba@hotmail.com
I am looking for some code for doing my own bitblitting routine.
Ofcourse not just bitblitting but make routines for different
types of blitting:
* transparency
* alpha blending
* darkening
* multiplying.
etc..
So a transparency call should look like this::
Bool MyTransparentBlit(
HDC hDestDC, int xpos, int ypos,
HDC hSrcDC, int xoffs, int yoffs, int width, int height)
{
// Get bits from DestDC
// Get Bits from source DC
// Mix'em together
// set Bits to dest DC
}
One of the calls that I need are probably GetDIBits, which calls for a bitmap.
Bummer!! In my heading I have only HDC....
Thus time to convert the DC to a bitmap. I've tried some code using a MemDC
and a bitblit and then select a compatible bitmap object into it, giving a handle to the old bitmap...
I tried to do it like this, but a call GetDIBits did not get the bits...
The return value (nr. of scan lines read) returned 0..so some thing went
wrong. (BTW I did not found mutch of info on getDIBIts or SetDIBIts in the mSDN library)...
So...
here's the question...
How do I get a proper handle to the bitmap inside any DC
and
How do i get the bits into the correct array...
BTW...
The bitmap created from the screen DC (in most cases this is the DestDC)
always returns a resolution of 1024x768 using GetDeviceCaps(HORZRES), which
is the screen resolution of my monitor, though it is not the size of the client area of the window it is attached to.. How do I get that area ?
Thanks appreciated..
When the code is ready I will certainly post it so these tricks for transparent
blits (using 9 bitblits or masked blits) are banned to the past...
Greetings and hope to hear from you soon ..
Hans Stevens
loba_loba@hotmail.com