• ### Popular Now

• 13
• 18
• 19
• 27
• 9

#### Archived

This topic is now archived and is closed to further replies.

This topic is 5873 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello. I''m desperatly looking for a fast and smooth way to perform fade-in and out operations in a 640x480 16 bit screen. I''ve just read an article on how to do that using gamma controls, but I think it performs a fade too jerkly (if that''s a word...). Any leads on articles or websites would be greatly appreciated!

##### Share on other sites
Using the gamma controls would be the fastest and simplest way to do it (Are you sure you''re doing it right, I''ve seen gamma adjustment fadeouts before and they looked fine). The only other way of doing it in 16bit is by modifying all the pixels on the screen. Just lock the surface and get, modify and set each pixel on the screen. I''ve found that (R-Amount,G-Amount,B-Amount) is actually very good (visually) approximation instead of doing (L-Amount,Cr,Cb) which requires a 2 conversions (RGB-YUV, YUV-RGB) for each pixel.

##### Share on other sites
The code I have goes like this:
  for(int blackloop=0;blackloop<255;blackloop++){ if(DDGammaRamp.red[blackloop] > 0) { DDGammaRamp.red[blackloop]=0; lpDDGammaControl->SetGammaRamp(DDSGR_CALIBRATE, &DDGammaRamp); } Sleep(1); if(DDGammaRamp.green[blackloop] > 0) { DDGammaRamp.green[blackloop]=0; lpDDGammaControl->SetGammaRamp(DDSGR_CALIBRATE, &DDGammaRamp); } Sleep(1); if(DDGammaRamp.blue[blackloop] > 0) { DDGammaRamp. blue [blackloop]=0; lpDDGammaControl->SetGammaRamp(DDSGR_CALIBRATE, &DDGammaRamp); } Sleep(1);}

Any tips on how I can improve this?