[SDL] help with displaying grayscale buffers

Solra Bizna sbizna at tejat.net
Mon Apr 14 22:53:58 PDT 2008


On 4/14/08, grapesmoker <grapesmoker at gmail.com> wrote:
> I'm trying to use SDL to display a 16bpp grayscale buffer that is acquired
> from a camera.
SDL has no support for any color component >8-bit. You have two options.
* Truncate the color values with SDL using 0xFF00 instead of 0xFF or
255 in your masks passed to CreateRGBSurface. It might not work, but
it's the easiest way to handle it.
* Downsample (with or without dithering) the source image into an
8-bit grayscale buffer. If you like, I could whip up some code to do
it efficiently.
-:sigma.SB


More information about the SDL mailing list