| Reply | « Previous Thread | Next Thread » |
|
Hi,
What is the speed of Image.createImage? Is it possible to use it in the paint method while still retaining resonable speed? /brian |
| brilleaben |
| View Public Profile |
| Find all posts by brilleaben |
|
try to use
System.currentTimeMillis(); to calculate speed of Image.createImage(..) |
|
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 |
| brilleaben |
| View Public Profile |
| Find all posts by brilleaben |
|
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. |
|
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 |
| brilleaben |
| View Public Profile |
| Find all posts by brilleaben |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|