×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    21

    Which one is the fastest (in drawing) ?

    Hi!

    For my new game (for Series 40) I'm thinking about the way to draw the sprites etc.

    Thinking about this I came to 4 possible solutions:

    1. Drawing direct to the screen.
    2. Drawing into an Image and then using drawImage() for displaying it on the screen after finishing painting
    3. Drawing into a pixelbuffer, then using drawPixels from the NokiaUI to display the screen after painting
    4. Drawing into an Image, and after finishing getting the pixelbuffer for the Image with getPixels() and then finally draw it to the screen via drawPixels().

    My solution is that the 1st way seems to be the slowest.
    Drawing into an Image seems to be easier than drawing into a pixelbuffer. But in this forum I already read that using drawImage() seems to be slower (showing in flickering) than using drawPixels().
    To me, way no. 4 seems to be very interesting!

    What do you think?
    Thanks for your suggestions and tips!!

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    How you blit the final result onto the screen is the least important part. For maximum performance on Series 40 phones you should be drawing your sprites with drawPixels() (since drawing the sprites is the part that takes the most time). You could draw them directly to the screen (since those devices are internally double buffered), or onto a pixel buffer that you then blit to the screen with drawPixels().

    shmoove

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    21
    Thanks for your answer!!

    There comes antoher questions to me: What is the "slow" part in drawImage() ? Is it actually drawing the pixels on the screen, or is it setting the color values?
    I just want to know if it's even slow using drawImage() to draw an Image onto an Image that is currently NOT SHOWN (therefore actually no pixels have to be drawn on screen)?

    What do you think about way no. 4 mentioned in my previous post? Would this way cause the screen to flicker? This way would be much easier to implement than drawing into a pixelbuffer directly!

    Thanks alot again for help!!!

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    I don't know exactly what causes drawImage() to be slower. I believe it is because the colors have to be adjusted to the format supported by the phone before they can be blitted on.
    Way no. 4 seems like doing too much. If you're already drawing onto an Image then you might as well be drawing directly on the screen. I don't think you'll get any flickering since the devices are internally double buffered, which means that drawing "directly to the screen" is actually drawing to a buffer that then gets blitted onto the screen.
    I think you should try to load the sprites as pixel buffers and use drawPixels() to draw them directly on screen, or if that fails draw them onto an Image and then drawImage() it onto the screen.

  5. #5
    Registered User
    Join Date
    Oct 2003
    Posts
    21
    Thank you very very much again!!

    So I'll have to find a way to load the images into a pixelbuffer.

    Have a nice day.

Posting Permissions

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