×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    55

    AknIconUtils is caching the image

    Hi,

    I´m having a bit trouble with the AknIconUtils. I´m using an svg image, I create the image using the AknIconUtils::CreateIconL, I set the size and display the image.

    I´m using scanlines and dataadress to manipulate the imag, like mirror it and so on. When I delete the image and then reload the image from the mif file using AknIconUtils as I described above, the image that is shown is still the manipulated image. AknIconUtils does not change the image back allthough I deleted the bitmap and re-read it from the mif file. It still displays the image like it was after I changed it.

    Has any one seen this problem and if so, did you find any solution?

    Thanx for your help

  2. #2
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    104

    Re: AknIconUtils is caching the image

    Yes it seems that AknIconUtils will cache images. My solution is to change the mif name when there is any change in the mif file.

  3. #3
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    55

    Re: AknIconUtils is caching the image

    Hi, thanx for your reply. I'm not sure I fully understand you. What name do you change? The name of the image or the name of the mif-file?

    Thanx

    Quote Originally Posted by ppiggy
    Yes it seems that AknIconUtils will cache images. My solution is to change the mif name when there is any change in the mif file.

  4. #4
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    104

    Re: AknIconUtils is caching the image

    The name of the .mif.

    E.g. from abc.mif change to abc_new.mif

  5. #5
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    55

    Re: AknIconUtils is caching the image

    Oki, I see. Thank you for your help.

    I also noticed that if you load a different icon from the mif file and then loads the original file (the one that was modified) then the real original is displayed.

    It seems like the system is caching the latest loade file from the mif file.

    It would be great to get this to work by not using any hack, anyone who has a clue?

    Thank you

  6. #6
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    55

    Re: AknIconUtils is caching the image

    Hmm, I was wrong in my last post. It does not help to load a dummy icon. When I load the image that I manipulated after loading a dummy, the image is still looks the same as it did after I changed it.

    How can I get the original image back. If someone from Nokia could answer this it would be great, it sounds crazy if there is nothing to do about this. There should be a possibility to reload the image in it´s original state.

    Please help.

    Thanx

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

    Re: AknIconUtils is caching the image

    What happens if you try AknIconUtils::SetSize? It might force AvKon to redraw your bitmap using the original SVG content (especially if you try resizing to some dummy size, and then to your target-size).

  8. #8
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    55

    Re: AknIconUtils is caching the image

    Hi, thank you for your answer. I´m sorry to say that it did no difference. I tried to load a dummy and set the size of the dummy and then reload the original image again. When displaying the image it is still changed.

    Any other idea, it would be nice to clear the cache somehow.



    Quote Originally Posted by wizard_hu_
    What happens if you try AknIconUtils::SetSize? It might force AvKon to redraw your bitmap using the original SVG content (especially if you try resizing to some dummy size, and then to your target-size).

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

    Re: AknIconUtils is caching the image

    Not exactly, I imagine something like this:
    Code:
    AknIconUtils::CreateIconL(iBitmap,iMask,filename,EBitmapId,EMaskID);
    AknIconUtils::SetSize(iBitmap,TSize(100,100));
    ...
    corrupt the bitmap somehow
    ...
    AknIconUtils::SetSize(iBitmap,TSize(22,22));
    AknIconUtils::SetSize(iBitmap,TSize(100,100));

  10. #10
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    55

    Re: AknIconUtils is caching the image

    I tested exactly what you did below but with no success. It´s pretty frustrating not being able to control this at all.

    Thanx for trying to help.


    Quote Originally Posted by wizard_hu_
    Not exactly, I imagine something like this:
    Code:
    AknIconUtils::CreateIconL(iBitmap,iMask,filename,EBitmapId,EMaskID);
    AknIconUtils::SetSize(iBitmap,TSize(100,100));
    ...
    corrupt the bitmap somehow
    ...
    AknIconUtils::SetSize(iBitmap,TSize(22,22));
    AknIconUtils::SetSize(iBitmap,TSize(100,100));

  11. #11
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    55

    Re: AknIconUtils is caching the image

    Some new information.

    I have the following code, I create two images (two different CFbsBitmaps) with the same id from the mif file.

    Code:
       
    AknIconUtils::CreateIconL(iTmpBitmap, iTmpMask, iconFile, 
                                 EMbmHelloworldbasicImage1,
                                 EMbmHelloworldbasicImage1_mask);
    AknIconUtils::CreateIconL(iBitmap, iMask, iconFile, 
                                 EMbmHelloworldbasicImage1,
                                 EMbmHelloworldbasicImage1_mask);
    I then set the size
    Code:
       
    AknIconUtils::SetSize(iTmpBitmap, rect.Size(), 
                             EAspectRatioPreservedAndUnusedSpaceRemoved);
    AknIconUtils::SetSize(iBitmap, rect.Size(), 
                             EAspectRatioPreservedAndUnusedSpaceRemoved);
    I then call DrawDeferred() and BitBltMasked iBitmap and iMask.

    After this I call a function that manipulates the data in iTmpBitmap and displays this image. The manipulated image is now shown correctly.

    I then call the first function that does the above code and displays iBitmap again. It now looks exactly like iTmpBitmap does after the manipulation of it. This is very strange.

    If I debug the application, I can see that the adresspointer and the serverhandle is the same for these two CFbsBitmaps, allthough they are created once for itself.

    On the other hand if I change the code:
    Code:
    AknIconUtils::SetSize(iTmpBitmap, rect.Size(), 
                             EAspectRatioPreservedAndUnusedSpaceRemoved);
    AknIconUtils::SetSize(iBitmap, rect.Size(), 
                             EAspectRatioPreservedAndUnusedSpaceRemoved);
    To:
    Code:
    AknIconUtils::SetSize(iTmpBitmap, rect.Size(), 
                             EAspectRatioPreservedAndUnusedSpaceRemoved);
    AknIconUtils::SetSize(iBitmap, rect.Size());
    The iBitmap image is displayed as if the data never has been changed, it now works as it should. The adresspointer and the serverhandle is not the same as it is for the iTmpBitmap.

    Isn´t it very strange that two icons, even if they are exactly the same, that is created seperatelly points to the same adress and has the same serverhandle.

    Does anyone know how to get around this? I think the whole behaviour of the AknIconUtil is very strange and in my eyes not very logic.

    Thanx

  12. #12
    Registered User
    Join Date
    Jul 2003
    Posts
    25

    Re: AknIconUtils is caching the image

    Any news on this one? I just experienced the caching problem myself .

    Basically, I also have to load the same SVG image over and over again at different sizes - but only the first size load is ever effective, even if the bitmaps are destroyed in between!

  13. #13
    Registered User
    Join Date
    Jul 2003
    Posts
    25

    Thumbs up Re: AknIconUtils is caching the image

    All right, problem solved !

    To empty a bitmap from Avkon Server cache, use this:

    if( iCachedBitmap )
    {
    AknIconUtils:estroyIconData( iCachedBitmap );
    }
    if( iCachedMask )
    {
    AknIconUtils:estroyIconData( iCachedMask );
    }

    Please note that this will NOT destroy any objects in your applications, simply flush the corresponding SVG data on the server side, you still need to call "delete iCachedBitmap" and so on if you own the bitmap objects.

    Cheers,
    Pawel

Similar Threads

  1. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  2. 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
  3. Image caching
    By pillar in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-07-28, 00:06
  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

Posting Permissions

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