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

2008-08-29 Thread Michael Stepanov
Found the problem. It's Big/Little Endian issue. It seems that SDL pixel format doesn't take into account the byte order for *[RGBA]shift: SDL_PixelFormat * PF = screen->format; How can I modify the statement: *PixelSrc = (ColorToReplace.R() << PF->Rshift) | (ColorToReplace.G() << PF->Gshift) |

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

2008-08-29 Thread Michael Stepanov
Thanks a lot, guys, for your help. Finally I managed to get correct RGB from the 16bit pixel using SDL_GetRGB. First I get a pixel and then retrieve RGB from it: Uint8 red, green, blue; Uint32 pixel; for(int y = 0; y < 480; y++) { for(int x = 0; x < 640; x++) {

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

2008-08-28 Thread Eero Tamminen
Hi, ext Michael Stepanov wrote: > On Tue, Apr 15, 2008 at 3:50 PM, Frantisek Dufka <[EMAIL PROTECTED]> wrote: >>> So, how in that situation I can get correct color? >>> >> It is already correct. The color format is RGB565. What 'correct' means to >> you in this context? If you need the value in di

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

2008-08-28 Thread Joni Valtanen
On Thu, 28 Aug 2008, Michael Stepanov wrote: > On Tue, Apr 15, 2008 at 3:50 PM, Frantisek Dufka <[EMAIL PROTECTED]> wrote: > >> Michael Stepanov wrote: >> >>> So, how in that situation I can get correct color? >>> >> >> It is already correct. The color format is RGB565. What 'correct' means to >

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

2008-08-28 Thread Michael Stepanov
On Tue, Apr 15, 2008 at 3:50 PM, Frantisek Dufka <[EMAIL PROTECTED]> wrote: > Michael Stepanov wrote: > >> So, how in that situation I can get correct color? >> > > It is already correct. The color format is RGB565. What 'correct' means to > you in this context? If you need the value in different

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

2008-04-15 Thread Frantisek Dufka
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

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

2008-04-15 Thread Frantisek Dufka
Michael Stepanov wrote: > So, how in that situation I can get correct color? It is already correct. The color format is RGB565. What 'correct' means to you in this context? If you need the value in different format you need to convert it. ___ maemo-de

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

2008-04-15 Thread Michael Stepanov
On Tue, Apr 15, 2008 at 3:30 PM, Frantisek Dufka <[EMAIL PROTECTED]> wrote: > Michael Stepanov wrote: > > > In case of Nokia that method returns *(Uint16 *)p. But instead of 6 > > hexadecimals it returns only 4. For example, for white color it returns > > instead of F. The same, for the r

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

2008-04-15 Thread Frantisek Dufka
Michael Stepanov wrote: > In case of Nokia that method returns *(Uint16 *)p. But instead of 6 > hexadecimals it returns only 4. For example, for white color it returns > instead of F. The same, for the rest of colors. > > Any idea why? > Some typo in your mail? Uint16 is 16 bit value,

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

2008-04-15 Thread Michael Stepanov
HI, Long time ago I tried to investigated the problem of replacing pixel's colors. So, I faced with that problem again. But the problem is in the result of getpixel() method. I use the similar one: Uint32 getpixel(SDL_Surface *surface, int x, int y) { int bpp = surface->format->BytesPerPixel;

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

2007-02-12 Thread Michael Stepanov
To: maemo-developers@maemo.org Subject: [maemo-developers] Nokia SDL color format for pixels Hi, I have a question about SDL realization for Nokia770/800. Does it use some different format to fill a pixel by some color? Because in my application SDL is used to change

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

2007-02-12 Thread Tapani Pälli
ext Michael Stepanov wrote: > Thanks for your answer, Tarani. > > On 2/12/07, *Tapani Pälli* <[EMAIL PROTECTED] > > wrote: > > ext Michael Stepanov wrote: > > Well, there is a open source system for home automation - Plutohome > > (www.plutohome.com

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

2007-02-12 Thread Michael Stepanov
Thanks for your answer, Tarani. On 2/12/07, Tapani Pälli <[EMAIL PROTECTED]> wrote: ext Michael Stepanov wrote: > Well, there is a open source system for home automation - Plutohome > (www.plutohome.com ). This system can use > Nokia770/800 as a control panel - Orbiter

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

2007-02-11 Thread Tapani Pälli
ext Michael Stepanov wrote: > Well, there is a open source system for home automation - Plutohome > (www.plutohome.com ). This system can use > Nokia770/800 as a control panel - Orbiter. The Orbiter is based on > SDL. So, after some hack it started work on Nokia (os2005/os

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

2007-02-09 Thread Tapani.Palli
mailto:[EMAIL PROTECTED] On Behalf Of ext Michael Stepanov Sent: 09 February, 2007 11:03 To: maemo-developers@maemo.org Subject: [maemo-developers] Nokia SDL color format for pixels Hi, I have a question about SDL realization for Nokia7

[maemo-developers] Nokia SDL color format for pixels

2007-02-09 Thread Michael Stepanov
Hi, I have a question about SDL realization for Nokia770/800. Does it use some different format to fill a pixel by some color? Because in my application SDL is used to change color of icons according to some conditions. It works fine under Linux (Debian) but it didn't work under Nokia 770 (I trie