Simon Woods
2004-12-23 10:56:30 UTC
Hi
[Warning: graphics newbie]
I've a picture box, whose picture I'm assigning to a StdPicture variable. (I
basically want to alpha blend it in-memory and then assign it back to the
picture box, so I'm using 2 in-memory device contexts, CSourceDC and
CTargetDC)
I'm using Karl Petersens CMemoryDC. I pass in the picture into his class.
His routine uses the handle of the picture as the handle of the bitmap, hBmp
Dim bmp as BITMAP
GetObject(hBmp, Len(bmp), bmp)
This fails with an invalid handle error. However, if I pass in the Image
property of picture box this call works fine.
1) Could someone explain this to me please.
2) I make the necessary alphablend to the image/picture. I'm happy that each
pixel gets alphablended (I've tried 2 techniques for alphablending a) the
API call b) a VB-only routine which means I can check the alphablended value
of each pixel and everything seems okay). There's a SetDIBitsToDevice call
to transfer the processed pixel info back to the CTargetDC in-memory device
contexts. However, when I get the picture out of the CTargetDC in-memory and
put it back into the picture box it's black. Can someone suggest how I can
dig further to find out where it's failing.
Thanks
S
[Warning: graphics newbie]
I've a picture box, whose picture I'm assigning to a StdPicture variable. (I
basically want to alpha blend it in-memory and then assign it back to the
picture box, so I'm using 2 in-memory device contexts, CSourceDC and
CTargetDC)
I'm using Karl Petersens CMemoryDC. I pass in the picture into his class.
His routine uses the handle of the picture as the handle of the bitmap, hBmp
Dim bmp as BITMAP
GetObject(hBmp, Len(bmp), bmp)
This fails with an invalid handle error. However, if I pass in the Image
property of picture box this call works fine.
1) Could someone explain this to me please.
2) I make the necessary alphablend to the image/picture. I'm happy that each
pixel gets alphablended (I've tried 2 techniques for alphablending a) the
API call b) a VB-only routine which means I can check the alphablended value
of each pixel and everything seems okay). There's a SetDIBitsToDevice call
to transfer the processed pixel info back to the CTargetDC in-memory device
contexts. However, when I get the picture out of the CTargetDC in-memory and
put it back into the picture box it's black. Can someone suggest how I can
dig further to find out where it's failing.
Thanks
S