It seems that some other developers are making use of photo capturing
on the Zire 72 as well, so I figured I'd let you in on an important
point to perhaps save you some of the frustration I suffered in
figuring it out:

I figured that the photo capturing code I'd used on the Zire 71 would
work more or less on the Zire 72 with some modifications to account
for the fact that there is no slider, and that the preview and capture
processes were now totally in the control of the developer. I was
quite disappointed when my captured images came out quite garbled. You
could tell what I took a photo of, but it was very strange looking.

There was no documentation about this, but what I found out after much
experimentation was that the data buffer returned from the Zire 72
camera was byte swapped on 2-byte boundaries compared to the Zire 71.
Even trying to display the image with simple calls to WinDrawBitmap()
resulted in garbled images. I managed to display the image properly in
the same way the CameraV2 sample does it by creating an off screen
window using the WinCreateOffscreenWindow() function, with the format
set to screenFormat, then using BmpGetBits() on that offscreen window
and writing the data buffer using the pointer from BmpGetBits(). I
imagine this worked because screenFormat takes such things as the byte
swapping into account, but I needed to save the image, not just
display it. Furthermore, I needed to pass this data into the
jpegARMlet library (perhaps I will switch to using the new built in
codecs library - I sure wish it'd been around for the 1st Zire 71
version of our application!)

What I ended up doing was looping over the data buffer, and using the
ByteSwap16() function that came with endianutils.h to get the correct
byte swapping done. This does seem quite inefficient, but it gets the
job done.

If anybody does figure out why things are swapped, or a better way of
getting around it, I'd be curious to see what you found out.



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to