When SetPalette is called, the PalmOS will scan through every pixel of the display to see if it needs to change and will update any pixels accordingly. This takes a lot of time. I know a developer who was using SetPalette to create a water shimmer effect in a game he was working on, but it really slowed things down, so he had to abandon that effect. It's just the way the PalmOS handles palette changes.

You can use PilRC to import a .bmp will with it's own color table. I'm not sure it will have the effect you want though. You can always draw it as you are but dump the results to a buffer and then copy the buffer to the screen. This will hide the drawing from the user.

Apparently, SetPalete changes the colors for the current draw buffer only.

Try setting the palette on the screen buffer (number 0), rather then the offscreen buffer. You'll need two "for" loops then, one for the palette and one for the lines. When you copy the buffer to the screen buffer, the colors should show as you'd expect.