Sprite designer - drawing

Monkey Forums/Monkey Programming/Sprite designer - drawing

frank(Posted 2012) [#1]
Hi all,

I'm making a small sprite designer which is going fine, however, I cannot seem to manage to get the drawing very efficient;

- I have a simple routine which draws DrawOval with a certain diameter (your pen-width)
- ofcourse when you do that, you are going to have gaps between te points (as your mouse/touch are faster than the drawing?)
- I feel these gaps up by drawing thick lines between all the 2 points ; it's here http://www.monkeycoder.co.nz/Community/posts.php?topic=905
- all pixels as drawn are kept in a pixel array which it redraws OnRender

Ofcourse looking at that code here http://www.monkeycoder.co.nz/Community/posts.php?topic=905 you're ging to see that this is not very efficient and it isn't :) It's super slow; with GLFW target it runs nicely but CPU is 30% here all the time and with HTML canvas it's just unworkable after drawing a few doodles.

In short; how can this be done more efficient? The whole(!) issue is in the thick line drawing; on removing that it's super fast and uses no cpu (at least not noticable).

Thanks

Edit: so to be sure; my current solution works fine (visibly) under android/ios/glfw, but it's a shame of the used CPU


Jesse(Posted 2012) [#2]
try this code see if it's any better, I haven't done any speed tests to compare it though:
http://www.monkeycoder.co.nz/Community/post.php?topic=1846&post=24210


frank(Posted 2012) [#3]
Yes, it's definitely faster, however:

1) It has imperfections: http://o7.no/xlUXXE
2) It crashes immediately after calling on GLFW for me


Jesse(Posted 2012) [#4]
1) that is not an imperfection, it's a property, try it with the rounded end flag = true
2) did you tried the updated version without the division? can you post the source code?


frank(Posted 2012) [#5]
Ouch that was stupid. Yes it works perfectly and it's definitely faster; it works fine in HTML now as well. Thanks a lot!