You Are Here:

Community: Developer Discussion Boards

#1 Old Image caching - 2006-07-27, 11:46

Join Date: Feb 2006
Posts: 113
pillar
Offline
Regular Contributor
I'm developing this map application. The user is able to move on the map. If you press right, it will move right so that 50% of your last screen is still showing and 50% is new map. The map data is loaded over-the-air as PNG's received as bytearrays. It is only loading the part that is not known yet, in order to save time/data received.

This is all working nice, except the fact that I would like to cache old parts of the map, in order to make it even more time and data efficient. My problem is that I'm having a hard time to get the concept of image caching down. It would be easy if it would always move 100% and load totally new screen. But when it's only moving 50%, it get's complicated.

Do you guys have any suggestions?

Only thing I have come up with is that if I could somehow divide the image data (bytearray) into 4 squares and in case of movement divide the extra data into two - that way I would have a coordinate system and could just look up in an array, if I already have those coordinates loaded. The problem is that I don't know of a way to divide the image that way. Is this understandable? Any suggestions?
Reply With Quote

#2 Old Re: Image caching - 2006-07-27, 16:29

Join Date: Jun 2005
Posts: 928
dcrocha's Avatar
dcrocha
Offline
Forum Nokia Expert
What if you get the image, as a byte array, draw it and store in a Hashtable, for example.

Then when you get the second image, or 50% of it, you would draw two images instead of two:

1) The one in the Hashtable, using Graphics.drawImage() overload to draw just a portion of the acquired image.
2) The one you've just received, also using drawImage() to drive just a portion of it.

Or you could receive three or four images at once, as a single byte array, and then split the images using
Code:
createImage(byte[] imageData, int imageOffset, int imageLength)
.

Daniel
Reply With Quote

#3 Old Re: Image caching - 2006-07-28, 01:06

Join Date: Dec 2005
Posts: 1,696
Location: Europe/Poland/Warsaw
peterblazejewicz
Offline
Super Contributor
hi pillar,

or save in RMS, use two different RMS: one for storing just-loaded image index (or could be geocoding data, map tile data, etc), second one to save only bytes from that image, and store index as access point ("key" from index RMS+"recordID" from image data RMS) in hashtable,
that way you can easily and fast retrieve textual data from first rms if no image data is currently required and both or only image data from the latter RMS if you need to load "cached" visual data,
You could even implement inteligent algorithm at runtime to decide how many data can be precached in RMS because RMS offers a way to retrieve of current RMS data and available size, and because RMS is faster then on-air download it could be also solution you can think about in your implementation,
RMS-based solution will be slower than in-memory caching Daniel wrote but could improve runtime memory usage,

hth,
regards,
Peter
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 Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
--- ???save image problem??? --- ferenn Mobile Java Media (Graphics & Sounds) 6 2007-10-01 15:33
HELP: Mutable Image to Immutable Image? rj_cybersilver Mobile Java Media (Graphics & Sounds) 1 2005-03-26 10:58
saving jpeg image on grid list flicker82 General Symbian C++ 0 2005-01-21 05:22
Image Caching in Nokia's WAP Browsers hseikaly General Browsing 1 2003-02-28 08:31
Image caching on 7650 MortenUlrik General Symbian C++ 0 2002-10-16 10:01

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 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ