This is the code I use for color cycling. It's reasonably fast.
0x1FF8000C is the location (in hardware) of the palette registers. This -is-
the fastest way I could think to do it. You'll need to do some research on
how to do it on your handheld though. The memory location is dependant upon
the screen you use methinks. The process for this hardware is:
You set a byte of memory to set the R/G/B registers with a color value. (The
value you push = the palette entry.)
You set the R/G/B registers with the new values.
You set a register with the palette entry to save.
*(palette+0) = blue (read = get, write = set)
*(palette+1) = green
*(palette+2) = red
*(palette+3) = control (write = change palette address)
This code could also be massively optomized by getting rid of the array
derefrences (paletteTemp[0]). Also, it doesn't -quite- rotate the palette.
It also changes the palette.
do {
UInt8 * paletteGet = (UInt8 *)0x1FF8000C;
UInt8 paletteTemp[3];
EvtGetEvent(&event, 0);
SysHandleEvent(&event);
*(paletteGet+3) = 0;
paletteTemp[0] = *(paletteGet+0);
paletteTemp[1] = *(paletteGet+1);
paletteTemp[2] = *(paletteGet+2);
for ( i=0; i<255; i++ ) {
*(paletteGet+3) = i+1; // get next entry
*(palette+0) = *(paletteGet+0); // set blue
*(palette+1) = *(paletteGet+1); // set green
*(palette+2) = *(paletteGet+2); // set red
*(palette+3) = i; // finalize entry
}
*(palette+0) = paletteTemp[0];
*(palette+1) = paletteTemp[1];
*(palette+2) = paletteTemp[2];
*(palette+3) = 255;
} while ( event.eType != appStopEvent );
--
Matthew (Darkstorm) Bevan [EMAIL PROTECTED]
Margin Software, NECTI. http://www.marginsoftware.com
Re-inventing the wheel, every time.
- Don't cook tonight -- starve a rat today!
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/