harjot-oberai / VectorMaster

Dynamic control over vector drawables!
MIT License
1.59k stars 161 forks source link

Vector drawable not drawn properly #7

Closed hivian closed 6 years ago

hivian commented 6 years ago

Hi.

I'm having a display bug when I want to use this vector drawable (SVG file exported with Adobe Illustrator, then converted to VectorDrawable) in a VectorMasterDrawable object. Some paths are missing or deformed, but only with your library, not with the Android drawable API. Can you explain me why ?

ic_201.zip

Thank you in advance.

harjot-oberai commented 6 years ago

For the functionalities provided by the library, I had to parse the XML manually, but all the path parsing code has been shifted to native after API 21 and hence could not be used directly in the library. Therefore the code for parsing the xml is somewhat outdated even though I tried to port some changes from native back to java.

So the drawable API in android is updated and hence draws the vector perfectly, but the path parser I use is from API 21, therefore it is not able to draw the vector properly.

You may try to set use_legacy_parser="false". Setting this parameter will make the library use a 3rd party Path Parser for parsing the xml and it may render the vector properly.

I will have a look at the vector and try to change the parsing logic to remove the errors.

Cheers!

hivian commented 6 years ago

I tried using setUseLegacyParser(boolean). Here is the result:

Android drawable api 26

screen shot 2017-12-28 at 12 27 06

VectorMaster: use_legacy_parser="true"

screen shot 2017-12-28 at 12 18 50

VectorMaster: use_legacy_parser="false"

screen shot 2017-12-28 at 12 18 12

It is better but some imperfections subsist.

Anyway, thanks for your hard work!