I have some questions concerning the direct screen access topic.
I think they are very important for some programmers who have ask similar questions and it would be great If anyone of the Nokia experts could give us more information about it since new phones support now 16bit (or even 24bit) color (a new example would be great):
I´m getting confused about the size of the pointers and the addresses they use.
The pixel address is 32bit long and looks like this (right ?)
// fetch screen buffer address
iScreenAddr = screenInfo.iScreenAddressValid ? (TUint16*)screenInfo.iScreenAddress : 0;
// skip the palette data in the beginning of frame buffer (16 entries in 12/16 bit mode)
iScreenAddr += 16; // Important:16*2 für TUint8 Address
Then we get the data address of the pixel, why are you using TUint8 (SDK:Address is 32bit) in the example?
// calculate the (used) frame buffer size in bytes
iFrameBufLen = iFlagRect.Width() * iFlagRect.Height() * 2;
for(TInt s = 0; s < b; s++)
Mem::Copy(aBitmapAddr +s, iFlagDataAddr +s , 1);
//12 bit mode but what about 16bit ???
TUint16* orgLocation = (TUint16*)aBitmapAddr + j*iWidth + i;
TUint16* movLocation = orgLocation + (sinTable[angle % 256] * iWidth);
// read values, hex addresses for 16bit ???
TInt8 r = static_cast<TInt8>((*orgLocation & 0x00f) - someValue);
//RED should be 0x001f
TInt8 g = static_cast<TInt8>(((*orgLocation & 0x0f0) >> 4) - someValue);
//GREEN should be 0x07ff >>5
TInt8 b = static_cast<TInt8>(((*orgLocation & 0xf00) >> 8) - someValue);
//BLUE should be 0xf800 >>11
// copy the pixel data to a new location ???
(r < 0) ? *movLocation = 0 : *movLocation = r;
(g < 0) ? *movLocation &= 0xf0f : *movLocation |= g << 4; // <<5
(b < 0) ? *movLocation &= 0x0ff : *movLocation |= b << 8; // <<11
The example works but when I manipulate the r,g,b values I get some strange results.
I hope someone can help me as soon as possible. I need this information urgently !