Work-around: PalmPhotoDisplayImage Failure In Landscape Orientation
The problem addressed here was first described in my 2008-01-25 post "PalmPhotoDisplayImage()fails on T3 device; OK on simulator". Since then, I've verified that the problem also occurs on the T5 device, exactly as it does on the T3.
PalmPhotoDisplayImage() won't draw an image on a Tungsten T3 or T5 device when the display screen has been rotated to landscape orientation. (Other rotate-capable devices may also behave like that; I only tested the T3 and T5) The problem didn't appear during any tests using the T3 or T5 simulator. Exhaustive internet research, and correspondence with other Palm OS developers (through the Palm Developer's Forum and by e-mail) over many months, yielded no clues to a possible explanation for this selective failure of PalmPhotoDisplayImage().
Use PalmPhotoDisplayImage() to write a bitmap of the image to an offscreen window, then copy the bitmap from that offscreen window to the display. I discovered this work-around after studying the FotoFinish sample program that was distributed with the Palm v.5.5 SDK from https://dts.pdn.palm.com
The FotoFinish programmer's description of this work-around states: "This is a hack and is not needed, once the byte-swapping bug in PalmPhotoDisplayImage is fixed".
I understand byte-swapping (I do it in my application using my own macros), but how could a byte-swapping bug affect PalmPhotoDisplayImage() only in landscape orientation, yet have no effect in portrait orientation? Does the display driver use two different blocks of pixel memory: one exclusively for portrait orientation, and the other only for landscape orientation?
Appeal For Enlightenment:
I've been programming computers since 1964 -- from breadboarded chips to room-sized IBMs, from assembler language to the highest-level APIs -- but I don't recall ever encountering such a baffling problem.
Can anyone offer a possible cause for this unexplained behavior of PalmPhotoDisplayImage()?
Thanks a lot for your time in reading this.