geftimov / android-pathview

Android view with both path from constructed path or from svg.
Apache License 2.0
2.91k stars 513 forks source link

stroke-linecap is being ignored #7

Closed casper1149 closed 9 years ago

casper1149 commented 9 years ago

Hi,

I am trying to draw a path, smth like an arch with rounded corners, however "stroke-linecap" parameter seems to be skipped and so the result image is without rounded corners.

svg example:

layout: <com.eftimoff.androipathview.PathView xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/archLeftPathView" android:layout_width="180dp" android:layout_height="180dp" app:pathColor="@android:color/white" app:svg="@raw/arc_left" app:pathWidth="60"/>

may be I am missing smth?

You can verify the svg using smth like http://www.rapidtables.com/web/tools/svg-viewer-editor.htm

geftimov commented 9 years ago

@casper1149

Well , unfortunately when getting the path from the svg i use only the color and the width.

The Paint object itself draws stroke with anti-alias. The solution is to catch and set the stroke-linecap.

Is this good for you?

geftimov commented 9 years ago

@casper1149

I have done changes in the library and it should work for you without problems. It is for version 1.0.4.

Thanks for the feedback, Georgi Eftimov

casper1149 commented 9 years ago

@geftimov great, thank you, I will verify the fix

casper1149 commented 9 years ago

@geftimov hm, stroke-width ok, but what about stroke-linecap, for me it still draws a line without rounded ends. I assume mSourcePaint.getStrokeCap() is requried to be used here.