×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    32

    Speed of Image.createImage

    Hi,


    What is the speed of Image.createImage? Is it possible to use it in the paint method while still retaining resonable speed?


    /brian

  2. #2
    Registered User
    Join Date
    Dec 2004
    Posts
    4
    try to use
    System.currentTimeMillis();
    to calculate speed of Image.createImage(..)

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    32
    Yes - thanks for your suggestion.

    Par se, I am not that interested in the actual speed (in time) of Image.createImage.

    The situation: I created a small midlet - I designed it while using the Nokia 6230 emulator. In the midlet I preload all graphics (one animation of 10 frames (90 x90 pixels each)) and one "Background" image.
    The target device is a Nokia 3100.
    While the midlet runs fine on a real Nokia 6230 device it actually refused to run on a 3100.
    I found out, that the preloading of the images somehow exhausted the heap/stack/whatever.
    So I redesigned the midlet - this time the paint method loads the images and 'nulls' the handle after painting the image. And now it works on a 3100 as well.

    My questions, then, are:

    Is Image.createImage fast enough to actually be used this way in a game? Ie. where you may have multiple images to draw ..?

    /brian

  4. #4
    Regular Contributor
    Join Date
    Jan 2004
    Posts
    165
    It's no surprise you used up all the heap, those images will take around 160k when loaded and on top of the background image you will have just about have exhausted your heap on a low-end series 40 phone.

    I doubt you'll be able to use that method usefully in a game as you will more than *likely* have the garbage collector running more often than you really want. Loading up a graphic in this way is slower than pre-loading.

    I am just curious as to what application you have that needs 10 frames of that size? On a series 40 phone 90x90 is a fair percentage of the screen. The better method would be to try and optimise the frames.

  5. #5
    Registered User
    Join Date
    May 2003
    Posts
    32
    Heh - I learned the hard way :-)

    I was doing a simple demo application for my girlfriend. The animation contained some flying
    hearts.
    I did consider breaking up the animation in smaller segments. But due to lack of time, I chose to stick with the loadImage during paint().
    It worked out nicely ... (even on a Nokia 3100 :-)

    /brian

Posting Permissions

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