Solved

Create an Image which fades

Posted on 1998-10-28
3
233 Views
Last Modified: 2010-04-02
I am trying to create a bmp which will fade to black.  I am in 16-bit color mode - so I cannot use palette manipulation.  My attempt was to use a mask which goes from white to black and then SRCAND it with my image in memory and then finally Blt to the screen.  This works but it doesn't create a smooth fade.  I have also tried manipulating pixels - but it has very poor performance. Sure would be nice if I could use some alpha blending.  Any help would be great.  
0
Comment
Question by:gpaige
3 Comments
 
LVL 7

Expert Comment

by:psdavis
ID: 1176422
Haven't you seen the new AlphaBlend function yet?  It's available for Win98 and WinNT?

Reject if you have... :)
0
 

Author Comment

by:gpaige
ID: 1176423
Yes I did - but I am trying to keep compatibility with 95 and NT 4.0.
0
 
LVL 1

Accepted Solution

by:
bculver earned 200 total points
ID: 1176424
Simply subtracting fixed values from the rgb componets doesn't do very well for the reason that  the amount of rgb in a pixel cannot be decremented (faded) proportionally. Try this rgb to grayscale and back algorithm with your pixel manipulating routine.

gray = .30*red + .59*green + .11*blue;
gray=gray-x                // 0>x<255  try different fading step values to your liking
red=gray*.30;
green=gray*.59
blue=gray*.11


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now