[maemo-developers] [maemo-developers] Nokia SDL color format for pixels

From: Frantisek Dufka dufkaf at seznam.cz
Date: Tue Apr 15 16:15:52 EEST 2008
Michael Stepanov wrote:

>     int bpp = surface->format->BytesPerPixel;

You can check also other fields of SDL_PixelFormat structure to get 
R,G,B color components. Interesting field names are

	Uint8  Rloss;
	Uint8  Gloss;
	Uint8  Bloss;
	Uint8  Rshift;
	Uint8  Gshift;
	Uint8  Bshift;
	Uint32 Rmask;
	Uint32 Gmask;
	Uint32 Bmask;

Or you can use SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, 
Uint8 *g, Uint8 *b) function which will probably do the dirty bit 
shifting and masking work for you.

http://www.google.com/search?q=SDL_GetRGB

More information about the maemo-developers mailing list