how do you combine two images then save it as one? for example i have an image take from the camera and another image of a frame, and i want to combine those two images.
how do you combine two images then save it as one? for example i have an image take from the camera and another image of a frame, and i want to combine those two images.
Combine them how? One on top of another? Assuming the frame has correct transparency information then just draw it on top of the other image.
Sorcery
I think that there is no offical API to combine images.maybe you need to write your own plug-in.
If the pixels in the centre of the frame have the correct alpha values then you should be able to BitBlt() the frame on top of the picture and it will work. If not you could create a mask for the centre of the frame and use BitBltMasked().
Sorcery
How about using offscreen bitmap . You could first blit image take from camera and then blit the image frame. You have a combined image. For usage following this link
Last edited by sriky27; 2008-10-16 at 14:09.
Regards,
Sriky
how can i draw merge the one with transparency on top if there is no gc.bitblit in the bitmapContext?
I'm having an e32user-cbase 71 error when i tried combining the two image....
Code:void CCameraCaptureEngine::ImageReady(CFbsBitmap* aBitmap,HBufC8* /*aData*/, TInt aError) { TInt err(KErrNone); if ( !aError ) { iBitmapSave = aBitmap; CGraphicsContext* bitmapContext=NULL; CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(iBitmapSave); CleanupStack::PushL(bitmapDevice); User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); CleanupStack::PushL(bitmapContext); bitmapContext->DrawBitmap(TPoint(0,0), iController.iGif_Reader->Bitmap()); iController.iGif_Reader->ScaleFileImage(TSize(640,480), iBitmapSave); TRAP(err, DrawL()); HandleError( err ); } else { HandleError( aError ); } }
i fixed the panic.. but my image is not being merged???
Code:iBitmapSave = aBitmap; CGraphicsContext* bitmapContext=NULL; CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(iBitmapSave); CleanupStack::PushL(bitmapDevice); User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); CleanupStack::PushL(bitmapContext); bitmapContext->DrawBitmap(TPoint(0,0), iController.iGif_Reader->Bitmap()); iController.iGif_Reader->ScaleFileImage(TSize(640,480), iBitmapSave); TRAP(err, DrawL()); CleanupStack::PopAndDestroy(bitmapContext); CleanupStack::PopAndDestroy(bitmapDevice);
Hi coolblue,
Could you be more specific by two images not being merged. Show your DrawL code
Regards,
Sriky
hi sriky
the image is saved is all white
i didn't place anything in the drawL(), i just tried the link you gave below...Code:void CCameraCaptureEngine::DrawL() { CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); //graphic context CleanupStack::PushL( fbsBitGc ); User::LeaveIfError( iController.GetSnappedImage(). Resize( iLandscapeSize )); CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL( &iController.GetSnappedImage() ); fbsBitGc->Activate( bmpDevice ); fbsBitGc->DrawBitmap( TRect(iLandscapeSize), iBitmapSave ); delete bmpDevice; CleanupStack::PopAndDestroy(fbsBitGc);//fbsBitGc; // Start to save the image. // StartToSaveImage(); iController.ShowConversionStatusL( KImageSaveImage ); }
Last edited by coolblues5000; 2008-10-28 at 05:33.
Hi you should try this
Problem was you were drawing bitmaps on two differnt contexxts.Code:iBitmapSave = aBitmap; CGraphicsContext* bitmapContext=NULL; CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(iBitmapSave); CleanupStack::PushL(bitmapDevice); User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); CleanupStack::PushL(bitmapContext); bitmapContext->DrawBitmap(TPoint(0,0), iController.iGif_Reader->Bitmap()); iController.iGif_Reader->ScaleFileImage(TSize(640,480), iBitmapSave); bitmapContext->DrawBitmap( TRect(iLandscapeSize), iBitmapSave ); CleanupStack::PopAndDestroy(bitmapContext); CleanupStack::PopAndDestroy(bitmapDevice
Regards,
Sriky
hi its still not working.. the saved image is scaled but the frame was not painted on top
Code:void CCameraCaptureEngine::DrawL() { CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); //graphic context CleanupStack::PushL( fbsBitGc ); User::LeaveIfError( iController.GetSnappedImage(). Resize( iLandscapeSize )); CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL( &iController.GetSnappedImage() ); fbsBitGc->Activate( bmpDevice ); fbsBitGc->DrawBitmap( TRect(iLandscapeSize), iBitmapSave ); delete bmpDevice; CleanupStack::PopAndDestroy(fbsBitGc);//fbsBitGc; CGraphicsContext* bitmapContext=NULL; CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(iBitmapSave); CleanupStack::PushL(bitmapDevice); User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); CleanupStack::PushL(bitmapContext); iController.iGif_Reader->ScaleFileImage(TSize(640,480), iBitmapSave); bitmapContext->DrawBitmap( TRect(iLandscapeSize), iBitmapSave ); bitmapContext->DrawBitmap(TPoint(0,0), iController.iGif_Reader->Bitmap()); CleanupStack::PopAndDestroy(bitmapContext); CleanupStack::PopAndDestroy(bitmapDevice); // Start to save the image. // StartToSaveImage(); iController.ShowConversionStatusL( KImageSaveImage ); }
i tried adding this
// draw something on the bitmap
TRect rect(0,0,100,100);
bitmapContext->SetBrushColor(KRgbRed);
bitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
bitmapContext->DrawRect(rect); // a filled red rectangle
its paints a red box...
is it because the bitmap I'm painting has a problem?
Code:CFbsBitmap* CGif_Reader::Bitmap() { CFbsBitmap* bitmap = NULL; if ( iArray.Count() && iArray[ iCurrImg ].iBitmap ) { bitmap = new ( ELeave ) CFbsBitmap; bitmap->Duplicate ( iArray[ iCurrImg ].iBitmap->Handle() ); return bitmap; } return bitmap; }