Solved

Create an Image which fades

Posted on 1998-10-28
3
236 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Handle Exceptions during instantiation 28 414
returning a dereferenced pts in C++ 10 149
computer science syllabus 3 81
Embarcadero C++ builder XE10.1 Berlin TRegistry declaration 1 25
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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…
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 how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

813 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

18 Experts available now in Live!

Get 1:1 Help Now