Hi all,

 

Having a hell of a time getting this going.. I'm trying to add a fairly
simple bit of functionality: save a photo to the expansion card.

 

I've modeled the code after the CameraV3 sample (seems to work just
fine) and have added the pnoJpegLib header to be able to save as JPG.
I've looked at the issues Miguel Hernandez and Landon Cunningham were
having a couple of years ago on this list and seem to have either hit
their problem or something similar. 

Here's my code:

 

// now have: BitmapPtr bmpPtr, which contains a pointer to a bitmap in
memory. It is around 22KB, a version 3 uncompressed bitmap pointer.

FileRef fr;

 

err = pnoJpeg2EncodeCreate( g.pnoJpegLibRefNum, &data );

 

MemHandle imgh;

err = pnoJpeg2QuickEncode( g.pnoJpegLibRefNum, bmpPtr, &imgh, 100 );

pnoJpeg2EncodeFree( g.pnoJpegLibRefNum, &data );

 

UInt16 jpgSize = MemHandleSize(imgh); // jpgSize always comes back as 1

void* jpgH = MemHandleLock( imgh );

UInt32 bytesWritten = 0;

 

err = VFSFileOpen(g.VFSVolRefNum, fullPath, vfsModeCreate |
vfsModeTruncate, &fr );

err = VFSFileWrite( fr, jpgSize, jpgH, &bytesWritten );

VFSFileClose(fr);

 

MemHandleUnlock(imgh);

MemHandleFree(imgh);

 

What I'm getting is 1 byte written to the output file. Seems to me that
the mem handle isn't being resized by the pnoJpeg call.

I've tried using pnoJpeg2QuickEncode and pnoJpeg2Write with both
pnoJpeg2EncodetoMemHandle and pnoJpeg2EncodeToVFS - all are giving me
this behaviour.

 

I load pnoJpegLib with pnoJpeg_OpenLibrary(&g.pnoJpegLibRef) which is
returning errNone so I suspect the library is actually loaded correctly.

 

 

Has anyone who's worked with this library figured out why they hit this
roadblock and what the fix was? I'd appreciate any advice or stray
thoughts that might get me moving forward again.

 

Thanks!

Stefan Mohr

 


-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to