Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image fading in Direct Draw 7 2

Status
Not open for further replies.

slowATthought

Programmer
Dec 2, 2003
56
0
0
US
I need to be able to fade an image to any color in Direct Draw. Any help is.... um.... helpful.
 
We know from thread222-739521 that slowATthought already has this book.

Now, as to as to fading an image to a particular color, I'm pretty certain I dropped in an example I put together on how to quickly convert an image to grayscale using DirectDraw which might help point the way (without being a fully worked solution to this particular problem). Trouble is that I can't find the thread right now, neither am I at my normal PC so I don't have access to any of my code libraries.
 
Yes, thanks for the reminder, strongm!

Hmm... Well, I have plenty of time, so if you do when you do get to your computer, maybe you can help.
 
Well, sadly you may have a bit of a wait; the code I was talking about actually used GDI+ not DirectDraw. So here's stuff to be looking at yourself: consider doing an alphablend using DirectDraw7's Bltfx method
 

Well, ok that's what I get for checking the board in the wee hours of the morning. Sorry about that slowATthought (and you thought you were slow :) ), and thanks for the reminder strongm.

Good Luck

 
No problem vb5prgrmr.

Strongm, I have heard about BltFx, but the book I have does not explain it. Could you tell me what i would need to do an alpha blend?

Thanks.
 
Look up alphablend in Search on this forum. You'll find
thread222-579829
thread222-520827
thread222-704818
amongst others. You will find a lot of smart code from strongm on this site, and looking up his old stuff will give him time to answer new questions for us all!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Thanks for all of the links, but I believe they relate to AlphBlend on an picture box. Remember that I am trying to do it in DX with the BltFx function. Are they similar? I just need to add a tint (probably black) to an image.
 
To update, I created a DDBLTFX object and the BltFx routine. All I need is the code before the blt that defines what it will do.
 
Yes, but I haven't had time to write any code - plus you've more-or-less figured it out for yourself, perhaps without realising it.

You need your original image on a DD7 surface, and another image of the same size that is just a block of the color you want to fade to, which should be easy to create (actually, you might get away with just having a color image of 1 pixel in size an be able to stretch it; haven't checked if we can do a strecth whilst doing BltFx). Then repeatedly alphablend the two images, slowy adding more and more of the color image
 
Sorry for the repeated posts. The post had left the first page, and I wasn't sure if you knew I hadn't completely solved it yet.

I created a surface to use as the color, and made it black. I am guessing that there is a property in the DDBLTFX object that I need to change to make fade between them, but I they all seem the same to me. I tried fiddling around with a few with no results. I think I can work without full code, in case you know what property I should use (which you probably do, of course!) Thanks for any help in advance.
 
Okey dokey. I'll see if I can find a window to put something together.
 
Check out for some interesting tutorials


[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!

Ever feel like you're banging your head against a tree? I did, so I cut down the tree.
 
Hey slowATthought, have you looked anywhere else for help on this subject? It seems like you are depending entirely on strongm. I bet you $10 there are lots of places on the internet which tell you how to do an alphablend. Just use !
 
Actually, it's trickier than I thought in DirectDraw - mainly because DirectDraw does not actually support alphablending (it is unimplemented). You have to use a bit of Direct3D and textures to get away with it.

So, if you are going to have to use a different component anyway, why not use GDI's built-in AlphaBlend function? Sure, you will not be able to use it on NT4 - but then you won't really be able to use DirectDraw on NT4 either...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top