Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Performance on Bitmap?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-08-2007, 03:49 PM
Junior Member
 
Join Date: Dec 2007
Location: Germany
Posts: 20
Question Performance on Bitmap?

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 ?
Reply With Quote
  #2 (permalink)  
Old 12-08-2007, 04:10 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,335
Default

What do you mean with scrolling?
Reply With Quote
  #3 (permalink)  
Old 12-08-2007, 04:38 PM
Junior Member
 
Join Date: Dec 2007
Location: Germany
Posts: 20
Default

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)
Reply With Quote
  #4 (permalink)  
Old 12-08-2007, 06:08 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,335
Default

You should use DrawImage instead.
I've attached a small example of a scrolling bitmap (the bitmap size is 1460x40).
Attached Files
File Type: zip ScrollImage.zip (7.1 KB, 38 views)
Reply With Quote
  #5 (permalink)  
Old 12-08-2007, 09:15 PM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default Flo

And Ive TouchFlowed it (PDA only)
Attached Files
File Type: sbp Flo.sbp (623 Bytes, 17 views)

Last edited by colin9876 : 12-08-2007 at 09:21 PM.
Reply With Quote
  #6 (permalink)  
Old 12-09-2007, 12:44 PM
Junior Member
 
Join Date: Dec 2007
Location: Germany
Posts: 20
Default

Quote:
Originally Posted by Erel View Post
You should use DrawImage instead.
I've attached a small example of a scrolling bitmap (the bitmap size is 1460x40).
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 by Roadrunner : 02-26-2008 at 07:13 AM.
Reply With Quote
  #7 (permalink)  
Old 12-09-2007, 02:39 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 487
Awards Showcase
Beta Tester 
Total Awards: 1
Default

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
File Type: zip ScrollImage3.zip (7.3 KB, 23 views)
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #8 (permalink)  
Old 12-09-2007, 02:52 PM
Junior Member
 
Join Date: Dec 2007
Location: Germany
Posts: 20
Default

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
Reply With Quote
  #9 (permalink)  
Old 12-09-2007, 02:57 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,335
Default

I think that this example is what you've wanted.
Attached Files
File Type: sbp ScrollImage.sbp (1.6 KB, 38 views)
Reply With Quote
  #10 (permalink)  
Old 12-09-2007, 03:19 PM
Junior Member
 
Join Date: Dec 2007
Location: Germany
Posts: 20
Default

I'm speechless - thank you very much Erel!

For me, today it's christmas
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bitmap Value Lost? fjsantos Questions & Help Needed 7 06-16-2008 07:04 PM
Performance vs Memory RandomCoder Questions & Help Needed 4 02-10-2008 05:03 PM
Background-Color on Bitmap.new2 Roadrunner Bug Reports 1 12-08-2007 04:08 PM
Out of Memory error while loading bitmap HARRY Questions & Help Needed 3 05-15-2007 01:12 PM


All times are GMT. The time now is 06:42 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0