bmarrdev / android-DecoView-charting

DecoView: Android arc based animated charting library
Apache License 2.0
991 stars 194 forks source link

Add more flexible end cap styles #6

Closed nealsanche closed 8 years ago

nealsanche commented 9 years ago
nealsanche commented 8 years ago

Downside of this clip path drawing technique is that the concave endcap is not antialiased and so looks poor under close scrutiny. See:

http://stackoverflow.com/questions/2719535/how-do-i-antialias-the-clip-boundary-on-androids-canvas

So, a bitmap rendering technique would have to be developed. I'll have a look into this soon.

bmarrdev commented 8 years ago

Thanks Neal, yeah the lack of anti alias clipping is an issue. I hope to be able to build a solution that overcomes this and the other issues with adding end caps, although I don't have the time at the moment. Feel free to explore alternative solutions.

nealsanche commented 8 years ago

Thanks Brent, I will do so. It's an interesting exercise going through the Android canvas stuff and seeing what it actually looks like when rendered. Screen resolution is almost high enough now that the non-antialiasing was almost missed. But as soon as I enabled the triple-tap to magnify gesture, it was pretty obvious that it wasn't looking very good.

I'll iterate, and hopefully it'll help you bring it back into the library in a way you're happy with.

nealsanche commented 8 years ago

This morning I tried using PorterDuff.Mode.CLEAR, which involved drawing into an offscreen bitmap, because the PorterDuff modes only work on bitmaps, apparently. This technique works, but even if I only create the bitmaps and paints once during the drawing cycle, there is a significant slow-down to the simple arc painting technique used currently.

It might be possible to just draw the end-cap into a small bitmap, use the current masking technique to replace only the end-cap part of the image.

I'll leave this branched for now. It's definitely a step backwards, performance wise.