[SDL] Pixel access in SDL_Surface

Mason Wheeler masonwheeler at yahoo.com
Fri Apr 4 08:59:09 PDT 2008


All right.  Does it make a difference whether the image uses a palette or not?  If not, how do you tell the difference between references in the original to two palette entries that are identical, with the slight distinction that one of them happens to be the color key?

>http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fSurface
>
>The members of SDL_Surface w, h, pitch, and format give all you need for 
>addressing pixels. But if you're using 8 bit, a pixel (x,y) is just 
>pixels[x+y*pitch]. Don't forget to lock/unlock the surface for direct 
>access. It's a void pointer because the element size depends on the 
>color format used.
>
>--Jacob





More information about the SDL mailing list