Back again,
Using the pnojpeg library and I think I seem to be most things right
but who knows.
This is my code:
neoslateGIF = FileOpen(0, fileName, 0, 0, fileModeAppend, &error);
WinGetDisplayExtent(&DepthWidth, &DepthHeight);
//dimensions and bounds for the offscreen window
myrect.topLeft.x = 0;
myrect.topLeft.y = 0;
myrect.extent.x = DepthWidth;
myrect.extent.y = DepthHeight;
WinGetSupportedDensity(&densityScr);
helperBitmap = BmpCreate(DepthWidth, DepthHeight, ColourDepth, NULL,
&err);
//Colour Depth is 16
BmpCreateBitmapV3(helperBitmap, densityScr, BmpGetBits(helperBitmap),
NULL);
if (helperBitmap)
{
DepthWindow = WinCreateBitmapWindow(helperBitmap, &err);
if(err)
{
StatusMsg("Error: CaptureScreen2GIF()\n Could not create 16bit
bitmap", err);
}
//copying current window to the offscreen window
WinCopyRectangle (WinGetDisplayWindow(), DepthWindow, &myrect, 0, 0, winPaint);
//open the pnojpeglibrary
err = pnoJpeg_OpenLibrary(&pnoJpeg2RefNum);
if(err != errNone)
{
ErrAlert(err);
}
err = pnoJpeg2EncodeCreate(pnoJpeg2RefNum, &jpegEncode);
if(err != errNone)
{
ErrAlert(err);
}
err = pnoJpeg2EncodeToFileStream(pnoJpeg2RefNum, jpegEncode,
neoslateGIF);
if(err == errNone)
{
pnoJpeg2EncodeSetQuality(pnoJpeg2RefNum, jpegEncode, 50);
pnoJpeg2EncodeProgressive(pnoJpeg2RefNum, jpegEncode, true);
err = pnoJpeg2Write(pnoJpeg2RefNum, jpegEncode, helperBitmap);
}
else
{
ErrAlert(err);
}
pnoJpeg2EncodeFree(pnoJpeg2RefNum, &jpegEncode);
//close the pnojpeg library
pnoJpeg_CloseLibrary(pnoJpeg2RefNum);
error = FileClose(neoslateGIF);
WinDeleteWindow(DepthWindow, false);
DepthWindow = NULL;
BmpDelete(helperBitmap);
}
This seems to be right from looking at examples and the previous posts
on the forums. What happens is I get a 4kb image that is incomplete
and corrupt every time regardless of what it is taking a screenshot
of. Not sure what happens and why.
I have tried copying the bitmap to the screen and I get the right
bitmap so that knocks out the fact that maybe the bitmap couldn't be
grabbed.
I have tried reducing the bounds of what I am copying and that doesn't
seem to change the output. I also have tried it on a different palm
but with only the same output.
I was thinking about trying previous releases but there is only one
previous release with jpeg encoding which doesn't seem to have changed
much from the previous versions.
Maybe I should be looking at other methods of taking 16bit screens. I
can't leave it as a bitmap because I am sending the image over
bluetooth and that would be a little large. My current program works
with 8bit images which is done by creating a gif. Now I have gone down
the road of letting the palm os convert from 16bit to 8bit but I lose
too much quality which is not a option.
I have thought about maybe pursuing some dithering options but that
seems a little more complicated than using the jpeg library.
As always much thanks,
Puzzled and Confused : ),
Landon Cunningham
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/