Example #1
0
/* Calculating the gamma by integrating the gamma ramps isn't exact,
   so this function isn't officially supported.
*/
int SDL_GetGamma(float *red, float *green, float *blue)
{
	int succeeded;
	SDL_VideoDevice *video = current_video;
	SDL_VideoDevice *this  = current_video;	

	succeeded = -1;
#ifdef USE_MATH_H
	/* Prefer using GetGammaRamp(), as it's more flexible */
	{
		Uint16 ramp[3][256];

		succeeded = SDL_GetGammaRamp(ramp[0], ramp[1], ramp[2]);
		if ( succeeded >= 0 ) {
			CalculateGammaFromRamp(red, ramp[0]);
			CalculateGammaFromRamp(green, ramp[1]);
			CalculateGammaFromRamp(blue, ramp[2]);
		}
	}
#else
	SDL_SetError("Gamma correction not supported");
#endif
	if ( (succeeded < 0) && video->GetGamma ) {
		SDL_ClearError();
		succeeded = video->GetGamma(this, red, green, blue);
	}
	return succeeded;
}
/* Calculating the gamma by integrating the gamma ramps isn't exact,
   so this function isn't officially supported.
*/
int
SDL_GetGamma(float *red, float *green, float *blue)
{
    int succeeded;
    Uint16 ramp[3][256];

    succeeded = SDL_GetGammaRamp(ramp[0], ramp[1], ramp[2]);
    if (succeeded >= 0) {
        CalculateGammaFromRamp(red, ramp[0]);
        CalculateGammaFromRamp(green, ramp[1]);
        CalculateGammaFromRamp(blue, ramp[2]);
    }
    return succeeded;
}
Example #3
0
int SDL_GetGamma(float *red, float *green, float *blue)
{
	int succeeded;
	SDL_VideoDevice *video = current_video;
	SDL_VideoDevice *this  = current_video;	

	succeeded = -1;
	/* Prefer using GetGammaRamp(), as it's more flexible */
	{
		Uint16 ramp[3][256];

		succeeded = SDL_GetGammaRamp(ramp[0], ramp[1], ramp[2]);
		if ( succeeded >= 0 ) {
			CalculateGammaFromRamp(red, ramp[0]);
			CalculateGammaFromRamp(green, ramp[1]);
			CalculateGammaFromRamp(blue, ramp[2]);
		}
	}
	if ( (succeeded < 0) && video->GetGamma ) {
		SDL_ClearError();
		succeeded = video->GetGamma(this, red, green, blue);
	}
	return succeeded;
}