?
Solved

Create an Image which fades

Posted on 1998-10-28
3
Medium Priority
?
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 600 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

765 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