|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Sujet n° 1469 |
Drawing on Screen |
le 30/10/2006 @ 19:20 par Garfield
|
Hi Everyone
I'm writing a program in which I want to allow the user to draw on the screen. I don't need to record what they're drawing nor do I need to save it or anything - I just want to let them draw within a fixed area of the screen.
The code which allows them to do this is as follows:
REPEAT E=WAITEVENT IF E=1000 GOSUB _Draw ... UNTIL E<0
_Draw: i=PENDOWN IF i=0 RETURN x=PENX:y=PENY IF y<16 RETURN 'if not within the defined IF y>99 RETURN 'area then exit subroutine COLOR 255 'Assumes non-BW screen PSET x,y REPEAT LINETO x,y E=DOEVENTS i=PENDOWN:x=PENX:y=PENY IF y<16 i=0 'if not within the defined IF y>99 i=0 'area then exit subroutine UNTIL i=0 RETURN
Now, this works fine except that it's quite slow. The response is sluggish and if I were to draw a circle it would look more like an octagon than a circle. Also, if I draw something quickly it may not capture it at all.
Am I missing something or is this simply one of iziBasic's limitations? If so, does anyone have an applet that I can call to allow the drawing routine? I'm sure a PP applet would give the user the same sort of response that Note Pad does.
Any help/suggestion would be welcome.
Thanks.
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1 -------- le 31/10/2006 @ 11:41 par aldweb
visiteur |
Hello Garfield,
Your program runs very smoothly and fast in my Tungsten C. The circles I draw are not perfect because I am not too good at drawing circles but they look much more like circles than octagons. I could even write my first name without any special issue.
Your source code may still be optimized a little bit though But I did not notice any huge improvement in the drawing speed as this one was already good with your source code...
_Draw: x=PENX : y=PENY i=PENDOWN*(y>=16)*(y<=99) IF i=0 RETURN COLOR 255 PSET x,y REPEAT LINETO x,y E=WAITEVENT x=PENX : y=PENY i=PENDOWN*(y>=16)*(y<=99) UNTIL i=0 RETURN
A few hints: - calculations (i=) should always be faster than tests (IF i=) - no need to scan with DOEVENTS in this case, a WAITEVENT is better as it should capture the very first event a little bit faster than the DOEVENTS loop which lets go some empty events through the REPEAT/UNTIL loop
Please let me know if you get better performance with these few changes in your source code?
Cheers,
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 2 -------- le 31/10/2006 @ 18:20 par Garfield
visiteur |
Hi Aldweb
Thanks for your answer. It's always good to know faster ways to achieve the same effect. :)
However, after making the changes I haven't noticed very much difference. If I draw at a moderate speed then it does perform well. However, what happens if you sign your name at the speed that you normally sign your name? Does it get captured correctly? Or is that too fast? If I sign my name as I would sign a cheque it looks nothing like what I have drawn. How does yours perform?
For your info, I'm using a Palm T3 which should be more than fast enough.
Please let me know.
Thanks.
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 3 -------- le 31/10/2006 @ 23:25 par aldweb
visiteur |
Hello Garfield,
Here are snapshots made with Snap on my Tungsten C:
Left circle was drawn at the normal speed, when I paid attention to drawing a nice circle. Right circle was drawn as fast as I could and, indeed, there are some straight lines sometimes.
Signing at normal speed.
Signing as fast as I could and, indeed, there are some lines instead of nice curve letters.
Cheers,
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 4 -------- le 01/11/2006 @ 17:42 par Garfield
visiteur |
Hi Aldweb
Many thanks for getting back with such a detailed response.
It looks like the software works fine on your Palm. I don't have Snap to show you what happens on my T3, but I can assure you that if I draw a circle quite fast I can even end up with a triangle! If I sign my name, it looks like a few random lines.
Could I have something else running on my Palm that is slowing it down? Could the T3 have a slow screen response? I can't understand why it would work so well on yours and so badly on mine.
Do you have any ideas?
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 5 -------- le 01/11/2006 @ 18:01 par aldweb
visiteur |
Hello Garfield,
The Tungsten T3 is a device which is almost just as fast as the Tungsten C. Not only the CPU has the same beat, but all benchmark parameters are very good according to my award winning benchmark software being Speedy, at least in Portrait mode (the Landscape mode was a little bit less performing, this was enhanced in later devices like the T5 and the TX), all Speedy reference results can be seen online here: http://www.aldweb.com/articles.php?lng=en&pg=19.
Then, as you could see from the above snapshots, I am using the PalmRevolt skinning application which is known to have an effect on performance, especially on the display speed (about 20% decrease of performance), which is the factor important when considering your application.
Then, I don't have a single clue why performance is not OK in your T3 for this application.
What I suggest is that you try to hard reset your device (after having done at least 2 full backups - remember that HotSync is not a good backup software, use another one...), install only your application and check if you still get bad performance. If everything runs smoothly at this stage, then, indeed, one or more 3rd party application(s), probably running in the background, have a bad effect on your application's performance. But why would this be when my own test on a similar device, a Tungsten C, with the PalmRevolt skinning application running came with good performance?
On my side, I will test in an old Palm Vx, running a 20MHz processor. We'll see... You may do the same with any older device you own.
Cheers,
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 6 -------- le 02/11/2006 @ 18:47 par Garfield
visiteur |
Hi Aldweb
Many thanks for your help. I'm always reluctant to hard reset my device as my synchronisation with Outlook Exchange always does funny things when I do hard reset my device, so I'll believe you!
What I will do is try it out on other devices (my wife's Tungsten T and my brother's Sony) and see how it works.
Thanks.
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 7 -------- le 03/11/2006 @ 09:07 par Garfield
visiteur |
Hi Aldweb
Well, I've tried it on my Dad's Tungsten E and it works fine, much better response than my T3. It must be something I'm running on my Palm that's causing it, and knowing that is good enough for me!
Thanks for your help.
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 8 -------- le 05/11/2006 @ 17:48 par aldweb
visiteur |
Hi Garfield,
To end-up with my own tests, on a very old device being a Palm Vx (running an old DragonBall @ 20 MHz):
Drawing a circle as fast as possible could lead to getting a square! But I think this is quite to be expected on such an old device.
Drawing with care, I got a much nicer circle than with my Tungsten C (which has an ARM proc @ 400 MHz - so about 20 times faster than the Vx).
Cheers, aldweb
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 9 -------- le 13/11/2006 @ 09:58 par aldweb
visiteur |
Hello Garfield,
Even though you have a T3, there seems to be some similar issues with Grafiti on the T5 and the TX. Read here: What on earth did Palm do to grafitti in their NVFS devices?
Wouldn't your T3 suffer from this kind of problem?
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 10 -------- le 13/11/2006 @ 15:45 par Garfield
visiteur |
Hi Aldweb
Nope, my T3 doesn't suffer from this. The writing is fine in the graffiti area, and if I load up Note Pad, no matter how fast I draw, my circles are always round, never octagonal or any other multi-sided polygon, and believe me I've drawn circles as fast as I possibly can!
I only have this problem with my iziBasic program. Everything else works fine. To be honest, I'm pretty sure that if I hard-reset my T3 it would then work fine. I just don't want to go through that hassle. Knowing that it works on your Palm and on my Dad's Tungsten E has convinced me that it's just my T3 doing something funny.
However, if anyone else with a T3 wants to give it a go please go ahead and let me know the results.
Thanks.
|
|
|
sujet actif
sujet clos
Important!
Nouveau message -
Rectifier message
Clôturer sujet
Remonter
|
|