[maemo-developers] SDL, pixel format and little endian issue
From: Michael Stepanov michael at stepanoff.orgDate: Mon Sep 1 15:13:26 EEST 2008
- Previous message: Maemo Bug Jar #20
- Next message: SDL, pixel format and little endian issue
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, I have a SDL application where I have to replace color of specified pixels. So, I have a color in RGB representation and convert it to the pixel color using that approach: Uint32 PixelSrc = (0 << PF->Rshift) | (128 << PF->Gshift) | (192 << PF->Bshift); But as result I get color 0x10c0 instead of 0x0080C0. Why it's happens? Does SDL pixel format take into account byte order? Moreover, I found following values for Xshift for little endian: const int rshift = 0, gshift = 8, bshift = 16, ashift = 24; Using them I can get correct pixel color: Uini32 PixelDest = (0 << rshift) | (128 << gshift) | (192 << bshift); But the byte order is different. I get 0xc08000 but it should be 0x0080c0. Any idea what I do wrongly? TIA -- Cheers, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20080901/176e9bb2/attachment.htm
- Previous message: Maemo Bug Jar #20
- Next message: SDL, pixel format and little endian issue
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]