gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Drawing trouble

#122009 - FRuMMaGe - Fri Mar 16, 2007 11:37 am

On my paint program, when I draw fast, the line seems pixellated. Ie, there are lots of gaps. i know the cause of the problem is probably the frame rate, but currently I have no solution other than drawing slowly.

I would really appreciate it if someone could give me a formula that I could incorporate into my program that will fill in the gaps between pixels.

Also, occasionally, there is a random pixel actiavted on my screen when i'm drawing. I've noticed this on every other homebrew drawing utility and I would just like to know the cause.

Thanks!

#122014 - kusma - Fri Mar 16, 2007 12:26 pm

ehm, how about a normal line-drawing routine? :)


edit: here's a link to more info: http://en.wikipedia.org/wiki/Line_drawing_algorithm

#122023 - silent_code - Fri Mar 16, 2007 2:30 pm

like some fast bresenham. there are even faster ones, but that one should work well. instead of points, now you draw lines between touches. if the distance is small to medium, you'll not notice the difference. if you have rather big gaps, you'll see the line segments, but that's better than gaps, i guess.

Last edited by silent_code on Fri Mar 16, 2007 8:25 pm; edited 1 time in total

#122035 - kusma - Fri Mar 16, 2007 5:22 pm

yeah, you really need to optimize when you're drawing one line pr frame...

#122068 - FRuMMaGe - Fri Mar 16, 2007 9:18 pm

This is interesting. However, i'm very new to this and have no idea how to implement it into my program. Any pointers?

#122162 - silent_code - Sat Mar 17, 2007 2:36 pm

what exactly is it that you need help with? is it the line algorithm (in the worst case you can just google for it and copy-and-paste it to your program [overdramatized ;^p ]) or what? please clarify.

#122183 - FRuMMaGe - Sat Mar 17, 2007 7:19 pm

Well i started out with a program to move a square around the screen with the stylus. Then i made a mistake and didn't delete the old shape each time the new one was drawn, thus leaving trails. So I decided to make it into a paint program ^^.

I just need a way of making it draw the line properly, no matter how fast you move the stylus.