|
-
Mar 14th, 2003, 07:12 AM
#1
Thread Starter
Lively Member
Transparent Blit
hi,
Plz help me with this one.
I have a series of images of a walking character that i want to blit on to a background. But the images blitted should be transparent. The first thing i did was that i got all the images into an array of stdPicture objects (i'm not using DirectX and i don't want to, at this moment). Then i wrote the code to load one of the images into the a picturebox that would be displaying the rest of the sequence when the user presses the LeftArrow key. But here i needed the characters background color i.e. White in this case to be transparent. So i thought of getting the background of the form to be blitted onto the picturebox first and then the characters image to be blitted using the API TransparentBlit. i.e.
call BitBlit(picture1.hdc,0,0,picture1.width,picture1.height,form1.hdc,picture1.left,picture1.top,SRCCOPY )
call TransprentBlit(picture1.hdc,0,0,picture1.width,pictue1.heoght,stdpicture(1).handle,0,0,stdpicture(1) .width,stdpicture(1).height,rgb(255,255,255))
but here the stdpicture(1).handle is the handle of the bitmap and not any DC. So the TransparentBlit function doesn't work.
How can i get this thing done without using any more image or pictureboxes.
I tried using one more picturebox, i.e. getting tthe stdpicture(1) into the second picturebox and then TransparentBliting it onto the picture1 picture box.
But after some time of working fine it gives me an out of memory error.
-
Mar 14th, 2003, 08:48 AM
#2
PowerPoster
Use offscreen DCs: http://fox.acky.net/vb/english/coding/tutorial/3.3.html
btw: Pictureboxes have a hDC property which is their DC. Images don't have a DC.
-
Mar 14th, 2003, 10:33 AM
#3
Just seen your site for the first time - very cool!!
-
Mar 14th, 2003, 10:41 AM
#4
Is this your site Fox?? http://fox.acky.net/vb/english/codin...ial/index.html I can remember that I othen landed on this one when I was searching for VB Game code in my early days og game programming....Nice site...
-
Mar 14th, 2003, 02:38 PM
#5
PowerPoster
Yes, that's the tutorial I once started and never finished. I ran out of time and later I was pissed to continue writing it. The site itselves starts here http://fox.acky.net/vb/
However I didn't spend any time on it lately so the demo projects may be outdated - at least in my eyes they are. If I ever decided to update the site again it will be a 100% update with completely new projects and only complete tutorials. But this may take me a while before I even start..
-
Mar 14th, 2003, 02:52 PM
#6
I havn't read much on the page, but the tile tutorial can still be used as theory i think. So I hope you get the time to update it....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|