DopeyBiach Posted May 26, 2013 Author Share Posted May 26, 2013 This is REALLY grating on me. I can't for the life of me figure out what I'm missing here. It's a simple program where a picture is blitted into a picturebox with the black background removed.When I remove:```Or DDBLT_KEYSRC```from:```DDRVAL = DDS_Primary.Blt(r1, DDS_Buffer, r2, DDBLT_WAIT Or DDBLT_KEYSRC)```It then works fine, but that defeats the object as ALL I want to do is simply blit a bmp, to a picturebox, with the background removed.Here is the source, PLEASE HELP. ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png)```Option ExplicitDim DX As New DirectX7Dim DD As DirectDraw7Dim DDS_Primary As DirectDrawSurface7Dim DDS_Buffer As DirectDrawSurface7Dim DDSD_Primary As DDSURFACEDESC2Dim DDSD_Buffer As DDSURFACEDESC2Dim DD_Clipper As DirectDrawClipperDim ColorKey As IntegerDim CKey As DDCOLORKEYDim PixelFormat As DDPIXELFORMATDim bInit As BooleanPrivate Sub cmdProcess_Click()Call BltEnd SubPrivate Sub Form_Load()InitEnd SubPrivate Sub Init()Set DD = DX.DirectDrawCreate("")Call DD.SetCooperativeLevel(Me.hWnd, DDSCL_NORMAL)DDSD_Primary.lFlags = DDSD_CAPSDDSD_Primary.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACESet DDS_Primary = DD.CreateSurface(DDSD_Primary)DDSD_Buffer.lFlags = DDSD_CAPSDDSD_Buffer.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAINSet DDS_Buffer = DD.CreateSurfaceFromFile(App.Path & "image.bmp", DDSD_Buffer)ColorKey = vbBlackCKey.high = ColorKeyCKey.low = ColorKeyCall DDS_Buffer.SetColorKey(DDCKEY_SRCBLT, CKey)Set DD_Clipper = DD.CreateClipper(0)Call DD_Clipper.SetHWnd(picScreen.hWnd)Call DDS_Primary.SetClipper(DD_Clipper)bInit = TrueEnd SubPrivate Sub Blt()If bInit = False Then Call MsgBox("DirectDraw has not been initialized yet!", vbInformation, "Application Error") Exit SubEnd IfpicScreen.ClsDim DDRVAL As LongDim r1 As RECT ' ScreenDim r2 As RECT ' BufferCall DX.GetWindowRect(picScreen.hWnd, r1)With r2 .Bottom = DDSD_Buffer.lHeight .Right = DDSD_Buffer.lWidthEnd WithDDRVAL = DDS_Primary.Blt(r1, DDS_Buffer, r2, DDBLT_WAIT Or DDBLT_KEYSRC)End SubPrivate Sub picScreen_Paint()DD.RestoreAllSurfacesInitEnd Sub``` Link to comment Share on other sites More sharing options...
Synergy Posted May 26, 2013 Share Posted May 26, 2013 [Does this help?](http://content.gpwiki.org/index.php/DirectX:DirectDraw:Tutorials:VB:DX7:Transparency) Link to comment Share on other sites More sharing options...
DopeyBiach Posted May 26, 2013 Author Share Posted May 26, 2013 I've been there many times already. I've also been to countless forums and other resources.I'm relatively new to DX7, most of the examples use full screen - which is difficult for me to set back to window in order to get the code to work.Simple all I want to do. Is with DX7 draw a bitmap to a picture box and remove the background, in a window.No fullscreen applications or dodgy masking techniques and such, it should be such a simple procedure, yet I really seem to be missing something?Thank you for the reply, urgh. D: Link to comment Share on other sites More sharing options...
Synergy Posted May 26, 2013 Share Posted May 26, 2013 Have you tried just looking at how it's done in Eclipse, since that's all windowed and uses BMPs? I can't help too much as I don't have VB6 or Eclipse installed. Link to comment Share on other sites More sharing options...
DopeyBiach Posted May 26, 2013 Author Share Posted May 26, 2013 I have done. I'm having no luck though, I can't seem to understand why either. If I was getting an error then I would be happy as I'd know where I was going wrong, but I get get nothing.With DDBLT_KEYSRC there nothing renders at all, yet without DDBLT_KEYSRC it renders fine, but I want transparency. =/I've been developing at a wicked pace recently, yet something so simple seems to stump me lol. Link to comment Share on other sites More sharing options...
Synergy Posted May 26, 2013 Share Posted May 26, 2013 Hm… Sorry. No idea. It sounds simple enough though. Hopefully someone else can help.. ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
DopeyBiach Posted May 26, 2013 Author Share Posted May 26, 2013 Thank you for trying to help, it should be simple, incredibly simple.As they say though - "It's always the simple things.." ![<_<](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/dry.png)I've tried so many different ways to do this it's unreal. Link to comment Share on other sites More sharing options...
Zeno Posted May 26, 2013 Share Posted May 26, 2013 Your color key seems set up fine. Have you tried replacing "DDRVAL =" with "Call"? I think otherwise it should only return a variable with a value of DD_OK or the error code… Really not sure, just tossing an idea. Link to comment Share on other sites More sharing options...
DopeyBiach Posted May 26, 2013 Author Share Posted May 26, 2013 Nope, nothing. Thank you for trying, didn't even get an error - I just get nothing. ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png) Link to comment Share on other sites More sharing options...
Growlith1223 Posted May 27, 2013 Share Posted May 27, 2013 Can you post a picture as to what is going on? Link to comment Share on other sites More sharing options...
DopeyBiach Posted May 27, 2013 Author Share Posted May 27, 2013 Okay the Blt code without DDBLT_KEYSRC:![](http://freemmorpgmaker.com/uploadfiles/796b6baa05708a264600932fe48c5d0c.png)There is a simple little button, it's only use is to Blt, when pressed without DDBLT_KEYSRC, it goes from this:![](http://freemmorpgmaker.com/uploadfiles/8c569011532c4f12a76188ca279677d8.png)To this - as it should:![](http://freemmorpgmaker.com/uploadfiles/0ea67468dc1a8daa466dcb615ff58cad.png)Now when I add DDBLT_KEYSRC (the key is set earlier in the code as you can see, check the original post to see how and where) the Blt code looks like this:![](http://freemmorpgmaker.com/uploadfiles/d810cec2f079610ddccdfb6f8fd3fa4f.png)Now - when I press the process button it goes from this:![](http://freemmorpgmaker.com/uploadfiles/8c569011532c4f12a76188ca279677d8.png)To this:![](http://freemmorpgmaker.com/uploadfiles/8c569011532c4f12a76188ca279677d8.png)Without returning a single error or anything.I can't for the life of me figure out what exactly I'm doing wrong.Unless anyone can find a solution maybe a last resort is someone to write a code to od the exact same thing and if it works - provide me with it. Then I should be able to see exactly where I'm going wrong, as it may be small and difficult to find without writing it yourself.It's going to be something so small and silly, isn't it? ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png)Thanks to all for helping once again. Link to comment Share on other sites More sharing options...
DopeyBiach Posted May 30, 2013 Author Share Posted May 30, 2013 Bump. Is this really that unsolvable..? D: Link to comment Share on other sites More sharing options...
blkcrow Posted June 1, 2013 Share Posted June 1, 2013 doesnt know if this will help but what hapends when you use this instead```DDRVAL = DDS_Primary.Blt(r1, DDS_Buffer, r2, DDBLT_KEYSRC Or DDBLT_WAIT)```or this```DDRVAL = DDS_Primary.Blt(r1, DDS_Buffer, r2, DDBLT_KEYSRC)``` Link to comment Share on other sites More sharing options...
DopeyBiach Posted June 7, 2013 Author Share Posted June 7, 2013 Nothing still. :(Thank you for trying, though. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now