Landon Cunningham wrote:
Here what I have done...
WinGetDisplayExtent(&DepthWidth, &DepthHeight);
theBitmap = BmpCreate(DepthWidth, DepthHeight, bitColourDepth, NULL, &err);
if (theDepthBitmap)
{
DepthWindow = WinCreateBitmapWindow(theDepthBitmap, &err);
//the display screen
theDepthBitmap = WinGetBitmap(WinGetDisplayWindow());
screenH = WinSetDrawWindow(DepthWindow);
//drawing the screen over to the offscreen bitmap??
WinDrawBitmap(theDepthBitmap, 0, 0);
Everything up to this point looks about right (except "theBitmap"
versus "theDepthBitmap", but I assume that's a typo).
But, WinDrawBitmap() is going to take the bitmap you give it and
draw the bitmap into the current draw window. Since you've put
a window wrapper around theDepthBitmap and set that as the current
draw window, you're drawing the bitmap onto itself!
I think, instead, you want to remove the WinSetDrawWindow()
calls (since WinCopyRectangle() can copy directly to and from
the windows you give as arguments and doesn't care what the
current draw window is) and just copy a rectangle from the
display window to your offscreen window, like this:
RectangleType myrect;
myrect.topLeft.x = 0;
myrect.topLeft.y = 0;
myrect.extent.x = DepthWidth;
myrect.extent.y = DepthHeight;
WinCopyRectangle (
WinGetDisplayWindow(), DepthWindow,
&myrect,
0, 0,
winPaint);
The winPaint draw mode says it writes "color matched pixels", which
I assume means it will be happy to convert 16-bit to 8-bit.
By the way, on devices with the High-Density Display Feature Set,
you may need to use BmpCreateBitmapV3() and create a bitmap
the same density as the screen to get the full amount of information.
Unfortunately, with BmpCreateBitmapV3(), it isn't possible to create
a 320x320 bitmap because of memory constraints, so you'd have to do
something like create a 320x16 bitmap, copy the first 16 pixel rows
of the screen into it, write that into the GIF, copy the next 16 pixel
rows into the 320x16 bitmap, write that into the GIF, etc. until you've
created the whole GIF. (That is, if your GIF code supports doing
banding.)
- Logan
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/