more help please!!!
i was able to call the camera using the palmphotocapture function. then save
it. when i tried to check the photoH, it is not null so i guess i got the
image.
first problem, when i add the image into an album, i get an error.
next, because i don't want the image to be seen on the photos on palm, i
skipped the problem above.
second problem, i can't display the image. i am saving the image on the stream.
i retrieve it using the palmphotoopenImage. i checked the handle, it isn't
null. so again, i guess i got the photo. but when i tried to display it using
the PalmPhotoDisplayImage, nothing happend.
can you show me what i am doing wrong?
here is my function for displaying the image:
void OpenImage()
{
UInt32 density = 0;
/** 4 testing **/
Char *msg = "";
/** for retrieval **/
PalmPhotoHandle photoH = NULL;
PalmPhotoFileLocation fileLocation;
PalmPhotoCreateParam createParam;
/** for display **/
PalmPhotoDisplayParam displayParam;
RectangleType displayRect;
Coord width, height;
WinHandle winH;
/** photo image info **/
PalmPhotoImageInfo imageInfo;
BitmapType *tmpbitmapP = NULL;
InfoMsg(tempimageDescription);
// setup callframes
//MemSet(&fileLocation, sizeof(PalmPhotoFileLocation), 0);
MemSet( &createParam, sizeof(PalmPhotoCreateParam), 0 );
createParam.fileLocation.fileLocationType = palmPhotoStreamLocation;
createParam.fileLocation.file.StreamFile.type = 'Foto'; //BLOGAppType;
//'Foto';
createParam.fileLocation.file.StreamFile.creator = 'Foto';
//BLOGCreator; //'Foto';
StrCopy(createParam.fileLocation.file.StreamFile.name,
"Photo_101105_001.jpg");
/** capture photo **/
photoH = PalmPhotoOpenImageV2(PhotoLibRefNum, &createParam.fileLocation);
//err = PalmPhotoGetImageInfo(PhotoLibRefNum, photoH, &imageInfo);
err = PalmPhotoGetImageInfo(PhotoLibRefNum, photoH, &createParam.imageInfo);
if ((!err) && (photoH))
{
InfoMsg("image successfully opened");
WinScreenGetAttribute(winScreenDensity, &density);
//MemSet(&displayParam, sizeof(PalmPhotoDisplayParam), 0);
width = (createParam.imageInfo.width + 1) >> 1;
height = (createParam.imageInfo.height + 1) >> 1; //width = 160;
height = 120;
if(density == kDensityDouble)
winH = WinCreateOffscreenWindow(width, height, nativeFormat, &err);
else
winH = WinCreateOffscreenWindow(width, height, genericFormat, &err);
if (!err)
{
displayRect.topLeft.x = 0;
displayRect.topLeft.y = 0;
if(density == kDensityDouble)
{
displayRect.extent.x = width;
displayRect.extent.y = height;
}
else
{
displayRect.extent.x = createParam.imageInfo.width;
displayRect.extent.y = createParam.imageInfo.height;
}
//displayParam.winH = WinCreateOffscreenWindow(width, height,
nativeFormat, &err);
displayParam.winH = winH;
displayParam.rect = displayRect;
displayParam.displayCallback = NULL;
displayParam.userDataP = NULL;
err = PalmPhotoDisplayImage(PhotoLibRefNum, photoH, &displayParam);
if (err)
GenerateErrorMsg(err);
//WinDeleteWindow(displayParam.winH, true);
}
}
}
thanks a lot!
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/