[SDL] How to gray out a button image?
Andreas Schiffler
aschiffler at ferzkopp.net
Tue Apr 15 20:27:46 PDT 2008
You may want to use integer math ...
http://en.wikipedia.org/wiki/YUV#Numerical_approximations
The "brightness" value is the Y component. See also the blurb on MPEG
compatibility (re: range of Y) and note that the input RGB values need
to be uint32's to avoid overflows.
Will Langford wrote:
>> grayed = (source_pixel_red * 0.10) + (source_pixel_green * 0.61) +
>> (source_pixel_blue * 0.19);
>>
>
> Doh, mistyped math in the line,
>
> grayed = (source_pixel_red * 0.30) + (source_pixel_green * 0.59) +
> (source_pixel_blue * 0.11);
>
> -Will
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aschiffler.vcf
Type: text/x-vcard
Size: 135 bytes
Desc: not available
Url : http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080415/849d7c9a/attachment.vcf
More information about the SDL
mailing list