×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    How To Combine 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.

  2. #2
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How To Combine 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

  3. #3
    Nokia Developer Expert
    Join Date
    Jun 2008
    Posts
    333

    Re: How To Combine Two Images?

    I think that there is no offical API to combine images.maybe you need to write your own plug-in.

  4. #4
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: How To Combine Two Images?

    Quote Originally Posted by Sorcery-ltd View Post
    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
    yes, i want the frame to be on top of the image taken from the camera. then save the it as one image.

  5. #5
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: How To Combine Two Images?

    Quote Originally Posted by lming View Post
    do you want to find out byte difference or content difference?
    content difference is pretty hard to check because it equals to image recognition.
    no, i just want to put the frame on top of the image taken from the camera then save them as one image.

  6. #6
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How To Combine Two Images?

    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

  7. #7
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: How To Combine Two Images?

    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

  8. #8
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: How To Combine Two Images?

    how can i draw merge the one with transparency on top if there is no gc.bitblit in the bitmapContext?

  9. #9
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: How To Combine Two Images?

    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 );  
            }
        }

  10. #10
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: How To Combine Two Images?

    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);

  11. #11
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: How To Combine Two Images?

    Hi coolblue,

    Could you be more specific by two images not being merged. Show your DrawL code
    Regards,
    Sriky

  12. #12
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: How To Combine Two Images?

    hi sriky

    the image is saved is all white

    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 );
        }
    i didn't place anything in the drawL(), i just tried the link you gave below...
    Last edited by coolblues5000; 2008-10-28 at 05:33.

  13. #13
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: How To Combine Two Images?

    Hi you should try this
    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
    Problem was you were drawing bitmaps on two differnt contexxts.
    Regards,
    Sriky

  14. #14
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: How To Combine Two Images?

    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 );
        }

  15. #15
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: How To Combine Two Images?

    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;
        
        }

Similar Threads

  1. Incorrect rgb values for jpg images on S40 3rd ed
    By bjudfar in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-05-29, 16:34
  2. How to use code to get images from webCam???
    By DancingWave in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-04-10, 09:06
  3. Help with creating Images..Pls
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-03-02, 01:58
  4. Where are images inserted in .jar archive?
    By trussolillo in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2004-11-17, 08:31
  5. Problem with PNG Images
    By cyphre666 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2003-12-12, 18:20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×