Performance on Bitmap?

Discussion in 'Questions (Windows Mobile)' started by Roadrunner, Dec 8, 2007.

  1. Roadrunner

    Roadrunner Member Licensed User

    Hello there,

    I've got a bitmap which have a grid (horizontal and vertical lines).
    In this grid I'm plotting values from left to right.

    If I'm on the right end I will scroll the bitmap one pixel to the left.
    To do that I have a loop that counts on bitmap.width.
    Within that loop there is another loop (bitmap.height) reading the pixel color of the right neightbor and plots them to the actual position.

    On the desktop application it's fast enough to have a "scrolling effect". But on my mobile device it's extremly slow and totally unusable.

    The bitmap have a size of 100x80 - so there are 8000 get / setpixel-commands. Too much for my mobile :(

    Does anyone have an idea to scroll bitmaps ? :sign0085:
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    What do you mean with scrolling?
     
  3. Roadrunner

    Roadrunner Member Licensed User

    Scrolling means that the whole image will be moved by one pixel to the left. The now missing pixel on the right will be redrawn.
    If this will be done every second, you have a scrolling effect (like on jump'n'run games)

    There is some example of my code:

    Code:
    For i=0 To bitmap1.Width-2
       
    For ii=1 To bitmap1.Height-2
       wi.text = i
       wii.text = ii
       col = bitmap1.getpixel1(i+
    1,ii)
       
    Select col
       
    Case cWhite 
          bitmap1.SetPixel(i,ii,cWhite)
       
    Case cBlack 
          bitmap1.SetPixel(i,ii,cBlack)
       
    Case cRed 
          bitmap1.SetPixel(i,ii,cRed)
       
    End Select
       bitmap1.SetPixel(bitmap1.width-
    1,ii,cWhite)
          
    Next ii
       
    Next i
       bitmap1.SetPixel(noscroll-
    2,wert+120,cRed)
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You should use DrawImage instead.
    I've attached a small example of a scrolling bitmap (the bitmap size is 1460x40).
     

    Attached Files:

  5. colin9876

    colin9876 Active Member Licensed User

    Flo

    And Ive TouchFlowed it (PDA only)
     

    Attached Files:

    • Flo.sbp
      File size:
      623 bytes
      Views:
      28
    Last edited: Dec 8, 2007
  6. Roadrunner

    Roadrunner Member Licensed User

    Thanks for your reply :)

    My main problem is that I don't have a fixed image.
    On start I'm drawing my grid bitmap. Then on every timer event I'm adding a pixel (value of a measurement) on that grid. After that I have to scroll the whole bitmap on one pixel and have to redraw the grid on the right side.

    I attached my example for a better understanding.
     
    Last edited: Feb 26, 2008
  7. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Your example didn't do anything???
    Why was the yearup image commented out?

    Anyway, I've made a couple of changes, hope it's what you had in mind.

    Regards,
    RandomCoder
     

    Attached Files:

  8. Roadrunner

    Roadrunner Member Licensed User

    Think I got it fixed now...

    Normally I'm drawing my values in the bitmap directly so I have to work with the whole bitmap.

    Now I'm changed it to a really bitmap-file, put my values into an array and now scrolling in the way Erel is doing and then start again at the beginning.

    So I only have to redraw my values into the bitmap every 10 times.

    Thanks all for your help :sign0060:
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    I think that this example is what you've wanted.
     

    Attached Files:

  10. Roadrunner

    Roadrunner Member Licensed User

    I'm speechless - thank you very much Erel!

    For me, today it's christmas :D
     
Loading...