Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2007

    CImageDecoder PANIC -6 on mask loading

    Hi all!
    I'm want to load png file with alfa channel, but after WaitForRequest status equal -6 and the bitmaps are clean.

    _LIT8(MimeType, "image/png");
    CImageDecoder* imageDecoder = CImageDecoder::FileNewL(iEikonEnv->FsSession(),
        _L("c:\\test.png"), MimeType, CImageDecoder::EOptionAlwaysThread);
    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
    CFbsBitmap* mask   = new (ELeave) CFbsBitmap();
    bitmap->Create( imageDecoder->FrameInfo().iOverallSizeInPixels, EColor4K );
    mask->Create( imageDecoder->FrameInfo().iOverallSizeInPixels, EGray2 );
    TRequestStatus status;
    imageDecoder->Convert( &status, *bitmap, *mask );
    User::WaitForRequest( status );
    bitmap->Save( _L("c:\\Nokia\\images\\test.bmp") );
    mask->Save( _L("c:\\Nokia\\images\\test_mask.bmp") );
    delete bitmap;
    delete mask;
    delete imageDecoder;
    Also use this code in CActive derived class, same result
    iImageDecoder->Convert( &iStatus, *iBmp, *iBmpMask );
    Any problem with my code?

  2. #2
    Regular Contributor
    Join Date
    Feb 2006

    Re: CImageDecoder PANIC -6 on mask loading

    Dont use A.O..
    using EOptionAlwaysThread which does the conversion in it's own thread.

    Refer this ..


    Try the below code ....Hopefully it will work for you!!!!

    HTML Code:
    class CImageHandler : public CBase
    static CImageHandler* NewL(RFs& fs);
    CImageHandler(RFs& fs);
    CFbsBitmap* LoadFileL(const TDesC& aFilename);
    CImageDecoder* iLoadUtil;
    RFs& iFs;
    CImageHandler* CImageHandler::NewL(RFs& fs)
    CImageHandler* p=new (ELeave) CImageHandler(fs);
    return p;
    CImageHandler::CImageHandler(RFs& fs) :
    delete iLoadUtil;
    //the decoder function
    CFbsBitmap* CImageHandler::LoadFileL(const TDesC& aFilename)
    delete iLoadUtil;
    iLoadUtil = NULL;
    iLoadUtil = CImageDecoder::FileNewL(iFs, aFilename,
    // Bitmap
    CFbsBitmap* pBitmap = new CFbsBitmap();
    //some line to create the CFbsBitmap
    TRequestStatus stat = KRequestPending;
    iLoadUtil->Convert(&stat, *pBitmap, 0);
    if(stat.Int() != KErrNone)
    delete pBitmap;
    pBitmap = NULL;
    return pBitmap;
    Parag Purkar

  3. #3
    Regular Contributor
    Join Date
    May 2007

    Re: CImageDecoder PANIC -6 on mask loading

    To get a mask from the alpha channel, you need to specify the "EAllowGeneratedMask" option in FileNewL.

    Also, don't listen to any advice not to use Active Objects.
    Get Resolvr - The Zeroconf framework for Symbian OS free today. Make your IP networking applications fun and easy to use. http://www.novelinteractions.com/resolvr/
    Proud to be the only autorickshaw owner in Cambridge - http://blog.novelinteractions.com/images/tuktuk.jpg

  4. #4
    Registered User
    Join Date
    Aug 2007

    Re: CImageDecoder PANIC -6 on mask loading

    Thanks. All work after replaced by following code

    iImageDecoder = CImageDecoder::FileNewL( iFs, _L("c:\\test.png"),
    MimeType, CImageDecoder::EAllowGeneratedMask );

    By translating code in project discover that panic continue.
    Its funny system. Now I see that changed not only flag.
    The real punic source is different DisplayMode in file and params.
        iImageDecoder->FrameInfo().iFrameDisplayMode /*was EColor4K*/);
       // its a EColor16M for me
        EGray256 /*was EGray2*/ );
    So the bitmap and mask can be obtained without EAllowGeneratedMask
    Last edited by sergey.kish; 2007-08-28 at 14:16. Reason: realy find

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Oslo, Norway

    Re: CImageDecoder PANIC -6 on mask loading

    Th documentation says
    Quote Originally Posted by SDK Help

    The destination bitmap aDestination, must be created before the call to Convert() is made. aDestination must be large enough to contain the frame and be set to the required display mode. FrameInfo() can be used to obtain the size and display mode of the frame. The destination mask aDestinationMask must be created before the call to Convert() is made and must be large enough for the mask. The display mode must be EGray2 or EGray256 and must be EGray256 if the image contains alpha-blending information. This information can be obtained from the iFlags property of TFrameInfo obtained from a FrameInfo() call.
    This excerpt is taken from the 3rd ed. help, but 2nd ed. also has these sentences - although in the "Parameters" section. So empty bitmaps may not be enough.

    You can also try letting CImageDecoder to find out the mime type: FileNewL(RFs &aFs, TDesC &aSourceFilename, TOptions aOptions=EOptionNone, TUid aImageType=TUid::Null(), TUid aImageSubType=TUid::Null(), TUid aDecoderUid=TUid::Null());

    Problems stemming in the lack of Active Object might or might not appear, you will obviously find out if the User::WaitForRequest never returns.

Similar Threads

  1. Theme Studio 3.1 not creating themes
    By zemm in forum Themes/Carbide.ui
    Replies: 11
    Last Post: 2008-10-18, 08:41
  2. Using Bluetooth serial port in MIDlets (nokia 9500 issue)
    By orsteglasy in forum Mobile Java Networking & Messaging & Security
    Replies: 11
    Last Post: 2007-10-07, 21:49
  3. "ImageConversion 9" panic from CImageDecoder
    By dstl1128 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2007-08-28, 13:24
  4. Compilation series 60 3rd edition
    By asmobease in forum Symbian Tools & SDKs
    Replies: 32
    Last Post: 2006-09-13, 09:46
  5. WSERV 10 Panic with bitmap loading
    By fullscale in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-10-24, 08:01

Posting Permissions

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