×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    53

    convert from 16mu to 16m

    The displaymode of n95 camera image is of type EColor16Mu and I need it in display mode EColor16M
    is there a way that i can let the display mode of camera EColor16M direct and if there is no way how can I convert between them?

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: convert from 16mu to 16m

    You can create a bitmap in the required display mode, then draw your image to that one. Search for how to draw to a bitmap in the SDK Help (though the title of the result will be very different, the query will actually work). It is easier to locate the relevant hit if you order them by title.

  3. #3
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    53

    Re: convert from 16mu to 16m

    I searched the sdk but I can't find anything,plz if you can write the code to draw the bitmap plz do

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: convert from 16mu to 16m

    you could try out searching example's using CBitmapContext. Might be that there is no examples that you could use directly. One exmaple that could get you started is here: http://wiki.forum.nokia.com/index.ph...uble_buffering

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: convert from 16mu to 16m

    Quote Originally Posted by m_afatah View Post
    I searched the sdk but I can't find anything,plz if you can write the code to draw the bitmap plz do
    Which SDK do you use?
    » Symbian OS vx.y » Symbian OS guide » Graphics » Using Graphics Device Interface » Using Bitmaps » How to create and draw to an off-screen bitmap

  6. #6
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    53

    Re: convert from 16mu to 16m

    thank you for helping but I don't think that the sdk will help me what I want to do,I don't want to draw it on screen,what I want that I can make the Output of camera of display mode type 16m ,if I can't how can i convert from type 16mu to 16m ?

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: convert from 16mu to 16m

    Hmm, in my reading if something says "How to create and draw to an off-screen bitmap", it probably discusses how to create and draw to a bitmap, and not the screen (that is what 'off-screen' tries to say).
    Let us try once more. This is what you can find in the SDK Help, just without the colours
    Quote Originally Posted by SDK Help
    // create a bitmap to be used off-screen
    CFbsBitmap* offScreenBitmap = new (ELeave) CFbsBitmap();
    User::LeaveIfError(offScreenBitmap->Create(TSize(100,100),EColor256));
    CleanupStack::PushL(offScreenBitmap);

    // create an off-screen device and context
    CGraphicsContext* bitmapContext=NULL;
    CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(offScreenBitmap);
    CleanupStack::PushL(bitmapDevice);
    User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext));
    CleanupStack::PushL(bitmapContext);

    // 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

    // now do what you want with it, such as blitting to the screen
    gc.BitBlt(TPoint(20,20),offScreenBitmap);

    // cleanup
    CleanupStack::PopAndDestroy(3);
    Now consider that you have "CFbsBitmap *photo", and
    - replace the Red part with: photo->SizeInPixels()
    - replace the Sienna (is that a colour?) part with: your favourite EColor16M
    - then replace the the Blue part with: bitmapContext->DrawBitmap(photo->SizeInPixels(),photo);
    Guess what happens.

  8. #8
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    53

    Re: convert from 16mu to 16m

    I have made it like you said ,but the display mode not changed still EColor16Mu

    void CmouAppView::SetCameraFrame(CFbsBitmap& aBitmap)
    {
    // create a bitmap to be used off-screen
    CFbsBitmap* offScreenBitmap = new (ELeave) CFbsBitmap();
    User::LeaveIfError(offScreenBitmap->Create(aBitmap.SizeInPixels(),EColor16M));
    CleanupStack::PushL(offScreenBitmap);

    // create an off-screen device and context
    CGraphicsContext* bitmapContext=NULL;
    CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(offScreenBitmap);
    CleanupStack::PushL(bitmapDevice);
    User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext));
    CleanupStack::PushL(bitmapContext);

    bitmapContext->DrawBitmap(aBitmap.SizeInPixels(),&aBitmap);
    // cleanup
    CleanupStack::PopAndDestroy(3);
    TDisplayMode mou=aBitmap.DisplayMode();

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: convert from 16mu to 16m

    Note that the new bitmap is the one you should have checked... Also note that the PopAndDestroy(3) actually deletes offScreenBitmap, so your check would be safer before that line. But there is no much to check, since Create(...,EColor16M) is the line which defines the result.

    If you want to modify aBitmap itself (so the caller code would get the EColor16M bitmap instead of the other one), you can try
    Code:
    bitmapContext->DrawBitmap(aBitmap.SizeInPixels(),&aBitmap);
    
    aBitmap.Reset();
    aBitmap.Duplicate(offScreenBitmap->Handle());
    
    // cleanup
    CleanupStack::PopAndDestroy(3);
    TDisplayMode mou=aBitmap.DisplayMode();

  10. #10
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    53

    Re: convert from 16mu to 16m

    thank you for helping the problem is solved

Posting Permissions

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