×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jul 2007
    Posts
    114

    error=4 when try to scale the image

    Hello

    I have got the following routine to scale the image


    void CImageHandler::ScaleL()
    {
    __ASSERT_ALWAYS(!IsActive(),User::Invariant());
    if ( iScaler )
    {
    delete iScaler;
    }
    iScaler = NULL;
    iScaler = CBitmapScaler::NewL();

    TInt error=iScaledBitmap->Create(iSize, EColor64K);
    if(error)
    {
    this->idecode_state=Err;
    User::Leave(No_memory_for_scaled_image);
    }
    this->idecode_state=Scalings;
    iScaler->UseLowMemoryAlgorithm(ETrue);//make sure it does not requiremed with so much memory
    iScaler->Scale(&iStatus, *iBitmap, *iScaledBitmap, ETrue);
    SetActive();
    }

    but in the RunL..
    I check the status, it is equals to -4, which means that there is no Memory avaiable and idecode_state=Scalings...if it is really no memory, does not it generate this error in the iScaledBitmap->Create(iSize, EColor64K) and idecode_state=Err?? as Create should return KErrNoMemory
    when there is not enough memory..

    Regards

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: error=4 when try to scale the image

    it could be that Scale() function actually needs some temporal data storages, and while it is trying to reserve them, it finds out that there is not enough memory.

    Anyway, are you working with standard 1 MB heap still, or are the images really big ?

    yucca

  3. #3
    Regular Contributor
    Join Date
    Jul 2007
    Posts
    114

    Re: error=4 when try to scale the image

    the image is jpg format and it is less than 200KB...

    how to enlarge the heap size? I already set to the EPOCHEAPSIZE 0x5000 0x3000000 in the mmp file

    Regards

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

    Re: error=4 when try to scale the image

    it does not matter what the file size is, what matters is the image size in pixels and color depth, since it will be handled as a bitmap when you are scaling it. Anyway EPOCHEAPSIZE should do the trick, so it could be that you are actually running out of RAM memory.

    Anyway, you could always try loading the image directly to the size you need, and not to its original size. Or use Bitmap GC to simply draw the image into another one with different size.

    yucca

Similar Threads

  1. --- ???save image problem??? ---
    By ferenn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2007-10-01, 14:33
  2. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  3. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  4. HELP: Mutable Image to Immutable Image?
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-03-26, 09:58
  5. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

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