|
-
Dec 12th, 2001, 12:57 AM
#1
Thread Starter
Fanatic Member
An easy question in DirectX(Direct Draw)
I am a newbie in DX. While creating a surface from a picture file we use Set Surface=DirectDraw.CreateSurfaceFromFile().
My question is there is also a function DirectDraw.GetSurfaceFromDC() and I want to know how to use this. I tried getting the hDc of a picture box but no luck.
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Dec 12th, 2001, 05:53 AM
#2
Fanatic Member
Used this in Delphi a few days ago, don't quite remember the VB way, but since it's all just directx, it should be similar. Therefore, a little pseudo-code:
VB Code:
'// Set up a DDSURFACEDESC2 with the width & height and stuff,
'// then create an empty surface
Set Surface = DirectDraw.CreateSurface()
'// Get DC
DC = Surface.GetDC()
'// Draw from source DC onto surface DC
BitBlt(Source, 0, 0, Width, Height, DC, 0, 0, vbSrcCopy)
'// Release DC
Surface.ReleaseDC(DC)
Should work something like that 
[edit]
oops, used Delphi-style comments 
[/edit]
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
-
Dec 12th, 2001, 08:23 AM
#3
Good Ol' Platypus
I think you're trying to use it the wrong way- you're trying to get the picture from a DC into the Surface, while what that function does is allows you to use the surface in GDI operations. It returns the DC rather than setting it.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Dec 12th, 2001, 08:26 AM
#4
-
Dec 12th, 2001, 12:05 PM
#5
Thread Starter
Fanatic Member
Yeah I was trying to set the DC. Actually I tried using the mask technique to make an area invisible using BitBlt and then set that DC to the surface. I am just a newbie and don't know much in DX. Can anyone give some help.
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Dec 12th, 2001, 12:36 PM
#6
Fanatic Member
Use the SetColorKey function of the surface to get a color transparent 
http://www.vbexplorer.com/directx4vb/ explains it quite good
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
-
Dec 13th, 2001, 01:13 PM
#7
Thread Starter
Fanatic Member
Thanks, I got it
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
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
|