antwankakki / FabricView

A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out
http://antwankakki.github.io/FabricView/
Apache License 2.0
1.04k stars 184 forks source link

Smooth line #6

Closed ghost closed 7 years ago

ghost commented 8 years ago

Sketch is choppy, any way to smooth out drawing lines

antwankakki commented 8 years ago

yeah! sketch got choppy when I switched from redrawing the whole frame into redrawing the minimum rectangle of the area needing to be redrawn (will refer to it as dirty region as of now). It improved performance a bunch but it resulted in the choppy lines you are talking about. I am trying to find a way to have both (or a middle ground) but i don't have much time to concentrate on this as i am taking a lot of classes this semester.

If you don't care as much about the performance upgrades, you can take out the part regarding only redrawing the dirty area and it should be fine.

ghost commented 8 years ago

Thanks for the good library and quick response. one additional note is when repeatly draw cycle very quickly, the un-smooth problem stand out the most.

How do I disable the redrawing dirty area?

antwankakki commented 8 years ago

No problem! I am sorry but I can't get into details right now (I have an interview tomorrow morning, and two midterms in 3 days as well as a project on monday. You can probably even keep the code that redraws the dirty area and tinker around with connecting points in a curve instead of a line (see https://en.wikipedia.org/wiki/Bézier_curve)

Some other resources i recommend looking into are connecting points on a canvas, Spline interpolation (this is probably the best way to go, google "spline interpolation canvas" or stuff like that if you don't have the mathematical foundation for it) I wish i can help more right now but I am extremely busy. Regards

emmanuelproulx commented 7 years ago

We're now using Bezier curves. This issue is fixed.