You Are Here:

Community: Developer Discussion Boards

#1 Old AknIconUtils is caching the image - 2006-11-02, 15:24

Join Date: Jul 2005
Posts: 55
Tatanka.nbr1
Offline
Regular Contributor
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
Reply With Quote

#2 Old Re: AknIconUtils is caching the image - 2006-11-03, 12:17

Join Date: Jul 2004
Posts: 98
ppiggy
Offline
Regular Contributor
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.
Reply With Quote

#3 Old Re: AknIconUtils is caching the image - 2006-11-03, 14:11

Join Date: Jul 2005
Posts: 55
Tatanka.nbr1
Offline
Regular Contributor
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.
Reply With Quote

#4 Old Re: AknIconUtils is caching the image - 2006-11-04, 09:39

Join Date: Jul 2004
Posts: 98
ppiggy
Offline
Regular Contributor
The name of the .mif.

E.g. from abc.mif change to abc_new.mif
Reply With Quote

#5 Old Re: AknIconUtils is caching the image - 2006-11-04, 13:15

Join Date: Jul 2005
Posts: 55
Tatanka.nbr1
Offline
Regular Contributor
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
Reply With Quote

#6 Old Re: AknIconUtils is caching the image - 2006-11-07, 09:23

Join Date: Jul 2005
Posts: 55
Tatanka.nbr1
Offline
Regular Contributor
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
Reply With Quote

#7 Old Re: AknIconUtils is caching the image - 2006-11-07, 16:10

Join Date: Feb 2006
Posts: 16,385
Location: Zürich, Switzerland
wizard_hu_'s Avatar
wizard_hu_
Offline
Forum Nokia Champion
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).
Reply With Quote

#8 Old Re: AknIconUtils is caching the image - 2006-11-07, 16:37

Join Date: Jul 2005
Posts: 55
Tatanka.nbr1
Offline
Regular Contributor
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).
Reply With Quote

#9 Old Re: AknIconUtils is caching the image - 2006-11-07, 18:57

Join Date: Feb 2006
Posts: 16,385
Location: Zürich, Switzerland
wizard_hu_'s Avatar
wizard_hu_
Offline
Forum Nokia Champion
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));
Reply With Quote

#10 Old Re: AknIconUtils is caching the image - 2006-11-08, 08:47

Join Date: Jul 2005
Posts: 55
Tatanka.nbr1
Offline
Regular Contributor
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));
Reply With Quote

#11 Old Re: AknIconUtils is caching the image - 2006-11-08, 10:59

Join Date: Jul 2005
Posts: 55
Tatanka.nbr1
Offline
Regular Contributor
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
Reply With Quote

#12 Old Re: AknIconUtils is caching the image - 2007-01-05, 18:55

Join Date: Jul 2003
Posts: 25
PawelDefee
Offline
Registered User
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!
Reply With Quote

#13 Old Thumbs up Re: AknIconUtils is caching the image - 2007-01-05, 20:08

Join Date: Jul 2003
Posts: 25
PawelDefee
Offline
Registered User
All right, problem solved !

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

if( iCachedBitmap )
{
AknIconUtils::DestroyIconData( iCachedBitmap );
}
if( iCachedMask )
{
AknIconUtils::DestroyIconData( 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
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a JPEG Image ummarbhutta Mobile Java Media (Graphics & Sounds) 8 2007-02-15 07:34
how to cut some part of Image mshouab Mobile Java Media (Graphics & Sounds) 2 2006-08-04 10:05
Image caching pillar Mobile Java Media (Graphics & Sounds) 2 2006-07-28 01:06
HELP: Mutable Image to Immutable Image? rj_cybersilver Mobile Java Media (Graphics & Sounds) 1 2005-03-26 10:58
Image Caching in Nokia's WAP Browsers hseikaly General Browsing 1 2003-02-28 08:31

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia