Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Create an Image which fades

Posted on 1998-10-28
3
Medium Priority
?
249 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

636 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