Ok this is what is happening. The library works now which is awsome.
When I create the bitmap through just grabbing it through
wingetbitmap() function I get a nicely sized image but the colors are
messed at 320x320.
Then if I create the bitmap through using wincreatebitmapwindow()
function, creating a window wrapper around the bitmap, then copying
the screen over using wincopyrectangle I get a smaller image with all
the right colours. I try creating the bitmap with higher height and
width but that does not change the size of the image. The size of
these images are 160x160. I have tried using a version3 bitmap and
changing the density but that doesn't seem to change anything.
Any ideas?
Landon
On 6/27/05, Miguel Angel Sotomayor Hernandez
<[EMAIL PROTECTED]> wrote:
> I could make it work
>
> Landon Cunningham wrote:
>
> >I know you have all probably read my past post regarding my problems
> >with encoding using the pnoJpeg lib. I know you must think that the
> >problem is very similiar to pnoJpegLib: 0-bytes length VFS-file
> >2005-05-01 09:03:00 <Miguel Angel Sotomayor Hernandez. I have looked
> >at it and even tried encoding to a memhandle but the same problem
> >exists, the mem handle is exactly 4kb.
> >
> >
> >
>
> Hopping that it will be usefull, here is my code, I hope it works for
> you. I'm just sending the relevant part of the code, sorry it's a little
> bit messy (I have more code within the function that checks if the image
> already exists and stores a reference to the image so my app knows what
> report the image belongs to and that kind of stuff but I removed those
> parts to make it clear... I hope).
>
> If you are in trouble let me know.
>
> I hope this helps
>
> Miguel
>
> code:
> pnoJpeg2EncPtr jpegEncode;
> MemHandle imgh;
> BitmapType * bitmapS;
>
> UInt16 * bitsS;
> pnoJpeg2EncPtr jpegEncode;
> MemHandle imgh;
>
> bitmapS = BmpCreate (previewWidth*2, previewHeight*2, previewDepth, 0,
> &err);
>
> bitsS = (UInt16 *) BmpGetBits (bitmapS);
>
> err = CameraLibPreview (gLibRefNum, bitsS,
> kCameraImageFormatRGB16, previewWidth*2, previewHeight*2);
>
>
> err = pnoJpeg2EncodeCreate(pnoJpegRefNum, &jpegEncode);
>
> if(err == errNone){
> pnoJpeg2EncodeToMemHandle(pnoJpegRefNum, jpegEncode,
> &imgh);
> pnoJpeg2EncodeSetQuality(pnoJpegRefNum, jpegEncode, 80);
> pnoJpeg2EncodeProgressive(pnoJpegRefNum, jpegEncode,
> true);
> err = pnoJpeg2Write(pnoJpegRefNum, jpegEncode, bitmapS);
> pnoJpeg2EncodeFree(pnoJpegRefNum, &jpegEncode);
> }
>
>
> Err error=0;
>
> UInt16 volRefNum;
> UInt32 volIterator;
>
> UInt16 pathLength;
> FileRef fr;
>
> volIterator = vfsIteratorStart;
> pathLength = 64;
> error = VFSVolumeEnumerate(&volRefNum, &volIterator);
> if (error == errNone)
> VFSGetDefaultDirectory(volRefNum, ".jpg", path,
> &pathLength);
> else
> DisplayError("No existen tarjetas para guardar
> la imagen", error);
> if (error == errNone){
> if (pathLength > 0 && path[pathLength - 1] == '\0')
> pathLength--;
> if (pathLength > 0 && path[pathLength - 1] != '/')
> path[pathLength++] = '/';
> }
>
> if(error == errNone) {
> void * datos; // Un apuntador sin tipo de dato
> especĂfico
> // Guardar la imagen en el archivo
>
>
> StrCat(path, nombre);
> datos = MemHandleLock(imgh);
> error = VFSFileOpen(volRefNum, path,
> vfsModeCreate | vfsModeReadWrite, &fr);
> error = VFSFileWrite(fr, MemHandleSize(imgh),
> datos, NULL);
> VFSFileClose(fr);
>
> MemHandleUnlock(imgh);
>
> if(error)
> FrmAlert(ImagenErrorAlert);
> }
>
>
>
>
> Landon Cunningham wrote:
>
> >I know you have all probably read my past post regarding my problems
> >with encoding using the pnoJpeg lib. I know you must think that the
> >problem is very similiar to pnoJpegLib: 0-bytes length VFS-file
> >2005-05-01 09:03:00 <Miguel Angel Sotomayor Hernandez. I have looked
> >at it and even tried encoding to a memhandle but the same problem
> >exists, the mem handle is exactly 4kb.
> >
> >So again what I am doing is trying to encode a bitmap using the pno
> >jpeg library. I have tried encoding to a filestream which results in
> >4kb jpeg image which does not open. Then I have tried using a
> >memhandle which results in 4kb image. I check the memhandle size
> >through MemHandleSize() function which results in exactly 4kb or 4096
> >bytes.
> >
> >I have tried looking at past examples and past posts but I seem to get
> >nowhere. I am just trying to encode a bitmap of the screen which is
> >160x160. Which as I read should not be a problem right.
> >
> >I know this must seem very annoying that I try and keep posting the
> >same problem with the same result. Ie no one helping me. But I have
> >spent hours trying to search past posts and looking for any results
> >that relate to this. I do apologize.
> >
> >Maybe this is some small stupid little problem that most people would
> >see but I have been looking at my code for way too long and I can't
> >seem to see it.
> >
> >Thanks,
> >
> >Landon C
> >
> >
> >
>
>
> --
> For information on using the PalmSource Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
>
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/