Re: Gamma Fade using CoreGraphics?
Re: Gamma Fade using CoreGraphics?
- Subject: Re: Gamma Fade using CoreGraphics?
- From: Stéphane Sudre <email@hidden>
- Date: Fri, 13 Jul 2001 16:48:00 +0200
#import <Cocoa/Cocoa.h>
#include <ApplicationServices/ApplicationServices.h>
int main(int argc, const char *argv[])
{
CGDisplayCount tmaxDisplayCount=100;
CGDirectDisplayID tDisplayTable[100];
CGDisplayCount i;
CGGammaValue gamma;
CGDisplayErr err;
CGDisplayCount displayCount_;
CGDisplayCount j;
float index;
float currentIND;
float step;
float speed=-0.001;
int iterattionNumber=5;
CGGetActiveDisplayList(tmaxDisplayCount,tDisplayTable,&displayCount_);
currentIND=1.0;
while ((iterattionNumber--))
{
// If you want to see a 1960's TV, set tDisplayTable[j] to
tDisplayTable[0] on 2 displays set-up
for(index=currentIND;index>=(1-currentIND);index+=speed) // Fade
in/out
{
gamma = index;
for (j=0;j<displayCount_;j++)
{
err = CGSetDisplayTransferByFormula(tDisplayTable[j],0,
gamma, 1.0,0,gamma, 1.0,0, gamma, 1.0);
gamma=1-index;
}
}
currentIND=1-currentIND;
speed=-speed;
for(index=currentIND;index>=(1-currentIND);index+=speed) // Fade
out/in
{
gamma = index;
for (j=0;j<displayCount_;j++)
{
err = CGSetDisplayTransferByFormula(tDisplayTable[j],0,
gamma, 1.0,0,gamma, 1.0,0, gamma, 1.0);
gamma=1-index;
}
}
currentIND=1-currentIND;
speed=-speed;
}
// Restores ALL displays
CGDisplayRestoreColorSyncSettings();
return 0;
}