jeff ang wrote:
> i am looking for a way how to play a video in palm. however,
> i did not find any functions that directly support video
> playback. i did find WinDrawPixel and WinDrawPixels, but
> i think having a loop of 160x160 per frame would slow down
> the device.
Unfortunately, it doesn't seem easy. It's not really feasible
to write directly to the screen memory. Apart from the fact
that it's a bad idea in the first place, it would be really
tough to ever get it working reliably on the wide variety of
devices out there.
If I were going to do some animation, I would probably do it
as a series of bitmaps, and just draw one after another
with WinDrawBitmap(). However, this would only work for a
small, fixed-size animation.
If you need to create your own animation on the fly, then I'm
afraid the simplest method is going to be the following:
(1) Create an offscreen bitmap with BmpRsrcCreate(), so that
you have a bitmap in a known format whose pixels you can
modify directly. This function does not come with the OS,
but it is available from PalmSource. Go to palmos.com's
developer knowledge base and search for the function by
name for more info.
(2) There are some standard system functions (and maybe
some BmpRsrcCreate()-style equivalents?) that will let
you get a pointer to the pixel data and the rowbytes
(bytes per row in the bitmap) for the bitmap, so get
those values.
(3) In a loop, write a bunch of pixel data to the raw bitmap,
then use WinDrawBitmap() to copy a frame to the screen.
If you do this, it's going to be pretty important to get the
offscreen bitmap to be the same density as the screen (unless
you want pixel doubling) as well as the same pixel depth
(probably). The pixel depth issue will be a bit annoying,
actually, because you want it to be the same as the main draw
window for speed (otherwise the system will have to convert
the pixel data, not just copy it), but you want it to always
be 16 for the sake of making your code simple.
Hmm, after writing all that it seems like there's got to be
a better way that's still supported, but then I can't imagine
what it'd be given the API that's available.
- Logan
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/