Image caching causing problems

I am making a Java based game. I'm using a mixture of static and animated gifs (things should switch to animated gifs now and then e.g. when something explodes).
I am using Tookit.getImage() to get images, e.g.
Toolkit kit;
Image image;
image =  kit.getImage("images/Explode.gif");This caching is all very well for the static gifs, but very bad for the animated ones. For a 'repeat once' gif, it'll only ever play once upon first load, in future it just starts at the end of the animation. If I have the gifs repeat forever, all instances of the gif are synchronised at the exact same point (so if something is already exploding, then another explodes, it would start mid animation).
The Toolkit API suggests createImage (because getImage implements its own caching), but with createImage, the gifs don't animate whatsoever (they just display the initial frame). Anyone got any ideas to get independant instances of animated gifs working?
Thank you

Use a so called "sprite sheet" instead. Thats a single image, which contains all the frames next to each other.
A sprite sheet can look like this:
http://kaioa.com/k/newexplosion7_sheet.png
(Note that this one has full alpha. Drawing it will be very slow usually.)
And here is one with bitmask transparency:
http://kaioa.com/k/dither_ex.png
For displaying the animation you simply draw a specific region of the image each frame. You can do that for example with that drawImage method, which takes 2 clipping regions (4 coord pairs).
Getting "independant instances" is a matter of using seperate counters for each explosion on screen. You can for example use some Explosion object, which holds x, y and the frame number.

Similar Messages

  • File cache causing problems?

    Since installing Mavericks I experience pauses when switching between apps. I have the full16 meg capacity RAM and have not had this problem in prior versions of OS X. I note I have 8.3 meg of "file cache" and 3  meg of free memory. Is the file cache causing the problem? Any other ideas?

    When you have the problem, note the exact time: hour, minute, second.   
    These instructions must be carried out as an administrator. If you have only one user account, you are the administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    The title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen.
    Each message in the log begins with the date and time when it was entered. Scroll back to the time you noted above. Select the messages entered from then until the end of the episode, or until they start to repeat, whichever comes first. Copy the messages to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    The log contains a vast amount of information, almost all of it useless for solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    Some private information, such as your name, may appear in the log. Anonymize before posting.

  • Image scale caching causing problems

    I have an app with a image that the user must be able to zoom and scroll.
    When the image is first loaded it is at full view. When the user zooms the memory usage sky rockets, and during this zooming the app is very laggy.
    Once the memory has added about 70Mb, the zooming runs without lag.
    If the user waits however, the memory usage goes back down, the scaling lags again, and the memory fills again.
    I have been able to get around this with making the height an odd number of pixels.
    This causes the memory to stay at the +70Mb and prevent lagging, but this may not be a permanent solution.
    Is there any way to prevent the GC from wiping the scale information? Or any way to manage how the cached scale data is stored?

    The image is large. The app is for iOS and Android devices.
    The images are 5464x3073 (should be 3072, but made it odd to prevent problem), they are simply scaled to fit the screen (usually about 0.2 scale).
    Till this point is fine, obvious pause when loading the image, but when the user zooms in, the memory gets an extra 70Mb(if you zoom all the way in) and stays for about 10-20 seconds. During this time zoom is smooth. When the memory goes back down the process of zooming causes lag and memory usage again.

  • Mail attachment image caching problem with C7

    Using C7-00 and Mail for Exchange with up to date software. I received two Mobile Boarding Pass emails from Lufthansa for my flights. These emails contain barcode.gif as an attachment that one can show at the gate when boarding. Now the two emails contain attachment with same name (barcode.gif) and the images are equal in size too. The problem is that for the second mail the phone shows the attachment of the first email!
    I have read that Symbian^3 has for performance reasons aggressive image caching feature. But in this case this causes a real nasty bug!
     - Juha

    I have found a solution.
    In the IMG src tag we had been using /images/gfx/image.gif
    By changing this to /./images/gfx/image.gif the images are no longer cached and update immediately when changed.
    PQ

  • Mail attachment image caching problem

    Using C7-00 and Mail for Exchange with up to date software. I received two Mobile Boarding Pass emails from Lufthansa for my flights. These emails contain barcode.gif as an attachment that one can show at the gate when boarding. Now the two emails contain attachment with same name (barcode.gif) and the images are equal in size too. The problem is that for the second mail the phone shows the attachment of the first email!
    I have read that Symbian^3 has for performance reasons aggressive image caching feature. But in this case this causes a real nasty bug!
     - Juha

    I have found a solution.
    In the IMG src tag we had been using /images/gfx/image.gif
    By changing this to /./images/gfx/image.gif the images are no longer cached and update immediately when changed.
    PQ

  • Image Caching

    Hi
    I'm trying to implement Image Caching on an Oracle XE database following Tyler Muth's blog post http://tylermuth.wordpress.com/tag/oracle-plsql-images-caching/
    Has anyone managed to implement this successfully?
    I've run the following as sys :
    begin
    DBMS_EPG.SET_DAD_ATTRIBUTE (
       dad_name    => 'APEX',
       attr_name   => 'cgi-environment-list',
       attr_value  => 'HTTP_IF_NONE_MATCH');
    DBMS_EPG.SET_DAD_ATTRIBUTE (
       dad_name    => 'APEX',
       attr_name   => 'cgi-environment-list',
       attr_value  => 'IF_MODIFIED_SINCE');
    end;
    /And my function to download the images includes the following:
        v_etag_head := owa_util.get_cgi_env('HTTP_IF_NONE_MATCH');
        v_etag_str := lpad(p_file_id,2,0)||to_char(v_date_last_modified,'DDMMYYYYHH24MISS');
        if v_etag_head = v_etag_str then
          owa_util.status_line(
          NSTATUS         => 304,
          CREASON         => 'Not Modified',
          BCLOSE_HEADER   => true);
          return;
        else
          owa_util.mime_header(v_mimetype, FALSE );
          htp.p('Date: ' ||to_char(sysdate,'Dy, DD Mon RRRR hh24:mi:ss')||' GMT');
          htp.p('Content-length: '||v_file_length);
          htp.p('Content-Disposition: inline; filename="'||v_filename||'"');
          htp.p('Last-Modified: '||to_char(v_date_last_modified,'Dy, DD Mon RRRR hh24:mi:ss')||' GMT');
          htp.p('ETag: '||v_etag_str);
          htp.p('Expires: ' ||to_char(sysdate+(1/12),'Dy, DD Mon RRRR hh24:mi:ss')||' GMT');
          htp.p('Cache-Control: max-age=300');
          owa_util.http_header_close;
          wpg_docload.download_file(v_blob);
       end if;However, owa_util.get_cgi_env('HTTP_IF_NONE_MATCH') always returns null. I've checked using LiveHTTPHeaders and the If-None-Modified is being sent. This is running on a local Oracle XE database (using the EPG), running APEX 4.0.0.00.46 and Windows 7.
    I've searched the forum and there are four other posts that refer to HTTP_IF_NONE_MATCH, however these haven't helped. If anyone has any ideas or needs any more information, please let me know. And if you have got this working I'd love to know how, even just so I know it's possible!!
    Thanks for any help.
    Sara

    Bump.
    Has anyone managed to implement this successfully? Is there anything I can check? Or is this a bug with the EPG?
    This is causing us massive problems and I can't see what I've done wrong. Any help is really appreciated.
    Thanks
    Sara

  • Is there a solution to Rapidweaver Stacks Cache size problems?

    Is there a solution to Rapidweaver Stacks Cache size problems?
    My website http://www.optiekvanderlinden.be , has about 100 pages and is about 250MB in size. Every time I open RapidWeaver with the Stacks-plugin, the user/library/cache/com.yourhead.YHStacksKit folder grows to several Gigabytes in size. If I don't  manually empty the com.yourhead.YHStacksKit Cache daily, AND empty the Trash before i turn off my mac, my Mac still has problems and stalls at startup the next day. Sometimes up to 5 minutes and more before he really boots. If i have a been working on such a large site for a few weeks without deleting that cache, than my iMac doesn't start up anymore, and the only thing left to do is completely reinstall the iOs operating system. This problem doesn't happen the days i use all my other programs but don't use Rapidweaver.
    Does anyone know a solution and / or what is the cause of this?

    once more,
    i just launched my project in Rapidweaver, and WITHOUT making any changes to my pages, the cache/com.yourhead.YHStacksKit folder filled itself with 132 folders (total 84Mb), most of them containing images of specific pages etc. The largest folder in the cache is the one with the images of a page containing a catalogue of my company, this folder is 7Mb. It seems by just starting up a project, immediately different folders are created containing most of the images in my project, and some folders with a log.txt file. Still i don't see the reason why it is filling op a huge Cache even without making changes to the project. I have 2 different sites, so 2 different projects, and i get this with both of them.

  • I want to uninstall ReloadEvery as I think it is causing problems however it is not in my list of Extensions or Plugins yet it is clearly installed, I tried reinstalling FF but it was still there! How can I get rid of it?

    I installed ReloadEvery a while ago and it seemed to be working fine however I am now having problems with FF crashing and weird things like pages not reloading and not being able to use the back button etc
    I have already tried uninstalling and reinstalling FF and upgrading to FF 4.
    When I upgraded to FF 4 I was still having problems even though I didn't have any Extensions installed at all, or so I thought. I noticed that ReloadEvery was still installed. I was rather puzzled as I had done a clean install of FF 4. I want to remove ReloadEvery to see if it will solve my problems.
    I have also tried following the help on the FF Troubleshooting about manually uninstalling Extensions but again ReloadEvery not listed there yet I am still able to use it in FF!
    I want to get rid of it!! I really need some help please.

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    If clearing cookies doesn't work then it is possible that the <i>cookies.sqlite</i> file that stores the cookies is corrupted.
    Rename (or delete) <b>cookies.sqlite</b> (cookies.sqlite.old) and delete other present cookie files like <b>cookies.sqlite-journal</b> in the Firefox Profile Folder in case the file cookies.sqlite got corrupted.
    *http://kb.mozillazine.org/Cookies

  • FF 3.6 AND 5 on same Mac, 1 profile - can I uninstall 5 without causing problems running 3.6 or with the profile?

    I upgraded from 3.6.16 to 5, but don't like how 5 handles tabs (auto reloading 'problem loading' tabs when internet connection is reestablished). So I installed 3.6 in a separate folder, e.g. both versions are on this computer. I went back to using 3.6, and let it upgrade to either 3.6.18 or 19 (don't recall which & it's not open right now). I'm having problems with it using too much CPU & Memory, and not sure if that's a difference between 3.6.16 & 3.6.18/19, or if having 5 on the same computer even if closed could be causing the problem.
    Can I uninstall 5 without causing problems with the 3.6 version and the single profile?

    If you haven't tried this, give it a try. It worked for me, hopefully it will work for you. In your version 3 firefox, disable all extensions, I had two plugins (doubletwist and joost, disable those if you have them). Then install firefox 5 by overwriting your version 3 firefox. It should work fine after that. I tried everything before, I gave that a last ditch shot. Oh yeah, before you install firefox 5, clear your cache of everything just to be sure.
    Hopefully that helps.

  • I just updated my latest java but the update is causing problems with some externale devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device

    i just updated my latest java but the update is causing problems with some external devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device.
    Is this possible and how do i do that?
    Anyone who responds thanks for that!
    Juko
    I am running
    Hardware Overview:
      Model Name:          Mac Pro
      Model Identifier:          MacPro1,1
      Processor Name:          Dual-Core Intel Xeon
      Processor Speed:          2,66 GHz
      Number of Processors:          2
      Total Number of Cores:          4
      L2 Cache (per Processor):          4 MB
      Memory:          6 GB
      Bus Speed:          1,33 GHz
      Boot ROM Version:          MP11.005D.B00
      SMC Version (system):          1.7f10
      Serial Number (system):          CK7XXXXXXGP
      Hardware UUID:          00000000-0000-1000-8000-0017F20F82F0
    System Software Overview:
      System Version:          Mac OS X 10.7.5 (11G63)
      Kernel Version:          Darwin 11.4.2
      Boot Volume:          Macintosh HD(2)
      Boot Mode:          Normal
      Computer Name:          Mac Pro van Juko de Vries
      User Name:          Juko de Vries (jukodevries)
      Secure Virtual Memory:          Enabled
      64-bit Kernel and Extensions:          No
      Time since boot:          11 days 20:39
    Message was edited by Host

    Java 6 you can't as Apple maintains it, and Java 7 you could if you uninstall it and Oracle provides the earlier version which they likely won't his last update fixed 37 remote exploits.
    Java broken some software here and there, all you'll have to do is wait for a update from the other parties.

  • Image cache not working with Firefox and apex

    Hi,
    I'd like to cache all my images to save page rendering time and bandwidth because my images are all static and never change.
    I use the John Scott's caching technique Link: [http://jes.blogs.shellprompt.net/2007/05/18/apex-delivering-pages-in-3-seconds-or-less/], in a few words this technique consists of adding a header line "Expires: date in the future" in the http response.
    It works very well in IE, the images are cached and the same image can be accessed several times (within the same session or in different sessions) without issuing an http request to the server each time.
    with Firefox it does not work, the same image is asked again and again to the server (i'm using FF 3.5 and APEX 3.2).
    - Is it a date format problem? no, because when i type about:cache in FF, i can find my image in the cache with an expire date in the future.
    The weird thing here is that the counter is incremented each time u request the image, so FF knows it is in the cache and even if the expire date is in the future, FF asks it again to the server.
    - Is it a FF bug? If u read the http specs or if u google a little, u can come to the conclusion that FF does not follow the standards,
    but... images.google.com for example manages to get its images cached with FF.
    They use an http response header "cache-control: public, max-age=604800".
    I tried the same and all kinds of combinations but without success.
    When i compare my image with the one from google in the FF cache, they both have the same attributes.
    - It's not an apex issue neither because it works with IE, most probably an incompatibility between apex and FF?
    Maybe the use of cookie? or the http request (not the response) containing "cache-control: max-age=0"?
    I've found so far 2 half solutions:
    1) use ETag and modified date, see the Tyler Muth's note Link: [http://tylermuth.wordpress.com/2008/02/04/image-caching-in-plsql-applications/].
    with this technique FF continues to send request each time but the answer is shorter because it's just a "304 not modified" instead of "200 OK" (200 response is bigger as it contains the image).
    it's better than nothing but you still have 1 request + 1 response for nothing.
    Another problem is that you need SYS access to implement this, which is not possible on an hosted server. (note that for images from the file system it is already foreseen by apex 3.1, Tyler's note is for images from the db)
    2) if you preload the image (using myimage=new Image();myimage.src='...';), then there is max 1 request per browser session.
    There are 2 minor issues here:
    - no caching across sessions
    - if u don't want to preload all the images (example a page with lots of thumbnails, when user clicks it show a bigger image, in that case the thumbnails can be preloaded but overkill for the big images), then you need to load the image, wait until the image has loaded before displaying it, it does not slow down the execution, but requires some extra JS.
    I'm not asking anyone to investigate it, i can live with the 2 workarounds,
    but just in case someone encountered the same problem and already fixed it.
    Let me know if u managed to use the John Scott's technique with Firefox. (U can use Firebug to see the http traffic)
    Thx
    Tim

    Hi Anshul, hope these help. Let me know if you need to see anything else.
    Best,
    Menu Settings:
    Tab Hyperlink:
    Label Text with with hyper link option not available (works as a hyperlink in chrome and IE though):
    Thanks for the help in advance!

  • Image Caching issues

    I have a question regarding image caches in Safari. Why is it that when I change an image that is on my website, the changes do not show. I'll upload an image with the same name as the previous one and when I go to the browser and refresh the old image is still there. I've tried to refresh, empty cache, and reset safari. I've also done shift+refresh, option+refresh, etc. When i view the page on a pc the changes are made and if they don't show automatically I just use a shift+refresh on the pc and it works. I've also had the same problem with pdfs.
    Has anyone had this problem and if so do you know if there is anything to be done about this?

    Hi Scott,
    I had the same with my website an I did the following ...
    * Trash the whole Safari cache folder ... empty trash
    Go to: Home>UserName>Library>Chashes>Safari
    By the way to 'reload Safari' it is command-R
    Dimaxum

  • Increase still image cache when working only with images?

    I've been having hundreds of out of memory issues when working on a still image project. Thought it was solved but it hasnt.
    If im working totally with still images (Jpegs, Tiffs and PSD's) should I increase the Still Image cache from its default amount? I have scoured the internet trying to find out what the Still Image Cache is but cant find an explanation anywhere.
    I increased it this morning and all is well so far.....
    Might this solve my problem.

    The Still image cache is the amount of RAM assigned to the playback of the stills. That's what that slider adds... it should help to make it larger when you are working with a lot of stills. They are cached to RAM instead of being read from disk...
    From the manual:
    Still Cache: This specifies the amount of RAM used to hold still images for real-time playback. The still cache that is allocated is a percentage of the excess RAM allocated to Final Cut Pro, so adjusting the Application slider also adjusts the amount of RAM available to the still cache. The more RAM allocated to the still cache, the more still frames can be played back in real time in the currently selected sequence. If another sequence is opened, the contents of the still cache are replaced with stills from the new sequence. If there is no excess RAM available, this slider is dimmed.
    Jerry

  • HTML Image cache

    I need to clear the html image cache that mail uses. I get a newsletter with a header image but always see the old image if they have updated it.
    How can I fix this ?
    TIA

    Ok, I found out how to do it, not sure if it will cause any other issues but you have to delete this file
    User/library/caches/com.apple.mail/Cache.db

  • Two days ago, I loaded Light Room 6. Today I went back to Light Room 5. LR 6 corrupted an entire folder of images, and caused errors on my Raid 5 causing win 7 to run "Chk Dsk" and fix the errors to the operating system. LR 5 has not shut down for the las

    Two days ago, I loaded Light Room 6. Today I went back to Light Room 5. LR 6 corrupted an entire folder of images, and caused errors on my Raid 5 causing win 7 to run "Chk Dsk" and fix the errors to the operating system. LR 5 has not shut down for the last 5 hours. LR 6 has a serious bug. Anyone else experiencing this problem. Yesterday I was on tech support, waiting for 3 hours, finally they picked up and informed me there department was closing and someone else would call me on Monday. So, I'm working today and all day Sunday to make up for the down time using LR 6.
    I don't know if the bug exists in the program or the "Creative Cloud.
    Question: Does anyone know why if I bought Light Room 6 [NOT Light Room CC with the monthly rental], I have to enter my serial number if I want to use it?

    Entering the serial number is probably part of the registration process.
    Just out of curiosity, what were you doing on LR6 when the folder of images became corrupted?

Maybe you are looking for