[SDL] How to gray out a button image?

Erik esigra at gmail.com
Wed Apr 9 01:07:22 PDT 2008


Will Langford skrev:
> The formula for converting something to grey scale is something similar to
>
> G * 59%
> B * 11 %
> R * 30 %
>
> Those are pulled off my head from a project about 7 years ago, so they
> might be wrong.... but they should get ya darn close :).
>   

Thanks for the information. I had no idea that there should be such 
magic numbers in the calculation. I would have just used the 
(unweighted) average, like David Olsen wrote. Is there a link with the 
rationale for those particular numbers?

I was actually expecting to not do the gray scale conversion myself. I 
was thinking that we would not be the first SDL based project that uses 
pictorial buttons that can be disabled. I was hoping that there was some 
library function that could do it and take advantage of special hardware 
features on different platforms (such as MMX).


More information about the SDL mailing list